@imtbl/sdk 0.2.3-alpha → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +32 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.cjs +5950 -29145
- package/dist/index.d.ts +6328 -24265
- package/dist/index.js +5971 -29152
- package/dist/passport.js +1 -1
- package/package.json +4 -26
- package/dist/blockchain-data.d.ts +0 -1893
- package/dist/blockchain-data.js +0 -5666
- package/dist/browser/checkout.js +0 -2
- package/dist/checkout_sdk.d.ts +0 -1185
- package/dist/checkout_sdk.js +0 -13768
- package/dist/checkout_widgets.d.ts +0 -15381
- package/dist/checkout_widgets.js +0 -276
- package/dist/erc20.d.ts +0 -296
- package/dist/erc20.js +0 -371
- package/dist/erc721-permissioned-mintable.d.ts +0 -435
- package/dist/erc721-permissioned-mintable.js +0 -1165
- package/dist/orderbook.d.ts +0 -81
- package/dist/orderbook.js +0 -1983
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).immutable={})}(this,(function(e){"use strict";var t;e.Environment=void 0,(t=e.Environment||(e.Environment={})).PRODUCTION="production",t.SANDBOX="sandbox";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}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}var o={exports:{}},s="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,f=!1;function d(){f=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)a[t]=e[t],u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function h(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(a[(i=n)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}function l(e){var t;f||d();for(var r=e.length,n=r%3,i="",o=[],s=16383,u=0,c=r-n;u<c;u+=s)o.push(h(e,u,u+s>c?c:u+s));return 1===n?(t=e[r-1],i+=a[t>>2],i+=a[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=a[t>>10],i+=a[t>>4&63],i+=a[t<<2&63],i+="="),o.push(i),o.join("")}function p(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,d=r?i-1:0,h=r?-1:1,l=e[t+d];for(d+=h,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+e[t+d],d+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+d],d+=h,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),o-=c}return(l?-1:1)*s*Math.pow(2,o-n)}function g(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,d=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=f?(a=0,s=f):s+d>=1?(a=(t*u-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+l]=255&a,l+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+l]=255&s,l+=p,s/=256,c-=8);e[r+l-p]|=128*g}var m={}.toString,y=Array.isArray||function(e){return"[object Array]"==m.call(e)};_.TYPED_ARRAY_SUPPORT=void 0===s.TYPED_ARRAY_SUPPORT||s.TYPED_ARRAY_SUPPORT;var b=v();function v(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function w(e,t){if(v()<t)throw new RangeError("Invalid typed array length");return _.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=_.prototype:(null===e&&(e=new _(t)),e.length=t),e}function _(e,t,r){if(!(_.TYPED_ARRAY_SUPPORT||this instanceof _))return new _(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return S(this,e)}return E(this,e,t,r)}function E(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);_.TYPED_ARRAY_SUPPORT?(e=t).__proto__=_.prototype:e=k(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!_.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|R(t,r);e=w(e,n);var i=e.write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(T(t)){var r=0|x(t.length);return 0===(e=w(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?w(e,0):k(e,t);if("Buffer"===t.type&&y(t.data))return k(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function A(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function S(e,t){if(A(t),e=w(e,t<0?0:0|x(t)),!_.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function k(e,t){var r=t.length<0?0:0|x(t.length);e=w(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function x(e){if(e>=v())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v().toString(16)+" bytes");return 0|e}function T(e){return!(null==e||!e._isBuffer)}function R(e,t){if(T(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 te(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return re(e).length;default:if(n)return te(e).length;t=(""+t).toLowerCase(),n=!0}}function O(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 H(this,t,r);case"utf8":case"utf-8":return F(this,t,r);case"ascii":return z(this,t,r);case"latin1":case"binary":return K(this,t,r);case"base64":return D(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function M(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function I(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)),T(t))return 0===t.length?-1:P(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):P(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function P(e,t,r,n,i){var o,s=1,a=e.length,u=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;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var d=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){d=!1;break}if(d)return o}return-1}function C(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(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 s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function N(e,t,r,n){return ne(te(t,e.length-r),e,r,n)}function B(e,t,r,n){return ne(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function j(e,t,r,n){return B(e,t,r,n)}function L(e,t,r,n){return ne(re(t),e,r,n)}function U(e,t,r,n){return ne(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function D(e,t,r){return 0===t&&r===e.length?l(e):l(e.slice(t,r))}function F(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,c=e[i],f=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(f=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,d=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=d}return function(e){var t=e.length;if(t<=q)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=q));return r}(n)}_.poolSize=8192,_._augment=function(e){return e.__proto__=_.prototype,e},_.from=function(e,t,r){return E(null,e,t,r)},_.TYPED_ARRAY_SUPPORT&&(_.prototype.__proto__=Uint8Array.prototype,_.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&_[Symbol.species]),_.alloc=function(e,t,r){return function(e,t,r,n){return A(t),t<=0?w(e,t):void 0!==r?"string"==typeof n?w(e,t).fill(r,n):w(e,t).fill(r):w(e,t)}(null,e,t,r)},_.allocUnsafe=function(e){return S(null,e)},_.allocUnsafeSlow=function(e){return S(null,e)},_.isBuffer=ie,_.compare=function(e,t){if(!T(e)||!T(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},_.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},_.concat=function(e,t){if(!y(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return _.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=_.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!T(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},_.byteLength=R,_.prototype._isBuffer=!0,_.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)M(this,t,t+1);return this},_.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)M(this,t,t+3),M(this,t+1,t+2);return this},_.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)M(this,t,t+7),M(this,t+1,t+6),M(this,t+2,t+5),M(this,t+3,t+4);return this},_.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?F(this,0,e):O.apply(this,arguments)},_.prototype.equals=function(e){if(!T(e))throw new TypeError("Argument must be a Buffer");return this===e||0===_.compare(this,e)},_.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},_.prototype.compare=function(e,t,r,n,i){if(!T(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),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),c=e.slice(t,r),f=0;f<a;++f)if(u[f]!==c[f]){o=u[f],s=c[f];break}return o<s?-1:s<o?1:0},_.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},_.prototype.indexOf=function(e,t,r){return I(this,e,t,r,!0)},_.prototype.lastIndexOf=function(e,t,r){return I(this,e,t,r,!1)},_.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(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 C(this,e,t,r);case"utf8":case"utf-8":return N(this,e,t,r);case"ascii":return B(this,e,t,r);case"latin1":case"binary":return j(this,e,t,r);case"base64":return L(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(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 q=4096;function z(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function K(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function H(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=ee(e[o]);return i}function G(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function W(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function V(e,t,r,n,i,o){if(!T(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function X(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function J(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function $(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 Y(e,t,r,n,i){return i||$(e,0,r,4),g(e,t,r,n,23,4),r+4}function Q(e,t,r,n,i){return i||$(e,0,r,8),g(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),t<e&&(t=e),_.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=_.prototype;else{var i=t-e;r=new _(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},_.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||W(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},_.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||W(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},_.prototype.readUInt8=function(e,t){return t||W(e,1,this.length),this[e]},_.prototype.readUInt16LE=function(e,t){return t||W(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUInt16BE=function(e,t){return t||W(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUInt32LE=function(e,t){return t||W(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||W(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||W(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},_.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||W(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||W(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){t||W(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt16BE=function(e,t){t||W(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||W(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||W(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||W(e,4,this.length),p(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return t||W(e,4,this.length),p(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return t||W(e,8,this.length),p(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return t||W(e,8,this.length),p(this,e,!1,52,8)},_.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||V(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},_.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||V(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},_.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||V(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||V(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},_.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||V(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},_.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||V(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):J(this,e,t,!0),t+4},_.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||V(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):J(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);V(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},_.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);V(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},_.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||V(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||V(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):X(this,e,t,!0),t+2},_.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||V(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):X(this,e,t,!1),t+2},_.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||V(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):J(this,e,t,!0),t+4},_.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||V(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):J(this,e,t,!1),t+4},_.prototype.writeFloatLE=function(e,t,r){return Y(this,e,t,!0,r)},_.prototype.writeFloatBE=function(e,t,r){return Y(this,e,t,!1,r)},_.prototype.writeDoubleLE=function(e,t,r){return Q(this,e,t,!0,r)},_.prototype.writeDoubleBE=function(e,t,r){return Q(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<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!_.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},_.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!_.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=T(e)?e:te(new _(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var Z=/[^+\/0-9A-Za-z-_]/g;function ee(e){return e<16?"0"+e.toString(16):e.toString(16)}function te(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+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 re(e){return function(e){var t,r,n,i,o,s;f||d();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new c(3*a/4-o),n=o>0?a-4:a;var h=0;for(t=0,r=0;t<n;t+=4,r+=3)i=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],s[h++]=i>>16&255,s[h++]=i>>8&255,s[h++]=255&i;return 2===o?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,s[h++]=255&i):1===o&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,s[h++]=i>>8&255,s[h++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ne(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function ie(e){return null!=e&&(!!e._isBuffer||oe(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&oe(e.slice(0,0))}(e))}function oe(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var se=i(Object.freeze({__proto__:null,Buffer:_,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),_.alloc(+e)},isBuffer:ie,kMaxLength:b}));!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:se.Buffer}catch(e){}function s(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 a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function u(e,t,n,i){for(var o=0,s=0,a=Math.min(e.length,n),u=t;u<a;u++){var c=e.charCodeAt(u)-48;o*=i,s=c>=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&s<i,"Invalid character"),o+=s}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,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<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f<a;f+=n)c=u(e,f,f+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var d=1;for(c=u(e,f,e.length,t),f=0;f<s;f++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(e){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);o=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,s--),n=0!==o||s!==this.length-1?d[6-u.length]+u+n:u+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 c=h[e],f=l[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modrn(f).toString(e);n=(p=p.idivn(f)).isZero()?g+n:d[c-g.length]+g+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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var f=u>>>26,d=67108863&u,h=Math.min(c,t.length-1),l=Math.max(0,c-e.length+1);l<=h;l++){var p=c-l|0;f+=(s=(i=0|e.words[p])*(o=0|t.words[l])+d)/67108864|0,d=67108863&s}r.words[c]=0|d,u=0|f}return 0!==u?r.words[c]=0|u: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 s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,i),s},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===o?(r<e.length&&(e[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===o?(r>=0&&(e[r--]=s>>24&255),n=0,o=0):(n=s>>>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 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},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<<i:this.words[n]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var 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,s=0;s<n.length;s++)o=(t=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<r.length;s++)o=(t=(0|r.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var n,i,o,s=e.words,a=t.words,u=r.words,c=0,f=0|s[0],d=8191&f,h=f>>>13,l=0|s[1],p=8191&l,g=l>>>13,m=0|s[2],y=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,S=E>>>13,k=0|s[5],x=8191&k,T=k>>>13,R=0|s[6],O=8191&R,M=R>>>13,I=0|s[7],P=8191&I,C=I>>>13,N=0|s[8],B=8191&N,j=N>>>13,L=0|s[9],U=8191&L,D=L>>>13,F=0|a[0],q=8191&F,z=F>>>13,K=0|a[1],H=8191&K,G=K>>>13,W=0|a[2],V=8191&W,X=W>>>13,J=0|a[3],$=8191&J,Y=J>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,fe=0|a[8],de=8191&fe,he=fe>>>13,le=0|a[9],pe=8191&le,ge=le>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(c+(n=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(h,q)|0))<<13)|0;c=((o=Math.imul(h,z))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(g,q)|0,o=Math.imul(g,z);var ye=(c+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(b,q)|0,o=Math.imul(b,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,G)|0;var be=(c+(n=n+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,V)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,X)|0;var ve=(c+(n=n+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(A,q),i=(i=Math.imul(A,z))+Math.imul(S,q)|0,o=Math.imul(S,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,Y)|0;var we=(c+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(T,q)|0,o=Math.imul(T,z),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,ee)|0;var _e=(c+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(O,q),i=(i=Math.imul(O,z))+Math.imul(M,q)|0,o=Math.imul(M,z),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0;var Ee=(c+(n=n+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(C,q)|0,o=Math.imul(C,z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(c+(n=n+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(j,q)|0,o=Math.imul(j,z),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,ce)|0;var Se=(c+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,z))+Math.imul(D,q)|0,o=Math.imul(D,z),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(j,H)|0,o=o+Math.imul(j,G)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,he)|0;var ke=(c+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,G))+Math.imul(D,H)|0,o=Math.imul(D,G),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(j,V)|0,o=o+Math.imul(j,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,se)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,he)|0)+Math.imul(b,de)|0,o=o+Math.imul(b,he)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,X))+Math.imul(D,V)|0,o=Math.imul(D,X),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,Y)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,n=n+Math.imul(A,ue)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Te=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,Y))+Math.imul(D,$)|0,o=Math.imul(D,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(j,Z)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(T,ue)|0,o=o+Math.imul(T,ce)|0,n=n+Math.imul(A,de)|0,i=(i=i+Math.imul(A,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Re=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,ee))+Math.imul(D,Z)|0,o=Math.imul(D,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(T,de)|0,o=o+Math.imul(T,he)|0;var Oe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(D,re)|0,o=Math.imul(D,ne),n=n+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,se)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(O,de)|0,i=(i=i+Math.imul(O,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var Me=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ge)|0)+Math.imul(T,pe)|0))<<13)|0;c=((o=o+Math.imul(T,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(D,oe)|0,o=Math.imul(D,se),n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(j,ue)|0,o=o+Math.imul(j,ce)|0,n=n+Math.imul(P,de)|0,i=(i=i+Math.imul(P,he)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,he)|0;var Ie=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,ue),i=(i=Math.imul(U,ce))+Math.imul(D,ue)|0,o=Math.imul(D,ce),n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(j,de)|0,o=o+Math.imul(j,he)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ge)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,de),i=(i=Math.imul(U,he))+Math.imul(D,de)|0,o=Math.imul(D,he);var Ce=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(j,pe)|0))<<13)|0;c=((o=o+Math.imul(j,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Ne=(c+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(D,pe)|0))<<13)|0;return c=((o=Math.imul(D,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=me,u[1]=ye,u[2]=be,u[3]=ve,u[4]=we,u[5]=_e,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=ke,u[10]=xe,u[11]=Te,u[12]=Re,u[13]=Oe,u[14]=Me,u[15]=Ie,u[16]=Pe,u[17]=Ce,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var f=o-c,d=(0|e.words[f])*(0|t.words[c]),h=67108863&d;a=67108863&(h=h+a|0),i+=(s=(s=s+(d/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function y(e,t,r){return m(e,t,r)}Math.imul||(g=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?p(this,e,t):r<1024?m(this,e,t):y(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),y(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<this.length;i++){var o=(0|this.words[i])*e,s=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=s>>>26,this.words[i]=67108863&s}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<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<n;this.words[t]=u|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var d=0|this.words[c];this.words[c]=f<<26-o|d>>>o,f=d&a}return u&&0!==f&&(u.words[u.length++]=f),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<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this._strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var f=n.clone()._ishlnsubmul(o,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var d=u-1;d>=0;d--){var h=67108864*(0|n.words[o.length+d])+(0|n.words[o.length+d-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(o,h,d);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(o,1,d),n.isZero()||(n.negative^=1);a&&(a.words[d]=h)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):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,s,a},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),s=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(d)),o.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(d)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(u)):(n.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(c)}},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,s=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var d=0,h=1;0==(n.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).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 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(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 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 _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(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){S.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=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?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<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}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<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(E,v),n(A,v),A.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=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 w;else if("p224"===e)t=new _;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new A}return b[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.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)},S.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},S.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)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.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),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var d=this.pow(f,o),h=this.pow(e,o.addn(1).iushrn(1)),l=this.pow(e,o),p=s;0!==l.cmp(a);){for(var g=l,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var y=this.pow(d,new i(1).iushln(p-m-1));h=h.redMul(y),d=y.redSqr(),l=l.redMul(d),p=m}return h},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var d=c>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===n&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},n(k,S),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),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,r)}(o);var ae=o.exports,ue=n(ae);let ce=!1,fe=!1;const de={debug:1,default:2,info:2,warning:3,error:4,off:5};let he=de.default,le=null;const pe=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 ge,me;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(ge||(ge={})),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"}(me||(me={}));const ye="0123456789abcdef";let be=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==de[r]&&this.throwArgumentError("invalid log level name","logLevel",e),he>de[r]||console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(fe)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=ye[t[e]>>4],r+=ye[15&t[e]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=t;let s="";switch(r){case me.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case me.CALL_EXCEPTION:case me.INSUFFICIENT_FUNDS:case me.MISSING_NEW:case me.NONCE_EXPIRED:case me.REPLACEMENT_UNDERPRICED:case me.TRANSACTION_REPLACED:case me.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(t+=" ("+i.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){pe&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:pe})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return le||(le=new e("logger/5.7.0")),le}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),ce){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fe=!!t,ce=!!r}static setLogLevel(t){const r=de[t.toLowerCase()];null!=r?he=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};be.errors=me,be.levels=ge;const ve=new be("bytes/5.7.0");function we(e){return!!e.toHexString}function _e(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return _e(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Ee(e){return Re(e)&&!(e.length%2)||Se(e)}function Ae(e){return"number"==typeof e&&e==e&&e%1==0}function Se(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Ae(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Ae(r)||r<0||r>=256)return!1}return!0}function ke(e,t){if(t||(t={}),"number"==typeof e){ve.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),_e(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),we(e)&&(e=e.toHexString()),Re(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":ve.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return _e(new Uint8Array(n))}return Se(e)?_e(new Uint8Array(e)):ve.throwArgumentError("invalid arrayify value","value",e)}function xe(e){const t=e.map((e=>ke(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),_e(n)}function Te(e){let t=ke(e);if(0===t.length)return t;let r=0;for(;r<t.length&&0===t[r];)r++;return r&&(t=t.slice(r)),t}function Re(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const Oe="0123456789abcdef";function Me(e,t){if(t||(t={}),"number"==typeof e){ve.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=Oe[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),we(e))return e.toHexString();if(Re(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":ve.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Se(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=Oe[(240&n)>>4]+Oe[15&n]}return t}return ve.throwArgumentError("invalid hexlify value","value",e)}function Ie(e){if("string"!=typeof e)e=Me(e);else if(!Re(e)||e.length%2)return null;return(e.length-2)/2}function Pe(e,t,r){return"string"!=typeof e?e=Me(e):(!Re(e)||e.length%2)&&ve.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function Ce(e){let t="0x";return e.forEach((e=>{t+=Me(e).substring(2)})),t}function Ne(e){const t=function(e){"string"!=typeof e&&(e=Me(e));Re(e)||ve.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(Me(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function Be(e,t){for("string"!=typeof e?e=Me(e):Re(e)||ve.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&ve.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function je(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Ee(e)){let r=ke(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Me(r.slice(0,32)),t.s=Me(r.slice(32,64))):65===r.length?(t.r=Me(r.slice(0,32)),t.s=Me(r.slice(32,64)),t.v=r[64]):ve.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:ve.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Me(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=function(e,t){(e=ke(e)).length>t&&ve.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),_e(r)}(ke(t._vs),32);t._vs=Me(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&ve.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=Me(r);null==t.s?t.s=i:t.s!==i&&ve.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?ve.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&&ve.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Re(t.r)?t.r=Be(t.r,32):ve.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Re(t.s)?t.s=Be(t.s,32):ve.throwArgumentError("signature missing or invalid s","signature",e);const r=ke(t.s);r[0]>=128&&ve.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Me(r);t._vs&&(Re(t._vs)||ve.throwArgumentError("signature invalid _vs","signature",e),t._vs=Be(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&ve.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}const Le="bignumber/5.7.0";var Ue=ue.BN;const De=new be(Le),Fe={},qe=9007199254740991;let ze=!1;class Ke{constructor(e,t){e!==Fe&&De.throwError("cannot call constructor directly; use BigNumber.from",be.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Ge(We(this).fromTwos(e))}toTwos(e){return Ge(We(this).toTwos(e))}abs(){return"-"===this._hex[0]?Ke.from(this._hex.substring(1)):this}add(e){return Ge(We(this).add(We(e)))}sub(e){return Ge(We(this).sub(We(e)))}div(e){return Ke.from(e).isZero()&&Ve("division-by-zero","div"),Ge(We(this).div(We(e)))}mul(e){return Ge(We(this).mul(We(e)))}mod(e){const t=We(e);return t.isNeg()&&Ve("division-by-zero","mod"),Ge(We(this).umod(t))}pow(e){const t=We(e);return t.isNeg()&&Ve("negative-power","pow"),Ge(We(this).pow(t))}and(e){const t=We(e);return(this.isNegative()||t.isNeg())&&Ve("unbound-bitwise-result","and"),Ge(We(this).and(t))}or(e){const t=We(e);return(this.isNegative()||t.isNeg())&&Ve("unbound-bitwise-result","or"),Ge(We(this).or(t))}xor(e){const t=We(e);return(this.isNegative()||t.isNeg())&&Ve("unbound-bitwise-result","xor"),Ge(We(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ve("negative-width","mask"),Ge(We(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ve("negative-width","shl"),Ge(We(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ve("negative-width","shr"),Ge(We(this).shrn(e))}eq(e){return We(this).eq(We(e))}lt(e){return We(this).lt(We(e))}lte(e){return We(this).lte(We(e))}gt(e){return We(this).gt(We(e))}gte(e){return We(this).gte(We(e))}isNegative(){return"-"===this._hex[0]}isZero(){return We(this).isZero()}toNumber(){try{return We(this).toNumber()}catch(e){Ve("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return De.throwError("this platform does not support BigInt",be.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?ze||(ze=!0,De.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?De.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",be.errors.UNEXPECTED_ARGUMENT,{}):De.throwError("BigNumber.toString does not accept parameters",be.errors.UNEXPECTED_ARGUMENT,{})),We(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ke)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new Ke(Fe,He(e)):e.match(/^-?[0-9]+$/)?new Ke(Fe,He(new Ue(e))):De.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Ve("underflow","BigNumber.from",e),(e>=qe||e<=-qe)&&Ve("overflow","BigNumber.from",e),Ke.from(String(e));const t=e;if("bigint"==typeof t)return Ke.from(t.toString());if(Se(t))return Ke.from(Me(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return Ke.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Re(e)||"-"===e[0]&&Re(e.substring(1))))return Ke.from(e)}return De.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function He(e){if("string"!=typeof e)return He(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&De.throwArgumentError("invalid hex","value",e),"0x00"===(e=He(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 Ge(e){return Ke.from(He(e))}function We(e){const t=Ke.from(e).toHexString();return"-"===t[0]?new Ue("-"+t.substring(3),16):new Ue(t.substring(2),16)}function Ve(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),De.throwError(e,be.errors.NUMERIC_FAULT,n)}const Xe=new be(Le),Je={},$e=Ke.from(0),Ye=Ke.from(-1);function Qe(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Xe.throwError(e,be.errors.NUMERIC_FAULT,i)}let Ze="0";for(;Ze.length<256;)Ze+=Ze;function et(e){if("number"!=typeof e)try{e=Ke.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Ze.substring(0,e):Xe.throwArgumentError("invalid decimal size","decimals",e)}function tt(e,t){null==t&&(t=0);const r=et(t),n=(e=Ke.from(e)).lt($e);n&&(e=e.mul(Ye));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=e.div(r).toString();return e=1===r.length?o:o+"."+i,n&&(e="-"+e),e}function rt(e,t){null==t&&(t=0);const r=et(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Xe.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Xe.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Xe.throwArgumentError("too many decimal points","value",e);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Qe("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Ke.from(o),u=Ke.from(s);let c=a.mul(r).add(u);return n&&(c=c.mul(Ye)),c}class nt{constructor(e,t,r,n){e!==Je&&Xe.throwError("cannot use FixedFormat constructor; use FixedFormat.from",be.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=et(n),Object.freeze(this)}static from(e){if(e instanceof nt)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Xe.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&Xe.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&&Xe.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Xe.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new nt(Je,t,r,n)}}class it{constructor(e,t,r,n){e!==Je&&Xe.throwError("cannot use FixedNumber constructor; use FixedNumber.from",be.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&&Xe.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=rt(this._value,this.format.decimals),r=rt(e._value,e.format.decimals);return it.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=rt(this._value,this.format.decimals),r=rt(e._value,e.format.decimals);return it.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=rt(this._value,this.format.decimals),r=rt(e._value,e.format.decimals);return it.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=rt(this._value,this.format.decimals),r=rt(e._value,e.format.decimals);return it.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=it.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ot.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=it.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ot.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)&&Xe.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=it.from("1"+Ze.substring(0,e),this.format),n=st.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&&Xe.throwArgumentError("invalid byte width","width",e);return Be(Ke.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return it.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Ke.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Re(e)||"bigint"==typeof e||Se(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),it.fromString(tt(e,t),nt.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=nt.from(t),n=rt(e,r.decimals);!r.signed&&n.lt($e)&&Qe("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Be(i,r.width/8));const o=tt(n,r.decimals);return new it(Je,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=nt.from(t);if(ke(e).length>r.width/8)throw new Error("overflow");let n=Ke.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=tt(n,r.decimals);return new it(Je,i,o,r)}static from(e,t){if("string"==typeof e)return it.fromString(e,t);if(Se(e))return it.fromBytes(e,t);try{return it.fromValue(e,0,t)}catch(e){if(e.code!==be.errors.INVALID_ARGUMENT)throw e}return Xe.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ot=it.from(1),st=it.from("0.5");var at=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const ut=new be("properties/5.7.0");function ct(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function ft(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 dt(e){return at(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 ht(e){const t={};for(const r in e)t[r]=e[r];return t}const lt={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function pt(e){if(null==e||lt[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;r<t.length;r++){let n=null;try{n=e[t[r]]}catch(e){continue}if(!pt(n))return!1}return!0}return ut.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function gt(e){if(pt(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>mt(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&ct(t,r,mt(n))}return t}return ut.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function mt(e){return gt(e)}class yt{constructor(e){for(const t in e)this[t]=mt(e[t])}}const bt="abi/5.7.0",vt=new be(bt),wt={};let _t={calldata:!0,memory:!0,storage:!0},Et={calldata:!0,memory:!0};function At(e,t){if("bytes"===e||"string"===e){if(_t[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Et[t])return!0;return(_t[t]||"payable"===t)&&vt.throwArgumentError("invalid modifier","name",t),!1}function St(e,t){for(let r in t)ct(e,r,t[r])}const kt=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),xt=new RegExp(/^(.*)\[([0-9]*)\]$/);class Tt{constructor(e,t){e!==wt&&vt.throwError("use fromString",be.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),St(this,t);let r=this.type.match(xt);St(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:Tt.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=kt.sighash),kt[e]||vt.throwArgumentError("invalid format type","format",e),e===kt.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!==kt.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===kt.full?", ":",")+")"):t+=this.type,e!==kt.sighash&&(!0===this.indexed&&(t+=" indexed"),e===kt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Tt.fromString(e,t):Tt.fromObject(e)}static fromObject(e){return Tt.isParamType(e)?e:new Tt(wt,{name:e.name||null,type:Ut(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Tt.fromObject):null})}static fromString(e,t){return r=function(e,t){let r=e;function n(t){vt.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}},s=o;for(let r=0;r<e.length;r++){let o=e[r];switch(o){case"(":s.state.allowType&&""===s.type?s.type="tuple":s.state.allowParams||n(r),s.state.allowType=!1,s.type=Ut(s.type),s.components=[i(s)],s=s.components[0];break;case")":delete s.state,"indexed"===s.name&&(t||n(r),s.indexed=!0,s.name=""),At(s.type,s.name)&&(s.name=""),s.type=Ut(s.type);let e=s;s=s.parent,s||n(r),delete e.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,"indexed"===s.name&&(t||n(r),s.indexed=!0,s.name=""),At(s.type,s.name)&&(s.name=""),s.type=Ut(s.type);let a=i(s.parent);s.parent.components.push(a),delete s.parent,s=a;break;case" ":s.state.allowType&&""!==s.type&&(s.type=Ut(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&""!==s.name&&("indexed"===s.name?(t||n(r),s.indexed&&n(r),s.indexed=!0,s.name=""):At(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||n(r),s.type+=o,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||n(r),s.type+=o,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=o,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=o,delete s.state.allowArray):s.state.readArray?s.type+=o:n(r)}}return s.parent&&vt.throwArgumentError("unexpected eof","param",e),delete o.state,"indexed"===s.name?(t||n(r.length-7),s.indexed&&n(r.length-7),s.indexed=!0,s.name=""):At(s.type,s.name)&&(s.name=""),o.type=Ut(o.type),o}(e,!!t),Tt.fromObject({name:r.name,type:r.type,indexed:r.indexed,components:r.components});var r}static isParamType(e){return!(null==e||!e._isParamType)}}function Rt(e,t){return function(e){e=e.trim();let t=[],r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];","===o&&0===n?(t.push(r),r=""):(r+=o,"("===o?n++:")"===o&&(n--,-1===n&&vt.throwArgumentError("unbalanced parenthesis","value",e)))}r&&t.push(r);return t}(e).map((e=>Tt.fromString(e,t)))}class Ot{constructor(e,t){e!==wt&&vt.throwError("use a static from method",be.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),St(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Ot.isFragment(e)?e:"string"==typeof e?Ot.fromString(e):Ot.fromObject(e)}static fromObject(e){if(Ot.isFragment(e))return e;switch(e.type){case"function":return Bt.fromObject(e);case"event":return Mt.fromObject(e);case"constructor":return Nt.fromObject(e);case"error":return Lt.fromObject(e);case"fallback":case"receive":return null}return vt.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]?Mt.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Bt.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Nt.fromString(e.trim()):"error"===e.split(" ")[0]?Lt.fromString(e.substring(5).trim()):vt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Mt extends Ot{format(e){if(e||(e=kt.sighash),kt[e]||vt.throwArgumentError("invalid format type","format",e),e===kt.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!==kt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===kt.full?", ":",")+") ",e!==kt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Mt.fromString(e):Mt.fromObject(e)}static fromObject(e){if(Mt.isEventFragment(e))return e;"event"!==e.type&&vt.throwArgumentError("invalid event object","value",e);const t={name:Ft(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Tt.fromObject):[],type:"event"};return new Mt(wt,t)}static fromString(e){let t=e.match(qt);t||vt.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:vt.warn("unknown modifier: "+e)}})),Mt.fromObject({name:t[1].trim(),anonymous:r,inputs:Rt(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function It(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&vt.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||vt.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Ke.from(r[1]),r[0]):e}function Pt(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 Ct(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&&vt.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&vt.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||vt.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&&vt.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&&vt.throwArgumentError("unable to determine stateMutability","value",e),t}class Nt extends Ot{format(e){if(e||(e=kt.sighash),kt[e]||vt.throwArgumentError("invalid format type","format",e),e===kt.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===kt.sighash&&vt.throwError("cannot format a constructor for sighash",be.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===kt.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Nt.fromString(e):Nt.fromObject(e)}static fromObject(e){if(Nt.isConstructorFragment(e))return e;"constructor"!==e.type&&vt.throwArgumentError("invalid constructor object","value",e);let t=Ct(e);t.constant&&vt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Tt.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ke.from(e.gas):null};return new Nt(wt,r)}static fromString(e){let t={type:"constructor"},r=(e=It(e,t)).match(qt);return r&&"constructor"===r[1].trim()||vt.throwArgumentError("invalid constructor string","value",e),t.inputs=Rt(r[2].trim(),!1),Pt(r[3].trim(),t),Nt.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Bt extends Nt{format(e){if(e||(e=kt.sighash),kt[e]||vt.throwArgumentError("invalid format type","format",e),e===kt.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!==kt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===kt.full?", ":",")+") ",e!==kt.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?Bt.fromString(e):Bt.fromObject(e)}static fromObject(e){if(Bt.isFunctionFragment(e))return e;"function"!==e.type&&vt.throwArgumentError("invalid function object","value",e);let t=Ct(e);const r={type:e.type,name:Ft(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Tt.fromObject):[],outputs:e.outputs?e.outputs.map(Tt.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ke.from(e.gas):null};return new Bt(wt,r)}static fromString(e){let t={type:"function"},r=(e=It(e,t)).split(" returns ");r.length>2&&vt.throwArgumentError("invalid function string","value",e);let n=r[0].match(qt);if(n||vt.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&Ft(t.name),t.inputs=Rt(n[2],!1),Pt(n[3].trim(),t),r.length>1){let n=r[1].match(qt);""==n[1].trim()&&""==n[3].trim()||vt.throwArgumentError("unexpected tokens","value",e),t.outputs=Rt(n[2],!1)}else t.outputs=[];return Bt.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function jt(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||vt.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Lt extends Ot{format(e){if(e||(e=kt.sighash),kt[e]||vt.throwArgumentError("invalid format type","format",e),e===kt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==kt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===kt.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Lt.fromString(e):Lt.fromObject(e)}static fromObject(e){if(Lt.isErrorFragment(e))return e;"error"!==e.type&&vt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Ft(e.name),inputs:e.inputs?e.inputs.map(Tt.fromObject):[]};return jt(new Lt(wt,t))}static fromString(e){let t={type:"error"},r=e.match(qt);return r||vt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Ft(t.name),t.inputs=Rt(r[2],!1),jt(Lt.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function Ut(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Dt=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ft(e){return e&&e.match(Dt)||vt.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const qt=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const zt=new be(bt);class Kt{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){zt.throwArgumentError(e,this.localName,t)}}class Ht{constructor(e){ct(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return Ce(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(xe(e._data))}writeBytes(e){let t=ke(e);const r=t.length%this.wordSize;return r&&(t=xe([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=ke(Ke.from(e));return t.length>this.wordSize&&zt.throwError("value out-of-bounds",be.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=xe([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 Gt{constructor(e,t,r,n){ct(this,"_data",ke(e)),ct(this,"wordSize",t||32),ct(this,"_coerceFunc",r),ct(this,"allowLoose",n),this._offset=0}get data(){return Me(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):Gt.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:zt.throwError("data out-of-bounds",be.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new Gt(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 Ke.from(this.readBytes(this.wordSize))}}var Wt={exports:{}};
|
|
2
|
+
/**
|
|
3
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
4
|
+
*
|
|
5
|
+
* @version 0.8.0
|
|
6
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
7
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
8
|
+
* @license MIT
|
|
9
|
+
*/!function(e){!function(){var t="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node?i=r:o&&(i=self);var s=!i.JS_SHA3_NO_COMMON_JS&&e.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],f=[0,8,16,24],d=[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],h=[224,256,384,512],l=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],g={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!i.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 m=function(e,t,r){return function(n){return new I(e,t,e).update(n)[r]()}},y=function(e,t,r){return function(n,i){return new I(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,o){return A["cshake"+e].update(t,n,i,o)[r]()}},v=function(e,t,r){return function(t,n,i,o){return A["kmac"+e].update(t,n,i,o)[r]()}},w=function(e,t,r,n){for(var i=0;i<p.length;++i){var o=p[i];e[o]=t(r,n,o)}return e},_=function(e,t){var r=m(e,t,"hex");return r.create=function(){return new I(e,t,e)},r.update=function(e){return r.create().update(e)},w(r,m,e,t)},E=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:_},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:_},{name:"shake",padding:[31,7936,2031616,520093696],bits:l,createMethod:function(e,t){var r=y(e,t,"hex");return r.create=function(r){return new I(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},w(r,y,e,t)}},{name:"cshake",padding:c,bits:l,createMethod:function(e,t){var r=g[e],n=b(e,0,"hex");return n.create=function(n,i,o){return i||o?new I(e,t,n).bytepad([i,o],r):A["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},w(n,b,e,t)}},{name:"kmac",padding:c,bits:l,createMethod:function(e,t){var r=g[e],n=v(e,0,"hex");return n.create=function(n,i,o){return new P(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},w(n,v,e,t)}}],A={},S=[],k=0;k<E.length;++k)for(var x=E[k],T=x.bits,R=0;R<T.length;++R){var O=x.name+"_"+T[R];if(S.push(O),A[O]=x.createMethod(T[R],x.padding),"sha3"!==x.name){var M=x.name+T[R];S.push(M),A[M]=A[O]}}function I(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function P(e,t,r){I.call(this,e,t,r)}I.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(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var i,o,s=this.blocks,u=this.byteCount,c=e.length,d=this.blockCount,h=0,l=this.s;h<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<d+1;++i)s[i]=0;if(r)for(i=this.start;h<c&&i<u;++h)s[i>>2]|=e[h]<<f[3&i++];else for(i=this.start;h<c&&i<u;++h)(o=e.charCodeAt(h))<128?s[i>>2]|=o<<f[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<f[3&i++],s[i>>2]|=(128|o>>6&63)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[i>>2]|=(240|o>>18)<<f[3&i++],s[i>>2]|=(128|o>>12&63)<<f[3&i++],s[i>>2]|=(128|o>>6&63)<<f[3&i++],s[i>>2]|=(128|63&o)<<f[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[d],i=0;i<d;++i)l[i]^=s[i];C(l),this.reset=!0}else this.start=i}return this},I.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},I.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(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var i=0,o=e.length;if(r)i=o;else for(var s=0;s<e.length;++s){var u=e.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},I.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];C(n)}},I.prototype.toString=I.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<t&&s<n;++o,++s)e=r[o],a+=u[e>>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];s%t==0&&(C(r),o=0)}return i&&(e=r[o],a+=u[e>>4&15]+u[15&e],i>1&&(a+=u[e>>12&15]+u[e>>8&15]),i>2&&(a+=u[e>>20&15]+u[e>>16&15])),a},I.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)u[s]=r[o];s%t==0&&C(r)}return i&&(u[o]=r[o],e=e.slice(0,a)),e},I.prototype.buffer=I.prototype.arrayBuffer,I.prototype.digest=I.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%r==0&&C(n)}return o&&(e=a<<2,t=n[s],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},P.prototype=new I,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var C=function(e){var t,r,n,i,o,s,a,u,c,f,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M,I,P,C,N,B,j,L,U,D,F,q,z,K,H,G,W,V,X,J,$,Y,Q,Z,ee,te,re,ne,ie,oe,se,ae,ue,ce,fe;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],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>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^(u<<1|c>>>31),r=o^(c<<1|u>>>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=s^(f<<1|h>>>31),r=a^(h<<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=u^(l<<1|p>>>31),r=c^(p<<1|l>>>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=h^(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,g=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,M=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,j=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,$=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=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,Q=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=g^~y&v,e[1]=m^~b&w,e[10]=k^~T&O,e[11]=x^~R&M,e[20]=B^~L&D,e[21]=j^~U&F,e[30]=G^~V&J,e[31]=W^~X&$,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=y^~v&_,e[3]=b^~w&E,e[12]=T^~O&I,e[13]=R^~M&P,e[22]=L^~D&q,e[23]=U^~F&z,e[32]=V^~J&Y,e[33]=X^~$&Q,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=v^~_&A,e[5]=w^~E&S,e[14]=O^~I&C,e[15]=M^~P&N,e[24]=D^~q&K,e[25]=F^~z&H,e[34]=J^~Y&Z,e[35]=$^~Q&ee,e[44]=oe^~ae&ce,e[45]=se^~ue&fe,e[6]=_^~A&g,e[7]=E^~S&m,e[16]=I^~C&k,e[17]=P^~N&x,e[26]=q^~K&B,e[27]=z^~H&j,e[36]=Y^~Z&G,e[37]=Q^~ee&W,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=A^~g&y,e[9]=S^~m&b,e[18]=C^~k&T,e[19]=N^~x&R,e[28]=K^~B&L,e[29]=H^~j&U,e[38]=Z^~G&V,e[39]=ee^~W&X,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=d[n],e[1]^=d[n+1]};if(s)e.exports=A;else for(k=0;k<S.length;++k)i[S[k]]=A[S[k]]}()}(Wt);var Vt=n(Wt.exports);function Xt(e){return"0x"+Vt.keccak_256(ke(e))}const Jt=new be("rlp/5.7.0");function $t(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Yt(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function Qt(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(Qt(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=$t(t.length);return r.unshift(247+r.length),r.concat(t)}Ee(e)||Jt.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(ke(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=$t(t.length);return r.unshift(183+r.length),r.concat(t)}function Zt(e){return Me(Qt(e))}function er(e,t,r,n){const i=[];for(;r<t+1+n;){const o=tr(e,r);i.push(o.result),(r+=o.consumed)>t+1+n&&Jt.throwError("child data too short",be.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function tr(e,t){if(0===e.length&&Jt.throwError("data too short",be.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&Jt.throwError("data short segment too short",be.errors.BUFFER_OVERRUN,{});const n=Yt(e,t+1,r);return t+1+r+n>e.length&&Jt.throwError("data long segment too short",be.errors.BUFFER_OVERRUN,{}),er(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&Jt.throwError("data array too short",be.errors.BUFFER_OVERRUN,{}),er(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&Jt.throwError("data array too short",be.errors.BUFFER_OVERRUN,{});const n=Yt(e,t+1,r);t+1+r+n>e.length&&Jt.throwError("data array too short",be.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:Me(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&Jt.throwError("data too short",be.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:Me(e.slice(t+1,t+1+r))}}return{consumed:1,result:Me(e[t])}}function rr(e){const t=ke(e),r=tr(t,0);return r.consumed!==t.length&&Jt.throwArgumentError("invalid rlp data","data",e),r.result}const nr=new be("address/5.7.0");function ir(e){Re(e,20)||nr.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=ke(Xt(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 or={};for(let e=0;e<10;e++)or[String(e)]=String(e);for(let e=0;e<26;e++)or[String.fromCharCode(65+e)]=String(10+e);const sr=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function ar(e){let t=null;if("string"!=typeof e&&nr.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=ir(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&nr.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>or[e])).join("");for(;t.length>=sr;){let e=t.substring(0,sr);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}(e)&&nr.throwArgumentError("bad icap checksum","address",e),r=e.substring(4),t=new Ue(r,36).toString(16);t.length<40;)t="0"+t;t=ir("0x"+t)}else nr.throwArgumentError("invalid address","address",e);var r;return t}function ur(e){let t=null;try{t=ar(e.from)}catch(t){nr.throwArgumentError("missing from address","transaction",e)}return ar(Pe(Xt(Zt([t,Te(ke(Ke.from(e.nonce).toHexString()))])),12))}class cr extends Kt{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=ar(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return ar(Be(e.readValue().toHexString(),20))}}class fr extends Kt{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 dr=new be(bt);function hr(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||dr.throwError("cannot encode object for signature with missing names",be.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&dr.throwError("cannot encode object for signature with duplicate names",be.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else dr.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&dr.throwArgumentError("types/value length mismatch","tuple",r);let i=new Ht(e.wordSize),o=new Ht(e.wordSize),s=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=o.length;e.encode(o,r);let n=i.writeUpdatableValue();s.push((e=>{n(e+t)}))}else e.encode(i,r)})),s.forEach((e=>{e(i.length)}));let a=e.appendWriter(i);return a+=e.appendWriter(o),a}function lr(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===be.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===be.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<r.length;e++){const t=r[e];t instanceof Error&&Object.defineProperty(r,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(r)}class pr extends Kt{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;r<this.length;r++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),dr.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let e=0;e<t.length;e++)n.push(this.coder);return hr(e,n,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&dr.throwError("insufficient data length",be.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e<t;e++)r.push(new fr(this.coder));return e.coerce(this.name,lr(e,r))}}class gr extends Kt{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class mr extends Kt{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=ke(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class yr extends mr{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,Me(super.decode(e)))}}class br extends Kt{constructor(e,t){let r="bytes"+String(e);super(r,r,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let r=ke(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}decode(e){return e.coerce(this.name,Me(e.readBytes(this.size)))}}class vr extends Kt{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const wr=Ke.from(-1),_r=Ke.from(0),Er=Ke.from(1),Ar=Ke.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Sr extends Kt{constructor(e,t,r){const n=(t?"int":"uint")+8*e;super(n,n,r,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let r=Ke.from(t),n=Ar.mask(8*e.wordSize);if(this.signed){let e=n.mask(8*this.size-1);(r.gt(e)||r.lt(e.add(Er).mul(wr)))&&this._throwError("value out-of-bounds",t)}else(r.lt(_r)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const kr=new be("strings/5.7.0");var xr,Tr;function Rr(e,t,r,n,i){if(e===Tr.BAD_PREFIX||e===Tr.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return e===Tr.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(xr||(xr={})),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"}(Tr||(Tr={}));const Or=Object.freeze({error:function(e,t,r,n,i){return kr.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:Rr,replace:function(e,t,r,n,i){return e===Tr.OVERLONG?(n.push(i),0):(n.push(65533),Rr(e,t,r))}});function Mr(e,t){null==t&&(t=Or.error),e=ke(e);const r=[];let n=0;for(;n<e.length;){const i=e[n++];if(i>>7==0){r.push(i);continue}let o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){n+=t(128==(192&i)?Tr.UNEXPECTED_CONTINUE:Tr.BAD_PREFIX,n-1,e,r);continue}o=3,s=65535}if(n-1+o>=e.length){n+=t(Tr.OVERRUN,n-1,e,r);continue}let a=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=e[n];if(128!=(192&i)){n+=t(Tr.MISSING_CONTINUE,n,e,r),a=null;break}a=a<<6|63&i,n++}null!==a&&(a>1114111?n+=t(Tr.OUT_OF_RANGE,n-1-o,e,r,a):a>=55296&&a<=57343?n+=t(Tr.UTF16_SURROGATE,n-1-o,e,r,a):a<=s?n+=t(Tr.OVERLONG,n-1-o,e,r,a):r.push(a))}return r}function Ir(e,t=xr.current){t!=xr.current&&(kr.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>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 ke(r)}function Pr(e,t){return Mr(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}class Cr extends mr{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Ir(t))}decode(e){return Pr(super.decode(e))}}class Nr extends Kt{constructor(e,t){let r=!1;const n=[];e.forEach((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 hr(e,this.coders,t)}decode(e){return e.coerce(this.name,lr(e,this.coders))}}const Br=new be(bt),jr=new RegExp(/^bytes([0-9]*)$/),Lr=new RegExp(/^(u?int)([0-9]*)$/);const Ur=new class{constructor(e){ct(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new cr(e.name);case"bool":return new gr(e.name);case"string":return new Cr(e.name);case"bytes":return new yr(e.name);case"array":return new pr(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Nr((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new vr(e.name)}let t=e.type.match(Lr);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&Br.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Sr(r/8,"int"===t[1],e.name)}if(t=e.type.match(jr),t){let r=parseInt(t[1]);return(0===r||r>32)&&Br.throwArgumentError("invalid bytes length","param",e),new br(r,e.name)}return Br.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Gt(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Ht(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(Tt.from(e))));return new Nr(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Br.throwError("types/values length mismatch",be.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(Tt.from(e)))),n=new Nr(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(Tt.from(e))));return new Nr(n,"_").decode(this._getReader(ke(t),r))}};function Dr(e){return Xt(Ir(e))}const Fr="hash/5.7.0";function qr(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return ke(t)}function zr(e){e=ke(e);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Kr(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 Hr(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<n;e++)o.push(i+=r());let s=r(),a=t;t+=s;let u=0,c=0;function f(){return 0==u&&(c=c<<8|e[t++],u=8),c>>--u&1}const d=Math.pow(2,31),h=d>>>1,l=h>>1,p=d-1;let g=0;for(let e=0;e<31;e++)g=g<<1|f();let m=[],y=0,b=d;for(;;){let e=Math.floor(((g-y+1)*i-1)/b),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<o[n]?r=n:t=n}if(0==t)break;m.push(t);let s=y+Math.floor(b*o[t]/i),a=y+Math.floor(b*o[t+1]/i)-1;for(;0==((s^a)&h);)g=g<<1&p|f(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&l;)g=g&h|g<<1&p>>>1|f(),s=s<<1^h,a=(a^h)<<1|h|1;y=s,b=1+a-s}let v=n-4;return m.map((t=>{switch(t-v){case 3:return v+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return v+256+(e[a++]<<8|e[a++]);case 1:return v+e[a++];default:return t-1}}))}(e))}function Gr(e){return 1&e?~e>>1:e>>1}function Wr(e,t){let r=Array(e);for(let n=0,i=-1;n<e;n++)r[n]=i+=1+t();return r}function Vr(e,t){let r=Array(e);for(let n=0,i=0;n<e;n++)r[n]=i+=Gr(t());return r}function Xr(e,t){let r=Wr(e(),e),n=e(),i=Wr(n,e),o=function(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}(n,e);for(let e=0;e<n;e++)for(let t=0;t<o[e];t++)r.push(i[e]+t);return t?r.map((e=>t[e])):r}function Jr(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)Vr(e,r).forEach(((e,t)=>n[t].push(e)));return n}function $r(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 Kr(Jr(i.length,1+e,t).map(((e,t)=>{const o=e[0],s=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*n;return[o+t*r,s.map((e=>e+i))]}))})))}function Yr(e,t){return Jr(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const Qr=Hr(qr("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==")),Zr=new Set(Xr(Qr)),en=new Set(Xr(Qr)),tn=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push($r(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(Yr(r,e))}return function(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}(Kr(t))}(Qr),rn=function(e){let t=Xr(e).sort(((e,t)=>e-t));return function r(){let n=[];for(;;){let i=Xr(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 s=!!(1&i);return i>>=1,{branches:n,valid:o,fe0f:s,save:1==i,check:2==i}}()}(Qr),nn=45,on=95;function sn(e){return function(e,t=xr.current){return Mr(Ir(e,t))}(e)}function an(e){return e.filter((e=>65039!=e))}function un(e){for(let t of e.split(".")){let e=sn(t);try{for(let t=e.lastIndexOf(on)-1;t>=0;t--)if(e[t]!==on)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===nn&&e[3]===nn)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function cn(e){return un(function(e,t){let r=sn(e).reverse(),n=[];for(;r.length;){let e=fn(r);if(e){n.push(...t(e));continue}let i=r.pop();if(Zr.has(i)){n.push(i);continue}if(en.has(i))continue;let o=tn[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return un(function(e){return e.normalize("NFC")}(String.fromCodePoint(...n)))}(e,an))}function fn(e,t){var r;let n,i,o=rn,s=[],a=e.length;for(t&&(t.length=0);a;){let u=e[--a];if(o=null===(r=o.branches.find((e=>e.set.has(u))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;s.push(u),o.fe0f&&(s.push(65039),a>0&&65039==e[a-1]&&a--),o.valid&&(n=s.slice(),2==o.valid&&n.splice(1,1),t&&t.push(...e.slice(a).reverse()),e.length=a)}return n}const dn=new be(Fr),hn=new Uint8Array(32);function ln(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function pn(e){const t=Ir(cn(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e<t.length;e++){46===t[e]&&(r.push(ln(t.slice(n,e))),n=e+1)}if(n>=t.length)throw new Error("invalid ENS name; empty component");return r.push(ln(t.slice(n))),r}function gn(e){"string"!=typeof e&&dn.throwArgumentError("invalid ENS name; not a string","name",e);let t=hn;const r=pn(e);for(;r.length;)t=Xt(xe([t,Xt(r.pop())]));return Me(t)}function mn(e){return Me(xe(pn(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"}hn.fill(0);var yn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const bn=new be(Fr),vn=new Uint8Array(32);vn.fill(0);const wn=Ke.from(-1),_n=Ke.from(0),En=Ke.from(1),An=Ke.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Sn=Be(En.toHexString(),32),kn=Be(_n.toHexString(),32),xn={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Tn=["name","version","chainId","verifyingContract","salt"];function Rn(e){return function(t){return"string"!=typeof t&&bn.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const On={name:Rn("name"),version:Rn("version"),chainId:function(e){try{return Ke.from(e).toString()}catch(e){}return bn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return ar(e).toLowerCase()}catch(e){}return bn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=ke(e);if(32!==t.length)throw new Error("bad length");return Me(t)}catch(e){}return bn.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Mn(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))&&bn.throwArgumentError("invalid numeric width","type",e);const i=An.mask(r?n-1:n),o=r?i.add(En).mul(wn):_n;return function(t){const r=Ke.from(t);return(r.lt(o)||r.gt(i))&&bn.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),Be(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))&&bn.throwArgumentError("invalid bytes width","type",e),function(t){return ke(t).length!==r&&bn.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=ke(e),r=t.length%32;return r?Ce([t,vn.slice(r)]):Me(t)}(t)}}}switch(e){case"address":return function(e){return Be(ar(e),32)};case"bool":return function(e){return e?Sn:kn};case"bytes":return function(e){return Xt(e)};case"string":return function(e){return Dr(e)}}return null}function In(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Pn{constructor(e){ct(this,"types",Object.freeze(mt(e))),ct(this,"_encoderCache",{}),ct(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]&&bn.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",e),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===n&&bn.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",e);Mn(s)||(r[s]||bn.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",e),r[s].push(n),t[n][s]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?bn.throwArgumentError("missing primary type","types",e):i.length>1&&bn.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),ct(this,"primaryType",i[0]),function i(o,s){s[o]&&bn.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),s[o]=!0,Object.keys(t[o]).forEach((e=>{r[e]&&(i(e,s),Object.keys(s).forEach((t=>{n[t][e]=!0})))})),delete s[o]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=In(t,e[t])+r.map((t=>In(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=Mn(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&&bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(Xt)),Xt(Ce(i))}}const r=this.types[e];if(r){const t=Dr(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?Xt(n):n}));return n.unshift(t),Ce(n)}}return bn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||bn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Xt(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(Mn(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&&bn.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)),{}):bn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Pn(e)}static getPrimaryType(e){return Pn.from(e).primaryType}static hashStruct(e,t,r){return Pn.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=xn[r];n||bn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>Tn.indexOf(e.name)-Tn.indexOf(t.name))),Pn.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Ce(["0x1901",Pn.hashDomain(e),Pn.from(t).hash(r)])}static hash(e,t,r){return Xt(Pn.encode(e,t,r))}static resolveNames(e,t,r,n){return yn(this,void 0,void 0,(function*(){e=ht(e);const i={};e.verifyingContract&&!Re(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=Pn.from(t);o.visit(r,((e,t)=>("address"!==e||Re(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){Pn.hashDomain(e);const n={},i=[];Tn.forEach((t=>{const r=e[t];null!=r&&(n[t]=On[t](r),i.push({name:t,type:xn[t]}))}));const o=Pn.from(t),s=ht(t);return s.EIP712Domain?bn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):s.EIP712Domain=i,o.encode(r),{types:s,domain:n,primaryType:o.primaryType,message:o.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return Me(ke(t));if(e.match(/^u?int/))return Ke.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&bn.throwArgumentError("invalid string","value",t),t}return bn.throwArgumentError("unsupported type","type",e)}))}}}const Cn=new be(bt);class Nn extends yt{}class Bn extends yt{}class jn extends yt{}class Ln extends yt{static isIndexed(e){return!(!e||!e._isIndexed)}}const Un={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Dn(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class Fn{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,ct(this,"fragments",t.map((e=>Ot.from(e))).filter((e=>null!=e))),ct(this,"_abiCoder",ft(new.target,"getAbiCoder")()),ct(this,"functions",{}),ct(this,"errors",{}),ct(this,"events",{}),ct(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Cn.warn("duplicate definition - constructor"):void ct(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]?Cn.warn("duplicate definition - "+r):t[r]=e})),this.deploy||ct(this,"deploy",Nt.from({payable:!1,type:"constructor"})),ct(this,"_isInterface",!0)}format(e){e||(e=kt.full),e===kt.sighash&&Cn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===kt.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Ur}static getAddress(e){return ar(e)}static getSighash(e){return Pe(Dr(e.format()),0,4)}static getEventTopic(e){return Dr(e.format())}getFunction(e){if(Re(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Cn.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?Cn.throwArgumentError("no matching function","name",t):r.length>1&&Cn.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[Bt.fromString(e).format()];return t||Cn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Re(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Cn.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?Cn.throwArgumentError("no matching event","name",t):r.length>1&&Cn.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[Mt.fromString(e).format()];return t||Cn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Re(e)){const t=ft(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Cn.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?Cn.throwArgumentError("no matching error","name",t):r.length>1&&Cn.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[Bt.fromString(e).format()];return t||Cn.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 ft(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),ft(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=ke(t);return Me(r.slice(0,4))!==this.getSighash(e)&&Cn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",Me(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),Me(xe([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=ke(t);return Me(r.slice(0,4))!==this.getSighash(e)&&Cn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",Me(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Me(xe([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=ke(t),n=null,i="",o=null,s=null,a=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=Me(r.slice(0,4)),t=Un[e];if(t)o=this._abiCoder.decode(t.inputs,r.slice(4)),s=t.name,a=t.signature,t.reason&&(n=o[0]),"Error"===s?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===s&&(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)),s=t.name,a=t.format()}catch(e){}break}}return Cn.throwError("call revert exception"+i,be.errors.CALL_EXCEPTION,{method:e.format(),data:Me(t),errorArgs:o,errorName:s,errorSignature:a,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Me(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Cn.throwError("too many arguments for "+e.format(),be.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?Dr(t):"bytes"===e.type?Xt(Me(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=Ke.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),Be(Me(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?Cn.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&&Cn.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&&Cn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const s=t[o];if(e.indexed)if("string"===e.type)r.push(Dr(s));else if("bytes"===e.type)r.push(Xt(s));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[s]))}else n.push(e),i.push(s)})),{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);Re(r[0],32)&&r[0].toLowerCase()===t||Cn.throwError("fragment/topic mismatch",be.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(Tt.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let s=null!=r?this._abiCoder.decode(n,xe(r)):null,a=this._abiCoder.decode(i,t,!0),u=[],c=0,f=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==s)u[t]=new Ln({_isIndexed:!0,hash:null});else if(o[t])u[t]=new Ln({_isIndexed:!0,hash:s[f++]});else try{u[t]=s[f++]}catch(e){u[t]=e}else try{u[t]=a[c++]}catch(e){u[t]=e}if(e.name&&null==u[e.name]){const r=u[t];r instanceof Error?Object.defineProperty(u,e.name,{enumerable:!0,get:()=>{throw Dn(`property ${JSON.stringify(e.name)}`,r)}}):u[e.name]=r}}));for(let e=0;e<u.length;e++){const t=u[e];t instanceof Error&&Object.defineProperty(u,e,{enumerable:!0,get:()=>{throw Dn(`index ${e}`,t)}})}return Object.freeze(u)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new Bn({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ke.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Nn({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=Me(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new jn({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 qn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const zn=new be("abstract-provider/5.7.0");class Kn extends yt{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class Hn{constructor(){zn.checkAbstract(new.target,Hn),ct(this,"_isProvider",!0)}getFeeData(){return qn(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield dt({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=Ke.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)}}var Gn=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const Wn=new be("abstract-signer/5.7.0"),Vn=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Xn=[be.errors.INSUFFICIENT_FUNDS,be.errors.NONCE_EXPIRED,be.errors.REPLACEMENT_UNDERPRICED];class Jn{constructor(){Wn.checkAbstract(new.target,Jn),ct(this,"_isSigner",!0)}getBalance(e){return Gn(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return Gn(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return Gn(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield dt(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return Gn(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield dt(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return Gn(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 Gn(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Gn(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Gn(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return Gn(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===Vn.indexOf(t)&&Wn.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=ht(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()&&Wn.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return Gn(this,void 0,void 0,(function*(){const t=yield dt(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>Gn(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&Wn.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||Wn.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):Wn.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&&Wn.throwError("network does not support EIP-1559",be.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):Wn.throwError("failed to get consistent fee data",be.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(Xn.indexOf(e.code)>=0)throw e;return Wn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",be.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]&&Wn.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield dt(t)}))}_checkProvider(e){this.provider||Wn.throwError("missing provider",be.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class $n extends Jn{constructor(e,t){super(),ct(this,"address",e),ct(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{Wn.throwError(e,be.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 $n(this.address,e)}}var Yn={},Qn={},Zn=ei;function ei(e,t){if(!e)throw new Error(t||"Assertion failed")}ei.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var ti="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},ri=i(Object.freeze({__proto__:null,default:ti})),ni=Zn,ii=ri;function oi(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function si(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function ai(e){return 1===e.length?"0"+e:e}function ui(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}Qn.inherits=ii,Qn.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<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var n=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=63&o|128):oi(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<e.length;i++)r[i]=0|e[i];return r},Qn.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=ai(e[r].toString(16));return t},Qn.htonl=si,Qn.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var i=e[n];"little"===t&&(i=si(i)),r+=ui(i.toString(16))}return r},Qn.zero2=ai,Qn.zero8=ui,Qn.join32=function(e,t,r,n){var i=r-t;ni(i%4==0);for(var o=new Array(i/4),s=0,a=t;s<o.length;s++,a+=4){var u;u="big"===n?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],o[s]=u>>>0}return o},Qn.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>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},Qn.rotr32=function(e,t){return e>>>t|e<<32-t},Qn.rotl32=function(e,t){return e<<t|e>>>32-t},Qn.sum32=function(e,t){return e+t>>>0},Qn.sum32_3=function(e,t,r){return e+t+r>>>0},Qn.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},Qn.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},Qn.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o<n?1:0)+r+i;e[t]=s>>>0,e[t+1]=o},Qn.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},Qn.sum64_lo=function(e,t,r,n){return t+n>>>0},Qn.sum64_4_hi=function(e,t,r,n,i,o,s,a){var u=0,c=t;return u+=(c=c+n>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+r+i+s+(u+=(c=c+a>>>0)<a?1:0)>>>0},Qn.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},Qn.sum64_5_hi=function(e,t,r,n,i,o,s,a,u,c){var f=0,d=t;return f+=(d=d+n>>>0)<t?1:0,f+=(d=d+o>>>0)<o?1:0,f+=(d=d+a>>>0)<a?1:0,e+r+i+s+u+(f+=(d=d+c>>>0)<c?1:0)>>>0},Qn.sum64_5_lo=function(e,t,r,n,i,o,s,a,u,c){return t+n+o+a+c>>>0},Qn.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},Qn.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},Qn.shr64_hi=function(e,t,r){return e>>>r},Qn.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var ci={},fi=Qn,di=Zn;function hi(){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}ci.BlockHash=hi,hi.prototype.update=function(e,t){if(e=fi.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=fi.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},hi.prototype.digest=function(e){return this.update(this._pad()),di(null===this.pending),this._digest(e)},hi.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>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<this.padLength;o++)n[i++]=0;return n};var li={},pi={},gi=Qn.rotr32;function mi(e,t,r){return e&t^~e&r}function yi(e,t,r){return e&t^e&r^t&r}function bi(e,t,r){return e^t^r}pi.ft_1=function(e,t,r,n){return 0===e?mi(t,r,n):1===e||3===e?bi(t,r,n):2===e?yi(t,r,n):void 0},pi.ch32=mi,pi.maj32=yi,pi.p32=bi,pi.s0_256=function(e){return gi(e,2)^gi(e,13)^gi(e,22)},pi.s1_256=function(e){return gi(e,6)^gi(e,11)^gi(e,25)},pi.g0_256=function(e){return gi(e,7)^gi(e,18)^e>>>3},pi.g1_256=function(e){return gi(e,17)^gi(e,19)^e>>>10};var vi=Qn,wi=ci,_i=pi,Ei=vi.rotl32,Ai=vi.sum32,Si=vi.sum32_5,ki=_i.ft_1,xi=wi.BlockHash,Ti=[1518500249,1859775393,2400959708,3395469782];function Ri(){if(!(this instanceof Ri))return new Ri;xi.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}vi.inherits(Ri,xi);var Oi=Ri;Ri.blockSize=512,Ri.outSize=160,Ri.hmacStrength=80,Ri.padLength=64,Ri.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Ei(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4];for(n=0;n<r.length;n++){var c=~~(n/20),f=Si(Ei(i,5),ki(c,o,s,a),u,r[n],Ti[c]);u=a,a=s,s=Ei(o,30),o=i,i=f}this.h[0]=Ai(this.h[0],i),this.h[1]=Ai(this.h[1],o),this.h[2]=Ai(this.h[2],s),this.h[3]=Ai(this.h[3],a),this.h[4]=Ai(this.h[4],u)},Ri.prototype._digest=function(e){return"hex"===e?vi.toHex32(this.h,"big"):vi.split32(this.h,"big")};var Mi=Qn,Ii=ci,Pi=pi,Ci=Zn,Ni=Mi.sum32,Bi=Mi.sum32_4,ji=Mi.sum32_5,Li=Pi.ch32,Ui=Pi.maj32,Di=Pi.s0_256,Fi=Pi.s1_256,qi=Pi.g0_256,zi=Pi.g1_256,Ki=Ii.BlockHash,Hi=[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 Gi(){if(!(this instanceof Gi))return new Gi;Ki.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Hi,this.W=new Array(64)}Mi.inherits(Gi,Ki);var Wi=Gi;Gi.blockSize=512,Gi.outSize=256,Gi.hmacStrength=192,Gi.padLength=64,Gi.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Bi(zi(r[n-2]),r[n-7],qi(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],c=this.h[5],f=this.h[6],d=this.h[7];for(Ci(this.k.length===r.length),n=0;n<r.length;n++){var h=ji(d,Fi(u),Li(u,c,f),this.k[n],r[n]),l=Ni(Di(i),Ui(i,o,s));d=f,f=c,c=u,u=Ni(a,h),a=s,s=o,o=i,i=Ni(h,l)}this.h[0]=Ni(this.h[0],i),this.h[1]=Ni(this.h[1],o),this.h[2]=Ni(this.h[2],s),this.h[3]=Ni(this.h[3],a),this.h[4]=Ni(this.h[4],u),this.h[5]=Ni(this.h[5],c),this.h[6]=Ni(this.h[6],f),this.h[7]=Ni(this.h[7],d)},Gi.prototype._digest=function(e){return"hex"===e?Mi.toHex32(this.h,"big"):Mi.split32(this.h,"big")};var Vi=Qn,Xi=Wi;function Ji(){if(!(this instanceof Ji))return new Ji;Xi.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Vi.inherits(Ji,Xi);var $i=Ji;Ji.blockSize=512,Ji.outSize=224,Ji.hmacStrength=192,Ji.padLength=64,Ji.prototype._digest=function(e){return"hex"===e?Vi.toHex32(this.h.slice(0,7),"big"):Vi.split32(this.h.slice(0,7),"big")};var Yi=Qn,Qi=ci,Zi=Zn,eo=Yi.rotr64_hi,to=Yi.rotr64_lo,ro=Yi.shr64_hi,no=Yi.shr64_lo,io=Yi.sum64,oo=Yi.sum64_hi,so=Yi.sum64_lo,ao=Yi.sum64_4_hi,uo=Yi.sum64_4_lo,co=Yi.sum64_5_hi,fo=Yi.sum64_5_lo,ho=Qi.BlockHash,lo=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function po(){if(!(this instanceof po))return new po;ho.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=lo,this.W=new Array(160)}Yi.inherits(po,ho);var go=po;function mo(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function yo(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function bo(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function vo(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function wo(e,t){var r=eo(e,t,28)^eo(t,e,2)^eo(t,e,7);return r<0&&(r+=4294967296),r}function _o(e,t){var r=to(e,t,28)^to(t,e,2)^to(t,e,7);return r<0&&(r+=4294967296),r}function Eo(e,t){var r=eo(e,t,14)^eo(e,t,18)^eo(t,e,9);return r<0&&(r+=4294967296),r}function Ao(e,t){var r=to(e,t,14)^to(e,t,18)^to(t,e,9);return r<0&&(r+=4294967296),r}function So(e,t){var r=eo(e,t,1)^eo(e,t,8)^ro(e,t,7);return r<0&&(r+=4294967296),r}function ko(e,t){var r=to(e,t,1)^to(e,t,8)^no(e,t,7);return r<0&&(r+=4294967296),r}function xo(e,t){var r=eo(e,t,19)^eo(t,e,29)^ro(e,t,6);return r<0&&(r+=4294967296),r}function To(e,t){var r=to(e,t,19)^to(t,e,29)^no(e,t,6);return r<0&&(r+=4294967296),r}po.blockSize=1024,po.outSize=512,po.hmacStrength=192,po.padLength=128,po.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=xo(r[n-4],r[n-3]),o=To(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],u=So(r[n-30],r[n-29]),c=ko(r[n-30],r[n-29]),f=r[n-32],d=r[n-31];r[n]=ao(i,o,s,a,u,c,f,d),r[n+1]=uo(i,o,s,a,u,c,f,d)}},po.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],o=this.h[2],s=this.h[3],a=this.h[4],u=this.h[5],c=this.h[6],f=this.h[7],d=this.h[8],h=this.h[9],l=this.h[10],p=this.h[11],g=this.h[12],m=this.h[13],y=this.h[14],b=this.h[15];Zi(this.k.length===r.length);for(var v=0;v<r.length;v+=2){var w=y,_=b,E=Eo(d,h),A=Ao(d,h),S=mo(d,h,l,p,g),k=yo(d,h,l,p,g,m),x=this.k[v],T=this.k[v+1],R=r[v],O=r[v+1],M=co(w,_,E,A,S,k,x,T,R,O),I=fo(w,_,E,A,S,k,x,T,R,O);w=wo(n,i),_=_o(n,i),E=bo(n,i,o,s,a),A=vo(n,i,o,s,a,u);var P=oo(w,_,E,A),C=so(w,_,E,A);y=g,b=m,g=l,m=p,l=d,p=h,d=oo(c,f,M,I),h=so(f,f,M,I),c=a,f=u,a=o,u=s,o=n,s=i,n=oo(M,I,P,C),i=so(M,I,P,C)}io(this.h,0,n,i),io(this.h,2,o,s),io(this.h,4,a,u),io(this.h,6,c,f),io(this.h,8,d,h),io(this.h,10,l,p),io(this.h,12,g,m),io(this.h,14,y,b)},po.prototype._digest=function(e){return"hex"===e?Yi.toHex32(this.h,"big"):Yi.split32(this.h,"big")};var Ro=Qn,Oo=go;function Mo(){if(!(this instanceof Mo))return new Mo;Oo.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ro.inherits(Mo,Oo);var Io=Mo;Mo.blockSize=1024,Mo.outSize=384,Mo.hmacStrength=192,Mo.padLength=128,Mo.prototype._digest=function(e){return"hex"===e?Ro.toHex32(this.h.slice(0,12),"big"):Ro.split32(this.h.slice(0,12),"big")},li.sha1=Oi,li.sha224=$i,li.sha256=Wi,li.sha384=Io,li.sha512=go;var Po={},Co=Qn,No=ci,Bo=Co.rotl32,jo=Co.sum32,Lo=Co.sum32_3,Uo=Co.sum32_4,Do=No.BlockHash;function Fo(){if(!(this instanceof Fo))return new Fo;Do.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function qo(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function zo(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Ko(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Co.inherits(Fo,Do),Po.ripemd160=Fo,Fo.blockSize=512,Fo.outSize=160,Fo.hmacStrength=192,Fo.padLength=64,Fo.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],o=this.h[3],s=this.h[4],a=r,u=n,c=i,f=o,d=s,h=0;h<80;h++){var l=jo(Bo(Uo(r,qo(h,n,i,o),e[Ho[h]+t],zo(h)),Wo[h]),s);r=s,s=o,o=Bo(i,10),i=n,n=l,l=jo(Bo(Uo(a,qo(79-h,u,c,f),e[Go[h]+t],Ko(h)),Vo[h]),d),a=d,d=f,f=Bo(c,10),c=u,u=l}l=Lo(this.h[1],i,f),this.h[1]=Lo(this.h[2],o,d),this.h[2]=Lo(this.h[3],s,a),this.h[3]=Lo(this.h[4],r,u),this.h[4]=Lo(this.h[0],n,c),this.h[0]=l},Fo.prototype._digest=function(e){return"hex"===e?Co.toHex32(this.h,"little"):Co.split32(this.h,"little")};var Ho=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Go=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Wo=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Vo=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Xo=Qn,Jo=Zn;function $o(e,t,r){if(!(this instanceof $o))return new $o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Xo.toArray(t,r))}var Yo=$o;$o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Jo(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},$o.prototype.update=function(e,t){return this.inner.update(e,t),this},$o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=Qn,t.common=ci,t.sha=li,t.ripemd=Po,t.hmac=Yo,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(Yn);var Qo=n(Yn);function Zo(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},e(r,r.exports),r.exports}var es=ts;function ts(e,t){if(!e)throw new Error(t||"Assertion failed")}ts.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var rs=Zo((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),ns=Zo((function(e,t){var r=t;r.assert=es,r.toArray=rs.toArray,r.zero2=rs.zero2,r.toHex=rs.toHex,r.encode=rs.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,o=e.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,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 s,a,u=e.andln(3)+i&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),s=0==(1&u)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(s),a=0==(1&c)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==u?c:-c,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+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 ue(e,"hex","le")}})),is=ns.getNAF,os=ns.getJSF,ss=ns.assert;function as(e,t){this.type=e,this.p=new ue(t.p,16),this.red=t.prime?ue.red(t.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=t.n&&new ue(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 us=as;function cs(e,t){this.curve=e,this.type=t,this.precomputed=null}as.prototype.point=function(){throw new Error("Not implemented")},as.prototype.validate=function(){throw new Error("Not implemented")},as.prototype._fixedNafMul=function(e,t){ss(e.precomputed);var r=e._getDoubles(),n=is(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var u=o+r.step-1;u>=o;u--)s=(s<<1)+n[u];a.push(s)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o<a.length;o++)(s=a[o])===d?f=f.mixedAdd(r.points[o]):s===-d&&(f=f.mixedAdd(r.points[o].neg()));c=c.add(f)}return c.toP()},as.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=is(t,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var c=o[a];ss(0!==c),s="affine"===e.type?c>0?s.mixedAdd(i[c-1>>1]):s.mixedAdd(i[-c-1>>1].neg()):c>0?s.add(i[c-1>>1]):s.add(i[-c-1>>1].neg())}return"affine"===e.type?s.toP():s},as.prototype._wnafMulAdd=function(e,t,r,n,i){var o,s,a,u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,d=0;for(o=0;o<n;o++){var h=(a=t[o])._getNAFPoints(e);u[o]=h.wnd,c[o]=h.points}for(o=n-1;o>=1;o-=2){var l=o-1,p=o;if(1===u[l]&&1===u[p]){var g=[t[l],null,null,t[p]];0===t[l].y.cmp(t[p].y)?(g[1]=t[l].add(t[p]),g[2]=t[l].toJ().mixedAdd(t[p].neg())):0===t[l].y.cmp(t[p].y.redNeg())?(g[1]=t[l].toJ().mixedAdd(t[p]),g[2]=t[l].add(t[p].neg())):(g[1]=t[l].toJ().mixedAdd(t[p]),g[2]=t[l].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=os(r[l],r[p]);for(d=Math.max(y[0].length,d),f[l]=new Array(d),f[p]=new Array(d),s=0;s<d;s++){var b=0|y[0][s],v=0|y[1][s];f[l][s]=m[3*(b+1)+(v+1)],f[p][s]=0,c[l]=g}}else f[l]=is(r[l],u[l],this._bitLength),f[p]=is(r[p],u[p],this._bitLength),d=Math.max(f[l].length,d),d=Math.max(f[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(o=d;o>=0;o--){for(var E=0;o>=0;){var A=!0;for(s=0;s<n;s++)_[s]=0|f[s][o],0!==_[s]&&(A=!1);if(!A)break;E++,o--}if(o>=0&&E++,w=w.dblp(E),o<0)break;for(s=0;s<n;s++){var S=_[s];0!==S&&(S>0?a=c[s][S-1>>1]:S<0&&(a=c[s][-S-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o<n;o++)c[o]=null;return i?w:w.toP()},as.BasePoint=cs,cs.prototype.eq=function(){throw new Error("Not implemented")},cs.prototype.validate=function(){return this.curve.validate(this)},as.prototype.decodePoint=function(e,t){e=ns.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?ss(e[e.length-1]%2==0):7===e[0]&&ss(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},cs.prototype.encodeCompressed=function(e){return this.encode(e,!0)},cs.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},cs.prototype.encode=function(e,t){return ns.encode(this._encode(t),e)},cs.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},cs.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},cs.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},cs.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},cs.prototype._getBeta=function(){return null},cs.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var fs=Zo((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),ds=ns.assert;function hs(e){us.call(this,"short",e),this.a=new ue(e.a,16).toRed(this.red),this.b=new ue(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}fs(hs,us);var ls=hs;function ps(e,t,r,n){us.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new ue(t,16),this.y=new ue(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function gs(e,t,r,n){us.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(t,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}hs.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new ue(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new ue(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],ds(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new ue(e.a,16),b:new ue(e.b,16)}})):this._getEndoBasis(r)}}},hs.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:ue.mont(e),r=new ue(2).toRed(t).redInvm(),n=r.redNeg(),i=new ue(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},hs.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,s,a,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),l=new ue(1),p=new ue(0),g=new ue(0),m=new ue(1),y=0;0!==d.cmpn(0);){var b=h.div(d);u=h.sub(b.mul(d)),c=g.sub(b.mul(l));var v=m.sub(b.mul(p));if(!n&&u.cmp(f)<0)t=a.neg(),r=l,n=u.neg(),i=c;else if(n&&2==++y)break;a=u,h=d,d=u,g=l,l=c,m=p,p=v}o=u.neg(),s=c;var w=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=t,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},hs.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),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:u.add(c).neg()}},hs.prototype.pointFromX=function(e,t){(e=new ue(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)},hs.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)},hs.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var s=this._endoSplit(t[o]),a=e[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),f=0;f<2*o;f++)n[f]=null,i[f]=null;return c},fs(ps,us.BasePoint),hs.prototype.point=function(e,t,r){return new ps(this,e,t,r)},hs.prototype.pointFromJSON=function(e,t){return ps.fromJSON(this,e,t)},ps.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},ps.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},ps.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},ps.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},ps.prototype.isInfinity=function(){return this.inf},ps.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)},ps.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)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},ps.prototype.getX=function(){return this.x.fromRed()},ps.prototype.getY=function(){return this.y.fromRed()},ps.prototype.mul=function(e){return e=new ue(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)},ps.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)},ps.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)},ps.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))},ps.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},ps.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},fs(gs,us.BasePoint),hs.prototype.jpoint=function(e,t,r){return new gs(this,e,t,r)},gs.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)},gs.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},gs.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)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),d=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(d).redISub(d),l=u.redMul(d.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,l,p)},gs.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),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=r.redMul(u),d=a.redSqr().redIAdd(c).redISub(f).redISub(f),h=a.redMul(f.redISub(d)).redISub(i.redMul(c)),l=this.z.redMul(s);return this.curve.jpoint(d,h,l)},gs.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<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),c=s.redAdd(s);for(t=0;t<e;t++){var f=o.redSqr(),d=c.redSqr(),h=d.redSqr(),l=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),p=o.redMul(d),g=l.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=l.redMul(m);y=y.redIAdd(y).redISub(h);var b=c.redMul(a);t+1<e&&(u=u.redMul(h)),o=g,a=b,c=y}return this.curve.jpoint(o,c.redMul(i),a)},gs.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},gs.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),l=this.x.redAdd(d).redSqr().redISub(f).redISub(h);l=l.redIAdd(l);var p=f.redAdd(f).redIAdd(f),g=p.redSqr(),m=h.redIAdd(h);m=(m=m.redIAdd(m)).redIAdd(m),e=g.redISub(l).redISub(l),t=p.redMul(l.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},gs.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),l=this.x.redSub(f).redMul(this.x.redAdd(f));l=l.redAdd(l).redIAdd(l);var p=h.redIAdd(h),g=(p=p.redIAdd(p)).redAdd(p);e=l.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(f);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=l.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},gs.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(s),f=a.redSqr().redISub(c.redAdd(c)),d=c.redISub(f),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var l=a.redMul(d).redISub(h),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,l,p)},gs.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.x.redMul(a).redISub(f);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var l=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(d,h,l)},gs.prototype.mul=function(e,t){return e=new ue(e,t),this.curve._wnafMul(this,e)},gs.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},gs.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},gs.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},gs.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ms=Zo((function(e,t){var r=t;r.base=us,r.short=ls,r.mont=null,r.edwards=null})),ys=Zo((function(e,t){var r,n=t,i=ns.assert;function o(e){"short"===e.type?this.curve=new ms.short(e):"edwards"===e.type?this.curve=new ms.edwards(e):this.curve=new ms.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 s(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,s("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:Qo.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:Qo.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:Qo.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:Qo.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"]}),s("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:Qo.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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Qo.sha256,gRed:!1,g:["9"]}),s("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:Qo.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=void 0}s("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:Qo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function bs(e){if(!(this instanceof bs))return new bs(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=rs.toArray(e.entropy,e.entropyEnc||"hex"),r=rs.toArray(e.nonce,e.nonceEnc||"hex"),n=rs.toArray(e.pers,e.persEnc||"hex");es(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var vs=bs;bs.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.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},bs.prototype._hmac=function(){return new Qo.hmac(this.hash,this.K)},bs.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},bs.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=rs.toArray(e,t),r=rs.toArray(r,n),es(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},bs.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=rs.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(r),this._reseed++,rs.encode(o,t)};var ws=ns.assert;function _s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Es=_s;_s.fromPublic=function(e,t,r){return t instanceof _s?t:new _s(e,{pub:t,pubEnc:r})},_s.fromPrivate=function(e,t,r){return t instanceof _s?t:new _s(e,{priv:t,privEnc:r})},_s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},_s.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},_s.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},_s.prototype._importPrivate=function(e,t){this.priv=new ue(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},_s.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?ws(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||ws(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},_s.prototype.derive=function(e){return e.validate()||ws(e.validate(),"public point not validated"),e.mul(this.priv).getX()},_s.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},_s.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},_s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var As=ns.assert;function Ss(e,t){if(e instanceof Ss)return e;this._importDER(e,t)||(As(e.r&&e.s,"Signature without r or s"),this.r=new ue(e.r,16),this.s=new ue(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var ks=Ss;function xs(){this.place=0}function Ts(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,s=t.place;o<n;o++,s++)i<<=8,i|=e[s],i>>>=0;return!(i<=127)&&(t.place=s,i)}function Rs(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function Os(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Ss.prototype._importDER=function(e,t){e=ns.toArray(e,t);var r=new xs;if(48!==e[r.place++])return!1;var n=Ts(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=Ts(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 s=Ts(e,r);if(!1===s)return!1;if(e.length!==s+r.place)return!1;var a=e.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new ue(o),this.s=new ue(a),this.recoveryParam=null,!0},Ss.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=Rs(t),r=Rs(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Os(n,t.length),(n=n.concat(t)).push(2),Os(n,r.length);var i=n.concat(r),o=[48];return Os(o,i.length),o=o.concat(i),ns.encode(o,e)};var Ms=function(){throw new Error("unsupported")},Is=ns.assert;function Ps(e){if(!(this instanceof Ps))return new Ps(e);"string"==typeof e&&(Is(Object.prototype.hasOwnProperty.call(ys,e),"Unknown curve "+e),e=ys[e]),e instanceof ys.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 Cs=Ps;Ps.prototype.keyPair=function(e){return new Es(this,e)},Ps.prototype.keyFromPrivate=function(e,t){return Es.fromPrivate(this,e,t)},Ps.prototype.keyFromPublic=function(e,t){return Es.fromPublic(this,e,t)},Ps.prototype.genKeyPair=function(e){e||(e={});for(var t=new vs({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Ms(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new ue(2));;){var i=new ue(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Ps.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},Ps.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 ue(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),s=e.toArray("be",i),a=new vs({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var f=n.k?n.k(c):new ue(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var h=d.getX(),l=h.umod(this.n);if(0!==l.cmpn(0)){var p=f.invm(this.n).mul(l.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(d.getY().isOdd()?1:0)|(0!==h.cmp(l)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new ks({r:l,s:p,recoveryParam:g})}}}}}},Ps.prototype.verify=function(e,t,r,n){e=this._truncateToN(new ue(e,16)),r=this.keyFromPublic(r,n);var i=(t=new ks(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 s,a=o.invm(this.n),u=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),c)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},Ps.prototype.recoverPubKey=function(e,t,r,n){Is((3&r)===r,"The recovery param is more than two bits"),t=new ks(t,n);var i=this.n,o=new ue(e),s=t.r,a=t.s,u=1&r,c=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");s=c?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var f=t.r.invm(i),d=i.sub(o).mul(f).umod(i),h=a.mul(f).umod(i);return this.g.mulAdd(d,s,h)},Ps.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new ks(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 Ns=Zo((function(e,t){var r=t;r.version="6.5.4",r.utils=ns,r.rand=function(){throw new Error("unsupported")},r.curve=ms,r.curves=ys,r.ec=Cs,r.eddsa=null})),Bs=Ns.ec;const js=new be("signing-key/5.7.0");let Ls=null;function Us(){return Ls||(Ls=new Bs("secp256k1")),Ls}class Ds{constructor(e){ct(this,"curve","secp256k1"),ct(this,"privateKey",Me(e)),32!==Ie(this.privateKey)&&js.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Us().keyFromPrivate(ke(this.privateKey));ct(this,"publicKey","0x"+t.getPublic(!1,"hex")),ct(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),ct(this,"_isSigningKey",!0)}_addPoint(e){const t=Us().keyFromPublic(ke(this.publicKey)),r=Us().keyFromPublic(ke(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Us().keyFromPrivate(ke(this.privateKey)),r=ke(e);32!==r.length&&js.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return je({recoveryParam:n.recoveryParam,r:Be("0x"+n.r.toString(16),32),s:Be("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=Us().keyFromPrivate(ke(this.privateKey)),r=Us().keyFromPublic(ke(Fs(e)));return Be("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function Fs(e,t){const r=ke(e);if(32===r.length){const e=new Ds(r);return t?"0x"+Us().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?Me(r):"0x"+Us().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+Us().keyFromPublic(r).getPublic(!0,"hex"):Me(r):js.throwArgumentError("invalid public or private key","key","[REDACTED]")}const qs=new be("transactions/5.7.0");var zs;function Ks(e){return"0x"===e?null:ar(e)}function Hs(e){return"0x"===e?_r:Ke.from(e)}function Gs(e,t){return function(e){return ar(Pe(Xt(Pe(Fs(e),1)),12))}(function(e,t){const r=je(t),n={r:ke(r.r),s:ke(r.s)};return"0x"+Us().recoverPubKey(ke(e),n,r.recoveryParam).encode("hex",!1)}(ke(e),t))}function Ws(e,t){const r=Te(Ke.from(e).toHexString());return r.length>32&&qs.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function Vs(e,t){return{address:ar(e),storageKeys:(t||[]).map(((t,r)=>(32!==Ie(t)&&qs.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}function Xs(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&qs.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),Vs(e[0],e[1])):Vs(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return Vs(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function Js(e){return Xs(e).map((e=>[e.address,e.storageKeys]))}function $s(e,t){if(null!=e.gasPrice){const t=Ke.from(e.gasPrice),r=Ke.from(e.maxFeePerGas||0);t.eq(r)||qs.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[Ws(e.chainId||0,"chainId"),Ws(e.nonce||0,"nonce"),Ws(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ws(e.maxFeePerGas||0,"maxFeePerGas"),Ws(e.gasLimit||0,"gasLimit"),null!=e.to?ar(e.to):"0x",Ws(e.value||0,"value"),e.data||"0x",Js(e.accessList||[])];if(t){const e=je(t);r.push(Ws(e.recoveryParam,"recoveryParam")),r.push(Te(e.r)),r.push(Te(e.s))}return Ce(["0x02",Zt(r)])}function Ys(e,t){const r=[Ws(e.chainId||0,"chainId"),Ws(e.nonce||0,"nonce"),Ws(e.gasPrice||0,"gasPrice"),Ws(e.gasLimit||0,"gasLimit"),null!=e.to?ar(e.to):"0x",Ws(e.value||0,"value"),e.data||"0x",Js(e.accessList||[])];if(t){const e=je(t);r.push(Ws(e.recoveryParam,"recoveryParam")),r.push(Te(e.r)),r.push(Te(e.s))}return Ce(["0x01",Zt(r)])}function Qs(e,t,r){try{const r=Hs(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){qs.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=Be(t[1],32),e.s=Be(t[2],32);try{const t=Xt(r(e));e.from=Gs(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function Zs(e){const t=ke(e);if(t[0]>127)return function(e){const t=rr(e);9!==t.length&&6!==t.length&&qs.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:Hs(t[0]).toNumber(),gasPrice:Hs(t[1]),gasLimit:Hs(t[2]),to:Ks(t[3]),value:Hs(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=Ke.from(t[6]).toNumber()}catch(e){return r}if(r.r=Be(t[7],32),r.s=Be(t[8],32),Ke.from(r.r).isZero()&&Ke.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(Me(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=Xt(Zt(i));try{r.from=Gs(o,{r:Me(r.r),s:Me(r.s),recoveryParam:n})}catch(e){}r.hash=Xt(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=rr(e.slice(1));8!==t.length&&11!==t.length&&qs.throwArgumentError("invalid component count for transaction type: 1","payload",Me(e));const r={type:1,chainId:Hs(t[0]).toNumber(),nonce:Hs(t[1]).toNumber(),gasPrice:Hs(t[2]),gasLimit:Hs(t[3]),to:Ks(t[4]),value:Hs(t[5]),data:t[6],accessList:Xs(t[7])};return 8===t.length||(r.hash=Xt(e),Qs(r,t.slice(8),Ys)),r}(t);case 2:return function(e){const t=rr(e.slice(1));9!==t.length&&12!==t.length&&qs.throwArgumentError("invalid component count for transaction type: 2","payload",Me(e));const r=Hs(t[2]),n=Hs(t[3]),i={type:2,chainId:Hs(t[0]).toNumber(),nonce:Hs(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Hs(t[4]),to:Ks(t[5]),value:Hs(t[6]),data:t[7],accessList:Xs(t[8])};return 9===t.length||(i.hash=Xt(e),Qs(i,t.slice(9),$s)),i}(t)}return qs.throwError(`unsupported transaction type: ${t[0]}`,be.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(zs||(zs={}));var ea=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const ta=new be("contracts/5.7.0"),ra={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 na(e,t){return ea(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&ta.throwArgumentError("invalid address or ENS name","name",r);try{return ar(r)}catch(e){}e||ta.throwError("a provider or signer is needed to resolve ENS names",be.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&ta.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function ia(e,t,r){return ea(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>ia(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield na(e,t):"tuple"===r.type?yield ia(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>ia(e,t,r.arrayChildren)))):Promise.reject(ta.makeError("invalid value for array",be.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function oa(e,t,r){return ea(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=ht(r.pop())),ta.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=dt({override:na(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>ea(this,void 0,void 0,(function*(){return ar(e.signer)!==e.override&&ta.throwError("Contract with a Signer cannot override from",be.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=na(e.provider,n.from));const i=yield dt({args:ia(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:dt(n)||{}}),o=e.interface.encodeFunctionData(t,i.args),s={data:o,to:i.address},a=i.overrides;if(null!=a.nonce&&(s.nonce=Ke.from(a.nonce).toNumber()),null!=a.gasLimit&&(s.gasLimit=Ke.from(a.gasLimit)),null!=a.gasPrice&&(s.gasPrice=Ke.from(a.gasPrice)),null!=a.maxFeePerGas&&(s.maxFeePerGas=Ke.from(a.maxFeePerGas)),null!=a.maxPriorityFeePerGas&&(s.maxPriorityFeePerGas=Ke.from(a.maxPriorityFeePerGas)),null!=a.from&&(s.from=a.from),null!=a.type&&(s.type=a.type),null!=a.accessList&&(s.accessList=Xs(a.accessList)),null==s.gasLimit&&null!=t.gas){let e=21e3;const r=ke(o);for(let t=0;t<r.length;t++)e+=4,r[t]&&(e+=64);s.gasLimit=Ke.from(t.gas).add(e)}if(a.value){const e=Ke.from(a.value);e.isZero()||t.payable||ta.throwError("non-payable method cannot override value",be.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:n.value}),s.value=e}a.customData&&(s.customData=ht(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete n.nonce,delete n.gasLimit,delete n.gasPrice,delete n.from,delete n.value,delete n.type,delete n.accessList,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.customData,delete n.ccipReadEnabled;const u=Object.keys(n).filter((e=>null!=n[e]));return u.length&&ta.throwError(`cannot override ${u.map((e=>JSON.stringify(e))).join(",")}`,be.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),s}))}function sa(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=mt(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 aa(e,t,r){const n=e.signer||e.provider;return function(...i){return ea(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=ht(i.pop());null!=e.blockTag&&(o=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(o));const s=yield oa(e,t,i),a=yield n.call(s,o);try{let n=e.interface.decodeFunctionResult(t,a);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===be.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=s),t}}))}}function ua(e,t,r){return t.constant?aa(e,t,r):function(e,t){return function(...r){return ea(this,void 0,void 0,(function*(){e.signer||ta.throwError("sending a transaction requires a signer",be.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield oa(e,t,r),i=yield e.signer.sendTransaction(n);return sa(e,i),i}))}}(e,t)}function ca(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 fa{constructor(e,t){ct(this,"tag",e),ct(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 da extends fa{constructor(){super("error",null)}}class ha extends fa{constructor(e,t,r,n){const i={address:e};let o=t.getEventTopic(r);n?(o!==n[0]&&ta.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(ca(i),i),ct(this,"address",e),ct(this,"interface",t),ct(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=function(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}(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class la extends fa{constructor(e,t){super("*",{address:e}),ct(this,"address",e),ct(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 pa{constructor(e,t,r){ct(this,"interface",ft(new.target,"getInterface")(t)),null==r?(ct(this,"provider",null),ct(this,"signer",null)):Jn.isSigner(r)?(ct(this,"provider",r.provider||null),ct(this,"signer",r)):Hn.isProvider(r)?(ct(this,"provider",r),ct(this,"signer",null)):ta.throwArgumentError("invalid signer or provider","signerOrProvider",r),ct(this,"callStatic",{}),ct(this,"estimateGas",{}),ct(this,"functions",{}),ct(this,"populateTransaction",{}),ct(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];ct(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?ct(this.filters,t,this.filters[r[0]]):ta.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if(ct(this,"_runningEvents",{}),ct(this,"_wrappedEmits",{}),null==e&&ta.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ct(this,"address",e),this.provider)ct(this,"resolvedAddress",na(this.provider,e));else try{ct(this,"resolvedAddress",Promise.resolve(ar(e)))}catch(e){ta.throwError("provider is required to use ENS name as contract address",be.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])ta.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]&&ct(this,e,ua(this,t,!0)),null==this.functions[e]&&ct(this.functions,e,ua(this,t,!1)),null==this.callStatic[e]&&ct(this.callStatic,e,aa(this,t,!0)),null==this.populateTransaction[e]&&ct(this.populateTransaction,e,function(e,t){return function(...r){return oa(e,t,r)}}(this,t)),null==this.estimateGas[e]&&ct(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return ea(this,void 0,void 0,(function*(){r||ta.throwError("estimate require a provider or signer",be.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield oa(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]&&ct(this,e,this[r])}catch(e){}null==this.functions[e]&&ct(this.functions,e,this.functions[r]),null==this.callStatic[e]&&ct(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&ct(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&ct(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return ur(e)}static getInterface(e){return Fn.isInterface(e)?e:new Fn(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&&ta.throwError("contract not deployed",be.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||ta.throwError("sending a transactions require a signer",be.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=ht(e||{});return["from","to"].forEach((function(e){null!=t[e]&&ta.throwError("cannot override "+e,be.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new $n(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ct(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Ln.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 da);if("event"===e)return this._normalizeRunningEvent(new fa("event",null));if("*"===e)return this._normalizeRunningEvent(new la(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new ha(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 ha(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new fa(ca(t),t))}return this._normalizeRunningEvent(new la(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=mt(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||ta.throwError("events require a provider or a signer with a provider",be.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=ht(n.filter);return"string"==typeof t&&Re(t,32)?(null!=r&&ta.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 ga extends pa{}class ma{constructor(e,t,r){let n=null;n="string"==typeof t?t:Se(t)?Me(t):t&&"string"==typeof t.object?t.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!Re(n)||n.length%2)&&ta.throwArgumentError("invalid bytecode","bytecode",t),r&&!Jn.isSigner(r)&&ta.throwArgumentError("invalid signer","signer",r),ct(this,"bytecode",n),ct(this,"interface",ft(new.target,"getInterface")(e)),ct(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){t=ht(e.pop());for(const e in t)if(!ra[e])throw new Error("unknown transaction override "+e)}if(["data","from","to"].forEach((e=>{null!=t[e]&&ta.throwError("cannot override "+e,be.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.value){Ke.from(t.value).isZero()||this.interface.deploy.payable||ta.throwError("non-payable constructor cannot override value",be.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value})}return ta.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=Me(xe([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return ea(this,void 0,void 0,(function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),ta.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield ia(this.signer,e,this.interface.deploy.inputs);r.push(t);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=ft(this.constructor,"getContractAddress")(i),s=ft(this.constructor,"getContract")(o,this.interface,this.signer);return sa(s,i),ct(s,"deployTransaction",i),s}))}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&&ta.throwError("missing compiler output",be.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 ga.getInterface(e)}static getContractAddress(e){return ur(e)}static getContract(e,t,r){return new ga(e,t,r)}}class ya{constructor(e){ct(this,"alphabet",e),ct(this,"base",e.length),ct(this,"_alphabetMap",{}),ct(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=ke(e);if(0===t.length)return"";let r=[0];for(let e=0;e<t.length;++e){let n=t[e];for(let e=0;e<r.length;++e)n+=r[e]<<8,r[e]=n%this.base,n=n/this.base|0;for(;n>0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e<t.length-1;++e)n+=this._leader;for(let e=r.length-1;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<e.length;r++){let n=this._alphabetMap[e[r]];if(void 0===n)throw new Error("Non-base"+this.base+" character");let i=n;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r<e.length-1;++r)t.push(0);return ke(new Uint8Array(t.reverse()))}}new ya("abcdefghijklmnopqrstuvwxyz234567");const ba=new ya("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function va(e){return"0x"+Qo.sha256().update(ke(e)).digest("hex")}var wa={exports:{}};!function(e,t){!function(t){const r=2147483647;function n(e){const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let r=1779033703,n=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,u=528734635,c=1541459225;const f=new Uint32Array(64);function d(e){let d=0,h=e.length;for(;h>=64;){let l,p,g,m,y,b=r,v=n,w=i,_=o,E=s,A=a,S=u,k=c;for(p=0;p<16;p++)g=d+4*p,f[p]=(255&e[g])<<24|(255&e[g+1])<<16|(255&e[g+2])<<8|255&e[g+3];for(p=16;p<64;p++)l=f[p-2],m=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,l=f[p-15],y=(l>>>7|l<<25)^(l>>>18|l<<14)^l>>>3,f[p]=(m+f[p-7]|0)+(y+f[p-16]|0)|0;for(p=0;p<64;p++)m=(((E>>>6|E<<26)^(E>>>11|E<<21)^(E>>>25|E<<7))+(E&A^~E&S)|0)+(k+(t[p]+f[p]|0)|0)|0,y=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&v^b&w^v&w)|0,k=S,S=A,A=E,E=_+m|0,_=w,w=v,v=b,b=m+y|0;r=r+b|0,n=n+v|0,i=i+w|0,o=o+_|0,s=s+E|0,a=a+A|0,u=u+S|0,c=c+k|0,d+=64,h-=64}}d(e);let h,l=e.length%64,p=e.length/536870912|0,g=e.length<<3,m=l<56?56:120,y=e.slice(e.length-l,e.length);for(y.push(128),h=l+1;h<m;h++)y.push(0);return y.push(p>>>24&255),y.push(p>>>16&255),y.push(p>>>8&255),y.push(p>>>0&255),y.push(g>>>24&255),y.push(g>>>16&255),y.push(g>>>8&255),y.push(g>>>0&255),d(y),[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,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);const i=64+t.length+4,o=new Array(i),s=new Array(64);let a,u=[];for(a=0;a<64;a++)o[a]=54;for(a=0;a<e.length;a++)o[a]^=e[a];for(a=0;a<t.length;a++)o[64+a]=t[a];for(a=i-4;a<i;a++)o[a]=0;for(a=0;a<64;a++)s[a]=92;for(a=0;a<e.length;a++)s[a]^=e[a];function c(){for(let e=i-1;e>=i-4;e--){if(o[e]++,o[e]<=255)return;o[e]=0}}for(;r>=32;)c(),u=u.concat(n(s.concat(n(o)))),r-=32;return r>0&&(c(),u=u.concat(n(s.concat(n(o))).slice(0,r))),u}function o(e,t,r,n,i){let o;for(c(e,16*(2*r-1),i,0,16),o=0;o<2*r;o++)u(e,16*o,i,16),a(i,n),c(i,0,e,t+16*o,16);for(o=0;o<r;o++)c(e,t+2*o*16,e,16*o,16);for(o=0;o<r;o++)c(e,t+16*(2*o+1),e,16*(o+r),16)}function s(e,t){return e<<t|e>>>32-t}function a(e,t){c(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=s(t[0]+t[12],7),t[8]^=s(t[4]+t[0],9),t[12]^=s(t[8]+t[4],13),t[0]^=s(t[12]+t[8],18),t[9]^=s(t[5]+t[1],7),t[13]^=s(t[9]+t[5],9),t[1]^=s(t[13]+t[9],13),t[5]^=s(t[1]+t[13],18),t[14]^=s(t[10]+t[6],7),t[2]^=s(t[14]+t[10],9),t[6]^=s(t[2]+t[14],13),t[10]^=s(t[6]+t[2],18),t[3]^=s(t[15]+t[11],7),t[7]^=s(t[3]+t[15],9),t[11]^=s(t[7]+t[3],13),t[15]^=s(t[11]+t[7],18),t[1]^=s(t[0]+t[3],7),t[2]^=s(t[1]+t[0],9),t[3]^=s(t[2]+t[1],13),t[0]^=s(t[3]+t[2],18),t[6]^=s(t[5]+t[4],7),t[7]^=s(t[6]+t[5],9),t[4]^=s(t[7]+t[6],13),t[5]^=s(t[4]+t[7],18),t[11]^=s(t[10]+t[9],7),t[8]^=s(t[11]+t[10],9),t[9]^=s(t[8]+t[11],13),t[10]^=s(t[9]+t[8],18),t[12]^=s(t[15]+t[14],7),t[13]^=s(t[12]+t[15],9),t[14]^=s(t[13]+t[12],13),t[15]^=s(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function u(e,t,r,n){for(let i=0;i<n;i++)r[i]^=e[t+i]}function c(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}function f(e){if(!e||"number"!=typeof e.length)return!1;for(let t=0;t<e.length;t++){const r=e[t];if("number"!=typeof r||r%1||r<0||r>=256)return!1}return!0}function d(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function h(e,t,n,s,a,h,l){if(n=d(n,"N"),s=d(s,"r"),a=d(a,"p"),h=d(h,"dkLen"),0===n||0!=(n&n-1))throw new Error("N must be power of 2");if(n>r/128/s)throw new Error("N too large");if(s>r/128/a)throw new Error("r too large");if(!f(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!f(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let p=i(e,t,128*a*s);const g=new Uint32Array(32*a*s);for(let e=0;e<g.length;e++){const t=4*e;g[e]=(255&p[t+3])<<24|(255&p[t+2])<<16|(255&p[t+1])<<8|(255&p[t+0])<<0}const m=new Uint32Array(64*s),y=new Uint32Array(32*s*n),b=32*s,v=new Uint32Array(16),w=new Uint32Array(16),_=a*n*2;let E,A,S=0,k=null,x=!1,T=0,R=0;const O=l?parseInt(1e3/s):4294967295,M="undefined"!=typeof setImmediate?setImmediate:setTimeout,I=function(){if(x)return l(new Error("cancelled"),S/_);let t;switch(T){case 0:A=32*R*s,c(g,A,m,0,b),T=1,E=0;case 1:t=n-E,t>O&&(t=O);for(let e=0;e<t;e++)c(m,0,y,(E+e)*b,b),o(m,b,s,v,w);if(E+=t,S+=t,l){const e=parseInt(1e3*S/_);if(e!==k){if(x=l(null,S/_),x)break;k=e}}if(E<n)break;E=0,T=2;case 2:t=n-E,t>O&&(t=O);for(let e=0;e<t;e++){const e=m[16*(2*s-1)]&n-1;u(y,e*b,m,b),o(m,b,s,v,w)}if(E+=t,S+=t,l){const e=parseInt(1e3*S/_);if(e!==k){if(x=l(null,S/_),x)break;k=e}}if(E<n)break;if(c(m,0,g,A,b),R++,R<a){T=0;break}p=[];for(let e=0;e<g.length;e++)p.push(g[e]>>0&255),p.push(g[e]>>8&255),p.push(g[e]>>16&255),p.push(g[e]>>24&255);const r=i(e,p,h);return l&&l(null,1,r),r}l&&M(I)};if(!l)for(;;){const e=I();if(null!=e)return e}I()}const l={scrypt:function(e,t,r,n,i,o,s){return new Promise((function(a,u){let c=0;s&&s(0),h(e,t,r,n,i,o,(function(e,t,r){if(e)u(e);else if(r)s&&1!==c&&s(1),a(new Uint8Array(r));else if(s&&t!==c)return c=t,s(t)}))}))},syncScrypt:function(e,t,r,n,i,o){return new Uint8Array(h(e,t,r,n,i,o))}};e.exports=l}()}(wa);var _a=wa.exports;const Ea=new be("networks/5.7.1");function Aa(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 Aa(e)},t}function Sa(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return Sa(e,t)},r}const ka={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Aa("homestead")},xa={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Aa("ropsten")},Ta={chainId:63,name:"classicMordor",_defaultProvider:Sa("https://www.ethercluster.com/mordor","classicMordor")},Ra={unspecified:{chainId:0,name:"unspecified"},homestead:ka,mainnet:ka,morden:{chainId:2,name:"morden"},ropsten:xa,testnet:xa,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Aa("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Aa("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Aa("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Aa("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Sa("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Ta,classicTestnet:Ta,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Sa("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Aa("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Aa("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};var Oa=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};function Ma(e,t){return Oa(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:ke(new Uint8Array(i))}}))}var Ia=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const Pa=new be("web/5.7.1");function Ca(e){return new Promise((t=>{setTimeout(t,e)}))}function Na(e,t){if(null==e)return null;if("string"==typeof e)return e;if(Ee(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Pr(e)}catch(e){}return Me(e)}return e}function Ba(e,t,r){let n=null;if(null!=t){n=Ir(t);const r="string"==typeof e?{url:e}:ht(e);if(r.headers){const e=0!==Object.keys(r.headers).filter((e=>"content-type"===e.toLowerCase())).length;e||(r.headers=ht(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return function(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;Pa.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;Pa.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s="object"==typeof e&&!!e.errorPassThrough,a={};let u=null;const c={method:"GET"};let f=!1,d=12e4;if("string"==typeof e)u=e;else if("object"==typeof e){if(null!=e&&null!=e.url||Pa.throwArgumentError("missing URL","connection.url",e),u=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)a[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(f=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==u.substring(0,6)&&!0!==e.allowInsecureAuthentication&&Pa.throwError("basic authentication requires a secure https url",be.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;a.authorization={key:"Authorization",value:"Basic "+zr(Ir(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=ht(e.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),l=u?u.match(h):null;if(l)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":l[1]||"text/plain"},body:l[2]?qr(l[3]):(p=l[3],Ir(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){Pa.throwError("processing response error",be.errors.SERVER_ERROR,{body:Na(l[1],l[2]),error:e,requestBody:null,requestMethod:"GET",url:u})}var p;t&&(c.method="POST",c.body=t,null==a["content-type"]&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==a["content-length"]&&(a["content-length"]={key:"Content-Length",value:String(t.length)}));const g={};Object.keys(a).forEach((e=>{const t=a[e];g[t.key]=t.value})),c.headers=g;const m=function(){let e=null;return{promise:new Promise((function(t,r){d&&(e=setTimeout((()=>{null!=e&&(e=null,r(Pa.makeError("timeout",be.errors.TIMEOUT,{requestBody:Na(c.body,g["content-type"]),requestMethod:c.method,timeout:d,url:u})))}),d))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),y=function(){return Ia(this,void 0,void 0,(function*(){for(let e=0;e<n;e++){let t=null;try{if(t=yield Ma(u,c),e<n)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){u=t.headers.location;continue}}else if(429===t.statusCode){let r=!0;if(i&&(r=yield i(e,u)),r){let r=0;const n=t.headers["retry-after"];r="string"==typeof n&&n.match(/^[1-9][0-9]*$/)?1e3*parseInt(n):o*parseInt(String(Math.random()*Math.pow(2,e))),yield Ca(r);continue}}}catch(e){t=e.response,null==t&&(m.cancel(),Pa.throwError("missing response",be.errors.SERVER_ERROR,{requestBody:Na(c.body,g["content-type"]),requestMethod:c.method,serverError:e,url:u}))}let a=t.body;if(f&&304===t.statusCode?a=null:!s&&(t.statusCode<200||t.statusCode>=300)&&(m.cancel(),Pa.throwError("bad response",be.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:Na(a,t.headers?t.headers["content-type"]:null),requestBody:Na(c.body,g["content-type"]),requestMethod:c.method,url:u})),r)try{const e=yield r(a,t);return m.cancel(),e}catch(r){if(r.throttleRetry&&e<n){let t=!0;if(i&&(t=yield i(e,u)),t){const t=o*parseInt(String(Math.random()*Math.pow(2,e)));yield Ca(t);continue}}m.cancel(),Pa.throwError("processing response error",be.errors.SERVER_ERROR,{body:Na(a,t.headers?t.headers["content-type"]:null),error:r,requestBody:Na(c.body,g["content-type"]),requestMethod:c.method,url:u})}return m.cancel(),a}return Pa.throwError("failed response",be.errors.SERVER_ERROR,{requestBody:Na(c.body,g["content-type"]),requestMethod:c.method,url:u})}))}();return Promise.race([m.promise,y])}(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(Pr(e))}catch(t){Pa.throwError("invalid JSON",be.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function ja(e,t){return t||(t={}),null==(t=ht(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 s=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{s()&&n(new Error("timeout"))}),t.timeout));const a=t.retryLimit;let u=0;!function i(){return e().then((function(e){if(void 0!==e)s()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(u++,u>a)return void(s()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){s()&&n(e)}))}()}))}for(var La="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Ua={},Da=0;Da<32;Da++){var Fa=La.charAt(Da);if(void 0!==Ua[Fa])throw new TypeError(Fa+" is ambiguous");Ua[Fa]=Da}function qa(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function za(e){for(var t=1,r=0;r<e.length;++r){var n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=qa(t)^n>>5}for(t=qa(t),r=0;r<e.length;++r){var i=e.charCodeAt(r);t=qa(t)^31&i}return t}function Ka(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)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),s=e.slice(i+1);if(s.length<6)return"Data too short";var a=za(o);if("string"==typeof a)return a;for(var u=[],c=0;c<s.length;++c){var f=s.charAt(c),d=Ua[f];if(void 0===d)return"Unknown character "+f;a=qa(a)^d,c+6>=s.length||u.push(d)}return 1!==a?"Invalid checksum for "+e:{prefix:o,words:u}}function Ha(e,t,r,n){for(var i=0,o=0,s=(1<<r)-1,a=[],u=0;u<e.length;++u)for(i=i<<t|e[u],o+=t;o>=r;)o-=r,a.push(i>>o&s);if(n)o>0&&a.push(i<<r-o&s);else{if(o>=t)return"Excess padding";if(i<<r-o&s)return"Non-zero padding"}return a}var Ga={decodeUnsafe:function(){var e=Ka.apply(null,arguments);if("object"==typeof e)return e},decode:function(e){var t=Ka.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},encode:function(e,t,r){if(r=r||90,e.length+7+t.length>r)throw new TypeError("Exceeds length limit");var n=za(e=e.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=e+"1",o=0;o<t.length;++o){var s=t[o];if(s>>5!=0)throw new Error("Non 5-bit word");n=qa(n)^s,i+=La.charAt(s)}for(o=0;o<6;++o)n=qa(n);for(n^=1,o=0;o<6;++o){i+=La.charAt(n>>5*(5-o)&31)}return i},toWordsUnsafe:function(e){var t=Ha(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=Ha(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=Ha(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=Ha(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}},Wa=n(Ga);const Va="providers/5.7.2",Xa=new be(Va);class Ja{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),s=this.hex.bind(this),a=this.number.bind(this),u=this.type.bind(this);return e.transaction={hash:o,type:u,accessList:Ja.allowNull(this.accessList.bind(this),null),blockHash:Ja.allowNull(o,null),blockNumber:Ja.allowNull(a,null),transactionIndex:Ja.allowNull(a,null),confirmations:Ja.allowNull(a,null),from:t,gasPrice:Ja.allowNull(r),maxPriorityFeePerGas:Ja.allowNull(r),maxFeePerGas:Ja.allowNull(r),gasLimit:r,to:Ja.allowNull(t,null),value:r,nonce:a,data:i,r:Ja.allowNull(this.uint256),s:Ja.allowNull(this.uint256),v:Ja.allowNull(a),creates:Ja.allowNull(t,null),raw:Ja.allowNull(i)},e.transactionRequest={from:Ja.allowNull(t),nonce:Ja.allowNull(a),gasLimit:Ja.allowNull(r),gasPrice:Ja.allowNull(r),maxPriorityFeePerGas:Ja.allowNull(r),maxFeePerGas:Ja.allowNull(r),to:Ja.allowNull(t),value:Ja.allowNull(r),data:Ja.allowNull((e=>this.data(e,!0))),type:Ja.allowNull(a),accessList:Ja.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:o,address:t,topics:Ja.arrayOf(o),data:i,logIndex:a,blockHash:o},e.receipt={to:Ja.allowNull(this.address,null),from:Ja.allowNull(this.address,null),contractAddress:Ja.allowNull(t,null),transactionIndex:a,root:Ja.allowNull(s),gasUsed:r,logsBloom:Ja.allowNull(i),blockHash:o,transactionHash:o,logs:Ja.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Ja.allowNull(a,null),cumulativeGasUsed:r,effectiveGasPrice:Ja.allowNull(r),status:Ja.allowNull(a),type:u},e.block={hash:Ja.allowNull(o),parentHash:o,number:a,timestamp:a,nonce:Ja.allowNull(s),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:Ja.allowNull(t),extraData:i,transactions:Ja.allowNull(Ja.arrayOf(o)),baseFeePerGas:Ja.allowNull(r)},e.blockWithTransactions=ht(e.block),e.blockWithTransactions.transactions=Ja.allowNull(Ja.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Ja.allowNull(n,void 0),toBlock:Ja.allowNull(n,void 0),blockHash:Ja.allowNull(o,void 0),address:Ja.allowNull(t,void 0),topics:Ja.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Ja.allowNull(a),blockHash:Ja.allowNull(o),transactionIndex:a,removed:Ja.allowNull(this.boolean.bind(this)),address:t,data:Ja.allowFalsish(i,"0x"),topics:Ja.arrayOf(o),transactionHash:o,logIndex:a},e}accessList(e){return Xs(e||[])}number(e){return"0x"===e?0:Ke.from(e).toNumber()}type(e){return"0x"===e||null==e?0:Ke.from(e).toNumber()}bigNumber(e){return Ke.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),Re(e))?e.toLowerCase():Xa.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 ar(e)}callAddress(e){if(!Re(e,32))return null;const t=ar(Pe(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return ur(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||Re(e))return Ne(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==Ie(r)?Xa.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=Ke.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!Re(e))throw new Error("invalid uint256");return Be(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=Ja.check(t,e);return n._difficulty=null==r?null:Ke.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Ja.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&Ke.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=Ja.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;Re(r)&&(r=Ke.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),Re(r)&&(r=Ke.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 Zs(e)}receiptLog(e){return Ja.check(this.formats.receiptLog,e)}receipt(e){const t=Ja.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=Ke.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&Xa.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):Xa.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&Xa.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 Ja.check(this.formats.filter,e)}filterLog(e){return Ja.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}}}var $a=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const Ya=new be(Va);function Qa(e){return null==e?"null":(32!==Ie(e)&&Ya.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function Za(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[Qa(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return Qa(e)})).join("&")}function eu(e){if("string"==typeof e){if(32===Ie(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+Za(e);if(Kn.isForkEvent(e))throw Ya.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+Za(e.topics||[])}throw new Error("invalid event - "+e)}function tu(){return(new Date).getTime()}function ru(e){return new Promise((t=>{setTimeout(t,e)}))}const nu=["block","network","pending","poll"];const iu={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 ou(e){return Be(Ke.from(e).toHexString(),32)}function su(e){return ba.encode(xe([e,Pe(va(va(e)),0,4)]))}const au=new RegExp("^(ipfs)://(.*)$","i"),uu=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),au,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function cu(e,t){try{return Pr(fu(e,t))}catch(e){}return null}function fu(e,t){if("0x"===e)return null;const r=Ke.from(Pe(e,t,t+32)).toNumber(),n=Ke.from(Pe(e,r,r+32)).toNumber();return Pe(e,r+32,r+32+n)}function du(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):Ya.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function hu(e){const t=ke(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 lu(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function pu(e){const t=[];let r=0;for(let n=0;n<e.length;n++)t.push(null),r+=32;for(let n=0;n<e.length;n++){const i=ke(e[n]);t[n]=hu(r),t.push(hu(i.length)),t.push(lu(i)),r+=32+32*Math.ceil(i.length/32)}return Ce(t)}class gu{constructor(e,t,r,n){ct(this,"provider",e),ct(this,"name",r),ct(this,"address",e.formatter.address(t)),ct(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>Ke.from(e).eq(1))).catch((e=>{if(e.code===be.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return $a(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:Ce([e,gn(this.name),t||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=Ce(["0x9061b923",pu([mn(this.name),r.data])]));try{let e=yield this.provider.call(r);return ke(e).length%32==4&&Ya.throwError("resolver threw error",be.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=fu(e,0)),e}catch(e){if(e.code===be.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return $a(this,void 0,void 0,(function*(){const r=yield this._fetch(e,t);return null!=r?fu(r,0):null}))}_getAddress(e,t){const r=iu[String(e)];if(null==r&&Ya.throwError(`unsupported coin type: ${e}`,be.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=ke(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 su(xe([[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 su(xe([[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=Wa.toWords(n.slice(2));return e.unshift(t),Wa.encode(r.prefix,e)}}return null}getAddress(e){return $a(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===be.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",ou(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&Ya.throwError("invalid or unsupported coin data",be.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return $a(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;r<uu.length;r++){const n=t.match(uu[r]);if(null==n)continue;const i=n[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:du(t)};case"erc721":case"erc1155":{const r="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const o=this._resolvedAddress||(yield this.getAddress()),s=(n[2]||"").split("/");if(2!==s.length)return null;const a=yield this.provider.formatter.address(s[0]),u=Be(Ke.from(s[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:a,data:Ce(["0x6352211e",u])}));if(o!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=Ke.from(yield this.provider.call({to:a,data:Ce(["0x00fdd58e",Be(o,32),u])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(s[0]),data:Ce([r,u])};let f=cu(yield this.provider.call(c),0);if(null==f)return null;e.push({type:"metadata-url-base",content:f}),"erc1155"===i&&(f=f.replace("{id}",u.substring(2)),e.push({type:"metadata-url-expanded",content:f})),f.match(/^ipfs:/i)&&(f=du(f)),e.push({type:"metadata-url",content:f});const d=yield Ba(f);if(!d)return null;e.push({type:"metadata",content:JSON.stringify(d)});let h=d.image;if("string"!=typeof h)return null;if(h.match(/^(https:\/\/|data:)/i));else{if(null==h.match(au))return null;e.push({type:"url-ipfs",content:h}),h=du(h)}return e.push({type:"url",content:h}),{linkage:e,url:h}}}}}catch(e){}return null}))}getContentHash(){return $a(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+ba.encode("0x"+t[1])}const r=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){const e=parseInt(r[3],16);if(r[4].length===2*e)return"ipns://"+ba.encode("0x"+r[1])}const n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&64===n[1].length)return"bzz://"+n[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"},t=zr("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]));return"sia://"+t}return Ya.throwError("invalid or unsupported content hash data",be.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return $a(this,void 0,void 0,(function*(){let t=Ir(e);t=xe([ou(64),ou(t.length),t]),t.length%32!=0&&(t=xe([t,Be("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",Me(t));return null==r||"0x"===r?null:Pr(r)}))}}let mu=null,yu=1;class bu extends Hn{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ct(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=ft(new.target,"getNetwork")(e);t?(ct(this,"_network",t),this.emit("network",t,null)):Ya.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return $a(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||Ya.throwError("no network detected",be.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:ct(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return ja((()=>this._ready().then((e=>e),(e=>{if(e.code!==be.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==mu&&(mu=new Ja),mu}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in Ra){const r=Ra[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=Ra[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=Ra[e.name];if(!t)return"number"!=typeof e.chainId&&Ea.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&Ea.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;var n;return null==r&&t._defaultProvider&&(r=(n=t._defaultProvider)&&"function"==typeof n.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}(null==e?"homestead":e)}ccipReadFetch(e,t,r){return $a(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<r.length;e++){const t=r[e],s=t.replace("{sender}",n).replace("{data}",i),a=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:n}),u=yield Ba({url:s,errorPassThrough:!0},a,((e,t)=>(e.status=t.statusCode,e)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return Ya.throwError(`response not found during CCIP fetch: ${c}`,be.errors.SERVER_ERROR,{url:t,errorMessage:c});o.push(c)}return Ya.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,be.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(e){return $a(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(tu()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=tu(),r=dt({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=tu();return(e=Ke.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=r,r.catch((e=>{this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return $a(this,void 0,void 0,(function*(){const e=yu++,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)Ya.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Ya.makeError("network block skew detected",be.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 $a(this,void 0,void 0,(function*(){return Ya.throwError("provider does not support network detection",be.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return $a(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 ru(0),this._network;const r=Ya.makeError("underlying network changed",be.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=tu();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=tu(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return $a(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return $a(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const s=[];let a=!1;const u=function(){return!!a||(a=!0,s.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||u()||i(e)};if(this.on(e,c),s.push((()=>{this.removeListener(e,c)})),n){let r=n.startBlock,i=null;const c=s=>$a(this,void 0,void 0,(function*(){a||(yield ru(1e3),this.getTransactionCount(n.from).then((f=>$a(this,void 0,void 0,(function*(){if(!a){if(f<=n.nonce)r=s;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i<n.startBlock&&(i=n.startBlock));i<=s;){if(a)return;const r=yield this.getBlockWithTransactions(i);for(let i=0;i<r.transactions.length;i++){const s=r.transactions[i];if(s.hash===e)return;if(s.from===n.from&&s.nonce===n.nonce){if(a)return;const r=yield this.waitForTransaction(s.hash,t);if(u())return;let i="replaced";return s.data===n.data&&s.to===n.to&&s.value.eq(n.value)?i="repriced":"0x"===s.data&&s.from===s.to&&s.value.isZero()&&(i="cancelled"),void o(Ya.makeError("transaction was replaced",be.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(s),hash:e,receipt:r}))}}i++}}a||this.once("block",c)}}))),(e=>{a||this.once("block",c)})))}));if(a)return;this.once("block",c),s.push((()=>{this.removeListener("block",c)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{u()||o(Ya.makeError("timeout exceeded",be.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),s.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return $a(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ke.from(e)}catch(t){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return Ke.from(n)}catch(e){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return Ke.from(n).toNumber()}catch(e){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return Me(n)}catch(e){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield dt({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>Ne(e)))}),i=yield this.perform("getStorageAt",n);try{return Me(i)}catch(e){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==Ie(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&Ya.throwError("Transaction hash mismatch from Provider.sendTransaction.",be.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>$a(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&&Ya.throwError("transaction failed",be.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),n}sendTransaction(e){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>Me(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 $a(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?Ke.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?Me(e):null)))})),this.formatter.transactionRequest(yield dt(r))}))}_getFilter(e){return $a(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 dt(t))}))}_call(e,t,r){return $a(this,void 0,void 0,(function*(){r>=10&&Ya.throwError("CCIP read exceeded maximum redirections",be.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)&&Ie(i)%32==4)try{const o=Pe(i,4),s=Pe(o,0,32);Ke.from(s).eq(n)||Ya.throwError("CCIP Read sender did not match",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const a=[],u=Ke.from(Pe(o,32,64)).toNumber(),c=Ke.from(Pe(o,u,u+32)).toNumber(),f=Pe(o,u+32);for(let t=0;t<c;t++){const r=cu(f,32*t);null==r&&Ya.throwError("CCIP Read contained corrupt URL string",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),a.push(r)}const d=fu(o,64);Ke.from(Pe(o,100,128)).isZero()||Ya.throwError("CCIP Read callback selector included junk",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const h=Pe(o,96,100),l=fu(o,128),p=yield this.ccipReadFetch(e,d,a);null==p&&Ya.throwError("CCIP Read disabled or provided no URLs",be.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const g={to:n,data:Ce([h,pu([p,l])])};return this._call(g,t,r+1)}catch(e){if(e.code===be.errors.SERVER_ERROR)throw e}try{return Me(i)}catch(r){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:r})}}))}call(e,t){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield dt({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(r.transaction,r.blockTag,r.ccipReadEnabled?0:-1)}))}estimateGas(e){return $a(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield dt({transaction:this._getTransactionRequest(e)}),r=yield this.perform("estimateGas",t);try{return Ke.from(r)}catch(e){return Ya.throwError("bad result from backend",be.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:r,error:e})}}))}_getAddress(e){return $a(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&Ya.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&Ya.throwError("ENS name not configured",be.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return $a(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let r=-128;const n={includeTransactions:!!t};if(Re(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),Re(n.blockTag)&&(r=parseInt(n.blockTag.substring(2),16))}catch(t){Ya.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return ja((()=>$a(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;r<e.transactions.length;r++){const n=e.transactions[r];if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}}const r=this.formatter.blockWithTransactions(e);return r.transactions=r.transactions.map((e=>this._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 $a(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ja((()=>$a(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 $a(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return ja((()=>$a(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 $a(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield dt({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),Ja.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return $a(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return $a(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&Ya.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 $a(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 gu(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return $a(this,void 0,void 0,(function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Ya.throwError("network does not support ENS",be.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+gn(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return $a(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(Re(e))throw t}"string"!=typeof e&&Ya.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return $a(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=cu(yield this.call({to:r,data:"0x691f3431"+gn(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n}))}getAvatar(e){return $a(this,void 0,void 0,(function*(){let t=null;if(Re(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new gu(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==be.errors.CALL_EXCEPTION)throw e}try{const e=cu(yield this.call({to:n,data:"0x691f3431"+gn(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==be.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 Ya.throwError(e+" not implemented",be.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 class{constructor(e,t,r){ct(this,"tag",e),ct(this,"listener",t),ct(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||nu.indexOf(this.tag)>=0}}(eu(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=eu(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=eu(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=eu(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=eu(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=eu(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var vu=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};const wu=new be(Va),_u=["call","estimateGas"];function Eu(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=Re(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=Eu(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return Eu(JSON.parse(e),t)}catch(e){}return null}function Au(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=Eu(t,!0);if(e)return e.data;wu.throwError("missing revert data in call exception; Transaction reverted without a reason string",be.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=Eu(t.body,!1);null==r&&(r=Eu(t,!1)),r&&wu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",be.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===be.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)&&wu.throwError("insufficient funds for intrinsic transaction cost",be.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&wu.throwError("nonce has already been used",be.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wu.throwError("replacement fee too low",be.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&wu.throwError("legacy pre-eip-155 transactions not supported",be.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),_u.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wu.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",be.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function Su(e){return new Promise((function(t){setTimeout(t,e)}))}function ku(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 xu(e){return e?e.toLowerCase():e}const Tu={};class Ru extends Jn{constructor(e,t,r){if(super(),e!==Tu)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ct(this,"provider",t),null==r&&(r=0),"string"==typeof r?(ct(this,"_address",this.provider.formatter.address(r)),ct(this,"_index",null)):"number"==typeof r?(ct(this,"_index",r),ct(this,"_address",null)):wu.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return wu.throwError("cannot alter JSON-RPC Signer connection",be.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new Ou(Tu,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&&wu.throwError("unknown account #"+this._index,be.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=ht(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=ht(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>vu(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&wu.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),dt({tx:dt(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&wu.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)&&wu.throwError("user rejected transaction",be.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),Au("sendTransaction",e,n))))}))}signTransaction(e){return wu.throwError("signing transactions is unsupported",be.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return vu(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 ja((()=>vu(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 vu(this,void 0,void 0,(function*(){const t="string"==typeof e?Ir(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Me(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&wu.throwError("user rejected signing",be.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}}))}_legacySignMessage(e){return vu(this,void 0,void 0,(function*(){const t="string"==typeof e?Ir(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),Me(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&wu.throwError("user rejected signing",be.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}}))}_signTypedData(e,t,r){return vu(this,void 0,void 0,(function*(){const n=yield Pn.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(Pn.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&wu.throwError("user rejected signing",be.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}}))}unlock(e){return vu(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class Ou extends Ru{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 Mu={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Iu extends bu{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=ft(this.constructor,"defaultUrl")()),ct(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(ht(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 vu(this,void 0,void 0,(function*(){yield Su(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=ft(this.constructor,"getNetwork");try{return t(Ke.from(e).toNumber())}catch(t){return wu.throwError("could not detect network",be.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return wu.throwError("could not detect network",be.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new Ru(Tu,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:mt(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=Ba(this.connection,JSON.stringify(r),ku).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",[xu(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[xu(t.address),t.blockTag]];case"getCode":return["eth_getCode",[xu(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[xu(t.address),Be(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",[ft(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[ft(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=xu(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return vu(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&Ke.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=ht(t)).transaction=ht(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&wu.throwError(e+" not implemented",be.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return Au(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 Su(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=ht(Mu);if(t)for(const e in t)t[e]&&(r[e]=!0);!function(e,t){e&&"object"==typeof e||ut.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||ut.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}(e,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=Ne(Ke.from(e[t]));"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=Me(e[t]))})),e.accessList&&(n.accessList=Xs(e.accessList)),n}}const Pu=new be(Va);let Cu=1;function Nu(e,t){const r="Web3LegacyFetcher";return function(e,n){const i={method:e,params:n,id:Cu++,jsonrpc:"2.0"};return new Promise(((e,n)=>{this.emit("debug",{action:"request",fetcher:r,request:mt(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 Bu extends Iu{constructor(e,t){null==e&&Pu.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:mt(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=Nu(0,e.sendAsync.bind(e)):e.send?n=Nu(0,e.send.bind(e)):Pu.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),ct(this,"jsonRpcFetchFunc",n),ct(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const ju=new be("units/5.7.0"),Lu=["wei","kwei","mwei","gwei","szabo","finney","ether"];function Uu(e,t){if("string"!=typeof e&&ju.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=Lu.indexOf(t);-1!==e&&(t=3*e)}return rt(e,null!=t?t:18)}var Du={},Fu=Ku;Ku.strict=Hu,Ku.loose=Gu;var qu=Object.prototype.toString,zu={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function Ku(e){return Hu(e)||Gu(e)}function Hu(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function Gu(e){return zu[qu.call(e)]}var Wu=Fu.strict,Vu=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Du,"__esModule",{value:!0});const Xu=Vu(Fu),Ju=Vu((function(e){if(Wu(e)){var t=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return Buffer.from(e)})),$u="hex",Yu="utf8",Qu="0";function Zu(e){return new Uint8Array(e)}function ec(e,t=!1){const r=e.toString($u);return t?jc(r):r}function tc(e){return e.toString(Yu)}function rc(e){return e.readUIntBE(0,e.length)}function nc(e){return Ju.default(e)}function ic(e,t=!1){return ec(nc(e),t)}function oc(e){return tc(nc(e))}function sc(e){return rc(nc(e))}function ac(e){return Array.from(e).map(yc).join("")}function uc(e){return Buffer.from(Nc(e),$u)}Du.bufferToArray=Zu,Du.bufferToHex=ec,Du.bufferToUtf8=tc,Du.bufferToNumber=rc,Du.bufferToBinary=function(e){return ac(Zu(e))},Du.arrayToBuffer=nc,Du.arrayToHex=ic,Du.arrayToUtf8=oc,Du.arrayToNumber=sc,Du.arrayToBinary=ac;var cc=Du.hexToBuffer=uc;function fc(e){return Zu(uc(e))}function dc(e){return ac(fc(e))}Du.hexToArray=fc,Du.hexToUtf8=function(e){return tc(uc(e))},Du.hexToNumber=function(e){return sc(fc(e))};var hc=Du.hexToBinary=dc;function lc(e){return Buffer.from(e,Yu)}function pc(e){return Zu(lc(e))}Du.utf8ToBuffer=lc,Du.utf8ToArray=pc;var gc=Du.utf8ToHex=function(e,t=!1){return ec(lc(e),t)};Du.utf8ToNumber=function(e){const t=parseInt(e,10);return function(e,t){if(!e)throw new Error(t)}(!function(e){return void 0===e}(t),"Number can only safely store up to 53 bits"),t},Du.utf8ToBinary=function(e){return ac(pc(e))},Du.numberToBuffer=function(e){return bc(yc(e))},Du.numberToArray=function(e){return vc(yc(e))};var mc=Du.numberToHex=function(e,t){return wc(yc(e),t)};function yc(e){return Mc((e>>>0).toString(2))}function bc(e){return nc(vc(e))}function vc(e){return new Uint8Array(Rc(e).map((e=>parseInt(e,2))))}function wc(e,t){return ic(vc(e),t)}Du.numberToUtf8=function(e){return`${e}`},Du.numberToBinary=yc,Du.binaryToBuffer=bc,Du.binaryToArray=vc,Du.binaryToHex=wc,Du.binaryToUtf8=function(e){return oc(vc(e))};var _c=Du.binaryToNumber=function(e){return sc(vc(e))};function Ec(e){return!("string"!=typeof e||!new RegExp(/^[01]+$/).test(e))&&e.length%8==0}function Ac(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function Sc(e){return Buffer.isBuffer(e)}function kc(e){return Xu.default.strict(e)&&!Sc(e)}function xc(e){return!kc(e)&&!Sc(e)&&void 0!==e.byteLength}function Tc(e,t=8){const r=e%t;return r?(e-r)/t*t+t:e}function Rc(e,t=8){const r=Mc(e).match(new RegExp(`.{${t}}`,"gi"));return Array.from(r||[])}function Oc(e){return Rc(e).map(Dc).join("")}function Mc(e,t=8,r=Qu){return Pc(e,Tc(e.length,t),r)}Du.isBinaryString=Ec,Du.isHexString=Ac,Du.isBuffer=Sc,Du.isTypedArray=kc,Du.isArrayBuffer=xc,Du.getType=function(e){return Sc(e)?"buffer":kc(e)?"typed-array":xc(e)?"array-buffer":Array.isArray(e)?"array":typeof e},Du.getEncoding=function(e){return Ec(e)?"binary":Ac(e)?$u:Yu},Du.concatBuffers=function(...e){return Buffer.concat(e)},Du.concatArrays=function(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])},Du.trimLeft=function(e,t){const r=e.length-t;return r>0&&(e=e.slice(r)),e},Du.trimRight=function(e,t){return e.slice(0,t)},Du.calcByteLength=Tc,Du.splitBytes=Rc,Du.swapBytes=Oc,Du.swapHex=function(e){return wc(Oc(dc(e)))};var Ic=Du.sanitizeBytes=Mc;function Pc(e,t,r=Qu){return Fc(e,t,!0,r)}var Cc=Du.padLeft=Pc;function Nc(e){return e.replace(/^0x/,"")}Du.padRight=function(e,t,r=Qu){return Fc(e,t,!1,r)};var Bc=Du.removeHexPrefix=Nc;function jc(e){return e.startsWith("0x")?e:`0x${e}`}var Lc=Du.addHexPrefix=jc;var Uc=Du.sanitizeHex=function(e){return(e=Mc(e=Nc(e),2))&&(e=jc(e)),e};function Dc(e){return e.split("").reverse().join("")}function Fc(e,t,r,n=Qu){const i=t-e.length;let o=e;if(i>0){const t=n.repeat(i);o=r?t+e:e+t}return o}Du.removeHexLeadingZeros=function(e){const t=e.startsWith("0x");return e=(e=Nc(e)).startsWith(Qu)?e.substring(1):e,t?jc(e):e};var qc={},zc="6.5.4",Kc={},Hc={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:se.Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s<o;s++){var a=e.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}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<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},i.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},i.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=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<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=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,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f<a;f+=n)c=u(e,f,f+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var d=1;for(c=u(e,f,e.length,t),f=0;f<s;f++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(e,t,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],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var f=u>>>26,d=67108863&u,h=Math.min(c,t.length-1),l=Math.max(0,c-e.length+1);l<=h;l++){var p=c-l|0;f+=(s=(i=0|e.words[p])*(o=0|t.words[l])+d)/67108864|0,d=67108863&s}r.words[c]=0|d,u=0|f}return 0!==u?r.words[c]=0|u: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,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);n=0!==(o=a>>>24-i&16777215)||s!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var h=f[e],l=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(l).toString(e);n=(p=p.idivn(l)).isZero()?g+n:c[h-g.length]+g+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 s,a,u="le"===t,c=new e(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),c[o-a-1]=s}return c},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 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(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;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},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<<i:this.words[n]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var 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,s=0;s<n.length;s++)o=(t=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<r.length;s++)o=(t=(0|r.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var l=function(e,t,r){var n,i,o,s=e.words,a=t.words,u=r.words,c=0,f=0|s[0],d=8191&f,h=f>>>13,l=0|s[1],p=8191&l,g=l>>>13,m=0|s[2],y=8191&m,b=m>>>13,v=0|s[3],w=8191&v,_=v>>>13,E=0|s[4],A=8191&E,S=E>>>13,k=0|s[5],x=8191&k,T=k>>>13,R=0|s[6],O=8191&R,M=R>>>13,I=0|s[7],P=8191&I,C=I>>>13,N=0|s[8],B=8191&N,j=N>>>13,L=0|s[9],U=8191&L,D=L>>>13,F=0|a[0],q=8191&F,z=F>>>13,K=0|a[1],H=8191&K,G=K>>>13,W=0|a[2],V=8191&W,X=W>>>13,J=0|a[3],$=8191&J,Y=J>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,fe=0|a[8],de=8191&fe,he=fe>>>13,le=0|a[9],pe=8191&le,ge=le>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(c+(n=Math.imul(d,q))|0)+((8191&(i=(i=Math.imul(d,z))+Math.imul(h,q)|0))<<13)|0;c=((o=Math.imul(h,z))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,q),i=(i=Math.imul(p,z))+Math.imul(g,q)|0,o=Math.imul(g,z);var ye=(c+(n=n+Math.imul(d,H)|0)|0)+((8191&(i=(i=i+Math.imul(d,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((o=o+Math.imul(h,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,q),i=(i=Math.imul(y,z))+Math.imul(b,q)|0,o=Math.imul(b,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(g,H)|0,o=o+Math.imul(g,G)|0;var be=(c+(n=n+Math.imul(d,V)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,V)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,q),i=(i=Math.imul(w,z))+Math.imul(_,q)|0,o=Math.imul(_,z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,X)|0;var ve=(c+(n=n+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,Y)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(A,q),i=(i=Math.imul(A,z))+Math.imul(S,q)|0,o=Math.imul(S,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(b,V)|0,o=o+Math.imul(b,X)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,$)|0,o=o+Math.imul(g,Y)|0;var we=(c+(n=n+Math.imul(d,Z)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,Z)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(x,q),i=(i=Math.imul(x,z))+Math.imul(T,q)|0,o=Math.imul(T,z),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,Y)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,ee)|0;var _e=(c+(n=n+Math.imul(d,re)|0)|0)+((8191&(i=(i=i+Math.imul(d,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(O,q),i=(i=Math.imul(O,z))+Math.imul(M,q)|0,o=Math.imul(M,z),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,X)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(g,re)|0,o=o+Math.imul(g,ne)|0;var Ee=(c+(n=n+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,se)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,se)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(P,q),i=(i=Math.imul(P,z))+Math.imul(C,q)|0,o=Math.imul(C,z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,G)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,X)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,Y)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var Ae=(c+(n=n+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(B,q),i=(i=Math.imul(B,z))+Math.imul(j,q)|0,o=Math.imul(j,z),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,G)|0,n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,X)|0,n=n+Math.imul(x,$)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,Y)|0,n=n+Math.imul(A,Z)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,ce)|0;var Se=(c+(n=n+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,q),i=(i=Math.imul(U,z))+Math.imul(D,q)|0,o=Math.imul(D,z),n=n+Math.imul(B,H)|0,i=(i=i+Math.imul(B,G)|0)+Math.imul(j,H)|0,o=o+Math.imul(j,G)|0,n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(C,V)|0,o=o+Math.imul(C,X)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,Y)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(S,re)|0,o=o+Math.imul(S,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,ce)|0,n=n+Math.imul(p,de)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(g,de)|0,o=o+Math.imul(g,he)|0;var ke=(c+(n=n+Math.imul(d,pe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ge)|0)+Math.imul(h,pe)|0))<<13)|0;c=((o=o+Math.imul(h,ge)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,H),i=(i=Math.imul(U,G))+Math.imul(D,H)|0,o=Math.imul(D,G),n=n+Math.imul(B,V)|0,i=(i=i+Math.imul(B,X)|0)+Math.imul(j,V)|0,o=o+Math.imul(j,X)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,Y)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,Y)|0,n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(T,re)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(A,oe)|0,i=(i=i+Math.imul(A,se)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,se)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,n=n+Math.imul(y,de)|0,i=(i=i+Math.imul(y,he)|0)+Math.imul(b,de)|0,o=o+Math.imul(b,he)|0;var xe=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;c=((o=o+Math.imul(g,ge)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,X))+Math.imul(D,V)|0,o=Math.imul(D,X),n=n+Math.imul(B,$)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(j,$)|0,o=o+Math.imul(j,Y)|0,n=n+Math.imul(P,Z)|0,i=(i=i+Math.imul(P,ee)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,n=n+Math.imul(A,ue)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,n=n+Math.imul(w,de)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Te=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,ge)|0)+Math.imul(b,pe)|0))<<13)|0;c=((o=o+Math.imul(b,ge)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,$),i=(i=Math.imul(U,Y))+Math.imul(D,$)|0,o=Math.imul(D,Y),n=n+Math.imul(B,Z)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(j,Z)|0,o=o+Math.imul(j,ee)|0,n=n+Math.imul(P,re)|0,i=(i=i+Math.imul(P,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(O,oe)|0,i=(i=i+Math.imul(O,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,n=n+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(T,ue)|0,o=o+Math.imul(T,ce)|0,n=n+Math.imul(A,de)|0,i=(i=i+Math.imul(A,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Re=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ge)|0)+Math.imul(_,pe)|0))<<13)|0;c=((o=o+Math.imul(_,ge)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,ee))+Math.imul(D,Z)|0,o=Math.imul(D,ee),n=n+Math.imul(B,re)|0,i=(i=i+Math.imul(B,ne)|0)+Math.imul(j,re)|0,o=o+Math.imul(j,ne)|0,n=n+Math.imul(P,oe)|0,i=(i=i+Math.imul(P,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(O,ue)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,n=n+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(T,de)|0,o=o+Math.imul(T,he)|0;var Oe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,ge)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ge)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(D,re)|0,o=Math.imul(D,ne),n=n+Math.imul(B,oe)|0,i=(i=i+Math.imul(B,se)|0)+Math.imul(j,oe)|0,o=o+Math.imul(j,se)|0,n=n+Math.imul(P,ue)|0,i=(i=i+Math.imul(P,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,n=n+Math.imul(O,de)|0,i=(i=i+Math.imul(O,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var Me=(c+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ge)|0)+Math.imul(T,pe)|0))<<13)|0;c=((o=o+Math.imul(T,ge)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,se))+Math.imul(D,oe)|0,o=Math.imul(D,se),n=n+Math.imul(B,ue)|0,i=(i=i+Math.imul(B,ce)|0)+Math.imul(j,ue)|0,o=o+Math.imul(j,ce)|0,n=n+Math.imul(P,de)|0,i=(i=i+Math.imul(P,he)|0)+Math.imul(C,de)|0,o=o+Math.imul(C,he)|0;var Ie=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,ge)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ge)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,ue),i=(i=Math.imul(U,ce))+Math.imul(D,ue)|0,o=Math.imul(D,ce),n=n+Math.imul(B,de)|0,i=(i=i+Math.imul(B,he)|0)+Math.imul(j,de)|0,o=o+Math.imul(j,he)|0;var Pe=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(i=(i=i+Math.imul(P,ge)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ge)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,de),i=(i=Math.imul(U,he))+Math.imul(D,de)|0,o=Math.imul(D,he);var Ce=(c+(n=n+Math.imul(B,pe)|0)|0)+((8191&(i=(i=i+Math.imul(B,ge)|0)+Math.imul(j,pe)|0))<<13)|0;c=((o=o+Math.imul(j,ge)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Ne=(c+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,ge))+Math.imul(D,pe)|0))<<13)|0;return c=((o=Math.imul(D,ge))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=me,u[1]=ye,u[2]=be,u[3]=ve,u[4]=we,u[5]=_e,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=ke,u[10]=xe,u[11]=Te,u[12]=Re,u[13]=Oe,u[14]=Me,u[15]=Ie,u[16]=Pe,u[17]=Ce,u[18]=Ne,0!==c&&(u[19]=c,r.length++),r};function p(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(l=h),i.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?l(this,e,t):n<63?h(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<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var f=o-c,d=(0|e.words[f])*(0|t.words[c]),h=67108863&d;a=67108863&(h=h+a|0),i+=(s=(s=s+(d/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},g.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s<o;s++)n[s]=t[e[s]],i[s]=r[e[s]]},g.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var d=u,h=c,l=0;l<s;l++){var p=r[f+l],g=n[f+l],m=r[f+l+s],y=n[f+l+s],b=d*m-h*y;y=d*y+h*m,m=b,r[f+l]=p+m,n[f+l]=g+y,r[f+l+s]=p-m,n[f+l+s]=g-y,l!==a&&(b=u*d-c*h,h=u*h+c*d,d=b)}},g.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},g.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},g.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},g.prototype.convert13b=function(e,t,n,i){for(var o=0,s=0;s<t;s++)o+=0|e[s],n[2*s]=8191&o,o>>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s<i;++s)n[s]=0;r(0===o),r(0==(-8192&o))},g.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},g.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),c=new Array(n),f=new Array(n),d=new Array(n),h=r.words;h.length=n,this.convert13b(e.words,e.length,s,n),this.convert13b(t.words,t.length,c,n),this.transform(s,o,a,u,n,i),this.transform(c,o,f,d,n,i);for(var l=0;l<n;l++){var p=a[l]*f[l]-u[l]*d[l];u[l]=a[l]*d[l]+u[l]*f[l],a[l]=p}return this.conjugate(a,u,n),this.transform(a,u,h,o,n,i),this.conjugate(h,o,n),this.normalize13b(h,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},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),p(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},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<t.length;r++){var n=r/26|0,i=r%26;t[r]=(e.words[n]&1<<i)>>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var o=r.sqr();n<t.length;n++,o=o.sqr())0!==t[n]&&(r=r.mul(o));return r},i.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<n;this.words[t]=u|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},i.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var d=0|this.words[c];this.words[c]=f<<26-o|d>>>o,f=d&a}return u&&0!==f&&(u.words[u.length++]=f),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<<t;return!(this.length<=n)&&!!(this.words[n]&i)},i.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>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,s=0|o.words[o.length-1];0!==(r=26-this._countBits(s))&&(o=o.ushln(r),n.iushln(r),s=0|o.words[o.length-1]);var a,u=n.length-o.length;if("mod"!==t){(a=new i(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var f=n.clone()._ishlnsubmul(o,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var d=u-1;d>=0;d--){var h=67108864*(0|n.words[o.length+d])+(0|n.words[o.length+d-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(o,h,d);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(o,1,d),n.isZero()||(n.negative^=1);a&&(a.words[d]=h)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||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?(a=this.neg().divmod(e,t),"mod"!==t&&(o=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:o,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(o=a.div.neg()),{div:o,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):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,s,a},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),s=new i(0),a=new i(0),u=new i(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),d=t.clone();!t.isZero();){for(var h=0,l=1;0==(t.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||s.isOdd())&&(o.iadd(f),s.isub(d)),o.iushrn(1),s.iushrn(1);for(var p=0,g=1;0==(n.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(d)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a),s.isub(u)):(n.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:n.iushln(c)}},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,s=new i(1),a=new i(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(t.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var d=0,h=1;0==(n.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(n.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(o=0===t.cmpn(1)?s:a).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 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=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:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new E(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 m={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(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 A(e){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)}y.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.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=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(b,y),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i<n;i++)t.words[i]=e.words[i];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&r,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,y),n(w,y),n(_,y),_.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new b;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 _}return m[e]=t,t},E.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.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)},E.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},E.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)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,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),s=0;!o.isZero()&&0===o.andln(1);)s++,o.iushrn(1);r(!o.isZero());var a=new i(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new i(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var d=this.pow(f,o),h=this.pow(e,o.addn(1).iushrn(1)),l=this.pow(e,o),p=s;0!==l.cmp(a);){for(var g=l,m=0;0!==g.cmp(a);m++)g=g.redSqr();r(m<p);var y=this.pow(d,new i(1).iushln(p-m-1));h=h.redMul(y),d=y.redSqr(),l=l.redMul(d),p=m}return h},E.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},E.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new i(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var o=r[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],f=u-1;f>=0;f--){var d=c>>f&1;o!==r[0]&&(o=this.sqr(o)),0!==d||0!==s?(s<<=1,s|=d,(4===++a||0===n&&0===f)&&(o=this.mul(o,r[s]),a=0,s=0)):a=0}u=26}return o},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new A(e)},n(A,E),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.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)},A.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),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,r)}(Hc);var Gc=Hc.exports,Wc={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var i=e.charCodeAt(n),o=i>>8,s=255&i;o?r.push(o,s):r.push(s)}return r},t.zero2=r,t.toHex=n,t.encode=function(e,t){return"hex"===t?n(e):e}}(Wc),function(e){var t=e,r=Gc,n=Zn,i=Wc;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=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,o=e.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},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 s,a,u=e.andln(3)+i&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),s=0==(1&u)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?u:-u,r[0].push(s),a=0==(1&c)?0:3!==(n=t.andln(7)+o&7)&&5!==n||2!==u?c:-c,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+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")}}(Kc);var Vc,Xc={exports:{}},Jc=i(Object.freeze({__proto__:null,default:{}}));function $c(e){this.rand=e}if(Xc.exports=function(e){return Vc||(Vc=new $c(null)),Vc.generate(e)},Xc.exports.Rand=$c,$c.prototype.generate=function(e){return this._rand(e)},$c.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?$c.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?$c.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&($c.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var Yc=Jc;if("function"!=typeof Yc.randomBytes)throw new Error("Not supported");$c.prototype._rand=function(e){return Yc.randomBytes(e)}}catch(tR){}var Qc=Xc.exports,Zc={},ef=Gc,tf=Kc,rf=tf.getNAF,nf=tf.getJSF,of=tf.assert;function sf(e,t){this.type=e,this.p=new ef(t.p,16),this.red=t.prime?ef.red(t.prime):ef.mont(this.p),this.zero=new ef(0).toRed(this.red),this.one=new ef(1).toRed(this.red),this.two=new ef(2).toRed(this.red),this.n=t.n&&new ef(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 af=sf;function uf(e,t){this.curve=e,this.type=t,this.precomputed=null}sf.prototype.point=function(){throw new Error("Not implemented")},sf.prototype.validate=function(){throw new Error("Not implemented")},sf.prototype._fixedNafMul=function(e,t){of(e.precomputed);var r=e._getDoubles(),n=rf(t,1,this._bitLength),i=(1<<r.step+1)-(r.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<n.length;o+=r.step){s=0;for(var u=o+r.step-1;u>=o;u--)s=(s<<1)+n[u];a.push(s)}for(var c=this.jpoint(null,null,null),f=this.jpoint(null,null,null),d=i;d>0;d--){for(o=0;o<a.length;o++)(s=a[o])===d?f=f.mixedAdd(r.points[o]):s===-d&&(f=f.mixedAdd(r.points[o].neg()));c=c.add(f)}return c.toP()},sf.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var i=n.points,o=rf(t,r,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var u=0;a>=0&&0===o[a];a--)u++;if(a>=0&&u++,s=s.dblp(u),a<0)break;var c=o[a];of(0!==c),s="affine"===e.type?c>0?s.mixedAdd(i[c-1>>1]):s.mixedAdd(i[-c-1>>1].neg()):c>0?s.add(i[c-1>>1]):s.add(i[-c-1>>1].neg())}return"affine"===e.type?s.toP():s},sf.prototype._wnafMulAdd=function(e,t,r,n,i){var o,s,a,u=this._wnafT1,c=this._wnafT2,f=this._wnafT3,d=0;for(o=0;o<n;o++){var h=(a=t[o])._getNAFPoints(e);u[o]=h.wnd,c[o]=h.points}for(o=n-1;o>=1;o-=2){var l=o-1,p=o;if(1===u[l]&&1===u[p]){var g=[t[l],null,null,t[p]];0===t[l].y.cmp(t[p].y)?(g[1]=t[l].add(t[p]),g[2]=t[l].toJ().mixedAdd(t[p].neg())):0===t[l].y.cmp(t[p].y.redNeg())?(g[1]=t[l].toJ().mixedAdd(t[p]),g[2]=t[l].add(t[p].neg())):(g[1]=t[l].toJ().mixedAdd(t[p]),g[2]=t[l].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=nf(r[l],r[p]);for(d=Math.max(y[0].length,d),f[l]=new Array(d),f[p]=new Array(d),s=0;s<d;s++){var b=0|y[0][s],v=0|y[1][s];f[l][s]=m[3*(b+1)+(v+1)],f[p][s]=0,c[l]=g}}else f[l]=rf(r[l],u[l],this._bitLength),f[p]=rf(r[p],u[p],this._bitLength),d=Math.max(f[l].length,d),d=Math.max(f[p].length,d)}var w=this.jpoint(null,null,null),_=this._wnafT4;for(o=d;o>=0;o--){for(var E=0;o>=0;){var A=!0;for(s=0;s<n;s++)_[s]=0|f[s][o],0!==_[s]&&(A=!1);if(!A)break;E++,o--}if(o>=0&&E++,w=w.dblp(E),o<0)break;for(s=0;s<n;s++){var S=_[s];0!==S&&(S>0?a=c[s][S-1>>1]:S<0&&(a=c[s][-S-1>>1].neg()),w="affine"===a.type?w.mixedAdd(a):w.add(a))}}for(o=0;o<n;o++)c[o]=null;return i?w:w.toP()},sf.BasePoint=uf,uf.prototype.eq=function(){throw new Error("Not implemented")},uf.prototype.validate=function(){return this.curve.validate(this)},sf.prototype.decodePoint=function(e,t){e=tf.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?of(e[e.length-1]%2==0):7===e[0]&&of(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},uf.prototype.encodeCompressed=function(e){return this.encode(e,!0)},uf.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},uf.prototype.encode=function(e,t){return tf.encode(this._encode(t),e)},uf.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},uf.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},uf.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},uf.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},uf.prototype._getBeta=function(){return null},uf.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var cf=Gc,ff=ri,df=af,hf=Kc.assert;function lf(e){df.call(this,"short",e),this.a=new cf(e.a,16).toRed(this.red),this.b=new cf(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}ff(lf,df);var pf=lf;function gf(e,t,r,n){df.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new cf(t,16),this.y=new cf(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function mf(e,t,r,n){df.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new cf(0)):(this.x=new cf(t,16),this.y=new cf(r,16),this.z=new cf(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}lf.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new cf(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new cf(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],hf(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new cf(e.a,16),b:new cf(e.b,16)}})):this._getEndoBasis(r)}}},lf.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:cf.mont(e),r=new cf(2).toRed(t).redInvm(),n=r.redNeg(),i=new cf(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},lf.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,s,a,u,c,f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),l=new cf(1),p=new cf(0),g=new cf(0),m=new cf(1),y=0;0!==d.cmpn(0);){var b=h.div(d);u=h.sub(b.mul(d)),c=g.sub(b.mul(l));var v=m.sub(b.mul(p));if(!n&&u.cmp(f)<0)t=a.neg(),r=l,n=u.neg(),i=c;else if(n&&2==++y)break;a=u,h=d,d=u,g=l,l=c,m=p,p=v}o=u.neg(),s=c;var w=n.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=t,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},lf.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),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),c=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:u.add(c).neg()}},lf.prototype.pointFromX=function(e,t){(e=new cf(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)},lf.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)},lf.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var s=this._endoSplit(t[o]),a=e[o],u=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),u=u.neg(!0)),n[2*o]=a,n[2*o+1]=u,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var c=this._wnafMulAdd(1,n,i,2*o,r),f=0;f<2*o;f++)n[f]=null,i[f]=null;return c},ff(gf,df.BasePoint),lf.prototype.point=function(e,t,r){return new gf(this,e,t,r)},lf.prototype.pointFromJSON=function(e,t){return gf.fromJSON(this,e,t)},gf.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},gf.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},gf.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}var o=t[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},gf.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},gf.prototype.isInfinity=function(){return this.inf},gf.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)},gf.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)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},gf.prototype.getX=function(){return this.x.fromRed()},gf.prototype.getY=function(){return this.y.fromRed()},gf.prototype.mul=function(e){return e=new cf(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)},gf.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)},gf.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)},gf.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))},gf.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},gf.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},ff(mf,df.BasePoint),lf.prototype.jpoint=function(e,t,r){return new mf(this,e,t,r)},mf.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)},mf.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},mf.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)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),f=c.redMul(a),d=n.redMul(c),h=u.redSqr().redIAdd(f).redISub(d).redISub(d),l=u.redMul(d.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,l,p)},mf.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),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),c=u.redMul(s),f=r.redMul(u),d=a.redSqr().redIAdd(c).redISub(f).redISub(f),h=a.redMul(f.redISub(d)).redISub(i.redMul(c)),l=this.z.redMul(s);return this.curve.jpoint(d,h,l)},mf.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<e;t++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,u=a.redSqr().redSqr(),c=s.redAdd(s);for(t=0;t<e;t++){var f=o.redSqr(),d=c.redSqr(),h=d.redSqr(),l=f.redAdd(f).redIAdd(f).redIAdd(n.redMul(u)),p=o.redMul(d),g=l.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=l.redMul(m);y=y.redIAdd(y).redISub(h);var b=c.redMul(a);t+1<e&&(u=u.redMul(h)),o=g,a=b,c=y}return this.curve.jpoint(o,c.redMul(i),a)},mf.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},mf.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),u=a.redSqr().redISub(s).redISub(s),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),l=this.x.redAdd(d).redSqr().redISub(f).redISub(h);l=l.redIAdd(l);var p=f.redAdd(f).redIAdd(f),g=p.redSqr(),m=h.redIAdd(h);m=(m=m.redIAdd(m)).redIAdd(m),e=g.redISub(l).redISub(l),t=p.redMul(l.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},mf.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(n).redISub(o);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=a.redSqr().redISub(s).redISub(s);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=a.redMul(s.redISub(u)).redISub(c),r=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),l=this.x.redSub(f).redMul(this.x.redAdd(f));l=l.redAdd(l).redIAdd(l);var p=h.redIAdd(h),g=(p=p.redIAdd(p)).redAdd(p);e=l.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(f);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=l.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},mf.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),s=r.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(s),f=a.redSqr().redISub(c.redAdd(c)),d=c.redISub(f),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var l=a.redMul(d).redISub(h),p=r.redAdd(r).redMul(n);return this.curve.jpoint(f,l,p)},mf.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(u),f=t.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var d=this.x.redMul(a).redISub(f);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var l=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(d,h,l)},mf.prototype.mul=function(e,t){return e=new cf(e,t),this.curve._wnafMul(this,e)},mf.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),i=r.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(n)).cmpn(0)},mf.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},mf.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},mf.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var yf=Gc,bf=ri,vf=af,wf=Kc;function _f(e){vf.call(this,"mont",e),this.a=new yf(e.a,16).toRed(this.red),this.b=new yf(e.b,16).toRed(this.red),this.i4=new yf(4).toRed(this.red).redInvm(),this.two=new yf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}bf(_f,vf);var Ef=_f;function Af(e,t,r){vf.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new yf(t,16),this.z=new yf(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}_f.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)},bf(Af,vf.BasePoint),_f.prototype.decodePoint=function(e,t){return this.point(wf.toArray(e,t),1)},_f.prototype.point=function(e,t){return new Af(this,e,t)},_f.prototype.pointFromJSON=function(e){return Af.fromJSON(this,e)},Af.prototype.precompute=function(){},Af.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Af.fromJSON=function(e,t){return new Af(e,t[0],t[1]||e.one)},Af.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Af.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Af.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)},Af.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Af.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),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),u=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},Af.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},Af.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Af.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Af.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Af.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Af.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Sf=Gc,kf=ri,xf=af,Tf=Kc.assert;function Rf(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,xf.call(this,"edwards",e),this.a=new Sf(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Sf(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Sf(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Tf(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}kf(Rf,xf);var Of=Rf;function Mf(e,t,r,n,i){xf.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 Sf(t,16),this.y=new Sf(r,16),this.z=n?new Sf(n,16):this.curve.one,this.t=i&&new Sf(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()))))}Rf.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},Rf.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},Rf.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},Rf.prototype.pointFromX=function(e,t){(e=new Sf(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()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var a=s.fromRed().isOdd();return(t&&!a||!t&&a)&&(s=s.redNeg()),this.point(e,s)},Rf.prototype.pointFromY=function(e,t){(e=new Sf(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 s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},Rf.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)},kf(Mf,xf.BasePoint),Rf.prototype.pointFromJSON=function(e){return Mf.fromJSON(this,e)},Rf.prototype.point=function(e,t,r,n){return new Mf(this,e,t,r,n)},Mf.fromJSON=function(e,t){return new Mf(e,t[0],t[1],t[2])},Mf.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Mf.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Mf.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),s=o.redSub(r),a=n.redSub(t),u=i.redMul(s),c=o.redMul(a),f=i.redMul(a),d=s.redMul(o);return this.curve.point(u,c,d,f)},Mf.prototype._projDbl=function(){var e,t,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(n=this.curve._mulA(a)).redAdd(u);this.zOne?(e=s.redSub(a).redSub(u).redMul(c.redSub(this.curve.two)),t=c.redMul(n.redSub(u)),r=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),e=s.redSub(a).redISub(u).redMul(o),t=c.redMul(n.redSub(u)),r=c.redMul(o))}else n=a.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(a.redISub(u)),r=n.redMul(o);return this.curve.point(e,t,r)},Mf.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Mf.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),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(t),c=o.redMul(s),f=a.redMul(u),d=o.redMul(u),h=s.redMul(a);return this.curve.point(c,f,h,d)},Mf.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),c=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),d=n.redMul(u).redMul(f);return this.curve.twisted?(t=n.redMul(c).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(c)):(t=n.redMul(c).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(c)),this.curve.point(d,t,r)},Mf.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},Mf.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},Mf.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},Mf.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},Mf.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},Mf.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Mf.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Mf.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Mf.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},Mf.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}},Mf.prototype.toP=Mf.prototype.normalize,Mf.prototype.mixedAdd=Mf.prototype.add,function(e){var t=e;t.base=af,t.short=pf,t.mont=Ef,t.edwards=Of}(Zc);var If,Pf,Cf={};!function(e){var t,r=e,n=Yn,i=Zc,o=Kc.assert;function s(e){"short"===e.type?this.curve=new i.short(e):"edwards"===e.type?this.curve=new i.edwards(e):this.curve=new i.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new s(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=s,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:n.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:n.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:n.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:n.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:n.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:n.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:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{t=Pf?If:(Pf=1,If={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}})}catch(e){t=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:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",t]})}(Cf);var Nf=Yn,Bf=Wc,jf=Zn;function Lf(e){if(!(this instanceof Lf))return new Lf(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=Bf.toArray(e.entropy,e.entropyEnc||"hex"),r=Bf.toArray(e.nonce,e.nonceEnc||"hex"),n=Bf.toArray(e.pers,e.persEnc||"hex");jf(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Uf=Lf;Lf.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.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Lf.prototype._hmac=function(){return new Nf.hmac(this.hash,this.K)},Lf.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Lf.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=Bf.toArray(e,t),r=Bf.toArray(r,n),jf(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Lf.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=Bf.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(r),this._reseed++,Bf.encode(o,t)};var Df=Gc,Ff=Kc.assert;function qf(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var zf=qf;qf.fromPublic=function(e,t,r){return t instanceof qf?t:new qf(e,{pub:t,pubEnc:r})},qf.fromPrivate=function(e,t,r){return t instanceof qf?t:new qf(e,{priv:t,privEnc:r})},qf.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},qf.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},qf.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},qf.prototype._importPrivate=function(e,t){this.priv=new Df(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},qf.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Ff(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Ff(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},qf.prototype.derive=function(e){return e.validate()||Ff(e.validate(),"public point not validated"),e.mul(this.priv).getX()},qf.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},qf.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},qf.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Kf=Gc,Hf=Kc,Gf=Hf.assert;function Wf(e,t){if(e instanceof Wf)return e;this._importDER(e,t)||(Gf(e.r&&e.s,"Signature without r or s"),this.r=new Kf(e.r,16),this.s=new Kf(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var Vf=Wf;function Xf(){this.place=0}function Jf(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,s=t.place;o<n;o++,s++)i<<=8,i|=e[s],i>>>=0;return!(i<=127)&&(t.place=s,i)}function $f(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function Yf(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Wf.prototype._importDER=function(e,t){e=Hf.toArray(e,t);var r=new Xf;if(48!==e[r.place++])return!1;var n=Jf(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=Jf(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 s=Jf(e,r);if(!1===s)return!1;if(e.length!==s+r.place)return!1;var a=e.slice(r.place,s+r.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new Kf(o),this.s=new Kf(a),this.recoveryParam=null,!0},Wf.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=$f(t),r=$f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Yf(n,t.length),(n=n.concat(t)).push(2),Yf(n,r.length);var i=n.concat(r),o=[48];return Yf(o,i.length),o=o.concat(i),Hf.encode(o,e)};var Qf=Gc,Zf=Uf,ed=Cf,td=Qc,rd=Kc.assert,nd=zf,id=Vf;function od(e){if(!(this instanceof od))return new od(e);"string"==typeof e&&(rd(Object.prototype.hasOwnProperty.call(ed,e),"Unknown curve "+e),e=ed[e]),e instanceof ed.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 sd=od;od.prototype.keyPair=function(e){return new nd(this,e)},od.prototype.keyFromPrivate=function(e,t){return nd.fromPrivate(this,e,t)},od.prototype.keyFromPublic=function(e,t){return nd.fromPublic(this,e,t)},od.prototype.genKeyPair=function(e){e||(e={});for(var t=new Zf({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||td(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Qf(2));;){var i=new Qf(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},od.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},od.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 Qf(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),s=e.toArray("be",i),a=new Zf({hash:this.hash,entropy:o,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),u=this.n.sub(new Qf(1)),c=0;;c++){var f=n.k?n.k(c):new Qf(a.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(u)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var h=d.getX(),l=h.umod(this.n);if(0!==l.cmpn(0)){var p=f.invm(this.n).mul(l.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var g=(d.getY().isOdd()?1:0)|(0!==h.cmp(l)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),g^=1),new id({r:l,s:p,recoveryParam:g})}}}}}},od.prototype.verify=function(e,t,r,n){e=this._truncateToN(new Qf(e,16)),r=this.keyFromPublic(r,n);var i=(t=new id(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 s,a=o.invm(this.n),u=a.mul(e).umod(this.n),c=a.mul(i).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(u,r.getPublic(),c)).isInfinity()&&s.eqXToP(i):!(s=this.g.mulAdd(u,r.getPublic(),c)).isInfinity()&&0===s.getX().umod(this.n).cmp(i)},od.prototype.recoverPubKey=function(e,t,r,n){rd((3&r)===r,"The recovery param is more than two bits"),t=new id(t,n);var i=this.n,o=new Qf(e),s=t.r,a=t.s,u=1&r,c=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");s=c?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var f=t.r.invm(i),d=i.sub(o).mul(f).umod(i),h=a.mul(f).umod(i);return this.g.mulAdd(d,s,h)},od.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new id(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 ad=Kc,ud=ad.assert,cd=ad.parseBytes,fd=ad.cachedProperty;function dd(e,t){this.eddsa=e,this._secret=cd(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=cd(t.pub)}dd.fromPublic=function(e,t){return t instanceof dd?t:new dd(e,{pub:t})},dd.fromSecret=function(e,t){return t instanceof dd?t:new dd(e,{secret:t})},dd.prototype.secret=function(){return this._secret},fd(dd,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),fd(dd,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),fd(dd,"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})),fd(dd,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),fd(dd,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),fd(dd,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),dd.prototype.sign=function(e){return ud(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},dd.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},dd.prototype.getSecret=function(e){return ud(this._secret,"KeyPair is public only"),ad.encode(this.secret(),e)},dd.prototype.getPublic=function(e){return ad.encode(this.pubBytes(),e)};var hd=dd,ld=Gc,pd=Kc,gd=pd.assert,md=pd.cachedProperty,yd=pd.parseBytes;function bd(e,t){this.eddsa=e,"object"!=typeof t&&(t=yd(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),gd(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof ld&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}md(bd,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),md(bd,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),md(bd,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),md(bd,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),bd.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},bd.prototype.toHex=function(){return pd.encode(this.toBytes(),"hex").toUpperCase()};var vd=bd,wd=Yn,_d=Cf,Ed=Kc,Ad=Ed.assert,Sd=Ed.parseBytes,kd=hd,xd=vd;function Td(e){if(Ad("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Td))return new Td(e);e=_d[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=wd.sha512}var Rd=Td;Td.prototype.sign=function(e,t){e=Sd(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),a=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},Td.prototype.verify=function(e,t,r){e=Sd(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)},Td.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Ed.intFromLE(e.digest()).umod(this.curve.n)},Td.prototype.keyFromPublic=function(e){return kd.fromPublic(this,e)},Td.prototype.keyFromSecret=function(e){return kd.fromSecret(this,e)},Td.prototype.makeSignature=function(e){return e instanceof xd?e:new xd(this,e)},Td.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},Td.prototype.decodePoint=function(e){var t=(e=Ed.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),n=0!=(128&e[t]),i=Ed.intFromLE(r);return this.curve.pointFromY(i,n)},Td.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},Td.prototype.decodeInt=function(e){return Ed.intFromLE(e)},Td.prototype.isPoint=function(e){return e instanceof this.pointClass},function(e){var t=e;t.version=zc,t.utils=Kc,t.rand=Qc,t.curve=Zc,t.curves=Cf,t.ec=sd,t.eddsa=Rd}(qc);var Od={},Md={},Id={},Pd={},Cd={},Nd=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Cd,"__esModule",{value:!0}),Cd.getLength=Cd.decode=Cd.encode=void 0;var Bd=Nd(ae);function jd(e,t){if("0"===e[0]&&"0"===e[1])throw new Error("invalid RLP: extra zeros");return parseInt(e,t)}function Ld(e,t){if(e<56)return Buffer.from([e+t]);var r=Fd(e),n=Fd(t+55+r.length/2);return Buffer.from(n+r,"hex")}function Ud(e){var t,r,n,i,o,s=[],a=e[0];if(a<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(a<=183){if(t=a-127,n=128===a?Buffer.from([]):e.slice(1,t),2===t&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:e.slice(t)}}if(a<=191){if(r=a-182,e.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if((t=jd(e.slice(1,r).toString("hex"),16))<=55)throw new Error("invalid RLP: expected string length to be greater than 55");if((n=e.slice(r,t+r)).length<t)throw new Error("invalid RLP: not enough bytes for string");return{data:n,remainder:e.slice(t+r)}}if(a<=247){for(t=a-191,i=e.slice(1,t);i.length;)o=Ud(i),s.push(o.data),i=o.remainder;return{data:s,remainder:e.slice(t)}}var u=(r=a-246)+(t=jd(e.slice(1,r).toString("hex"),16));if(u>e.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(i=e.slice(r,u)).length)throw new Error("invalid rlp, List has a invalid length");for(;i.length;)o=Ud(i),s.push(o.data),i=o.remainder;return{data:s,remainder:e.slice(u)}}function Dd(e){return"0x"===e.slice(0,2)}function Fd(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");var t=e.toString(16);return t.length%2?"0"+t:t}function qd(e){if(!Buffer.isBuffer(e)){if("string"==typeof e)return Dd(e)?Buffer.from(function(e){return e.length%2?"0"+e:e}("string"!=typeof(r=e)?r:Dd(r)?r.slice(2):r),"hex"):Buffer.from(e);if("number"==typeof e||"bigint"==typeof e)return e?(t=Fd(e),Buffer.from(t,"hex")):Buffer.from([]);if(null==e)return Buffer.from([]);if(e instanceof Uint8Array)return Buffer.from(e);if(Bd.default.isBN(e))return Buffer.from(e.toArray());throw new Error("invalid type")}var t,r;return e}Cd.encode=function e(t){if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)r.push(e(t[n]));var i=Buffer.concat(r);return Buffer.concat([Ld(i.length,192),i])}var o=qd(t);return 1===o.length&&o[0]<128?o:Buffer.concat([Ld(o.length,128),o])},Cd.decode=function(e,t){if(void 0===t&&(t=!1),!e||0===e.length)return Buffer.from([]);var r=Ud(qd(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid remainder");return r.data},Cd.getLength=function(e){if(!e||0===e.length)return Buffer.from([]);var t=qd(e),r=t[0];if(r<=127)return t.length;if(r<=183)return r-127;if(r<=191)return r-182;if(r<=247)return r-191;var n=r-246;return n+jd(t.slice(1,n).toString("hex"),16)};var zd=r&&r.__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]}),Kd=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Hd=r&&r.__importStar||function(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)&&zd(t,e,r);return Kd(t,e),t},Gd=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pd,"__esModule",{value:!0}),Pd.rlp=Pd.BN=void 0;var Wd=Gd(ae);Pd.BN=Wd.default;var Vd=Hd(Cd);Pd.rlp=Vd,function(e){Object.defineProperty(e,"__esModule",{value:!0}),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.MAX_INTEGER=e.MAX_UINT64=void 0;var t=se,r=Pd;e.MAX_UINT64=new r.BN("ffffffffffffffff",16),e.MAX_INTEGER=new r.BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),e.TWO_POW256=new r.BN("10000000000000000000000000000000000000000000000000000000000000000",16),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")}(Id);var Xd={};function Jd(){throw new Error("setTimeout has not been defined")}function $d(){throw new Error("clearTimeout has not been defined")}var Yd=Jd,Qd=$d;function Zd(e){if(Yd===setTimeout)return setTimeout(e,0);if((Yd===Jd||!Yd)&&setTimeout)return Yd=setTimeout,setTimeout(e,0);try{return Yd(e,0)}catch(t){try{return Yd.call(null,e,0)}catch(t){return Yd.call(this,e,0)}}}"function"==typeof s.setTimeout&&(Yd=setTimeout),"function"==typeof s.clearTimeout&&(Qd=clearTimeout);var eh,th=[],rh=!1,nh=-1;function ih(){rh&&eh&&(rh=!1,eh.length?th=eh.concat(th):nh=-1,th.length&&oh())}function oh(){if(!rh){var e=Zd(ih);rh=!0;for(var t=th.length;t;){for(eh=th,th=[];++nh<t;)eh&&eh[nh].run();nh=-1,t=th.length}eh=null,rh=!1,function(e){if(Qd===clearTimeout)return clearTimeout(e);if((Qd===$d||!Qd)&&clearTimeout)return Qd=clearTimeout,clearTimeout(e);try{return Qd(e)}catch(t){try{return Qd.call(null,e)}catch(t){return Qd.call(this,e)}}}(e)}}function sh(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];th.push(new ah(e,t)),1!==th.length||rh||Zd(oh)}function ah(e,t){this.fun=e,this.array=t}ah.prototype.run=function(){this.fun.apply(null,this.array)};function uh(){}var ch=uh,fh=uh,dh=uh,hh=uh,lh=uh,ph=uh,gh=uh;var mh=s.performance||{},yh=mh.now||mh.mozNow||mh.msNow||mh.oNow||mh.webkitNow||function(){return(new Date).getTime()};var bh=new Date;var vh={nextTick:sh,title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ch,addListener:fh,once:dh,off:hh,removeListener:lh,removeAllListeners:ph,emit:gh,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*yh.call(mh),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-bh)/1e3}},wh="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},_h=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},Eh=/%[sdj%]/g;function Ah(e){if(!Dh(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(Rh(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,o=String(e).replace(Eh,(function(e){if("%%"===e)return"%";if(r>=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}})),s=n[r];r<i;s=n[++r])jh(s)||!Kh(s)?o+=" "+s:o+=" "+Rh(s);return o}function Sh(e,t){if(qh(s.process))return function(){return Sh(e,t).apply(this,arguments)};if(!0===vh.noDeprecation)return e;var r=!1;return function(){if(!r){if(vh.throwDeprecation)throw new Error(t);vh.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}}var kh,xh={};function Th(e){if(qh(kh)&&(kh=vh.env.NODE_DEBUG||""),e=e.toUpperCase(),!xh[e])if(new RegExp("\\b"+e+"\\b","i").test(kh)){xh[e]=function(){var t=Ah.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else xh[e]=function(){};return xh[e]}function Rh(e,t){var r={seen:[],stylize:Mh};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Bh(t)?r.showHidden=t:t&&Zh(r,t),qh(r.showHidden)&&(r.showHidden=!1),qh(r.depth)&&(r.depth=2),qh(r.colors)&&(r.colors=!1),qh(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Oh),Ih(r,e,r.depth)}function Oh(e,t){var r=Rh.styles[t];return r?"["+Rh.colors[r][0]+"m"+e+"["+Rh.colors[r][1]+"m":e}function Mh(e,t){return e}function Ih(e,t,r){if(e.customInspect&&t&&Wh(t.inspect)&&t.inspect!==Rh&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return Dh(n)||(n=Ih(e,n,r)),n}var i=function(e,t){if(qh(t))return e.stylize("undefined","undefined");if(Dh(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(Uh(t))return e.stylize(""+t,"number");if(Bh(t))return e.stylize(""+t,"boolean");if(jh(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Gh(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Ph(t);if(0===o.length){if(Wh(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(zh(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Hh(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Gh(t))return Ph(t)}var u,c="",f=!1,d=["{","}"];(Nh(t)&&(f=!0,d=["[","]"]),Wh(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return zh(t)&&(c=" "+RegExp.prototype.toString.call(t)),Hh(t)&&(c=" "+Date.prototype.toUTCString.call(t)),Gh(t)&&(c=" "+Ph(t)),0!==o.length||f&&0!=t.length?r<0?zh(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=f?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)el(t,String(s))?o.push(Ch(e,t,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(Ch(e,t,r,n,i,!0))})),o}(e,t,r,s,o):o.map((function(n){return Ch(e,t,r,s,n,f)})),e.seen.pop(),function(e,t,r){var n=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(n>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,c,d)):d[0]+c+d[1]}function Ph(e){return"["+Error.prototype.toString.call(e)+"]"}function Ch(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),el(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=jh(r)?Ih(e,u.value,null):Ih(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),qh(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function Nh(e){return Array.isArray(e)}function Bh(e){return"boolean"==typeof e}function jh(e){return null===e}function Lh(e){return null==e}function Uh(e){return"number"==typeof e}function Dh(e){return"string"==typeof e}function Fh(e){return"symbol"==typeof e}function qh(e){return void 0===e}function zh(e){return Kh(e)&&"[object RegExp]"===Jh(e)}function Kh(e){return"object"==typeof e&&null!==e}function Hh(e){return Kh(e)&&"[object Date]"===Jh(e)}function Gh(e){return Kh(e)&&("[object Error]"===Jh(e)||e instanceof Error)}function Wh(e){return"function"==typeof e}function Vh(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Xh(e){return _.isBuffer(e)}function Jh(e){return Object.prototype.toString.call(e)}function $h(e){return e<10?"0"+e.toString(10):e.toString(10)}Rh.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]},Rh.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Yh=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Qh(){console.log("%s - %s",function(){var e=new Date,t=[$h(e.getHours()),$h(e.getMinutes()),$h(e.getSeconds())].join(":");return[e.getDate(),Yh[e.getMonth()],t].join(" ")}(),Ah.apply(null,arguments))}function Zh(e,t){if(!t||!Kh(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function el(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var tl="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function rl(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(tl&&e[tl]){var t;if("function"!=typeof(t=e[tl]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,tl,{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;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),tl&&Object.defineProperty(t,tl,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,_h(e))}function nl(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function il(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var n=t.pop();if("function"!=typeof n)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return n.apply(i,arguments)};e.apply(this,t).then((function(e){vh.nextTick(o.bind(null,null,e))}),(function(e){vh.nextTick(nl.bind(null,e,o))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,_h(e)),t}rl.custom=tl;var ol={inherits:wh,_extend:Zh,log:Qh,isBuffer:Xh,isPrimitive:Vh,isFunction:Wh,isError:Gh,isDate:Hh,isObject:Kh,isRegExp:zh,isUndefined:qh,isSymbol:Fh,isString:Dh,isNumber:Uh,isNullOrUndefined:Lh,isNull:jh,isBoolean:Bh,isArray:Nh,inspect:Rh,deprecate:Sh,format:Ah,debuglog:Th,promisify:rl,callbackify:il},sl=Object.freeze({__proto__:null,_extend:Zh,callbackify:il,debuglog:Th,default:ol,deprecate:Sh,format:Ah,inherits:wh,inspect:Rh,isArray:Nh,isBoolean:Bh,isBuffer:Xh,isDate:Hh,isError:Gh,isFunction:Wh,isNull:jh,isNullOrUndefined:Lh,isNumber:Uh,isObject:Kh,isPrimitive:Vh,isRegExp:zh,isString:Dh,isSymbol:Fh,isUndefined:qh,log:Qh,promisify:rl});function al(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}var ul,cl=Object.prototype.hasOwnProperty,fl=Object.keys||function(e){var t=[];for(var r in e)cl.call(e,r)&&t.push(r);return t},dl=Array.prototype.slice;function hl(){return void 0!==ul?ul:ul="foo"===function(){}.name}function ll(e){return Object.prototype.toString.call(e)}function pl(e){return!ie(e)&&("function"==typeof s.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function gl(e,t){e||_l(e,!0,t,"==",El)}var ml=/\s*function\s+([^\(\s]*)\s*/;function yl(e){if(Wh(e)){if(hl())return e.name;var t=e.toString().match(ml);return t&&t[1]}}function bl(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 vl(wl(e.actual),128)+" "+e.operator+" "+vl(wl(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||_l;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=yl(t),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}}function vl(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function wl(e){if(hl()||!Wh(e))return Rh(e);var t=yl(e);return"[Function"+(t?": "+t:"")+"]"}function _l(e,t,r,n,i){throw new bl({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function El(e,t){e||_l(e,!0,t,"==",El)}function Al(e,t,r){e!=t&&_l(e,t,r,"==",Al)}function Sl(e,t,r){e==t&&_l(e,t,r,"!=",Sl)}function kl(e,t,r){Tl(e,t,!1)||_l(e,t,r,"deepEqual",kl)}function xl(e,t,r){Tl(e,t,!0)||_l(e,t,r,"deepStrictEqual",xl)}function Tl(e,t,r,n){if(e===t)return!0;if(ie(e)&&ie(t))return 0===al(e,t);if(Hh(e)&&Hh(t))return e.getTime()===t.getTime();if(zh(e)&&zh(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(pl(e)&&pl(t)&&ll(e)===ll(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===al(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(ie(e)!==ie(t))return!1;var i=(n=n||{actual:[],expected:[]}).actual.indexOf(e);return-1!==i&&i===n.expected.indexOf(t)||(n.actual.push(e),n.expected.push(t),function(e,t,r,n){if(null==e||null==t)return!1;if(Vh(e)||Vh(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=Rl(e),o=Rl(t);if(i&&!o||!i&&o)return!1;if(i)return Tl(e=dl.call(e),t=dl.call(t),r);var s,a,u=fl(e),c=fl(t);if(u.length!==c.length)return!1;for(u.sort(),c.sort(),a=u.length-1;a>=0;a--)if(u[a]!==c[a])return!1;for(a=u.length-1;a>=0;a--)if(!Tl(e[s=u[a]],t[s],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function Rl(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function Ol(e,t,r){Tl(e,t,!1)&&_l(e,t,r,"notDeepEqual",Ol)}function Ml(e,t,r){Tl(e,t,!0)&&_l(e,t,r,"notDeepStrictEqual",Ml)}function Il(e,t,r){e!==t&&_l(e,t,r,"===",Il)}function Pl(e,t,r){e===t&&_l(e,t,r,"!==",Pl)}function Cl(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 Nl(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&&_l(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!e&&i&&!r;if((!e&&Gh(i)&&o&&Cl(i,r)||s)&&_l(i,r,"Got unwanted exception"+n),e&&i&&r&&!Cl(i,r)||!e&&i)throw i}function Bl(e,t,r){Nl(!0,e,t,r)}function jl(e,t,r){Nl(!1,e,t,r)}function Ll(e){if(e)throw e}gl.AssertionError=bl,wh(bl,Error),gl.fail=_l,gl.ok=El,gl.equal=Al,gl.notEqual=Sl,gl.deepEqual=kl,gl.deepStrictEqual=xl,gl.notDeepEqual=Ol,gl.notDeepStrictEqual=Ml,gl.strictEqual=Il,gl.notStrictEqual=Pl,gl.throws=Bl,gl.doesNotThrow=jl,gl.ifError=Ll;var Ul=i(Object.freeze({__proto__:null,AssertionError:bl,assert:El,deepEqual:kl,deepStrictEqual:xl,default:gl,doesNotThrow:jl,equal:Al,fail:_l,ifError:Ll,notDeepEqual:Ol,notDeepStrictEqual:Ml,notEqual:Sl,notStrictEqual:Pl,ok:El,strictEqual:Il,throws:Bl})),Dl={};const Fl="Impossible case. Please create issue.",ql="The tweak was out of range or the resulted private key is invalid",zl="The tweak was out of range or equal to zero",Kl="Unknow error on context randomization",Hl="Private Key is invalid",Gl="Public Key could not be parsed",Wl="Public Key serialization error",Vl="The sum of the public keys is not valid",Xl="Signature could not be parsed",Jl="The nonce generation function failed, or the private key was invalid",$l="Public key could not be recover",Yl="Scalar was invalid (zero or overflow)";function Ql(e,t){if(!e)throw new Error(t)}function Zl(e,t,r){if(Ql(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;Ql(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;Ql(t.length===r,n)}}function ep(e){Ql("Boolean"===rp(e),"Expected compressed to be a Boolean")}function tp(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),Zl("output",e,t),e}function rp(e){return Object.prototype.toString.call(e).slice(8,-1)}const np=new(0,qc.ec)("secp256k1"),ip=np.curve,op=ip.n.constructor;function sp(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new op(t);if(r.cmp(ip.p)>=0)return null;r=r.toRed(ip.red);let n=r.redSqr().redIMul(r).redIAdd(ip.b).redSqrt();return 3===e!==n.isOdd()&&(n=n.redNeg()),np.keyPair({pub:{x:r,y:n}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let n=new op(t),i=new op(r);if(n.cmp(ip.p)>=0||i.cmp(ip.p)>=0)return null;if(n=n.toRed(ip.red),i=i.toRed(ip.red),(6===e||7===e)&&i.isOdd()!==(7===e))return null;const o=n.redSqr().redIMul(n);return i.redSqr().redISub(o.redIAdd(ip.b)).isZero()?np.keyPair({pub:{x:n,y:i}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function ap(e,t){const r=t.encode(null,33===e.length);for(let t=0;t<e.length;++t)e[t]=r[t]}var up={contextRandomize:()=>0,privateKeyVerify(e){const t=new op(e);return t.cmp(ip.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new op(e),r=ip.n.sub(t).umod(ip.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new op(t);if(r.cmp(ip.n)>=0)return 1;if(r.iadd(new op(e)),r.cmp(ip.n)>=0&&r.isub(ip.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new op(t);if(r.cmp(ip.n)>=0||r.isZero())return 1;r.imul(new op(e)),r.cmp(ip.n)>=0&&(r=r.umod(ip.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===sp(e)?1:0,publicKeyCreate(e,t){const r=new op(t);if(r.cmp(ip.n)>=0||r.isZero())return 1;return ap(e,np.keyFromPrivate(t).getPublic()),0},publicKeyConvert(e,t){const r=sp(t);if(null===r)return 1;return ap(e,r.getPublic()),0},publicKeyNegate(e,t){const r=sp(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),ap(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e<t.length;++e)if(r[e]=sp(t[e]),null===r[e])return 1;let n=r[0].getPublic();for(let e=1;e<r.length;++e)n=n.add(r[e].pub);return n.isInfinity()?2:(ap(e,n),0)},publicKeyTweakAdd(e,t,r){const n=sp(t);if(null===n)return 1;if((r=new op(r)).cmp(ip.n)>=0)return 2;const i=n.getPublic().add(ip.g.mul(r));return i.isInfinity()?2:(ap(e,i),0)},publicKeyTweakMul(e,t,r){const n=sp(t);if(null===n)return 1;if((r=new op(r)).cmp(ip.n)>=0||r.isZero())return 2;return ap(e,n.getPublic().mul(r)),0},signatureNormalize(e){const t=new op(e.subarray(0,32)),r=new op(e.subarray(32,64));return t.cmp(ip.n)>=0||r.cmp(ip.n)>=0?1:(1===r.cmp(np.nh)&&e.set(ip.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new op(r).cmp(ip.n)>=0)return 1;if(new op(n).cmp(ip.n)>=0)return 1;const{output:i}=e;let o=i.subarray(4,37);o[0]=0,o.set(r,1);let s=33,a=0;for(;s>1&&0===o[a]&&!(128&o[a+1]);--s,++a);if(o=o.subarray(a),128&o[0])return 1;if(s>1&&0===o[0]&&!(128&o[1]))return 1;let u=i.subarray(39,72);u[0]=0,u.set(n,1);let c=33,f=0;for(;c>1&&0===u[f]&&!(128&u[f+1]);--c,++f);return u=u.subarray(f),128&u[0]||c>1&&0===u[0]&&!(128&u[1])?1:(e.outputlen=6+s+c,i[0]=48,i[1]=e.outputlen-2,i[2]=2,i[3]=o.length,i.set(o,4),i[4+s]=2,i[5+s]=u.length,i.set(u,6+s),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let i=t.subarray(4,4+r);if(33===i.length&&0===i[0]&&(i=i.subarray(1)),i.length>32)return 1;let o=t.subarray(6+r);if(33===o.length&&0===o[0]&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let s=new op(i);s.cmp(ip.n)>=0&&(s=new op(0));let a=new op(t.subarray(6+r));return a.cmp(ip.n)>=0&&(a=new op(0)),e.set(s.toArrayLike(Uint8Array,"be",32),0),e.set(a.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,n,i){if(i){const e=i;i=i=>{const o=e(t,r,null,n,i);if(!(o instanceof Uint8Array&&32===o.length))throw new Error("This is the way");return new op(o)}}const o=new op(r);if(o.cmp(ip.n)>=0||o.isZero())return 1;let s;try{s=np.sign(t,r,{canonical:!0,k:i,pers:n})}catch(e){return 1}return e.signature.set(s.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(s.s.toArrayLike(Uint8Array,"be",32),32),e.recid=s.recoveryParam,0},ecdsaVerify(e,t,r){const n={r:e.subarray(0,32),s:e.subarray(32,64)},i=new op(n.r),o=new op(n.s);if(i.cmp(ip.n)>=0||o.cmp(ip.n)>=0)return 1;if(1===o.cmp(np.nh)||i.isZero()||o.isZero())return 3;const s=sp(r);if(null===s)return 2;const a=s.getPublic();return np.verify(t,n,a)?0:3},ecdsaRecover(e,t,r,n){const i={r:t.slice(0,32),s:t.slice(32,64)},o=new op(i.r),s=new op(i.s);if(o.cmp(ip.n)>=0||s.cmp(ip.n)>=0)return 1;if(o.isZero()||s.isZero())return 2;let a;try{a=np.recoverPubKey(n,i,r)}catch(e){return 2}return ap(e,a),0},ecdh(e,t,r,n,i,o,s){const a=sp(t);if(null===a)return 1;const u=new op(r);if(u.cmp(ip.n)>=0||u.isZero())return 2;const c=a.getPublic().mul(u);if(void 0===i){const t=c.encode(null,!0),r=np.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{o||(o=new Uint8Array(32));const t=c.getX().toArray("be",32);for(let e=0;e<32;++e)o[e]=t[e];s||(s=new Uint8Array(32));const r=c.getY().toArray("be",32);for(let e=0;e<32;++e)s[e]=r[e];const a=i(o,s,n);if(!(a instanceof Uint8Array&&a.length===e.length))return 2;e.set(a)}return 0}},cp=(e=>({contextRandomize(t){if(Ql(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&Zl("seed",t,32),1===e.contextRandomize(t))throw new Error(Kl)},privateKeyVerify:t=>(Zl("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(t){switch(Zl("private key",t,32),e.privateKeyNegate(t)){case 0:return t;case 1:throw new Error(Fl)}},privateKeyTweakAdd(t,r){switch(Zl("private key",t,32),Zl("tweak",r,32),e.privateKeyTweakAdd(t,r)){case 0:return t;case 1:throw new Error(ql)}},privateKeyTweakMul(t,r){switch(Zl("private key",t,32),Zl("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(zl)}},publicKeyVerify:t=>(Zl("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(Zl("private key",t,32),ep(r),n=tp(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error(Hl);case 2:throw new Error(Wl)}},publicKeyConvert(t,r=!0,n){switch(Zl("public key",t,[33,65]),ep(r),n=tp(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(Gl);case 2:throw new Error(Wl)}},publicKeyNegate(t,r=!0,n){switch(Zl("public key",t,[33,65]),ep(r),n=tp(n,r?33:65),e.publicKeyNegate(n,t)){case 0:return n;case 1:throw new Error(Gl);case 2:throw new Error(Fl);case 3:throw new Error(Wl)}},publicKeyCombine(t,r=!0,n){Ql(Array.isArray(t),"Expected public keys to be an Array"),Ql(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)Zl("public key",e,[33,65]);switch(ep(r),n=tp(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(Gl);case 2:throw new Error(Vl);case 3:throw new Error(Wl)}},publicKeyTweakAdd(t,r,n=!0,i){switch(Zl("public key",t,[33,65]),Zl("tweak",r,32),ep(n),i=tp(i,n?33:65),e.publicKeyTweakAdd(i,t,r)){case 0:return i;case 1:throw new Error(Gl);case 2:throw new Error(ql)}},publicKeyTweakMul(t,r,n=!0,i){switch(Zl("public key",t,[33,65]),Zl("tweak",r,32),ep(n),i=tp(i,n?33:65),e.publicKeyTweakMul(i,t,r)){case 0:return i;case 1:throw new Error(Gl);case 2:throw new Error(zl)}},signatureNormalize(t){switch(Zl("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(Xl)}},signatureExport(t,r){Zl("signature",t,64);const n={output:r=tp(r,72),outputlen:72};switch(e.signatureExport(n,t)){case 0:return r.slice(0,n.outputlen);case 1:throw new Error(Xl);case 2:throw new Error(Fl)}},signatureImport(t,r){switch(Zl("signature",t),r=tp(r,64),e.signatureImport(r,t)){case 0:return r;case 1:throw new Error(Xl);case 2:throw new Error(Fl)}},ecdsaSign(t,r,n={},i){Zl("message",t,32),Zl("private key",r,32),Ql("Object"===rp(n),"Expected options to be an Object"),void 0!==n.data&&Zl("options.data",n.data),void 0!==n.noncefn&&Ql("Function"===rp(n.noncefn),"Expected options.noncefn to be a Function");const o={signature:i=tp(i,64),recid:null};switch(e.ecdsaSign(o,t,r,n.data,n.noncefn)){case 0:return o;case 1:throw new Error(Jl);case 2:throw new Error(Fl)}},ecdsaVerify(t,r,n){switch(Zl("signature",t,64),Zl("message",r,32),Zl("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(Xl);case 2:throw new Error(Gl)}},ecdsaRecover(t,r,n,i=!0,o){switch(Zl("signature",t,64),Ql("Number"===rp(r)&&r>=0&&r<=3,"Expected recovery id to be a Number within interval [0, 3]"),Zl("message",n,32),ep(i),o=tp(o,i?33:65),e.ecdsaRecover(o,t,r,n)){case 0:return o;case 1:throw new Error(Xl);case 2:throw new Error($l);case 3:throw new Error(Fl)}},ecdh(t,r,n={},i){switch(Zl("public key",t,[33,65]),Zl("private key",r,32),Ql("Object"===rp(n),"Expected options to be an Object"),void 0!==n.data&&Zl("options.data",n.data),void 0!==n.hashfn?(Ql("Function"===rp(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&Zl("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&Zl("options.ybuf",n.ybuf,32),Zl("output",i)):i=tp(i,32),e.ecdh(i,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return i;case 1:throw new Error(Gl);case 2:throw new Error(Yl)}}}))(up),fp={},dp={exports:{}},hp={exports:{}};
|
|
10
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
11
|
+
!function(e,t){var r=se,n=r.Buffer;function i(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}}(hp,hp.exports);var lp=hp.exports,pp=65536,gp=4294967295;var mp=lp.Buffer,yp=r.crypto||r.msCrypto;yp&&yp.getRandomValues?dp.exports=function(e,t){if(e>gp)throw new RangeError("requested too many random bytes");var r=mp.allocUnsafe(e);if(e>0)if(e>pp)for(var n=0;n<e;n+=pp)yp.getRandomValues(r.slice(n,n+pp));else yp.getRandomValues(r);if("function"==typeof t)return process.nextTick((function(){t(null,r)}));return r}:dp.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")};var bp=dp.exports;Object.defineProperty(fp,"__esModule",{value:!0});var vp=bp;fp.getRandomBytes=function(e){return new Promise((function(t,r){vp(e,(function(e,n){e?r(e):t(n)}))}))},fp.getRandomBytesSync=function(e){return vp(e)},function(e){var t=r&&r.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},n=r&&r.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=cp,o=fp;e.createPrivateKey=function(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return[4,o.getRandomBytes(32)];case 1:return e=t.sent(),i.privateKeyVerify(e)?[2,e]:[3,0];case 2:return[2]}}))}))},e.createPrivateKeySync=function(){for(;;){var e=o.getRandomBytesSync(32);if(i.privateKeyVerify(e))return e}},function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(cp)}(Dl);var wp={};function _p(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type ".concat(typeof e));return"0"===e[0]&&"x"===e[1]}Object.defineProperty(wp,"__esModule",{value:!0}),wp.isHexString=wp.getKeys=wp.fromAscii=wp.fromUtf8=wp.toAscii=wp.arrayContainsArray=wp.getBinarySize=wp.padToEven=wp.stripHexPrefix=wp.isHexPrefixed=void 0,wp.isHexPrefixed=_p;function Ep(e){var t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received ".concat(typeof t));return t.length%2&&(t="0".concat(t)),t}wp.stripHexPrefix=function(e){if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received ".concat(typeof e));return _p(e)?e.slice(2):e},wp.padToEven=Ep,wp.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', recieved ".concat(typeof e));return Buffer.byteLength(e,"utf8")},wp.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error("[arrayContainsArray] method requires input 'superset' to be an array, got type '".concat(typeof e,"'"));if(!0!==Array.isArray(t))throw new Error("[arrayContainsArray] method requires input 'subset' to be an array, got type '".concat(typeof t,"'"));return t[r?"some":"every"]((function(t){return e.indexOf(t)>=0}))},wp.toAscii=function(e){var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r<n;r+=2){var i=parseInt(e.substr(r,2),16);t+=String.fromCharCode(i)}return t},wp.fromUtf8=function(e){var t=Buffer.from(e,"utf8");return"0x".concat(Ep(t.toString("hex")).replace(/^0+|0+$/g,""))},wp.fromAscii=function(e){for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r).toString(16);t+=n.length<2?"0".concat(n):n}return"0x".concat(t)},wp.getKeys=function(e,t,r){if(!Array.isArray(e))throw new Error("[getKeys] method expects input 'params' to be an array, got ".concat(typeof e));if("string"!=typeof t)throw new Error("[getKeys] method expects input 'key' to be type 'string', got ".concat(typeof e));for(var n=[],i=0;i<e.length;i++){var o=e[i][t];if(r&&!o)o="";else if("string"!=typeof o)throw new Error("invalid abi - expected type 'string', received ".concat(typeof o));n.push(o)}return n},wp.isHexString=function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)};var Ap={},Sp={};Object.defineProperty(Sp,"__esModule",{value:!0}),Sp.assertIsString=Sp.assertIsArray=Sp.assertIsBuffer=Sp.assertIsHexString=void 0;var kp=wp;Sp.assertIsHexString=function(e){if(!(0,kp.isHexString)(e)){var t="This method only supports 0x-prefixed hex strings but input was: ".concat(e);throw new Error(t)}};Sp.assertIsBuffer=function(e){if(!Buffer.isBuffer(e)){var t="This method only supports Buffer but input was: ".concat(e);throw new Error(t)}};Sp.assertIsArray=function(e){if(!Array.isArray(e)){var t="This method only supports number arrays but input was: ".concat(e);throw new Error(t)}};Sp.assertIsString=function(e){if("string"!=typeof e){var t="This method only supports strings but input was: ".concat(e);throw new Error(t)}},function(e){var t=r&&r.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=r&&r.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.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 s};Object.defineProperty(e,"__esModule",{value:!0}),e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToHex=e.bufferToInt=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;var i=Pd,o=wp,s=Sp;e.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("Received an invalid integer type: ".concat(e));return"0x".concat(e.toString(16))};e.intToBuffer=function(t){var r=(0,e.intToHex)(t);return Buffer.from((0,o.padToEven)(r.slice(2)),"hex")};e.zeros=function(e){return Buffer.allocUnsafe(e).fill(0)};var a=function(t,r,n){var i=(0,e.zeros)(r);return n?t.length<r?(t.copy(i),i):t.slice(0,r):t.length<r?(t.copy(i,r-t.length),i):t.slice(-r)};e.setLengthLeft=function(e,t){return(0,s.assertIsBuffer)(e),a(e,t,!1)};e.setLengthRight=function(e,t){return(0,s.assertIsBuffer)(e),a(e,t,!0)};var u=function(e){for(var t=e[0];e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};e.unpadBuffer=function(e){return(0,s.assertIsBuffer)(e),u(e)};e.unpadArray=function(e){return(0,s.assertIsArray)(e),u(e)};e.unpadHexString=function(e){return(0,s.assertIsHexString)(e),e=(0,o.stripHexPrefix)(e),u(e)};e.toBuffer=function(t){if(null==t)return Buffer.allocUnsafe(0);if(Buffer.isBuffer(t))return Buffer.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return Buffer.from(t);if("string"==typeof t){if(!(0,o.isHexString)(t))throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ".concat(t));return Buffer.from((0,o.padToEven)((0,o.stripHexPrefix)(t)),"hex")}if("number"==typeof t)return(0,e.intToBuffer)(t);if(i.BN.isBN(t)){if(t.isNeg())throw new Error("Cannot convert negative BN to buffer. Given: ".concat(t));return t.toArrayLike(Buffer)}if(t.toArray)return Buffer.from(t.toArray());if(t.toBuffer)return Buffer.from(t.toBuffer());throw new Error("invalid type")};e.bufferToInt=function(t){return new i.BN((0,e.toBuffer)(t)).toNumber()};e.bufferToHex=function(t){return"0x"+(t=(0,e.toBuffer)(t)).toString("hex")};e.fromSigned=function(e){return new i.BN(e).fromTwos(256)};e.toUnsigned=function(e){return Buffer.from(e.toTwos(256).toArray())};e.addHexPrefix=function(e){return"string"!=typeof e||(0,o.isHexPrefixed)(e)?e:"0x"+e};e.toUtf8=function(e){if((e=(0,o.stripHexPrefix)(e)).length%2!=0)throw new Error("Invalid non-even hex string input for toUtf8() provided");return Buffer.from(e.replace(/^(00)+|(00)+$/g,""),"hex").toString("utf8")};e.baToJSON=function(t){if(Buffer.isBuffer(t))return"0x".concat(t.toString("hex"));if(t instanceof Array){for(var r=[],n=0;n<t.length;n++)r.push((0,e.baToJSON)(t[n]));return r}};e.validateNoLeadingZeroes=function(e){var r,i;try{for(var o=t(Object.entries(e)),s=o.next();!s.done;s=o.next()){var a=n(s.value,2),u=a[0],c=a[1];if(void 0!==c&&c.length>0&&0===c[0])throw new Error("".concat(u," cannot have leading zeroes, received: ").concat(c.toString("hex")))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},e.arrToBufArr=function e(t){return Array.isArray(t)?t.map((function(t){return e(t)})):Buffer.from(t)},e.bufArrToArr=function e(t){return Array.isArray(t)?t.map((function(t){return e(t)})):Uint8Array.from(null!=t?t:[])}}(Ap);var xp={},Tp={},Rp={};Object.defineProperty(Rp,"__esModule",{value:!0}),Rp.createHashFunction=function(e){return function(t){var r=e();return r.update(t),Buffer.from(r.digest())}};var Op={exports:{}};function Mp(){}function Ip(){Ip.init.call(this)}function Pp(e){return void 0===e._maxListeners?Ip.defaultMaxListeners:e._maxListeners}function Cp(e,t,r,n){var i,o,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),s=o[t]):(o=e._events=new Mp,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(i=Pp(e))&&i>0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(a)}}else s=o[t]=r,++e._eventsCount;return e}function Np(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 Bp(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 jp(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}Mp.prototype=Object.create(null),Ip.EventEmitter=Ip,Ip.usingDomains=!1,Ip.prototype.domain=void 0,Ip.prototype._events=void 0,Ip.prototype._maxListeners=void 0,Ip.defaultMaxListeners=10,Ip.init=function(){this.domain=null,Ip.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Mp,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Ip.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},Ip.prototype.getMaxListeners=function(){return Pp(this)},Ip.prototype.emit=function(e){var t,r,n,i,o,s,a,u="error"===e;if(s=this._events)u=u&&null==s.error;else if(!u)return!1;if(a=this.domain,u){if(t=arguments[1],!a){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(r=s[e]))return!1;var f="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=jp(e,n),o=0;o<n;++o)i[o].call(r)}(r,f,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=jp(e,i),s=0;s<i;++s)o[s].call(r,n)}(r,f,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=jp(e,o),a=0;a<o;++a)s[a].call(r,n,i)}(r,f,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=jp(e,s),u=0;u<s;++u)a[u].call(r,n,i,o)}(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=jp(e,i),s=0;s<i;++s)o[s].apply(r,n)}(r,f,this,i)}return!0},Ip.prototype.addListener=function(e,t){return Cp(this,e,t,!1)},Ip.prototype.on=Ip.prototype.addListener,Ip.prototype.prependListener=function(e,t){return Cp(this,e,t,!0)},Ip.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Np(this,e,t)),this},Ip.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Np(this,e,t)),this},Ip.prototype.removeListener=function(e,t){var r,n,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new Mp:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){s=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 Mp,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,s||t)}return this},Ip.prototype.off=function(e,t){return this.removeListener(e,t)},Ip.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new Mp,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new Mp:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o<i.length;++o)"removeListener"!==(n=i[o])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new Mp,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Ip.prototype.listeners=function(e){var t,r,n=this._events;return r=n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(t):[],r},Ip.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Bp.call(e,t)},Ip.prototype.listenerCount=Bp,Ip.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Lp,Up,Dp=i(Object.freeze({__proto__:null,EventEmitter:Ip,default:Ip}));function Fp(){return Up?Lp:(Up=1,Lp=Dp.EventEmitter)}var qp,zp,Kp,Hp,Gp=i(sl);function Wp(){if(zp)return qp;function e(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 t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function r(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}zp=1;var o=se.Buffer,s=Gp.inspect,a=s&&s.custom||"inspect";function u(e,t,r){o.prototype.copy.call(e,t,r)}return qp=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var r,i,c;return r=e,i=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value: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}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t=o.allocUnsafe(e>>>0),r=this.head,n=0;r;)u(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,t}},{key:a,value:function(e,r){return s(this,t(t({},r),{},{depth:0,customInspect:!1}))}}],i&&n(r.prototype,i),c&&n(r,c),Object.defineProperty(r,"prototype",{writable:!1}),e}(),qp}function Vp(){if(Hp)return Kp;function e(e,n){r(e,n),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}return Hp=1,Kp={destroy:function(n,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(n):n&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,n)):process.nextTick(r,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,(function(r){!i&&r?o._writableState?o._writableState.errorEmitted?process.nextTick(t,o):(o._writableState.errorEmitted=!0,process.nextTick(e,o,r)):process.nextTick(e,o,r):i?(process.nextTick(t,o),i(r)):process.nextTick(t,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}var Xp={};var Jp,$p,Yp,Qp,Zp,eg,tg,rg,ng={};function ig(e,t,r){r||(r=Error);var n=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=e,ng[e]=n}function og(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function sg(){if($p)return Jp;$p=1;var e=Xp.codes.ERR_INVALID_OPT_VALUE;return Jp={getHighWaterMark:function(t,r,n,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(r,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new e(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}}function ag(){if(Qp)return Yp;function e(e){try{if(!r.localStorage)return!1}catch(e){return!1}var t=r.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return Qp=1,Yp=function(t,r){if(e("noDeprecation"))return t;var n=!1;return function(){if(!n){if(e("throwDeprecation"))throw new Error(r);e("traceDeprecation")?console.trace(r):console.warn(r),n=!0}return t.apply(this,arguments)}},Yp}function ug(){if(eg)return Zp;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;e.entry=null;for(;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var t;eg=1,Zp=E,E.WritableState=_;var n={deprecate:ag()},i=Fp(),o=se.Buffer,s=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,u=Vp(),c=sg().getHighWaterMark,f=Xp.codes,d=f.ERR_INVALID_ARG_TYPE,h=f.ERR_METHOD_NOT_IMPLEMENTED,l=f.ERR_MULTIPLE_CALLBACK,p=f.ERR_STREAM_CANNOT_PIPE,g=f.ERR_STREAM_DESTROYED,m=f.ERR_STREAM_NULL_VALUES,y=f.ERR_STREAM_WRITE_AFTER_END,b=f.ERR_UNKNOWN_ENCODING,v=u.errorOrDestroy;function w(){}function _(r,n,i){t=t||cg(),r=r||{},"boolean"!=typeof i&&(i=n instanceof t),this.objectMode=!!r.objectMode,i&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=c(this,r,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new l;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(R,e,t),e._writableState.errorEmitted=!0,v(e,n)):(i(n),e._writableState.errorEmitted=!0,v(e,n),R(e,t))}(e,r,n,t,i);else{var o=x(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),n?process.nextTick(S,e,r,o,i):S(e,r,o,i)}}(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function E(e){var r=this instanceof(t=t||cg());if(!r&&!a.call(E,this))return new E(e);this._writableState=new _(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function A(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new g("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function S(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function k(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,A(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,f=n.encoding,d=n.callback;if(A(t,r,!1,r.objectMode?1:c.length,c,f,d),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function T(e,t){e._final((function(r){t.pendingcb--,r&&v(e,r),t.prefinished=!0,e.emit("prefinish"),R(e,t)}))}function R(e,t){var r=x(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(T,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}return ri(E,i),_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(_.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===E&&(e&&e._writableState instanceof _)}})):a=function(e){return e instanceof this},E.prototype.pipe=function(){v(this,new p)},E.prototype.write=function(e,t,r){var n,i=this._writableState,a=!1,u=!i.objectMode&&(n=e,o.isBuffer(n)||n instanceof s);return u&&!o.isBuffer(e)&&(e=function(e){return o.from(e)}(e)),"function"==typeof t&&(r=t,t=null),u?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=w),i.ending?function(e,t){var r=new y;v(e,r),process.nextTick(t,r)}(this,r):(u||function(e,t,r,n){var i;return null===r?i=new m:"string"==typeof r||t.objectMode||(i=new d("chunk",["string","Buffer"],r)),!i||(v(e,i),process.nextTick(n,i),!1)}(this,i,e,r))&&(i.pendingcb++,a=function(e,t,r,n,i,s){if(!r){var a=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=o.from(t,r));return t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=t.objectMode?1:n.length;t.length+=u;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else A(e,t,!1,u,n,i,s);return c}(this,i,u,e,t,r)),a},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},E.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new b(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,r){r(new h("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,r){var n=this._writableState;return"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||function(e,t,r){t.ending=!0,R(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=u.destroy,E.prototype._undestroy=u.undestroy,E.prototype._destroy=function(e,t){t(e)},Zp}function cg(){if(rg)return tg;rg=1;var e=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};tg=s;var t=xg(),r=ug();ri(s,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var o=n[i];s.prototype[o]||(s.prototype[o]=r.prototype[o])}function s(e){if(!(this instanceof s))return new s(e);t.call(this,e),r.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(u,this)}function u(e){e.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),tg}ig("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),ig("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,o,s;if("string"==typeof t&&(i="not ",t.substr(!o||o<0?0:+o,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(og(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(og(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),ig("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),ig("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),ig("ERR_STREAM_PREMATURE_CLOSE","Premature close"),ig("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),ig("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),ig("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),ig("ERR_STREAM_WRITE_AFTER_END","write after end"),ig("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),ig("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),ig("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Xp.codes=ng;var fg=_.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 dg(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!fg(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=lg;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=pg;break;default:return void(this.write=hg)}this.charBuffer=new _(6),this.charReceived=0,this.charLength=0}function hg(e){return e.toString(this.encoding)}function lg(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function pg(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}dg.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<this.charLength)return"";if(e=e.slice(r,e.length),!((i=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=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},dg.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},dg.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 gg=i(Object.freeze({__proto__:null,StringDecoder:dg})),mg=Xp.codes.ERR_STREAM_PREMATURE_CLOSE;function yg(){}var bg,vg,wg,_g,Eg,Ag,Sg=function e(t,r,n){if("function"==typeof r)return e(t,null,r);r||(r={}),n=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(n||yg);var i=r.readable||!1!==r.readable&&t.readable,o=r.writable||!1!==r.writable&&t.writable,s=function(){t.writable||u()},a=t._writableState&&t._writableState.finished,u=function(){o=!1,a=!0,i||n.call(t)},c=t._readableState&&t._readableState.endEmitted,f=function(){i=!1,c=!0,o||n.call(t)},d=function(e){n.call(t,e)},h=function(){var e;return i&&!c?(t._readableState&&t._readableState.ended||(e=new mg),n.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new mg),n.call(t,e)):void 0},l=function(){t.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?o&&!t._writableState&&(t.on("end",s),t.on("close",s)):(t.on("complete",u),t.on("abort",h),t.req?l():t.on("request",l)),t.on("end",f),t.on("finish",u),!1!==r.error&&t.on("error",d),t.on("close",h),function(){t.removeListener("complete",u),t.removeListener("abort",h),t.removeListener("request",l),t.req&&t.req.removeListener("finish",u),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",u),t.removeListener("end",f),t.removeListener("error",d),t.removeListener("close",h)}};function kg(){if(vg)return bg;var e;function t(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}vg=1;var r=Sg,n=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function f(e,t){return{value:e,done:t}}function d(e){var t=e[n];if(null!==t){var r=e[c].read();null!==r&&(e[a]=null,e[n]=null,e[i]=null,t(f(r,!1)))}}function h(e){process.nextTick(d,e)}var l=Object.getPrototypeOf((function(){})),p=Object.setPrototypeOf((e={get stream(){return this[c]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[s])return Promise.resolve(f(void 0,!0));if(this[c].destroyed)return new Promise((function(t,r){process.nextTick((function(){e[o]?r(e[o]):t(f(void 0,!0))}))}));var r,n=this[a];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[s]?r(f(void 0,!0)):t[u](r,n)}),n)}}(n,this));else{var i=this[c].read();if(null!==i)return Promise.resolve(f(i,!1));r=new Promise(this[u])}return this[a]=r,r}},t(e,Symbol.asyncIterator,(function(){return this})),t(e,"return",(function(){var e=this;return new Promise((function(t,r){e[c].destroy(null,(function(e){e?r(e):t(f(void 0,!0))}))}))})),e),l);return bg=function(e){var d,l=Object.create(p,(t(d={},c,{value:e,writable:!0}),t(d,n,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,s,{value:e._readableState.endEmitted,writable:!0}),t(d,u,{value:function(e,t){var r=l[c].read();r?(l[a]=null,l[n]=null,l[i]=null,e(f(r,!1))):(l[n]=e,l[i]=t)},writable:!0}),d));return l[a]=null,r(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=l[i];return null!==t&&(l[a]=null,l[n]=null,l[i]=null,t(e)),void(l[o]=e)}var r=l[n];null!==r&&(l[a]=null,l[n]=null,l[i]=null,r(f(void 0,!0))),l[s]=!0})),e.on("readable",h.bind(null,l)),l},bg}function xg(){if(Ag)return Eg;var e;Ag=1,Eg=E,E.ReadableState=_,Dp.EventEmitter;var t=function(e,t){return e.listeners(t).length},n=Fp(),i=se.Buffer,o=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s,a=Gp;s=a&&a.debuglog?a.debuglog("stream"):function(){};var u,c,f,d=Wp(),h=Vp(),l=sg().getHighWaterMark,p=Xp.codes,g=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,y=p.ERR_METHOD_NOT_IMPLEMENTED,b=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ri(E,n);var v=h.errorOrDestroy,w=["error","close","destroy","pause","resume"];function _(t,r,n){e=e||cg(),t=t||{},"boolean"!=typeof n&&(n=r instanceof e),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=l(this,t,"readableHighWaterMark",n),this.buffer=new d,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.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(u||(u=gg.StringDecoder),this.decoder=new u(t.encoding),this.encoding=t.encoding)}function E(t){if(e=e||cg(),!(this instanceof E))return new E(t);var r=this instanceof e;this._readableState=new _(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function A(e,t,r,n,a){s("readableAddChunk",t);var u,c=e._readableState;if(null===t)c.reading=!1,function(e,t){if(s("onEofChunk"),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,t.sync?T(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,R(e)))}(e,c);else if(a||(u=function(e,t){var r;n=t,i.isBuffer(n)||n instanceof o||"string"==typeof t||void 0===t||e.objectMode||(r=new g("chunk",["string","Buffer","Uint8Array"],t));var n;return r}(c,t)),u)v(e,u);else if(c.objectMode||t&&t.length>0)if("string"==typeof t||c.objectMode||Object.getPrototypeOf(t)===i.prototype||(t=function(e){return i.from(e)}(t)),n)c.endEmitted?v(e,new b):S(e,c,t,!0);else if(c.ended)v(e,new m);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(t=c.decoder.write(t),c.objectMode||0!==t.length?S(e,c,t,!1):O(e,c)):S(e,c,t,!1)}else n||(c.reading=!1,O(e,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function S(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&T(e)),O(e,t)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=h.destroy,E.prototype._undestroy=h.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=i.from(e,t),t=""),r=!0),A(this,e,t,!1,r)},E.prototype.unshift=function(e){return A(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){u||(u=gg.StringDecoder);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var k=1073741824;function x(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=k?e=k:(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 T(e){var t=e._readableState;s("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(s("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(R,e))}function R(e){var t=e._readableState;s("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,N(e)}function O(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(s("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){s("readable nexttick read 0"),e.read(0)}function C(e,t){s("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),N(e),t.flowing&&!t.reading&&e.read(0)}function N(e){var t=e._readableState;for(s("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(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);var r}function j(e){var t=e._readableState;s("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(L,t,e))}function L(e,t){if(s("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function U(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}return E.prototype.read=function(e){s("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return s("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):T(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return s("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&s("length less than watermark",i=!0),t.ended||t.reading?s("reading or ended",i=!1):i&&(s("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=x(r,t))),null===(n=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},E.prototype._read=function(e){v(this,new y("_read()"))},E.prototype.pipe=function(e,r){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,s("pipe count=%d opts=%j",i.pipesCount,r);var o=(!r||!1!==r.end)&&e!==process.stdout&&e!==process.stderr?u:g;function a(t,r){s("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,s("cleanup"),e.removeListener("close",l),e.removeListener("finish",p),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",g),n.removeListener("data",d),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}function u(){s("onend"),e.end()}i.endEmitted?process.nextTick(o):n.once("end",o),e.on("unpipe",a);var c=function(e){return function(){var r=e._readableState;s("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&t(e,"data")&&(r.flowing=!0,N(e))}}(n);e.on("drain",c);var f=!1;function d(t){s("ondata");var r=e.write(t);s("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==U(i.pipes,e))&&!f&&(s("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function h(r){s("onerror",r),g(),e.removeListener("error",h),0===t(e,"error")&&v(e,r)}function l(){e.removeListener("finish",p),g()}function p(){s("onfinish"),e.removeListener("close",l),g()}function g(){s("unpipe"),n.unpipe(e)}return n.on("data",d),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",h),e.once("close",l),e.once("finish",p),e.emit("pipe",n),i.flowing||(s("pipe resume"),n.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};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,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=U(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},E.prototype.on=function(e,t){var r=n.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,s("on readable",i.length,i.reading),i.length?T(this):i.reading||process.nextTick(P,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var r=n.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(I,this),r},E.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(I,this),t},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(s("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(C,e,t))}(this,e)),e.paused=!1,this},E.prototype.pause=function(){return s("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(s("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(s("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){(s("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<w.length;o++)e.on(w[o],this.emit.bind(this,w[o]));return this._read=function(t){s("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=kg()),c(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=B,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===f&&(f=_g?wg:(_g=1,wg=function(){throw new Error("Readable.from is not available in the browser")})),f(E,e,t)}),Eg}var Tg=Bg,Rg=Xp.codes,Og=Rg.ERR_METHOD_NOT_IMPLEMENTED,Mg=Rg.ERR_MULTIPLE_CALLBACK,Ig=Rg.ERR_TRANSFORM_ALREADY_TRANSFORMING,Pg=Rg.ERR_TRANSFORM_WITH_LENGTH_0,Cg=cg();function Ng(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new Mg);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Bg(e){if(!(this instanceof Bg))return new Bg(e);Cg.call(this,e),this._transformState={afterTransform:Ng.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",jg)}function jg(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Lg(this,null,null):this._flush((function(t,r){Lg(e,t,r)}))}function Lg(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Pg;if(e._transformState.transforming)throw new Ig;return e.push(null)}ri(Bg,Cg),Bg.prototype.push=function(e,t){return this._transformState.needTransform=!1,Cg.prototype.push.call(this,e,t)},Bg.prototype._transform=function(e,t,r){r(new Og("_transform()"))},Bg.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Bg.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Bg.prototype._destroy=function(e,t){Cg.prototype._destroy.call(this,e,(function(e){t(e)}))};var Ug,Dg=qg,Fg=Tg;function qg(e){if(!(this instanceof qg))return new qg(e);Fg.call(this,e)}ri(qg,Fg),qg.prototype._transform=function(e,t,r){r(null,e)};var zg=Xp.codes,Kg=zg.ERR_MISSING_ARGS,Hg=zg.ERR_STREAM_DESTROYED;function Gg(e){if(e)throw e}function Wg(e){e()}function Vg(e,t){return e.pipe(t)}var Xg=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=function(e){return e.length?"function"!=typeof e[e.length-1]?Gg:e.pop():Gg}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new Kg("streams");var o=t.map((function(e,r){var s=r<t.length-1;return function(e,t,r,n){n=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(n);var i=!1;e.on("close",(function(){i=!0})),void 0===Ug&&(Ug=Sg),Ug(e,{readable:t,writable:r},(function(e){if(e)return n(e);i=!0,n()}));var o=!1;return function(t){if(!i&&!o)return o=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void n(t||new Hg("pipe"))}}(e,s,r>0,(function(e){n||(n=e),e&&o.forEach(Wg),s||(o.forEach(Wg),i(n))}))}));return t.reduce(Vg)};!function(e,t){(t=e.exports=xg()).Stream=t,t.Readable=t,t.Writable=ug(),t.Duplex=cg(),t.Transform=Tg,t.PassThrough=Dg,t.finished=Sg,t.pipeline=Xg}(Op,Op.exports);var Jg=Op.exports;const{Transform:$g}=Jg;const{Transform:Yg}=Jg;const Qg=e=>class t extends $g{constructor(t,r,n,i,o){super(o),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._hashBitLength=i,this._options=o,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}},Zg=e=>class t extends Yg{constructor(t,r,n,i){super(i),this._rate=t,this._capacity=r,this._delimitedSuffix=n,this._options=i,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let n=null;try{this.update(e,t)}catch(e){n=e}r(n)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(e)||(e=Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}};var em={};const tm=[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];em.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],o=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],a=e[5]^e[15]^e[25]^e[35]^e[45],u=e[6]^e[16]^e[26]^e[36]^e[46],c=e[7]^e[17]^e[27]^e[37]^e[47],f=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49];let h=f^(i<<1|o>>>31),l=d^(o<<1|i>>>31);const p=e[0]^h,g=e[1]^l,m=e[10]^h,y=e[11]^l,b=e[20]^h,v=e[21]^l,w=e[30]^h,_=e[31]^l,E=e[40]^h,A=e[41]^l;h=r^(s<<1|a>>>31),l=n^(a<<1|s>>>31);const S=e[2]^h,k=e[3]^l,x=e[12]^h,T=e[13]^l,R=e[22]^h,O=e[23]^l,M=e[32]^h,I=e[33]^l,P=e[42]^h,C=e[43]^l;h=i^(u<<1|c>>>31),l=o^(c<<1|u>>>31);const N=e[4]^h,B=e[5]^l,j=e[14]^h,L=e[15]^l,U=e[24]^h,D=e[25]^l,F=e[34]^h,q=e[35]^l,z=e[44]^h,K=e[45]^l;h=s^(f<<1|d>>>31),l=a^(d<<1|f>>>31);const H=e[6]^h,G=e[7]^l,W=e[16]^h,V=e[17]^l,X=e[26]^h,J=e[27]^l,$=e[36]^h,Y=e[37]^l,Q=e[46]^h,Z=e[47]^l;h=u^(r<<1|n>>>31),l=c^(n<<1|r>>>31);const ee=e[8]^h,te=e[9]^l,re=e[18]^h,ne=e[19]^l,ie=e[28]^h,oe=e[29]^l,se=e[38]^h,ae=e[39]^l,ue=e[48]^h,ce=e[49]^l,fe=p,de=g,he=y<<4|m>>>28,le=m<<4|y>>>28,pe=b<<3|v>>>29,ge=v<<3|b>>>29,me=_<<9|w>>>23,ye=w<<9|_>>>23,be=E<<18|A>>>14,ve=A<<18|E>>>14,we=S<<1|k>>>31,_e=k<<1|S>>>31,Ee=T<<12|x>>>20,Ae=x<<12|T>>>20,Se=R<<10|O>>>22,ke=O<<10|R>>>22,xe=I<<13|M>>>19,Te=M<<13|I>>>19,Re=P<<2|C>>>30,Oe=C<<2|P>>>30,Me=B<<30|N>>>2,Ie=N<<30|B>>>2,Pe=j<<6|L>>>26,Ce=L<<6|j>>>26,Ne=D<<11|U>>>21,Be=U<<11|D>>>21,je=F<<15|q>>>17,Le=q<<15|F>>>17,Ue=K<<29|z>>>3,De=z<<29|K>>>3,Fe=H<<28|G>>>4,qe=G<<28|H>>>4,ze=V<<23|W>>>9,Ke=W<<23|V>>>9,He=X<<25|J>>>7,Ge=J<<25|X>>>7,We=$<<21|Y>>>11,Ve=Y<<21|$>>>11,Xe=Z<<24|Q>>>8,Je=Q<<24|Z>>>8,$e=ee<<27|te>>>5,Ye=te<<27|ee>>>5,Qe=re<<20|ne>>>12,Ze=ne<<20|re>>>12,et=oe<<7|ie>>>25,tt=ie<<7|oe>>>25,rt=se<<8|ae>>>24,nt=ae<<8|se>>>24,it=ue<<14|ce>>>18,ot=ce<<14|ue>>>18;e[0]=fe^~Ee&Ne,e[1]=de^~Ae&Be,e[10]=Fe^~Qe&pe,e[11]=qe^~Ze&ge,e[20]=we^~Pe&He,e[21]=_e^~Ce&Ge,e[30]=$e^~he&Se,e[31]=Ye^~le&ke,e[40]=Me^~ze&et,e[41]=Ie^~Ke&tt,e[2]=Ee^~Ne&We,e[3]=Ae^~Be&Ve,e[12]=Qe^~pe&xe,e[13]=Ze^~ge&Te,e[22]=Pe^~He&rt,e[23]=Ce^~Ge&nt,e[32]=he^~Se&je,e[33]=le^~ke&Le,e[42]=ze^~et&me,e[43]=Ke^~tt&ye,e[4]=Ne^~We&it,e[5]=Be^~Ve&ot,e[14]=pe^~xe&Ue,e[15]=ge^~Te&De,e[24]=He^~rt&be,e[25]=Ge^~nt&ve,e[34]=Se^~je&Xe,e[35]=ke^~Le&Je,e[44]=et^~me&Re,e[45]=tt^~ye&Oe,e[6]=We^~it&fe,e[7]=Ve^~ot&de,e[16]=xe^~Ue&Fe,e[17]=Te^~De&qe,e[26]=rt^~be&we,e[27]=nt^~ve&_e,e[36]=je^~Xe&$e,e[37]=Le^~Je&Ye,e[46]=me^~Re&Me,e[47]=ye^~Oe&Ie,e[8]=it^~fe&Ee,e[9]=ot^~de&Ae,e[18]=Ue^~Fe&Qe,e[19]=De^~qe&Ze,e[28]=be^~we&Pe,e[29]=ve^~_e&Ce,e[38]=Xe^~$e&he,e[39]=Je^~Ye&le,e[48]=Re^~Me&ze,e[49]=Oe^~Ie&Ke,e[0]^=tm[2*t],e[1]^=tm[2*t+1]}};const rm=em;function nm(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}nm.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},nm.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<this.count%4*8,this.count+=1,this.count===this.blockSize&&(rm.p1600(this.state),this.count=0)},nm.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<this.count%4*8,0!=(128&e)&&this.count===this.blockSize-1&&rm.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<(this.blockSize-1)%4*8,rm.p1600(this.state),this.count=0,this.squeezing=!0},nm.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(rm.p1600(this.state),this.count=0);return t},nm.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var im=function(e){const t=Qg(e),r=Zg(e);return function(e,n){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+e)}}}(nm);Object.defineProperty(Tp,"__esModule",{value:!0});var om=Rp,sm=im;Tp.keccak224=om.createHashFunction((function(){return sm("keccak224")})),Tp.keccak256=om.createHashFunction((function(){return sm("keccak256")})),Tp.keccak384=om.createHashFunction((function(){return sm("keccak384")})),Tp.keccak512=om.createHashFunction((function(){return sm("keccak512")}));var am=lp.Buffer,um=Jg.Transform;function cm(e){um.call(this),this._block=am.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}ri(cm,um),cm.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},cm.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},cm.prototype.update=function(e,t){if(function(e,t){if(!am.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");am.isBuffer(e)||(e=am.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var i=this._blockOffset;i<this._blockSize;)r[i++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},cm.prototype._update=function(){throw new Error("_update is not implemented")},cm.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},cm.prototype._digest=function(){throw new Error("_digest is not implemented")};var fm=cm,dm=ri,hm=fm,lm=lp.Buffer,pm=new Array(16);function gm(){hm.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function mm(e,t){return e<<t|e>>>32-t}function ym(e,t,r,n,i,o,s){return mm(e+(t&r|~t&n)+i+o|0,s)+t|0}function bm(e,t,r,n,i,o,s){return mm(e+(t&n|r&~n)+i+o|0,s)+t|0}function vm(e,t,r,n,i,o,s){return mm(e+(t^r^n)+i+o|0,s)+t|0}function wm(e,t,r,n,i,o,s){return mm(e+(r^(t|~n))+i+o|0,s)+t|0}dm(gm,hm),gm.prototype._update=function(){for(var e=pm,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;r=ym(r,n,i,o,e[0],3614090360,7),o=ym(o,r,n,i,e[1],3905402710,12),i=ym(i,o,r,n,e[2],606105819,17),n=ym(n,i,o,r,e[3],3250441966,22),r=ym(r,n,i,o,e[4],4118548399,7),o=ym(o,r,n,i,e[5],1200080426,12),i=ym(i,o,r,n,e[6],2821735955,17),n=ym(n,i,o,r,e[7],4249261313,22),r=ym(r,n,i,o,e[8],1770035416,7),o=ym(o,r,n,i,e[9],2336552879,12),i=ym(i,o,r,n,e[10],4294925233,17),n=ym(n,i,o,r,e[11],2304563134,22),r=ym(r,n,i,o,e[12],1804603682,7),o=ym(o,r,n,i,e[13],4254626195,12),i=ym(i,o,r,n,e[14],2792965006,17),r=bm(r,n=ym(n,i,o,r,e[15],1236535329,22),i,o,e[1],4129170786,5),o=bm(o,r,n,i,e[6],3225465664,9),i=bm(i,o,r,n,e[11],643717713,14),n=bm(n,i,o,r,e[0],3921069994,20),r=bm(r,n,i,o,e[5],3593408605,5),o=bm(o,r,n,i,e[10],38016083,9),i=bm(i,o,r,n,e[15],3634488961,14),n=bm(n,i,o,r,e[4],3889429448,20),r=bm(r,n,i,o,e[9],568446438,5),o=bm(o,r,n,i,e[14],3275163606,9),i=bm(i,o,r,n,e[3],4107603335,14),n=bm(n,i,o,r,e[8],1163531501,20),r=bm(r,n,i,o,e[13],2850285829,5),o=bm(o,r,n,i,e[2],4243563512,9),i=bm(i,o,r,n,e[7],1735328473,14),r=vm(r,n=bm(n,i,o,r,e[12],2368359562,20),i,o,e[5],4294588738,4),o=vm(o,r,n,i,e[8],2272392833,11),i=vm(i,o,r,n,e[11],1839030562,16),n=vm(n,i,o,r,e[14],4259657740,23),r=vm(r,n,i,o,e[1],2763975236,4),o=vm(o,r,n,i,e[4],1272893353,11),i=vm(i,o,r,n,e[7],4139469664,16),n=vm(n,i,o,r,e[10],3200236656,23),r=vm(r,n,i,o,e[13],681279174,4),o=vm(o,r,n,i,e[0],3936430074,11),i=vm(i,o,r,n,e[3],3572445317,16),n=vm(n,i,o,r,e[6],76029189,23),r=vm(r,n,i,o,e[9],3654602809,4),o=vm(o,r,n,i,e[12],3873151461,11),i=vm(i,o,r,n,e[15],530742520,16),r=wm(r,n=vm(n,i,o,r,e[2],3299628645,23),i,o,e[0],4096336452,6),o=wm(o,r,n,i,e[7],1126891415,10),i=wm(i,o,r,n,e[14],2878612391,15),n=wm(n,i,o,r,e[5],4237533241,21),r=wm(r,n,i,o,e[12],1700485571,6),o=wm(o,r,n,i,e[3],2399980690,10),i=wm(i,o,r,n,e[10],4293915773,15),n=wm(n,i,o,r,e[1],2240044497,21),r=wm(r,n,i,o,e[8],1873313359,6),o=wm(o,r,n,i,e[15],4264355552,10),i=wm(i,o,r,n,e[6],2734768916,15),n=wm(n,i,o,r,e[13],1309151649,21),r=wm(r,n,i,o,e[4],4149444226,6),o=wm(o,r,n,i,e[11],3174756917,10),i=wm(i,o,r,n,e[2],718787259,15),n=wm(n,i,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},gm.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=lm.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};var _m=gm,Em=se.Buffer,Am=ri,Sm=fm,km=new Array(16),xm=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Tm=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Rm=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Om=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Mm=[0,1518500249,1859775393,2400959708,2840853838],Im=[1352829926,1548603684,1836072691,2053994217,0];function Pm(){Sm.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function Cm(e,t){return e<<t|e>>>32-t}function Nm(e,t,r,n,i,o,s,a){return Cm(e+(t^r^n)+o+s|0,a)+i|0}function Bm(e,t,r,n,i,o,s,a){return Cm(e+(t&r|~t&n)+o+s|0,a)+i|0}function jm(e,t,r,n,i,o,s,a){return Cm(e+((t|~r)^n)+o+s|0,a)+i|0}function Lm(e,t,r,n,i,o,s,a){return Cm(e+(t&n|r&~n)+o+s|0,a)+i|0}function Um(e,t,r,n,i,o,s,a){return Cm(e+(t^(r|~n))+o+s|0,a)+i|0}Am(Pm,Sm),Pm.prototype._update=function(){for(var e=km,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,u=0|this._b,c=0|this._c,f=0|this._d,d=0|this._e,h=0;h<80;h+=1){var l,p;h<16?(l=Nm(r,n,i,o,s,e[xm[h]],Mm[0],Rm[h]),p=Um(a,u,c,f,d,e[Tm[h]],Im[0],Om[h])):h<32?(l=Bm(r,n,i,o,s,e[xm[h]],Mm[1],Rm[h]),p=Lm(a,u,c,f,d,e[Tm[h]],Im[1],Om[h])):h<48?(l=jm(r,n,i,o,s,e[xm[h]],Mm[2],Rm[h]),p=jm(a,u,c,f,d,e[Tm[h]],Im[2],Om[h])):h<64?(l=Lm(r,n,i,o,s,e[xm[h]],Mm[3],Rm[h]),p=Bm(a,u,c,f,d,e[Tm[h]],Im[3],Om[h])):(l=Um(r,n,i,o,s,e[xm[h]],Mm[4],Rm[h]),p=Nm(a,u,c,f,d,e[Tm[h]],Im[4],Om[h])),r=s,s=o,o=Cm(i,10),i=n,n=l,a=d,d=f,f=Cm(c,10),c=u,u=p}var g=this._b+i+f|0;this._b=this._c+o+d|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+c|0,this._a=g},Pm.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=Em.alloc?Em.alloc(20):new Em(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};var Dm=Pm,Fm={exports:{}},qm=lp.Buffer;function zm(e,t){this._block=qm.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}zm.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=qm.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,o=this._len,s=0;s<i;){for(var a=o%n,u=Math.min(i-s,n-a),c=0;c<u;c++)r[a+c]=e[s+c];s+=u,(o+=u)%n==0&&this._update(r)}return this._len+=i,this},zm.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},zm.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Km=zm,Hm=ri,Gm=Km,Wm=lp.Buffer,Vm=[1518500249,1859775393,-1894007588,-899497514],Xm=new Array(80);function Jm(){this.init(),this._w=Xm,Gm.call(this,64,56)}function $m(e){return e<<30|e>>>2}function Ym(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Hm(Jm,Gm),Jm.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Jm.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=r[u-3]^r[u-8]^r[u-14]^r[u-16];for(var c=0;c<80;++c){var f=~~(c/20),d=0|((t=n)<<5|t>>>27)+Ym(f,i,o,s)+a+r[c]+Vm[f];a=s,s=o,o=$m(i),i=n,n=d}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},Jm.prototype._hash=function(){var e=Wm.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var Qm=Jm,Zm=ri,ey=Km,ty=lp.Buffer,ry=[1518500249,1859775393,-1894007588,-899497514],ny=new Array(80);function iy(){this.init(),this._w=ny,ey.call(this,64,56)}function oy(e){return e<<5|e>>>27}function sy(e){return e<<30|e>>>2}function ay(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}Zm(iy,ey),iy.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},iy.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)r[u]=e.readInt32BE(4*u);for(;u<80;++u)r[u]=(t=r[u-3]^r[u-8]^r[u-14]^r[u-16])<<1|t>>>31;for(var c=0;c<80;++c){var f=~~(c/20),d=oy(n)+ay(f,i,o,s)+a+r[c]+ry[f]|0;a=s,s=o,o=sy(i),i=n,n=d}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},iy.prototype._hash=function(){var e=ty.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e};var uy=iy,cy=ri,fy=Km,dy=lp.Buffer,hy=[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],ly=new Array(64);function py(){this.init(),this._w=ly,fy.call(this,64,56)}function gy(e,t,r){return r^e&(t^r)}function my(e,t,r){return e&t|r&(e|t)}function yy(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function by(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function vy(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function wy(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}cy(py,fy),py.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},py.prototype._update=function(e){for(var t=this._w,r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._f,u=0|this._g,c=0|this._h,f=0;f<16;++f)t[f]=e.readInt32BE(4*f);for(;f<64;++f)t[f]=wy(t[f-2])+t[f-7]+vy(t[f-15])+t[f-16]|0;for(var d=0;d<64;++d){var h=c+by(s)+gy(s,a,u)+hy[d]+t[d]|0,l=yy(r)+my(r,n,i)|0;c=u,u=a,a=s,s=o+h|0,o=i,i=n,n=r,r=h+l|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=a+this._f|0,this._g=u+this._g|0,this._h=c+this._h|0},py.prototype._hash=function(){var e=dy.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var _y=py,Ey=ri,Ay=_y,Sy=Km,ky=lp.Buffer,xy=new Array(64);function Ty(){this.init(),this._w=xy,Sy.call(this,64,56)}Ey(Ty,Ay),Ty.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Ty.prototype._hash=function(){var e=ky.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Ry=Ty,Oy=ri,My=Km,Iy=lp.Buffer,Py=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Cy=new Array(160);function Ny(){this.init(),this._w=Cy,My.call(this,128,112)}function By(e,t,r){return r^e&(t^r)}function jy(e,t,r){return e&t|r&(e|t)}function Ly(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Uy(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Dy(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Fy(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function qy(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function zy(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Ky(e,t){return e>>>0<t>>>0?1:0}Oy(Ny,My),Ny.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Ny.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,u=0|this._gh,c=0|this._hh,f=0|this._al,d=0|this._bl,h=0|this._cl,l=0|this._dl,p=0|this._el,g=0|this._fl,m=0|this._gl,y=0|this._hl,b=0;b<32;b+=2)t[b]=e.readInt32BE(4*b),t[b+1]=e.readInt32BE(4*b+4);for(;b<160;b+=2){var v=t[b-30],w=t[b-30+1],_=Dy(v,w),E=Fy(w,v),A=qy(v=t[b-4],w=t[b-4+1]),S=zy(w,v),k=t[b-14],x=t[b-14+1],T=t[b-32],R=t[b-32+1],O=E+x|0,M=_+k+Ky(O,E)|0;M=(M=M+A+Ky(O=O+S|0,S)|0)+T+Ky(O=O+R|0,R)|0,t[b]=M,t[b+1]=O}for(var I=0;I<160;I+=2){M=t[I],O=t[I+1];var P=jy(r,n,i),C=jy(f,d,h),N=Ly(r,f),B=Ly(f,r),j=Uy(s,p),L=Uy(p,s),U=Py[I],D=Py[I+1],F=By(s,a,u),q=By(p,g,m),z=y+L|0,K=c+j+Ky(z,y)|0;K=(K=(K=K+F+Ky(z=z+q|0,q)|0)+U+Ky(z=z+D|0,D)|0)+M+Ky(z=z+O|0,O)|0;var H=B+C|0,G=N+P+Ky(H,B)|0;c=u,y=m,u=a,m=g,a=s,g=p,s=o+K+Ky(p=l+z|0,l)|0,o=i,l=h,i=n,h=d,n=r,d=f,r=K+G+Ky(f=z+H|0,z)|0}this._al=this._al+f|0,this._bl=this._bl+d|0,this._cl=this._cl+h|0,this._dl=this._dl+l|0,this._el=this._el+p|0,this._fl=this._fl+g|0,this._gl=this._gl+m|0,this._hl=this._hl+y|0,this._ah=this._ah+r+Ky(this._al,f)|0,this._bh=this._bh+n+Ky(this._bl,d)|0,this._ch=this._ch+i+Ky(this._cl,h)|0,this._dh=this._dh+o+Ky(this._dl,l)|0,this._eh=this._eh+s+Ky(this._el,p)|0,this._fh=this._fh+a+Ky(this._fl,g)|0,this._gh=this._gh+u+Ky(this._gl,m)|0,this._hh=this._hh+c+Ky(this._hl,y)|0},Ny.prototype._hash=function(){var e=Iy.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Hy=Ny,Gy=ri,Wy=Hy,Vy=Km,Xy=lp.Buffer,Jy=new Array(160);function $y(){this.init(),this._w=Jy,Vy.call(this,128,112)}Gy($y,Wy),$y.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},$y.prototype._hash=function(){var e=Xy.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Yy=$y,Qy=Fm.exports=function(e){e=e.toLowerCase();var t=Qy[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};Qy.sha=Qm,Qy.sha1=uy,Qy.sha224=Ry,Qy.sha256=_y,Qy.sha384=Yy,Qy.sha512=Hy;var Zy=Fm.exports;function eb(){this.head=null,this.tail=null,this.length=0}eb.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},eb.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},eb.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}},eb.prototype.clear=function(){this.head=this.tail=null,this.length=0},eb.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},eb.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},nb.ReadableState=rb;var tb=Th("stream");function rb(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Ib&&(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 eb,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 dg(e.encoding),this.encoding=e.encoding)}function nb(e){if(!(this instanceof nb))return new nb(e);this._readableState=new rb(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),Ip.call(this)}function ib(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,ab(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var u;!t.decoder||i||n||(r=t.decoder.write(r),u=!t.objectMode&&0===r.length),i||(t.reading=!1),u||(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&&ab(e))),function(e,t){t.readingMore||(t.readingMore=!0,sh(cb,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(t)}wh(nb,Ip),nb.prototype.push=function(e,t){var r=this._readableState;return r.objectMode||"string"!=typeof e||(t=t||r.defaultEncoding)!==r.encoding&&(e=_.from(e,t),t=""),ib(this,r,e,t,!1)},nb.prototype.unshift=function(e){return ib(this,this._readableState,e,"",!0)},nb.prototype.isPaused=function(){return!1===this._readableState.flowing},nb.prototype.setEncoding=function(e){return this._readableState.decoder=new dg(e),this._readableState.encoding=e,this};var ob=8388608;function sb(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=ob?e=ob:(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 ab(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(tb("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?sh(ub,e):ub(e))}function ub(e){tb("emit readable"),e.emit("readable"),hb(e)}function cb(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(tb("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function fb(e){tb("readable nexttick read 0"),e.read(0)}function db(e,t){t.reading||(tb("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),hb(e),t.flowing&&!t.reading&&e.read(0)}function hb(e){var t=e._readableState;for(tb("flow",t.flowing);t.flowing&&null!==e.read(););}function lb(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=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;e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,n=1,i=r.data;e-=i.length;for(;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));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,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(s));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function pb(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,sh(gb,t,e))}function gb(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function mb(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function yb(){}function bb(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function vb(e,t){Object.defineProperty(this,"buffer",{get:Sh((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")}),e=e||{},this.objectMode=!!e.objectMode,t instanceof Ib&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=!1===e.decodeStrings;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,i){--t.pendingcb,r?sh(i,n):i(n);e._writableState.errorEmitted=!0,e.emit("error",n)}(e,r,n,t,i);else{var o=Sb(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||Ab(e,r),n?sh(Eb,e,r,o,i):Eb(e,r,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Tb(this)}function wb(e){if(!(this instanceof wb||this instanceof Ib))return new wb(e);this._writableState=new vb(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev)),Ip.call(this)}function _b(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function Eb(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),xb(e,t)}function Ab(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var s=0;r;)i[s]=r,r=r.next,s+=1;_b(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Tb(t)}else{for(;r;){var a=r.chunk,u=r.encoding,c=r.callback;if(_b(e,t,!1,t.objectMode?1:a.length,a,u,c),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function Sb(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function kb(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function xb(e,t){var r=Sb(t);return r&&(0===t.pendingcb?(kb(e,t),t.finished=!0,e.emit("finish")):kb(e,t)),r}function Tb(e){var t=this;this.next=null,this.entry=null,this.finish=function(r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}nb.prototype.read=function(e){tb("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return tb("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?pb(this):ab(this),null;if(0===(e=sb(e,t))&&t.ended)return 0===t.length&&pb(this),null;var n,i=t.needReadable;return tb("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&tb("length less than watermark",i=!0),t.ended||t.reading?tb("reading or ended",i=!1):i&&(tb("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=sb(r,t))),null===(n=e>0?lb(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&pb(this)),null!==n&&this.emit("data",n),n},nb.prototype._read=function(e){this.emit("error",new Error("not implemented"))},nb.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,tb("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?s:c;function o(e){tb("onunpipe"),e===r&&c()}function s(){tb("onend"),e.end()}n.endEmitted?sh(i):r.once("end",i),e.on("unpipe",o);var a=function(e){return function(){var t=e._readableState;tb("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,hb(e))}}(r);e.on("drain",a);var u=!1;function c(){tb("cleanup"),e.removeListener("close",l),e.removeListener("finish",p),e.removeListener("drain",a),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",c),r.removeListener("data",d),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||a()}var f=!1;function d(t){tb("ondata"),f=!1,!1!==e.write(t)||f||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==mb(n.pipes,e))&&!u&&(tb("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,f=!0),r.pause())}function h(t){var r;tb("onerror",t),g(),e.removeListener("error",h),0===(r="error",e.listeners(r).length)&&e.emit("error",t)}function l(){e.removeListener("finish",p),g()}function p(){tb("onfinish"),e.removeListener("close",l),g()}function g(){tb("unpipe"),r.unpipe(e)}return r.on("data",d),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",h),e.once("close",l),e.once("finish",p),e.emit("pipe",r),n.flowing||(tb("pipe resume"),r.resume()),e},nb.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<n;i++)r[i].emit("unpipe",this);return this}var o=mb(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this)),this},nb.prototype.on=function(e,t){var r=Ip.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&ab(this):sh(fb,this))}return r},nb.prototype.addListener=nb.prototype.on,nb.prototype.resume=function(){var e=this._readableState;return e.flowing||(tb("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,sh(db,e,t))}(this,e)),this},nb.prototype.pause=function(){return tb("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(tb("pause"),this._readableState.flowing=!1,this.emit("pause")),this},nb.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;for(var i in e.on("end",(function(){if(tb("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)})),e.on("data",(function(i){(tb("wrapped data"),t.decoder&&(i=t.decoder.write(i)),t.objectMode&&null==i)||(t.objectMode||i&&i.length)&&(n.push(i)||(r=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));return function(e,t){for(var r=0,n=e.length;r<n;r++)t(e[r],r)}(["error","close","destroy","pause","resume"],(function(t){e.on(t,n.emit.bind(n,t))})),n._read=function(t){tb("wrapped _read",t),r&&(r=!1,e.resume())},n},nb._fromList=lb,wb.WritableState=vb,wh(wb,Ip),vb.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},wb.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},wb.prototype.write=function(e,t,r){var n=this._writableState,i=!1;return"function"==typeof t&&(r=t,t=null),_.isBuffer(e)?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=yb),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),sh(t,r)}(this,r):function(e,t,r,n){var i=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):_.isBuffer(r)||"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),sh(n,o),i=!1),i}(this,n,e,r)&&(n.pendingcb++,i=function(e,t,r,n,i){r=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=_.from(t,r));return t}(t,r,n),_.isBuffer(r)&&(n="buffer");var o=t.objectMode?1:r.length;t.length+=o;var s=t.length<t.highWaterMark;s||(t.needDrain=!0);if(t.writing||t.corked){var a=t.lastBufferedRequest;t.lastBufferedRequest=new bb(r,n,i),a?a.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _b(e,t,!1,o,r,n,i);return s}(this,n,e,t,r)),i},wb.prototype.cork=function(){this._writableState.corked++},wb.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||Ab(this,e))},wb.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},wb.prototype._write=function(e,t,r){r(new Error("not implemented"))},wb.prototype._writev=null,wb.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,xb(e,t),r&&(t.finished?sh(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},wh(Ib,nb);for(var Rb=Object.keys(wb.prototype),Ob=0;Ob<Rb.length;Ob++){var Mb=Rb[Ob];Ib.prototype[Mb]||(Ib.prototype[Mb]=wb.prototype[Mb])}function Ib(e){if(!(this instanceof Ib))return new Ib(e);nb.call(this,e),wb.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",Pb)}function Pb(){this.allowHalfOpen||this._writableState.ended||sh(Cb,this)}function Cb(e){e.end()}function Nb(e){this.afterTransform=function(t,r){return function(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!=r&&e.push(r);i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function Bb(e){if(!(this instanceof Bb))return new Bb(e);Ib.call(this,e),this._transformState=new Nb(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",(function(){"function"==typeof this._flush?this._flush((function(e){jb(t,e)})):jb(t)}))}function jb(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(n.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}function Lb(e){if(!(this instanceof Lb))return new Lb(e);Bb.call(this,e)}function Ub(){Ip.call(this)}wh(Bb,Ib),Bb.prototype.push=function(e,t){return this._transformState.needTransform=!1,Ib.prototype.push.call(this,e,t)},Bb.prototype._transform=function(e,t,r){throw new Error("Not implemented")},Bb.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Bb.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},wh(Lb,Bb),Lb.prototype._transform=function(e,t,r){r(null,e)},wh(Ub,Ip),Ub.Readable=nb,Ub.Writable=wb,Ub.Duplex=Ib,Ub.Transform=Bb,Ub.PassThrough=Lb,Ub.Stream=Ub,Ub.prototype.pipe=function(e,t){var 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",s),r.on("close",a));var o=!1;function s(){o||(o=!0,e.end())}function a(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){if(c(),0===Ip.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",u),e.on("error",u),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e};var Db=i(Object.freeze({__proto__:null,Duplex:Ib,PassThrough:Lb,Readable:nb,Stream:Ub,Transform:Bb,Writable:wb,default:Ub})),Fb=lp.Buffer,qb=Db.Transform,zb=gg.StringDecoder;function Kb(e){qb.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}ri(Kb,qb),Kb.prototype.update=function(e,t,r){"string"==typeof e&&(e=Fb.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},Kb.prototype.setAutoPadding=function(){},Kb.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},Kb.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},Kb.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},Kb.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},Kb.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},Kb.prototype._finalOrDigest=function(e){var t=this.__final()||Fb.alloc(0);return e&&(t=this._toString(t,e,!0)),t},Kb.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new zb(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n};var Hb=Kb,Gb=_m,Wb=Dm,Vb=Zy,Xb=Hb;function Jb(e){Xb.call(this,"digest"),this._hash=e}ri(Jb,Xb),Jb.prototype._update=function(e){this._hash.update(e)},Jb.prototype._final=function(){return this._hash.digest()};var $b=function(e){return"md5"===(e=e.toLowerCase())?new Gb:"rmd160"===e||"ripemd160"===e?new Wb:new Jb(Vb(e))};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.rlphash=e.ripemd160FromArray=e.ripemd160FromString=e.ripemd160=e.sha256FromArray=e.sha256FromString=e.sha256=e.keccakFromArray=e.keccakFromHexString=e.keccakFromString=e.keccak256=e.keccak=void 0;var t=Tp,r=$b,n=Pd,i=Ap,o=Sp;e.keccak=function(e,r){switch(void 0===r&&(r=256),(0,o.assertIsBuffer)(e),r){case 224:return(0,t.keccak224)(e);case 256:return(0,t.keccak256)(e);case 384:return(0,t.keccak384)(e);case 512:return(0,t.keccak512)(e);default:throw new Error("Invald algorithm: keccak".concat(r))}};e.keccak256=function(t){return(0,e.keccak)(t)};e.keccakFromString=function(t,r){void 0===r&&(r=256),(0,o.assertIsString)(t);var n=Buffer.from(t,"utf8");return(0,e.keccak)(n,r)};e.keccakFromHexString=function(t,r){return void 0===r&&(r=256),(0,o.assertIsHexString)(t),(0,e.keccak)((0,i.toBuffer)(t),r)};e.keccakFromArray=function(t,r){return void 0===r&&(r=256),(0,o.assertIsArray)(t),(0,e.keccak)((0,i.toBuffer)(t),r)};var s=function(e){return e=(0,i.toBuffer)(e),r("sha256").update(e).digest()};e.sha256=function(e){return(0,o.assertIsBuffer)(e),s(e)};e.sha256FromString=function(e){return(0,o.assertIsString)(e),s(e)};e.sha256FromArray=function(e){return(0,o.assertIsArray)(e),s(e)};var a=function(e,t){e=(0,i.toBuffer)(e);var n=r("rmd160").update(e).digest();return!0===t?(0,i.setLengthLeft)(n,32):n};e.ripemd160=function(e,t){return(0,o.assertIsBuffer)(e),a(e,t)};e.ripemd160FromString=function(e,t){return(0,o.assertIsString)(e),a(e,t)};e.ripemd160FromArray=function(e,t){return(0,o.assertIsArray)(e),a(e,t)};e.rlphash=function(t){return(0,e.keccak)(n.rlp.encode(t))}}(xp);var Yb={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=e.bnToRlp=e.bnToUnpaddedBuffer=e.bnToHex=void 0;var t,r=Pd,n=wp,i=Ap;function o(e){return(0,i.unpadBuffer)(e.toArrayLike(Buffer))}e.bnToHex=function(e){return"0x".concat(e.toString(16))},e.bnToUnpaddedBuffer=o,e.bnToRlp=function(e){return o(e)},function(e){e[e.Number=0]="Number",e[e.BN=1]="BN",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(t=e.TypeOutput||(e.TypeOutput={})),e.toType=function(e,o){if(null===e)return null;if(void 0!==e){if("string"==typeof e&&!(0,n.isHexString)(e))throw new Error("A string must be provided with a 0x-prefix, given: ".concat(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)");var s=(0,i.toBuffer)(e);if(o===t.Buffer)return s;if(o===t.BN)return new r.BN(s);if(o===t.Number){var a=new r.BN(s),u=new r.BN(Number.MAX_SAFE_INTEGER.toString());if(a.gt(u))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return a.toNumber()}return"0x".concat(s.toString("hex"))}}}(Yb),function(e){var t=r&&r.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.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 s},n=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),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;var i=n(Ul),o=Pd,s=Dl,a=wp,u=Id,c=Ap,f=xp,d=Sp,h=Yb,l=function(){function e(e,t,r,n){void 0===e&&(e=new o.BN(0)),void 0===t&&(t=new o.BN(0)),void 0===r&&(r=u.KECCAK256_RLP),void 0===n&&(n=u.KECCAK256_NULL),this.nonce=e,this.balance=t,this.stateRoot=r,this.codeHash=n,this._validate()}return e.fromAccountData=function(t){var r=t.nonce,n=t.balance,i=t.stateRoot,s=t.codeHash;return new e(r?new o.BN((0,c.toBuffer)(r)):void 0,n?new o.BN((0,c.toBuffer)(n)):void 0,i?(0,c.toBuffer)(i):void 0,s?(0,c.toBuffer)(s):void 0)},e.fromRlpSerializedAccount=function(e){var t=o.rlp.decode(e);if(!Array.isArray(t))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(t)},e.fromValuesArray=function(r){var n=t(r,4),i=n[0],s=n[1],a=n[2],u=n[3];return new e(new o.BN(i),new o.BN(s),a,u)},e.prototype._validate=function(){if(this.nonce.lt(new o.BN(0)))throw new Error("nonce must be greater than zero");if(this.balance.lt(new o.BN(0)))throw new Error("balance must be greater than zero");if(32!==this.stateRoot.length)throw new Error("stateRoot must have a length of 32");if(32!==this.codeHash.length)throw new Error("codeHash must have a length of 32")},e.prototype.raw=function(){return[(0,h.bnToUnpaddedBuffer)(this.nonce),(0,h.bnToUnpaddedBuffer)(this.balance),this.stateRoot,this.codeHash]},e.prototype.serialize=function(){return o.rlp.encode(this.raw())},e.prototype.isContract=function(){return!this.codeHash.equals(u.KECCAK256_NULL)},e.prototype.isEmpty=function(){return this.balance.isZero()&&this.nonce.isZero()&&this.codeHash.equals(u.KECCAK256_NULL)},e}();e.Account=l;e.isValidAddress=function(e){try{(0,d.assertIsString)(e)}catch(e){return!1}return/^0x[0-9a-fA-F]{40}$/.test(e)};e.toChecksumAddress=function(e,t){(0,d.assertIsHexString)(e);var r=(0,a.stripHexPrefix)(e).toLowerCase(),n="";t&&(n=(0,h.toType)(t,h.TypeOutput.BN).toString()+"0x");for(var i=(0,f.keccakFromString)(n+r).toString("hex"),o="0x",s=0;s<r.length;s++)parseInt(i[s],16)>=8?o+=r[s].toUpperCase():o+=r[s];return o};e.isValidChecksumAddress=function(t,r){return(0,e.isValidAddress)(t)&&(0,e.toChecksumAddress)(t,r)===t};e.generateAddress=function(e,t){(0,d.assertIsBuffer)(e),(0,d.assertIsBuffer)(t);var r=new o.BN(t);return r.isZero()?(0,f.rlphash)([e,null]).slice(-20):(0,f.rlphash)([e,Buffer.from(r.toArray())]).slice(-20)};e.generateAddress2=function(e,t,r){return(0,d.assertIsBuffer)(e),(0,d.assertIsBuffer)(t),(0,d.assertIsBuffer)(r),(0,i.default)(20===e.length),(0,i.default)(32===t.length),(0,f.keccak256)(Buffer.concat([Buffer.from("ff","hex"),e,t,(0,f.keccak256)(r)])).slice(-20)};e.isValidPrivate=function(e){return(0,s.privateKeyVerify)(e)};e.isValidPublic=function(e,t){return void 0===t&&(t=!1),(0,d.assertIsBuffer)(e),64===e.length?(0,s.publicKeyVerify)(Buffer.concat([Buffer.from([4]),e])):!!t&&(0,s.publicKeyVerify)(e)};e.pubToAddress=function(e,t){return void 0===t&&(t=!1),(0,d.assertIsBuffer)(e),t&&64!==e.length&&(e=Buffer.from((0,s.publicKeyConvert)(e,!1).slice(1))),(0,i.default)(64===e.length),(0,f.keccak)(e).slice(-20)},e.publicToAddress=e.pubToAddress;e.privateToPublic=function(e){return(0,d.assertIsBuffer)(e),Buffer.from((0,s.publicKeyCreate)(e,!1)).slice(1)};e.privateToAddress=function(t){return(0,e.publicToAddress)((0,e.privateToPublic)(t))};e.importPublic=function(e){return(0,d.assertIsBuffer)(e),64!==e.length&&(e=Buffer.from((0,s.publicKeyConvert)(e,!1).slice(1))),e};e.zeroAddress=function(){var e=(0,c.zeros)(20);return(0,c.bufferToHex)(e)};e.isZeroAddress=function(t){try{(0,d.assertIsString)(t)}catch(e){return!1}return(0,e.zeroAddress)()===t}}(Xd);var Qb={},Zb=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qb,"__esModule",{value:!0}),Qb.Address=void 0;var ev=Zb(Ul),tv=Pd,rv=Ap,nv=Xd,iv=function(){function e(e){(0,ev.default)(20===e.length,"Invalid address length"),this.buf=e}return e.zero=function(){return new e((0,rv.zeros)(20))},e.fromString=function(t){return(0,ev.default)((0,nv.isValidAddress)(t),"Invalid address"),new e((0,rv.toBuffer)(t))},e.fromPublicKey=function(t){return(0,ev.default)(Buffer.isBuffer(t),"Public key should be Buffer"),new e((0,nv.pubToAddress)(t))},e.fromPrivateKey=function(t){return(0,ev.default)(Buffer.isBuffer(t),"Private key should be Buffer"),new e((0,nv.privateToAddress)(t))},e.generate=function(t,r){return(0,ev.default)(tv.BN.isBN(r)),new e((0,nv.generateAddress)(t.buf,r.toArrayLike(Buffer)))},e.generate2=function(t,r,n){return(0,ev.default)(Buffer.isBuffer(r)),(0,ev.default)(Buffer.isBuffer(n)),new e((0,nv.generateAddress2)(t.buf,r,n))},e.prototype.equals=function(e){return this.buf.equals(e.buf)},e.prototype.isZero=function(){return this.equals(e.zero())},e.prototype.isPrecompileOrSystemAddress=function(){var e=new tv.BN(this.buf),t=new tv.BN(0),r=new tv.BN("ffff","hex");return e.gte(t)&&e.lte(r)},e.prototype.toString=function(){return"0x"+this.buf.toString("hex")},e.prototype.toBuffer=function(){return Buffer.from(this.buf)},e}();Qb.Address=iv;var ov={};Object.defineProperty(ov,"__esModule",{value:!0}),ov.hashPersonalMessage=ov.isValidSignature=ov.fromRpcSig=ov.toCompactSig=ov.toRpcSig=ov.ecrecover=ov.ecsign=void 0;var sv=Dl,av=Pd,uv=Ap,cv=xp,fv=Sp,dv=Yb;function hv(e,t){var r=(0,dv.toType)(e,dv.TypeOutput.BN);if(r.eqn(0)||r.eqn(1))return(0,dv.toType)(e,dv.TypeOutput.BN);if(!t)return r.subn(27);var n=(0,dv.toType)(t,dv.TypeOutput.BN);return r.sub(n.muln(2).addn(35))}function lv(e){var t=new av.BN(e);return t.eqn(0)||t.eqn(1)}ov.ecsign=function(e,t,r){var n=(0,sv.ecdsaSign)(e,t),i=n.signature,o=n.recid,s=Buffer.from(i.slice(0,32)),a=Buffer.from(i.slice(32,64));if(!r||"number"==typeof r){if(r&&!Number.isSafeInteger(r))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");return{r:s,s:a,v:r?o+(2*r+35):o+27}}return{r:s,s:a,v:(0,dv.toType)(r,dv.TypeOutput.BN).muln(2).addn(35).addn(o).toArrayLike(Buffer)}};ov.ecrecover=function(e,t,r,n,i){var o=Buffer.concat([(0,uv.setLengthLeft)(r,32),(0,uv.setLengthLeft)(n,32)],64),s=hv(t,i);if(!lv(s))throw new Error("Invalid signature v value");var a=(0,sv.ecdsaRecover)(o,s.toNumber(),e);return Buffer.from((0,sv.publicKeyConvert)(a,!1).slice(1))};ov.toRpcSig=function(e,t,r,n){if(!lv(hv(e,n)))throw new Error("Invalid signature v value");return(0,uv.bufferToHex)(Buffer.concat([(0,uv.setLengthLeft)(t,32),(0,uv.setLengthLeft)(r,32),(0,uv.toBuffer)(e)]))};ov.toCompactSig=function(e,t,r,n){if(!lv(hv(e,n)))throw new Error("Invalid signature v value");var i=(0,dv.toType)(e,dv.TypeOutput.Number),o=r;return(i>28&&i%2==1||1===i||28===i)&&((o=Buffer.from(r))[0]|=128),(0,uv.bufferToHex)(Buffer.concat([(0,uv.setLengthLeft)(t,32),(0,uv.setLengthLeft)(o,32)]))};ov.fromRpcSig=function(e){var t,r,n,i=(0,uv.toBuffer)(e);if(i.length>=65)t=i.slice(0,32),r=i.slice(32,64),n=(0,uv.bufferToInt)(i.slice(64));else{if(64!==i.length)throw new Error("Invalid signature length");t=i.slice(0,32),r=i.slice(32,64),n=(0,uv.bufferToInt)(i.slice(32,33))>>7,r[0]&=127}return n<27&&(n+=27),{v:n,r:t,s:r}};ov.isValidSignature=function(e,t,r,n,i){void 0===n&&(n=!0);var o=new av.BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),s=new av.BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(32!==t.length||32!==r.length)return!1;if(!lv(hv(e,i)))return!1;var a=new av.BN(t),u=new av.BN(r);return!(a.isZero()||a.gt(s)||u.isZero()||u.gt(s))&&(!n||1!==u.cmp(o))};ov.hashPersonalMessage=function(e){(0,fv.assertIsBuffer)(e);var t=Buffer.from("Ethereum Signed Message:\n".concat(e.length),"utf-8");return(0,cv.keccak)(Buffer.concat([t,e]))};var pv={},gv=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pv,"__esModule",{value:!0}),pv.defineProperties=void 0;var mv=gv(Ul),yv=wp,bv=Pd,vv=Ap;pv.defineProperties=function(e,t,r){if(e.raw=[],e._fields=[],e.toJSON=function(t){if(void 0===t&&(t=!1),t){var r={};return e._fields.forEach((function(t){r[t]="0x".concat(e[t].toString("hex"))})),r}return(0,vv.baToJSON)(e.raw)},e.serialize=function(){return bv.rlp.encode(e.raw)},t.forEach((function(t,r){function n(){return e.raw[r]}function i(n){"00"!==(n=(0,vv.toBuffer)(n)).toString("hex")||t.allowZero||(n=Buffer.allocUnsafe(0)),t.allowLess&&t.length?(n=(0,vv.unpadBuffer)(n),(0,mv.default)(t.length>=n.length,"The field ".concat(t.name," must not have more ").concat(t.length," bytes"))):t.allowZero&&0===n.length||!t.length||(0,mv.default)(t.length===n.length,"The field ".concat(t.name," must have byte length of ").concat(t.length)),e.raw[r]=n}e._fields.push(t.name),Object.defineProperty(e,t.name,{enumerable:!0,configurable:!0,get:n,set:i}),t.default&&(e[t.name]=t.default),t.alias&&Object.defineProperty(e,t.alias,{enumerable:!1,configurable:!0,set:i,get:n})})),r)if("string"==typeof r&&(r=Buffer.from((0,yv.stripHexPrefix)(r),"hex")),Buffer.isBuffer(r)&&(r=bv.rlp.decode(r)),Array.isArray(r)){if(r.length>e._fields.length)throw new Error("wrong number of fields in data");r.forEach((function(t,r){e[e._fields[r]]=(0,vv.toBuffer)(t)}))}else{if("object"!=typeof r)throw new Error("invalid data");var n=Object.keys(r);t.forEach((function(t){-1!==n.indexOf(t.name)&&(e[t.name]=r[t.name]),-1!==n.indexOf(t.alias)&&(e[t.alias]=r[t.alias])}))}},function(e){var t=r&&r.__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]}),n=r&&r.__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.isHexString=e.getKeys=e.fromAscii=e.fromUtf8=e.toAscii=e.arrayContainsArray=e.getBinarySize=e.padToEven=e.stripHexPrefix=e.isHexPrefixed=void 0,n(Id,e),n(Xd,e),n(Qb,e),n(xp,e),n(ov,e),n(Ap,e),n(pv,e),n(Pd,e),n(Yb,e);var i=wp;Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return i.isHexPrefixed}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return i.stripHexPrefix}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return i.padToEven}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return i.getBinarySize}}),Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return i.arrayContainsArray}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return i.toAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return i.fromUtf8}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return i.fromAscii}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return i.getKeys}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return i.isHexString}})}(Md);var wv={},_v={},Ev=lp.Buffer;var Av=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=n}var s=e.length,a=e.charAt(0),u=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return Ev.alloc(0);for(var r=0,n=0,i=0;e[r]===a;)n++,r++;for(var o=(e.length-r)*u+1>>>0,c=new Uint8Array(o);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var d=0,h=o-1;(0!==f||d<i)&&-1!==h;h--,d++)f+=s*c[h]>>>0,c[h]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,r++}for(var l=o-i;l!==o&&0===c[l];)l++;var p=Ev.allocUnsafe(n+(o-l));p.fill(0,0,n);for(var g=n;l!==o;)p[g++]=c[l++];return p}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=Ev.from(t)),!Ev.isBuffer(t))throw new TypeError("Expected Buffer");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 u=(o-i)*c+1>>>0,f=new Uint8Array(u);i!==o;){for(var d=t[i],h=0,l=u-1;(0!==d||h<n)&&-1!==l;l--,h++)d+=256*f[l]>>>0,f[l]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,i++}for(var p=u-n;p!==u&&0===f[p];)p++;for(var g=a.repeat(r);p<u;++p)g+=e.charAt(f[p]);return g},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+s+" character")}}},Sv=Av("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),kv=lp.Buffer,xv=$b;var Tv=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=e(t);return Sv.encode(kv.concat([t,r],t.length+4))},decode:function(e){var r=t(Sv.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=Sv.decodeUnsafe(e);if(r)return t(r)}}}((function(e){var t=xv("sha256").update(e).digest();return xv("sha256").update(t).digest()})),Rv={},Ov={};Object.defineProperty(Ov,"__esModule",{value:!0});var Mv=Po.ripemd160,Iv=Rp;Ov.ripemd160=Iv.createHashFunction((function(){return new Mv}));var Pv={};Object.defineProperty(Pv,"__esModule",{value:!0});var Cv=Wi,Nv=Rp;Pv.sha256=Nv.createHashFunction((function(){return new Cv}));var Bv=ri,jv=lp.Buffer,Lv=Hb,Uv=jv.alloc(128),Dv=64;function Fv(e,t){Lv.call(this,"digest"),"string"==typeof t&&(t=jv.from(t)),this._alg=e,this._key=t,t.length>Dv?t=e(t):t.length<Dv&&(t=jv.concat([t,Uv],Dv));for(var r=this._ipad=jv.allocUnsafe(Dv),n=this._opad=jv.allocUnsafe(Dv),i=0;i<Dv;i++)r[i]=54^t[i],n[i]=92^t[i];this._hash=[r]}Bv(Fv,Lv),Fv.prototype._update=function(e){this._hash.push(e)},Fv.prototype._final=function(){var e=this._alg(jv.concat(this._hash));return this._alg(jv.concat([this._opad,e]))};var qv=_m,zv=ri,Kv=Fv,Hv=Hb,Gv=lp.Buffer,Wv=function(e){return(new qv).update(e).digest()},Vv=Dm,Xv=Zy,Jv=Gv.alloc(128);function $v(e,t){Hv.call(this,"digest"),"string"==typeof t&&(t=Gv.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new Vv:Xv(e)).update(t).digest():t.length<r&&(t=Gv.concat([t,Jv],r));for(var n=this._ipad=Gv.allocUnsafe(r),i=this._opad=Gv.allocUnsafe(r),o=0;o<r;o++)n[o]=54^t[o],i[o]=92^t[o];this._hash="rmd160"===e?new Vv:Xv(e),this._hash.update(n)}zv($v,Hv),$v.prototype._update=function(e){this._hash.update(e)},$v.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new Vv:Xv(this._alg)).update(this._opad).update(e).digest()};Object.defineProperty(Rv,"__esModule",{value:!0});var Yv=Ov,Qv=Pv;Rv.createHmac=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new $v("rmd160",t):"md5"===e?new Kv(Wv,t):new $v(e,t)},Rv.randomBytes=bp;var Zv=function(){function e(e){this.hashFunction=e,this.buffers=[]}return e.prototype.update=function(e){if(!Buffer.isBuffer(e))throw new Error("hdkey-crypto shim is outdated");return this.buffers.push(e),this},e.prototype.digest=function(e){if(e)throw new Error("hdkey-crypto shim is outdated");return this.hashFunction(Buffer.concat(this.buffers))},e}();Rv.createHash=function(e){if("ripemd160"===e)return new Zv(Yv.ripemd160);if("sha256"===e)return new Zv(Qv.sha256);throw new Error("hdkey-crypto shim is outdated")};var ew={},tw={},rw=r&&r.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(tw,"__esModule",{value:!0});var nw=rw(cp);function iw(e){return e&&"object"==typeof e&&"default"in e?e.default:e}tw.privateKeyVerify=function(e){return nw.privateKeyVerify(e)},tw.publicKeyCreate=function(e,t){return void 0===t&&(t=!0),Buffer.from(nw.publicKeyCreate(e,t))},tw.publicKeyVerify=function(e){return nw.publicKeyVerify(e)},tw.publicKeyConvert=function(e,t){return void 0===t&&(t=!0),Buffer.from(nw.publicKeyConvert(e,t))},tw.privateKeyTweakAdd=function(e,t){return Buffer.from(nw.privateKeyTweakAdd(Buffer.from(e),t))},tw.publicKeyTweakAdd=function(e,t,r){return void 0===r&&(r=!0),Buffer.from(nw.publicKeyTweakAdd(Buffer.from(e),t,r))},tw.sign=function(e,t){var r=nw.ecdsaSign(e,t);return{signature:Buffer.from(r.signature),recovery:r.recid}},tw.verify=function(e,t,r){return nw.ecdsaVerify(t,e,r)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}(tw)}(ew);var ow=iw(Ul),sw=iw(lp),aw=iw(Tv),uw=Rv,cw=ew,fw=sw.Buffer,dw=fw.from("Bitcoin seed","utf8"),hw=2147483648,lw={private:76066276,public:76067358};function pw(e){this.versions=e||lw,this.depth=0,this.index=0,this._privateKey=null,this._publicKey=null,this.chainCode=null,this._fingerprint=0,this.parentFingerprint=0}function gw(e,t,r){var n=fw.allocUnsafe(78);n.writeUInt32BE(t,0),n.writeUInt8(e.depth,4);var i=e.depth?e.parentFingerprint:0;return n.writeUInt32BE(i,5),n.writeUInt32BE(e.index,9),e.chainCode.copy(n,13),r.copy(n,45),n}function mw(e){var t=uw.createHash("sha256").update(e).digest();return uw.createHash("ripemd160").update(t).digest()}Object.defineProperty(pw.prototype,"fingerprint",{get:function(){return this._fingerprint}}),Object.defineProperty(pw.prototype,"identifier",{get:function(){return this._identifier}}),Object.defineProperty(pw.prototype,"pubKeyHash",{get:function(){return this.identifier}}),Object.defineProperty(pw.prototype,"privateKey",{get:function(){return this._privateKey},set:function(e){ow.equal(e.length,32,"Private key must be 32 bytes."),ow(!0===cw.privateKeyVerify(e),"Invalid private key"),this._privateKey=e,this._publicKey=cw.publicKeyCreate(e,!0),this._identifier=mw(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0)}}),Object.defineProperty(pw.prototype,"publicKey",{get:function(){return this._publicKey},set:function(e){ow(33===e.length||65===e.length,"Public key must be 33 or 65 bytes."),ow(!0===cw.publicKeyVerify(e),"Invalid public key"),this._publicKey=cw.publicKeyConvert(e,!0),this._identifier=mw(this.publicKey),this._fingerprint=this._identifier.slice(0,4).readUInt32BE(0),this._privateKey=null}}),Object.defineProperty(pw.prototype,"privateExtendedKey",{get:function(){return this._privateKey?aw.encode(gw(this,this.versions.private,fw.concat([fw.alloc(1,0),this.privateKey]))):null}}),Object.defineProperty(pw.prototype,"publicExtendedKey",{get:function(){return aw.encode(gw(this,this.versions.public,this.publicKey))}}),pw.prototype.derive=function(e){if("m"===e||"M"===e||"m'"===e||"M'"===e)return this;var t=e.split("/"),r=this;return t.forEach((function(e,t){if(0!==t){var n=e.length>1&&"'"===e[e.length-1],i=parseInt(e,10);ow(i<hw,"Invalid index"),n&&(i+=hw),r=r.deriveChild(i)}else ow(/^[mM]{1}/.test(e),'Path must start with "m" or "M"')})),r},pw.prototype.deriveChild=function(e){var t,r=e>=hw,n=fw.allocUnsafe(4);if(n.writeUInt32BE(e,0),r){ow(this.privateKey,"Could not derive hardened child key");var i=this.privateKey,o=fw.alloc(1,0);i=fw.concat([o,i]),t=fw.concat([i,n])}else t=fw.concat([this.publicKey,n]);var s=uw.createHmac("sha512",this.chainCode).update(t).digest(),a=s.slice(0,32),u=s.slice(32),c=new pw(this.versions);if(this.privateKey)try{c.privateKey=cw.privateKeyTweakAdd(this.privateKey,a)}catch(t){return this.deriveChild(e+1)}else try{c.publicKey=cw.publicKeyTweakAdd(this.publicKey,a,!0)}catch(t){return this.deriveChild(e+1)}return c.chainCode=u,c.depth=this.depth+1,c.parentFingerprint=this.fingerprint,c.index=e,c},pw.prototype.sign=function(e){return cw.sign(e,this.privateKey).signature},pw.prototype.verify=function(e,t){return cw.verify(e,t,this.publicKey)},pw.prototype.wipePrivateData=function(){return this._privateKey&&uw.randomBytes(this._privateKey.length).copy(this._privateKey),this._privateKey=null,this},pw.prototype.toJSON=function(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}},pw.fromMasterSeed=function(e,t){var r=uw.createHmac("sha512",dw).update(e).digest(),n=r.slice(0,32),i=r.slice(32),o=new pw(t);return o.chainCode=i,o.privateKey=n,o},pw.fromExtendedKey=function(e,t){var r=new pw(t=t||lw),n=aw.decode(e),i=n.readUInt32BE(0);ow(i===t.private||i===t.public,"Version mismatch: does not match private or public"),r.depth=n.readUInt8(4),r.parentFingerprint=n.readUInt32BE(5),r.index=n.readUInt32BE(9),r.chainCode=n.slice(13,45);var o=n.slice(45);return 0===o.readUInt8(0)?(ow(i===t.private,"Version mismatch: version does not match private"),r.privateKey=o.slice(1)):(ow(i===t.public,"Version mismatch: version does not match public"),r.publicKey=o),r},pw.fromJSON=function(e){return pw.fromExtendedKey(e.xpriv)},pw.HARDENED_OFFSET=hw;var yw=pw;Object.defineProperty(_v,"__esModule",{value:!0});var bw,vw=yw;_v.HDKey=vw;var ww={},_w={};
|
|
12
|
+
/*! https://mths.be/utf8js v3.0.0 by @mathias */
|
|
13
|
+
!function(e){!function(e){var t,r,n,i=String.fromCharCode;function o(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function s(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function a(e,t){return i(e>>t&63|128)}function u(e){if(0==(4294967168&e))return i(e);var t="";return 0==(4294965248&e)?t=i(e>>6&31|192):0==(4294901760&e)?(s(e),t=i(e>>12&15|224),t+=a(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=a(e,12),t+=a(e,6)),t+=i(63&e|128)}function c(){if(n>=r)throw Error("Invalid byte index");var e=255&t[n];if(n++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function f(){var e,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|c())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&e)<<12|c()<<6|c())>=2048)return s(i),i;throw Error("Invalid continuation byte")}if(240==(248&e)&&(i=(7&e)<<18|c()<<12|c()<<6|c())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}e.version="3.0.0",e.encode=function(e){for(var t=o(e),r=t.length,n=-1,i="";++n<r;)i+=u(t[n]);return i},e.decode=function(e){t=o(e),r=t.length,n=0;for(var s,a=[];!1!==(s=f());)a.push(s);return function(e){for(var t,r=e.length,n=-1,o="";++n<r;)(t=e[n])>65535&&(o+=i((t-=65536)>>>10&1023|55296),t=56320|1023&t),o+=i(t);return o}(a)}}(e)}(_w);var Ew={exports:{}};
|
|
14
|
+
/*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */!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;t<e.length;t++)if(!r(e[t])||e[t]<0||e[t]>255)return!1;return!0}function i(e,t){if(e.buffer&&"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 s(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 a,u={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return i(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&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("")}},c=(a="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(a[(240&n)>>4]+a[15&n])}return t.join("")}}),f={16:10,24:12,32:14},d=[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],h=[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],l=[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],g=[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],m=[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],y=[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],b=[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],_=[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],E=[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],A=[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],S=[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 x(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var T=function(e){if(!(this instanceof T))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:i(e,!0)}),this._prepare()};T.prototype._prepare=function(){var e=f[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(e+1),i=this.key.length/4,o=x(this.key);for(t=0;t<i;t++)r=t>>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var s,a=0,u=i;u<n;){if(s=o[i-1],o[0]^=h[s>>16&255]<<24^h[s>>8&255]<<16^h[255&s]<<8^h[s>>24&255]^d[a]<<24,a+=1,8!=i)for(t=1;t<i;t++)o[t]^=o[t-1];else{for(t=1;t<i/2;t++)o[t]^=o[t-1];s=o[i/2-1],o[i/2]^=h[255&s]^h[s>>8&255]<<8^h[s>>16&255]<<16^h[s>>24&255]<<24;for(t=i/2+1;t<i;t++)o[t]^=o[t-1]}for(t=0;t<i&&u<n;)c=u>>2,l=u%4,this._Ke[c][l]=o[t],this._Kd[e-c][l]=o[t++],u++}for(var c=1;c<e;c++)for(var l=0;l<4;l++)s=this._Kd[c][l],this._Kd[c][l]=E[s>>24&255]^A[s>>16&255]^S[s>>8&255]^k[255&s]},T.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=x(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var s=1;s<t;s++){for(i=0;i<4;i++)r[i]=p[n[i]>>24&255]^g[n[(i+1)%4]>>16&255]^m[n[(i+2)%4]>>8&255]^y[255&n[(i+3)%4]]^this._Ke[s][i];n=r.slice()}var a,u=o(16);for(i=0;i<4;i++)a=this._Ke[t][i],u[4*i]=255&(h[n[i]>>24&255]^a>>24),u[4*i+1]=255&(h[n[(i+1)%4]>>16&255]^a>>16),u[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(h[255&n[(i+3)%4]]^a);return u},T.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=x(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var s=1;s<t;s++){for(i=0;i<4;i++)r[i]=b[n[i]>>24&255]^v[n[(i+3)%4]>>16&255]^w[n[(i+2)%4]>>8&255]^_[255&n[(i+1)%4]]^this._Kd[s][i];n=r.slice()}var a,u=o(16);for(i=0;i<4;i++)a=this._Kd[t][i],u[4*i]=255&(l[n[i]>>24&255]^a>>24),u[4*i+1]=255&(l[n[(i+3)%4]>>16&255]^a>>16),u[4*i+2]=255&(l[n[(i+2)%4]>>8&255]^a>>8),u[4*i+3]=255&(l[255&n[(i+1)%4]]^a);return u};var R=function(e){if(!(this instanceof R))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new T(e)};R.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<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.encrypt(r),t,n);return t},R.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.decrypt(r),t,n);return t};var O=function(e,t){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=o(16);this._lastCipherblock=i(t,!0),this._aes=new T(e)};O.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<e.length;n+=16){s(e,r,0,n,n+16);for(var a=0;a<16;a++)r[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,t,n)}return t},O.prototype.decrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),n=0;n<e.length;n+=16){s(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var a=0;a<16;a++)t[n+a]=r[a]^this._lastCipherblock[a];s(e,this._lastCipherblock,0,n,n+16)}return t};var M=function(e,t,r){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=o(16);r||(r=1),this.segmentSize=r,this._shiftRegister=i(t,!0),this._aes=new T(e)};M.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[n+o]^=t[o];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(r,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r},M.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t,r=i(e,!0),n=0;n<r.length;n+=this.segmentSize){t=this._aes.encrypt(this._shiftRegister);for(var o=0;o<this.segmentSize;o++)r[n+o]^=t[o];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,n,n+this.segmentSize)}return r};var I=function(e,t){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=o(16);this._lastPrecipher=i(t,!0),this._lastPrecipherIndex=16,this._aes=new T(e)};I.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},I.prototype.decrypt=I.prototype.encrypt;var P=function(e){if(!(this instanceof P))throw Error("Counter must be instanitated with `new`");0===e||e||(e=1),"number"==typeof e?(this._counter=o(16),this.setValue(e)):this.setBytes(e)};P.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},P.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},P.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var C=function(e,t){if(!(this instanceof C))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof P||(t=new P(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new T(e)};C.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},C.prototype.decrypt=C.prototype.encrypt;var N={AES:T,Counter:P,ModeOfOperation:{ecb:R,cbc:O,cfb:M,ofb:I,ctr:C},utils:{hex:c,utf8:u},padding:{pkcs7:{pad:function(e){var t=16-(e=i(e,!0)).length%16,r=o(e.length+t);s(e,r);for(var n=e.length;n<r.length;n++)r[n]=t;return r},strip:function(e){if((e=i(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(t>16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n<t;n++)if(e[r+n]!==t)throw new Error("PKCS#7 invalid padding byte");var a=o(r);return s(e,a,0,0,r),a}}},_arrayTest:{coerceArray:i,createArray:o,copyArray:s}};e.exports=N}()}(Ew);var Aw,Sw,kw=Ew.exports;function xw(){if(Aw)return ww;Aw=1;var e=r&&r.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),t=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=r&&r.__importStar||function(r){if(r&&r.__esModule)return r;var n={};if(null!=r)for(var i in r)"default"!==i&&Object.prototype.hasOwnProperty.call(r,i)&&e(n,r,i);return t(n,r),n},i=r&&r.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=r&&r.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},s=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ww,"__esModule",{value:!0}),ww.fromQuorumWallet=ww.fromKryptoKit=ww.fromEtherCamp=ww.fromEtherWallet=void 0;var a=n(Jc),u=Md,c=_a,f=s(r_()),d=_w,h=kw;var l={count:1,keysize:16,ivsize:16,digest:"md5"};function p(e,t,r){var n=function(e){return e?{count:e.count||l.count,keysize:e.keysize||l.keysize,ivsize:e.ivsize||l.ivsize,digest:e.digest||l.digest}:l}(r);function i(r){var i=a.createHash(n.digest);i.update(r),i.update(e),i.update(t),r=i.digest();for(var o=1,s=n.count;o<s;o++)(i=a.createHash(n.digest)).update(r),r=i.digest();return r}for(var o=[],s=0;Buffer.concat(o).length<n.keysize+n.ivsize;)o[s]=i(0===s?Buffer.alloc(0):o[s-1]),s++;var u=Buffer.concat(o);return{key:u.slice(0,n.keysize),iv:u.slice(n.keysize,n.keysize+n.ivsize)}}function g(e,t){var r,n="object"==typeof e?e:JSON.parse(e);if(n.locked){if("string"!=typeof t)throw new Error("Password required");if(t.length<7)throw new Error("Password must be at least 7 characters");var i=function(e){var t=Buffer.from(e,"base64");return"Salted__"===t.slice(0,8).toString()?{salt:t.slice(8,16),ciphertext:t.slice(16)}:{ciphertext:t}}(n.encrypted?n.private.slice(0,128):n.private);if(!i.salt)throw new Error("Unsupported EtherWallet key format");var o=p(Buffer.from(t),i.salt,{keysize:32,ivsize:16});r=function(e,t){return Buffer.concat([e.update(t),e.final()])}(a.createDecipheriv("aes-256-cbc",o.key,o.iv),Buffer.from(i.ciphertext)),r=Buffer.from(d.decode(r.toString()),"hex")}else{if(64!==n.private.length)throw new Error("Invalid private key length");r=Buffer.from(n.private,"hex")}var s=new f.default(r);if(s.getAddressString()!==n.address)throw new Error("Invalid private key or address");return s}function m(e){return new f.default((0,u.keccak256)(Buffer.from(e)))}function y(e,t){return i(this,void 0,void 0,(function(){var r,n,i,s,a,d,l;return o(this,(function(o){switch(o.label){case 0:return"#"===e[0]&&(e=e.slice(1)),r=e[0],e=e.slice(1),"d"!==r?[3,1]:(n=(0,u.sha256)((0,u.toBuffer)(e)),[3,4]);case 1:if("q"!==r)return[3,3];if("string"!=typeof t)throw new Error("Password required");return i=(0,u.sha256)(Buffer.from(e.slice(0,30))),s=e.slice(30,46),a=function(e){function t(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}for(var r="",n="",i=0;i<e.length;i++)e[i]<=127?(r+=t(n)+String.fromCharCode(e[i]),n=""):n+="%"+e[i].toString(16);return Buffer.from(r+t(n))}(i),[4,(0,c.scrypt)(Buffer.from(t,"utf8"),a,16384,8,1,32)];case 2:if(d=o.sent(),l=new h.ModeOfOperation.ecb(d),n=Buffer.concat([Buffer.from(l.decrypt(i.slice(0,16))),Buffer.from(l.decrypt(i.slice(16,32)))]),s.length>0&&s!==(0,u.sha256)((0,u.sha256)(n)).slice(0,8).toString("hex"))throw new Error("Failed to decrypt input - possibly invalid passphrase");return[3,4];case 3:throw new Error("Unsupported or invalid entropy type");case 4:return[2,new f.default(n)]}}))}))}function b(e,t){if(e.length<10)throw new Error("Passphrase must be at least 10 characters");if(t.length<10)throw new Error("User id must be at least 10 characters");var r=e+t,n=a.pbkdf2Sync(r,r,2e3,32,"sha256");return new f.default(n)}ww.fromEtherWallet=g,ww.fromEtherCamp=m,ww.fromKryptoKit=y,ww.fromQuorumWallet=b;var v={fromEtherWallet:g,fromEtherCamp:m,fromKryptoKit:y,fromQuorumWallet:b};return ww.default=v,ww}var Tw=new Uint8Array(16);function Rw(){if(!Sw&&!(Sw="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Sw(Tw)}var Ow=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Mw(e){return"string"==typeof e&&Ow.test(e)}for(var Iw,Pw,Cw=[],Nw=0;Nw<256;++Nw)Cw.push((Nw+256).toString(16).substr(1));function Bw(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Cw[e[t+0]]+Cw[e[t+1]]+Cw[e[t+2]]+Cw[e[t+3]]+"-"+Cw[e[t+4]]+Cw[e[t+5]]+"-"+Cw[e[t+6]]+Cw[e[t+7]]+"-"+Cw[e[t+8]]+Cw[e[t+9]]+"-"+Cw[e[t+10]]+Cw[e[t+11]]+Cw[e[t+12]]+Cw[e[t+13]]+Cw[e[t+14]]+Cw[e[t+15]]).toLowerCase();if(!Mw(r))throw TypeError("Stringified UUID is invalid");return r}var jw=0,Lw=0;function Uw(e){if(!Mw(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}function Dw(e,t,r){function n(e,n,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"==typeof n&&(n=Uw(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+e.length);if(s.set(n),s.set(e,n.length),(s=r(s))[6]=15&s[6]|t,s[8]=63&s[8]|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=s[a];return i}return Bw(s)}try{n.name=e}catch(e){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function Fw(e){return 14+(e+64>>>9<<4)+1}function qw(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function zw(e,t,r,n,i,o){return qw((s=qw(qw(t,e),qw(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function Kw(e,t,r,n,i,o,s){return zw(t&r|~t&n,e,t,i,o,s)}function Hw(e,t,r,n,i,o,s){return zw(t&n|r&~n,e,t,i,o,s)}function Gw(e,t,r,n,i,o,s){return zw(t^r^n,e,t,i,o,s)}function Ww(e,t,r,n,i,o,s){return zw(r^(t|~n),e,t,i,o,s)}var Vw=Dw("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var o=e[i>>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[Fw(t)-1]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var a=r,u=n,c=i,f=o;r=Kw(r,n,i,o,e[s],7,-680876936),o=Kw(o,r,n,i,e[s+1],12,-389564586),i=Kw(i,o,r,n,e[s+2],17,606105819),n=Kw(n,i,o,r,e[s+3],22,-1044525330),r=Kw(r,n,i,o,e[s+4],7,-176418897),o=Kw(o,r,n,i,e[s+5],12,1200080426),i=Kw(i,o,r,n,e[s+6],17,-1473231341),n=Kw(n,i,o,r,e[s+7],22,-45705983),r=Kw(r,n,i,o,e[s+8],7,1770035416),o=Kw(o,r,n,i,e[s+9],12,-1958414417),i=Kw(i,o,r,n,e[s+10],17,-42063),n=Kw(n,i,o,r,e[s+11],22,-1990404162),r=Kw(r,n,i,o,e[s+12],7,1804603682),o=Kw(o,r,n,i,e[s+13],12,-40341101),i=Kw(i,o,r,n,e[s+14],17,-1502002290),r=Hw(r,n=Kw(n,i,o,r,e[s+15],22,1236535329),i,o,e[s+1],5,-165796510),o=Hw(o,r,n,i,e[s+6],9,-1069501632),i=Hw(i,o,r,n,e[s+11],14,643717713),n=Hw(n,i,o,r,e[s],20,-373897302),r=Hw(r,n,i,o,e[s+5],5,-701558691),o=Hw(o,r,n,i,e[s+10],9,38016083),i=Hw(i,o,r,n,e[s+15],14,-660478335),n=Hw(n,i,o,r,e[s+4],20,-405537848),r=Hw(r,n,i,o,e[s+9],5,568446438),o=Hw(o,r,n,i,e[s+14],9,-1019803690),i=Hw(i,o,r,n,e[s+3],14,-187363961),n=Hw(n,i,o,r,e[s+8],20,1163531501),r=Hw(r,n,i,o,e[s+13],5,-1444681467),o=Hw(o,r,n,i,e[s+2],9,-51403784),i=Hw(i,o,r,n,e[s+7],14,1735328473),r=Gw(r,n=Hw(n,i,o,r,e[s+12],20,-1926607734),i,o,e[s+5],4,-378558),o=Gw(o,r,n,i,e[s+8],11,-2022574463),i=Gw(i,o,r,n,e[s+11],16,1839030562),n=Gw(n,i,o,r,e[s+14],23,-35309556),r=Gw(r,n,i,o,e[s+1],4,-1530992060),o=Gw(o,r,n,i,e[s+4],11,1272893353),i=Gw(i,o,r,n,e[s+7],16,-155497632),n=Gw(n,i,o,r,e[s+10],23,-1094730640),r=Gw(r,n,i,o,e[s+13],4,681279174),o=Gw(o,r,n,i,e[s],11,-358537222),i=Gw(i,o,r,n,e[s+3],16,-722521979),n=Gw(n,i,o,r,e[s+6],23,76029189),r=Gw(r,n,i,o,e[s+9],4,-640364487),o=Gw(o,r,n,i,e[s+12],11,-421815835),i=Gw(i,o,r,n,e[s+15],16,530742520),r=Ww(r,n=Gw(n,i,o,r,e[s+2],23,-995338651),i,o,e[s],6,-198630844),o=Ww(o,r,n,i,e[s+7],10,1126891415),i=Ww(i,o,r,n,e[s+14],15,-1416354905),n=Ww(n,i,o,r,e[s+5],21,-57434055),r=Ww(r,n,i,o,e[s+12],6,1700485571),o=Ww(o,r,n,i,e[s+3],10,-1894986606),i=Ww(i,o,r,n,e[s+10],15,-1051523),n=Ww(n,i,o,r,e[s+1],21,-2054922799),r=Ww(r,n,i,o,e[s+8],6,1873313359),o=Ww(o,r,n,i,e[s+15],10,-30611744),i=Ww(i,o,r,n,e[s+6],15,-1560198380),n=Ww(n,i,o,r,e[s+13],21,1309151649),r=Ww(r,n,i,o,e[s+4],6,-145523070),o=Ww(o,r,n,i,e[s+11],10,-1120210379),i=Ww(i,o,r,n,e[s+2],15,718787259),n=Ww(n,i,o,r,e[s+9],21,-343485551),r=qw(r,a),n=qw(n,u),i=qw(i,c),o=qw(o,f)}return[r,n,i,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(Fw(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))})),Xw=Vw;function Jw(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function $w(e,t){return e<<t|e>>>32-t}var Yw=Dw("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i<n.length;++i)e.push(n.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.length/4+2,s=Math.ceil(o/16),a=new Array(s),u=0;u<s;++u){for(var c=new Uint32Array(16),f=0;f<16;++f)c[f]=e[64*u+4*f]<<24|e[64*u+4*f+1]<<16|e[64*u+4*f+2]<<8|e[64*u+4*f+3];a[u]=c}a[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<s;++d){for(var h=new Uint32Array(80),l=0;l<16;++l)h[l]=a[d][l];for(var p=16;p<80;++p)h[p]=$w(h[p-3]^h[p-8]^h[p-14]^h[p-16],1);for(var g=r[0],m=r[1],y=r[2],b=r[3],v=r[4],w=0;w<80;++w){var _=Math.floor(w/20),E=$w(g,5)+Jw(_,m,y,b)+v+t[_]+h[w]>>>0;v=b,b=y,y=$w(m,30)>>>0,m=g,g=E}r[0]=r[0]+g>>>0,r[1]=r[1]+m>>>0,r[2]=r[2]+y>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),Qw=Yw;var Zw,e_=Object.freeze({__proto__:null,NIL:"00000000-0000-0000-0000-000000000000",parse:Uw,stringify:Bw,v1:function(e,t,r){var n=t&&r||0,i=t||new Array(16),o=(e=e||{}).node||Iw,s=void 0!==e.clockseq?e.clockseq:Pw;if(null==o||null==s){var a=e.random||(e.rng||Rw)();null==o&&(o=Iw=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=Pw=16383&(a[6]<<8|a[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:Lw+1,f=u-jw+(c-Lw)/1e4;if(f<0&&void 0===e.clockseq&&(s=s+1&16383),(f<0||u>jw)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");jw=u,Lw=c,Pw=s;var d=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[n++]=d>>>24&255,i[n++]=d>>>16&255,i[n++]=d>>>8&255,i[n++]=255&d;var h=u/4294967296*1e4&268435455;i[n++]=h>>>8&255,i[n++]=255&h,i[n++]=h>>>24&15|16,i[n++]=h>>>16&255,i[n++]=s>>>8|128,i[n++]=255&s;for(var l=0;l<6;++l)i[n+l]=o[l];return t||Bw(i)},v3:Xw,v4:function(e,t,r){var n=(e=e||{}).random||(e.rng||Rw)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return Bw(n)},v5:Qw,validate:Mw,version:function(e){if(!Mw(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}}),t_=i(e_);function r_(){return Zw||(Zw=1,function(e){var t=r&&r.__assign||function(){return t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=r&&r.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=r&&r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=r&&r.__importStar||function(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)&&n(t,e,r);return i(t,e),t},s=r&&r.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},a=r&&r.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.thirdparty=e.hdkey=void 0;var c=o(Jc),f=Md,d=_a,h=function(){if(bw)return wv;bw=1;var e=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wv,"__esModule",{value:!0});var t=e(r_()),n=_v,i=function(){function e(e){this._hdkey=e}return e.fromMasterSeed=function(t){return new e(n.HDKey.fromMasterSeed(t))},e.fromExtendedKey=function(t){return new e(n.HDKey.fromExtendedKey(t))},e.prototype.privateExtendedKey=function(){if(!this._hdkey.privateExtendedKey)throw new Error("This is a public key only wallet");return this._hdkey.privateExtendedKey},e.prototype.publicExtendedKey=function(){return this._hdkey.publicExtendedKey},e.prototype.derivePath=function(t){return new e(this._hdkey.derive(t))},e.prototype.deriveChild=function(t){return new e(this._hdkey.deriveChild(t))},e.prototype.getWallet=function(){return this._hdkey._privateKey?t.default.fromPrivateKey(this._hdkey._privateKey):t.default.fromPublicKey(this._hdkey._publicKey,!0)},e}();return wv.default=i,wv}();Object.defineProperty(e,"hdkey",{enumerable:!0,get:function(){return u(h).default}});var l=xw();Object.defineProperty(e,"thirdparty",{enumerable:!0,get:function(){return u(l).default}});var p=Tv,g=bp,m=t_.v4;function y(e,t,r){if(t.toLowerCase().startsWith("0x")&&(t=t.slice(2)),!t&&!r)return t;if(r%2)throw new Error("Invalid length argument, must be an even number");if("number"==typeof r&&t.length!==r)throw new Error("Invalid "+e+", string must be "+r+" hex characters");if(!/^([0-9a-f]{2})+$/i.test(t))throw new Error("Invalid "+e+", string must be "+("number"==typeof r?r:"empty or a non-zero even number of")+" hex characters");return t}function b(e,t,r){if(!Buffer.isBuffer(t))throw new Error("Invalid "+e+", must be a string ("+("number"==typeof r?""+2*r:"empty or a non-zero even number of")+" hex characters) or buffer"+("number"==typeof r?" ("+r+" bytes)":""));if("number"==typeof r&&t.length!==r)throw new Error("Invalid "+e+", buffer must be "+r+" bytes");return t}var v=function(){function e(e,t){if(void 0===t&&(t=void 0),this.privateKey=e,this.publicKey=t,e&&t)throw new Error("Cannot supply both a private and a public key to the constructor");if(e&&!(0,f.isValidPrivate)(e))throw new Error("Private key does not satisfy the curve requirements (ie. it is invalid)");if(t&&!(0,f.isValidPublic)(t))throw new Error("Invalid public key")}return e.generate=function(t){if(void 0===t&&(t=!1),!t)return new e(g(32));for(var r=new f.BN("088f924eeceeda7fe92e1f5b0fffffffffffffff",16);;){var n=g(32);if(new f.BN((0,f.privateToAddress)(n)).lte(r))return new e(n)}},e.generateVanityAddress=function(t){for(t instanceof RegExp||(t=new RegExp(t));;){var r=g(32),n=(0,f.privateToAddress)(r);if(t.test(n.toString("hex")))return new e(r)}},e.fromPublicKey=function(t,r){return void 0===r&&(r=!1),r&&(t=(0,f.importPublic)(t)),new e(void 0,t)},e.fromExtendedPublicKey=function(t){if("xpub"!==t.slice(0,4))throw new Error("Not an extended public key");var r=p.decode(t).slice(45);return e.fromPublicKey(r,!0)},e.fromPrivateKey=function(t){return new e(t)},e.fromExtendedPrivateKey=function(t){if("xprv"!==t.slice(0,4))throw new Error("Not an extended private key");var r=p.decode(t);if(0!==r[45])throw new Error("Invalid extended private key");return e.fromPrivateKey(r.slice(46))},e.fromV1=function(t,r){return s(this,void 0,void 0,(function(){var n,i,o,s,u;return a(this,(function(a){switch(a.label){case 0:if("1"!==(n="object"==typeof t?t:JSON.parse(t)).Version)throw new Error("Not a V1 Wallet");if("scrypt"!==n.Crypto.KeyHeader.Kdf)throw new Error("Unsupported key derivation scheme");return i=n.Crypto.KeyHeader.KdfParams,[4,(0,d.scrypt)(Buffer.from(r),Buffer.from(n.Crypto.Salt,"hex"),i.N,i.R,i.P,i.DkLen)];case 1:if(o=a.sent(),s=Buffer.from(n.Crypto.CipherText,"hex"),(0,f.keccak256)(Buffer.concat([o.slice(16,32),s])).toString("hex")!==n.Crypto.MAC)throw new Error("Key derivation failed - possibly wrong passphrase");return u=c.createDecipheriv("aes-128-cbc",(0,f.keccak256)(o.slice(0,16)).slice(0,16),Buffer.from(n.Crypto.IV,"hex")),[2,new e(w(u,s))]}}))}))},e.fromV3=function(t,r,n){return void 0===n&&(n=!1),s(this,void 0,void 0,(function(){var i,o,s,u,h;return a(this,(function(a){switch(a.label){case 0:if(3!==(i="object"==typeof t?t:JSON.parse(n?t.toLowerCase():t)).version)throw new Error("Not a V3 wallet");return"scrypt"!==i.crypto.kdf?[3,2]:(s=i.crypto.kdfparams,[4,(0,d.scrypt)(Buffer.from(r),Buffer.from(s.salt,"hex"),s.n,s.r,s.p,s.dklen)]);case 1:return o=a.sent(),[3,3];case 2:if("pbkdf2"!==i.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(s=i.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");o=c.pbkdf2Sync(Buffer.from(r),Buffer.from(s.salt,"hex"),s.c,s.dklen,"sha256"),a.label=3;case 3:if(u=Buffer.from(i.crypto.ciphertext,"hex"),(0,f.keccak256)(Buffer.concat([Buffer.from(o.slice(16,32)),u])).toString("hex")!==i.crypto.mac)throw new Error("Key derivation failed - possibly wrong passphrase");return h=c.createDecipheriv(i.crypto.cipher,o.slice(0,16),Buffer.from(i.crypto.cipherparams.iv,"hex")),[2,new e(w(h,u))]}}))}))},e.fromEthSale=function(t,r){var n="object"==typeof t?t:JSON.parse(t),i=Buffer.from(n.encseed,"hex"),o=c.pbkdf2Sync(r,r,2e3,32,"sha256").slice(0,16),s=w(c.createDecipheriv("aes-128-cbc",o,i.slice(0,16)),i.slice(16)),a=new e((0,f.keccak256)(s));if(a.getAddress().toString("hex")!==n.ethaddr)throw new Error("Decoded key mismatch - possibly wrong passphrase");return a},Object.defineProperty(e.prototype,"pubKey",{get:function(){return _(this.publicKey)||(this.publicKey=(0,f.privateToPublic)(this.privateKey)),this.publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"privKey",{get:function(){if(!_(this.privateKey))throw new Error("This is a public key only wallet");return this.privateKey},enumerable:!1,configurable:!0}),e.prototype.getPrivateKey=function(){return this.privKey},e.prototype.getPrivateKeyString=function(){return(0,f.bufferToHex)(this.privKey)},e.prototype.getPublicKey=function(){return this.pubKey},e.prototype.getPublicKeyString=function(){return(0,f.bufferToHex)(this.getPublicKey())},e.prototype.getAddress=function(){return(0,f.publicToAddress)(this.pubKey)},e.prototype.getAddressString=function(){return(0,f.bufferToHex)(this.getAddress())},e.prototype.getChecksumAddressString=function(){return(0,f.toChecksumAddress)(this.getAddressString())},e.prototype.toV3=function(e,r){return s(this,void 0,void 0,(function(){var n,i,o,s,u,h;return a(this,(function(a){switch(a.label){case 0:if(!_(this.privateKey))throw new Error("This is a public key only wallet");switch(l=r,p={cipher:"aes-128-ctr",kdf:"scrypt",salt:g(32),iv:g(16),uuid:g(16),dklen:32,c:262144,n:262144,r:8,p:1},n=l?("string"==typeof l.salt&&(l.salt=Buffer.from(y("salt",l.salt),"hex")),"string"==typeof l.iv&&(l.iv=Buffer.from(y("iv",l.iv,32),"hex")),"string"==typeof l.uuid&&(l.uuid=Buffer.from(y("uuid",l.uuid,32),"hex")),l.salt&&b("salt",l.salt),l.iv&&b("iv",l.iv,16),l.uuid&&b("uuid",l.uuid,16),t(t({},p),l)):p,n.kdf){case"pbkdf2":return[3,1];case"scrypt":return[3,2]}return[3,4];case 1:return i=function(e){return{dklen:e.dklen,salt:e.salt,c:e.c,prf:"hmac-sha256"}}(n),o=c.pbkdf2Sync(Buffer.from(e),i.salt,i.c,i.dklen,"sha256"),[3,5];case 2:return i=function(e){return{dklen:e.dklen,salt:e.salt,n:e.n,r:e.r,p:e.p}}(n),[4,(0,d.scrypt)(Buffer.from(e),i.salt,i.n,i.r,i.p,i.dklen)];case 3:return o=a.sent(),[3,5];case 4:throw new Error("Unsupported kdf");case 5:if(!(s=c.createCipheriv(n.cipher,o.slice(0,16),n.iv)))throw new Error("Unsupported cipher");return u=w(s,this.privKey),h=(0,f.keccak256)(Buffer.concat([Buffer.from(o.slice(16,32)),Buffer.from(u)])),[2,{version:3,id:m({random:n.uuid}),address:this.getAddress().toString("hex"),crypto:{ciphertext:u.toString("hex"),cipherparams:{iv:n.iv.toString("hex")},cipher:n.cipher,kdf:n.kdf,kdfparams:t(t({},i),{salt:i.salt.toString("hex")}),mac:h.toString("hex")}}]}var l,p}))}))},e.prototype.getV3Filename=function(e){return["UTC--",(e?new Date(e):new Date).toJSON().replace(/:/g,"-"),"--",this.getAddress().toString("hex")].join("")},e.prototype.toV3String=function(e,t){return s(this,void 0,void 0,(function(){var r,n;return a(this,(function(i){switch(i.label){case 0:return n=(r=JSON).stringify,[4,this.toV3(e,t)];case 1:return[2,n.apply(r,[i.sent()])]}}))}))},e}();function w(e,t){return Buffer.concat([e.update(t),e.final()])}function _(e){return null!=e}e.default=v}(Od)),Od}var n_=r_(),i_={exports:{}},o_=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},s_=o_,a_=Object.prototype.toString;function u_(e){return Array.isArray(e)}function c_(e){return void 0===e}function f_(e){return"[object ArrayBuffer]"===a_.call(e)}function d_(e){return null!==e&&"object"==typeof e}function h_(e){if("[object Object]"!==a_.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function l_(e){return"[object Function]"===a_.call(e)}function p_(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),u_(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var g_={isArray:u_,isArrayBuffer:f_,isBuffer:function(e){return null!==e&&!c_(e)&&null!==e.constructor&&!c_(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===a_.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&f_(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:d_,isPlainObject:h_,isUndefined:c_,isDate:function(e){return"[object Date]"===a_.call(e)},isFile:function(e){return"[object File]"===a_.call(e)},isBlob:function(e){return"[object Blob]"===a_.call(e)},isFunction:l_,isStream:function(e){return d_(e)&&l_(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===a_.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:p_,merge:function e(){var t={};function r(r,n){h_(t[n])&&h_(r)?t[n]=e(t[n],r):h_(r)?t[n]=e({},r):u_(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)p_(arguments[n],r);return t},extend:function(e,t,r){return p_(t,(function(t,n){e[n]=r&&"function"==typeof t?s_(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},m_=g_;function y_(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var b_=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(m_.isURLSearchParams(t))n=t.toString();else{var i=[];m_.forEach(t,(function(e,t){null!=e&&(m_.isArray(e)?t+="[]":e=[e],m_.forEach(e,(function(e){m_.isDate(e)?e=e.toISOString():m_.isObject(e)&&(e=JSON.stringify(e)),i.push(y_(t)+"="+y_(e))})))})),n=i.join("&")}if(n){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},v_=g_;function w_(){this.handlers=[]}w_.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},w_.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},w_.prototype.forEach=function(e){v_.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var __,E_,A_,S_,k_,x_,T_,R_,O_,M_,I_,P_,C_,N_,B_,j_,L_,U_,D_,F_,q_=w_,z_=g_,K_=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},H_={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function G_(){if(E_)return __;E_=1;var e=K_;return __=function(t,r,n,i,o){var s=new Error(t);return e(s,r,n,i,o)},__}function W_(){if(P_)return I_;P_=1;var e=R_?T_:(R_=1,T_=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),t=M_?O_:(M_=1,O_=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e});return I_=function(r,n){return r&&!e(n)?t(r,n):n}}function V_(){if(U_)return L_;function e(e){this.message=e}return U_=1,e.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},e.prototype.__CANCEL__=!0,L_=e}function X_(){if(F_)return D_;F_=1;var e=g_,t=function(){if(S_)return A_;S_=1;var e=G_();return A_=function(t,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(e("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}}(),r=function(){if(x_)return k_;x_=1;var e=g_;return k_=e.isStandardBrowserEnv()?{write:function(t,r,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(r)),e.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),e.isString(i)&&a.push("path="+i),e.isString(o)&&a.push("domain="+o),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},k_}(),n=b_,i=W_(),o=function(){if(N_)return C_;N_=1;var e=g_,t=["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"];return C_=function(r){var n,i,o,s={};return r?(e.forEach(r.split("\n"),(function(r){if(o=r.indexOf(":"),n=e.trim(r.substr(0,o)).toLowerCase(),i=e.trim(r.substr(o+1)),n){if(s[n]&&t.indexOf(n)>=0)return;s[n]="set-cookie"===n?(s[n]?s[n]:[]).concat([i]):s[n]?s[n]+", "+i:i}})),s):s},C_}(),s=function(){if(j_)return B_;j_=1;var e=g_;return B_=e.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var t=e;return r&&(n.setAttribute("href",t),t=n.href),n.setAttribute("href",t),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(r){var n=e.isString(r)?i(r):r;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}}(),a=G_(),u=H_,c=V_();return D_=function(f){return new Promise((function(d,h){var l,p=f.data,g=f.headers,m=f.responseType;function y(){f.cancelToken&&f.cancelToken.unsubscribe(l),f.signal&&f.signal.removeEventListener("abort",l)}e.isFormData(p)&&delete g["Content-Type"];var b=new XMLHttpRequest;if(f.auth){var v=f.auth.username||"",w=f.auth.password?unescape(encodeURIComponent(f.auth.password)):"";g.Authorization="Basic "+btoa(v+":"+w)}var _=i(f.baseURL,f.url);function E(){if(b){var e="getAllResponseHeaders"in b?o(b.getAllResponseHeaders()):null,r={data:m&&"text"!==m&&"json"!==m?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:e,config:f,request:b};t((function(e){d(e),y()}),(function(e){h(e),y()}),r),b=null}}if(b.open(f.method.toUpperCase(),n(_,f.params,f.paramsSerializer),!0),b.timeout=f.timeout,"onloadend"in b?b.onloadend=E:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(E)},b.onabort=function(){b&&(h(a("Request aborted",f,"ECONNABORTED",b)),b=null)},b.onerror=function(){h(a("Network Error",f,null,b)),b=null},b.ontimeout=function(){var e=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded",t=f.transitional||u;f.timeoutErrorMessage&&(e=f.timeoutErrorMessage),h(a(e,f,t.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",b)),b=null},e.isStandardBrowserEnv()){var A=(f.withCredentials||s(_))&&f.xsrfCookieName?r.read(f.xsrfCookieName):void 0;A&&(g[f.xsrfHeaderName]=A)}"setRequestHeader"in b&&e.forEach(g,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete g[t]:b.setRequestHeader(t,e)})),e.isUndefined(f.withCredentials)||(b.withCredentials=!!f.withCredentials),m&&"json"!==m&&(b.responseType=f.responseType),"function"==typeof f.onDownloadProgress&&b.addEventListener("progress",f.onDownloadProgress),"function"==typeof f.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",f.onUploadProgress),(f.cancelToken||f.signal)&&(l=function(e){b&&(h(!e||e&&e.type?new c("canceled"):e),b.abort(),b=null)},f.cancelToken&&f.cancelToken.subscribe(l),f.signal&&(f.signal.aborted?l():f.signal.addEventListener("abort",l))),p||(p=null),b.send(p)}))},D_}var J_=g_,$_=function(e,t){z_.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},Y_=K_,Q_={"Content-Type":"application/x-www-form-urlencoded"};function Z_(e,t){!J_.isUndefined(e)&&J_.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var eE,tE={transitional:H_,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(eE=X_()),eE),transformRequest:[function(e,t){return $_(t,"Accept"),$_(t,"Content-Type"),J_.isFormData(e)||J_.isArrayBuffer(e)||J_.isBuffer(e)||J_.isStream(e)||J_.isFile(e)||J_.isBlob(e)?e:J_.isArrayBufferView(e)?e.buffer:J_.isURLSearchParams(e)?(Z_(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J_.isObject(e)||t&&"application/json"===t["Content-Type"]?(Z_(t,"application/json"),function(e,t,r){if(J_.isString(e))try{return(t||JSON.parse)(e),J_.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||tE.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&J_.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Y_(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};J_.forEach(["delete","get","head"],(function(e){tE.headers[e]={}})),J_.forEach(["post","put","patch"],(function(e){tE.headers[e]=J_.merge(Q_)}));var rE,nE,iE=tE,oE=g_,sE=iE;function aE(){return nE?rE:(nE=1,rE=function(e){return!(!e||!e.__CANCEL__)})}var uE=g_,cE=function(e,t,r){var n=this||sE;return oE.forEach(r,(function(r){e=r.call(n,e,t)})),e},fE=aE(),dE=iE,hE=V_();function lE(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new hE("canceled")}var pE,gE,mE=g_,yE=function(e,t){t=t||{};var r={};function n(e,t){return mE.isPlainObject(e)&&mE.isPlainObject(t)?mE.merge(e,t):mE.isPlainObject(t)?mE.merge({},t):mE.isArray(t)?t.slice():t}function i(r){return mE.isUndefined(t[r])?mE.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!mE.isUndefined(t[e]))return n(void 0,t[e])}function s(r){return mE.isUndefined(t[r])?mE.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function a(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return mE.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||i,n=t(e);mE.isUndefined(n)&&t!==a||(r[e]=n)})),r};function bE(){return gE?pE:(gE=1,pE={version:"0.26.1"})}var vE=bE().version,wE={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){wE[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var _E={};wE.transitional=function(e,t,r){function n(e,t){return"[Axios v"+vE+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,o){if(!1===e)throw new Error(n(i," has been removed"+(t?" in "+t:"")));return t&&!_E[i]&&(_E[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 EE,AE,SE,kE,xE,TE,RE={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),i=n.length;i-- >0;){var o=n[i],s=t[o];if(s){var a=e[o],u=void 0===a||s(a,o,e);if(!0!==u)throw new TypeError("option "+o+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:wE},OE=g_,ME=b_,IE=q_,PE=function(e){return lE(e),e.headers=e.headers||{},e.data=cE.call(e,e.data,e.headers,e.transformRequest),e.headers=uE.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),uE.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||dE.adapter)(e).then((function(t){return lE(e),t.data=cE.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return fE(t)||(lE(e),t&&t.response&&(t.response.data=cE.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},CE=yE,NE=RE,BE=NE.validators;function jE(e){this.defaults=e,this.interceptors={request:new IE,response:new IE}}jE.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=CE(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&NE.assertOptions(r,{silentJSONParsing:BE.transitional(BE.boolean),forcedJSONParsing:BE.transitional(BE.boolean),clarifyTimeoutError:BE.transitional(BE.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,s=[];if(this.interceptors.response.forEach((function(e){s.push(e.fulfilled,e.rejected)})),!i){var a=[PE,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(t);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=t;n.length;){var c=n.shift(),f=n.shift();try{u=c(u)}catch(e){f(e);break}}try{o=PE(u)}catch(e){return Promise.reject(e)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},jE.prototype.getUri=function(e){return e=CE(this.defaults,e),ME(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},OE.forEach(["delete","get","head","options"],(function(e){jE.prototype[e]=function(t,r){return this.request(CE(r||{},{method:e,url:t,data:(r||{}).data}))}})),OE.forEach(["post","put","patch"],(function(e){jE.prototype[e]=function(t,r,n){return this.request(CE(n||{},{method:e,url:t,data:r}))}}));var LE=g_,UE=o_,DE=jE,FE=yE;var qE=function e(t){var r=new DE(t),n=UE(DE.prototype.request,r);return LE.extend(n,DE.prototype,r),LE.extend(n,r),n.create=function(r){return e(FE(t,r))},n}(iE);qE.Axios=DE,qE.Cancel=V_(),qE.CancelToken=function(){if(AE)return EE;AE=1;var e=V_();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(e){r=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(t){n.reason||(n.reason=new e(t),r(n.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},t.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},t.source=function(){var e,r=new t((function(t){e=t}));return{token:r,cancel:e}},EE=t}(),qE.isCancel=aE(),qE.VERSION=bE().version,qE.all=function(e){return Promise.all(e)},qE.spread=kE?SE:(kE=1,SE=function(e){return function(t){return e.apply(null,t)}}),qE.isAxiosError=function(){if(TE)return xE;TE=1;var e=g_;return xE=function(t){return e.isObject(t)&&!0===t.isAxiosError}}(),i_.exports=qE,i_.exports.default=qE;var zE=n(i_.exports);
|
|
15
|
+
/**
|
|
16
|
+
* @license
|
|
17
|
+
* author: Immutable
|
|
18
|
+
* core-sdk.js v1.1.0
|
|
19
|
+
* Released under the Apache-2.0 license.
|
|
20
|
+
*/
|
|
21
|
+
function KE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HE(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function GE(e,t,r){return t&&HE(e.prototype,t),r&&HE(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function WE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var VE=[{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:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",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:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],XE=function(){function e(){KE(this,e)}return GE(e,null,[{key:"createInterface",value:function(){return new Fn(VE)}},{key:"connect",value:function(e,t){return new ga(e,VE,t)}}]),e}();WE(XE,"abi",VE);var JE=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"operator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"_approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"}],$E=function(){function e(){KE(this,e)}return GE(e,null,[{key:"createInterface",value:function(){return new Fn(JE)}},{key:"connect",value:function(e,t){return new ga(e,JE,t)}}]),e}();WE($E,"abi",JE);var YE=[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];WE(function(){function e(){KE(this,e)}return GE(e,null,[{key:"createInterface",value:function(){return new Fn(YE)}},{key:"connect",value:function(e,t){return new ga(e,YE,t)}}]),e}(),"abi",YE);var QE=[{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"depositorEthKey",type:"address"},{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogDepositCancel",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogDepositCancelReclaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogDepositNftCancelReclaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"}],name:"LogFullWithdrawalRequest",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogMintWithdrawalPerformed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogMintableWithdrawalAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"depositorEthKey",type:"address"},{indexed:!1,internalType:"uint256",name:"starkKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogNftDeposit",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"}],name:"LogNftWithdrawalAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"},{indexed:!1,internalType:"address",name:"recipient",type:"address"}],name:"LogNftWithdrawalPerformed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"sequenceNumber",type:"uint256"},{indexed:!1,internalType:"uint256",name:"batchId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultRoot",type:"uint256"},{indexed:!1,internalType:"uint256",name:"orderRoot",type:"uint256"}],name:"LogRootUpdate",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"stateTransitionFact",type:"bytes32"}],name:"LogStateTransitionFact",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ethKey",type:"address"},{indexed:!1,internalType:"uint256",name:"assetId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"vaultId",type:"uint256"},{indexed:!1,internalType:"int256",name:"quantizedAmountChange",type:"int256"}],name:"LogVaultBalanceChangeApplied",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"LogWithdrawalAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"ownerKey",type:"uint256"},{indexed:!1,internalType:"uint256",name:"assetType",type:"uint256"},{indexed:!1,internalType:"uint256",name:"nonQuantizedAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"quantizedAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"recipient",type:"address"}],name:"LogWithdrawalPerformed",type:"event"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"announceAvailabilityVerifierRemovalIntent",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"announceVerifierRemovalIntent",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"depositCancel",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"depositERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"depositEth",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"depositNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"depositNftReclaim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"depositReclaim",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"escape",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"freezeRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"fullWithdrawalRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"assetType",type:"uint256"}],name:"getAssetInfo",outputs:[{internalType:"bytes",name:"assetInfo",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getCancellationRequest",outputs:[{internalType:"uint256",name:"request",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getDepositBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"}],name:"getEthKey",outputs:[{internalType:"address",name:"ethKey",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getFullWithdrawalRequest",outputs:[{internalType:"uint256",name:"res",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastBatchId",outputs:[{internalType:"uint256",name:"batchId",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOrderRoot",outputs:[{internalType:"uint256",name:"root",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getOrderTreeHeight",outputs:[{internalType:"uint256",name:"height",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"getQuantizedDepositBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"presumedAssetType",type:"uint256"}],name:"getQuantum",outputs:[{internalType:"uint256",name:"quantum",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getRegisteredAvailabilityVerifiers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getRegisteredVerifiers",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"getSequenceNumber",outputs:[{internalType:"uint256",name:"seq",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVaultRoot",outputs:[{internalType:"uint256",name:"root",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVaultTreeHeight",outputs:[{internalType:"uint256",name:"height",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetId",type:"uint256"}],name:"getWithdrawalBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isAvailabilityVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isFrozen",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isOperator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isTokenAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isUserAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"mainAcceptGovernance",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"mainCancelNomination",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"mainIsGovernor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"mainNominateNewGovernor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"mainRemoveGovernor",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"quantizedAmount",type:"uint256"}],name:"registerAndDepositERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"}],name:"registerAndDepositEth",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"string",name:"",type:"string"}],name:"registerAvailabilityVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"registerOperator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"registerToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"registerTokenAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"registerUser",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"registerUserAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"string",name:"",type:"string"}],name:"registerVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"removeAvailabilityVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"removeVerifier",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unFreeze",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"unregisterOperator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"unregisterTokenAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"unregisterUserAdmin",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256[]",name:"publicInput",type:"uint256[]"},{internalType:"uint256[]",name:"applicationData",type:"uint256[]"}],name:"updateState",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"bytes",name:"mintingBlob",type:"bytes"}],name:"withdrawAndMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"ownerKey",type:"uint256"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"withdrawNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"withdrawNftTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"}],ZE=function(){function e(){KE(this,e)}return GE(e,null,[{key:"createInterface",value:function(){return new Fn(QE)}},{key:"connect",value:function(e,t){return new ga(e,QE,t)}}]),e}();function eA(e){return eA=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},eA(e)}function tA(){return tA="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=eA(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},tA.apply(this,arguments)}function rA(e,t){return rA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},rA(e,t)}function nA(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rA(e,t)}function iA(e){return iA="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},iA(e)}function oA(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sA(e,t){if(t&&("object"===iA(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return oA(e)}WE(ZE,"abi",QE);var aA=[{inputs:[{internalType:"contract Core",name:"_imx",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"imx",outputs:[{internalType:"contract Core",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"starkKey",type:"uint256"}],name:"isRegistered",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"vaultId",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"registerAndDepositNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"}],name:"registerAndWithdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"registerAndWithdrawNft",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"registerAndWithdrawNftTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"address",name:"recipient",type:"address"}],name:"registerAndWithdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ethKey",type:"address"},{internalType:"uint256",name:"starkKey",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"},{internalType:"uint256",name:"assetType",type:"uint256"},{internalType:"bytes",name:"mintingBlob",type:"bytes"}],name:"regsiterAndWithdrawAndMint",outputs:[],stateMutability:"nonpayable",type:"function"}],uA="0x60806040523480156200001157600080fd5b5060405162001313380380620013138339818101604052810190620000379190620000fc565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506200012e565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620000b08262000083565b9050919050565b6000620000c482620000a3565b9050919050565b620000d681620000b7565b8114620000e257600080fd5b50565b600081519050620000f681620000cb565b92915050565b6000602082840312156200011557620001146200007e565b5b60006200012584828501620000e5565b91505092915050565b6111d5806200013e6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80634280d50a1161005b5780634280d50a146100ff5780634627d5981461011b578063579a698814610137578063ea864adf1461016757610088565b80630a9c3beb1461008d5780630f08025f146100a95780631259cc6c146100c7578063352eb84c146100e3575b600080fd5b6100a760048036038101906100a29190610a72565b610183565b005b6100b16102ae565b6040516100be9190610b8d565b60405180910390f35b6100e160048036038101906100dc9190610ba8565b6102d2565b005b6100fd60048036038101906100f89190610c57565b6103fd565b005b61011960048036038101906101149190610cf1565b610525565b005b61013560048036038101906101309190610da0565b610650565b005b610151600480360381019061014c9190610e3a565b610778565b60405161015e9190610e82565b60405180910390f35b610181600480360381019061017c9190610e9d565b61084a565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4888888886040518563ffffffff1660e01b81526004016101e29493929190610fa1565b600060405180830381600087803b1580156101fc57600080fd5b505af1158015610210573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d91443b7878585856040518563ffffffff1660e01b81526004016102739493929190610fe1565b600060405180830381600087803b15801561028d57600080fd5b505af11580156102a1573d6000803e3d6000fd5b5050505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4888888886040518563ffffffff1660e01b81526004016103319493929190610fa1565b600060405180830381600087803b15801561034b57600080fd5b505af115801561035f573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ebef0fd0878585856040518563ffffffff1660e01b81526004016103c29493929190611021565b600060405180830381600087803b1580156103dc57600080fd5b505af11580156103f0573d6000803e3d6000fd5b5050505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4878787876040518563ffffffff1660e01b815260040161045c9493929190610fa1565b600060405180830381600087803b15801561047657600080fd5b505af115801561048a573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663019b417a8684846040518463ffffffff1660e01b81526004016104eb93929190611066565b600060405180830381600087803b15801561050557600080fd5b505af1158015610519573d6000803e3d6000fd5b50505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4888888886040518563ffffffff1660e01b81526004016105849493929190610fa1565b600060405180830381600087803b15801561059e57600080fd5b505af11580156105b2573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae1cdde6878585856040518563ffffffff1660e01b8152600401610615949392919061109d565b600060405180830381600087803b15801561062f57600080fd5b505af1158015610643573d6000803e3d6000fd5b5050505050505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4878787876040518563ffffffff1660e01b81526004016106af9493929190610fa1565b600060405180830381600087803b1580156106c957600080fd5b505af11580156106dd573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166314cd70e48684846040518463ffffffff1660e01b815260040161073e939291906110e2565b600060405180830381600087803b15801561075857600080fd5b505af115801561076c573d6000803e3d6000fd5b50505050505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631dbd1da7846040518263ffffffff1660e01b81526004016107ea9190611119565b602060405180830381865afa158015610807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082b9190611149565b73ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd2414d4868686866040518563ffffffff1660e01b81526004016108a99493929190610fa1565b600060405180830381600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663441a3e7085836040518363ffffffff1660e01b8152600401610936929190611176565b600060405180830381600087803b15801561095057600080fd5b505af1158015610964573d6000803e3d6000fd5b505050505050505050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006109a482610979565b9050919050565b6109b481610999565b81146109bf57600080fd5b50565b6000813590506109d1816109ab565b92915050565b6000819050919050565b6109ea816109d7565b81146109f557600080fd5b50565b600081359050610a07816109e1565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112610a3257610a31610a0d565b5b8235905067ffffffffffffffff811115610a4f57610a4e610a12565b5b602083019150836001820283011115610a6b57610a6a610a17565b5b9250929050565b600080600080600080600060a0888a031215610a9157610a9061096f565b5b6000610a9f8a828b016109c2565b9750506020610ab08a828b016109f8565b965050604088013567ffffffffffffffff811115610ad157610ad0610974565b5b610add8a828b01610a1c565b95509550506060610af08a828b016109f8565b935050608088013567ffffffffffffffff811115610b1157610b10610974565b5b610b1d8a828b01610a1c565b925092505092959891949750929550565b6000819050919050565b6000610b53610b4e610b4984610979565b610b2e565b610979565b9050919050565b6000610b6582610b38565b9050919050565b6000610b7782610b5a565b9050919050565b610b8781610b6c565b82525050565b6000602082019050610ba26000830184610b7e565b92915050565b600080600080600080600060c0888a031215610bc757610bc661096f565b5b6000610bd58a828b016109c2565b9750506020610be68a828b016109f8565b965050604088013567ffffffffffffffff811115610c0757610c06610974565b5b610c138a828b01610a1c565b95509550506060610c268a828b016109f8565b9350506080610c378a828b016109f8565b92505060a0610c488a828b016109c2565b91505092959891949750929550565b60008060008060008060a08789031215610c7457610c7361096f565b5b6000610c8289828a016109c2565b9650506020610c9389828a016109f8565b955050604087013567ffffffffffffffff811115610cb457610cb3610974565b5b610cc089828a01610a1c565b94509450506060610cd389828a016109f8565b9250506080610ce489828a016109f8565b9150509295509295509295565b600080600080600080600060c0888a031215610d1057610d0f61096f565b5b6000610d1e8a828b016109c2565b9750506020610d2f8a828b016109f8565b965050604088013567ffffffffffffffff811115610d5057610d4f610974565b5b610d5c8a828b01610a1c565b95509550506060610d6f8a828b016109f8565b9350506080610d808a828b016109f8565b92505060a0610d918a828b016109f8565b91505092959891949750929550565b60008060008060008060a08789031215610dbd57610dbc61096f565b5b6000610dcb89828a016109c2565b9650506020610ddc89828a016109f8565b955050604087013567ffffffffffffffff811115610dfd57610dfc610974565b5b610e0989828a01610a1c565b94509450506060610e1c89828a016109f8565b9250506080610e2d89828a016109c2565b9150509295509295509295565b600060208284031215610e5057610e4f61096f565b5b6000610e5e848285016109f8565b91505092915050565b60008115159050919050565b610e7c81610e67565b82525050565b6000602082019050610e976000830184610e73565b92915050565b600080600080600060808688031215610eb957610eb861096f565b5b6000610ec7888289016109c2565b9550506020610ed8888289016109f8565b945050604086013567ffffffffffffffff811115610ef957610ef8610974565b5b610f0588828901610a1c565b93509350506060610f18888289016109f8565b9150509295509295909350565b610f2e81610999565b82525050565b610f3d816109d7565b82525050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b6000610f808385610f43565b9350610f8d838584610f54565b610f9683610f63565b840190509392505050565b6000606082019050610fb66000830187610f25565b610fc36020830186610f34565b8181036040830152610fd6818486610f74565b905095945050505050565b6000606082019050610ff66000830187610f34565b6110036020830186610f34565b8181036040830152611016818486610f74565b905095945050505050565b60006080820190506110366000830187610f34565b6110436020830186610f34565b6110506040830185610f34565b61105d6060830184610f25565b95945050505050565b600060608201905061107b6000830186610f34565b6110886020830185610f34565b6110956040830184610f34565b949350505050565b60006080820190506110b26000830187610f34565b6110bf6020830186610f34565b6110cc6040830185610f34565b6110d96060830184610f34565b95945050505050565b60006060820190506110f76000830186610f34565b6111046020830185610f34565b6111116040830184610f25565b949350505050565b600060208201905061112e6000830184610f34565b92915050565b600081519050611143816109ab565b92915050565b60006020828403121561115f5761115e61096f565b5b600061116d84828501611134565b91505092915050565b600060408201905061118b6000830185610f34565b6111986020830184610f34565b939250505056fea264697066735822122032218b31f9c0e88bb1991ae2275255c3d0cb01b4bf63a689bcaeccdcc791192c64736f6c634300080b0033",cA=function(e){nA(r,ma);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){KE(this,r);for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return sA(function(e){return e.length>1}(n)?t.call.apply(t,[this].concat(n)):t.call(this,aA,uA,n[0]))}return GE(r,[{key:"deploy",value:function(e,t){return tA(eA(r.prototype),"deploy",this).call(this,e,t||{})}},{key:"getDeployTransaction",value:function(e,t){return tA(eA(r.prototype),"getDeployTransaction",this).call(this,e,t||{})}},{key:"attach",value:function(e){return tA(eA(r.prototype),"attach",this).call(this,e)}},{key:"connect",value:function(e){return tA(eA(r.prototype),"connect",this).call(this,e)}}],[{key:"createInterface",value:function(){return new Fn(aA)}},{key:"connect",value:function(e,t){return new ga(e,aA,t)}}]),r}();WE(cA,"bytecode",uA),WE(cA,"abi",aA);var fA=Object.freeze({__proto__:null,Core:ZE,Registration:cA,IERC20:XE,IERC721:$E});function dA(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function hA(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){dA(o,n,i,s,a,"next",e)}function a(e){dA(o,n,i,s,a,"throw",e)}s(void 0)}))}}var lA="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},pA={exports:{}},gA={exports:{}};!function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(gA),function(e){var t=gA.exports.default;function r(){
|
|
22
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
23
|
+
e.exports=r=function(){return n},e.exports.__esModule=!0,e.exports.default=e.exports;var n={},i=Object.prototype,o=i.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var i=t&&t.prototype instanceof p?t:p,o=Object.create(i.prototype),s=new x(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var s=r.delegate;if(s){var a=A(s,r);if(a){if(a===l)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,s),o}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=d;var l={};function p(){}function g(){}function m(){}var y={};f(y,a,(function(){return this}));var b=Object.getPrototypeOf,v=b&&b(b(T([])));v&&v!==i&&o.call(v,a)&&(y=v);var w=m.prototype=p.prototype=Object.create(y);function _(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,r){function n(i,s,a,u){var c=h(e[i],e,s);if("throw"!==c.type){var f=c.arg,d=f.value;return d&&"object"==t(d)&&o.call(d,"__await")?r.resolve(d.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):r.resolve(d).then((function(e){f.value=e,a(f)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;this._invoke=function(e,t){function o(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(o,o):o()}}function A(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=h(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function T(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(o.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:R}}function R(){return{value:void 0,done:!0}}return g.prototype=m,f(w,"constructor",m),f(m,"constructor",g),g.displayName=f(m,c,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,f(e,c,"GeneratorFunction")),e.prototype=Object.create(w),e},n.awrap=function(e){return{__await:e}},_(E.prototype),f(E.prototype,u,(function(){return this})),n.AsyncIterator=E,n.async=function(e,t,r,i,o){void 0===o&&(o=Promise);var s=new E(d(e,t,r,i),o);return n.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},_(w),f(w,c,"Generator"),f(w,a,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},n.values=T,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(a&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},n}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(pA);var mA=pA.exports(),yA=mA;try{regeneratorRuntime=mA}catch(tR){"object"==typeof globalThis?globalThis.regeneratorRuntime=mA:Function("r","regeneratorRuntime = r")(mA)}function bA(e){var t;return Lc(Cc(e.r.toString(16),64)+Cc(e.s.toString(16),64)+Cc((null===(t=e.recoveryParam)||void 0===t?void 0:t.toString(16))||"",2))}function vA(e){return e.trim()?-1!==new ue(e,16).cmp(new ue(27))?new ue(e,16).sub(new ue(27)).toNumber():new ue(e,16).toNumber():void 0}function wA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;return e=Bc(e),{r:new ue(e.substring(0,t),"hex"),s:new ue(e.substring(t,2*t),"hex"),recoveryParam:vA(e.substring(2*t,2*t+2))}}function _A(e,t){return EA.apply(this,arguments)}function EA(){return(EA=hA(yA.mark((function e(t,r){var n;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=wA,e.next=3,r.signMessage(t);case 3:return e.t1=e.sent,n=(0,e.t0)(e.t1),e.abrupt("return",bA(n));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AA(e){return SA.apply(this,arguments)}function SA(){return(SA=hA(yA.mark((function e(t){var r,n;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Math.floor(Date.now()/1e3).toString(),e.next=3,_A(r,t);case 3:return n=e.sent,e.abrupt("return",{timestamp:r,signature:n});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kA(e,t){return xA.apply(this,arguments)}function xA(){return(xA=hA(yA.mark((function e(t,r){var n,i;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.getAddress();case 2:return n=e.sent,e.next=5,_A(t,r);case 5:return i=e.sent,e.abrupt("return",{message:t,ethAddress:n,ethSignature:i});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var TA,RA=new ue("08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f",16),OA=new qc.ec(new qc.curves.PresetCurve({type:"short",prime:null,p:"08000000 00000011 00000000 00000000 00000000 00000000 00000000 00000001",a:"00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001",b:"06f21413 efbe40de 150e596d 72f7a8c5 609ad26c 15c915c1 f4cdfcb9 9cee9e89",n:RA.toString("hex"),hash:Qo.sha256,gRed:!1,g:["1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca","5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f"]}));function MA(e,t){return new ue(Qo.sha256().update(cc(Bc(e)+Ic(mc(t),2))).digest("hex"),16)}function IA(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=hc(e).slice(t,r);return _c(n)}function PA(e,t,r,n){var i=Qo.sha256().update(e).digest("hex"),o=Qo.sha256().update(t).digest("hex"),s=IA(i,-31),a=IA(o,-31),u=IA(r,-31),c=IA(r,-62,-31);return"m/2645'/".concat(s,"'/").concat(a,"'/").concat(u,"'/").concat(c,"'/").concat(n)}function CA(e,t){var r=n_.hdkey.fromMasterSeed(Buffer.from(e.slice(2),"hex")).derivePath(t).getWallet().getPrivateKey();return function(e,t){for(var r=new ue("1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000",16),n=r.sub(r.mod(t)),i=MA(e.toString("hex",64),0),o=1;i.gte(n);o++)i=MA(i.toString("hex"),o);return i.umod(t).toString("hex")}(new ue(r),RA)}function NA(e){return BA.apply(this,arguments)}function BA(){return(BA=hA(yA.mark((function e(t){var r,n,i,o,s;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return r=e.sent.toLowerCase(),e.next=5,t.signMessage("Only sign this request if you’ve initiated an action with Immutable X.");case 5:return n=e.sent,i=je(n).s,o=PA("starkex","immutablex",r,"1"),s=CA(i,o),e.abrupt("return",s.padStart(64,"0"));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e.StarkCurveInvalidMessageLength="invalid message length"}(TA||(TA={}));var jA=function(){function e(t){KE(this,e),this.privateKey=t,this.keyPair=OA.keyFromPrivate(t,"hex")}return GE(e,[{key:"getAddress",value:function(){var e=this.keyPair.getPublic().getX().toString("hex");return Uc(e)}},{key:"signMessage",value:function(){var e=hA(yA.mark((function e(t){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.serialize(this.keyPair.sign(this.fixMsgHashLen(t))));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"serialize",value:function(e){return Lc(Cc(e.r.toString("hex"),64)+Cc(e.s.toString("hex"),64))}},{key:"fixMsgHashLen",value:function(e){if(e=Bc(e),(e=new ue(e,"hex").toString("hex")).length<=62)return e;if(63!==e.length)throw new Error(TA.StarkCurveInvalidMessageLength);return"".concat(e,"0")}}]),e}();function LA(e){return new jA(e)}function UA(e,t,r){return UA=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&rA(i,r.prototype),i},UA.apply(null,arguments)}function DA(e){var t="function"==typeof Map?new Map:void 0;return DA=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return UA(e,arguments,eA(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),rA(n,e)},DA(e)}var FA="https://api.sandbox.x.immutable.com".replace(/\/+$/,""),qA=GE((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:FA,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zE;KE(this,e),this.basePath=r,this.axios=n,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)})),zA=function(e){nA(r,DA(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(e,n){var i;return KE(this,r),WE(oA(i=t.call(this,n)),"name","RequiredError"),i.field=e,i}return GE(r)}();function KA(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 HA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?KA(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var GA="https://example.com",WA=function(e,t,r){if(null==r)throw new zA(t,"Required parameter ".concat(t," was null or undefined when calling ").concat(e,"."))};function VA(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";"object"===iA(t)?Array.isArray(t)?t.forEach((function(t){return VA(e,t,r)})):Object.keys(t).forEach((function(n){return VA(e,t[n],"".concat(r).concat(""!==r?".":"").concat(n))})):e.has(r)?e.append(r,t):e.set(r,t)}var XA=function(e){for(var t=new URLSearchParams(e.search),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];VA(t,n),e.search=t.toString()},JA=function(e,t,r){var n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},$A=function(e){return e.pathname+e.search+e.hash},YA=function(e,t,r,n){return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,s=HA(HA({},e.options),{},{url:((null==n?void 0:n.basePath)||o)+e.url});return i.request(s)}};function QA(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 ZA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?QA(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var eS=function(e){var t=function(e){return{getAsset:(r=hA(yA.mark((function t(r,n,i){var o,s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.length>3&&void 0!==l[3]?l[3]:{},WA("getAsset","tokenAddress",r),WA("getAsset","tokenId",n),s="/v1/assets/{token_address}/{token_id}".replace("{".concat("token_address","}"),encodeURIComponent(String(r))).replace("{".concat("token_id","}"),encodeURIComponent(String(n))),a=new URL(s,GA),e&&(u=e.baseOptions),c=ZA(ZA({method:"GET"},u),o),f={},d={},void 0!==i&&(d.include_fees=i),XA(a,d),h=u&&u.headers?u.headers:{},c.headers=ZA(ZA(ZA({},f),h),o.headers),t.abrupt("return",{url:$A(a),options:c});case 14:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),listAssets:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y){var b,v,w,_,E,A,S,k=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return b=k.length>16&&void 0!==k[16]?k[16]:{},v=new URL("/v1/assets",GA),e&&(w=e.baseOptions),_=ZA(ZA({method:"GET"},w),b),E={},A={},void 0!==r&&(A.page_size=r),void 0!==n&&(A.cursor=n),void 0!==i&&(A.order_by=i),void 0!==o&&(A.direction=o),void 0!==s&&(A.user=s),void 0!==a&&(A.status=a),void 0!==u&&(A.name=u),void 0!==c&&(A.metadata=c),void 0!==f&&(A.sell_orders=f),void 0!==d&&(A.buy_orders=d),void 0!==h&&(A.include_fees=h),void 0!==l&&(A.collection=l),void 0!==p&&(A.updated_min_timestamp=p),void 0!==g&&(A.updated_max_timestamp=g),void 0!==m&&(A.auxiliary_fee_percentages=m),void 0!==y&&(A.auxiliary_fee_recipients=y),XA(v,A),S=w&&w.headers?w.headers:{},_.headers=ZA(ZA(ZA({},E),S),b.headers),t.abrupt("return",{url:$A(v),options:_});case 27:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c,f,d,h,l,p,g,m){return t.apply(this,arguments)})};var t,r}(e);return{getAsset:function(r,n,i,o){return hA(yA.mark((function s(){var a;return yA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.getAsset(r,n,i,o);case 2:return a=s.sent,s.abrupt("return",YA(a,zE,FA,e));case 4:case"end":return s.stop()}}),s)})))()},listAssets:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b){return hA(yA.mark((function v(){var w;return yA.wrap((function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,t.listAssets(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b);case 2:return w=v.sent,v.abrupt("return",YA(w,zE,FA,e));case 4:case"end":return v.stop()}}),v)})))()}}},tS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getAsset",value:function(e,t){var r=this;return eS(this.configuration).getAsset(e.tokenAddress,e.tokenId,e.includeFees,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listAssets",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return eS(this.configuration).listAssets(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.name,t.metadata,t.sellOrders,t.buyOrders,t.includeFees,t.collection,t.updatedMinTimestamp,t.updatedMaxTimestamp,t.auxiliaryFeePercentages,t.auxiliaryFeeRecipients,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function rS(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 nS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var iS=function(e){var t=function(e){return{getBalance:(r=hA(yA.mark((function t(r,n){var i,o,s,a,u,c,f,d=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=d.length>2&&void 0!==d[2]?d[2]:{},WA("getBalance","owner",r),WA("getBalance","address",n),o="/v2/balances/{owner}/{address}".replace("{".concat("owner","}"),encodeURIComponent(String(r))).replace("{".concat("address","}"),encodeURIComponent(String(n))),s=new URL(o,GA),e&&(a=e.baseOptions),u=nS(nS({method:"GET"},a),i),c={},XA(s,{}),f=a&&a.headers?a.headers:{},u.headers=nS(nS(nS({},c),f),i.headers),t.abrupt("return",{url:$A(s),options:u});case 13:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),listBalances:(t=hA(yA.mark((function t(r,n,i,o,s){var a,u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},WA("listBalances","owner",r),u="/v2/balances/{owner}".replace("{".concat("owner","}"),encodeURIComponent(String(r))),c=new URL(u,GA),e&&(f=e.baseOptions),d=nS(nS({method:"GET"},f),a),h={},l={},void 0!==n&&(l.page_size=n),void 0!==i&&(l.cursor=i),void 0!==o&&(l.order_by=o),void 0!==s&&(l.direction=s),XA(c,l),p=f&&f.headers?f.headers:{},d.headers=nS(nS(nS({},h),p),a.headers),t.abrupt("return",{url:$A(c),options:d});case 16:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o){return t.apply(this,arguments)})};var t,r}(e);return{getBalance:function(r,n,i){return hA(yA.mark((function o(){var s;return yA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.getBalance(r,n,i);case 2:return s=o.sent,o.abrupt("return",YA(s,zE,FA,e));case 4:case"end":return o.stop()}}),o)})))()},listBalances:function(r,n,i,o,s,a){return hA(yA.mark((function u(){var c;return yA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.listBalances(r,n,i,o,s,a);case 2:return c=u.sent,u.abrupt("return",YA(c,zE,FA,e));case 4:case"end":return u.stop()}}),u)})))()}}},oS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getBalance",value:function(e,t){var r=this;return iS(this.configuration).getBalance(e.owner,e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listBalances",value:function(e,t){var r=this;return iS(this.configuration).listBalances(e.owner,e.pageSize,e.cursor,e.orderBy,e.direction,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function sS(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 aS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var uS=function(e){var t=function(e){return{createCollection:(o=hA(yA.mark((function t(r,n,i){var o,s,a,u,c,f,d,h=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>3&&void 0!==h[3]?h[3]:{},WA("createCollection","iMXSignature",r),WA("createCollection","iMXTimestamp",n),WA("createCollection","createCollectionRequest",i),s=new URL("/v1/collections",GA),e&&(a=e.baseOptions),u=aS(aS({method:"POST"},a),o),c={},f={},null!=r&&(c["IMX-Signature"]=String(r)),null!=n&&(c["IMX-Timestamp"]=String(n)),c["Content-Type"]="application/json",XA(s,f),d=a&&a.headers?a.headers:{},u.headers=aS(aS(aS({},c),d),o.headers),u.data=JA(i,u,e),t.abrupt("return",{url:$A(s),options:u});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r){return o.apply(this,arguments)}),getCollection:(i=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getCollection","address",r),i="/v1/collections/{address}".replace("{".concat("address","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=aS(aS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=aS(aS(aS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),listCollectionFilters:(n=hA(yA.mark((function t(r,n,i){var o,s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.length>3&&void 0!==l[3]?l[3]:{},WA("listCollectionFilters","address",r),s="/v1/collections/{address}/filters".replace("{".concat("address","}"),encodeURIComponent(String(r))),a=new URL(s,GA),e&&(u=e.baseOptions),c=aS(aS({method:"GET"},u),o),f={},d={},void 0!==n&&(d.page_size=n),void 0!==i&&(d.next_page_token=i),XA(a,d),h=u&&u.headers?u.headers:{},c.headers=aS(aS(aS({},f),h),o.headers),t.abrupt("return",{url:$A(a),options:c});case 14:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),listCollections:(r=hA(yA.mark((function t(r,n,i,o,s,a,u){var c,f,d,h,l,p,g,m=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=m.length>7&&void 0!==m[7]?m[7]:{},f=new URL("/v1/collections",GA),e&&(d=e.baseOptions),h=aS(aS({method:"GET"},d),c),l={},p={},void 0!==r&&(p.page_size=r),void 0!==n&&(p.cursor=n),void 0!==i&&(p.order_by=i),void 0!==o&&(p.direction=o),void 0!==s&&(p.blacklist=s),void 0!==a&&(p.whitelist=a),void 0!==u&&(p.keyword=u),XA(f,p),g=d&&d.headers?d.headers:{},h.headers=aS(aS(aS({},l),g),c.headers),t.abrupt("return",{url:$A(f),options:h});case 18:case"end":return t.stop()}}),t)}))),function(e,t,n,i,o,s,a){return r.apply(this,arguments)}),updateCollection:(t=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l,p=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=p.length>4&&void 0!==p[4]?p[4]:{},WA("updateCollection","address",r),WA("updateCollection","iMXSignature",n),WA("updateCollection","iMXTimestamp",i),WA("updateCollection","updateCollectionRequest",o),a="/v1/collections/{address}".replace("{".concat("address","}"),encodeURIComponent(String(r))),u=new URL(a,GA),e&&(c=e.baseOptions),f=aS(aS({method:"PATCH"},c),s),d={},h={},null!=n&&(d["IMX-Signature"]=String(n)),null!=i&&(d["IMX-Timestamp"]=String(i)),d["Content-Type"]="application/json",XA(u,h),l=c&&c.headers?c.headers:{},f.headers=aS(aS(aS({},d),l),s.headers),f.data=JA(o,f,e),t.abrupt("return",{url:$A(u),options:f});case 19:case"end":return t.stop()}}),t)}))),function(e,r,n,i){return t.apply(this,arguments)})};var t,r,n,i,o}(e);return{createCollection:function(r,n,i,o){return hA(yA.mark((function s(){var a;return yA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.createCollection(r,n,i,o);case 2:return a=s.sent,s.abrupt("return",YA(a,zE,FA,e));case 4:case"end":return s.stop()}}),s)})))()},getCollection:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getCollection(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listCollectionFilters:function(r,n,i,o){return hA(yA.mark((function s(){var a;return yA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.listCollectionFilters(r,n,i,o);case 2:return a=s.sent,s.abrupt("return",YA(a,zE,FA,e));case 4:case"end":return s.stop()}}),s)})))()},listCollections:function(r,n,i,o,s,a,u,c){return hA(yA.mark((function f(){var d;return yA.wrap((function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,t.listCollections(r,n,i,o,s,a,u,c);case 2:return d=f.sent,f.abrupt("return",YA(d,zE,FA,e));case 4:case"end":return f.stop()}}),f)})))()},updateCollection:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.updateCollection(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()}}},cS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createCollection",value:function(e,t){var r=this;return uS(this.configuration).createCollection(e.iMXSignature,e.iMXTimestamp,e.createCollectionRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getCollection",value:function(e,t){var r=this;return uS(this.configuration).getCollection(e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listCollectionFilters",value:function(e,t){var r=this;return uS(this.configuration).listCollectionFilters(e.address,e.pageSize,e.nextPageToken,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listCollections",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return uS(this.configuration).listCollections(t.pageSize,t.cursor,t.orderBy,t.direction,t.blacklist,t.whitelist,t.keyword,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"updateCollection",value:function(e,t){var r=this;return uS(this.configuration).updateCollection(e.address,e.iMXSignature,e.iMXTimestamp,e.updateCollectionRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function fS(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 dS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var hS=function(e){var t=function(e){return{getDeposit:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getDeposit","id",r),i="/v1/deposits/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=dS(dS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=dS(dS(dS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getSignableDeposit:(r=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableDeposit","getSignableDepositRequest",r),i=new URL("/v1/signable-deposit-details",GA),e&&(o=e.baseOptions),s=dS(dS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=dS(dS(dS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listDeposits:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y){var b,v,w,_,E,A,S,k=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return b=k.length>16&&void 0!==k[16]?k[16]:{},v=new URL("/v1/deposits",GA),e&&(w=e.baseOptions),_=dS(dS({method:"GET"},w),b),E={},A={},void 0!==r&&(A.page_size=r),void 0!==n&&(A.cursor=n),void 0!==i&&(A.order_by=i),void 0!==o&&(A.direction=o),void 0!==s&&(A.user=s),void 0!==a&&(A.status=a),void 0!==u&&(A.min_timestamp=u),void 0!==c&&(A.max_timestamp=c),void 0!==f&&(A.token_type=f),void 0!==d&&(A.token_id=d),void 0!==h&&(A.asset_id=h),void 0!==l&&(A.token_address=l),void 0!==p&&(A.token_name=p),void 0!==g&&(A.min_quantity=g),void 0!==m&&(A.max_quantity=m),void 0!==y&&(A.metadata=y),XA(v,A),S=w&&w.headers?w.headers:{},_.headers=dS(dS(dS({},E),S),b.headers),t.abrupt("return",{url:$A(v),options:_});case 27:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c,f,d,h,l,p,g,m){return t.apply(this,arguments)})};var t,r,n}(e);return{getDeposit:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getDeposit(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableDeposit:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableDeposit(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listDeposits:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b){return hA(yA.mark((function v(){var w;return yA.wrap((function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,t.listDeposits(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b);case 2:return w=v.sent,v.abrupt("return",YA(w,zE,FA,e));case 4:case"end":return v.stop()}}),v)})))()}}},lS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getDeposit",value:function(e,t){var r=this;return hS(this.configuration).getDeposit(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableDeposit",value:function(e,t){var r=this;return hS(this.configuration).getSignableDeposit(e.getSignableDepositRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listDeposits",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return hS(this.configuration).listDeposits(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.assetId,t.tokenAddress,t.tokenName,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function pS(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 gS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var mS=function(e){var t=function(e){return{encodeAsset:(t=hA(yA.mark((function t(r,n){var i,o,s,a,u,c,f,d,h=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=h.length>2&&void 0!==h[2]?h[2]:{},WA("encodeAsset","assetType",r),WA("encodeAsset","encodeAssetRequest",n),o="/v1/encode/{assetType}".replace("{".concat("assetType","}"),encodeURIComponent(String(r))),s=new URL(o,GA),e&&(a=e.baseOptions),u=gS(gS({method:"POST"},a),i),f={},(c={})["Content-Type"]="application/json",XA(s,f),d=a&&a.headers?a.headers:{},u.headers=gS(gS(gS({},c),d),i.headers),u.data=JA(n,u,e),t.abrupt("return",{url:$A(s),options:u});case 15:case"end":return t.stop()}}),t)}))),function(e,r){return t.apply(this,arguments)})};var t}(e);return{encodeAsset:function(r,n,i){return hA(yA.mark((function o(){var s;return yA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.encodeAsset(r,n,i);case 2:return s=o.sent,o.abrupt("return",YA(s,zE,FA,e));case 4:case"end":return o.stop()}}),o)})))()}}},yS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"encodeAsset",value:function(e,t){var r=this;return mS(this.configuration).encodeAsset(e.assetType,e.encodeAssetRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function bS(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 vS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wS=function(e){var t=function(e){return{createExchange:(o=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("createExchange","createExchangeAPIRequest",r),i=new URL("/v3/exchanges",GA),e&&(o=e.baseOptions),s=vS(vS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=vS(vS(vS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),createExchangeTransfer:(i=hA(yA.mark((function t(r,n,i,o,s){var a,u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},WA("createExchangeTransfer","id",r),WA("createExchangeTransfer","createTransferRequest",n),u="/v2/exchanges/{id}/transfers".replace("{".concat("id","}"),encodeURIComponent(String(r))),c=new URL(u,GA),e&&(f=e.baseOptions),d=vS(vS({method:"POST"},f),a),h={},l={},null!=i&&(h["x-imx-eth-address"]=String(i)),null!=o&&(h["x-imx-eth-signature"]=String(o)),null!=s&&(h.Authorization=String(s)),h["Content-Type"]="application/json",XA(c,l),p=f&&f.headers?f.headers:{},d.headers=vS(vS(vS({},h),p),a.headers),d.data=JA(n,d,e),t.abrupt("return",{url:$A(c),options:d});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r,n,o){return i.apply(this,arguments)}),getExchange:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getExchange","id",r),i="/v3/exchanges/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=vS(vS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=vS(vS(vS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getExchangeSignableTransfer:(r=hA(yA.mark((function t(r,n){var i,o,s,a,u,c,f,d,h=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=h.length>2&&void 0!==h[2]?h[2]:{},WA("getExchangeSignableTransfer","id",r),WA("getExchangeSignableTransfer","getSignableTransferRequest",n),o="/v2/exchanges/{id}/signable-transfer-details".replace("{".concat("id","}"),encodeURIComponent(String(r))),s=new URL(o,GA),e&&(a=e.baseOptions),u=vS(vS({method:"POST"},a),i),f={},(c={})["Content-Type"]="application/json",XA(s,f),d=a&&a.headers?a.headers:{},u.headers=vS(vS(vS({},c),d),i.headers),u.data=JA(n,u,e),t.abrupt("return",{url:$A(s),options:u});case 15:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),getExchanges:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f){var d,h,l,p,g,m,y,b=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d=b.length>9&&void 0!==b[9]?b[9]:{},h=new URL("/v3/exchanges",GA),e&&(l=e.baseOptions),p=vS(vS({method:"GET"},l),d),g={},m={},void 0!==r&&(m.page_size=r),void 0!==n&&(m.cursor=n),void 0!==i&&(m.order_by=i),void 0!==o&&(m.direction=o),void 0!==s&&(m.id=s),void 0!==a&&(m.wallet_address=a),void 0!==u&&(m.status=u),void 0!==c&&(m.provider=c),void 0!==f&&(m.transfer_id=f),XA(h,m),y=l&&l.headers?l.headers:{},p.headers=vS(vS(vS({},g),y),d.headers),t.abrupt("return",{url:$A(h),options:p});case 20:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c){return t.apply(this,arguments)})};var t,r,n,i,o}(e);return{createExchange:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.createExchange(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},createExchangeTransfer:function(r,n,i,o,s,a){return hA(yA.mark((function u(){var c;return yA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.createExchangeTransfer(r,n,i,o,s,a);case 2:return c=u.sent,u.abrupt("return",YA(c,zE,FA,e));case 4:case"end":return u.stop()}}),u)})))()},getExchange:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getExchange(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getExchangeSignableTransfer:function(r,n,i){return hA(yA.mark((function o(){var s;return yA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.getExchangeSignableTransfer(r,n,i);case 2:return s=o.sent,o.abrupt("return",YA(s,zE,FA,e));case 4:case"end":return o.stop()}}),o)})))()},getExchanges:function(r,n,i,o,s,a,u,c,f,d){return hA(yA.mark((function h(){var l;return yA.wrap((function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,t.getExchanges(r,n,i,o,s,a,u,c,f,d);case 2:return l=h.sent,h.abrupt("return",YA(l,zE,FA,e));case 4:case"end":return h.stop()}}),h)})))()}}},_S=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createExchange",value:function(e,t){var r=this;return wS(this.configuration).createExchange(e.createExchangeAPIRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createExchangeTransfer",value:function(e,t){var r=this;return wS(this.configuration).createExchangeTransfer(e.id,e.createTransferRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getExchange",value:function(e,t){var r=this;return wS(this.configuration).getExchange(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getExchangeSignableTransfer",value:function(e,t){var r=this;return wS(this.configuration).getExchangeSignableTransfer(e.id,e.getSignableTransferRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getExchanges",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return wS(this.configuration).getExchanges(t.pageSize,t.cursor,t.orderBy,t.direction,t.id,t.walletAddress,t.status,t.provider,t.transferId,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function ES(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 AS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ES(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ES(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var SS=function(e){var t=function(e){return{addMetadataSchemaToCollection:(n=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l,p=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=p.length>4&&void 0!==p[4]?p[4]:{},WA("addMetadataSchemaToCollection","address",r),WA("addMetadataSchemaToCollection","iMXSignature",n),WA("addMetadataSchemaToCollection","iMXTimestamp",i),WA("addMetadataSchemaToCollection","addMetadataSchemaToCollectionRequest",o),a="/v1/collections/{address}/metadata-schema".replace("{".concat("address","}"),encodeURIComponent(String(r))),u=new URL(a,GA),e&&(c=e.baseOptions),f=AS(AS({method:"POST"},c),s),d={},h={},null!=n&&(d["IMX-Signature"]=String(n)),null!=i&&(d["IMX-Timestamp"]=String(i)),d["Content-Type"]="application/json",XA(u,h),l=c&&c.headers?c.headers:{},f.headers=AS(AS(AS({},d),l),s.headers),f.data=JA(o,f,e),t.abrupt("return",{url:$A(u),options:f});case 19:case"end":return t.stop()}}),t)}))),function(e,t,r,i){return n.apply(this,arguments)}),getMetadataSchema:(r=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getMetadataSchema","address",r),i="/v1/collections/{address}/metadata-schema".replace("{".concat("address","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=AS(AS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=AS(AS(AS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),updateMetadataSchemaByName:(t=hA(yA.mark((function t(r,n,i,o,s){var a,u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},WA("updateMetadataSchemaByName","address",r),WA("updateMetadataSchemaByName","name",n),WA("updateMetadataSchemaByName","iMXSignature",i),WA("updateMetadataSchemaByName","iMXTimestamp",o),WA("updateMetadataSchemaByName","metadataSchemaRequest",s),u="/v1/collections/{address}/metadata-schema/{name}".replace("{".concat("address","}"),encodeURIComponent(String(r))).replace("{".concat("name","}"),encodeURIComponent(String(n))),c=new URL(u,GA),e&&(f=e.baseOptions),d=AS(AS({method:"PATCH"},f),a),h={},l={},null!=i&&(h["IMX-Signature"]=String(i)),null!=o&&(h["IMX-Timestamp"]=String(o)),h["Content-Type"]="application/json",XA(c,l),p=f&&f.headers?f.headers:{},d.headers=AS(AS(AS({},h),p),a.headers),d.data=JA(s,d,e),t.abrupt("return",{url:$A(c),options:d});case 20:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o){return t.apply(this,arguments)})};var t,r,n}(e);return{addMetadataSchemaToCollection:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.addMetadataSchemaToCollection(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},getMetadataSchema:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getMetadataSchema(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},updateMetadataSchemaByName:function(r,n,i,o,s,a){return hA(yA.mark((function u(){var c;return yA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.updateMetadataSchemaByName(r,n,i,o,s,a);case 2:return c=u.sent,u.abrupt("return",YA(c,zE,FA,e));case 4:case"end":return u.stop()}}),u)})))()}}},kS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"addMetadataSchemaToCollection",value:function(e,t){var r=this;return SS(this.configuration).addMetadataSchemaToCollection(e.address,e.iMXSignature,e.iMXTimestamp,e.addMetadataSchemaToCollectionRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMetadataSchema",value:function(e,t){var r=this;return SS(this.configuration).getMetadataSchema(e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"updateMetadataSchemaByName",value:function(e,t){var r=this;return SS(this.configuration).updateMetadataSchemaByName(e.address,e.name,e.iMXSignature,e.iMXTimestamp,e.metadataSchemaRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function xS(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 TS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var RS=function(e){var t=function(e){return{getAListOfMetadataRefreshes:(i=hA(yA.mark((function t(r,n,i,o,s,a){var u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=g.length>6&&void 0!==g[6]?g[6]:{},WA("getAListOfMetadataRefreshes","xImxEthSignature",r),WA("getAListOfMetadataRefreshes","xImxEthTimestamp",n),WA("getAListOfMetadataRefreshes","xImxEthAddress",i),c=new URL("/v1/metadata-refreshes",GA),e&&(f=e.baseOptions),d=TS(TS({method:"GET"},f),u),h={},l={},void 0!==o&&(l.page_size=o),void 0!==s&&(l.cursor=s),void 0!==a&&(l.collection_address=a),null!=r&&(h["x-imx-eth-signature"]=String(r)),null!=n&&(h["x-imx-eth-timestamp"]=String(n)),null!=i&&(h["x-imx-eth-address"]=String(i)),XA(c,l),p=f&&f.headers?f.headers:{},d.headers=TS(TS(TS({},h),p),u.headers),t.abrupt("return",{url:$A(c),options:d});case 20:case"end":return t.stop()}}),t)}))),function(e,t,r,n,o,s){return i.apply(this,arguments)}),getMetadataRefreshErrors:(n=hA(yA.mark((function t(r,n,i,o,s,a){var u,c,f,d,h,l,p,g,m=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=m.length>6&&void 0!==m[6]?m[6]:{},WA("getMetadataRefreshErrors","refreshId",r),WA("getMetadataRefreshErrors","xImxEthSignature",n),WA("getMetadataRefreshErrors","xImxEthTimestamp",i),WA("getMetadataRefreshErrors","xImxEthAddress",o),c="/v1/metadata-refreshes/{refresh_id}/errors".replace("{".concat("refresh_id","}"),encodeURIComponent(String(r))),f=new URL(c,GA),e&&(d=e.baseOptions),h=TS(TS({method:"GET"},d),u),l={},p={},void 0!==s&&(p.page_size=s),void 0!==a&&(p.cursor=a),null!=n&&(l["x-imx-eth-signature"]=String(n)),null!=i&&(l["x-imx-eth-timestamp"]=String(i)),null!=o&&(l["x-imx-eth-address"]=String(o)),XA(f,p),g=d&&d.headers?d.headers:{},h.headers=TS(TS(TS({},l),g),u.headers),t.abrupt("return",{url:$A(f),options:h});case 20:case"end":return t.stop()}}),t)}))),function(e,t,r,i,o,s){return n.apply(this,arguments)}),getMetadataRefreshResults:(r=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l,p=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=p.length>4&&void 0!==p[4]?p[4]:{},WA("getMetadataRefreshResults","refreshId",r),WA("getMetadataRefreshResults","xImxEthSignature",n),WA("getMetadataRefreshResults","xImxEthTimestamp",i),WA("getMetadataRefreshResults","xImxEthAddress",o),a="/v1/metadata-refreshes/{refresh_id}".replace("{".concat("refresh_id","}"),encodeURIComponent(String(r))),u=new URL(a,GA),e&&(c=e.baseOptions),f=TS(TS({method:"GET"},c),s),d={},h={},null!=n&&(d["x-imx-eth-signature"]=String(n)),null!=i&&(d["x-imx-eth-timestamp"]=String(i)),null!=o&&(d["x-imx-eth-address"]=String(o)),XA(u,h),l=c&&c.headers?c.headers:{},f.headers=TS(TS(TS({},d),l),s.headers),t.abrupt("return",{url:$A(u),options:f});case 18:case"end":return t.stop()}}),t)}))),function(e,t,n,i){return r.apply(this,arguments)}),requestAMetadataRefresh:(t=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("requestAMetadataRefresh","xImxEthSignature",r),WA("requestAMetadataRefresh","xImxEthTimestamp",n),WA("requestAMetadataRefresh","xImxEthAddress",i),WA("requestAMetadataRefresh","createMetadataRefreshRequest",o),a=new URL("/v1/metadata-refreshes",GA),e&&(u=e.baseOptions),c=TS(TS({method:"POST"},u),s),f={},d={},null!=r&&(f["x-imx-eth-signature"]=String(r)),null!=n&&(f["x-imx-eth-timestamp"]=String(n)),null!=i&&(f["x-imx-eth-address"]=String(i)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=TS(TS(TS({},f),h),s.headers),c.data=JA(o,c,e),t.abrupt("return",{url:$A(a),options:c});case 20:case"end":return t.stop()}}),t)}))),function(e,r,n,i){return t.apply(this,arguments)})};var t,r,n,i}(e);return{getAListOfMetadataRefreshes:function(r,n,i,o,s,a,u){return hA(yA.mark((function c(){var f;return yA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.getAListOfMetadataRefreshes(r,n,i,o,s,a,u);case 2:return f=c.sent,c.abrupt("return",YA(f,zE,FA,e));case 4:case"end":return c.stop()}}),c)})))()},getMetadataRefreshErrors:function(r,n,i,o,s,a,u){return hA(yA.mark((function c(){var f;return yA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.getMetadataRefreshErrors(r,n,i,o,s,a,u);case 2:return f=c.sent,c.abrupt("return",YA(f,zE,FA,e));case 4:case"end":return c.stop()}}),c)})))()},getMetadataRefreshResults:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.getMetadataRefreshResults(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},requestAMetadataRefresh:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.requestAMetadataRefresh(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()}}},OS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getAListOfMetadataRefreshes",value:function(e,t){var r=this;return RS(this.configuration).getAListOfMetadataRefreshes(e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,e.pageSize,e.cursor,e.collectionAddress,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMetadataRefreshErrors",value:function(e,t){var r=this;return RS(this.configuration).getMetadataRefreshErrors(e.refreshId,e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,e.pageSize,e.cursor,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMetadataRefreshResults",value:function(e,t){var r=this;return RS(this.configuration).getMetadataRefreshResults(e.refreshId,e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"requestAMetadataRefresh",value:function(e,t){var r=this;return RS(this.configuration).requestAMetadataRefresh(e.xImxEthSignature,e.xImxEthTimestamp,e.xImxEthAddress,e.createMetadataRefreshRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function MS(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 IS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?MS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var PS=function(e){var t=function(e){return{getMint:(i=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getMint","id",r),i="/v1/mints/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=IS(IS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=IS(IS(IS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getMintableTokenDetailsByClientTokenId:(n=hA(yA.mark((function t(r,n){var i,o,s,a,u,c,f,d=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=d.length>2&&void 0!==d[2]?d[2]:{},WA("getMintableTokenDetailsByClientTokenId","tokenAddress",r),WA("getMintableTokenDetailsByClientTokenId","tokenId",n),o="/v1/mintable-token/{token_address}/{token_id}".replace("{".concat("token_address","}"),encodeURIComponent(String(r))).replace("{".concat("token_id","}"),encodeURIComponent(String(n))),s=new URL(o,GA),e&&(a=e.baseOptions),u=IS(IS({method:"GET"},a),i),c={},XA(s,{}),f=a&&a.headers?a.headers:{},u.headers=IS(IS(IS({},c),f),i.headers),t.abrupt("return",{url:$A(s),options:u});case 13:case"end":return t.stop()}}),t)}))),function(e,t){return n.apply(this,arguments)}),listMints:(r=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m){var y,b,v,w,_,E,A,S=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return y=S.length>15&&void 0!==S[15]?S[15]:{},b=new URL("/v1/mints",GA),e&&(v=e.baseOptions),w=IS(IS({method:"GET"},v),y),_={},E={},void 0!==r&&(E.page_size=r),void 0!==n&&(E.cursor=n),void 0!==i&&(E.order_by=i),void 0!==o&&(E.direction=o),void 0!==s&&(E.user=s),void 0!==a&&(E.status=a),void 0!==u&&(E.min_timestamp=u),void 0!==c&&(E.max_timestamp=c),void 0!==f&&(E.token_type=f),void 0!==d&&(E.token_id=d),void 0!==h&&(E.token_name=h),void 0!==l&&(E.token_address=l),void 0!==p&&(E.min_quantity=p),void 0!==g&&(E.max_quantity=g),void 0!==m&&(E.metadata=m),XA(b,E),A=v&&v.headers?v.headers:{},w.headers=IS(IS(IS({},_),A),y.headers),t.abrupt("return",{url:$A(b),options:w});case 26:case"end":return t.stop()}}),t)}))),function(e,t,n,i,o,s,a,u,c,f,d,h,l,p,g){return r.apply(this,arguments)}),mintTokens:(t=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("mintTokens","mintTokensRequestV2",r),i=new URL("/v2/mints",GA),e&&(o=e.baseOptions),s=IS(IS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=IS(IS(IS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,r,n,i}(e);return{getMint:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getMint(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getMintableTokenDetailsByClientTokenId:function(r,n,i){return hA(yA.mark((function o(){var s;return yA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.getMintableTokenDetailsByClientTokenId(r,n,i);case 2:return s=o.sent,o.abrupt("return",YA(s,zE,FA,e));case 4:case"end":return o.stop()}}),o)})))()},listMints:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y){return hA(yA.mark((function b(){var v;return yA.wrap((function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,t.listMints(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y);case 2:return v=b.sent,b.abrupt("return",YA(v,zE,FA,e));case 4:case"end":return b.stop()}}),b)})))()},mintTokens:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.mintTokens(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()}}},CS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getMint",value:function(e,t){var r=this;return PS(this.configuration).getMint(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getMintableTokenDetailsByClientTokenId",value:function(e,t){var r=this;return PS(this.configuration).getMintableTokenDetailsByClientTokenId(e.tokenAddress,e.tokenId,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listMints",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return PS(this.configuration).listMints(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.tokenName,t.tokenAddress,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"mintTokens",value:function(e,t){var r=this;return PS(this.configuration).mintTokens(e.mintTokensRequestV2,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function NS(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 BS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var jS=function(e){var t=function(e){return{createNftPrimary:(o=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("createNftPrimary","createAPIRequest",r),i=new URL("/v2/nft/primary",GA),e&&(o=e.baseOptions),s=BS(BS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=BS(BS(BS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getCurrenciesNFTCheckoutPrimary:(i=hA(yA.mark((function t(r,n){var i,o,s,a,u,c,f,d=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=d.length>2&&void 0!==d[2]?d[2]:{},o=new URL("/v2/nft/primary/currencies",GA),e&&(s=e.baseOptions),a=BS(BS({method:"GET"},s),i),u={},c={},void 0!==r&&(c.provider=r),void 0!==n&&(c.include_limits=n),XA(o,c),f=s&&s.headers?s.headers:{},a.headers=BS(BS(BS({},u),f),i.headers),t.abrupt("return",{url:$A(o),options:a});case 13:case"end":return t.stop()}}),t)}))),function(e,t){return i.apply(this,arguments)}),getNftPrimaryTransaction:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getNftPrimaryTransaction","transactionId",r),i="/v2/nft/primary/{transaction_id}".replace("{".concat("transaction_id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=BS(BS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=BS(BS(BS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getNftPrimaryTransactions:(r=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h){var l,p,g,m,y,b,v,w=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=w.length>11&&void 0!==w[11]?w[11]:{},p=new URL("/v2/nft/primary",GA),e&&(g=e.baseOptions),m=BS(BS({method:"GET"},g),l),y={},b={},void 0!==r&&(b.page_size=r),void 0!==n&&(b.cursor=n),void 0!==i&&(b.order_by=i),void 0!==o&&(b.direction=o),void 0!==s&&(b.transaction_id=s),void 0!==a&&(b.contract_address=a),void 0!==u&&(b.seller_wallet_address=u),void 0!==c&&(b.user_wallet_address=c),void 0!==f&&(b.status=f),void 0!==d&&(b.provider=d),void 0!==h&&(b.mint_id=h),XA(p,b),v=g&&g.headers?g.headers:{},m.headers=BS(BS(BS({},y),v),l.headers),t.abrupt("return",{url:$A(p),options:m});case 22:case"end":return t.stop()}}),t)}))),function(e,t,n,i,o,s,a,u,c,f,d){return r.apply(this,arguments)}),registerNftPrimarySalesContract:(t=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("registerNftPrimarySalesContract","createAPIRequest",r),i=new URL("/v2/nft/primary/register",GA),e&&(o=e.baseOptions),s=BS(BS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=BS(BS(BS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,r,n,i,o}(e);return{createNftPrimary:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.createNftPrimary(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getCurrenciesNFTCheckoutPrimary:function(r,n,i){return hA(yA.mark((function o(){var s;return yA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.getCurrenciesNFTCheckoutPrimary(r,n,i);case 2:return s=o.sent,o.abrupt("return",YA(s,zE,FA,e));case 4:case"end":return o.stop()}}),o)})))()},getNftPrimaryTransaction:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getNftPrimaryTransaction(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getNftPrimaryTransactions:function(r,n,i,o,s,a,u,c,f,d,h,l){return hA(yA.mark((function p(){var g;return yA.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,t.getNftPrimaryTransactions(r,n,i,o,s,a,u,c,f,d,h,l);case 2:return g=p.sent,p.abrupt("return",YA(g,zE,FA,e));case 4:case"end":return p.stop()}}),p)})))()},registerNftPrimarySalesContract:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.registerNftPrimarySalesContract(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()}}},LS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createNftPrimary",value:function(e,t){var r=this;return jS(this.configuration).createNftPrimary(e.createAPIRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return jS(this.configuration).getCurrenciesNFTCheckoutPrimary(t.provider,t.includeLimits,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"getNftPrimaryTransaction",value:function(e,t){var r=this;return jS(this.configuration).getNftPrimaryTransaction(e.transactionId,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getNftPrimaryTransactions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return jS(this.configuration).getNftPrimaryTransactions(t.pageSize,t.cursor,t.orderBy,t.direction,t.transactionId,t.contractAddress,t.sellerWalletAddress,t.userWalletAddress,t.status,t.provider,t.mintId,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"registerNftPrimarySalesContract",value:function(e,t){var r=this;return jS(this.configuration).registerNftPrimarySalesContract(e.createAPIRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function US(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 DS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?US(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):US(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var FS=function(e){var t=function(e){return{cancelOrder:(d=hA(yA.mark((function t(r,n,i,o,s){var a,u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},WA("cancelOrder","id",r),WA("cancelOrder","cancelOrderRequest",n),u="/v1/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),c=new URL(u,GA),e&&(f=e.baseOptions),d=DS(DS({method:"DELETE"},f),a),h={},l={},null!=i&&(h["x-imx-eth-address"]=String(i)),null!=o&&(h["x-imx-eth-signature"]=String(o)),null!=s&&(h.Authorization=String(s)),h["Content-Type"]="application/json",XA(c,l),p=f&&f.headers?f.headers:{},d.headers=DS(DS(DS({},h),p),a.headers),d.data=JA(n,d,e),t.abrupt("return",{url:$A(c),options:d});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r,n,i){return d.apply(this,arguments)}),cancelOrderV3:(f=hA(yA.mark((function t(r,n,i,o,s){var a,u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=g.length>5&&void 0!==g[5]?g[5]:{},WA("cancelOrderV3","id",r),WA("cancelOrderV3","cancelOrderRequest",n),u="/v3/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),c=new URL(u,GA),e&&(f=e.baseOptions),d=DS(DS({method:"DELETE"},f),a),h={},l={},null!=i&&(h["x-imx-eth-address"]=String(i)),null!=o&&(h["x-imx-eth-signature"]=String(o)),null!=s&&(h.Authorization=String(s)),h["Content-Type"]="application/json",XA(c,l),p=f&&f.headers?f.headers:{},d.headers=DS(DS(DS({},h),p),a.headers),d.data=JA(n,d,e),t.abrupt("return",{url:$A(c),options:d});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r,n,i){return f.apply(this,arguments)}),createOrder:(c=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("createOrder","createOrderRequest",r),a=new URL("/v1/orders",GA),e&&(u=e.baseOptions),c=DS(DS({method:"POST"},u),s),f={},d={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=o&&(f.Authorization=String(o)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=DS(DS(DS({},f),h),s.headers),c.data=JA(r,c,e),t.abrupt("return",{url:$A(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return c.apply(this,arguments)}),createOrderV3:(u=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("createOrderV3","createOrderRequest",r),a=new URL("/v3/orders",GA),e&&(u=e.baseOptions),c=DS(DS({method:"POST"},u),s),f={},d={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=o&&(f.Authorization=String(o)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=DS(DS(DS({},f),h),s.headers),c.data=JA(r,c,e),t.abrupt("return",{url:$A(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return u.apply(this,arguments)}),getOrder:(a=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l,p=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=p.length>4&&void 0!==p[4]?p[4]:{},WA("getOrder","id",r),a="/v1/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),u=new URL(a,GA),e&&(c=e.baseOptions),f=DS(DS({method:"GET"},c),s),d={},h={},void 0!==n&&(h.include_fees=n),void 0!==i&&(h.auxiliary_fee_percentages=i),void 0!==o&&(h.auxiliary_fee_recipients=o),XA(u,h),l=c&&c.headers?c.headers:{},f.headers=DS(DS(DS({},d),l),s.headers),t.abrupt("return",{url:$A(u),options:f});case 15:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return a.apply(this,arguments)}),getOrderV3:(s=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l,p=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=p.length>4&&void 0!==p[4]?p[4]:{},WA("getOrderV3","id",r),a="/v3/orders/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),u=new URL(a,GA),e&&(c=e.baseOptions),f=DS(DS({method:"GET"},c),s),d={},h={},void 0!==n&&(h.include_fees=n),void 0!==i&&(h.auxiliary_fee_percentages=i),void 0!==o&&(h.auxiliary_fee_recipients=o),XA(u,h),l=c&&c.headers?c.headers:{},f.headers=DS(DS(DS({},d),l),s.headers),t.abrupt("return",{url:$A(u),options:f});case 15:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return s.apply(this,arguments)}),getSignableCancelOrder:(o=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableCancelOrder","getSignableCancelOrderRequest",r),i=new URL("/v1/signable-cancel-order-details",GA),e&&(o=e.baseOptions),s=DS(DS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=DS(DS(DS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getSignableCancelOrderV3:(i=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableCancelOrderV3","getSignableCancelOrderRequest",r),i=new URL("/v3/signable-cancel-order-details",GA),e&&(o=e.baseOptions),s=DS(DS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=DS(DS(DS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getSignableOrder:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableOrder","getSignableOrderRequestV3",r),i=new URL("/v3/signable-order-details",GA),e&&(o=e.baseOptions),s=DS(DS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=DS(DS(DS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),listOrders:(r=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M){var I,P,C,N,B,j,L,U=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return I=U.length>29&&void 0!==U[29]?U[29]:{},P=new URL("/v1/orders",GA),e&&(C=e.baseOptions),N=DS(DS({method:"GET"},C),I),B={},j={},void 0!==r&&(j.page_size=r),void 0!==n&&(j.cursor=n),void 0!==i&&(j.order_by=i),void 0!==o&&(j.direction=o),void 0!==s&&(j.user=s),void 0!==a&&(j.status=a),void 0!==u&&(j.min_timestamp=u),void 0!==c&&(j.max_timestamp=c),void 0!==f&&(j.updated_min_timestamp=f),void 0!==d&&(j.updated_max_timestamp=d),void 0!==h&&(j.buy_token_type=h),void 0!==l&&(j.buy_token_id=l),void 0!==p&&(j.buy_asset_id=p),void 0!==g&&(j.buy_token_address=g),void 0!==m&&(j.buy_token_name=m),void 0!==y&&(j.buy_min_quantity=y),void 0!==b&&(j.buy_max_quantity=b),void 0!==v&&(j.buy_metadata=v),void 0!==w&&(j.sell_token_type=w),void 0!==_&&(j.sell_token_id=_),void 0!==E&&(j.sell_asset_id=E),void 0!==A&&(j.sell_token_address=A),void 0!==S&&(j.sell_token_name=S),void 0!==k&&(j.sell_min_quantity=k),void 0!==x&&(j.sell_max_quantity=x),void 0!==T&&(j.sell_metadata=T),void 0!==R&&(j.auxiliary_fee_percentages=R),void 0!==O&&(j.auxiliary_fee_recipients=O),void 0!==M&&(j.include_fees=M),XA(P,j),L=C&&C.headers?C.headers:{},N.headers=DS(DS(DS({},B),L),I.headers),t.abrupt("return",{url:$A(P),options:N});case 40:case"end":return t.stop()}}),t)}))),function(e,t,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O){return r.apply(this,arguments)}),listOrdersV3:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M){var I,P,C,N,B,j,L,U=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return I=U.length>29&&void 0!==U[29]?U[29]:{},P=new URL("/v3/orders",GA),e&&(C=e.baseOptions),N=DS(DS({method:"GET"},C),I),B={},j={},void 0!==r&&(j.page_size=r),void 0!==n&&(j.cursor=n),void 0!==i&&(j.order_by=i),void 0!==o&&(j.direction=o),void 0!==s&&(j.user=s),void 0!==a&&(j.status=a),void 0!==u&&(j.min_timestamp=u),void 0!==c&&(j.max_timestamp=c),void 0!==f&&(j.updated_min_timestamp=f),void 0!==d&&(j.updated_max_timestamp=d),void 0!==h&&(j.buy_token_type=h),void 0!==l&&(j.buy_token_id=l),void 0!==p&&(j.buy_asset_id=p),void 0!==g&&(j.buy_token_address=g),void 0!==m&&(j.buy_token_name=m),void 0!==y&&(j.buy_min_quantity=y),void 0!==b&&(j.buy_max_quantity=b),void 0!==v&&(j.buy_metadata=v),void 0!==w&&(j.sell_token_type=w),void 0!==_&&(j.sell_token_id=_),void 0!==E&&(j.sell_asset_id=E),void 0!==A&&(j.sell_token_address=A),void 0!==S&&(j.sell_token_name=S),void 0!==k&&(j.sell_min_quantity=k),void 0!==x&&(j.sell_max_quantity=x),void 0!==T&&(j.sell_metadata=T),void 0!==R&&(j.auxiliary_fee_percentages=R),void 0!==O&&(j.auxiliary_fee_recipients=O),void 0!==M&&(j.include_fees=M),XA(P,j),L=C&&C.headers?C.headers:{},N.headers=DS(DS(DS({},B),L),I.headers),t.abrupt("return",{url:$A(P),options:N});case 40:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O){return t.apply(this,arguments)})};var t,r,n,i,o,s,a,u,c,f,d}(e);return{cancelOrder:function(r,n,i,o,s,a){return hA(yA.mark((function u(){var c;return yA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.cancelOrder(r,n,i,o,s,a);case 2:return c=u.sent,u.abrupt("return",YA(c,zE,FA,e));case 4:case"end":return u.stop()}}),u)})))()},cancelOrderV3:function(r,n,i,o,s,a){return hA(yA.mark((function u(){var c;return yA.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,t.cancelOrderV3(r,n,i,o,s,a);case 2:return c=u.sent,u.abrupt("return",YA(c,zE,FA,e));case 4:case"end":return u.stop()}}),u)})))()},createOrder:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createOrder(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},createOrderV3:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createOrderV3(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},getOrder:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.getOrder(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},getOrderV3:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.getOrderV3(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},getSignableCancelOrder:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableCancelOrder(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableCancelOrderV3:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableCancelOrderV3(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableOrder:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableOrder(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listOrders:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M,I){return hA(yA.mark((function P(){var C;return yA.wrap((function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,t.listOrders(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M,I);case 2:return C=P.sent,P.abrupt("return",YA(C,zE,FA,e));case 4:case"end":return P.stop()}}),P)})))()},listOrdersV3:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M,I){return hA(yA.mark((function P(){var C;return yA.wrap((function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,t.listOrdersV3(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M,I);case 2:return C=P.sent,P.abrupt("return",YA(C,zE,FA,e));case 4:case"end":return P.stop()}}),P)})))()}}},qS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"cancelOrder",value:function(e,t){var r=this;return FS(this.configuration).cancelOrder(e.id,e.cancelOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"cancelOrderV3",value:function(e,t){var r=this;return FS(this.configuration).cancelOrderV3(e.id,e.cancelOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createOrder",value:function(e,t){var r=this;return FS(this.configuration).createOrder(e.createOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createOrderV3",value:function(e,t){var r=this;return FS(this.configuration).createOrderV3(e.createOrderRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getOrder",value:function(e,t){var r=this;return FS(this.configuration).getOrder(e.id,e.includeFees,e.auxiliaryFeePercentages,e.auxiliaryFeeRecipients,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getOrderV3",value:function(e,t){var r=this;return FS(this.configuration).getOrderV3(e.id,e.includeFees,e.auxiliaryFeePercentages,e.auxiliaryFeeRecipients,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableCancelOrder",value:function(e,t){var r=this;return FS(this.configuration).getSignableCancelOrder(e.getSignableCancelOrderRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableCancelOrderV3",value:function(e,t){var r=this;return FS(this.configuration).getSignableCancelOrderV3(e.getSignableCancelOrderRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableOrder",value:function(e,t){var r=this;return FS(this.configuration).getSignableOrder(e.getSignableOrderRequestV3,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listOrders",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return FS(this.configuration).listOrders(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.updatedMinTimestamp,t.updatedMaxTimestamp,t.buyTokenType,t.buyTokenId,t.buyAssetId,t.buyTokenAddress,t.buyTokenName,t.buyMinQuantity,t.buyMaxQuantity,t.buyMetadata,t.sellTokenType,t.sellTokenId,t.sellAssetId,t.sellTokenAddress,t.sellTokenName,t.sellMinQuantity,t.sellMaxQuantity,t.sellMetadata,t.auxiliaryFeePercentages,t.auxiliaryFeeRecipients,t.includeFees,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"listOrdersV3",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return FS(this.configuration).listOrdersV3(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.updatedMinTimestamp,t.updatedMaxTimestamp,t.buyTokenType,t.buyTokenId,t.buyAssetId,t.buyTokenAddress,t.buyTokenName,t.buyMinQuantity,t.buyMaxQuantity,t.buyMetadata,t.sellTokenType,t.sellTokenId,t.sellAssetId,t.sellTokenAddress,t.sellTokenName,t.sellMinQuantity,t.sellMaxQuantity,t.sellMetadata,t.auxiliaryFeePercentages,t.auxiliaryFeeRecipients,t.includeFees,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function zS(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 KS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var HS=function(e){var t=function(e){return{createProject:(n=hA(yA.mark((function t(r,n,i){var o,s,a,u,c,f,d,h=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>3&&void 0!==h[3]?h[3]:{},WA("createProject","iMXSignature",r),WA("createProject","iMXTimestamp",n),WA("createProject","createProjectRequest",i),s=new URL("/v1/projects",GA),e&&(a=e.baseOptions),u=KS(KS({method:"POST"},a),o),c={},f={},null!=r&&(c["IMX-Signature"]=String(r)),null!=n&&(c["IMX-Timestamp"]=String(n)),c["Content-Type"]="application/json",XA(s,f),d=a&&a.headers?a.headers:{},u.headers=KS(KS(KS({},c),d),o.headers),u.data=JA(i,u,e),t.abrupt("return",{url:$A(s),options:u});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r){return n.apply(this,arguments)}),getProject:(r=hA(yA.mark((function t(r,n,i){var o,s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=l.length>3&&void 0!==l[3]?l[3]:{},WA("getProject","id",r),WA("getProject","iMXSignature",n),WA("getProject","iMXTimestamp",i),s="/v1/projects/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),a=new URL(s,GA),e&&(u=e.baseOptions),c=KS(KS({method:"GET"},u),o),f={},d={},null!=n&&(f["IMX-Signature"]=String(n)),null!=i&&(f["IMX-Timestamp"]=String(i)),XA(a,d),h=u&&u.headers?u.headers:{},c.headers=KS(KS(KS({},f),h),o.headers),t.abrupt("return",{url:$A(a),options:c});case 16:case"end":return t.stop()}}),t)}))),function(e,t,n){return r.apply(this,arguments)}),getProjects:(t=hA(yA.mark((function t(r,n,i,o,s,a){var u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=g.length>6&&void 0!==g[6]?g[6]:{},WA("getProjects","iMXSignature",r),WA("getProjects","iMXTimestamp",n),c=new URL("/v1/projects",GA),e&&(f=e.baseOptions),d=KS(KS({method:"GET"},f),u),h={},l={},void 0!==i&&(l.page_size=i),void 0!==o&&(l.cursor=o),void 0!==s&&(l.order_by=s),void 0!==a&&(l.direction=a),null!=r&&(h["IMX-Signature"]=String(r)),null!=n&&(h["IMX-Timestamp"]=String(n)),XA(c,l),p=f&&f.headers?f.headers:{},d.headers=KS(KS(KS({},h),p),u.headers),t.abrupt("return",{url:$A(c),options:d});case 19:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s){return t.apply(this,arguments)})};var t,r,n}(e);return{createProject:function(r,n,i,o){return hA(yA.mark((function s(){var a;return yA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.createProject(r,n,i,o);case 2:return a=s.sent,s.abrupt("return",YA(a,zE,FA,e));case 4:case"end":return s.stop()}}),s)})))()},getProject:function(r,n,i,o){return hA(yA.mark((function s(){var a;return yA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.getProject(r,n,i,o);case 2:return a=s.sent,s.abrupt("return",YA(a,zE,FA,e));case 4:case"end":return s.stop()}}),s)})))()},getProjects:function(r,n,i,o,s,a,u){return hA(yA.mark((function c(){var f;return yA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.getProjects(r,n,i,o,s,a,u);case 2:return f=c.sent,c.abrupt("return",YA(f,zE,FA,e));case 4:case"end":return c.stop()}}),c)})))()}}},GS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createProject",value:function(e,t){var r=this;return HS(this.configuration).createProject(e.iMXSignature,e.iMXTimestamp,e.createProjectRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getProject",value:function(e,t){var r=this;return HS(this.configuration).getProject(e.id,e.iMXSignature,e.iMXTimestamp,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getProjects",value:function(e,t){var r=this;return HS(this.configuration).getProjects(e.iMXSignature,e.iMXTimestamp,e.pageSize,e.cursor,e.orderBy,e.direction,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function WS(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 VS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?WS(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WS(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var XS=function(e){var t=function(e){return{getToken:(r=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getToken","address",r),i="/v1/tokens/{address}".replace("{".concat("address","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=VS(VS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=VS(VS(VS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listTokens:(t=hA(yA.mark((function t(r,n,i,o,s,a){var u,c,f,d,h,l,p,g=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=g.length>6&&void 0!==g[6]?g[6]:{},c=new URL("/v1/tokens",GA),e&&(f=e.baseOptions),d=VS(VS({method:"GET"},f),u),h={},l={},void 0!==r&&(l.page_size=r),void 0!==n&&(l.cursor=n),void 0!==i&&(l.order_by=i),void 0!==o&&(l.direction=o),void 0!==s&&(l.address=s),void 0!==a&&(l.symbols=a),XA(c,l),p=f&&f.headers?f.headers:{},d.headers=VS(VS(VS({},h),p),u.headers),t.abrupt("return",{url:$A(c),options:d});case 17:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s){return t.apply(this,arguments)})};var t,r}(e);return{getToken:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getToken(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listTokens:function(r,n,i,o,s,a,u){return hA(yA.mark((function c(){var f;return yA.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,t.listTokens(r,n,i,o,s,a,u);case 2:return f=c.sent,c.abrupt("return",YA(f,zE,FA,e));case 4:case"end":return c.stop()}}),c)})))()}}},JS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getToken",value:function(e,t){var r=this;return XS(this.configuration).getToken(e.address,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listTokens",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return XS(this.configuration).listTokens(t.pageSize,t.cursor,t.orderBy,t.direction,t.address,t.symbols,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function $S(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 YS(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$S(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var QS=function(e){var t=function(e){return{createTrade:(s=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("createTrade","createTradeRequest",r),a=new URL("/v1/trades",GA),e&&(u=e.baseOptions),c=YS(YS({method:"POST"},u),s),f={},d={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=o&&(f.Authorization=String(o)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=YS(YS(YS({},f),h),s.headers),c.data=JA(r,c,e),t.abrupt("return",{url:$A(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return s.apply(this,arguments)}),createTradeV3:(o=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("createTradeV3","createTradeRequest",r),a=new URL("/v3/trades",GA),e&&(u=e.baseOptions),c=YS(YS({method:"POST"},u),s),f={},d={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=o&&(f.Authorization=String(o)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=YS(YS(YS({},f),h),s.headers),c.data=JA(r,c,e),t.abrupt("return",{url:$A(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return o.apply(this,arguments)}),getSignableTrade:(i=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableTrade","getSignableTradeRequest",r),i=new URL("/v3/signable-trade-details",GA),e&&(o=e.baseOptions),s=YS(YS({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=YS(YS(YS({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getTrade:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getTrade","id",r),i="/v1/trades/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=YS(YS({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=YS(YS(YS({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),listTrades:(r=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h){var l,p,g,m,y,b,v,w=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=w.length>11&&void 0!==w[11]?w[11]:{},p=new URL("/v1/trades",GA),e&&(g=e.baseOptions),m=YS(YS({method:"GET"},g),l),y={},b={},void 0!==r&&(b.party_a_token_type=r),void 0!==n&&(b.party_a_token_address=n),void 0!==i&&(b.party_b_token_type=i),void 0!==o&&(b.party_b_token_address=o),void 0!==s&&(b.party_b_token_id=s),void 0!==a&&(b.page_size=a),void 0!==u&&(b.cursor=u),void 0!==c&&(b.order_by=c),void 0!==f&&(b.direction=f),void 0!==d&&(b.min_timestamp=d),void 0!==h&&(b.max_timestamp=h),XA(p,b),v=g&&g.headers?g.headers:{},m.headers=YS(YS(YS({},y),v),l.headers),t.abrupt("return",{url:$A(p),options:m});case 22:case"end":return t.stop()}}),t)}))),function(e,t,n,i,o,s,a,u,c,f,d){return r.apply(this,arguments)}),listTradesV3:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h){var l,p,g,m,y,b,v,w=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=w.length>11&&void 0!==w[11]?w[11]:{},p=new URL("/v3/trades",GA),e&&(g=e.baseOptions),m=YS(YS({method:"GET"},g),l),y={},b={},void 0!==r&&(b.party_a_token_type=r),void 0!==n&&(b.party_a_token_address=n),void 0!==i&&(b.party_b_token_type=i),void 0!==o&&(b.party_b_token_address=o),void 0!==s&&(b.party_b_token_id=s),void 0!==a&&(b.page_size=a),void 0!==u&&(b.cursor=u),void 0!==c&&(b.order_by=c),void 0!==f&&(b.direction=f),void 0!==d&&(b.min_timestamp=d),void 0!==h&&(b.max_timestamp=h),XA(p,b),v=g&&g.headers?g.headers:{},m.headers=YS(YS(YS({},y),v),l.headers),t.abrupt("return",{url:$A(p),options:m});case 22:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c,f,d){return t.apply(this,arguments)})};var t,r,n,i,o,s}(e);return{createTrade:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTrade(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},createTradeV3:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTradeV3(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},getSignableTrade:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableTrade(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getTrade:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getTrade(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listTrades:function(r,n,i,o,s,a,u,c,f,d,h,l){return hA(yA.mark((function p(){var g;return yA.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,t.listTrades(r,n,i,o,s,a,u,c,f,d,h,l);case 2:return g=p.sent,p.abrupt("return",YA(g,zE,FA,e));case 4:case"end":return p.stop()}}),p)})))()},listTradesV3:function(r,n,i,o,s,a,u,c,f,d,h,l){return hA(yA.mark((function p(){var g;return yA.wrap((function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,t.listTradesV3(r,n,i,o,s,a,u,c,f,d,h,l);case 2:return g=p.sent,p.abrupt("return",YA(g,zE,FA,e));case 4:case"end":return p.stop()}}),p)})))()}}},ZS=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createTrade",value:function(e,t){var r=this;return QS(this.configuration).createTrade(e.createTradeRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createTradeV3",value:function(e,t){var r=this;return QS(this.configuration).createTradeV3(e.createTradeRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableTrade",value:function(e,t){var r=this;return QS(this.configuration).getSignableTrade(e.getSignableTradeRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getTrade",value:function(e,t){var r=this;return QS(this.configuration).getTrade(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listTrades",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return QS(this.configuration).listTrades(t.partyATokenType,t.partyATokenAddress,t.partyBTokenType,t.partyBTokenAddress,t.partyBTokenId,t.pageSize,t.cursor,t.orderBy,t.direction,t.minTimestamp,t.maxTimestamp,r).then((function(t){return t(e.axios,e.basePath)}))}},{key:"listTradesV3",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return QS(this.configuration).listTradesV3(t.partyATokenType,t.partyATokenAddress,t.partyBTokenType,t.partyBTokenAddress,t.partyBTokenId,t.pageSize,t.cursor,t.orderBy,t.direction,t.minTimestamp,t.maxTimestamp,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function ek(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 tk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ek(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ek(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var rk=function(e){var t=function(e){return{createTransfer:(s=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("createTransfer","createTransferRequestV2",r),a=new URL("/v2/transfers",GA),e&&(u=e.baseOptions),c=tk(tk({method:"POST"},u),s),f={},d={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=o&&(f.Authorization=String(o)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=tk(tk(tk({},f),h),s.headers),c.data=JA(r,c,e),t.abrupt("return",{url:$A(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return s.apply(this,arguments)}),createTransferV1:(o=hA(yA.mark((function t(r,n,i,o){var s,a,u,c,f,d,h,l=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s=l.length>4&&void 0!==l[4]?l[4]:{},WA("createTransferV1","createTransferRequest",r),a=new URL("/v1/transfers",GA),e&&(u=e.baseOptions),c=tk(tk({method:"POST"},u),s),f={},d={},null!=n&&(f["x-imx-eth-address"]=String(n)),null!=i&&(f["x-imx-eth-signature"]=String(i)),null!=o&&(f.Authorization=String(o)),f["Content-Type"]="application/json",XA(a,d),h=u&&u.headers?u.headers:{},c.headers=tk(tk(tk({},f),h),s.headers),c.data=JA(r,c,e),t.abrupt("return",{url:$A(a),options:c});case 17:case"end":return t.stop()}}),t)}))),function(e,t,r,n){return o.apply(this,arguments)}),getSignableTransfer:(i=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableTransfer","getSignableTransferRequestV2",r),i=new URL("/v2/signable-transfer-details",GA),e&&(o=e.baseOptions),s=tk(tk({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=tk(tk(tk({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getSignableTransferV1:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableTransferV1","getSignableTransferRequest",r),i=new URL("/v1/signable-transfer-details",GA),e&&(o=e.baseOptions),s=tk(tk({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=tk(tk(tk({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getTransfer:(r=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getTransfer","id",r),i="/v1/transfers/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=tk(tk({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=tk(tk(tk({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listTransfers:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b){var v,w,_,E,A,S,k,x=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return v=x.length>17&&void 0!==x[17]?x[17]:{},w=new URL("/v1/transfers",GA),e&&(_=e.baseOptions),E=tk(tk({method:"GET"},_),v),A={},S={},void 0!==r&&(S.page_size=r),void 0!==n&&(S.cursor=n),void 0!==i&&(S.order_by=i),void 0!==o&&(S.direction=o),void 0!==s&&(S.user=s),void 0!==a&&(S.receiver=a),void 0!==u&&(S.status=u),void 0!==c&&(S.min_timestamp=c),void 0!==f&&(S.max_timestamp=f),void 0!==d&&(S.token_type=d),void 0!==h&&(S.token_id=h),void 0!==l&&(S.asset_id=l),void 0!==p&&(S.token_address=p),void 0!==g&&(S.token_name=g),void 0!==m&&(S.min_quantity=m),void 0!==y&&(S.max_quantity=y),void 0!==b&&(S.metadata=b),XA(w,S),k=_&&_.headers?_.headers:{},E.headers=tk(tk(tk({},A),k),v.headers),t.abrupt("return",{url:$A(w),options:E});case 28:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y){return t.apply(this,arguments)})};var t,r,n,i,o,s}(e);return{createTransfer:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTransfer(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},createTransferV1:function(r,n,i,o,s){return hA(yA.mark((function a(){var u;return yA.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,t.createTransferV1(r,n,i,o,s);case 2:return u=a.sent,a.abrupt("return",YA(u,zE,FA,e));case 4:case"end":return a.stop()}}),a)})))()},getSignableTransfer:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableTransfer(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableTransferV1:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableTransferV1(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getTransfer:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getTransfer(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listTransfers:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v){return hA(yA.mark((function w(){var _;return yA.wrap((function(w){for(;;)switch(w.prev=w.next){case 0:return w.next=2,t.listTransfers(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v);case 2:return _=w.sent,w.abrupt("return",YA(_,zE,FA,e));case 4:case"end":return w.stop()}}),w)})))()}}},nk=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createTransfer",value:function(e,t){var r=this;return rk(this.configuration).createTransfer(e.createTransferRequestV2,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"createTransferV1",value:function(e,t){var r=this;return rk(this.configuration).createTransferV1(e.createTransferRequest,e.xImxEthAddress,e.xImxEthSignature,e.authorization,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableTransfer",value:function(e,t){var r=this;return rk(this.configuration).getSignableTransfer(e.getSignableTransferRequestV2,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableTransferV1",value:function(e,t){var r=this;return rk(this.configuration).getSignableTransferV1(e.getSignableTransferRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getTransfer",value:function(e,t){var r=this;return rk(this.configuration).getTransfer(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listTransfers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return rk(this.configuration).listTransfers(t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.receiver,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.assetId,t.tokenAddress,t.tokenName,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}();function ik(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 ok(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ik(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ik(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var sk=function(e){var t=function(e){return{getSignableRegistration:(o=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableRegistration","getSignableRegistrationRequest",r),i=new URL("/v1/signable-registration",GA),e&&(o=e.baseOptions),s=ok(ok({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=ok(ok(ok({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return o.apply(this,arguments)}),getSignableRegistrationOffchain:(i=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableRegistrationOffchain","getSignableRegistrationRequest",r),i=new URL("/v1/signable-registration-offchain",GA),e&&(o=e.baseOptions),s=ok(ok({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=ok(ok(ok({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return i.apply(this,arguments)}),getUsers:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getUsers","user",r),i="/v1/users/{user}".replace("{".concat("user","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=ok(ok({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=ok(ok(ok({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),registerPassportUser:(r=hA(yA.mark((function t(r,n){var i,o,s,a,u,c,f,d=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=d.length>2&&void 0!==d[2]?d[2]:{},WA("registerPassportUser","authorization",r),WA("registerPassportUser","registerPassportUserRequest",n),o=new URL("/v1/passport/users",GA),e&&(s=e.baseOptions),a=ok(ok({method:"POST"},s),i),u={},c={},null!=r&&(u.Authorization=String(r)),u["Content-Type"]="application/json",XA(o,c),f=s&&s.headers?s.headers:{},a.headers=ok(ok(ok({},u),f),i.headers),a.data=JA(n,a,e),t.abrupt("return",{url:$A(o),options:a});case 16:case"end":return t.stop()}}),t)}))),function(e,t){return r.apply(this,arguments)}),registerUser:(t=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("registerUser","registerUserRequest",r),i=new URL("/v1/users",GA),e&&(o=e.baseOptions),s=ok(ok({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=ok(ok(ok({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return t.apply(this,arguments)})};var t,r,n,i,o}(e);return{getSignableRegistration:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableRegistration(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getSignableRegistrationOffchain:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableRegistrationOffchain(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getUsers:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getUsers(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},registerPassportUser:function(r,n,i){return hA(yA.mark((function o(){var s;return yA.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t.registerPassportUser(r,n,i);case 2:return s=o.sent,o.abrupt("return",YA(s,zE,FA,e));case 4:case"end":return o.stop()}}),o)})))()},registerUser:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.registerUser(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()}}},ak=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"getSignableRegistration",value:function(e,t){var r=this;return sk(this.configuration).getSignableRegistration(e.getSignableRegistrationRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableRegistrationOffchain",value:function(e,t){var r=this;return sk(this.configuration).getSignableRegistrationOffchain(e.getSignableRegistrationRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getUsers",value:function(e,t){var r=this;return sk(this.configuration).getUsers(e.user,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"registerPassportUser",value:function(e,t){var r=this;return sk(this.configuration).registerPassportUser(e.authorization,e.registerPassportUserRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"registerUser",value:function(e,t){var r=this;return sk(this.configuration).registerUser(e.registerUserRequest,t).then((function(e){return e(r.axios,r.basePath)}))}}]),r}();function uk(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 ck(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?uk(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var fk=function(e){var t=function(e){return{createWithdrawal:(i=hA(yA.mark((function t(r,n,i){var o,s,a,u,c,f,d,h=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=h.length>3&&void 0!==h[3]?h[3]:{},WA("createWithdrawal","xImxEthAddress",r),WA("createWithdrawal","xImxEthSignature",n),WA("createWithdrawal","createWithdrawalRequest",i),s=new URL("/v1/withdrawals",GA),e&&(a=e.baseOptions),u=ck(ck({method:"POST"},a),o),c={},f={},null!=r&&(c["x-imx-eth-address"]=String(r)),null!=n&&(c["x-imx-eth-signature"]=String(n)),c["Content-Type"]="application/json",XA(s,f),d=a&&a.headers?a.headers:{},u.headers=ck(ck(ck({},c),d),o.headers),u.data=JA(i,u,e),t.abrupt("return",{url:$A(s),options:u});case 18:case"end":return t.stop()}}),t)}))),function(e,t,r){return i.apply(this,arguments)}),getSignableWithdrawal:(n=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getSignableWithdrawal","getSignableWithdrawalRequest",r),i=new URL("/v1/signable-withdrawal-details",GA),e&&(o=e.baseOptions),s=ck(ck({method:"POST"},o),n),u={},(a={})["Content-Type"]="application/json",XA(i,u),c=o&&o.headers?o.headers:{},s.headers=ck(ck(ck({},a),c),n.headers),s.data=JA(r,s,e),t.abrupt("return",{url:$A(i),options:s});case 14:case"end":return t.stop()}}),t)}))),function(e){return n.apply(this,arguments)}),getWithdrawal:(r=hA(yA.mark((function t(r){var n,i,o,s,a,u,c,f=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=f.length>1&&void 0!==f[1]?f[1]:{},WA("getWithdrawal","id",r),i="/v1/withdrawals/{id}".replace("{".concat("id","}"),encodeURIComponent(String(r))),o=new URL(i,GA),e&&(s=e.baseOptions),a=ck(ck({method:"GET"},s),n),u={},XA(o,{}),c=s&&s.headers?s.headers:{},a.headers=ck(ck(ck({},u),c),n.headers),t.abrupt("return",{url:$A(o),options:a});case 12:case"end":return t.stop()}}),t)}))),function(e){return r.apply(this,arguments)}),listWithdrawals:(t=hA(yA.mark((function t(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v){var w,_,E,A,S,k,x,T=arguments;return yA.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return w=T.length>18&&void 0!==T[18]?T[18]:{},_=new URL("/v1/withdrawals",GA),e&&(E=e.baseOptions),A=ck(ck({method:"GET"},E),w),S={},k={},void 0!==r&&(k.withdrawn_to_wallet=r),void 0!==n&&(k.rollup_status=n),void 0!==i&&(k.page_size=i),void 0!==o&&(k.cursor=o),void 0!==s&&(k.order_by=s),void 0!==a&&(k.direction=a),void 0!==u&&(k.user=u),void 0!==c&&(k.status=c),void 0!==f&&(k.min_timestamp=f),void 0!==d&&(k.max_timestamp=d),void 0!==h&&(k.token_type=h),void 0!==l&&(k.token_id=l),void 0!==p&&(k.asset_id=p),void 0!==g&&(k.token_address=g),void 0!==m&&(k.token_name=m),void 0!==y&&(k.min_quantity=y),void 0!==b&&(k.max_quantity=b),void 0!==v&&(k.metadata=v),XA(_,k),x=E&&E.headers?E.headers:{},A.headers=ck(ck(ck({},S),x),w.headers),t.abrupt("return",{url:$A(_),options:A});case 29:case"end":return t.stop()}}),t)}))),function(e,r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b){return t.apply(this,arguments)})};var t,r,n,i}(e);return{createWithdrawal:function(r,n,i,o){return hA(yA.mark((function s(){var a;return yA.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,t.createWithdrawal(r,n,i,o);case 2:return a=s.sent,s.abrupt("return",YA(a,zE,FA,e));case 4:case"end":return s.stop()}}),s)})))()},getSignableWithdrawal:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getSignableWithdrawal(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},getWithdrawal:function(r,n){return hA(yA.mark((function i(){var o;return yA.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,t.getWithdrawal(r,n);case 2:return o=i.sent,i.abrupt("return",YA(o,zE,FA,e));case 4:case"end":return i.stop()}}),i)})))()},listWithdrawals:function(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w){return hA(yA.mark((function _(){var E;return yA.wrap((function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,t.listWithdrawals(r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w);case 2:return E=_.sent,_.abrupt("return",YA(E,zE,FA,e));case 4:case"end":return _.stop()}}),_)})))()}}},dk=function(e){nA(r,qA);var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(){return KE(this,r),t.apply(this,arguments)}return GE(r,[{key:"createWithdrawal",value:function(e,t){var r=this;return fk(this.configuration).createWithdrawal(e.xImxEthAddress,e.xImxEthSignature,e.createWithdrawalRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getSignableWithdrawal",value:function(e,t){var r=this;return fk(this.configuration).getSignableWithdrawal(e.getSignableWithdrawalRequest,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"getWithdrawal",value:function(e,t){var r=this;return fk(this.configuration).getWithdrawal(e.id,t).then((function(e){return e(r.axios,r.basePath)}))}},{key:"listWithdrawals",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return fk(this.configuration).listWithdrawals(t.withdrawnToWallet,t.rollupStatus,t.pageSize,t.cursor,t.orderBy,t.direction,t.user,t.status,t.minTimestamp,t.maxTimestamp,t.tokenType,t.tokenId,t.assetId,t.tokenAddress,t.tokenName,t.minQuantity,t.maxQuantity,t.metadata,r).then((function(t){return t(e.axios,e.basePath)}))}}]),r}(),hk=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};KE(this,e),this.apiKey=t.apiKey,this.username=t.username,this.password=t.password,this.accessToken=t.accessToken,this.basePath=t.basePath,this.baseOptions=t.baseOptions,this.formDataCtor=t.formDataCtor}return GE(e,[{key:"isJsonMime",value:function(e){var t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}]),e}();let lk=!1,pk=!1;const gk={debug:1,default:2,info:2,warning:3,error:4,off:5};let mk=gk.default,yk=null;const bk=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 vk,wk;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(vk||(vk={})),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"}(wk||(wk={}));const _k="0123456789abcdef";class Ek{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==gk[r]&&this.throwArgumentError("invalid log level name","logLevel",e),mk>gk[r]||console.log.apply(console,t)}debug(...e){this._log(Ek.levels.DEBUG,e)}info(...e){this._log(Ek.levels.INFO,e)}warn(...e){this._log(Ek.levels.WARNING,e)}makeError(e,t,r){if(pk)return this.makeError("censored error",t,{});t||(t=Ek.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<t.length;e++)r+=_k[t[e]>>4],r+=_k[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 wk.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 wk.CALL_EXCEPTION:case wk.INSUFFICIENT_FUNDS:case wk.MISSING_NEW:case wk.NONCE_EXPIRED:case wk.REPLACEMENT_UNDERPRICED:case wk.TRANSACTION_REPLACED:case wk.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const s=new Error(e);return s.reason=i,s.code=t,Object.keys(r).forEach((function(e){s[e]=r[e]})),s}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Ek.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){bk&&this.throwError("platform missing String.prototype.normalize",Ek.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:bk})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Ek.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Ek.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,Ek.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,Ek.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",Ek.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",Ek.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",Ek.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return yk||(yk=new Ek("logger/5.7.0")),yk}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Ek.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),lk){if(!e)return;this.globalLogger().throwError("error censorship permanent",Ek.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}pk=!!e,lk=!!t}static setLogLevel(e){const t=gk[e.toLowerCase()];null!=t?mk=t:Ek.globalLogger().warn("invalid log level - "+e)}static from(e){return new Ek(e)}}Ek.errors=wk,Ek.levels=vk,Ek.errors.INSUFFICIENT_FUNDS,Ek.errors.NONCE_EXPIRED,Ek.errors.REPLACEMENT_UNDERPRICED;var Ak=function(e){nA(r,DA(Error));var t=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=eA(e);if(t){var i=eA(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sA(this,r)}}(r);function r(e){var n,i=e.code,o=e.details,s=e.message;return KE(this,r),(n=t.call(this,s)).code=i,n.details=o,n}return GE(r)}();function Sk(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 kk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sk(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sk(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var xk={"x-sdk-version":"imx-core-sdk-ts-".concat("1.1.0")},Tk=function(e){var t=e.coreContractAddress,r=e.registrationContractAddress,n=e.chainID,i=e.basePath,o=e.headers,s=e.sdkVersion;if(!i.trim())throw Error("basePath can not be empty");return s&&(xk["x-sdk-version"]=s),o=kk(kk({},o||{}),xk),{apiConfiguration:new hk({basePath:i,baseOptions:{headers:o}}),ethConfiguration:{coreContractAddress:t,registrationContractAddress:r,chainID:n}}},Rk={get PRODUCTION(){return Tk({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"})},get SANDBOX(){return Tk({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"})},createConfig:Tk};function Ok(e){return Mk.apply(this,arguments)}function Mk(){return(Mk=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.usersApi,e.next=3,r.getAddress();case 3:return o=e.sent,e.next=6,n.getAddress();case 6:return s=e.sent,e.next=9,i.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:o,stark_key:s}});case 9:return a=e.sent,u=a.data,c=u.signable_message,f=u.payload_hash,e.next=13,_A(c,r);case 13:return d=e.sent,e.next=16,n.signMessage(f);case 16:return h=e.sent,e.next=19,i.registerUser({registerUserRequest:{eth_signature:d,ether_key:o,stark_signature:h,stark_key:s}});case 19:return l=e.sent,e.abrupt("return",l.data);case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ik(e,t){return Pk.apply(this,arguments)}function Pk(){return(Pk=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.isRegistered(t);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),"USER_UNREGISTERED"!==e.t0.reason){e.next=10;break}return e.abrupt("return",!1);case 10:throw e.t0;case 11:case"end":return e.stop()}}),e,null,[[0,6]])})))).apply(this,arguments)}function Ck(e,t,r){return Nk.apply(this,arguments)}function Nk(){return(Nk=hA(yA.mark((function e(t,r,n){var i;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getSignableRegistration({getSignableRegistrationRequest:{ether_key:t,stark_key:r}});case 2:return i=e.sent,e.abrupt("return",{operator_signature:i.data.operator_signature,payload_hash:i.data.payload_hash});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Bk,jk={exports:{}};
|
|
24
|
+
/**
|
|
25
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
26
|
+
*
|
|
27
|
+
* @version 0.8.0
|
|
28
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
29
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
30
|
+
* @license MIT
|
|
31
|
+
*/Bk=jk,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 process&&process.versions&&process.versions.node?r=lA:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&Bk.exports,o=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),a=[4,1024,262144,67108864],u=[0,8,16,24],c=[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],f=[224,256,384,512],d=[128,256],h=["hex","buffer","arrayBuffer","array","digest"],l={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 O(e,t,e).update(n)[r]()}},g=function(e,t,r){return function(n,i){return new O(e,t,i).update(n)[r]()}},m=function(e,t,r){return function(t,n,i,o){return _["cshake"+e].update(t,n,i,o)[r]()}},y=function(e,t,r){return function(t,n,i,o){return _["kmac"+e].update(t,n,i,o)[r]()}},b=function(e,t,r,n){for(var i=0;i<h.length;++i){var o=h[i];e[o]=t(r,n,o)}return e},v=function(e,t){var r=p(e,t,"hex");return r.create=function(){return new O(e,t,e)},r.update=function(e){return r.create().update(e)},b(r,p,e,t)},w=[{name:"keccak",padding:[1,256,65536,16777216],bits:f,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:f,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(e,t){var r=g(e,t,"hex");return r.create=function(r){return new O(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},b(r,g,e,t)}},{name:"cshake",padding:a,bits:d,createMethod:function(e,t){var r=l[e],n=m(e,0,"hex");return n.create=function(n,i,o){return i||o?new O(e,t,n).bytepad([i,o],r):_["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},b(n,m,e,t)}},{name:"kmac",padding:a,bits:d,createMethod:function(e,t){var r=l[e],n=y(e,0,"hex");return n.create=function(n,i,o){return new M(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},b(n,y,e,t)}}],_={},E=[],A=0;A<w.length;++A)for(var S=w[A],k=S.bits,x=0;x<k.length;++x){var T=S.name+"_"+k[x];if(E.push(T),_[T]=S.createMethod(k[x],S.padding),"sha3"!==S.name){var R=S.name+k[x];E.push(R),_[R]=_[T]}}function O(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function M(e,t,r){O.call(this,e,t,r)}O.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,s,a=this.blocks,c=this.byteCount,f=t.length,d=this.blockCount,h=0,l=this.s;h<f;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<d+1;++i)a[i]=0;if(r)for(i=this.start;h<f&&i<c;++h)a[i>>2]|=t[h]<<u[3&i++];else for(i=this.start;h<f&&i<c;++h)(s=t.charCodeAt(h))<128?a[i>>2]|=s<<u[3&i++]:s<2048?(a[i>>2]|=(192|s>>6)<<u[3&i++],a[i>>2]|=(128|63&s)<<u[3&i++]):s<55296||s>=57344?(a[i>>2]|=(224|s>>12)<<u[3&i++],a[i>>2]|=(128|s>>6&63)<<u[3&i++],a[i>>2]|=(128|63&s)<<u[3&i++]):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++h)),a[i>>2]|=(240|s>>18)<<u[3&i++],a[i>>2]|=(128|s>>12&63)<<u[3&i++],a[i>>2]|=(128|s>>6&63)<<u[3&i++],a[i>>2]|=(128|63&s)<<u[3&i++]);if(this.lastByteIndex=i,i>=c){for(this.start=i-c,this.block=a[d],i=0;i<d;++i)l[i]^=a[i];I(l),this.reset=!0}else this.start=i}return this},O.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},O.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,s=t.length;if(r)i=s;else for(var a=0;a<t.length;++a){var u=t.charCodeAt(a);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},O.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,o=[];return o.length=i,this.update(o),this},O.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];I(n)}},O.prototype.toString=O.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<n;){for(o=0;o<t&&a<n;++o,++a)e=r[o],u+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(I(r),o=0)}return i&&(e=r[o],u+=s[e>>4&15]+s[15&e],i>1&&(u+=s[e>>12&15]+s[e>>8&15]),i>2&&(u+=s[e>>20&15]+s[e>>16&15])),u},O.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)u[s]=r[o];s%t==0&&I(r)}return i&&(u[o]=r[o],e=e.slice(0,a)),e},O.prototype.buffer=O.prototype.arrayBuffer,O.prototype.digest=O.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,u=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%r==0&&I(n)}return o&&(e=a<<2,t=n[s],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},M.prototype=new O,M.prototype.finalize=function(){return this.encode(this.outputBits,!0),O.prototype.finalize.call(this)};var I=function(e){var t,r,n,i,o,s,a,u,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R,O,M,I,P,C,N,B,j,L,U,D,F,q,z,K,H,G,W,V,X,J,$,Y,Q,Z,ee,te,re,ne,ie,oe,se,ae,ue,ce,fe;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],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(l=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>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^(u<<1|f>>>31),r=o^(f<<1|u>>>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=s^(d<<1|h>>>31),r=a^(h<<1|d>>>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=u^(l<<1|p>>>31),r=f^(p<<1|l>>>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=d^(i<<1|o>>>31),r=h^(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,g=e[0],m=e[1],V=e[11]<<4|e[10]>>>28,X=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,M=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,j=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,$=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,P=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,fe=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,Q=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,D=e[26]<<25|e[27]>>>7,F=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,E=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,W=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,q=e[38]<<8|e[39]>>>24,z=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=g^~y&v,e[1]=m^~b&w,e[10]=k^~T&O,e[11]=x^~R&M,e[20]=B^~L&D,e[21]=j^~U&F,e[30]=G^~V&J,e[31]=W^~X&$,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=y^~v&_,e[3]=b^~w&E,e[12]=T^~O&I,e[13]=R^~M&P,e[22]=L^~D&q,e[23]=U^~F&z,e[32]=V^~J&Y,e[33]=X^~$&Q,e[42]=ne^~oe&ae,e[43]=ie^~se&ue,e[4]=v^~_&A,e[5]=w^~E&S,e[14]=O^~I&C,e[15]=M^~P&N,e[24]=D^~q&K,e[25]=F^~z&H,e[34]=J^~Y&Z,e[35]=$^~Q&ee,e[44]=oe^~ae&ce,e[45]=se^~ue&fe,e[6]=_^~A&g,e[7]=E^~S&m,e[16]=I^~C&k,e[17]=P^~N&x,e[26]=q^~K&B,e[27]=z^~H&j,e[36]=Y^~Z&G,e[37]=Q^~ee&W,e[46]=ae^~ce&te,e[47]=ue^~fe&re,e[8]=A^~g&y,e[9]=S^~m&b,e[18]=C^~k&T,e[19]=N^~x&R,e[28]=K^~B&L,e[29]=H^~j&U,e[38]=Z^~G&V,e[39]=ee^~W&X,e[48]=ce^~te&ne,e[49]=fe^~re&ie,e[0]^=c[n],e[1]^=c[n+1]};if(i)Bk.exports=_;else for(A=0;A<E.length;++A)r[E[A]]=_[E[A]]}();var Lk=jk.exports;function Uk(e){return"0x"+Lk.keccak_256(ke(e))}var Dk=ue.BN;const Fk=new Ek("bignumber/5.7.0"),qk={};let zk=!1;class Kk{constructor(e,t){e!==qk&&Fk.throwError("cannot call constructor directly; use BigNumber.from",Ek.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Gk(Wk(this).fromTwos(e))}toTwos(e){return Gk(Wk(this).toTwos(e))}abs(){return"-"===this._hex[0]?Kk.from(this._hex.substring(1)):this}add(e){return Gk(Wk(this).add(Wk(e)))}sub(e){return Gk(Wk(this).sub(Wk(e)))}div(e){return Kk.from(e).isZero()&&Vk("division-by-zero","div"),Gk(Wk(this).div(Wk(e)))}mul(e){return Gk(Wk(this).mul(Wk(e)))}mod(e){const t=Wk(e);return t.isNeg()&&Vk("division-by-zero","mod"),Gk(Wk(this).umod(t))}pow(e){const t=Wk(e);return t.isNeg()&&Vk("negative-power","pow"),Gk(Wk(this).pow(t))}and(e){const t=Wk(e);return(this.isNegative()||t.isNeg())&&Vk("unbound-bitwise-result","and"),Gk(Wk(this).and(t))}or(e){const t=Wk(e);return(this.isNegative()||t.isNeg())&&Vk("unbound-bitwise-result","or"),Gk(Wk(this).or(t))}xor(e){const t=Wk(e);return(this.isNegative()||t.isNeg())&&Vk("unbound-bitwise-result","xor"),Gk(Wk(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Vk("negative-width","mask"),Gk(Wk(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Vk("negative-width","shl"),Gk(Wk(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Vk("negative-width","shr"),Gk(Wk(this).shrn(e))}eq(e){return Wk(this).eq(Wk(e))}lt(e){return Wk(this).lt(Wk(e))}lte(e){return Wk(this).lte(Wk(e))}gt(e){return Wk(this).gt(Wk(e))}gte(e){return Wk(this).gte(Wk(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Wk(this).isZero()}toNumber(){try{return Wk(this).toNumber()}catch(e){Vk("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Fk.throwError("this platform does not support BigInt",Ek.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?zk||(zk=!0,Fk.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Fk.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ek.errors.UNEXPECTED_ARGUMENT,{}):Fk.throwError("BigNumber.toString does not accept parameters",Ek.errors.UNEXPECTED_ARGUMENT,{})),Wk(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Kk)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new Kk(qk,Hk(e)):e.match(/^-?[0-9]+$/)?new Kk(qk,Hk(new Dk(e))):Fk.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Vk("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&Vk("overflow","BigNumber.from",e),Kk.from(String(e));const t=e;if("bigint"==typeof t)return Kk.from(t.toString());if(Se(t))return Kk.from(Me(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return Kk.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(Re(e)||"-"===e[0]&&Re(e.substring(1))))return Kk.from(e)}return Fk.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Hk(e){if("string"!=typeof e)return Hk(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Fk.throwArgumentError("invalid hex","value",e),"0x00"===(e=Hk(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 Gk(e){return Kk.from(Hk(e))}function Wk(e){const t=Kk.from(e).toHexString();return"-"===t[0]?new Dk("-"+t.substring(3),16):new Dk(t.substring(2),16)}function Vk(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Fk.throwError(e,Ek.errors.NUMERIC_FAULT,n)}const Xk=new Ek("bignumber/5.7.0"),Jk={},$k=Kk.from(0),Yk=Kk.from(-1);function Qk(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),Xk.throwError(e,Ek.errors.NUMERIC_FAULT,i)}let Zk="0";for(;Zk.length<256;)Zk+=Zk;function ex(e){if("number"!=typeof e)try{e=Kk.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Zk.substring(0,e):Xk.throwArgumentError("invalid decimal size","decimals",e)}function tx(e,t){null==t&&(t=0);const r=ex(t),n=(e=Kk.from(e)).lt($k);n&&(e=e.mul(Yk));let i=e.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=e.div(r).toString();return e=1===r.length?o:o+"."+i,n&&(e="-"+e),e}function rx(e,t){null==t&&(t=0);const r=ex(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||Xk.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Xk.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&Xk.throwArgumentError("too many decimal points","value",e);let o=i[0],s=i[1];for(o||(o="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Qk("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=Kk.from(o),u=Kk.from(s);let c=a.mul(r).add(u);return n&&(c=c.mul(Yk)),c}class nx{constructor(e,t,r,n){e!==Jk&&Xk.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ek.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=ex(n),Object.freeze(this)}static from(e){if(e instanceof nx)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||Xk.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=(t,r,n)=>null==e[t]?n:(typeof e[t]!==r&&Xk.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&&Xk.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&Xk.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new nx(Jk,t,r,n)}}class ix{constructor(e,t,r,n){e!==Jk&&Xk.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ek.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&&Xk.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=rx(this._value,this.format.decimals),r=rx(e._value,e.format.decimals);return ix.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=rx(this._value,this.format.decimals),r=rx(e._value,e.format.decimals);return ix.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=rx(this._value,this.format.decimals),r=rx(e._value,e.format.decimals);return ix.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=rx(this._value,this.format.decimals),r=rx(e._value,e.format.decimals);return ix.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=ix.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(ox.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=ix.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(ox.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)&&Xk.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=ix.from("1"+Zk.substring(0,e),this.format),n=sx.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&&Xk.throwArgumentError("invalid byte width","width",e);return Be(Kk.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return ix.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(Kk.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Re(e)||"bigint"==typeof e||Se(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),ix.fromString(tx(e,t),nx.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=nx.from(t),n=rx(e,r.decimals);!r.signed&&n.lt($k)&&Qk("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=Be(i,r.width/8));const o=tx(n,r.decimals);return new ix(Jk,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=nx.from(t);if(ke(e).length>r.width/8)throw new Error("overflow");let n=Kk.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=tx(n,r.decimals);return new ix(Jk,i,o,r)}static from(e,t){if("string"==typeof e)return ix.fromString(e,t);if(Se(e))return ix.fromBytes(e,t);try{return ix.fromValue(e,0,t)}catch(e){if(e.code!==Ek.errors.INVALID_ARGUMENT)throw e}return Xk.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const ox=ix.from(1),sx=ix.from("0.5"),ax=new Ek("strings/5.7.0");var ux,cx;function fx(e,t=ux.current){t!=ux.current&&(ax.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>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 ke(r)}function dx(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 hx(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 lx(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 px(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lx(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lx(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function gx(e,t,r){return mx.apply(this,arguments)}function mx(){return mx=hA(yA.mark((function e(t,r,n){var i,o,s,a,u,c,f,d;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.users.map((function(e){return{ether_key:e.user,tokens:e.tokens.map((function(e){return px({id:e.id,blueprint:e.blueprint},e.royalties&&e.royalties.length>0&&{royalties:e.royalties.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))})}))}})),o=r.royalties,s=px(px({contract_address:r.contract_address},o&&o.length>0&&{royalties:o.map((function(e){return{recipient:e.recipient,percentage:e.percentage}}))}),{},{users:i,auth_signature:""}),a=Uk(fx(JSON.stringify(s))),e.next=6,_A(a,t);case 6:return u=e.sent,c=px(px({users:s.users.map((function(e){return{user:e.ether_key,tokens:e.tokens}}))},o&&o.length>0&&{royalties:o}),{},{contract_address:r.contract_address,auth_signature:u}),f={mintTokensRequestV2:[c]},e.next=11,n.mintTokens(f);case 11:return d=e.sent,e.abrupt("return",d.data);case 13:case"end":return e.stop()}}),e)}))),mx.apply(this,arguments)}function yx(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};case"ETH":return{type:"ETH",data:{decimals:18}}}}function bx(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return vx(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vx(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function vx(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function wx(e){return _x.apply(this,arguments)}function _x(){return(_x=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l,p,g,m;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,o=t.request,s=t.transfersApi,e.next=3,n.getAddress();case 3:return a=e.sent,u="ERC721"===o.type?"1":o.amount,e.next=7,s.getSignableTransferV1({getSignableTransferRequest:{sender:a,token:yx(o),amount:u,receiver:o.receiver}});case 7:return c=e.sent,f=c.data,d=f.signable_message,h=f.payload_hash,e.next=11,_A(d,n);case 11:return l=e.sent,e.next=14,i.signMessage(h);case 14:return p=e.sent,g={sender_stark_key:c.data.sender_stark_key,sender_vault_id:c.data.sender_vault_id,receiver_stark_key:c.data.receiver_stark_key,receiver_vault_id:c.data.receiver_vault_id,asset_id:c.data.asset_id,amount:c.data.amount,nonce:c.data.nonce,expiration_timestamp:c.data.expiration_timestamp,stark_signature:p},e.next=18,s.createTransferV1({createTransferRequest:g,xImxEthAddress:a,xImxEthSignature:l});case 18:return m=e.sent,e.abrupt("return",{sent_signature:null==m?void 0:m.data.sent_signature,status:null==m||null===(r=m.data.status)||void 0===r?void 0:r.toString(),time:null==m?void 0:m.data.time,transfer_id:null==m?void 0:m.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ex(e){return Ax.apply(this,arguments)}function Ax(){return(Ax=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,o=t.transfersApi,e.next=3,r.getAddress();case 3:return s=e.sent,a=i.map((function(e){return{amount:"1",token:yx({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}})),e.next=7,o.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:s,signable_requests:a}});case 7:if(u=e.sent,void 0!==(c=u.data.signable_message)){e.next=11;break}throw new Error("Invalid response from Signable registration offchain");case 11:return e.next=13,_A(c,r);case 13:f=e.sent,d=[],h=bx(u.data.signable_responses),e.prev=16,h.s();case 18:if((l=h.n()).done){e.next=27;break}return p=l.value,e.next=22,n.signMessage(p.payload_hash);case 22:g=e.sent,m={sender_vault_id:p.sender_vault_id,receiver_stark_key:p.receiver_stark_key,receiver_vault_id:p.receiver_vault_id,asset_id:p.asset_id,amount:p.amount,nonce:p.nonce,expiration_timestamp:p.expiration_timestamp,stark_signature:g},d.push(m);case 25:e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(16),h.e(e.t0);case 32:return e.prev=32,h.f(),e.finish(32);case 35:return y={sender_stark_key:u.data.sender_stark_key,requests:d},e.next=38,o.createTransfer({createTransferRequestV2:y,xImxEthAddress:s,xImxEthSignature:f});case 38:return b=e.sent,e.abrupt("return",{transfer_ids:null==b?void 0:b.data.transfer_ids});case 40:case"end":return e.stop()}}),e,null,[[16,29,32,35]])})))).apply(this,arguments)}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(ux||(ux={})),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"}(cx||(cx={})),hx("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))),dx("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"),dx("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"),dx("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;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t})),hx("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Sx=new Ek("units/5.7.0"),kx=["wei","kwei","mwei","gwei","szabo","finney","ether"];function xx(e,t){if("string"!=typeof e&&Sx.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=kx.indexOf(t);-1!==e&&(t=3*e)}return rx(e,null!=t?t:18)}function Tx(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 Rx(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tx(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tx(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ox(e,t,r,n,i,o,s){return Mx.apply(this,arguments)}function Mx(){return(Mx=hA(yA.mark((function e(t,r,n,i,o,s,a){var u,c,f;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return u=e.sent,e.next=5,Ck(u,i,a);case 5:return c=e.sent,e.next=8,s.populateTransaction.registerAndDepositEth(u,i,c.operator_signature,n,o);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(Rx(Rx({},f),{},{value:r})));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ix(e,t,r,n,i,o){return Px.apply(this,arguments)}function Px(){return(Px=hA(yA.mark((function e(t,r,n,i,o,s){var a;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.populateTransaction["deposit(uint256,uint256,uint256)"](i,n,o);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(Rx(Rx({},a),{},{value:r})));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Cx(e,t,r,n,i,o){return Nx.apply(this,arguments)}function Nx(){return(Nx=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c,f,d,h,l,p,g,m,y;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,u={decimals:18},c=xx(r.amount,"wei"),f={user:a,token:{type:r.type,data:u},amount:c.toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:f});case 8:return d=e.sent,e.next=11,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type}}});case 11:return h=e.sent,l=h.data.asset_type,p=d.data.stark_key,g=d.data.vault_id,m=ZE.connect(s.ethConfiguration.coreContractAddress,t),y=cA.connect(s.ethConfiguration.registrationContractAddress,t),e.next=19,Ik(p,y);case 19:if(e.sent){e.next=24;break}return e.abrupt("return",Ox(t,c,l,p,g,m,i));case 24:return e.abrupt("return",Ix(t,c,l,p,g,m));case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Bx(e,t,r,n,i,o){return jx.apply(this,arguments)}function jx(){return(jx=hA(yA.mark((function e(t,r,n,i,o,s){var a;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.populateTransaction.depositERC20(i,n,o,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lx(e,t,r,n,i,o,s){return Ux.apply(this,arguments)}function Ux(){return(Ux=hA(yA.mark((function e(t,r,n,i,o,s,a){var u,c,f;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return u=e.sent,e.next=5,Ck(u,i,a);case 5:return c=e.sent,e.next=8,s.populateTransaction.registerAndDepositERC20(u,i,c.operator_signature,n,o,r);case 8:return f=e.sent,e.abrupt("return",t.sendTransaction(f));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dx(e,t,r,n,i,o,s){return Fx.apply(this,arguments)}function Fx(){return(Fx=hA(yA.mark((function e(t,r,n,i,o,s,a){var u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return u=e.sent,e.next=5,o.getToken({address:r.tokenAddress});case 5:return c=e.sent,f=parseInt(c.data.decimals),d={decimals:f,token_address:r.tokenAddress},h=xx(r.amount,0),l=XE.connect(r.tokenAddress,t),e.next=12,l.populateTransaction.approve(a.ethConfiguration.coreContractAddress,h);case 12:return p=e.sent,e.next=15,t.sendTransaction(p);case 15:return g={user:u,token:{type:r.type,data:d},amount:h.toString()},e.next=18,n.getSignableDeposit({getSignableDepositRequest:g});case 18:return m=e.sent,e.next=21,s.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress}}}});case 21:return y=e.sent,b=y.data.asset_type,v=m.data.stark_key,w=m.data.vault_id,_=Kk.from(m.data.amount),E=ZE.connect(a.ethConfiguration.coreContractAddress,t),A=cA.connect(a.ethConfiguration.registrationContractAddress,t),e.next=30,Ik(v,A);case 30:if(e.sent){e.next=35;break}return e.abrupt("return",Lx(t,_,b,v,w,E,i));case 35:return e.abrupt("return",Bx(t,_,b,v,w,E));case 36:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qx(e,t,r,n,i,o){return zx.apply(this,arguments)}function zx(){return(zx=hA(yA.mark((function e(t,r,n,i,o,s){var a;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.populateTransaction.depositNft(i,n,o,r);case 2:return a=e.sent,e.abrupt("return",t.sendTransaction(a));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Kx(e,t,r,n,i,o){return Hx.apply(this,arguments)}function Hx(){return(Hx=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c,f,d,h,l,p,g,m,y,b,v,w;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,u={token_address:r.tokenAddress,token_id:r.tokenId},c={user:a,token:{type:r.type,data:u},amount:"1".toString()},e.next=8,n.getSignableDeposit({getSignableDepositRequest:c});case 8:return f=e.sent,e.next=11,o.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:r.type,data:{token_address:r.tokenAddress,token_id:r.tokenId}}}});case 11:return d=e.sent,h=d.data.asset_type,l=f.data.stark_key,p=f.data.vault_id,g=ZE.connect(s.ethConfiguration.coreContractAddress,t),m=cA.connect(s.ethConfiguration.registrationContractAddress,t),e.next=19,Ik(l,m);case 19:return y=e.sent,b=$E.connect(r.tokenAddress,t),v=s.ethConfiguration.coreContractAddress,e.next=24,b.isApprovedForAll(a,v);case 24:if(e.sent){e.next=28;break}return e.next=28,b.setApprovalForAll(v,!0);case 28:if(y){e.next=34;break}return e.next=31,Ck(a,l,i);case 31:return w=e.sent,e.next=34,g.registerUser(a,l,w.operator_signature);case 34:return e.abrupt("return",qx(t,r.tokenId,h,l,p,g));case 35:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Gx=function(e){if(void 0!==e)return e;throw new Error("undefined field exception")};function Wx(e){return Vx.apply(this,arguments)}function Vx(){return(Vx=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l,p;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.withdrawalsApi,o="ERC721"===t.type?"1":t.amount,e.t0=i,e.next=5,r.getAddress();case 5:return e.t1=e.sent,e.t2=yx(t),e.t3=o,e.t4={user:e.t1,token:e.t2,amount:e.t3},e.t5={getSignableWithdrawalRequest:e.t4},e.next=12,e.t0.getSignableWithdrawal.call(e.t0,e.t5);case 12:return s=e.sent,a=s.data,u=a.signable_message,c=a.payload_hash,e.next=16,n.signMessage(c);case 16:return f=e.sent,e.next=19,kA(u,r);case 19:return d=e.sent,h=d.ethAddress,l=d.ethSignature,e.next=24,i.createWithdrawal({createWithdrawalRequest:{stark_key:Gx(s.data.stark_key),amount:o,asset_id:Gx(s.data.asset_id),vault_id:Gx(s.data.vault_id),nonce:Gx(s.data.nonce),stark_signature:f},xImxEthAddress:h,xImxEthSignature:l});case 24:return p=e.sent,e.abrupt("return",p.data);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Xx(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 Jx(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xx(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xx(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $x(e,t,r,n){return Yx.apply(this,arguments)}function Yx(){return(Yx=hA(yA.mark((function e(t,r,n,i){var o;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.encodeAsset({assetType:t,encodeAssetRequest:{token:Jx({type:r},i&&{data:i})}});case 2:return o=e.sent,e.abrupt("return",o.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qx(e,t,r,n,i){return Zx.apply(this,arguments)}function Zx(){return(Zx=hA(yA.mark((function e(t,r,n,i,o){var s,a,u;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,Ck(s,n,o);case 5:return a=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(s,n,a.operator_signature,r);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function eT(e,t,r,n){return tT.apply(this,arguments)}function tT(){return(tT=hA(yA.mark((function e(t,r,n,i){var o;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rT(e,t,r,n,i,o){return nT.apply(this,arguments)}function nT(){return(nT=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$x("asset","ERC20",i,{token_address:n.tokenAddress});case 2:return a=e.sent,u=ZE.connect(s.ethConfiguration.coreContractAddress,t),c=cA.connect(s.ethConfiguration.registrationContractAddress,t),e.next=7,Ik(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",Qx(t,a.asset_type,r,c,o));case 12:return e.abrupt("return",eT(t,a.asset_type,r,u));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function iT(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 oT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iT(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sT(e,t,r,n,i){return aT.apply(this,arguments)}function aT(){return(aT=hA(yA.mark((function e(t,r,n,i,o){var s;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.withdrawAndMint(n,r,i);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function uT(e,t,r,n,i,o){return cT.apply(this,arguments)}function cT(){return(cT=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,e.next=5,Ck(a,n,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.regsiterAndWithdrawAndMint(a,n,u.operator_signature,r,i);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fT(e){var t=e.data.id,r=e.data.blueprint||"";return Uc(gc("{".concat(t,"}:{").concat(r,"}")))}function dT(e,t,r,n,i,o){return hT.apply(this,arguments)}function hT(){return(hT=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c,f;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$x("mintable-asset","ERC721",i,oT({id:n.data.id,token_address:n.data.tokenAddress},n.data.blueprint&&{blueprint:n.data.blueprint}));case 2:return a=e.sent,u=fT(n),c=ZE.connect(s.ethConfiguration.coreContractAddress,t),f=cA.connect(s.ethConfiguration.registrationContractAddress,t),e.next=8,Ik(r,f);case 8:if(e.sent){e.next=13;break}return e.abrupt("return",uT(t,a.asset_type,r,u,f,o));case 13:return e.abrupt("return",sT(t,a.asset_type,r,u,c));case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lT(e,t,r,n,i,o){return pT.apply(this,arguments)}function pT(){return(pT=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return a=e.sent,e.next=5,Ck(a,n,s);case 5:return u=e.sent,e.next=8,o.populateTransaction.registerAndWithdrawNft(a,n,u.operator_signature,r,i);case 8:return c=e.sent,e.abrupt("return",t.sendTransaction(c));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function gT(e,t,r,n,i){return mT.apply(this,arguments)}function mT(){return(mT=hA(yA.mark((function e(t,r,n,i,o){var s;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.populateTransaction.withdrawNft(n,r,i);case 2:return s=e.sent,e.abrupt("return",t.sendTransaction(s));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yT(e,t,r,n,i,o){return bT.apply(this,arguments)}function bT(){return(bT=hA(yA.mark((function e(t,r,n,i,o,s){var a,u,c;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$x("asset","ERC721",i,{token_id:n.tokenId,token_address:n.tokenAddress});case 2:return a=e.sent,u=ZE.connect(s.ethConfiguration.coreContractAddress,t),c=cA.connect(s.ethConfiguration.registrationContractAddress,t),e.next=7,Ik(r,c);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",lT(t,a.asset_type,r,n.tokenId,c,o));case 12:return e.abrupt("return",gT(t,a.asset_type,r,n.tokenId,u));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vT(e,t,r,n,i,o,s){return wT.apply(this,arguments)}function wT(){return(wT=hA(yA.mark((function e(t,r,n,i,o,s,a){var u,c;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=n.tokenAddress,c=n.tokenId,e.next=4,o.getMintableTokenDetailsByClientTokenId({tokenAddress:u,tokenId:c}).then((function(e){return dT(t,r,{type:"ERC721",data:{id:c,tokenAddress:u,blueprint:e.data.blueprint}},i,s,a)})).catch((function(e){var o;if(404===(null===(o=e.response)||void 0===o?void 0:o.status))return yT(t,r,n,i,s,a);throw e}));case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _T(e,t,r,n,i){return ET.apply(this,arguments)}function ET(){return(ET=hA(yA.mark((function e(t,r,n,i,o){var s,a,u;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getAddress();case 2:return s=e.sent,e.next=5,Ck(s,n,o);case 5:return a=e.sent,e.next=8,i.populateTransaction.registerAndWithdraw(s,n,a.operator_signature,r);case 8:return u=e.sent,e.abrupt("return",t.sendTransaction(u));case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function AT(e,t,r,n){return ST.apply(this,arguments)}function ST(){return(ST=hA(yA.mark((function e(t,r,n,i){var o;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.populateTransaction.withdraw(n,r);case 2:return o=e.sent,e.abrupt("return",t.sendTransaction(o));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function kT(e,t,r,n,i){return xT.apply(this,arguments)}function xT(){return(xT=hA(yA.mark((function e(t,r,n,i,o){var s,a,u;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$x("asset","ETH",n);case 2:return s=e.sent,a=ZE.connect(o.ethConfiguration.coreContractAddress,t),u=cA.connect(o.ethConfiguration.registrationContractAddress,t),e.next=7,Ik(r,u);case 7:if(e.sent){e.next=12;break}return e.abrupt("return",_T(t,s.asset_type,r,u,i));case 12:return e.abrupt("return",AT(t,s.asset_type,r,a));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function TT(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 RT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?TT(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function OT(e){return MT.apply(this,arguments)}function MT(){return(MT=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,o=t.ordersApi,e.next=3,r.getAddress();case 3:return s=e.sent,a="ERC721"===i.sell.type?"1":i.sell.amount,u="ERC721"===i.buy.type?"1":i.buy.amount,c={user:s,amount_buy:u,token_buy:yx(i.buy),amount_sell:a,token_sell:yx(i.sell),fees:i.fees,expiration_timestamp:i.expiration_timestamp,split_fees:!0},e.next=9,o.getSignableOrder({getSignableOrderRequestV3:c});case 9:return f=e.sent,d=f.data,h=d.signable_message,l=d.payload_hash,e.next=13,_A(h,r);case 13:return p=e.sent,e.next=16,n.signMessage(l);case 16:return g=e.sent,m=f.data,y={createOrderRequest:{amount_buy:m.amount_buy,amount_sell:m.amount_sell,asset_id_buy:m.asset_id_buy,asset_id_sell:m.asset_id_sell,expiration_timestamp:m.expiration_timestamp,include_fees:!0,fees:i.fees,nonce:m.nonce,stark_key:m.stark_key,stark_signature:g,vault_id_buy:m.vault_id_buy,vault_id_sell:m.vault_id_sell},xImxEthAddress:s,xImxEthSignature:p},e.next=21,o.createOrderV3(y);case 21:return b=e.sent,e.abrupt("return",RT({},b.data));case 23:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function IT(e){return PT.apply(this,arguments)}function PT(){return(PT=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,o=t.ordersApi,e.next=3,o.getSignableCancelOrderV3({getSignableCancelOrderRequest:{order_id:i.order_id}});case 3:return s=e.sent,a=s.data,u=a.signable_message,c=a.payload_hash,e.next=7,_A(u,r);case 7:return f=e.sent,e.next=10,n.signMessage(c);case 10:return d=e.sent,e.next=13,r.getAddress();case 13:return h=e.sent,e.next=16,o.cancelOrder({id:i.order_id.toString(),cancelOrderRequest:{order_id:i.order_id,stark_signature:d},xImxEthAddress:h,xImxEthSignature:f});case 16:return l=e.sent,e.abrupt("return",{order_id:l.data.order_id,status:l.data.status});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function CT(e){return NT.apply(this,arguments)}function NT(){return(NT=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.ethSigner,n=t.starkSigner,i=t.request,o=t.tradesApi,e.next=3,r.getAddress();case 3:return s=e.sent,e.next=6,o.getSignableTrade({getSignableTradeRequest:{user:s,order_id:i.order_id,fees:i.fees}});case 6:return a=e.sent,u=a.data,c=u.signable_message,f=u.payload_hash,e.next=10,_A(c,r);case 10:return d=e.sent,e.next=13,n.signMessage(f);case 13:return h=e.sent,e.next=16,o.createTradeV3({createTradeRequest:{amount_buy:a.data.amount_buy,amount_sell:a.data.amount_sell,asset_id_buy:a.data.asset_id_buy,asset_id_sell:a.data.asset_id_sell,expiration_timestamp:a.data.expiration_timestamp,fee_info:a.data.fee_info,fees:i.fees,include_fees:!0,nonce:a.data.nonce,order_id:i.order_id,stark_key:a.data.stark_key,vault_id_buy:a.data.vault_id_buy,vault_id_sell:a.data.vault_id_sell,stark_signature:h},xImxEthAddress:s,xImxEthSignature:d});case 16:return l=e.sent,e.abrupt("return",l.data);case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function BT(e){return jT.apply(this,arguments)}function jT(){return(jT=hA(yA.mark((function e(t){var r,n,i,o,s,a,u,c,f,d,h,l,p,g,m;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.ethSigner,i=t.starkSigner,o=t.request,s=t.exchangesApi,e.next=3,n.getAddress();case 3:return a=e.sent,u=o.amount,e.next=7,s.getExchangeSignableTransfer({id:o.transactionID,getSignableTransferRequest:{sender:a,token:yx(o),amount:u,receiver:o.receiver}});case 7:return c=e.sent,f=c.data,d=f.signable_message,h=f.payload_hash,e.next=11,_A(d,n);case 11:return l=e.sent,e.next=14,i.signMessage(h);case 14:return p=e.sent,g={sender_stark_key:c.data.sender_stark_key,sender_vault_id:c.data.sender_vault_id,receiver_stark_key:c.data.receiver_stark_key,receiver_vault_id:c.data.receiver_vault_id,asset_id:c.data.asset_id,amount:c.data.amount,nonce:c.data.nonce,expiration_timestamp:c.data.expiration_timestamp,stark_signature:p},e.next=18,s.createExchangeTransfer({id:o.transactionID,createTransferRequest:g,xImxEthAddress:a,xImxEthSignature:l});case 18:return m=e.sent,e.abrupt("return",{sent_signature:null==m?void 0:m.data.sent_signature,status:null==m||null===(r=m.data.status)||void 0===r?void 0:r.toString(),time:null==m?void 0:m.data.time,transfer_id:null==m?void 0:m.data.transfer_id});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function LT(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 UT(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?LT(Object(r),!0).forEach((function(t){WE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LT(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var DT=function(){function e(t){KE(this,e),this.config=t;var r=t.apiConfiguration;this.config=t,this.depositsApi=new lS(r),this.encodingApi=new yS(r),this.mintsApi=new CS(r),this.ordersApi=new qS(r),this.tokensApi=new JS(r),this.tradesApi=new ZS(r),this.transfersApi=new nk(r),this.usersApi=new ak(r),this.withdrawalsApi=new dk(r),this.projectsApi=new GS(r),this.collectionsApi=new cS(r),this.metadataApi=new kS(r),this.metadataRefreshesApi=new OS(r),this.exchangesApi=new _S(r)}var t,r,n,i,o,s,a,u,c,f,d,h,l,p,g,m,y,b,v,w,_,E,A,S,k,x,T,R;return GE(e,[{key:"isChainValid",value:function(e){return e===this.config.ethConfiguration.chainID}},{key:"validateChain",value:(R=hA(yA.mark((function e(t){var r;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getChainId();case 2:if(r=e.sent,this.isChainValid(r)){e.next=5;break}throw new Error("The wallet used for this operation is not from the correct network.");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"registerOffchain",value:(T=hA(yA.mark((function e(t){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",Ok(UT(UT({},t),{},{usersApi:this.usersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"isRegisteredOnchain",value:(x=hA(yA.mark((function e(t){var r,n;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return r=cA.connect(this.config.ethConfiguration.registrationContractAddress,t.ethSigner),e.next=5,t.starkSigner.getAddress();case 5:return n=e.sent,e.abrupt("return",Ik(n,r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"mint",value:(k=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",gx(t,r,this.mintsApi));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"transfer",value:(S=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",wx(UT(UT({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"exchangeTransfer",value:(A=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",BT(UT(UT({},t),{},{request:r,exchangesApi:this.exchangesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"batchNftTransfer",value:(E=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",Ex(UT(UT({},t),{},{request:r,transfersApi:this.transfersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"deposit",value:(_=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r.type,e.next="ETH"===e.t0?3:"ERC20"===e.t0?4:"ERC721"===e.t0?5:6;break;case 3:return e.abrupt("return",this.depositEth(t,r));case 4:return e.abrupt("return",this.depositERC20(t,r));case 5:return e.abrupt("return",this.depositERC721(t,r));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"depositEth",value:(w=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",Cx(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"depositERC20",value:(v=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",Dx(t,r,this.depositsApi,this.usersApi,this.tokensApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"depositERC721",value:(b=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",Kx(t,r,this.depositsApi,this.usersApi,this.encodingApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"prepareWithdrawal",value:(y=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",Wx(UT(UT(UT({},t),r),{},{withdrawalsApi:this.withdrawalsApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return y.apply(this,arguments)})},{key:"completeWithdrawal",value:function(e,t,r){switch(r.type){case"ETH":return this.completeEthWithdrawal(e,t);case"ERC20":return this.completeERC20Withdrawal(e,t,r);case"ERC721":return this.completeERC721Withdrawal(e,t,r)}}},{key:"completeEthWithdrawal",value:(m=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",kT(t,r,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"completeERC20Withdrawal",value:(g=hA(yA.mark((function e(t,r,n){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",rT(t,r,n,this.encodingApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return g.apply(this,arguments)})},{key:"completeERC721Withdrawal",value:function(){var e=hA(yA.mark((function e(t,r,n){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t);case 2:return e.abrupt("return",vT(t,r,n,this.encodingApi,this.mintsApi,this.usersApi,this.config));case 3:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"createOrder",value:(p=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",OT(UT(UT({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"cancelOrder",value:(l=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",IT(UT(UT({},t),{},{request:r,ordersApi:this.ordersApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"createTrade",value:(h=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.validateChain(t.ethSigner);case 2:return e.abrupt("return",CT(UT(UT({},t),{},{request:r,tradesApi:this.tradesApi})));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"createProject",value:(d=hA(yA.mark((function e(t,r){var n;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.createProject({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createProjectRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"getProject",value:(f=hA(yA.mark((function e(t,r){var n;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return n=e.sent,e.abrupt("return",this.projectsApi.getProject({id:r,iMXSignature:n.signature,iMXTimestamp:n.timestamp}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"getProjects",value:(c=hA(yA.mark((function e(t,r,n,i,o){var s;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return s=e.sent,e.abrupt("return",this.projectsApi.getProjects({iMXSignature:s.signature,iMXTimestamp:s.timestamp,pageSize:r,cursor:n,orderBy:i,direction:o}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return c.apply(this,arguments)})},{key:"createCollection",value:(u=hA(yA.mark((function e(t,r){var n;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return n=e.sent,e.abrupt("return",this.collectionsApi.createCollection({iMXSignature:n.signature,iMXTimestamp:n.timestamp,createCollectionRequest:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"updateCollection",value:(a=hA(yA.mark((function e(t,r,n){var i;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return i=e.sent,e.abrupt("return",this.collectionsApi.updateCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,address:r,updateCollectionRequest:n}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"addMetadataSchemaToCollection",value:(s=hA(yA.mark((function e(t,r,n){var i;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return i=e.sent,e.abrupt("return",this.metadataApi.addMetadataSchemaToCollection({iMXSignature:i.signature,iMXTimestamp:i.timestamp,addMetadataSchemaToCollectionRequest:n,address:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return s.apply(this,arguments)})},{key:"updateMetadataSchemaByName",value:(o=hA(yA.mark((function e(t,r,n,i){var o;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return o=e.sent,e.abrupt("return",this.metadataApi.updateMetadataSchemaByName({iMXSignature:o.signature,iMXTimestamp:o.timestamp,address:r,name:n,metadataSchemaRequest:i}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return o.apply(this,arguments)})},{key:"listMetadataRefreshes",value:(i=hA(yA.mark((function e(t,r,n,i){var o,s;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return o=e.sent,e.next=5,t.getAddress();case 5:return s=e.sent,e.abrupt("return",this.metadataRefreshesApi.getAListOfMetadataRefreshes({xImxEthSignature:o.signature,xImxEthTimestamp:o.timestamp,xImxEthAddress:s,collectionAddress:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return i.apply(this,arguments)})},{key:"getMetadataRefreshErrors",value:(n=hA(yA.mark((function e(t,r,n,i){var o,s;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return o=e.sent,e.next=5,t.getAddress();case 5:return s=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshErrors({xImxEthSignature:o.signature,xImxEthTimestamp:o.timestamp,xImxEthAddress:s,refreshId:r,pageSize:n,cursor:i}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"getMetadataRefreshResults",value:(r=hA(yA.mark((function e(t,r){var n,i;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.getMetadataRefreshResults({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,refreshId:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"createMetadataRefresh",value:(t=hA(yA.mark((function e(t,r){var n,i;return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,AA(t);case 2:return n=e.sent,e.next=5,t.getAddress();case 5:return i=e.sent,e.abrupt("return",this.metadataRefreshesApi.requestAMetadataRefresh({xImxEthSignature:n.signature,xImxEthTimestamp:n.timestamp,xImxEthAddress:i,createMetadataRefreshRequest:r}));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function FT(e){if(zE.isAxiosError(e)&&e.response){var t,r,n,i=e.response.data;return i.code&&i.message?new Ak({code:i.code,details:i.details,message:i.message}):new Ak({code:null!==(t=null!==(r=e.code)&&void 0!==r?r:null===(n=e.response)||void 0===n?void 0:n.status.toString())&&void 0!==t?t:"unknown_error_code",message:String(e)})}return new Ak({code:"unknown_error_code",message:String(e)})}var qT=function(){function e(t){KE(this,e),this.depositsApi=new lS(t.apiConfiguration),this.mintsApi=new CS(t.apiConfiguration),this.ordersApi=new qS(t.apiConfiguration),this.tokensApi=new JS(t.apiConfiguration),this.tradesApi=new ZS(t.apiConfiguration),this.transfersApi=new nk(t.apiConfiguration),this.exchangeApi=new _S(t.apiConfiguration),this.usersApi=new ak(t.apiConfiguration),this.withdrawalsApi=new dk(t.apiConfiguration),this.balanceApi=new oS(t.apiConfiguration),this.assetApi=new tS(t.apiConfiguration),this.collectionApi=new cS(t.apiConfiguration),this.metadataApi=new kS(t.apiConfiguration),this.metadataRefreshesApi=new OS(t.apiConfiguration),this.nftCheckoutPrimaryApi=new LS(t.apiConfiguration),this.projectsApi=new GS(t.apiConfiguration),this.workflows=new DT(t)}var t,r,n;return GE(e,[{key:"deposit",value:function(e,t){return this.workflows.deposit(e,t).catch((function(e){throw FT(e)}))}},{key:"getDeposit",value:function(e){return this.depositsApi.getDeposit(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listDeposits",value:function(e){return this.depositsApi.listDeposits(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"registerOffchain",value:function(e){return this.workflows.registerOffchain(e).catch((function(e){throw FT(e)}))}},{key:"isRegisteredOnchain",value:function(e){return this.workflows.isRegisteredOnchain(e).catch((function(e){throw FT(e)}))}},{key:"getUser",value:function(e){return this.usersApi.getUsers({user:e}).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getAsset",value:function(e){return this.assetApi.getAsset(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listAssets",value:function(e){return this.assetApi.listAssets(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"createCollection",value:function(e,t){return this.workflows.createCollection(e,t).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getCollection",value:function(e){return this.collectionApi.getCollection(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listCollectionFilters",value:function(e){return this.collectionApi.listCollectionFilters(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listCollections",value:function(e){return this.collectionApi.listCollections(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"updateCollection",value:function(e,t,r){return this.workflows.updateCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"addMetadataSchemaToCollection",value:function(e,t,r){return this.workflows.addMetadataSchemaToCollection(e,t,r).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getMetadataSchema",value:function(e){return this.metadataApi.getMetadataSchema(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"updateMetadataSchemaByName",value:function(e,t,r,n){return this.workflows.updateMetadataSchemaByName(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listMetadataRefreshes",value:function(e,t,r,n){return this.workflows.listMetadataRefreshes(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getMetadataRefreshErrors",value:function(e,t,r,n){return this.workflows.getMetadataRefreshErrors(e,t,r,n).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getMetadataRefreshResults",value:function(e,t){return this.workflows.getMetadataRefreshResults(e,t).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"createMetadataRefresh",value:function(e,t){return this.workflows.createMetadataRefresh(e,t).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"createProject",value:(n=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.createProject(t,r).then((function(e){return e.data})).catch((function(e){throw FT(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"getProject",value:(r=hA(yA.mark((function e(t,r){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProject(t,r).then((function(e){return e.data})).catch((function(e){throw FT(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getProjects",value:(t=hA(yA.mark((function e(t,r,n,i,o){return yA.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.workflows.getProjects(t,r,n,i,o).then((function(e){return e.data})).catch((function(e){throw FT(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,o){return t.apply(this,arguments)})},{key:"getBalance",value:function(e){return this.balanceApi.getBalance(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listBalances",value:function(e){return this.balanceApi.listBalances(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getMint",value:function(e){return this.mintsApi.getMint(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listMints",value:function(e){return this.mintsApi.listMints(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"mint",value:function(e,t){return this.workflows.mint(e,t).catch((function(e){throw FT(e)}))}},{key:"listWithdrawals",value:function(e){return this.withdrawalsApi.listWithdrawals(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getWithdrawal",value:function(e){return this.withdrawalsApi.getWithdrawal(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"prepareWithdrawal",value:function(e,t){return this.workflows.prepareWithdrawal(e,t).catch((function(e){throw FT(e)}))}},{key:"completeWithdrawal",value:function(e,t,r){return this.workflows.completeWithdrawal(e,t,r).catch((function(e){throw FT(e)}))}},{key:"getOrder",value:function(e){return this.ordersApi.getOrder(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listOrders",value:function(e){return this.ordersApi.listOrders(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"createOrder",value:function(e,t){return this.workflows.createOrder(e,t).catch((function(e){throw FT(e)}))}},{key:"cancelOrder",value:function(e,t){return this.workflows.cancelOrder(e,t).catch((function(e){throw FT(e)}))}},{key:"getTrade",value:function(e){return this.tradesApi.getTrade(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listTrades",value:function(e){return this.tradesApi.listTrades(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"createTrade",value:function(e,t){return this.workflows.createTrade(e,t).catch((function(e){throw FT(e)}))}},{key:"getToken",value:function(e){return this.tokensApi.getToken(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listTokens",value:function(e){return this.tokensApi.listTokens(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"getTransfer",value:function(e){return this.transfersApi.getTransfer(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"listTransfers",value:function(e){return this.transfersApi.listTransfers(e).then((function(e){return e.data})).catch((function(e){throw FT(e)}))}},{key:"transfer",value:function(e,t){return this.workflows.transfer(e,t).catch((function(e){throw FT(e)}))}},{key:"batchNftTransfer",value:function(e,t){return this.workflows.batchNftTransfer(e,t).catch((function(e){throw FT(e)}))}},{key:"createExchange",value:function(e){return this.exchangeApi.createExchange(e).catch((function(e){throw FT(e)}))}},{key:"getExchange",value:function(e){return this.exchangeApi.getExchange(e).catch((function(e){throw FT(e)}))}},{key:"getExchanges",value:function(e){return this.exchangeApi.getExchanges(e).catch((function(e){throw FT(e)}))}},{key:"exchangeTransfer",value:function(e,t){return this.workflows.exchangeTransfer(e,t).catch((function(e){throw FT(e)}))}},{key:"createNftPrimary",value:function(e){return this.nftCheckoutPrimaryApi.createNftPrimary(e).catch((function(e){throw FT(e)}))}},{key:"getCurrenciesNFTCheckoutPrimary",value:function(e){return this.nftCheckoutPrimaryApi.getCurrenciesNFTCheckoutPrimary(e).catch((function(e){throw FT(e)}))}},{key:"getNftPrimaryTransaction",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransaction(e).catch((function(e){throw FT(e)}))}},{key:"getNftPrimaryTransactions",value:function(e){return this.nftCheckoutPrimaryApi.getNftPrimaryTransactions(e).catch((function(e){throw FT(e)}))}}]),e}();const zT=({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n})=>Rk.createConfig({basePath:e,chainID:t,coreContractAddress:r,registrationContractAddress:n,sdkVersion:"ts-immutable-sdk-0.0.0"}),KT=()=>zT({basePath:"https://api.sandbox.x.immutable.com",chainID:5,coreContractAddress:"0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623",registrationContractAddress:"0x1C97Ada273C9A52253f463042f29117090Cd7D83"});class HT{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=KT();break;case e.Environment.PRODUCTION:this.immutableXConfig=zT({basePath:"https://api.x.immutable.com",chainID:1,coreContractAddress:"0x5FDCCA53617f4d2b9134B29090C87D01058e27e9",registrationContractAddress:"0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"});break;default:this.immutableXConfig=KT()}}}class GT{immutableX;depositsApi;mintsApi;ordersApi;tokensApi;tradesApi;transfersApi;exchangeApi;nftCheckoutPrimaryApi;usersApi;withdrawalsApi;balanceApi;assetApi;collectionApi;metadataApi;metadataRefreshesApi;projectsApi;constructor(e){const t=new HT(e);this.immutableX=new qT(t.immutableXConfig),this.depositsApi=this.immutableX.depositsApi,this.mintsApi=this.immutableX.mintsApi,this.ordersApi=this.immutableX.ordersApi,this.tokensApi=this.immutableX.tokensApi,this.tradesApi=this.immutableX.tradesApi,this.transfersApi=this.immutableX.transfersApi,this.exchangeApi=this.immutableX.exchangeApi,this.usersApi=this.immutableX.usersApi,this.withdrawalsApi=this.immutableX.withdrawalsApi,this.balanceApi=this.immutableX.balanceApi,this.assetApi=this.immutableX.assetApi,this.collectionApi=this.immutableX.collectionApi,this.metadataApi=this.immutableX.metadataApi,this.metadataRefreshesApi=this.immutableX.metadataRefreshesApi,this.nftCheckoutPrimaryApi=this.immutableX.nftCheckoutPrimaryApi,this.projectsApi=this.immutableX.projectsApi}getDeposit(e){return this.immutableX.getDeposit(e)}listDeposits(e){return this.immutableX.listDeposits(e)}getUser(e){return this.immutableX.getUser(e)}getAsset(e){return this.immutableX.getAsset(e)}listAssets(e){return this.immutableX.listAssets(e)}createCollection(e,t){return this.immutableX.createCollection(e,t)}getCollection(e){return this.immutableX.getCollection(e)}listCollectionFilters(e){return this.immutableX.listCollectionFilters(e)}listCollections(e){return this.collectionApi.listCollections(e).then((e=>e.data))}updateCollection(e,t,r){return this.immutableX.updateCollection(e,t,r)}addMetadataSchemaToCollection(e,t,r){return this.immutableX.addMetadataSchemaToCollection(e,t,r)}getMetadataSchema(e){return this.immutableX.getMetadataSchema(e)}updateMetadataSchemaByName(e,t,r,n){return this.immutableX.updateMetadataSchemaByName(e,t,r,n)}listMetadataRefreshes(e,t,r,n){return this.immutableX.listMetadataRefreshes(e,t,r,n)}getMetadataRefreshErrors(e,t,r,n){return this.immutableX.getMetadataRefreshErrors(e,t,r,n)}getMetadataRefreshResults(e,t){return this.immutableX.getMetadataRefreshResults(e,t)}createMetadataRefresh(e,t){return this.immutableX.createMetadataRefresh(e,t)}async createProject(e,t){return this.immutableX.createProject(e,t)}async getProject(e,t){return this.immutableX.getProject(e,t)}async getProjects(e,t,r,n,i){return this.immutableX.getProjects(e,t,r,n,i)}getBalance(e){return this.immutableX.getBalance(e)}listBalances(e){return this.immutableX.listBalances(e)}getMint(e){return this.immutableX.getMint(e)}listMints(e){return this.immutableX.listMints(e)}mint(e,t){return this.immutableX.mint(e,t)}listWithdrawals(e){return this.immutableX.listWithdrawals(e)}getWithdrawal(e){return this.immutableX.getWithdrawal(e)}getOrder(e){return this.immutableX.getOrder(e)}listOrders(e){return this.immutableX.listOrders(e)}getTrade(e){return this.immutableX.getTrade(e)}listTrades(e){return this.immutableX.listTrades(e)}getToken(e){return this.immutableX.getToken(e)}listTokens(e){return this.immutableX.listTokens(e)}getTransfer(e){return this.immutableX.getTransfer(e)}listTransfers(e){return this.immutableX.listTransfers(e)}createExchange(e){return this.immutableX.createExchange(e).then((e=>e.data))}getExchange(e){return this.immutableX.getExchange(e).then((e=>e.data))}getExchanges(e){return this.immutableX.getExchanges(e).then((e=>e.data))}exchangeTransfer(e,t){return this.immutableX.exchangeTransfer(e,t)}createNftPrimary(e){return this.immutableX.createNftPrimary(e).then((e=>e.data))}getCurrenciesNFTCheckoutPrimary(e){return this.immutableX.getCurrenciesNFTCheckoutPrimary(e).then((e=>e.data))}getNftPrimaryTransaction(e){return this.immutableX.getNftPrimaryTransaction(e).then((e=>e.data))}getNftPrimaryTransactions(e){return this.immutableX.getNftPrimaryTransactions(e).then((e=>e.data))}}var WT={exports:{}};!function(e,t){e.exports=function(){var e=e||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r&&r.crypto&&(n=r.crypto),!n)try{n=Jc}catch(e){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},a=s.lib={},u=a.Base={extend:function(e){var t=o(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)}},c=a.WordArray=u.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||d).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<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)t[n+a>>>2]=r[a>>>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=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new c.init(t,e)}}),f=s.enc={},d=f.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>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<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[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<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},l=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,f=e.min(4*u,o);if(u){for(var d=0;d<u;d+=s)this._doProcessBlock(i,d);r=i.splice(0,u),n.sigBytes-=f}return new c.init(r,f)},clone:function(){var e=u.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:u.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}});var g=s.algo={};return s}(Math);return e}()}(WT);var VT=WT.exports,XT=n(VT),JT={exports:{}};!function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[],u=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(a[i]=r(t.pow(n,.5))),u[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],f=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],f=r[5],d=r[6],h=r[7],l=0;l<64;l++){if(l<16)c[l]=0|e[t+l];else{var p=c[l-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=c[l-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[l]=g+c[l-7]+y+c[l-16]}var b=n&i^n&o^i&o,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&d)+u[l]+c[l];h=d,d=f,f=a,a=s+w|0,s=o,o=i,i=n,n=w+(v+b)|0}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]+a|0,r[5]=r[5]+f|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=o._createHelper(f),r.HmacSHA256=o._createHmacHelper(f)}(Math),e.SHA256}(VT)}(JT);var $T=n(JT.exports),YT={exports:{}};!function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return r.create(i,o)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(t[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,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);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<r.length;o++)i[r.charCodeAt(o)]=o}var s=r.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(VT)}(YT);var QT=n(YT.exports),ZT={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(VT)}(ZT);var eR=n(ZT.exports);function tR(e){this.message=e}tR.prototype=new Error,tR.prototype.name="InvalidCharacterError";var rR="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new tR("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,o=0,s="";n=t.charAt(o++);~n&&(r=i%4?64*r+n:n,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};function nR(e){this.message=e}function iR(e,t){if("string"!=typeof e)throw new nR("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(rR(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return rR(t)}}(e.split(".")[r]))}catch(e){throw new nR("Invalid token specified: "+e.message)}}nR.prototype=new Error,nR.prototype.name="InvalidTokenError";var oR,sR,aR,uR={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},cR=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(cR||{});(aR=cR||(cR={})).reset=function(){oR=3,sR=uR},aR.setLevel=function(e){if(!(0<=e&&e<=4))throw new Error("Invalid log level");oR=e},aR.setLogger=function(e){sR=e};var fR=class{constructor(e){this._name=e}debug(...e){oR>=4&&sR.debug(fR._format(this._name,this._method),...e)}info(...e){oR>=3&&sR.info(fR._format(this._name,this._method),...e)}warn(...e){oR>=2&&sR.warn(fR._format(this._name,this._method),...e)}error(...e){oR>=1&&sR.error(fR._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){const t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){const r=new fR(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){const r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){oR>=4&&sR.debug(fR._format(e),...t)}static info(e,...t){oR>=3&&sR.info(fR._format(e),...t)}static warn(e,...t){oR>=2&&sR.warn(fR._format(e),...t)}static error(e,...t){oR>=1&&sR.error(fR._format(e),...t)}};cR.reset();var dR=class{static _randomWord(){return XT.lib.WordArray.random(1).words[0]}static generateUUIDv4(){const e="10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>(+e^dR._randomWord()&15>>+e/4).toString(16)));return e.replace(/-/g,"")}static generateCodeVerifier(){return dR.generateUUIDv4()+dR.generateUUIDv4()+dR.generateUUIDv4()}static generateCodeChallenge(e){try{const t=$T(e);return QT.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(e){throw fR.error("CryptoUtils.generateCodeChallenge",e),e}}static generateBasicAuth(e,t){const r=eR.parse([e,t].join(":"));return QT.stringify(r)}},hR=class{constructor(e){this._name=e,this._logger=new fR(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)t(...e)}},lR=class{static decode(e){try{return iR(e)}catch(e){throw fR.error("JwtUtils.decode",e),e}}},pR=class{static center({...e}){var t;return null==e.width&&(e.width=null!=(t=[800,720,600,480].find((e=>e<=window.outerWidth/1.618)))?t:360),null!=e.left||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),null!=e.height&&(null!=e.top||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter((([,e])=>null!=e)).map((([e,t])=>`${e}=${"boolean"!=typeof t?t:t?"yes":"no"}`)).join(",")}},gR=class extends hR{constructor(){super(...arguments),this._logger=new fR(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const e=this._expiration-gR.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=gR.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){const t=this._logger.create("init");e=Math.max(Math.floor(e),1);const r=gR.getEpochTime()+e;if(this.expiration===r&&this._timerHandle)return void t.debug("skipping since already initialized for expiration at",this.expiration);this.cancel(),t.debug("using duration",e),this._expiration=r;const n=Math.min(e,5);this._timerHandle=setInterval(this._callback,1e3*n)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},mR=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const r=new URL(e,"http://127.0.0.1")["fragment"===t?"hash":"search"];return new URLSearchParams(r.slice(1))}},yR=class extends Error{constructor(e,t){var r,n,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw fR.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=null!=(r=e.error_description)?r:null,this.error_uri=null!=(n=e.error_uri)?n:null,this.state=e.userState,this.session_state=null!=(i=e.session_state)?i:null}},bR=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},vR=class{constructor(e){this._logger=new fR("AccessTokenEvents"),this._expiringTimer=new gR("Access token expiring"),this._expiredTimer=new gR("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){const t=this._logger.create("load");if(e.access_token&&void 0!==e.expires_in){const r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let e=r-this._expiringNotificationTimeInSeconds;e<=0&&(e=1),t.debug("registering expiring timer, raising in",e,"seconds"),this._expiringTimer.init(e)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const n=r+1;t.debug("registering expired timer, raising in",n,"seconds"),this._expiredTimer.init(n)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},wR=class{constructor(){this._logger=new fR("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},_R=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new fR("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:r,...n}=t;if(!r)return await fetch(e,n);const i=new AbortController,o=setTimeout((()=>i.abort()),1e3*r);try{return await fetch(e,{...t,signal:i.signal})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new bR("Network timed out");throw e}finally{clearTimeout(o)}}async getJson(e,{token:t,credentials:r}={}){const n=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};let o;t&&(n.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);try{n.debug("url:",e),o=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(e){throw n.error("Network Error"),e}n.debug("HTTP response received, status",o.status);const s=o.headers.get("Content-Type");if(s&&!this._contentTypes.find((e=>s.startsWith(e)))&&n.throw(new Error(`Invalid response Content-Type: ${null!=s?s:"undefined"}, from URL: ${e}`)),o.ok&&this._jwtHandler&&(null==s?void 0:s.startsWith("application/jwt")))return await this._jwtHandler(await o.text());let a;try{a=await o.json()}catch(e){if(n.error("Error parsing JSON response",e),o.ok)throw e;throw new Error(`${o.statusText} (${o.status})`)}if(!o.ok){if(n.error("Error from server:",a),a.error)throw new yR(a);throw new Error(`${o.statusText} (${o.status}): ${JSON.stringify(a)}`)}return a}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:n,initCredentials:i}){const o=this._logger.create("postForm"),s={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};let a;void 0!==r&&(s.Authorization="Basic "+r),this.appendExtraHeaders(s);try{o.debug("url:",e),a=await this.fetchWithTimeout(e,{method:"POST",headers:s,body:t,timeoutInSeconds:n,credentials:i})}catch(e){throw o.error("Network error"),e}o.debug("HTTP response received, status",a.status);const u=a.headers.get("Content-Type");if(u&&!this._contentTypes.find((e=>u.startsWith(e))))throw new Error(`Invalid response Content-Type: ${null!=u?u:"undefined"}, from URL: ${e}`);const c=await a.text();let f={};if(c)try{f=JSON.parse(c)}catch(e){if(o.error("Error parsing JSON response",e),a.ok)throw e;throw new Error(`${a.statusText} (${a.status})`)}if(!a.ok){if(o.error("Error from server:",f),f.error)throw new yR(f,t);throw new Error(`${a.statusText} (${a.status}): ${JSON.stringify(f)}`)}return f}appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),n=["authorization","accept","content-type"];0!==r.length&&r.forEach((r=>{if(n.includes(r.toLocaleLowerCase()))return void t.warn("Protected header could not be overridden",r,n);const i="function"==typeof this._extraHeaders[r]?this._extraHeaders[r]():this._extraHeaders[r];i&&""!==i&&(e[r]=i)}))}},ER=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new fR("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){this._logger.create(`get('${e}')`),e=this._prefix+e;return await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let r=0;r<e;r++){const e=await this._store.key(r);e&&0===e.indexOf(this._prefix)&&t.push(e.substr(this._prefix.length))}return t}},AR=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:n,metadataSeed:i,client_id:o,client_secret:s,response_type:a="code",scope:u="openid",redirect_uri:c,post_logout_redirect_uri:f,client_authentication:d="client_secret_post",prompt:h,display:l,max_age:p,ui_locales:g,acr_values:m,resource:y,response_mode:b="query",filterProtocolClaims:v=!0,loadUserInfo:w=!1,staleStateAgeInSeconds:_=900,clockSkewInSeconds:E=300,userInfoJwtIssuer:A="OP",mergeClaims:S=!1,disablePKCE:k=!1,stateStore:x,refreshTokenCredentials:T,revokeTokenAdditionalContentTypes:R,fetchRequestCredentials:O,refreshTokenAllowedScope:M,extraQueryParams:I={},extraTokenParams:P={},extraHeaders:C={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=n,this.client_id=o,this.client_secret=s,this.response_type=a,this.scope=u,this.redirect_uri=c,this.post_logout_redirect_uri=f,this.client_authentication=d,this.prompt=h,this.display=l,this.max_age=p,this.ui_locales=g,this.acr_values=m,this.resource=y,this.response_mode=b,this.filterProtocolClaims=null==v||v,this.loadUserInfo=!!w,this.staleStateAgeInSeconds=_,this.clockSkewInSeconds=E,this.userInfoJwtIssuer=A,this.mergeClaims=!!S,this.disablePKCE=!!k,this.revokeTokenAdditionalContentTypes=R,O&&T&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=O||(T||"same-origin"),x)this.stateStore=x;else{const e="undefined"!=typeof window?window.localStorage:new wR;this.stateStore=new ER({store:e})}this.refreshTokenAllowedScope=M,this.extraQueryParams=I,this.extraTokenParams=P,this.extraHeaders=C}},SR=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new fR("TokenClient"),this._jsonService=new _R(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:n=this._settings.client_secret,...i}){const o=this._logger.create("exchangeCode");r||o.throw(new Error("A client_id is required")),t||o.throw(new Error("A redirect_uri is required")),i.code||o.throw(new Error("A code is required"));const s=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[e,t]of Object.entries(i))null!=t&&s.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!n)throw o.throw(new Error("A client_secret is required")),null;a=dR.generateBasicAuth(r,n);break;case"client_secret_post":s.append("client_id",r),n&&s.append("client_secret",n)}const u=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const c=await this._jsonService.postForm(u,{body:s,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return o.debug("got response"),c}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:n=this._settings.scope,...i}){const o=this._logger.create("exchangeCredentials");t||o.throw(new Error("A client_id is required"));const s=new URLSearchParams({grant_type:e,scope:n});for(const[e,t]of Object.entries(i))null!=t&&s.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw o.throw(new Error("A client_secret is required")),null;a=dR.generateBasicAuth(t,r);break;case"client_secret_post":s.append("client_id",t),r&&s.append("client_secret",r)}const u=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const c=await this._jsonService.postForm(u,{body:s,basicAuth:a,initCredentials:this._settings.fetchRequestCredentials});return o.debug("got response"),c}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:n,...i}){const o=this._logger.create("exchangeRefreshToken");t||o.throw(new Error("A client_id is required")),i.refresh_token||o.throw(new Error("A refresh_token is required"));const s=new URLSearchParams({grant_type:e});for(const[e,t]of Object.entries(i))null!=t&&s.set(e,t);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw o.throw(new Error("A client_secret is required")),null;a=dR.generateBasicAuth(t,r);break;case"client_secret_post":s.append("client_id",t),r&&s.append("client_secret",r)}const u=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const c=await this._jsonService.postForm(u,{body:s,basicAuth:a,timeoutInSeconds:n,initCredentials:this._settings.fetchRequestCredentials});return o.debug("got response"),c}async revoke(e){var t;const r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));const n=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${null!=(t=e.token_type_hint)?t:"default token type"}`);const i=new URLSearchParams;for(const[t,r]of Object.entries(e))null!=r&&i.set(t,r);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(n,{body:i}),r.debug("got response")}},kR=class{constructor(e){this.id=e.id||dR.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=gR.getEpochTime(),this.request_type=e.request_type}toStorageString(){return new fR("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})}static fromStorageString(e){return fR.createStatic("State","fromStorageString"),new kR(JSON.parse(e))}static async clearStaleState(e,t){const r=fR.createStatic("State","clearStaleState"),n=gR.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let t=0;t<i.length;t++){const o=i[t],s=await e.get(o);let a=!1;if(s)try{const e=kR.fromStorageString(s);r.debug("got item from key:",o,e.created),e.created<=n&&(a=!0)}catch(e){r.error("Error parsing state for key:",o,e),a=!0}else r.debug("no item in storage for key:",o),a=!0;a&&(r.debug("removed item for key:",o),e.remove(o))}}},xR=class extends kR{constructor(e){super(e),!0===e.code_verifier?this.code_verifier=dR.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=dR.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new fR("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){fR.createStatic("SigninState","fromStorageString");const t=JSON.parse(e);return new xR(t)}},TR=class{constructor(e){this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-gR.getEpochTime()}set expires_in(e){"string"==typeof e&&(e=Number(e)),void 0!==e&&e>=0&&(this.expires_at=Math.floor(e)+gR.getEpochTime())}get isOpenId(){var e;return(null==(e=this.scope)?void 0:e.split(" ").includes("openid"))||!!this.id_token}},RR=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],OR=["sub","iss","aud","exp","iat"],MR=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=null!=(t=e.session_state)?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState}get expires_in(){if(void 0!==this.expires_at)return this.expires_at-gR.getEpochTime()}set expires_in(e){void 0!==e&&(this.expires_at=Math.floor(e)+gR.getEpochTime())}get expired(){const e=this.expires_in;if(void 0!==e)return e<=0}get scopes(){var e,t;return null!=(t=null==(e=this.scope)?void 0:e.split(" "))?t:[]}toStorageString(){return new fR("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return fR.createStatic("User","fromStorageString"),new MR(JSON.parse(e))}},IR="oidc-client",PR=class{constructor(){this._abort=new hR("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:r,keepOpen:n}=await new Promise(((r,n)=>{const i=i=>{var o;const s=i.data,a=null!=(o=e.scriptOrigin)?o:window.location.origin;if(i.origin===a&&(null==s?void 0:s.source)===IR){try{const r=mR.readParams(s.url,e.response_mode).get("state");if(r||t.warn("no state found in response url"),i.source!==this._window&&r!==e.state)return}catch(e){this._dispose(),n(new Error("Invalid response from window"))}r(s)}};window.addEventListener("message",i,!1),this._disposeHandlers.add((()=>window.removeEventListener("message",i,!1))),this._disposeHandlers.add(this._abort.addHandler((e=>{this._dispose(),n(e)})))}));return t.debug("got response from window"),this._dispose(),n||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,n=window.location.origin){e.postMessage({source:IR,url:t,keepOpen:r},n)}},CR={location:!1,toolbar:!1,height:640},NR="_blank",BR=60,jR=2,LR=10,UR=class extends AR{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:n=CR,popupWindowTarget:i=NR,redirectMethod:o="assign",redirectTarget:s="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:u=e.iframeScriptOrigin,silent_redirect_uri:c=e.redirect_uri,silentRequestTimeoutInSeconds:f=LR,automaticSilentRenew:d=!0,validateSubOnSilentRenew:h=!0,includeIdTokenInSilentRenew:l=!1,monitorSession:p=!1,monitorAnonymousSession:g=!1,checkSessionIntervalInSeconds:m=jR,query_status_response_type:y="code",stopCheckSessionOnError:b=!0,revokeTokenTypes:v=["access_token","refresh_token"],revokeTokensOnSignout:w=!1,includeIdTokenInSilentSignout:_=!1,accessTokenExpiringNotificationTimeInSeconds:E=BR,userStore:A}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=n,this.popupWindowTarget=i,this.redirectMethod=o,this.redirectTarget=s,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=u,this.silent_redirect_uri=c,this.silentRequestTimeoutInSeconds=f,this.automaticSilentRenew=d,this.validateSubOnSilentRenew=h,this.includeIdTokenInSilentRenew=l,this.monitorSession=p,this.monitorAnonymousSession=g,this.checkSessionIntervalInSeconds=m,this.stopCheckSessionOnError=b,this.query_status_response_type=y,this.revokeTokenTypes=v,this.revokeTokensOnSignout=w,this.includeIdTokenInSilentSignout=_,this.accessTokenExpiringNotificationTimeInSeconds=E,A)this.userStore=A;else{const e="undefined"!=typeof window?window.sessionStorage:new wR;this.userStore=new ER({store:e})}}},DR=class extends PR{constructor({silentRequestTimeoutInSeconds:e=LR}){super(),this._logger=new fR("IFrameWindow"),this._timeoutInSeconds=e,this._frame=DR.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const t=setTimeout((()=>this._abort.raise(new bR("IFrame timed out without a response"))),1e3*this._timeoutInSeconds);return this._disposeHandlers.add((()=>clearTimeout(t))),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",(e=>{var t;const r=e.target;null==(t=r.parentNode)||t.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))}),!0),null==(e=this._frame.contentWindow)||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},FR=class extends PR{constructor({popupWindowTarget:e=NR,popupWindowFeatures:t={}}){super(),this._logger=new fR("PopupWindow");const r=pR.center({...CR,...t});this._window=window.open(void 0,e,pR.serialize(r))}async navigate(e){var t;null==(t=this._window)||t.focus();const r=setInterval((()=>{this._window&&!this._window.closed||this._abort.raise(new Error("Popup closed by user"))}),500);return this._disposeHandlers.add((()=>clearInterval(r))),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},qR=class extends vR{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new fR("UserManagerEvents"),this._userLoaded=new hR("User loaded"),this._userUnloaded=new hR("User unloaded"),this._silentRenewError=new hR("Silent renew error"),this._userSignedIn=new hR("User signed in"),this._userSignedOut=new hR("User signed out"),this._userSessionChanged=new hR("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}};function zR(e,t){return function(){return e.apply(t,arguments)}}const{toString:KR}=Object.prototype,{getPrototypeOf:HR}=Object,GR=(WR=Object.create(null),e=>{const t=KR.call(e);return WR[t]||(WR[t]=t.slice(8,-1).toLowerCase())});var WR;const VR=e=>(e=e.toLowerCase(),t=>GR(t)===e),XR=e=>t=>typeof t===e,{isArray:JR}=Array,$R=XR("undefined");const YR=VR("ArrayBuffer");const QR=XR("string"),ZR=XR("function"),eO=XR("number"),tO=e=>null!==e&&"object"==typeof e,rO=e=>{if("object"!==GR(e))return!1;const t=HR(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},nO=VR("Date"),iO=VR("File"),oO=VR("Blob"),sO=VR("FileList"),aO=VR("URLSearchParams");function uO(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),JR(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function cO(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const fO="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,dO=e=>!$R(e)&&e!==fO;const hO=(lO="undefined"!=typeof Uint8Array&&HR(Uint8Array),e=>lO&&e instanceof lO);var lO;const pO=VR("HTMLFormElement"),gO=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),mO=VR("RegExp"),yO=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};uO(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},bO="abcdefghijklmnopqrstuvwxyz",vO="0123456789",wO={DIGIT:vO,ALPHA:bO,ALPHA_DIGIT:bO+bO.toUpperCase()+vO};const _O=VR("AsyncFunction");var EO={isArray:JR,isArrayBuffer:YR,isBuffer:function(e){return null!==e&&!$R(e)&&null!==e.constructor&&!$R(e.constructor)&&ZR(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||ZR(e.append)&&("formdata"===(t=GR(e))||"object"===t&&ZR(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&YR(e.buffer),t},isString:QR,isNumber:eO,isBoolean:e=>!0===e||!1===e,isObject:tO,isPlainObject:rO,isUndefined:$R,isDate:nO,isFile:iO,isBlob:oO,isRegExp:mO,isFunction:ZR,isStream:e=>tO(e)&&ZR(e.pipe),isURLSearchParams:aO,isTypedArray:hO,isFileList:sO,forEach:uO,merge:function e(){const{caseless:t}=dO(this)&&this||{},r={},n=(n,i)=>{const o=t&&cO(r,i)||i;rO(r[o])&&rO(n)?r[o]=e(r[o],n):rO(n)?r[o]=e({},n):JR(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&uO(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(uO(t,((t,n)=>{r&&ZR(t)?e[n]=zR(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,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],n&&!n(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&HR(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:GR,kindOfTest:VR,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(JR(e))return e;let t=e.length;if(!eO(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:pO,hasOwnProperty:gO,hasOwnProp:gO,reduceDescriptors:yO,freezeMethods:e=>{yO(e,((t,r)=>{if(ZR(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];ZR(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 JR(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:cO,global:fO,isContextDefined:dO,ALPHABET:wO,generateString:(e=16,t=wO.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&ZR(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(tO(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=JR(e)?[]:{};return uO(e,((e,t)=>{const o=r(e,n+1);!$R(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:_O,isThenable:e=>e&&(tO(e)||ZR(e))&&ZR(e.then)&&ZR(e.catch)};function AO(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)}EO.inherits(AO,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:EO.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const SO=AO.prototype,kO={};["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=>{kO[e]={value:e}})),Object.defineProperties(AO,kO),Object.defineProperty(SO,"isAxiosError",{value:!0}),AO.from=(e,t,r,n,i,o)=>{const s=Object.create(SO);return EO.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),AO.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function xO(e){return EO.isPlainObject(e)||EO.isArray(e)}function TO(e){return EO.endsWith(e,"[]")?e.slice(0,-2):e}function RO(e,t,r){return e?e.concat(t).map((function(e,t){return e=TO(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const OO=EO.toFlatObject(EO,{},null,(function(e){return/^is[A-Z]/.test(e)}));function MO(e,t,r){if(!EO.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=EO.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!EO.isUndefined(t[e])}))).metaTokens,i=r.visitor||c,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&EO.isSpecCompliantForm(t);if(!EO.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(EO.isDate(e))return e.toISOString();if(!a&&EO.isBlob(e))throw new AO("Blob is not supported. Use a Buffer instead.");return EO.isArrayBuffer(e)||EO.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(EO.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(EO.isArray(e)&&function(e){return EO.isArray(e)&&!e.some(xO)}(e)||(EO.isFileList(e)||EO.endsWith(r,"[]"))&&(a=EO.toArray(e)))return r=TO(r),a.forEach((function(e,n){!EO.isUndefined(e)&&null!==e&&t.append(!0===s?RO([r],n,o):null===s?r:r+"[]",u(e))})),!1;return!!xO(e)||(t.append(RO(i,r,o),u(e)),!1)}const f=[],d=Object.assign(OO,{defaultVisitor:c,convertValue:u,isVisitable:xO});if(!EO.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!EO.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),EO.forEach(r,(function(r,o){!0===(!(EO.isUndefined(r)||null===r)&&i.call(t,r,EO.isString(o)?o.trim():o,n,d))&&e(r,n?n.concat(o):[o])})),f.pop()}}(e),t}function IO(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function PO(e,t){this._pairs=[],e&&MO(e,this,t)}const CO=PO.prototype;function NO(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function BO(e,t,r){if(!t)return e;const n=r&&r.encode||NO,i=r&&r.serialize;let o;if(o=i?i(t,r):EO.isURLSearchParams(t)?t.toString():new PO(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}CO.append=function(e,t){this._pairs.push([e,t])},CO.toString=function(e){const t=e?function(t){return e.call(this,t,IO)}:IO;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var jO=class{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){EO.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},LO={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var UO={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:PO,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function DO(e){function t(e,r,n,i){let o=e[i++];const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&EO.isArray(n)?n.length:o,a)return EO.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&EO.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&EO.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<i;n++)o=r[n],t[o]=e[o];return t}(n[o])),!s}if(EO.isFormData(e)&&EO.isFunction(e.entries)){const r={};return EO.forEachEntry(e,((e,n)=>{t(function(e){return EO.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const FO={"Content-Type":void 0};const qO={transitional:LO,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=EO.isObject(e);i&&EO.isHTMLForm(e)&&(e=new FormData(e));if(EO.isFormData(e))return n&&n?JSON.stringify(DO(e)):e;if(EO.isArrayBuffer(e)||EO.isBuffer(e)||EO.isStream(e)||EO.isFile(e)||EO.isBlob(e))return e;if(EO.isArrayBufferView(e))return e.buffer;if(EO.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 MO(e,new UO.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return UO.isNode&&EO.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=EO.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return MO(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(EO.isString(e))try{return(t||JSON.parse)(e),EO.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||qO.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&EO.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 AO.from(e,AO.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:UO.classes.FormData,Blob:UO.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};EO.forEach(["delete","get","head"],(function(e){qO.headers[e]={}})),EO.forEach(["post","put","patch"],(function(e){qO.headers[e]=EO.merge(FO)}));var zO=qO;const KO=EO.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 HO=Symbol("internals");function GO(e){return e&&String(e).trim().toLowerCase()}function WO(e){return!1===e||null==e?e:EO.isArray(e)?e.map(WO):String(e)}function VO(e,t,r,n,i){return EO.isFunction(n)?n.call(this,t,r):(i&&(t=r),EO.isString(t)?EO.isString(n)?-1!==t.indexOf(n):EO.isRegExp(n)?n.test(t):void 0:void 0)}let XO=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=GO(t);if(!i)throw new Error("header name must be a non-empty string");const o=EO.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=WO(e))}const o=(e,t)=>EO.forEach(e,((e,r)=>i(e,r,t)));return EO.isPlainObject(e)||e instanceof this.constructor?o(e,t):EO.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]&&KO[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=GO(e)){const r=EO.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(EO.isFunction(t))return t.call(this,e,r);if(EO.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=GO(e)){const r=EO.findKey(this,e);return!(!r||void 0===this[r]||t&&!VO(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=GO(e)){const i=EO.findKey(r,e);!i||t&&!VO(0,r[i],i,t)||(delete r[i],n=!0)}}return EO.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&&!VO(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return EO.forEach(this,((n,i)=>{const o=EO.findKey(r,i);if(o)return t[o]=WO(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();s!==i&&delete t[i],t[s]=WO(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return EO.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&EO.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[HO]=this[HO]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=GO(e);t[n]||(!function(e,t){const r=EO.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 EO.isArray(e)?e.forEach(n):n(e),this}};XO.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),EO.freezeMethods(XO.prototype),EO.freezeMethods(XO);var JO=XO;function $O(e,t){const r=this||zO,n=t||r,i=JO.from(n.headers);let o=n.data;return EO.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function YO(e){return!(!e||!e.__CANCEL__)}function QO(e,t,r){AO.call(this,null==e?"canceled":e,AO.ERR_CANCELED,t,r),this.name="CanceledError"}EO.inherits(QO,AO,{__CANCEL__:!0});var ZO=UO.isStandardBrowserEnv?{write:function(e,t,r,n,i,o){const s=[];s.push(e+"="+encodeURIComponent(t)),EO.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),EO.isString(n)&&s.push("path="+n),EO.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function eM(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var tM=UO.isStandardBrowserEnv?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=EO.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function rM(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,s=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=n[s];i||(i=u),r[o]=a,n[o]=u;let f=s,d=0;for(;f!==o;)d+=r[f++],f%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-i<t)return;const h=c&&u-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-r,u=n(a);r=o;const c={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&o<=s?(s-o)/u:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}var nM="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=JO.from(e.headers).normalize(),o=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}EO.isFormData(n)&&(UO.isStandardBrowserEnv||UO.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let u=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 c=eM(e.baseURL,e.url);function f(){if(!u)return;const n=JO.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new AO("Request failed with status code "+r.status,[AO.ERR_BAD_REQUEST,AO.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),BO(c,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(f)},u.onabort=function(){u&&(r(new AO("Request aborted",AO.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new AO("Network Error",AO.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||LO;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new AO(t,n.clarifyTimeoutError?AO.ETIMEDOUT:AO.ECONNABORTED,e,u)),u=null},UO.isStandardBrowserEnv){const t=(e.withCredentials||tM(c))&&e.xsrfCookieName&&ZO.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&EO.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),EO.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&"json"!==o&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",rM(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",rM(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{u&&(r(!t||t.type?new QO(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);d&&-1===UO.protocols.indexOf(d)?r(new AO("Unsupported protocol "+d+":",AO.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const iM={http:null,xhr:nM};EO.forEach(iM,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var oM=e=>{e=EO.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=EO.isString(r)?iM[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new AO(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(EO.hasOwnProp(iM,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!EO.isFunction(n))throw new TypeError("adapter is not a function");return n};function sM(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new QO(null,e)}function aM(e){sM(e),e.headers=JO.from(e.headers),e.data=$O.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return oM(e.adapter||zO.adapter)(e).then((function(t){return sM(e),t.data=$O.call(e,e.transformResponse,t),t.headers=JO.from(t.headers),t}),(function(t){return YO(t)||(sM(e),t&&t.response&&(t.response.data=$O.call(e,e.transformResponse,t.response),t.response.headers=JO.from(t.response.headers))),Promise.reject(t)}))}const uM=e=>e instanceof JO?e.toJSON():e;function cM(e,t){t=t||{};const r={};function n(e,t,r){return EO.isPlainObject(e)&&EO.isPlainObject(t)?EO.merge.call({caseless:r},e,t):EO.isPlainObject(t)?EO.merge({},t):EO.isArray(t)?t.slice():t}function i(e,t,r){return EO.isUndefined(t)?EO.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!EO.isUndefined(t))return n(void 0,t)}function s(e,t){return EO.isUndefined(t)?EO.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>i(uM(e),uM(t),!0)};return EO.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=u[n]||i,s=o(e[n],t[n],n);EO.isUndefined(s)&&o!==a||(r[n]=s)})),r}const fM="1.4.0",dM={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{dM[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const hM={};dM.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new AO(n(i," has been removed"+(t?" in "+t:"")),AO.ERR_DEPRECATED);return t&&!hM[i]&&(hM[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 lM={assertOptions:function(e,t,r){if("object"!=typeof e)throw new AO("options must be an object",AO.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new AO("option "+o+" must be "+r,AO.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new AO("Unknown option "+o,AO.ERR_BAD_OPTION)}},validators:dM};const pM=lM.validators;let gM=class{constructor(e){this.defaults=e,this.interceptors={request:new jO,response:new jO}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=cM(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let o;void 0!==r&&lM.assertOptions(r,{silentJSONParsing:pM.transitional(pM.boolean),forcedJSONParsing:pM.transitional(pM.boolean),clarifyTimeoutError:pM.transitional(pM.boolean)},!1),null!=n&&(EO.isFunction(n)?t.paramsSerializer={serialize:n}:lM.assertOptions(n,{encode:pM.function,serialize:pM.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),o=i&&EO.merge(i.common,i[t.method]),o&&EO.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=JO.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let f,d=0;if(!a){const e=[aM.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,u),f=e.length,c=Promise.resolve(t);d<f;)c=c.then(e[d++],e[d++]);return c}f=s.length;let h=t;for(d=0;d<f;){const e=s[d++],t=s[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=aM.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,f=u.length;d<f;)c=c.then(u[d++],u[d++]);return c}getUri(e){return BO(eM((e=cM(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};EO.forEach(["delete","get","head","options"],(function(e){gM.prototype[e]=function(t,r){return this.request(cM(r||{},{method:e,url:t,data:(r||{}).data}))}})),EO.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(cM(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}gM.prototype[e]=t(),gM.prototype[e+"Form"]=t(!0)}));var mM=gM;var yM=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{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 QO(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;const r=new e((function(e){t=e}));return{token:r,cancel:t}}};const bM={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(bM).forEach((([e,t])=>{bM[t]=e}));var vM=bM;const wM=function e(t){const r=new mM(t),n=zR(mM.prototype.request,r);return EO.extend(n,mM.prototype,r,{allOwnKeys:!0}),EO.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(cM(t,r))},n}(zO);wM.Axios=mM,wM.CanceledError=QO,wM.CancelToken=yM,wM.isCancel=YO,wM.VERSION=fM,wM.toFormData=MO,wM.AxiosError=AO,wM.Cancel=wM.CanceledError,wM.all=function(e){return Promise.all(e)},wM.spread=function(e){return function(t){return e.apply(null,t)}},wM.isAxiosError=function(e){return EO.isObject(e)&&!0===e.isAxiosError},wM.mergeConfig=cM,wM.AxiosHeaders=JO,wM.formToJSON=e=>DO(EO.isHTMLForm(e)?new FormData(e):e),wM.HttpStatusCode=vM,wM.default=wM;var _M=wM,EM=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(EM||{}),AM=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e))(AM||{}),SM=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e))(SM||{}),kM=(e=>(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_auth_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="mc_get_wallet_info",e.ShowUI="mc_wallet",e.NFTPurchase="magic_nft_purchase",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.UpdatePhoneNumber="magic_auth_update_phone_number",e.UpdatePhoneNumberTestMode="magic_auth_update_phone_number_testing_mode",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e))(kM||{}),xM=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e))(xM||{}),TM=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e))(TM||{}),RM=(e=>(e.Harmony="HARMONY",e))(RM||{}),OM=Object.create,MM=Object.defineProperty,IM=Object.defineProperties,PM=Object.getOwnPropertyDescriptor,CM=Object.getOwnPropertyDescriptors,NM=Object.getOwnPropertyNames,BM=Object.getOwnPropertySymbols,jM=Object.getPrototypeOf,LM=Object.prototype.hasOwnProperty,UM=Object.prototype.propertyIsEnumerable,DM=(e,t,r)=>t in e?MM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,FM=(e,t)=>{for(var r in t||(t={}))LM.call(t,r)&&DM(e,r,t[r]);if(BM)for(var r of BM(t))UM.call(t,r)&&DM(e,r,t[r]);return e},qM=(e,t,r)=>new Promise(((n,i)=>{var o=e=>{try{a(r.next(e))}catch(e){i(e)}},s=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((r=r.apply(e,t)).next())})),zM=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))(((e,t)=>{var r=Object.prototype.hasOwnProperty,n="~";function i(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],a]:e._events[u].push(a):(e._events[u]=a,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function u(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),u.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},u.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i<o;i++)s[i]=r[i].fn;return s},u.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,i,o,s){var a=n?n+e:e;if(!this._events[a])return!1;var u,c,f=this._events[a],d=arguments.length;if(f.fn){switch(f.once&&this.removeListener(e,f.fn,void 0,!0),d){case 1:return f.fn.call(f.context),!0;case 2:return f.fn.call(f.context,t),!0;case 3:return f.fn.call(f.context,t,r),!0;case 4:return f.fn.call(f.context,t,r,i),!0;case 5:return f.fn.call(f.context,t,r,i,o),!0;case 6:return f.fn.call(f.context,t,r,i,o,s),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];f.fn.apply(f.context,u)}else{var h,l=f.length;for(c=0;c<l;c++)switch(f[c].once&&this.removeListener(e,f[c].fn,void 0,!0),d){case 1:f[c].fn.call(f[c].context);break;case 2:f[c].fn.call(f[c].context,t);break;case 3:f[c].fn.call(f[c].context,t,r);break;case 4:f[c].fn.call(f[c].context,t,r,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];f[c].fn.apply(f[c].context,u)}}return!0},u.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&a(this,o);else{for(var u=0,c=[],f=s.length;u<f;u++)(s[u].fn!==t||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=n,u.EventEmitter=u,typeof t<"u"&&(t.exports=u)}));var KM={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16},HM="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},GM=HM,WM=function(e){let t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=KM,n=(t=e.exports={}).re=[],i=t.src=[],o=t.t={},s=0,a=(e,t,r)=>{let a=s++;GM(a,t),o[e]=a,i[a]=t,n[a]=new RegExp(t,r?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION",`(${i[o.NUMERICIDENTIFIER]})\\.(${i[o.NUMERICIDENTIFIER]})\\.(${i[o.NUMERICIDENTIFIER]})`),a("MAINVERSIONLOOSE",`(${i[o.NUMERICIDENTIFIERLOOSE]})\\.(${i[o.NUMERICIDENTIFIERLOOSE]})\\.(${i[o.NUMERICIDENTIFIERLOOSE]})`),a("PRERELEASEIDENTIFIER",`(?:${i[o.NUMERICIDENTIFIER]}|${i[o.NONNUMERICIDENTIFIER]})`),a("PRERELEASEIDENTIFIERLOOSE",`(?:${i[o.NUMERICIDENTIFIERLOOSE]}|${i[o.NONNUMERICIDENTIFIER]})`),a("PRERELEASE",`(?:-(${i[o.PRERELEASEIDENTIFIER]}(?:\\.${i[o.PRERELEASEIDENTIFIER]})*))`),a("PRERELEASELOOSE",`(?:-?(${i[o.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[o.PRERELEASEIDENTIFIERLOOSE]})*))`),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD",`(?:\\+(${i[o.BUILDIDENTIFIER]}(?:\\.${i[o.BUILDIDENTIFIER]})*))`),a("FULLPLAIN",`v?${i[o.MAINVERSION]}${i[o.PRERELEASE]}?${i[o.BUILD]}?`),a("FULL",`^${i[o.FULLPLAIN]}$`),a("LOOSEPLAIN",`[v=\\s]*${i[o.MAINVERSIONLOOSE]}${i[o.PRERELEASELOOSE]}?${i[o.BUILD]}?`),a("LOOSE",`^${i[o.LOOSEPLAIN]}$`),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE",`${i[o.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),a("XRANGEIDENTIFIER",`${i[o.NUMERICIDENTIFIER]}|x|X|\\*`),a("XRANGEPLAIN",`[v=\\s]*(${i[o.XRANGEIDENTIFIER]})(?:\\.(${i[o.XRANGEIDENTIFIER]})(?:\\.(${i[o.XRANGEIDENTIFIER]})(?:${i[o.PRERELEASE]})?${i[o.BUILD]}?)?)?`),a("XRANGEPLAINLOOSE",`[v=\\s]*(${i[o.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[o.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[o.XRANGEIDENTIFIERLOOSE]})(?:${i[o.PRERELEASELOOSE]})?${i[o.BUILD]}?)?)?`),a("XRANGE",`^${i[o.GTLT]}\\s*${i[o.XRANGEPLAIN]}$`),a("XRANGELOOSE",`^${i[o.GTLT]}\\s*${i[o.XRANGEPLAINLOOSE]}$`),a("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),a("COERCERTL",i[o.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM",`(\\s*)${i[o.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",a("TILDE",`^${i[o.LONETILDE]}${i[o.XRANGEPLAIN]}$`),a("TILDELOOSE",`^${i[o.LONETILDE]}${i[o.XRANGEPLAINLOOSE]}$`),a("LONECARET","(?:\\^)"),a("CARETTRIM",`(\\s*)${i[o.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",a("CARET",`^${i[o.LONECARET]}${i[o.XRANGEPLAIN]}$`),a("CARETLOOSE",`^${i[o.LONECARET]}${i[o.XRANGEPLAINLOOSE]}$`),a("COMPARATORLOOSE",`^${i[o.GTLT]}\\s*(${i[o.LOOSEPLAIN]})$|^$`),a("COMPARATOR",`^${i[o.GTLT]}\\s*(${i[o.FULLPLAIN]})$|^$`),a("COMPARATORTRIM",`(\\s*)${i[o.GTLT]}\\s*(${i[o.LOOSEPLAIN]}|${i[o.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE",`^\\s*(${i[o.XRANGEPLAIN]})\\s+-\\s+(${i[o.XRANGEPLAIN]})\\s*$`),a("HYPHENRANGELOOSE",`^\\s*(${i[o.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[o.XRANGEPLAINLOOSE]})\\s*$`),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>=\\s*0.0.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")})),VM=/^[0-9]+$/,XM=(e,t)=>{let r=VM.test(e),n=VM.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},JM={compareIdentifiers:XM,rcompareIdentifiers:(e,t)=>XM(t,e)},{MAX_LENGTH:$M,MAX_SAFE_INTEGER:YM}=KM,{re:QM,t:ZM}=WM,{compareIdentifiers:eI}=JM,tI=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof tI){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>$M)throw new TypeError(`version is longer than ${$M} characters`);GM("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?QM[ZM.LOOSE]:QM[ZM.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>YM||this.major<0)throw new TypeError("Invalid major version");if(this.minor>YM||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>YM||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<YM)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(GM("SemVer.compare",this.version,this.options,e),!(e instanceof tI)){if("string"==typeof e&&e===this.version)return 0;e=new tI(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof tI||(e=new tI(e,this.options)),eI(this.major,e.major)||eI(this.minor,e.minor)||eI(this.patch,e.patch)}comparePre(e){if(e instanceof tI||(e=new tI(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(GM("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return eI(r,n)}while(++t)}compareBuild(e){e instanceof tI||(e=new tI(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(GM("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return eI(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},rI=(e,t,r)=>new tI(e,r).compare(new tI(t,r)),nI=(e,t,r)=>0===rI(e,t,r),iI=(e,t,r)=>0!==rI(e,t,r),oI=(e,t,r)=>rI(e,t,r)>0,sI=(e,t,r)=>rI(e,t,r)>=0,aI=(e,t,r)=>rI(e,t,r)<0,uI=(e,t,r)=>rI(e,t,r)<=0,cI=(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 nI(e,r,n);case"!=":return iI(e,r,n);case">":return oI(e,r,n);case">=":return sI(e,r,n);case"<":return aI(e,r,n);case"<=":return uI(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}},fI=Symbol("SemVer ANY"),dI=class{static get ANY(){return fI}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof dI){if(e.loose===!!t.loose)return e;e=e.value}GM("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===fI?this.value="":this.value=this.operator+this.semver.version,GM("comp",this)}parse(e){let t=this.options.loose?hI[lI.COMPARATORLOOSE]:hI[lI.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new tI(r[2],this.options.loose):this.semver=fI}toString(){return this.value}test(e){if(GM("Comparator.test",e,this.options.loose),this.semver===fI||e===fI)return!0;if("string"==typeof e)try{e=new tI(e,this.options)}catch(e){return!1}return cI(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof dI))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new pI(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new pI(this.value,t).test(e.semver);let r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),s=cI(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),a=cI(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||i&&o||s||a}},{re:hI,t:lI}=WM,pI=class{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof pI)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new pI(e.raw,t);if(e instanceof dI)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?gI[mI.HYPHENRANGELOOSE]:gI[mI.HYPHENRANGE];e=e.replace(r,II(this.options.includePrerelease)),GM("hyphen replace",e),e=e.replace(gI[mI.COMPARATORTRIM],yI),GM("comparator trim",e,gI[mI.COMPARATORTRIM]),e=(e=(e=e.replace(gI[mI.TILDETRIM],bI)).replace(gI[mI.CARETTRIM],vI)).split(/\s+/).join(" ");let n=t?gI[mI.COMPARATORLOOSE]:gI[mI.COMPARATOR];return e.split(" ").map((e=>_I(e,this.options))).join(" ").split(/\s+/).map((e=>MI(e,this.options))).filter(this.options.loose?e=>!!e.match(n):()=>!0).map((e=>new dI(e,this.options)))}intersects(e,t){if(!(e instanceof pI))throw new TypeError("a Range is required");return this.set.some((r=>wI(r,t)&&e.set.some((e=>wI(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new tI(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(PI(this.set[t],e,this.options))return!0;return!1}},{re:gI,t:mI,comparatorTrimReplace:yI,tildeTrimReplace:bI,caretTrimReplace:vI}=WM,wI=(e,t)=>{let r=!0,n=e.slice(),i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},_I=(e,t)=>(GM("comp",e,t),e=kI(e,t),GM("caret",e),e=AI(e,t),GM("tildes",e),e=TI(e,t),GM("xrange",e),e=OI(e,t),GM("stars",e),e),EI=e=>!e||"x"===e.toLowerCase()||"*"===e,AI=(e,t)=>e.trim().split(/\s+/).map((e=>SI(e,t))).join(" "),SI=(e,t)=>{let r=t.loose?gI[mI.TILDELOOSE]:gI[mI.TILDE];return e.replace(r,((t,r,n,i,o)=>{let s;return GM("tilde",e,t,r,n,i,o),EI(r)?s="":EI(n)?s=`>=${r}.0.0 <${+r+1}.0.0-0`:EI(i)?s=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(GM("replaceTilde pr",o),s=`>=${r}.${n}.${i}-${o} <${r}.${+n+1}.0-0`):s=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,GM("tilde return",s),s}))},kI=(e,t)=>e.trim().split(/\s+/).map((e=>xI(e,t))).join(" "),xI=(e,t)=>{GM("caret",e,t);let r=t.loose?gI[mI.CARETLOOSE]:gI[mI.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,o,s)=>{let a;return GM("caret",e,t,r,i,o,s),EI(r)?a="":EI(i)?a=`>=${r}.0.0${n} <${+r+1}.0.0-0`:EI(o)?a="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:s?(GM("replaceCaret pr",s),a="0"===r?"0"===i?`>=${r}.${i}.${o}-${s} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}-${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o}-${s} <${+r+1}.0.0-0`):(GM("no pr"),a="0"===r?"0"===i?`>=${r}.${i}.${o}${n} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o} <${+r+1}.0.0-0`),GM("caret return",a),a}))},TI=(e,t)=>(GM("replaceXRanges",e,t),e.split(/\s+/).map((e=>RI(e,t))).join(" ")),RI=(e,t)=>{e=e.trim();let r=t.loose?gI[mI.XRANGELOOSE]:gI[mI.XRANGE];return e.replace(r,((r,n,i,o,s,a)=>{GM("xRange",e,r,n,i,o,s,a);let u=EI(i),c=u||EI(o),f=c||EI(s),d=f;return"="===n&&d&&(n=""),a=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(c&&(o=0),s=0,">"===n?(n=">=",c?(i=+i+1,o=0,s=0):(o=+o+1,s=0)):"<="===n&&(n="<",c?i=+i+1:o=+o+1),"<"===n&&(a="-0"),r=`${n+i}.${o}.${s}${a}`):c?r=`>=${i}.0.0${a} <${+i+1}.0.0-0`:f&&(r=`>=${i}.${o}.0${a} <${i}.${+o+1}.0-0`),GM("xRange return",r),r}))},OI=(e,t)=>(GM("replaceStars",e,t),e.trim().replace(gI[mI.STAR],"")),MI=(e,t)=>(GM("replaceGTE0",e,t),e.trim().replace(gI[t.includePrerelease?mI.GTE0PRE:mI.GTE0],"")),II=e=>(t,r,n,i,o,s,a,u,c,f,d,h,l)=>`${r=EI(n)?"":EI(i)?`>=${n}.0.0${e?"-0":""}`:EI(o)?`>=${n}.${i}.0${e?"-0":""}`:s?`>=${r}`:`>=${r}${e?"-0":""}`} ${u=EI(c)?"":EI(f)?`<${+c+1}.0.0-0`:EI(d)?`<${c}.${+f+1}.0-0`:h?`<=${c}.${f}.${d}-${h}`:e?`<${c}.${f}.${+d+1}-0`:`<=${u}`}`.trim(),PI=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(GM(e[r].semver),e[r].semver!==dI.ANY&&e[r].semver.prerelease.length>0){let n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},CI=(e,t,r)=>{try{t=new pI(t,r)}catch(e){return!1}return t.test(e)},{MAX_LENGTH:NI}=KM,{re:BI,t:jI}=WM,LI=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof tI)return e;if("string"!=typeof e||e.length>NI||!(t.loose?BI[jI.LOOSE]:BI[jI.FULL]).test(e))return null;try{return new tI(e,t)}catch(e){return null}},{re:UI,t:DI}=WM,FI=(e,t)=>{if(e instanceof tI)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=UI[DI.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),UI[DI.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;UI[DI.COERCERTL].lastIndex=-1}else r=e.match(UI[DI.COERCE]);return null===r?null:LI(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};function qI(e){return String.fromCharCode(parseInt(e.slice(1),16))}function zI(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function KI(e){return function(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,qI))}(JSON.stringify(e))}function HI(e){return JSON.parse(function(e){return decodeURIComponent(Array.from(atob(e),zI).join(""))}(e))}function GI(e){return void 0===e}function WI(e){return function(e){return null===e}(e)||GI(e)}function VI(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var XI={};var JI={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"},$I=class extends Error{constructor(e,t){super(`Magic SDK Error: [${e}] ${t}`),this.code=e,this.rawMessage=t,this.__proto__=Error,Object.setPrototypeOf(this,$I.prototype)}},YI=class extends Error{constructor(e){super(),this.__proto__=Error;let t=Number(null==e?void 0:e.code);this.rawMessage=(null==e?void 0:e.message)||"Internal error",this.code=function(e){return!WI(e)&&"number"==typeof e&&Object.values(SM).includes(e)}(t)?t:SM.InternalError,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=(null==e?void 0:e.data)||void 0,Object.setPrototypeOf(this,YI.prototype)}},QI=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}log(){console.warn(this.message)}},ZI=class extends Error{constructor(e,t,r,n){super(`Magic Extension Error (${e.name}): [${t}] ${r}`),this.code=t,this.rawMessage=r,this.data=n,this.__proto__=Error,Object.setPrototypeOf(this,ZI.prototype)}},eP=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}log(){console.warn(this.message)}};function tP(){return new $I(EM.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.")}function rP(){return new $I(EM.MalformedResponse,"Response from the Magic iframe is malformed.")}function nP(e){return new $I(EM.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}function iP(e){let t=`Some extensions are incompatible with \`${XI.sdkName}@${XI.version}\`:`;return e.filter((e=>void 0!==e.compat&&null!==e.compat)).forEach((e=>{let r=e.compat[XI.sdkName];"string"==typeof r?t+=`\n - Extension \`${e.name}\` supports version(s) \`${r}\``:r||(t+=`\n - Extension \`${e.name}\` does not support ${XI.platform} environments.`)})),new $I(EM.IncompatibleExtensions,t)}function oP(e){return new $I(EM.InvalidArgument,`Invalid ${(e=>{let t=e+1,r=t%10,n=t%100;return 1===r&&11!==n?`${t}st`:2===r&&12!==n?`${t}nd`:3===r&&13!==n?`${t}rd`:`${t}th`})(e.argument)} argument given to \`${e.procedure}\`.\n Expected: \`${e.expected}\`\n Received: \`${e.received}\``)}function sP(){return new QI(AM.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${XI.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`)}var aP=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function uP(){return aP.next().value}var cP=Symbol("Payload pre-processed by Magic SDK");function fP(e){return Object.defineProperty(e,cP,{value:!0,enumerable:!1}),e}function dP(e){var t,r,n;return function(e){return!!e[cP]}(e)||(e.jsonrpc=null!=(t=e.jsonrpc)?t:"2.0",e.id=uP(),e.method=null!=(r=e.method)?r:"noop",e.params=null!=(n=e.params)?n:[],fP(e)),e}function hP(e,t=[]){return fP({params:t,method:e,jsonrpc:"2.0",id:uP()})}var lP=class{constructor(e){e instanceof lP?(this._jsonrpc=e.payload.jsonrpc,this._id=e.payload.id,this._result=e.payload.result,this._error=e.payload.error):function(e){return!WI(e)&&!(GI(e.jsonrpc)||GI(e.id)||GI(e.result)&&GI(e.error))}(e)?(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=e.result,this._error=e.error):(this._jsonrpc=e.jsonrpc,this._id=e.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return void 0!==this._error&&null!==this._error}get hasResult(){return void 0!==this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},pP=((e,t,r)=>(r=null!=e?OM(jM(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of NM(t))!LM.call(e,i)&&i!==r&&MM(e,i,{get:()=>t[i],enumerable:!(n=PM(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:MM(r,"default",{value:e,enumerable:!0}),e)))(zM()),gP=class extends pP.default{};function mP(){let e=new gP;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...n)=>(e[t].apply(e,n),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var yP=Symbol("isPromiEvent");function bP(e){return!!e[yP]}function vP(e){let t=wP(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:n}=mP(),i=Symbol("Promise.then"),o=Symbol("Promise.catch"),s=Symbol("Promise.finally"),a=(e,t)=>(...r)=>{let n=t[e].apply(t,r);return u(n)},u=e=>Object.assign(e,{[yP]:!0,[i]:e[i]||e.then,[o]:e[o]||e.catch,[s]:e[s]||e.finally,then:a(i,e),catch:a(o,e),finally:a(s,e),on:n("on",e),once:n("once",e),addListener:n("addListener",e),off:n("off",e),removeListener:n("removeListener",e),removeAllListeners:n("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),c=u(t.then((e=>(c.emit("done",e),c.emit("settled"),e)),(e=>{throw c.emit("error",e),c.emit("settled"),e})));return c}function wP(e){return new Promise(((t,r)=>{let n=e(t,r);Promise.resolve(n).catch(r)}))}var _P,EP=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){let t=this.overlay.post(TM.MAGIC_HANDLE_REQUEST,dP(e)),r=vP(((e,r)=>{t.then((t=>{if(n(),t.hasError)r(new YI(t.payload.error));else{if(!t.hasResult)throw rP();e(t.payload.result)}})).catch((e=>{n(),r(e)}))})),n=this.overlay.on(xM.MAGIC_HANDLE_EVENT,(t=>{var n;let{response:i}=t.data;if(i.id===e.id&&(null==(n=i.result)?void 0:n.event)){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}}));return r}createIntermediaryEvent(e,t){return r=>{let n=hP(kM.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(n)}}},AP=class extends EP{loginWithMagicLink(e){let{email:t,showUI:r=!0,redirectURI:n}=e,i=hP(this.sdk.testMode?kM.LoginWithMagicLinkTestMode:kM.LoginWithMagicLink,[{email:t,showUI:r,redirectURI:n}]);return this.request(i)}loginWithSMS(e){let{phoneNumber:t}=e,r=hP(this.sdk.testMode?kM.LoginWithSmsTestMode:kM.LoginWithSms,[{phoneNumber:t,showUI:!0}]);return this.request(r)}loginWithEmailOTP(e){let{email:t,showUI:r}=e,n=hP(this.sdk.testMode?kM.LoginWithEmailOTPTestMode:kM.LoginWithEmailOTP,[{email:t,showUI:r}]);if(!r){let e=this.request(n);return e&&e.on("otp-input-sent",(e=>{this.createIntermediaryEvent("verify-email-otp",n.id)(e)})),e}return this.request(n)}loginWithCredential(e){let t=null!=e?e:"";if(!e&&"web"===XI.platform){t=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let r=hP(this.sdk.testMode?kM.LoginWithCredentialTestMode:kM.LoginWithCredential,[t]);return this.request(r)}},SP={};function kP(e){return(...t)=>qM(this,null,(function*(){return _P||(_P=yield XI.configureStorage()),yield _P.ready(),_P[e](...t)}))}((e,t)=>{for(var r in t)MM(e,r,{get:t[r],enumerable:!0})})(SP,{clear:()=>OP,getItem:()=>xP,iterate:()=>CP,key:()=>IP,keys:()=>PP,length:()=>MP,removeItem:()=>RP,setItem:()=>TP});var xP=kP("getItem"),TP=kP("setItem"),RP=kP("removeItem"),OP=kP("clear"),MP=kP("length"),IP=kP("key"),PP=kP("keys"),CP=kP("iterate");function NP(){let e=window.crypto.getRandomValues(new Uint8Array(16));e[6]=15&e[6]|64,e[8]=191&e[8]|128;let t="";return t+=e[0].toString(16),t+=e[1].toString(16),t+=e[2].toString(16),t+=e[3].toString(16),t+="-",t+=e[4].toString(16),t+=e[5].toString(16),t+="-",t+=e[6].toString(16),t+=e[7].toString(16),t+="-",t+=e[8].toString(16),t+=e[9].toString(16),t+="-",t+=e[10].toString(16),t+=e[11].toString(16),t+=e[12].toString(16),t+=e[13].toString(16),t+=e[14].toString(16),t+=e[15].toString(16),t}var BP="STORE_KEY_PRIVATE_KEY",jP="STORE_KEY_PUBLIC_JWK",LP="ECDSA",UP="P-256",DP={name:LP,namedCurve:UP},FP={name:LP,namedCurve:UP};function qP(){RP(jP),RP(BP)}function zP(){return qM(this,null,(function*(){let e=yield function(){return qM(this,null,(function*(){if(function(){let e="undefined"!=typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}())return(yield xP(jP))||(yield function(){return qM(this,null,(function*(){let e=null,{subtle:t}=window.crypto,r=yield t.generateKey(DP,!0,["sign"]),n=yield t.exportKey("jwk",r.privateKey);e=yield t.exportKey("jwk",r.publicKey);let i=yield t.importKey("jwk",n,FP,!1,["sign"]);yield TP(BP,i),yield TP(jP,e)}))}()),xP(jP);console.info("webcrypto is not supported")}))}();if(!e)return void console.info("unable to create public key or webcrypto is unsupported");let{subtle:t}=window.crypto,r=yield xP(BP);if(!r||!t)return void console.info("unable to find private key or webcrypto unsupported");let n={iat:Math.floor((new Date).getTime()/1e3),jti:NP()},i={typ:"dpop+jwt",alg:"ES256",jwk:e},o=KP(JSON.stringify(i)),s=KP(JSON.stringify(n)),a=function(e){return(new TextEncoder).encode(e)}(`${o}.${s}`),u={name:LP,hash:{name:"SHA-256"}},c=function(e){let t="";return e.forEach((e=>{t+=String.fromCharCode(e)})),HP(t)}(new Uint8Array(yield t.sign(u,r,a)));return`${o}.${s}.${c}`}))}function KP(e){return HP(function(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))}(e))}function HP(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}var GP=class extends EP{getIdToken(e){let t=hP(this.sdk.testMode?kM.GetIdTokenTestMode:kM.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=hP(this.sdk.testMode?kM.GenerateIdTokenTestMode:kM.GenerateIdToken,[e]);return this.request(t)}getMetadata(){let e=hP(this.sdk.testMode?kM.GetMetadataTestMode:kM.GetMetadata);return this.request(e)}updateEmail(e){let{email:t,showUI:r=!0}=e,n=hP(this.sdk.testMode?kM.UpdateEmailTestMode:kM.UpdateEmail,[{email:t,showUI:r}]);return this.request(n)}isLoggedIn(){let e=hP(this.sdk.testMode?kM.IsLoggedInTestMode:kM.IsLoggedIn);return this.request(e)}logout(){qP();let e=hP(this.sdk.testMode?kM.LogoutTestMode:kM.Logout);return this.request(e)}showSettings(){let e=hP(this.sdk.testMode?kM.UserSettingsTestMode:kM.UserSettings);return this.request(e)}updatePhoneNumber(){let e=hP(this.sdk.testMode?kM.UpdatePhoneNumberTestMode:kM.UpdatePhoneNumber);return this.request(e)}recoverAccount(e){let t=hP(this.sdk.testMode?kM.RecoverAccountTestMode:kM.RecoverAccount,[e]);return this.request(t)}},WP=class extends EP{connectWithUI(){let e=hP(kM.RequestAccounts);return this.request(e)}showUI(){let e=hP(kM.ShowUI);return this.request(e)}getInfo(){let e=hP(kM.GetInfo);return this.request(e)}requestUserInfoWithUI(e){let t=hP(kM.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}disconnect(){qP();let e=hP(kM.Disconnect);return this.request(e)}},{createBoundEmitterMethod:VP,createChainingEmitterMethod:XP}=mP(),JP=class extends EP{constructor(){super(...arguments),this.isMagic=!0,this.on=XP("on",this),this.once=XP("once",this),this.addListener=XP("addListener",this),this.off=XP("off",this),this.removeListener=XP("removeListener",this),this.removeAllListeners=XP("removeAllListeners",this),this.emit=VP("emit"),this.eventNames=VP("eventNames"),this.listeners=VP("listeners"),this.listenerCount=VP("listenerCount")}sendAsync(e,t){if(!t)throw oP({procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t});if(Array.isArray(e))this.overlay.post(TM.MAGIC_HANDLE_REQUEST,e.map((e=>{let t=dP(e);return this.prefixPayloadMethodForTestMode(t),t}))).then((e=>{t(null,e.map((e=>((e,t)=>IM(e,CM(t)))(FM({},e.payload),{error:e.hasError?new YI(e.payload.error):null}))))}));else{let r=dP(e);this.prefixPayloadMethodForTestMode(r),this.overlay.post(TM.MAGIC_HANDLE_REQUEST,r).then((e=>{t(e.hasError?new YI(e.payload.error):null,e.payload)}))}}send(e,t){if("string"==typeof e){let r=hP(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new QI(AM.SyncWeb3Method,"Non-async web3 methods are deprecated in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new lP(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=hP("eth_accounts");return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}};function $P(e,t){return t?new URL(e,t):new URL(e)}var YP=["request","overlay","sdk"];function QP(e){let t=Object.getPrototypeOf(e),r=[t];for(;t!==EP.prototype;)t=Object.getPrototypeOf(t),r.push(t);return r}var ZP=class extends EP{constructor(){super(void 0),this.__sdk_access_field_descriptors__=new Map,this.__is_initialized__=!1,this.utils={createPromiEvent:vP,isPromiEvent:bP,encodeJSON:KI,decodeJSON:HI,createJsonRpcRequestPayload:hP,standardizeJsonRpcRequestPayload:dP,storage:SP};let e=[this,...QP(this)];YP.forEach((t=>{let r=e.map((e=>Object.getOwnPropertyDescriptor(e,t))),n=r.findIndex((e=>!!e)),i=n>0,o=r[n];o&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:o,isPrototypeField:i}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw nP(t)}}))}))}init(e){this.__is_initialized__||(YP.forEach((e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}})),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:n}=e;return new eP(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n?` Use \`${n}\` instead.`:""}`)}createWarning(e,t){return new eP(this,e,t)}createError(e,t,r){return new ZI(this,e,t,r)}},eC=class extends ZP{};eC.Internal=class extends ZP{},eC.Anonymous="anonymous extension";var tC=class extends EP{purchase(e){let t=hP(kM.NFTPurchase,[e]);return this.request(t)}};function rC(e){return!e.compat||null==e.compat[XI.sdkName]||("string"==typeof e.compat[XI.sdkName]?CI(FI(XI.version),e.compat[XI.sdkName]):!!e.compat[XI.sdkName])}function nC(e){var t;let r=null!=(t=null==e?void 0:e.extensions)?t:[],n={},i=[];if(Array.isArray(r)?r.forEach((e=>{rC(e)?(e.init(this),(e.name||e.name!==eC.Anonymous)&&(this[e.name]=e),e instanceof eC.Internal&&(VI(e.config)||(n[e.name]=e.config))):i.push(e)})):Object.keys(r).forEach((e=>{if(rC(r[e])){r[e].init(this);let t=r[e];this[e]=t,t instanceof eC.Internal&&(VI(t.config)||(n[r[e].name]=t.config))}else i.push(r[e])})),i.length)throw iP(i);return n}var iC=class{constructor(e,t){var r;if(this.apiKey=e,!e)throw tP();"react-native"===XI.platform&&(null==t?void 0:t.endpoint)&&sP().log();let{defaultEndpoint:n,version:i}=XI;this.testMode=!(null==t||!t.testMode),this.endpoint=$P(null!=(r=null==t?void 0:t.endpoint)?r:n).origin,this.auth=new AP(this),this.user=new GP(this),this.wallet=new WP(this),this.nft=new tC(this),this.rpcProvider=new JP(this);let o=nC.call(this,t);this.parameters=KI(FM({API_KEY:this.apiKey,DOMAIN_ORIGIN:window.location?window.location.origin:"",ETH_NETWORK:null==t?void 0:t.network,host:$P(this.endpoint).host,sdk:JI[XI.sdkName],version:i,ext:VI(o)?void 0:o,locale:(null==t?void 0:t.locale)||"en_US"},XI.bundleId?{bundleId:XI.bundleId}:{}))}get overlay(){if(!iC.__overlays__.has(this.parameters)){let e=new XI.ViewController(this.endpoint,this.parameters);e.init(),iC.__overlays__.set(this.parameters,e)}return iC.__overlays__.get(this.parameters)}preload(){return qM(this,null,(function*(){yield this.overlay.ready}))}},oC=iC;function sC(e,t){var r;let n=null==(r=t.data.response)?void 0:r.id,i=function(e,t){return t&&Array.isArray(e)?e.find((e=>e.id===t)):e}(e,n);if(n&&i){return{id:n,response:new lP(i).applyResult(t.data.response.result).applyError(t.data.response.error)}}return{}}oC.__overlays__=new Map;var aC=class{constructor(e,t){this.endpoint=e,this.parameters=t,this.messageHandlers=new Set,this.ready=this.waitForReady(),this.listen()}post(e,t){return qM(this,null,(function*(){return wP((r=>qM(this,null,(function*(){yield this.ready;let n=[],i=Array.isArray(t)?t.map((e=>e.id)):[],o=yield function(e,t){return qM(this,null,(function*(){let r,n=yield xP("rt");if("web"===XI.platform)try{r=yield zP()}catch(e){console.error("webcrypto error",e)}return r?n?{msgType:e,payload:t,jwt:r,rt:n}:{msgType:e,payload:t,jwt:r}:{msgType:e,payload:t}}))}(`${e}-${this.parameters}`,t);yield this._post(o);let s=this.on(xM.MAGIC_HANDLE_RESPONSE,(e=>o=>{let{id:s,response:a}=sC(t,o);(function(e){qM(this,null,(function*(){!e.data.rt||(yield TP("rt",e.data.rt))}))})(o),s&&a&&Array.isArray(t)&&i.includes(s)?(n.push(a),n.length===t.length&&(e(),r(n))):s&&a&&!Array.isArray(t)&&s===t.id&&(e(),r(a))})((()=>s())))}))))}))}on(e,t){let r=t.bind(window),n=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(n),()=>this.messageHandlers.delete(n)}waitForReady(){return new Promise((e=>{this.on(xM.MAGIC_OVERLAY_READY,(()=>e()))}))}listen(){this.on(xM.MAGIC_HIDE_OVERLAY,(()=>{this.hideOverlay()})),this.on(xM.MAGIC_SHOW_OVERLAY,(()=>{this.showOverlay()}))}},uC=Object.create,cC=Object.defineProperty,fC=Object.getOwnPropertyDescriptor,dC=Object.getOwnPropertyNames,hC=Object.getPrototypeOf,lC=Object.prototype.hasOwnProperty,pC=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')})),gC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mC=(e,t,r)=>(r=null!=e?uC(hC(e)):{},((e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let i of dC(t))!lC.call(e,i)&&i!==r&&cC(e,i,{get:()=>t[i],enumerable:!(n=fC(t,i))||n.enumerable});return e})(!t&&e&&e.__esModule?r:cC(r,"default",{value:e,enumerable:!0}),e)),yC=(e,t,r)=>new Promise(((n,i)=>{var o=e=>{try{a(r.next(e))}catch(e){i(e)}},s=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,s);a((r=r.apply(e,t)).next())})),bC=gC(((e,t)=>{!function(r){if("object"==typeof e&&typeof t<"u")t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).localforage=r()}}((function(){return function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof pC&&pC;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};t[s][0].call(f.exports,(function(e){return i(t[s][1][e]||e)}),f,f.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof pC&&pC,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){(function(e){var r,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var i=0,o=new n(f),s=e.document.createTextNode("");o.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(!e.setImmediate&&typeof e.MessageChannel<"u"){var a=new e.MessageChannel;a.port1.onmessage=f,r=function(){a.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};var u,c=[];function f(){u=!0;for(var e,t,r=c.length;r;){for(t=c,c=[],e=-1;++e<r;)t[e]();r=c.length}u=!1}t.exports=function(e){1===c.push(e)&&!u&&r()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(e,t,r){var n=e(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],u=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==i&&l(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function d(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return o.reject(e,t)}n===e?o.reject(e,new TypeError("Cannot resolve promise with itself")):o.resolve(e,n)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function l(e,t){var r=!1;function n(t){r||(r=!0,o.reject(e,t))}function i(t){r||(r=!0,o.resolve(e,t))}var s=p((function(){t(i,n)}));"error"===s.status&&n(s.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var r=new this.constructor(i);this.state!==u?d(r,this.state===a?e:t,this.outcome):this.queue.push(new f(r,e,t));return r},f.prototype.callFulfilled=function(e){o.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){o.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},o.resolve=function(e,t){var r=p(h,t);if("error"===r.status)return o.reject(e,r.value);var n=r.value;if(n)l(e,n);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},o.reject=function(e,t){e.state=s,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},c.resolve=function(e){return e instanceof this?e:o.resolve(new this(i),e)},c.reject=function(e){var t=new this(i);return o.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var s=new Array(r),a=0,u=-1,c=new this(i);++u<r;)f(e[u],u);return c;function f(e,i){t.resolve(e).then((function(e){s[i]=e,++a===r&&!n&&(n=!0,o.resolve(c,s))}),(function(e){n||(n=!0,o.reject(c,e))}))}},c.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var s=-1,a=new this(i);++s<r;)u(e[s]);return a;function u(e){t.resolve(e).then((function(e){n||(n=!0,o.resolve(a,e))}),(function(e){n||(n=!0,o.reject(a,e))}))}}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(e,t,r){var n="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};var i=function(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}();function o(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}typeof Promise>"u"&&e(3);var s=Promise;function a(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",h=void 0,l={},p=Object.prototype.toString,g="readonly",m="readwrite";function y(e){return"boolean"==typeof h?s.resolve(h):function(e){return new s((function(t){var r=e.transaction(d,m),n=o([""]);r.objectStore(d).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return h=e}))}function b(e){var t=l[e.name],r={};r.promise=new s((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function v(e){var t=l[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=l[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function _(e,t){return new s((function(r,n){if(l[e.name]=l[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var o=[e.name];t&&o.push(e.version);var s=i.open.apply(i,o);t&&(s.onupgradeneeded=function(t){var r=s.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(d)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),n(s.error)},s.onsuccess=function(){var t=s.result;t.onversionchange=function(e){e.target.close()},r(t),v(e)}}))}function E(e){return _(e,!1)}function A(e){return _(e,!0)}function S(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,i=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||r){if(r){var o=e.db.version+1;o>e.version&&(e.version=o)}return!0}return!1}function k(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),i=0;i<t;i++)n[i]=e.charCodeAt(i);return r}(atob(e.data));return o([t],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function T(e){var t=this,r=t._initReady().then((function(){var e=l[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(r,e,e),r}function R(e,t,r,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);r(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return s.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),A(e)})).then((function(){return function(e){b(e);for(var t=l[e.name],r=t.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,E(e).then((function(t){return e.db=t,S(e)?A(e):t})).then((function(n){e.db=t.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(t){throw w(e,t),t}))}(e).then((function(){R(e,t,r,n-1)}))})).catch(r);r(i)}}var O={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var i=l[r.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},l[r.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=T);var o=[];function a(){return s.resolve()}for(var u=0;u<i.forages.length;u++){var c=i.forages[u];c!==t&&o.push(c._initReady().catch(a))}var f=i.forages.slice(0);return s.all(o).then((function(){return r.db=i.db,E(r)})).then((function(e){return r.db=e,S(r,t._defaultConfig.version)?A(r):e})).then((function(e){r.db=i.db=e,t._dbInfo=r;for(var n=0;n<f.length;n++){var o=f[n];o!==t&&(o._dbInfo.db=r.db,o._dbInfo.version=r.version)}}))},_support:function(){try{if(!i||!i.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}(),iterate:function(e,t){var r=this,n=new s((function(t,n){r.ready().then((function(){R(r._dbInfo,g,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var r=s.result;if(r){var n=r.value;x(n)&&(n=k(n));var i=e(n,r.key,a++);void 0!==i?t(i):r.continue()}else t()},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new s((function(t,n){r.ready().then((function(){R(r._dbInfo,g,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).get(e);s.onsuccess=function(){var e=s.result;void 0===e&&(e=null),x(e)&&(e=k(e)),t(e)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var i=new s((function(r,i){var o;n.ready().then((function(){return o=n._dbInfo,"[object Blob]"===p.call(t)?y(o.db).then((function(e){return e?t:function(e){return new s((function(t,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");t({__local_forage_encoded_blob:!0,data:n,type:e.type})},n.readAsBinaryString(e)}))}(t)})):t})).then((function(t){R(n._dbInfo,m,(function(o,s){if(o)return i(o);try{var a=s.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var u=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),r(t)},s.onabort=s.onerror=function(){var e=u.error?u.error:u.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return a(i,r),i},removeItem:function(e,t){var r=this;e=c(e);var n=new s((function(t,n){r.ready().then((function(){R(r._dbInfo,m,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).delete(e);o.oncomplete=function(){t()},o.onerror=function(){n(s.error)},o.onabort=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},clear:function(e){var t=this,r=new s((function(e,r){t.ready().then((function(){R(t._dbInfo,m,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return a(r,e),r},length:function(e){var t=this,r=new s((function(e,r){t.ready().then((function(){R(t._dbInfo,g,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).count();o.onsuccess=function(){e(o.result)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,e),r},key:function(e,t){var r=this,n=new s((function(t,n){e<0?t(null):r.ready().then((function(){R(r._dbInfo,g,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName),a=!1,u=s.openKeyCursor();u.onsuccess=function(){var r=u.result;r?0===e||a?t(r.key):(a=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}}))})).catch(n)}));return a(n,t),n},keys:function(e){var t=this,r=new s((function(e,r){t.ready().then((function(){R(t._dbInfo,g,(function(n,i){if(n)return r(n);try{var o=i.objectStore(t._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):e(s)},o.onerror=function(){r(o.error)}}catch(e){r(e)}}))})).catch(r)}));return a(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r,n=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var o=e.name===n.name&&this._dbInfo.db?s.resolve(this._dbInfo.db):E(e).then((function(t){var r=l[e.name],n=r.forages;r.db=t;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=t;return t}));r=e.storeName?o.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;b(e);var n=l[e.name],o=n.forages;t.close();for(var a=0;a<o.length;a++){var u=o[a];u._dbInfo.db=null,u._dbInfo.version=r}var c=new s((function(t,n){var o=i.open(e.name,r);o.onerror=function(e){o.result.close(),n(e)},o.onupgradeneeded=function(){o.result.deleteObjectStore(e.storeName)},o.onsuccess=function(){var e=o.result;e.close(),t(e)}}));return c.then((function(e){n.db=e;for(var t=0;t<o.length;t++){var r=o[t];r._dbInfo.db=e,v(r._dbInfo)}})).catch((function(t){throw(w(e,t)||s.resolve()).catch((function(){})),t}))}})):o.then((function(t){b(e);var r=l[e.name],n=r.forages;t.close();for(var o=0;o<n.length;o++){n[o]._dbInfo.db=null}var a=new s((function(t,r){var n=i.deleteDatabase(e.name);n.onerror=function(){var e=n.result;e&&e.close(),r(n.error)},n.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},n.onsuccess=function(){var e=n.result;e&&e.close(),t(e)}}));return a.then((function(e){r.db=e;for(var t=0;t<n.length;t++){v(n[t]._dbInfo)}})).catch((function(t){throw(w(e,t)||s.resolve()).catch((function(){})),t}))}))}else r=s.reject("Invalid arguments");return a(r,t),r}};var M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",C="arbf",N="blob",B="si08",j="ui08",L="uic8",U="si16",D="si32",F="ur16",q="ui32",z="fl32",K="fl64",H=Object.prototype.toString;function G(e){var t,r,n,i,o,s=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var c=new ArrayBuffer(s),f=new Uint8Array(c);for(t=0;t<a;t+=4)r=M.indexOf(e[t]),n=M.indexOf(e[t+1]),i=M.indexOf(e[t+2]),o=M.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|i>>2,f[u++]=(3&i)<<6|63&o;return c}function W(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=M[r[t]>>2],n+=M[(3&r[t])<<4|r[t+1]>>4],n+=M[(15&r[t+1])<<2|r[t+2]>>6],n+=M[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var V={serialize:function(e,t){var r="";if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,i=P;e instanceof ArrayBuffer?(n=e,i+=C):(n=e.buffer,"[object Int8Array]"===r?i+=B:"[object Uint8Array]"===r?i+=j:"[object Uint8ClampedArray]"===r?i+=L:"[object Int16Array]"===r?i+=U:"[object Uint16Array]"===r?i+=F:"[object Int32Array]"===r?i+=D:"[object Uint32Array]"===r?i+=q:"[object Float32Array]"===r?i+=z:"[object Float64Array]"===r?i+=K:t(new Error("Failed to get type for BinaryArray"))),t(i+W(n))}else if("[object Blob]"===r){var o=new FileReader;o.onload=function(){var r="~~local_forage_type~"+e.type+"~"+W(this.result);t(P+N+r)},o.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,9)!==P)return JSON.parse(e);var t,r=e.substring(13),n=e.substring(9,13);if(n===N&&I.test(r)){var i=r.match(I);t=i[1],r=r.substring(i[0].length)}var s=G(r);switch(n){case C:return s;case N:return o([s],{type:t});case B:return new Int8Array(s);case j:return new Uint8Array(s);case L:return new Uint8ClampedArray(s);case U:return new Int16Array(s);case F:return new Uint16Array(s);case D:return new Int32Array(s);case q:return new Uint32Array(s);case z:return new Float32Array(s);case K:return new Float64Array(s);default:throw new Error("Unkown type: "+n)}},stringToBuffer:G,bufferToString:W};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function J(e,t,r,n,i,o){e.executeSql(r,n,i,(function(e,s){s.code===s.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?o(e,s):X(e,t,(function(){e.executeSql(r,n,i,o)}),o)}),o):o(e,s)}),o)}function $(e,t,r,n){var i=this;e=c(e);var o=new s((function(o,s){i.ready().then((function(){void 0===t&&(t=null);var a=t,u=i._dbInfo;u.serializer.serialize(t,(function(t,c){c?s(c):u.db.transaction((function(r){J(r,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){o(a)}),(function(e,t){s(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void o($.apply(i,[e,a,r,n-1]));s(t)}}))}))})).catch(s)}));return a(o,r),o}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new s((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(i){X(i,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=V,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new s((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var o=n.rows,s=o.length,a=0;a<s;a++){var u=o.item(a),c=u.value;if(c&&(c=i.serializer.deserialize(c)),void 0!==(c=e(c,u.key,a+1)))return void t(c)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=new s((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},setItem:function(e,t,r){return $.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=c(e);var n=new s((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},clear:function(e){var t=this,r=new s((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){J(t,n,"DELETE FROM "+n.storeName,[],(function(){e()}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,e),r},length:function(e){var t=this,r=new s((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){J(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(t,r){var n=r.rows.item(0).c;e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,e),r},key:function(e,t){var r=this,n=new s((function(t,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){J(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,r){var n=r.rows.length?r.rows.item(0).key:null;t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return a(n,t),n},keys:function(e){var t=this,r=new s((function(e,r){t.ready().then((function(){var n=t._dbInfo;n.db.transaction((function(t){J(t,n,"SELECT key FROM "+n.storeName,[],(function(t,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);e(n)}),(function(e,t){r(t)}))}))})).catch(r)}));return a(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var n,i=this;return n=e.name?new s((function(t){var n;n=e.name===r.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(function(e){return new s((function(t,r){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],o=0;o<n.rows.length;o++)i.push(n.rows.item(o).name);t({db:e,storeNames:i})}),(function(e,t){r(t)}))}),(function(e){r(e)}))}))}(n))})).then((function(e){return new s((function(t,r){e.db.transaction((function(n){function i(e){return new s((function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){r(t)}))}))}for(var o=[],a=0,u=e.storeNames.length;a<u;a++)o.push(i(e.storeNames[a]));s.all(o).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):s.reject("Invalid arguments"),a(n,t),n}};function Q(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function Z(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0}var ee={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=Q(e,this._defaultConfig),Z()?(this._dbInfo=t,t.serializer=V,s.resolve()):s.reject()},_support:function(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,i=n.length,o=localStorage.length,s=1,a=0;a<o;a++){var u=localStorage.key(a);if(0===u.indexOf(n)){var c=localStorage.getItem(u);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(i),s++)))return c}}}));return a(n,t),n},getItem:function(e,t){var r=this;e=c(e);var n=r.ready().then((function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e);return n&&(n=t.serializer.deserialize(n)),n}));return a(n,t),n},setItem:function(e,t,r){var n=this;e=c(e);var i=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new s((function(i,o){var s=n._dbInfo;s.serializer.serialize(t,(function(t,n){if(n)o(n);else try{localStorage.setItem(s.keyPrefix+e,t),i(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&o(e),o(e)}}))}))}));return a(i,r),i},removeItem:function(e,t){var r=this;e=c(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return a(n,t),n},clear:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return a(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return a(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return a(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var o=localStorage.key(i);0===o.indexOf(e.keyPrefix)&&n.push(o.substring(e.keyPrefix.length))}return n}));return a(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,i=this;return n=e.name?new s((function(t){e.storeName?t(Q(e,i._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):s.reject("Invalid arguments"),a(n,t),n}},te=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},re=function(e,t){for(var r=e.length,n=0;n<r;){if(te(e[n],t))return!0;n++}return!1},ne=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},oe={},se={INDEXEDDB:O,WEBSQL:Y,LOCALSTORAGE:ee},ae=[se.INDEXEDDB._driver,se.WEBSQL._driver,se.LOCALSTORAGE._driver],ue=["dropInstance"],ce=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ue),fe={description:"",driver:ae.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function de(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ne(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var le=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),se)if(se.hasOwnProperty(r)){var n=se[r],i=n._driver;this[r]=i,ie[i]||this.defineDriver(n)}this._defaultConfig=he({},fe),this._config=he({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(typeof e>"u"?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new s((function(t,r){try{var n=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(i);for(var o=ce.concat("_initStorage"),u=0,c=o.length;u<c;u++){var f=o[u];if((!re(ue,f)||e[f])&&"function"!=typeof e[f])return void r(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=s.reject(t);return a(r,arguments[arguments.length-1]),r}},r=0,n=ue.length;r<n;r++){var i=ue[r];e[i]||(e[i]=t(i))}}();var d=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,oe[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,r):d(!!e._support):d(!0)}catch(e){r(e)}}));return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?s.resolve(ie[e]):s.reject(new Error("Driver not found."));return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=s.resolve(V);return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this;ne(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){n._config.driver=n.driver()}function a(e){return n._extend(e),o(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch((function(){return s.resolve()})):s.resolve();return this._driverSet=c.then((function(){var e=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(e).then((function(e){n._driver=e._driver,o(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0;return function r(){for(;t<e.length;){var i=e[t];return t++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(a).catch(r)}o();var u=new Error("No available storage method found.");return n._driverSet=s.reject(u),n._driverSet}()}}(i)}))})).catch((function(){o();var e=new Error("No available storage method found.");return n._driverSet=s.reject(e),n._driverSet})),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!oe[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ce.length;e<t;e++)de(this,ce[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new le;t.exports=pe},{3:3}]},{},[4])(4)}))})),vC=gC(((e,t)=>{!function(r,n){"object"==typeof e&&typeof t<"u"?n(e):"function"==typeof define&&define.amd?define("localforage-driver-memory",["exports"],n):n(r.LocalforageDriverMemory={})}(typeof self<"u"?self:e,(function(e){var t=/^~~local_forage_type~([^~]+)~/,r=Object.prototype.toString;function n(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var n=new ArrayBuffer(t),i=new Uint8Array(n),o=0,s=0;o<r;o+=4){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[o]),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[o+1]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[o+2]),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[o+3]);i[s++]=a<<2|u>>4,i[s++]=(15&u)<<4|c>>2,i[s++]=(3&c)<<6|63&f}return n}function i(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[n]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[n])<<4|t[n+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[n+1])<<2|t[n+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[n+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function o(e){var t,r;if(null===e||"object"!=typeof e||"isActiveClone"in e)return e;var n=e instanceof Date?new Date(e):e.constructor();try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(Object.keys(e)),s=i.next();!s.done;s=i.next()){var a=s.value;Object.prototype.hasOwnProperty.call(e,a)&&(e.isActiveClone=null,n[a]=o(e[a]),delete e.isActiveClone)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function s(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function a(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function c(e,t){var r,n=this;if(t=u.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return r=e.name?new Promise((function(t){e.storeName?t(s(e,n._defaultConfig)):t(e.name+"/")})):Promise.reject("Invalid arguments"),{promise:r,callback:t}}function f(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var d={bufferToString:i,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var r,i=e.substring(13),o=e.substring(9,13);if("blob"===o&&t.test(i)){var s=i.match(t);r=s[1],i=i.substring(s[0].length)}var a=n(i);switch(o){case"arbf":return a;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new(typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}([a],{type:r});case"si08":return new Int8Array(a);case"ui08":return new Uint8Array(a);case"uic8":return new Uint8ClampedArray(a);case"si16":return new Int16Array(a);case"ur16":return new Uint16Array(a);case"si32":return new Int32Array(a);case"ui32":return new Uint32Array(a);case"fl32":return new Float32Array(a);case"fl64":return new Float64Array(a);default:throw new Error("Unkown type: "+o)}},serialize:function(e,t){var n="";if(e&&(n=r.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===r.call(e.buffer))){var o=void 0,s="__lfsc__:";e instanceof ArrayBuffer?(o=e,s+="arbf"):(o=e.buffer,"[object Int8Array]"===n?s+="si08":"[object Uint8Array]"===n?s+="ui08":"[object Uint8ClampedArray]"===n?s+="uic8":"[object Int16Array]"===n?s+="si16":"[object Uint16Array]"===n?s+="ur16":"[object Int32Array]"===n?s+="si32":"[object Uint32Array]"===n?s+="ui32":"[object Float32Array]"===n?s+="fl32":"[object Float64Array]"===n?s+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(s+i(o))}else if("[object Blob]"===n){var a=new FileReader;a.onload=function(){var r="~~local_forage_type~"+e.type+"~"+i(this.result);t("__lfsc__:blob"+r)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:n},h={},l=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return h[t]||(h[t]=new e(t)),h[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete h[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();e._support=!0,e._driver="localforage-driver-memory",e._initStorage=function(e){var t=e?o(e):{},r=s(t,this._defaultConfig),n=l.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=d,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=n,Promise.resolve()},e.clear=function(e){var t=this,r=this.ready().then((function(){t._dbInfo.mStore.clear()}));return a(r,e),r},e.dropInstance=function(e,t){var r=c.apply(this,arguments),n=r.promise,i=r.callback,o=n.then((function(e){l.resolve(e).drop()}));return a(o,i),n},e.getItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)}));return a(n,t),n},e.iterate=function(e,t){var r=this,n=this.ready().then((function(){for(var t=r._dbInfo.mStore,n=t.keys(),i=0;i<n.length;i++){var o=t.get(n[i]);if(o&&(o=r._dbInfo.serializer.deserialize(o)),void 0!==(o=e(o,n[i],i+1)))return o}}));return a(n,t),n},e.key=function(e,t){var r=this,n=this.ready().then((function(){var t;try{void 0===(t=r._dbInfo.mStore.key(e))&&(t=null)}catch{t=null}return t}));return a(n,t),n},e.keys=function(e){var t=this,r=this.ready().then((function(){return t._dbInfo.mStore.keys()}));return a(r,e),r},e.length=function(e){var t=this.keys().then((function(e){return e.length}));return a(t,e),t},e.removeItem=function(e,t){var r=this;e=f(e);var n=this.ready().then((function(){r._dbInfo.mStore.rm(e)}));return a(n,t),n},e.setItem=function(e,t,r){var n=this;e=f(e);var i=this.ready().then((function(){void 0===t&&(t=null);var r=t;return new Promise((function(i,o){n._dbInfo.serializer.serialize(t,(function(t,s){if(s)o(s);else try{n._dbInfo.mStore.set(e,t),i(r)}catch(e){o(e)}}))}))}));return a(i,r),i},Object.defineProperty(e,"__esModule",{value:!0})}))})),wC=mC(bC()),_C=mC(vC()),EC={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",zIndex:"2147483647"};var AC=function(e,t){return Object.assign(XI,t),e}(oC,{platform:"web",sdkName:"magic-sdk",version:"13.6.2",defaultEndpoint:"https://auth.magic.link/",ViewController:class extends aC{constructor(){super(...arguments),this.activeElement=null}init(){this.test="hello",this.iframe=new Promise((e=>{let t=()=>{if(function(e){let t=[].slice.call(document.querySelectorAll(".magic-iframe"));return Boolean(t.find((t=>t.src.includes(e))))}(encodeURIComponent(this.parameters)))new QI(AM.DuplicateIframe,"Duplicate iframes found.").log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=$P(this.endpoint).host,t.title="Secure Modal",t.src=$P(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href,function(e){for(let[t,r]of Object.entries(EC))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)})),window.addEventListener("message",(e=>{var t;if(e.origin===this.endpoint&&e.data&&e.data.msgType&&this.messageHandlers.size){e.data.response=null!=(t=e.data.response)?t:{};for(let t of this.messageHandlers.values())t(e)}}))}showOverlay(){return yC(this,null,(function*(){let e=yield this.iframe;e.style.display="block",this.activeElement=document.activeElement,e.focus()}))}hideOverlay(){return yC(this,null,(function*(){var e;(yield this.iframe).style.display="none",null!=(e=this.activeElement)&&e.focus&&this.activeElement.focus(),this.activeElement=null}))}_post(e){return yC(this,null,(function*(){let t=yield this.iframe;if(!t||!t.contentWindow)throw new $I(EM.ModalNotReady,"Modal is not ready.");t.contentWindow.postMessage(e,this.endpoint)}))}},configureStorage:()=>yC(void 0,null,(function*(){let e=wC.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return yield e.defineDriver(_C),yield e.setDriver([wC.default.INDEXEDDB,wC.default.LOCALSTORAGE,_C._driver]),e}))}),SC=(e=>(e.LoginWithOIDC="magic_auth_login_with_oidc",e))(SC||{}),kC=class extends eC.Internal{constructor(){super(...arguments),this.name="openid",this.config={}}loginWithOIDC(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_oidc",[e]);return this.request(t)}};function xC(e,t){return function(){return e.apply(t,arguments)}}const{toString:TC}=Object.prototype,{getPrototypeOf:RC}=Object,OC=(e=>t=>{const r=TC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),MC=e=>(e=e.toLowerCase(),t=>OC(t)===e),IC=e=>t=>typeof t===e,{isArray:PC}=Array,CC=IC("undefined");const NC=MC("ArrayBuffer");const BC=IC("string"),jC=IC("function"),LC=IC("number"),UC=e=>null!==e&&"object"==typeof e,DC=e=>{if("object"!==OC(e))return!1;const t=RC(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},FC=MC("Date"),qC=MC("File"),zC=MC("Blob"),KC=MC("FileList"),HC=MC("URLSearchParams");function GC(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),PC(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function WC(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const VC="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,XC=e=>!CC(e)&&e!==VC;const JC=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&RC(Uint8Array)),$C=MC("HTMLFormElement"),YC=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),QC=MC("RegExp"),ZC=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};GC(r,((r,i)=>{!1!==t(r,i,e)&&(n[i]=r)})),Object.defineProperties(e,n)},eN="abcdefghijklmnopqrstuvwxyz",tN="0123456789",rN={DIGIT:tN,ALPHA:eN,ALPHA_DIGIT:eN+eN.toUpperCase()+tN};const nN=MC("AsyncFunction");var iN={isArray:PC,isArrayBuffer:NC,isBuffer:function(e){return null!==e&&!CC(e)&&null!==e.constructor&&!CC(e.constructor)&&jC(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||jC(e.append)&&("formdata"===(t=OC(e))||"object"===t&&jC(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&NC(e.buffer),t},isString:BC,isNumber:LC,isBoolean:e=>!0===e||!1===e,isObject:UC,isPlainObject:DC,isUndefined:CC,isDate:FC,isFile:qC,isBlob:zC,isRegExp:QC,isFunction:jC,isStream:e=>UC(e)&&jC(e.pipe),isURLSearchParams:HC,isTypedArray:JC,isFileList:KC,forEach:GC,merge:function e(){const{caseless:t}=XC(this)&&this||{},r={},n=(n,i)=>{const o=t&&WC(r,i)||i;DC(r[o])&&DC(n)?r[o]=e(r[o],n):DC(n)?r[o]=e({},n):PC(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&GC(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(GC(t,((t,n)=>{r&&jC(t)?e[n]=xC(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,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],n&&!n(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&RC(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:OC,kindOfTest:MC,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(PC(e))return e;let t=e.length;if(!LC(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:$C,hasOwnProperty:YC,hasOwnProp:YC,reduceDescriptors:ZC,freezeMethods:e=>{ZC(e,((t,r)=>{if(jC(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];jC(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 PC(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:WC,global:VC,isContextDefined:XC,ALPHABET:rN,generateString:(e=16,t=rN.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&jC(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(UC(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=PC(e)?[]:{};return GC(e,((e,t)=>{const o=r(e,n+1);!CC(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:nN,isThenable:e=>e&&(UC(e)||jC(e))&&jC(e.then)&&jC(e.catch)};function oN(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)}iN.inherits(oN,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:iN.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const sN=oN.prototype,aN={};["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=>{aN[e]={value:e}})),Object.defineProperties(oN,aN),Object.defineProperty(sN,"isAxiosError",{value:!0}),oN.from=(e,t,r,n,i,o)=>{const s=Object.create(sN);return iN.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),oN.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function uN(e){return iN.isPlainObject(e)||iN.isArray(e)}function cN(e){return iN.endsWith(e,"[]")?e.slice(0,-2):e}function fN(e,t,r){return e?e.concat(t).map((function(e,t){return e=cN(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const dN=iN.toFlatObject(iN,{},null,(function(e){return/^is[A-Z]/.test(e)}));function hN(e,t,r){if(!iN.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=iN.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!iN.isUndefined(t[e])}))).metaTokens,i=r.visitor||c,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&iN.isSpecCompliantForm(t);if(!iN.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(iN.isDate(e))return e.toISOString();if(!a&&iN.isBlob(e))throw new oN("Blob is not supported. Use a Buffer instead.");return iN.isArrayBuffer(e)||iN.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(iN.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(iN.isArray(e)&&function(e){return iN.isArray(e)&&!e.some(uN)}(e)||(iN.isFileList(e)||iN.endsWith(r,"[]"))&&(a=iN.toArray(e)))return r=cN(r),a.forEach((function(e,n){!iN.isUndefined(e)&&null!==e&&t.append(!0===s?fN([r],n,o):null===s?r:r+"[]",u(e))})),!1;return!!uN(e)||(t.append(fN(i,r,o),u(e)),!1)}const f=[],d=Object.assign(dN,{defaultVisitor:c,convertValue:u,isVisitable:uN});if(!iN.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!iN.isUndefined(r)){if(-1!==f.indexOf(r))throw Error("Circular reference detected in "+n.join("."));f.push(r),iN.forEach(r,(function(r,o){!0===(!(iN.isUndefined(r)||null===r)&&i.call(t,r,iN.isString(o)?o.trim():o,n,d))&&e(r,n?n.concat(o):[o])})),f.pop()}}(e),t}function lN(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function pN(e,t){this._pairs=[],e&&hN(e,this,t)}const gN=pN.prototype;function mN(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function yN(e,t,r){if(!t)return e;const n=r&&r.encode||mN,i=r&&r.serialize;let o;if(o=i?i(t,r):iN.isURLSearchParams(t)?t.toString():new pN(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}gN.append=function(e,t){this._pairs.push([e,t])},gN.toString=function(e){const t=e?function(t){return e.call(this,t,lN)}:lN;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var bN=class{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){iN.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},vN={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wN={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:pN,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function _N(e){function t(e,r,n,i){let o=e[i++];const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&iN.isArray(n)?n.length:o,a)return iN.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&iN.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&iN.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<i;n++)o=r[n],t[o]=e[o];return t}(n[o])),!s}if(iN.isFormData(e)&&iN.isFunction(e.entries)){const r={};return iN.forEachEntry(e,((e,n)=>{t(function(e){return iN.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const EN={"Content-Type":void 0};const AN={transitional:vN,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=iN.isObject(e);i&&iN.isHTMLForm(e)&&(e=new FormData(e));if(iN.isFormData(e))return n&&n?JSON.stringify(_N(e)):e;if(iN.isArrayBuffer(e)||iN.isBuffer(e)||iN.isStream(e)||iN.isFile(e)||iN.isBlob(e))return e;if(iN.isArrayBufferView(e))return e.buffer;if(iN.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 hN(e,new wN.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return wN.isNode&&iN.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=iN.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return hN(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(iN.isString(e))try{return(t||JSON.parse)(e),iN.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||AN.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&iN.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 oN.from(e,oN.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:wN.classes.FormData,Blob:wN.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};iN.forEach(["delete","get","head"],(function(e){AN.headers[e]={}})),iN.forEach(["post","put","patch"],(function(e){AN.headers[e]=iN.merge(EN)}));var SN=AN;const kN=iN.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 xN=Symbol("internals");function TN(e){return e&&String(e).trim().toLowerCase()}function RN(e){return!1===e||null==e?e:iN.isArray(e)?e.map(RN):String(e)}function ON(e,t,r,n,i){return iN.isFunction(n)?n.call(this,t,r):(i&&(t=r),iN.isString(t)?iN.isString(n)?-1!==t.indexOf(n):iN.isRegExp(n)?n.test(t):void 0:void 0)}class MN{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=TN(t);if(!i)throw new Error("header name must be a non-empty string");const o=iN.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=RN(e))}const o=(e,t)=>iN.forEach(e,((e,r)=>i(e,r,t)));return iN.isPlainObject(e)||e instanceof this.constructor?o(e,t):iN.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]&&kN[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=TN(e)){const r=iN.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(iN.isFunction(t))return t.call(this,e,r);if(iN.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=TN(e)){const r=iN.findKey(this,e);return!(!r||void 0===this[r]||t&&!ON(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=TN(e)){const i=iN.findKey(r,e);!i||t&&!ON(0,r[i],i,t)||(delete r[i],n=!0)}}return iN.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&&!ON(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return iN.forEach(this,((n,i)=>{const o=iN.findKey(r,i);if(o)return t[o]=RN(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();s!==i&&delete t[i],t[s]=RN(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return iN.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&iN.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[xN]=this[xN]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=TN(e);t[n]||(!function(e,t){const r=iN.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 iN.isArray(e)?e.forEach(n):n(e),this}}MN.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),iN.freezeMethods(MN.prototype),iN.freezeMethods(MN);var IN=MN;function PN(e,t){const r=this||SN,n=t||r,i=IN.from(n.headers);let o=n.data;return iN.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function CN(e){return!(!e||!e.__CANCEL__)}function NN(e,t,r){oN.call(this,null==e?"canceled":e,oN.ERR_CANCELED,t,r),this.name="CanceledError"}iN.inherits(NN,oN,{__CANCEL__:!0});var BN=wN.isStandardBrowserEnv?{write:function(e,t,r,n,i,o){const s=[];s.push(e+"="+encodeURIComponent(t)),iN.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),iN.isString(n)&&s.push("path="+n),iN.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function jN(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var LN=wN.isStandardBrowserEnv?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=iN.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function UN(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,s=0;return t=void 0!==t?t:1e3,function(a){const u=Date.now(),c=n[s];i||(i=u),r[o]=a,n[o]=u;let f=s,d=0;for(;f!==o;)d+=r[f++],f%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),u-i<t)return;const h=c&&u-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-r,u=n(a);r=o;const c={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:u||void 0,estimated:u&&s&&o<=s?(s-o)/u:void 0,event:i};c[t?"download":"upload"]=!0,e(c)}}var DN="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=IN.from(e.headers).normalize(),o=e.responseType;let s;function a(){e.cancelToken&&e.cancelToken.unsubscribe(s),e.signal&&e.signal.removeEventListener("abort",s)}iN.isFormData(n)&&(wN.isStandardBrowserEnv||wN.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let u=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 c=jN(e.baseURL,e.url);function f(){if(!u)return;const n=IN.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new oN("Request failed with status code "+r.status,[oN.ERR_BAD_REQUEST,oN.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:o&&"text"!==o&&"json"!==o?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),yN(c,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(f)},u.onabort=function(){u&&(r(new oN("Request aborted",oN.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new oN("Network Error",oN.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||vN;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new oN(t,n.clarifyTimeoutError?oN.ETIMEDOUT:oN.ECONNABORTED,e,u)),u=null},wN.isStandardBrowserEnv){const t=(e.withCredentials||LN(c))&&e.xsrfCookieName&&BN.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&iN.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),iN.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&"json"!==o&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",UN(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",UN(e.onUploadProgress)),(e.cancelToken||e.signal)&&(s=t=>{u&&(r(!t||t.type?new NN(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(s),e.signal&&(e.signal.aborted?s():e.signal.addEventListener("abort",s)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);d&&-1===wN.protocols.indexOf(d)?r(new oN("Unsupported protocol "+d+":",oN.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const FN={http:null,xhr:DN};iN.forEach(FN,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var qN=e=>{e=iN.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let i=0;i<t&&(r=e[i],!(n=iN.isString(r)?FN[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new oN(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(iN.hasOwnProp(FN,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!iN.isFunction(n))throw new TypeError("adapter is not a function");return n};function zN(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new NN(null,e)}function KN(e){zN(e),e.headers=IN.from(e.headers),e.data=PN.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return qN(e.adapter||SN.adapter)(e).then((function(t){return zN(e),t.data=PN.call(e,e.transformResponse,t),t.headers=IN.from(t.headers),t}),(function(t){return CN(t)||(zN(e),t&&t.response&&(t.response.data=PN.call(e,e.transformResponse,t.response),t.response.headers=IN.from(t.response.headers))),Promise.reject(t)}))}const HN=e=>e instanceof IN?e.toJSON():e;function GN(e,t){t=t||{};const r={};function n(e,t,r){return iN.isPlainObject(e)&&iN.isPlainObject(t)?iN.merge.call({caseless:r},e,t):iN.isPlainObject(t)?iN.merge({},t):iN.isArray(t)?t.slice():t}function i(e,t,r){return iN.isUndefined(t)?iN.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!iN.isUndefined(t))return n(void 0,t)}function s(e,t){return iN.isUndefined(t)?iN.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}const u={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>i(HN(e),HN(t),!0)};return iN.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=u[n]||i,s=o(e[n],t[n],n);iN.isUndefined(s)&&o!==a||(r[n]=s)})),r}const WN="1.4.0",VN={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{VN[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const XN={};VN.transitional=function(e,t,r){function n(e,t){return"[Axios v1.4.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new oN(n(i," has been removed"+(t?" in "+t:"")),oN.ERR_DEPRECATED);return t&&!XN[i]&&(XN[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 JN={assertOptions:function(e,t,r){if("object"!=typeof e)throw new oN("options must be an object",oN.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new oN("option "+o+" must be "+r,oN.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new oN("Unknown option "+o,oN.ERR_BAD_OPTION)}},validators:VN};const $N=JN.validators;class YN{constructor(e){this.defaults=e,this.interceptors={request:new bN,response:new bN}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=GN(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;let o;void 0!==r&&JN.assertOptions(r,{silentJSONParsing:$N.transitional($N.boolean),forcedJSONParsing:$N.transitional($N.boolean),clarifyTimeoutError:$N.transitional($N.boolean)},!1),null!=n&&(iN.isFunction(n)?t.paramsSerializer={serialize:n}:JN.assertOptions(n,{encode:$N.function,serialize:$N.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase(),o=i&&iN.merge(i.common,i[t.method]),o&&iN.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=IN.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const u=[];let c;this.interceptors.response.forEach((function(e){u.push(e.fulfilled,e.rejected)}));let f,d=0;if(!a){const e=[KN.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,u),f=e.length,c=Promise.resolve(t);d<f;)c=c.then(e[d++],e[d++]);return c}f=s.length;let h=t;for(d=0;d<f;){const e=s[d++],t=s[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=KN.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,f=u.length;d<f;)c=c.then(u[d++],u[d++]);return c}getUri(e){return yN(jN((e=GN(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}iN.forEach(["delete","get","head","options"],(function(e){YN.prototype[e]=function(t,r){return this.request(GN(r||{},{method:e,url:t,data:(r||{}).data}))}})),iN.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(GN(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}YN.prototype[e]=t(),YN.prototype[e+"Form"]=t(!0)}));var QN=YN;class ZN{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{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 NN(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 e;const t=new ZN((function(t){e=t}));return{token:t,cancel:e}}}var eB=ZN;const tB={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(tB).forEach((([e,t])=>{tB[t]=e}));var rB=tB;const nB=function e(t){const r=new QN(t),n=xC(QN.prototype.request,r);return iN.extend(n,QN.prototype,r,{allOwnKeys:!0}),iN.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(GN(t,r))},n}(SN);nB.Axios=QN,nB.CanceledError=NN,nB.CancelToken=eB,nB.isCancel=CN,nB.VERSION=WN,nB.toFormData=hN,nB.AxiosError=oN,nB.Cancel=nB.CanceledError,nB.all=function(e){return Promise.all(e)},nB.spread=function(e){return function(t){return e.apply(null,t)}},nB.isAxiosError=function(e){return iN.isObject(e)&&!0===e.isAxiosError},nB.mergeConfig=GN,nB.AxiosHeaders=IN,nB.formToJSON=e=>_N(iN.isHTMLForm(e)?new FormData(e):e),nB.HttpStatusCode=rB,nB.default=nB;var iB=nB;const oB="https://guardian.sandbox.imtbl.com".replace(/\/+$/,"");class sB{basePath;axios;configuration;constructor(e,t=oB,r=iB){this.basePath=t,this.axios=r,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class aB extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const uB="https://example.com",cB=function(e,t,r){if(null==r)throw new aB(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},fB=async function(e,t){if(t&&t.accessToken){const r="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+r}};function dB(e,t,r=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>dB(e,t,r))):Object.keys(t).forEach((n=>dB(e,t[n],`${r}${""!==r?".":""}${n}`))):e.has(r)?e.append(r,t):e.set(r,t))}const hB=function(e,...t){const r=new URLSearchParams(e.search);dB(r,t),e.search=r.toString()},lB=function(e,t,r){const n="string"!=typeof e;return(n&&r&&r.isJsonMime?r.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},pB=function(e){return e.pathname+e.search+e.hash},gB=function(e,t,r,n){return(i=t,o=r)=>{const s={...e.options,url:(n?.basePath||o)+e.url};return i.request(s)}},mB=function(e){const t=function(e){return{approvePendingTransaction:async(t,r,n={})=>{cB("approvePendingTransaction","payloadHash",t),cB("approvePendingTransaction","transactionApprovalRequest",r);const i="/guardian/v1/transactions/{payloadHash}/approve".replace("{payloadHash}",encodeURIComponent(String(t))),o=new URL(i,uB);let s;e&&(s=e.baseOptions);const a={method:"POST",...s,...n},u={};await fB(u,e),u["Content-Type"]="application/json",hB(o,{});let c=s&&s.headers?s.headers:{};return a.headers={...u,...c,...n.headers},a.data=lB(r,a,e),{url:pB(o),options:a}},evaluateTransaction:async(t,r,n={})=>{cB("evaluateTransaction","id",t),cB("evaluateTransaction","transactionEvaluationRequest",r);const i="/guardian/v1/transactions/{id}/evaluate".replace("{id}",encodeURIComponent(String(t))),o=new URL(i,uB);let s;e&&(s=e.baseOptions);const a={method:"POST",...s,...n},u={};await fB(u,e),u["Content-Type"]="application/json",hB(o,{});let c=s&&s.headers?s.headers:{};return a.headers={...u,...c,...n.headers},a.data=lB(r,a,e),{url:pB(o),options:a}},getTransactionByID:async(t,r,n,i={})=>{cB("getTransactionByID","transactionID",t),cB("getTransactionByID","chainType",r);const o="/guardian/v1/transactions/{transactionID}".replace("{transactionID}",encodeURIComponent(String(t))),s=new URL(o,uB);let a;e&&(a=e.baseOptions);const u={method:"GET",...a,...i},c={},f={};await fB(c,e),void 0!==r&&(f.chainType=r),void 0!==n&&(f.chainID=n),hB(s,f);let d=a&&a.headers?a.headers:{};return u.headers={...c,...d,...i.headers},{url:pB(s),options:u}}}}(e);return{async approvePendingTransaction(r,n,i){const o=await t.approvePendingTransaction(r,n,i);return gB(o,iB,oB,e)},async evaluateTransaction(r,n,i){const o=await t.evaluateTransaction(r,n,i);return gB(o,iB,oB,e)},async getTransactionByID(r,n,i,o){const s=await t.getTransactionByID(r,n,i,o);return gB(s,iB,oB,e)}}};class yB extends sB{approvePendingTransaction(e,t){return mB(this.configuration).approvePendingTransaction(e.payloadHash,e.transactionApprovalRequest,t).then((e=>e(this.axios,this.basePath)))}evaluateTransaction(e,t){return mB(this.configuration).evaluateTransaction(e.id,e.transactionEvaluationRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionByID(e,t){return mB(this.configuration).getTransactionByID(e.transactionID,e.chainType,e.chainID,t).then((e=>e(this.axios,this.basePath)))}}class bB{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}function vB(e){const t=-1!==new ue(e,16).cmp(new ue(27))?new ue(e,16).sub(new ue(27)).toNumber():new ue(e,16).toNumber();return e.trim()?t:void 0}async function wB(e,t){const r=function(e,t=64){const r=Bc(e);return{r:new ue(r.substring(0,t),"hex"),s:new ue(r.substring(t,2*t),"hex"),recoveryParam:vB(r.substring(2*t,2*t+2))}}(await t.signMessage(e));return Lc(Cc((n=r).r.toString(16),64)+Cc(n.s.toString(16),64)+Cc(n.recoveryParam?.toString(16)||"",2));var n}function _B(e){switch(e.type){case"ERC721":return{type:"ERC721",data:{token_id:e.tokenId,token_address:e.tokenAddress}};case"ERC20":return{type:"ERC20",data:{token_address:e.tokenAddress}};default:return{type:"ETH",data:{decimals:18}}}}var EB;!function(e){e.AUTHENTICATION_ERROR="AUTHENTICATION_ERROR",e.INVALID_CONFIGURATION="INVALID_CONFIGURATION",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",e.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",e.SILENT_LOGIN_ERROR="SILENT_LOGIN_ERROR",e.REFRESH_TOKEN_ERROR="REFRESH_TOKEN_ERROR",e.USER_REGISTRATION_ERROR="USER_REGISTRATION_ERROR",e.LOGOUT_ERROR="LOGOUT_ERROR",e.TRANSFER_ERROR="TRANSFER_ERROR",e.CREATE_ORDER_ERROR="CREATE_ORDER_ERROR",e.CANCEL_ORDER_ERROR="CANCEL_ORDER_ERROR",e.EXCHANGE_TRANSFER_ERROR="EXCHANGE_TRANSFER_ERROR",e.CREATE_TRADE_ERROR="CREATE_TRADE_ERROR",e.OPERATION_NOT_SUPPORTED_ERROR="OPERATION_NOT_SUPPORTED_ERROR"}(EB||(EB={}));class AB extends Error{type;constructor(e,t){super(e),this.type=t}}const SB=async(e,t)=>{try{return await e()}catch(e){const r=`${t}: ${e.message}`||"UnknownError";throw new AB(r,t)}},kB="passport_credentials";class xB{saveCredentials(e){localStorage.setItem(kB,JSON.stringify(e))}getCredentials(){const e=localStorage.getItem(kB);return e?JSON.parse(e):null}areValid(e){if(e){const t=this.isTokenValid(e.access_token),r=this.isTokenValid(e.id_token);return t&&r}return!1}isTokenValid(e){return(iR(e).exp??0)>Date.now()/1e3+3600}clearCredentials(){localStorage.removeItem(kB)}}const TB={headers:{"Content-Type":"application/x-www-form-urlencoded"}};function RB(e){return new Promise((t=>{setTimeout(t,e)}))}class OB{userManager;config;deviceCredentialsManager;constructor(e){this.config=e,this.userManager=new class{constructor(e){this._logger=new fR("UserManager"),this.settings=new UR(e),this._client=new class{constructor(e){this._logger=new fR("OidcClient"),this.settings=new AR(e),this.metadataService=new class{constructor(e){this._settings=e,this._logger=new fR("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new _R(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const r=this._logger.create(`_getMetadataProperty('${e}')`),n=await this.getMetadata();if(r.debug("resolved"),void 0===n[e]){if(!0===t)return void r.warn("Metadata does not contain optional property");r.throw(new Error("Metadata does not contain property "+e))}return n[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}}(this.settings),this._claimsService=new class{constructor(e){this._settings=e,this._logger=new fR("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let e;e=Array.isArray(this._settings.filterProtocolClaims)?this._settings.filterProtocolClaims:RR;for(const r of e)OR.includes(r)||delete t[r]}return t}mergeClaims(e,t){const r={...e};for(const[e,n]of Object.entries(t))for(const t of Array.isArray(n)?n:[n]){const n=r[e];n?Array.isArray(n)?n.includes(t)||n.push(t):r[e]!==t&&("object"==typeof t&&this._settings.mergeClaims?r[e]=this.mergeClaims(n,t):r[e]=[n,t]):r[e]=t}return r}}(this.settings),this._validator=new class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new fR("ResponseValidator"),this._userInfoService=new class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new fR("UserInfoService"),this._getClaimsFromJwt=async e=>{const t=this._logger.create("_getClaimsFromJwt");try{const r=lR.decode(e);return t.debug("JWT decoding successful"),r}catch(e){throw t.error("Error parsing JWT response"),e}},this._jsonService=new _R(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);const n=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",n),n}}(this._settings,this._metadataService),this._tokenClient=new SR(this._settings,this._metadataService)}async validateSigninResponse(e,t){const r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,null==t?void 0:t.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){const r=this._logger.create("validateCredentialsResponse");e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){const r=this._logger.create("validateRefreshResponse");e.userState=t.data,null!=e.session_state||(e.session_state=t.session_state),null!=e.scope||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),r.debug("claims processed")}validateSignoutResponse(e,t){const r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new yR(e)}_processSigninState(e,t){const r=this._logger.create("_processSigninState");if(t.id!==e.state&&r.throw(new Error("State does not match")),t.client_id||r.throw(new Error("No client_id on state")),t.authority||r.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&r.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&r.throw(new Error("client_id mismatch on settings vs. signin state")),r.debug("state validated"),e.userState=t.data,null!=e.scope||(e.scope=t.scope),e.error)throw r.warn("Response was error",e.error),new yR(e);t.code_verifier&&!e.code&&r.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){const n=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token)return void n.debug("not loading user info");n.debug("loading user info");const i=await this._userInfoService.getClaims(e.access_token);n.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&n.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),n.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){const r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");const n=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,n)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;const n=this._logger.create("_validateIdTokenAttributes");n.debug("decoding ID Token JWT");const i=lR.decode(null!=(r=e.id_token)?r:"");if(i.sub||n.throw(new Error("ID Token is missing a subject claim")),t){const e=lR.decode(t);i.sub!==e.sub&&n.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==e.auth_time&&n.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==e.azp&&n.throw(new Error("azp in id_token does not match original azp")),!i.azp&&e.azp&&n.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}}(this.settings,this.metadataService,this._claimsService),this._tokenClient=new SR(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:n,id_token_hint:i,login_hint:o,skipUserInfo:s,nonce:a,response_type:u=this.settings.response_type,scope:c=this.settings.scope,redirect_uri:f=this.settings.redirect_uri,prompt:d=this.settings.prompt,display:h=this.settings.display,max_age:l=this.settings.max_age,ui_locales:p=this.settings.ui_locales,acr_values:g=this.settings.acr_values,resource:m=this.settings.resource,response_mode:y=this.settings.response_mode,extraQueryParams:b=this.settings.extraQueryParams,extraTokenParams:v=this.settings.extraTokenParams}){const w=this._logger.create("createSigninRequest");if("code"!==u)throw new Error("Only the Authorization Code flow (with PKCE) is supported");const _=await this.metadataService.getAuthorizationEndpoint();w.debug("Received authorization endpoint",_);const E=new class{constructor({url:e,authority:t,client_id:r,redirect_uri:n,response_type:i,scope:o,state_data:s,response_mode:a,request_type:u,client_secret:c,nonce:f,resource:d,skipUserInfo:h,extraQueryParams:l,extraTokenParams:p,disablePKCE:g,...m}){if(this._logger=new fR("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!n)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!o)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new xR({data:s,request_type:u,code_verifier:!g,client_id:r,authority:t,redirect_uri:n,response_mode:a,client_secret:c,scope:o,extraTokenParams:p,skipUserInfo:h});const y=new URL(e);y.searchParams.append("client_id",r),y.searchParams.append("redirect_uri",n),y.searchParams.append("response_type",i),y.searchParams.append("scope",o),f&&y.searchParams.append("nonce",f),y.searchParams.append("state",this.state.id),this.state.code_challenge&&(y.searchParams.append("code_challenge",this.state.code_challenge),y.searchParams.append("code_challenge_method","S256")),d&&(Array.isArray(d)?d:[d]).forEach((e=>y.searchParams.append("resource",e)));for(const[e,t]of Object.entries({response_mode:a,...m,...l}))null!=t&&y.searchParams.append(e,t.toString());this.url=y.href}}({url:_,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:f,response_type:u,scope:c,state_data:e,prompt:d,display:h,max_age:l,ui_locales:p,id_token_hint:i,login_hint:o,acr_values:g,resource:m,request:t,request_uri:r,extraQueryParams:b,extraTokenParams:v,request_type:n,response_mode:y,client_secret:this.settings.client_secret,skipUserInfo:s,nonce:a,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();const A=E.state;return await this.settings.stateStore.set(A.id,A.toStorageString()),E}async readSigninResponseState(e,t=!1){const r=this._logger.create("readSigninResponseState"),n=new TR(mR.readParams(e,this.settings.response_mode));if(!n.state)throw r.throw(new Error("No state in response")),null;const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:xR.fromStorageString(i),response:n}}async processSigninResponse(e){const t=this._logger.create("processSigninResponse"),{state:r,response:n}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(n,r),n}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:n={}}){const i=await this._tokenClient.exchangeCredentials({username:e,password:t,...n}),o=new TR(new URLSearchParams);return Object.assign(o,i),await this._validator.validateCredentialsResponse(o,r),o}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;const n=this._logger.create("useRefreshToken");let i;if(void 0===this.settings.refreshTokenAllowedScope)i=e.scope;else{const t=this.settings.refreshTokenAllowedScope.split(" ");i=((null==(r=e.scope)?void 0:r.split(" "))||[]).filter((e=>t.includes(e))).join(" ")}const o=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:i,timeoutInSeconds:t}),s=new TR(new URLSearchParams);return Object.assign(s,o),n.debug("validating response",s),await this._validator.validateRefreshResponse(s,{...e,scope:i}),s}async createSignoutRequest({state:e,id_token_hint:t,request_type:r,post_logout_redirect_uri:n=this.settings.post_logout_redirect_uri,extraQueryParams:i=this.settings.extraQueryParams}={}){const o=this._logger.create("createSignoutRequest"),s=await this.metadataService.getEndSessionEndpoint();if(!s)throw o.throw(new Error("No end session endpoint")),null;o.debug("Received end session endpoint",s);const a=new class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:n,extraQueryParams:i,request_type:o}){if(this._logger=new fR("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const s=new URL(e);r&&s.searchParams.append("id_token_hint",r),n&&(s.searchParams.append("post_logout_redirect_uri",n),t&&(this.state=new kR({data:t,request_type:o}),s.searchParams.append("state",this.state.id)));for(const[e,t]of Object.entries({...i}))null!=t&&s.searchParams.append(e,t.toString());this.url=s.href}}({url:s,id_token_hint:t,post_logout_redirect_uri:n,state_data:e,extraQueryParams:i,request_type:r});await this.clearStaleState();const u=a.state;return u&&(o.debug("Signout request has state to persist"),await this.settings.stateStore.set(u.id,u.toStorageString())),a}async readSignoutResponseState(e,t=!1){const r=this._logger.create("readSignoutResponseState"),n=new class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}}(mR.readParams(e,this.settings.response_mode));if(!n.state){if(r.debug("No state in response"),n.error)throw r.warn("Response was error:",n.error),new yR(n);return{state:void 0,response:n}}const i=await this.settings.stateStore[t?"remove":"get"](n.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:kR.fromStorageString(i),response:n}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:r,response:n}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(n,r)):t.debug("No state from storage; skipping response validation"),n}clearStaleState(){return this._logger.create("clearStaleState"),kR.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}}(e),this._redirectNavigator=new class{constructor(e){this._settings=e,this._logger=new fR("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let n=window.self;"top"===t&&(n=null!=(r=window.top)?r:window.self);const i=n.location[e].bind(n.location);let o;return{navigate:async e=>{this._logger.create("navigate");const t=new Promise(((e,t)=>{o=t}));return i(e.url),await t},close:()=>{this._logger.create("close"),null==o||o(new Error("Redirect aborted")),n.stop()}}}}(this.settings),this._popupNavigator=new class{constructor(e){this._settings=e,this._logger=new fR("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new FR({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,t=!1){this._logger.create("callback"),FR.notifyOpener(e,t)}}(this.settings),this._iframeNavigator=new class{constructor(e){this._settings=e,this._logger=new fR("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new DR({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),DR.notifyParent(e,this._settings.iframeNotifyParentOrigin)}}(this.settings),this._events=new qR(this.settings),this._silentRenewService=new class{constructor(e){this._userManager=e,this._logger=new fR("SilentRenewService"),this._isStarted=!1,this._retryTimer=new gR("Retry Silent Renew"),this._tokenExpiring=async()=>{const e=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),e.debug("silent token renewal successful")}catch(t){if(t instanceof bR)return e.warn("ErrorTimeout from signinSilent:",t,"retry in 5s"),void this._retryTimer.init(5);e.error("Error from signinSilent:",t),this._userManager.events._raiseSilentRenewError(t)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}}(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new class{constructor(e){this._userManager=e,this._logger=new fR("SessionMonitor"),this._start=async e=>{const t=e.session_state;if(!t)return;const r=this._logger.create("_start");if(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,r.debug("session_state",t,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,r.debug("session_state",t,", anonymous user")),this._checkSessionIFrame)this._checkSessionIFrame.start(t);else try{const e=await this._userManager.metadataService.getCheckSessionIframe();if(e){r.debug("initializing check session iframe");const n=this._userManager.settings.client_id,i=this._userManager.settings.checkSessionIntervalInSeconds,o=this._userManager.settings.stopCheckSessionOnError,s=new class{constructor(e,t,r,n,i){this._callback=e,this._client_id=t,this._intervalInSeconds=n,this._stopOnError=i,this._logger=new fR("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=e=>{e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(e.data+" message from check session op iframe"))};const o=new URL(r);this._frame_origin=o.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=o.href}load(){return new Promise((e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)}))}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{this._frame.contentWindow&&this._session_state&&this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,1e3*this._intervalInSeconds)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}}(this._callback,n,e,i,o);await s.load(),this._checkSessionIFrame=s,s.start(t)}else r.warn("no check session iframe found in the metadata")}catch(e){r.error("Error from getCheckSessionIframe:",e instanceof Error?e.message:e)}},this._stop=()=>{const e=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const t=setInterval((async()=>{clearInterval(t);try{const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}catch(t){e.error("error from querySessionStatus",t instanceof Error?t.message:t)}}),1e3)}},this._callback=async()=>{const e=this._logger.create("_callback");try{const t=await this._userManager.querySessionStatus();let r=!0;t&&this._checkSessionIFrame?t.sub===this._sub?(r=!1,this._checkSessionIFrame.start(t.session_state),t.sid===this._sid?e.debug("same sub still logged in at OP, restarting check session iframe; session_state",t.session_state):(e.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",t.session_state),this._userManager.events._raiseUserSessionChanged())):e.debug("different subject signed into OP",t.sub):e.debug("subject no longer signed into OP"),r?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():e.debug("no change in session detected, no event to raise")}catch(t){this._sub&&(e.debug("Error calling queryCurrentSigninSession; raising signed out event",t),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch((e=>{this._logger.error(e)}))}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const e=await this._userManager.querySessionStatus();if(e){const t={session_state:e.session_state,profile:e.sub&&e.sid?{sub:e.sub,sid:e.sid}:null};this._start(t)}}}}(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){const e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");const{redirectMethod:t,...r}=e,n=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},n)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){const n=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});n.debug("got signin response");const o=await this._buildUser(i);return o.profile&&o.profile.sub?n.info("success, signed in subject",o.profile.sub):n.info("no subject"),o}async signinPopup(e={}){const t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,o=this.settings.popup_redirect_uri;o||t.throw(new Error("No popup_redirect_uri configured"));const s=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n}),a=await this._signin({request_type:"si:p",redirect_uri:o,display:"popup",...i},s);return a&&(a.profile&&a.profile.sub?t.info("success, signed in subject",a.profile.sub):t.info("no subject")),a}async signinPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async signinSilent(e={}){var t;const r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:n,...i}=e;let o=await this._loadUser();if(null==o?void 0:o.refresh_token){r.debug("using refresh token");const e=new class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}}(o);return await this._useRefreshToken(e)}const s=this.settings.silent_redirect_uri;let a;s||r.throw(new Error("No silent_redirect_uri configured")),o&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",o.profile.sub),a=o.profile.sub);const u=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});return o=await this._signin({request_type:"si:s",redirect_uri:s,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,...i},u,a),o&&((null==(t=o.profile)?void 0:t.sub)?r.info("success, signed in subject",o.profile.sub):r.info("no subject")),o}async _useRefreshToken(e){const t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new MR({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...n}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));const o=await this._loadUser(),s=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),a=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?null==o?void 0:o.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...n},s);try{const e=await this._client.processSigninResponse(a.url);return t.debug("got signin response"),e.session_state&&e.profile.sub?(t.info("success for subject",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid}):(t.info("success, user not authenticated"),null)}catch(e){if(this.settings.monitorAnonymousSession&&e instanceof yR)switch(e.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:e.session_state}}throw e}}async _signin(e,t,r){const n=await this._signinStart(e,t);return await this._signinEnd(n.url,r)}async _signinStart(e,t){const r=this._logger.create("_signinStart");try{const n=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:n.url,state:n.state.id,response_mode:n.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(e){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signinEnd(e,t){const r=this._logger.create("_signinEnd"),n=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(n,t)}async _buildUser(e,t){const r=this._logger.create("_buildUser"),n=new MR(e);if(t){if(t!==n.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",n.profile.sub),new yR({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(n),r.debug("user stored"),this._events.load(n),n}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:r,...n}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...n},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:n,...i}=e,o=this.settings.popup_post_logout_redirect_uri,s=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:n});await this._signout({request_type:"so:p",post_logout_redirect_uri:o,state:null==o?void 0:{},...i},s),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,t),r.info("success")}async _signout(e,t){const r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;const n=this._logger.create("_signoutStart");try{const i=await this._loadUser();n.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);const o=e.id_token_hint||i&&i.id_token;o&&(n.debug("setting id_token_hint in signout request"),e.id_token_hint=o),await this.removeUser(),n.debug("user removed, creating signout request");const s=await this._client.createSignoutRequest(e);return n.debug("got signout request"),await t.navigate({url:s.url,state:null==(r=s.state)?void 0:r.id})}catch(e){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),e}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;const r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:n,...i}=e,o=this.settings.includeIdTokenInSilentSignout?null==(t=await this._loadUser())?void 0:t.id_token:void 0,s=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n});await this._signout({request_type:"so:s",post_logout_redirect_uri:s,id_token_hint:o,...i},a),r.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const r=this._logger.create("_revokeInternal");if(!e)return;const n=t.filter((t=>"string"==typeof e[t]));if(n.length){for(const t of n)await this._client.revokeToken(e[t],t),r.info(`${t} revoked successfully`),"access_token"!==t&&(e[t]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}else r.debug("no need to revoke due to no token(s)")}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),MR.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}}((({oidcConfiguration:e,authenticationDomain:t})=>{const r={authority:t,redirect_uri:e.redirectUri,popup_redirect_uri:e.redirectUri,client_id:e.clientId,metadata:{authorization_endpoint:`${t}/authorize`,token_endpoint:`${t}/oauth/token`,userinfo_endpoint:`${t}/userinfo`,end_session_endpoint:`${t}/v2/logout?returnTo=${encodeURIComponent(e.logoutRedirectUri)}&client_id=${e.clientId}`},mergeClaims:!0,loadUserInfo:!0,scope:e.scope};return e.audience&&(r.extraQueryParams={audience:e.audience}),r})(e)),this.deviceCredentialsManager=new xB}static mapOidcUserToDomainModel=e=>{const t=e.profile?.passport,r={expired:e.expired,idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:e.profile.sub,email:e.profile.email,nickname:e.profile.nickname}};return t?.imx_eth_address&&(r.imx={ethAddress:t?.imx_eth_address,starkAddress:t?.imx_stark_address,userAdminAddress:t?.imx_user_admin_address}),t?.zkevm_eth_address&&(r.zkEvm={ethAddress:t?.zkevm_eth_address,userAdminAddress:t?.zkevm_user_admin_address}),r};static mapDeviceTokenResponseToDomainUserModel=e=>{const t=iR(e.id_token),r={idToken:e.id_token,accessToken:e.access_token,refreshToken:e.refresh_token,profile:{sub:t.sub,email:t.email,nickname:t.nickname}};return t?.passport?.imx_eth_address&&(r.imx={ethAddress:t?.passport?.imx_eth_address,starkAddress:t?.passport?.imx_stark_address,userAdminAddress:t?.passport?.imx_user_admin_address}),r};async login(){return SB((async()=>{const e=await this.userManager.signinPopup({popupWindowFeatures:{width:410,height:450}});return OB.mapOidcUserToDomainModel(e)}),EB.AUTHENTICATION_ERROR)}async loginCallback(){return SB((async()=>this.userManager.signinPopupCallback()),EB.AUTHENTICATION_ERROR)}async loginWithDeviceFlow(){return SB((async()=>{const e=await _M.post(`${this.config.authenticationDomain}/oauth/device/code`,{client_id:this.config.oidcConfiguration.clientId,scope:this.config.oidcConfiguration.scope,audience:this.config.oidcConfiguration.audience},TB);return{code:e.data.user_code,deviceCode:e.data.device_code,url:e.data.verification_uri_complete,interval:e.data.interval}}),EB.AUTHENTICATION_ERROR)}async connectImxDeviceFlow(e,t,r){return SB((async()=>{const n=Date.now();for(;;){if(null!=r&&Date.now()-n>r)throw new Error("Timed out");await RB(1e3*t);try{const t=await this.getDeviceFlowToken(e),r=OB.mapDeviceTokenResponseToDomainUserModel(t);return r.imx?.ethAddress&&r.imx?.starkAddress&&r.imx?.userAdminAddress&&this.deviceCredentialsManager.saveCredentials(t),r}catch(e){if(!_M.isAxiosError(e))throw e;{const t=e.response?.data;switch(t.error){case"authorization_pending":case"slow_down":break;case"expired_token":throw new Error("Token expired, please log in again");case"access_denied":throw new Error("User denied access");default:throw new Error("Error getting token")}}}}throw new Error("Failed to get credentials")}),EB.AUTHENTICATION_ERROR)}async getDeviceFlowToken(e){return(await _M.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e},TB)).data}async connectImxWithCredentials(e){return SB((async()=>{if(this.deviceCredentialsManager.areValid(e))return OB.mapDeviceTokenResponseToDomainUserModel(e);const t=e?.refresh_token??null;if(t){const e=await this.refreshToken(t);return OB.mapDeviceTokenResponseToDomainUserModel(e)}return null}),EB.AUTHENTICATION_ERROR)}async refreshToken(e){return(await _M.post(`${this.config.authenticationDomain}/oauth/token`,{client_id:this.config.oidcConfiguration.clientId,grant_type:"refresh_token",refresh_token:e},TB)).data}async logout(){return SB((async()=>this.userManager.signoutRedirect()),EB.LOGOUT_ERROR)}async logoutDeviceFlow(){return SB((async()=>{this.deviceCredentialsManager.clearCredentials()}),EB.LOGOUT_ERROR)}async loginSilent(){return SB((async()=>{if(!await this.getUser())return null;const e=await this.userManager.signinSilent();return e?OB.mapOidcUserToDomainModel(e):null}),EB.SILENT_LOGIN_ERROR)}async getUser(){return SB((async()=>{const e=await this.userManager.getUser();if(e)return OB.mapOidcUserToDomainModel(e);const t=this.deviceCredentialsManager.getCredentials();return t?OB.mapDeviceTokenResponseToDomainUserModel(t):null}),EB.NOT_LOGGED_IN_ERROR)}async getUserDeviceFlow(){return SB((async()=>{const e=this.deviceCredentialsManager.getCredentials();return e?OB.mapDeviceTokenResponseToDomainUserModel(e):null}),EB.NOT_LOGGED_IN_ERROR)}checkStoredDeviceFlowCredentials(){return this.deviceCredentialsManager.getCredentials()}}class MB{config;constructor(e){this.config=e}async login(e,t){return SB((async()=>{const r=new AC(this.config.magicPublishableApiKey,{extensions:[new kC],network:t});return await r.openid.loginWithOIDC({jwt:e,providerId:this.config.magicProviderId}),r.rpcProvider}),EB.WALLET_CONNECTION_ERROR)}}const IB=1e3,PB=3,CB=async(e,t)=>{const{retries:r=PB,interval:n=IB,finalErr:i=Error("Retry failed"),finallyFn:o=(()=>{})}=t||{};try{return await e()}catch(t){return r<=0?Promise.reject(i):(await(s=n,new Promise((e=>{setTimeout((()=>e()),s)}))),CB(e,{retries:r-1,finalErr:i,finallyFn:o}))}finally{r<=0&&o()}var s};class NB{transactionAPI;confirmationScreen;imxEtherAddress;constructor({imxPublicApiDomain:e,accessToken:t,confirmationScreen:r,imxEtherAddress:n}){this.confirmationScreen=r,this.transactionAPI=new yB(new bB({accessToken:t,basePath:e})),this.imxEtherAddress=n}loading(e){this.confirmationScreen.loading(e)}async validate({payloadHash:e}){if(!(await CB((async()=>this.transactionAPI.getTransactionByID({transactionID:e,chainType:"starkex"})),{finallyFn:()=>{this.confirmationScreen.closeWindow()}})).data.id)throw new Error("Transaction doesn't exists");const t=await this.transactionAPI.evaluateTransaction({id:e,transactionEvaluationRequest:{chainType:"starkex"}}),{confirmationRequired:r}=t.data;if(r){if(!(await this.confirmationScreen.startGuardianTransaction(e,this.imxEtherAddress)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow()}}const BB="ERC721";const jB="ERC721";class LB{user;starkSigner;immutableXClient;confirmationScreen;guardianClient;constructor({user:e,starkSigner:t,immutableXClient:r,imxPublicApiDomain:n,confirmationScreen:i}){this.user=e,this.starkSigner=t,this.immutableXClient=r,this.confirmationScreen=i,this.guardianClient=new NB({imxPublicApiDomain:n,accessToken:e.accessToken,confirmationScreen:i,imxEtherAddress:e.imx.ethAddress})}async transfer(e){return async function({request:e,transfersApi:t,starkSigner:r,user:n,guardianClient:i}){return SB((async()=>{i.loading();const o=e.type===jB?"1":e.amount,s={sender:n.imx.ethAddress,token:_B(e),amount:o,receiver:e.receiver},a={Authorization:`Bearer ${n.accessToken}`},u=await t.getSignableTransferV1({getSignableTransferRequest:s},{headers:a});await i.validate({payloadHash:u.data.payload_hash});const c=u.data,{payload_hash:f}=c,d=await r.signMessage(f),h=await r.getAddress(),l={createTransferRequest:{sender_stark_key:c.sender_stark_key||h,sender_vault_id:c.sender_vault_id,receiver_stark_key:c.receiver_stark_key,receiver_vault_id:c.receiver_vault_id,asset_id:c.asset_id,amount:c.amount,nonce:c.nonce,expiration_timestamp:c.expiration_timestamp,stark_signature:d}},{data:p}=await t.createTransferV1(l,{headers:a});return{sent_signature:p.sent_signature,status:p.status?.toString(),time:p.time,transfer_id:p.transfer_id}}),EB.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}registerOffchain(){throw new AB("Operation not supported",EB.OPERATION_NOT_SUPPORTED_ERROR)}isRegisteredOnchain(){throw new AB("Operation not supported",EB.OPERATION_NOT_SUPPORTED_ERROR)}createOrder(e){return async function({starkSigner:e,user:t,request:r,ordersApi:n,guardianClient:i}){return SB((async()=>{i.loading();const{ethAddress:o}=t.imx,s=r.sell.type===BB?"1":r.sell.amount,a=r.buy.type===BB?"1":r.buy.amount,u={Authorization:`Bearer ${t.accessToken}`},c={user:o,amount_buy:a,token_buy:_B(r.buy),amount_sell:s,token_sell:_B(r.sell),fees:r.fees,expiration_timestamp:r.expiration_timestamp},f=await n.getSignableOrder({getSignableOrderRequestV3:c},{headers:u});await i.validate({payloadHash:f.data.payload_hash});const{payload_hash:d}=f.data,h=await e.signMessage(d),l=f.data,p={createOrderRequest:{include_fees:!0,fees:r.fees,stark_signature:h,amount_buy:l.amount_buy,amount_sell:l.amount_sell,asset_id_buy:l.asset_id_buy,asset_id_sell:l.asset_id_sell,expiration_timestamp:l.expiration_timestamp,nonce:l.nonce,stark_key:l.stark_key,vault_id_buy:l.vault_id_buy,vault_id_sell:l.vault_id_sell}};return{...(await n.createOrderV3(p,{headers:u})).data}}),EB.CREATE_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}cancelOrder(e){return async function({user:e,starkSigner:t,request:r,ordersApi:n,guardianClient:i}){return SB((async()=>{i.loading();const o={order_id:r.order_id},s={Authorization:`Bearer ${e.accessToken}`},a=await n.getSignableCancelOrderV3({getSignableCancelOrderRequest:o},{headers:s});await i.validate({payloadHash:a.data.payload_hash});const{payload_hash:u}=a.data,c=await t.signMessage(u),f=await n.cancelOrderV3({id:r.order_id.toString(),cancelOrderRequest:{order_id:r.order_id,stark_signature:c}},{headers:s});return{order_id:f.data.order_id,status:f.data.status}}),EB.CANCEL_ORDER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,ordersApi:this.immutableXClient.ordersApi,guardianClient:this.guardianClient})}createTrade(e){return async function({request:e,tradesApi:t,user:r,starkSigner:n,guardianClient:i}){return SB((async()=>{i.loading();const{ethAddress:o}=r.imx,s={expiration_timestamp:e.expiration_timestamp,fees:e.fees,order_id:e.order_id,user:o},a={Authorization:`Bearer ${r.accessToken}`},u=await t.getSignableTrade({getSignableTradeRequest:s},{headers:a});await i.validate({payloadHash:u.data.payload_hash});const{payload_hash:c}=u.data,f=await n.signMessage(c),{data:d}=u,h={createTradeRequest:{include_fees:!0,fees:e?.fees,stark_signature:f,order_id:e?.order_id,fee_info:d.fee_info,amount_buy:d.amount_buy,amount_sell:d.amount_sell,asset_id_buy:d.asset_id_buy,asset_id_sell:d.asset_id_sell,expiration_timestamp:d.expiration_timestamp,nonce:d.nonce,stark_key:d.stark_key,vault_id_buy:d.vault_id_buy,vault_id_sell:d.vault_id_sell}},{data:l}=await t.createTradeV3(h,{headers:a});return l}),EB.CREATE_TRADE_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,tradesApi:this.immutableXClient.tradesApi,guardianClient:this.guardianClient})}batchNftTransfer(e){return async function({user:e,starkSigner:t,request:r,transfersApi:n,guardianClient:i}){return SB((async()=>{i.loading({width:480,height:784});const{ethAddress:o}=e.imx,s={sender_ether_key:o,signable_requests:r.map((e=>({amount:"1",token:_B({type:jB,tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver})))},a={Authorization:`Bearer ${e.accessToken}`},u=await n.getSignableTransfer({getSignableTransferRequestV2:s},{headers:a});await i.validate({payloadHash:u.data.signable_responses[0]?.payload_hash});const c=await Promise.all(u.data.signable_responses.map((async e=>{const r=await t.signMessage(e.payload_hash);return{sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r}}))),f={sender_stark_key:u.data.sender_stark_key,requests:c},d=await n.createTransfer({createTransferRequestV2:f},{headers:a});return{transfer_ids:d?.data.transfer_ids}}),EB.TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,transfersApi:this.immutableXClient.transfersApi,guardianClient:this.guardianClient})}exchangeTransfer(e){return async function({user:e,starkSigner:t,request:r,exchangesApi:n}){return SB((async()=>{const{ethAddress:i}=e.imx,o=r.amount,s=await n.getExchangeSignableTransfer({id:r.transactionID,getSignableTransferRequest:{sender:i,token:_B(r),amount:o,receiver:r.receiver}}),a=await t.getAddress(),{payload_hash:u}=s.data,c=await t.signMessage(u),f={sender_stark_key:s.data.sender_stark_key||a,sender_vault_id:s.data.sender_vault_id,receiver_stark_key:s.data.receiver_stark_key,receiver_vault_id:s.data.receiver_vault_id,asset_id:s.data.asset_id,amount:s.data.amount,nonce:s.data.nonce,expiration_timestamp:s.data.expiration_timestamp,stark_signature:c},d={Authorization:`Bearer ${e.accessToken}`},h=await n.createExchangeTransfer({id:r.transactionID,createTransferRequest:f},{headers:d});return{sent_signature:h?.data.sent_signature,status:h?.data.status?.toString(),time:h?.data.time,transfer_id:h?.data.transfer_id}}),EB.EXCHANGE_TRANSFER_ERROR)}({request:e,user:this.user,starkSigner:this.starkSigner,exchangesApi:this.immutableXClient.exchangeApi})}deposit(e){throw new AB("Operation not supported",EB.OPERATION_NOT_SUPPORTED_ERROR)}prepareWithdrawal(e){throw new AB("Operation not supported",EB.OPERATION_NOT_SUPPORTED_ERROR)}completeWithdrawal(e,t){throw new AB("Operation not supported",EB.OPERATION_NOT_SUPPORTED_ERROR)}getAddress(){return Promise.resolve(this.user.imx.ethAddress)}}class UB{authManager;config;confirmationScreen;immutableXClient;magicAdapter;constructor({authManager:e,config:t,confirmationScreen:r,immutableXClient:n,magicAdapter:i}){this.authManager=e,this.config=t,this.confirmationScreen=r,this.immutableXClient=n,this.magicAdapter=i}async getProvider(){const e=await this.authManager.login();return this.createProviderInstance(e)}async getProviderSilent(){const e=await this.authManager.loginSilent();return e?this.createProviderInstance(e):null}async getProviderWithDeviceFlow(e,t,r){const n=await this.authManager.connectImxDeviceFlow(e,t,r);return this.createProviderInstance(n)}async getProviderWithCredentials(e){const t=await this.authManager.connectImxWithCredentials(e);return t?this.createProviderInstance(t):null}async createProviderInstance(e){if(!e.idToken)throw new AB("Failed to initialise",EB.WALLET_CONNECTION_ERROR);const t=await this.magicAdapter.login(e.idToken,this.config.network),r=new Bu(t).getSigner(),n=await(async e=>SB((async()=>LA(await NA(e))),EB.WALLET_CONNECTION_ERROR))(r);if(!e.imx?.ethAddress){const t=await this.registerStarkEx(r,n,e.accessToken);return new LB({user:t,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}return new LB({user:e,starkSigner:n,immutableXClient:this.immutableXClient,imxPublicApiDomain:this.config.imxPublicApiDomain,confirmationScreen:this.confirmationScreen})}async registerStarkEx(e,t,r){return SB((async()=>{await async function({ethSigner:e,starkSigner:t,usersApi:r},n){return SB((async()=>{const i=await e.getAddress(),o=await t.getAddress(),s=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:i,stark_key:o}}),{signable_message:a,payload_hash:u}=s.data,c=await wB(a,e),f=await t.signMessage(u);return(await r.registerPassportUser({authorization:`Bearer ${n}`,registerPassportUserRequest:{eth_signature:c,ether_key:i,stark_signature:f,stark_key:o}})).statusText}),EB.USER_REGISTRATION_ERROR)}({ethSigner:e,starkSigner:t,usersApi:this.immutableXClient.usersApi},r);return await CB((async()=>{const e=await this.authManager.loginSilent();return!!e?.imx?e:Promise.reject(new Error("user wallet addresses not exist"))}))}),EB.REFRESH_TOKEN_ERROR)}}var DB;e.Networks=void 0,(DB=e.Networks||(e.Networks={})).PRODUCTION="mainnet",DB.SANDBOX="goerli";const FB=(e,t,r)=>{const n=t.map((t=>!e[t]&&t)).filter((e=>e)).join(", ");if(""!==n){throw new AB(r?`${r} - ${n} cannot be null`:`${n} cannot be null`,EB.INVALID_CONFIGURATION)}};class qB{network;authenticationDomain;passportDomain;imxPublicApiDomain;magicPublishableApiKey;magicProviderId;oidcConfiguration;baseConfig;constructor({baseConfig:t,overrides:r,...n}){if(FB(n,["clientId","logoutRedirectUri","redirectUri"]),this.oidcConfiguration=n,this.baseConfig=t,r)FB(r,["network","authenticationDomain","magicPublishableApiKey","magicProviderId","passportDomain","imxPublicApiDomain"],"overrides"),this.network=r.network,this.authenticationDomain=r.authenticationDomain,this.passportDomain=r.passportDomain,this.imxPublicApiDomain=r.imxPublicApiDomain,this.magicPublishableApiKey=r.magicPublishableApiKey,this.magicProviderId=r.magicProviderId;else switch(t.environment){case e.Environment.PRODUCTION:this.network=e.Networks.PRODUCTION,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.immutable.com",this.imxPublicApiDomain="https://api.immutable.com";break;case e.Environment.SANDBOX:default:this.network=e.Networks.SANDBOX,this.authenticationDomain="https://auth.immutable.com",this.magicPublishableApiKey="pk_live_10F423798A540ED7",this.magicProviderId="fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=",this.passportDomain="https://passport.sandbox.immutable.com",this.imxPublicApiDomain="https://api.sandbox.immutable.com"}}}var zB,KB,HB;!function(e){e.CONFIRMATION_WINDOW_READY="confirmation_window_ready",e.TRANSACTION_CONFIRMED="transaction_confirmed",e.TRANSACTION_ERROR="transaction_error"}(zB||(zB={})),function(e){e.TRANSACTION_START="transaction_start"}(KB||(KB={})),function(e){e.cancelOrder="delete:v1/orders",e.createOrder="post:v1/orders",e.createTrade="post:v1/trades",e.createTransfer="post:v1/transfers",e.createBatchTransfer="post:v2/transfers"}(HB||(HB={}));const GB="imx_passport_confirmation",WB=({url:e,title:t,width:r,height:n})=>{const i=Math.max(0,Math.round(window.screenX+(window.outerWidth-r)/2)),o=Math.max(0,Math.round(window.screenY+(window.outerHeight-n)/2)),s=window.open(e,t,`\n scrollbars=yes,\n width=${r}, \n height=${n}, \n top=${o}, \n left=${i}\n `);if(!s)throw new Error("Failed to open confirmation screen");return s.focus(),s},VB="Confirm this transaction";class XB{config;confirmationWindow;constructor(e){this.config=e}postMessage(e,t,r){e.postMessage({eventType:GB,accessToken:t,...r},this.config.passportDomain)}startTransaction(e,t,r){return new Promise(((n,i)=>{const o=({data:r,origin:o})=>{if(o===this.config.passportDomain&&r.eventType===GB)switch(r.messageType){case zB.CONFIRMATION_WINDOW_READY:this.postMessage(s,e,{messageType:KB.TRANSACTION_START,messageData:t});break;case zB.TRANSACTION_CONFIRMED:n({confirmed:!0});break;case zB.TRANSACTION_ERROR:i(new Error("Transaction error"));break;default:i(new Error("Unsupported message type"))}};window.addEventListener("message",o);const s=WB({url:`${this.config.passportDomain}/transaction-confirmation`,title:VB,width:r?.width||480,height:r?.height||380}),a=setInterval((()=>{s.closed&&(clearInterval(a),window.removeEventListener("message",o),n({confirmed:!1}))}),1e3)}))}startGuardianTransaction(e,t){return new Promise(((r,n)=>{const i=({data:e,origin:t})=>{if(t===this.config.passportDomain&&e.eventType===GB)switch(e.messageType){case zB.CONFIRMATION_WINDOW_READY:break;case zB.TRANSACTION_CONFIRMED:r({confirmed:!0});break;case zB.TRANSACTION_ERROR:n(new Error("Transaction error"));break;default:n(new Error("Unsupported message type"))}};if(window.addEventListener("message",i),!this.confirmationWindow)return void r({confirmed:!1});this.confirmationWindow.location.href=`${this.config.passportDomain}/transaction-confirmation/transaction.html?transactionId=${e}&imxEtherAddress=${t}&chainType=starkex`;const o=setInterval((()=>{this.confirmationWindow?.closed&&(clearInterval(o),window.removeEventListener("message",i),r({confirmed:!1}))}),1e3)}))}loading(e){this.confirmationWindow=WB({url:`${this.config.passportDomain}/transaction-confirmation/loading.html`,title:VB,width:e?.width||480,height:e?.height||380})}closeWindow(){this.confirmationWindow?.close()}}var JB=n((function({mustBeMetaMask:e=!1,silent:t=!1,timeout:r=3e3}={}){!function(){if("boolean"!=typeof e)throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if("boolean"!=typeof t)throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if("number"!=typeof r)throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}();let n=!1;return new Promise((i=>{function o(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",o);const{ethereum:r}=window;if(!r||e&&!r.isMetaMask){const n=e&&r?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum.";!t&&console.error("@metamask/detect-provider:",n),i(null)}else i(r)}window.ethereum?o():(window.addEventListener("ethereum#initialized",o,{once:!0}),setTimeout((()=>{o()}),r))}))}));async function $B(e,t){if(!function(e,t){return e===t.ethConfiguration.chainID}(await e.getChainId(),t))throw new Error("The wallet used for this operation is not connected to the correct network.")}async function YB(e,t,r){await $B(t,r.immutableXConfig);const n=fA.Registration.connect(r.immutableXConfig.ethConfiguration.registrationContractAddress,t);try{return await n.isRegistered(e)}catch(e){if("USER_UNREGISTERED"===e.reason)return!1;throw e}}async function QB(e,t,r){const n=await r.getSignableRegistration({getSignableRegistrationRequest:{ether_key:e,stark_key:t}});return{operator_signature:n.data.operator_signature,payload_hash:n.data.payload_hash}}const ZB=e=>{if(void 0!==e)return e;throw new Error("undefined field exception")};async function ej(e){const{signers:{ethSigner:t,starkSigner:r},type:n,config:i}=e;await $B(t,e.config);const o=new dk(i.apiConfiguration),s="ERC721"===n?"1":e.amount,a=await o.getSignableWithdrawal({getSignableWithdrawalRequest:{user:await t.getAddress(),token:_B(e),amount:s}}),{signable_message:u,payload_hash:c}=a.data,f=await r.signMessage(c),{ethAddress:d,ethSignature:h}=await async function(e,t){return{message:e,ethAddress:await t.getAddress(),ethSignature:await wB(e,t)}}(u,t);return(await o.createWithdrawal({createWithdrawalRequest:{stark_key:ZB(a.data.stark_key),amount:s,asset_id:ZB(a.data.asset_id),vault_id:ZB(a.data.vault_id),nonce:ZB(a.data.nonce),stark_signature:f},xImxEthAddress:d,xImxEthSignature:h})).data}async function tj(e,t,r,n){const i=new yS(r.apiConfiguration);return(await i.encodeAsset({assetType:e,encodeAssetRequest:{token:{type:t,...n&&{data:n}}}})).data}async function rj({ethSigner:e,starkPublicKey:t,token:r,config:n}){await $B(e,n.immutableXConfig);const i=n.immutableXConfig,o=await tj("asset","ERC20",i,{token_address:r.tokenAddress});return await YB(t,e,n)?async function(e,t,r,n){const i=fA.Core.connect(n.ethConfiguration.coreContractAddress,e),o=await i.populateTransaction.withdraw(r,t);return e.sendTransaction(o)}(e,o.asset_type,t,i):async function({ethSigner:e,assetType:t,starkPublicKey:r,config:n}){const i=await e.getAddress(),o=n.immutableXConfig,s=new ak(o.apiConfiguration),a=await QB(i,r,s),u=fA.Registration.connect(n.immutableXConfig.ethConfiguration.registrationContractAddress,e),c=await u.populateTransaction.registerAndWithdraw(i,r,a.operator_signature,t);return e.sendTransaction(c)}({ethSigner:e,assetType:o.asset_type,starkPublicKey:t,config:n})}async function nj(e,t,r,n){const i=n.immutableXConfig,o=await tj("mintable-asset","ERC721",i,{id:r.data.id,token_address:r.data.tokenAddress,...r.data.blueprint&&{blueprint:r.data.blueprint}}),s=function(e){const{id:t}=e.data,r=e.data.blueprint||"";return Uc(gc(`{${t}}:{${r}}`))}(r);return await YB(t,e,n)?async function(e,t,r,n,i){const o=fA.Core.connect(i.ethConfiguration.coreContractAddress,e),s=await o.populateTransaction.withdrawAndMint(r,t,n);return e.sendTransaction(s)}(e,o.asset_type,t,s,i):async function(e,t,r,n,i){const o=await e.getAddress(),s=new ak(i.apiConfiguration),a=await QB(o,r,s),u=fA.Registration.connect(i.ethConfiguration.registrationContractAddress,e),c=await u.populateTransaction.regsiterAndWithdrawAndMint(o,r,a.operator_signature,t,n);return e.sendTransaction(c)}(e,o.asset_type,t,s,i)}async function ij(e,t,r,n){const i=n.immutableXConfig,o=await tj("asset","ERC721",i,{token_id:r.tokenId,token_address:r.tokenAddress});return await YB(t,e,n)?async function(e,t,r,n,i){const o=fA.Core.connect(i.ethConfiguration.coreContractAddress,e),s=await o.populateTransaction.withdrawNft(r,t,n);return e.sendTransaction(s)}(e,o.asset_type,t,r.tokenId,i):async function(e,t,r,n,i){const o=await e.getAddress(),s=new ak(i.apiConfiguration),a=await QB(o,r,s),u=fA.Registration.connect(i.ethConfiguration.registrationContractAddress,e),c=await u.populateTransaction.registerAndWithdrawNft(o,r,a.operator_signature,t,n);return e.sendTransaction(c)}(e,o.asset_type,t,r.tokenId,i)}async function oj({ethSigner:e,starkPublicKey:t,config:r}){await $B(e,r.immutableXConfig);const n=r.immutableXConfig,i=await tj("asset","ETH",n);return await YB(t,e,r)?async function(e,t,r,n){const i=fA.Core.connect(n.ethConfiguration.coreContractAddress,e),o=await i.populateTransaction.withdraw(r,t);return e.sendTransaction(o)}(e,i.asset_type,t,n):async function(e,t,r,n){const i=await e.getAddress(),o=new ak(n.apiConfiguration),s=await QB(i,r,o),a=fA.Registration.connect(n.ethConfiguration.registrationContractAddress,e),u=await a.populateTransaction.registerAndWithdraw(i,r,s.operator_signature,t);return e.sendTransaction(u)}(e,i.asset_type,t,n)}async function sj({signers:{ethSigner:e},starkPublicKey:t,token:r,config:n}){switch(r.type){case"ETH":return oj({ethSigner:e,starkPublicKey:t,config:n});case"ERC20":return rj({ethSigner:e,starkPublicKey:t,token:r,config:n});case"ERC721":return async function({ethSigner:e,starkPublicKey:t,token:r,config:n}){await $B(e,n.immutableXConfig);const{tokenAddress:i}=r,{tokenId:o}=r,s=n.immutableXConfig,a=new CS(s.apiConfiguration);return await a.getMintableTokenDetailsByClientTokenId({tokenAddress:i,tokenId:o}).then((r=>nj(e,t,{type:"ERC721",data:{id:o,tokenAddress:i,blueprint:r.data.blueprint}},n))).catch((i=>{if(404===i.response?.status)return ij(e,t,r,n);throw i}))}({ethSigner:e,starkPublicKey:t,token:r,config:n})}}async function aj({signers:{ethSigner:e},deposit:t,config:r}){await $B(e,r.immutableXConfig);const n=await e.getAddress(),i=Uu(t.amount,"wei"),o=r.immutableXConfig,s=new lS(o.apiConfiguration),a=new yS(o.apiConfiguration),u=new ak(o.apiConfiguration),c={user:n,token:{type:t.type,data:{decimals:18}},amount:i.toString()},f=await s.getSignableDeposit({getSignableDepositRequest:c}),d=(await a.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:t.type}}})).data.asset_type,h=f.data.stark_key,l=f.data.vault_id;return await YB(h,e,r)?async function(e,t,r,n,i,o){const s=fA.Core.connect(o.ethConfiguration.coreContractAddress,e),a=await s.populateTransaction["deposit(uint256,uint256,uint256)"](n,r,i);return e.sendTransaction({...a,value:t})}(e,i,d,h,l,o):async function(e,t,r,n,i,o,s){const a=await e.getAddress(),u=fA.Core.connect(o.ethConfiguration.coreContractAddress,e),c=await QB(a,n,s),f=await u.populateTransaction.registerAndDepositEth(a,n,c.operator_signature,r,i);return e.sendTransaction({...f,value:t})}(e,i,d,h,l,o,u)}async function uj({signers:{ethSigner:e},deposit:t,config:r}){await $B(e,r.immutableXConfig);const{apiConfiguration:n,ethConfiguration:i}=r.immutableXConfig,o=await e.getAddress(),s=new JS(n),a=new lS(n),u=new yS(n),c=new ak(n),f=await s.getToken({address:t.tokenAddress}),d={decimals:parseInt(f.data.decimals),token_address:t.tokenAddress},h=Uu(t.amount,0),l=fA.IERC20.connect(t.tokenAddress,e),p=await l.populateTransaction.approve(i.coreContractAddress,h);await e.sendTransaction(p);const g={user:o,token:{type:t.type,data:d},amount:h.toString()},m=await a.getSignableDeposit({getSignableDepositRequest:g}),y=(await u.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:t.type,data:{token_address:t.tokenAddress}}}})).data.asset_type,b=m.data.stark_key,v=m.data.vault_id,w=Ke.from(m.data.amount);return await YB(b,e,r)?async function(e,t,r,n,i,o){const s=fA.Core.connect(o.coreContractAddress,e),a=await s.populateTransaction.depositERC20(n,r,i,t);return e.sendTransaction(a)}(e,w,y,b,v,i):async function(e,t,r,n,i,o,s){const a=await e.getAddress(),u=fA.Core.connect(o.coreContractAddress,e),c=await QB(a,n,s),f=await u.populateTransaction.registerAndDepositERC20(a,n,c.operator_signature,r,i,t);return e.sendTransaction(f)}(e,w,y,b,v,i,c)}async function cj({signers:{ethSigner:e},deposit:t,config:r}){await $B(e,r.immutableXConfig);const n=await e.getAddress(),{immutableXConfig:i}=r,o=new lS(i.apiConfiguration),s=new yS(i.apiConfiguration),a=new ak(i.apiConfiguration),u={token_address:t.tokenAddress,token_id:t.tokenId},c={user:n,token:{type:t.type,data:u},amount:"1".toString()},f=await o.getSignableDeposit({getSignableDepositRequest:c}),d=(await s.encodeAsset({assetType:"asset",encodeAssetRequest:{token:{type:t.type,data:{token_address:t.tokenAddress,token_id:t.tokenId}}}})).data.asset_type,h=f.data.stark_key,l=f.data.vault_id,p=await YB(h,e,r),g=fA.IERC721.connect(t.tokenAddress,e),m=i.ethConfiguration.coreContractAddress;if(await g.isApprovedForAll(n,m)||await g.setApprovalForAll(m,!0),!p){const t=await QB(n,h,a),r=fA.Core.connect(i.ethConfiguration.coreContractAddress,e);await r.registerUser(n,h,t.operator_signature)}return async function(e,t,r,n,i,o){const s=fA.Core.connect(o.ethConfiguration.coreContractAddress,e),a=await s.populateTransaction.depositNft(n,r,i,t);return e.sendTransaction(a)}(e,t.tokenId,d,h,l,i)}class fj{config;signers;constructor(e,t,r){this.config=e,this.signers={ethSigner:t,starkSigner:r}}async getAddress(){return await this.signers.ethSigner.getAddress()}registerOffchain(){return async function(e,t){await $B(e.ethSigner,t.immutableXConfig);const r=new ak(t.immutableXConfig.apiConfiguration),n=await e.ethSigner.getAddress(),i=await e.starkSigner.getAddress(),o=await r.getSignableRegistrationOffchain({getSignableRegistrationRequest:{ether_key:n,stark_key:i}}),{signable_message:s,payload_hash:a}=o.data,u=await wB(s,e.ethSigner),c=await e.starkSigner.signMessage(a);return(await r.registerUser({registerUserRequest:{eth_signature:u,ether_key:n,stark_signature:c,stark_key:i}})).data}(this.signers,this.config)}batchNftTransfer(e){return async function({signers:{ethSigner:e,starkSigner:t},request:r,config:n}){await $B(e,n.immutableXConfig);const i=await e.getAddress(),o=new nk(n.immutableXConfig.apiConfiguration),s=r.map((e=>({amount:"1",token:_B({type:"ERC721",tokenId:e.tokenId,tokenAddress:e.tokenAddress}),receiver:e.receiver}))),a=await o.getSignableTransfer({getSignableTransferRequestV2:{sender_ether_key:i,signable_requests:s}}),u=a.data.signable_message;if(void 0===u)throw new Error("Invalid response from Signable registration offchain");const c=await wB(u,e),f=[];for(const e of a.data.signable_responses){const r=await t.signMessage(e.payload_hash),n={sender_vault_id:e.sender_vault_id,receiver_stark_key:e.receiver_stark_key,receiver_vault_id:e.receiver_vault_id,asset_id:e.asset_id,amount:e.amount,nonce:e.nonce,expiration_timestamp:e.expiration_timestamp,stark_signature:r};f.push(n)}const d={sender_stark_key:a.data.sender_stark_key,requests:f},h=await o.createTransfer({createTransferRequestV2:d,xImxEthAddress:i,xImxEthSignature:c});return{transfer_ids:h?.data.transfer_ids}}({signers:this.signers,request:e,config:this.config})}cancelOrder(e){return async function({signers:e,request:t,config:r}){const n=new qS(r.immutableXConfig.apiConfiguration),i=await n.getSignableCancelOrder({getSignableCancelOrderRequest:{order_id:t.order_id}}),{signable_message:o,payload_hash:s}=i.data,a=await wB(o,e.ethSigner),u=await e.starkSigner.signMessage(s),c=await e.ethSigner.getAddress(),f=await n.cancelOrder({id:t.order_id.toString(),cancelOrderRequest:{order_id:t.order_id,stark_signature:u},xImxEthAddress:c,xImxEthSignature:a});return{order_id:f.data.order_id,status:f.data.status}}({signers:this.signers,request:e,config:this.config})}completeWithdrawal(e,t){return sj({config:this.config,signers:this.signers,token:t,starkPublicKey:e})}createOrder(e){return async function({signers:e,request:t,config:r}){await $B(e.ethSigner,r.immutableXConfig);const n=await e.ethSigner.getAddress(),i=new qS(r.immutableXConfig.apiConfiguration),o="ERC721"===t.sell.type?"1":t.sell.amount,s={user:n,amount_buy:"ERC721"===t.buy.type?"1":t.buy.amount,token_buy:_B(t.buy),amount_sell:o,token_sell:_B(t.sell),fees:t.fees,expiration_timestamp:t.expiration_timestamp},a=await i.getSignableOrder({getSignableOrderRequestV3:s}),{signable_message:u,payload_hash:c}=a.data,f=await wB(u,e.ethSigner),d=await e.starkSigner.signMessage(c),h=a.data,l={createOrderRequest:{amount_buy:h.amount_buy,amount_sell:h.amount_sell,asset_id_buy:h.asset_id_buy,asset_id_sell:h.asset_id_sell,expiration_timestamp:h.expiration_timestamp,include_fees:!0,fees:t.fees,nonce:h.nonce,stark_key:h.stark_key,stark_signature:d,vault_id_buy:h.vault_id_buy,vault_id_sell:h.vault_id_sell},xImxEthAddress:n,xImxEthSignature:f};return{...(await i.createOrder(l)).data}}({signers:this.signers,request:e,config:this.config})}createTrade(e){return async function({signers:{ethSigner:e,starkSigner:t},request:r,config:n}){await $B(e,n.immutableXConfig);const i=await e.getAddress(),o=new ZS(n.immutableXConfig.apiConfiguration),s=await o.getSignableTrade({getSignableTradeRequest:{user:i,order_id:r.order_id,fees:r.fees}}),{signable_message:a,payload_hash:u}=s.data,c=await wB(a,e),f=await t.signMessage(u);return(await o.createTrade({createTradeRequest:{amount_buy:s.data.amount_buy,amount_sell:s.data.amount_sell,asset_id_buy:s.data.asset_id_buy,asset_id_sell:s.data.asset_id_sell,expiration_timestamp:s.data.expiration_timestamp,fee_info:s.data.fee_info,fees:r.fees,include_fees:!0,nonce:s.data.nonce,order_id:r.order_id,stark_key:s.data.stark_key,vault_id_buy:s.data.vault_id_buy,vault_id_sell:s.data.vault_id_sell,stark_signature:f},xImxEthAddress:i,xImxEthSignature:c})).data}({signers:this.signers,request:e,config:this.config})}deposit(e){return async function({signers:e,deposit:t,config:r}){switch(t.type){case"ETH":return aj({signers:e,deposit:t,config:r});case"ERC20":return uj({signers:e,deposit:t,config:r});case"ERC721":return cj({signers:e,deposit:t,config:r})}}({signers:this.signers,deposit:e,config:this.config})}exchangeTransfer(e){return async function({signers:e,request:t,config:r}){await $B(e.ethSigner,r.immutableXConfig);const n=new _S(r.immutableXConfig.apiConfiguration),i=await e.ethSigner.getAddress(),o=t.amount,s=await n.getExchangeSignableTransfer({id:t.transactionID,getSignableTransferRequest:{sender:i,token:_B(t),amount:o,receiver:t.receiver}}),{signable_message:a,payload_hash:u}=s.data,c=await wB(a,e.ethSigner),f=await e.starkSigner.signMessage(u),d={sender_stark_key:s.data.sender_stark_key,sender_vault_id:s.data.sender_vault_id,receiver_stark_key:s.data.receiver_stark_key,receiver_vault_id:s.data.receiver_vault_id,asset_id:s.data.asset_id,amount:s.data.amount,nonce:s.data.nonce,expiration_timestamp:s.data.expiration_timestamp,stark_signature:f},h=await n.createExchangeTransfer({id:t.transactionID,createTransferRequest:d,xImxEthAddress:i,xImxEthSignature:c});return{sent_signature:h?.data.sent_signature,status:h?.data.status?.toString(),time:h?.data.time,transfer_id:h?.data.transfer_id}}({signers:this.signers,request:e,config:this.config})}async isRegisteredOnchain(){return YB(await this.signers.starkSigner.getAddress(),this.signers.ethSigner,this.config)}prepareWithdrawal(e){return async function({signers:e,withdrawal:t,config:r}){return ej({signers:e,config:r.immutableXConfig,...t})}({signers:this.signers,withdrawal:e,config:this.config})}transfer(e){return async function({signers:{ethSigner:e,starkSigner:t},request:r,config:n}){await $B(e,n.immutableXConfig);const i=await e.getAddress(),o=new nk(n.immutableXConfig.apiConfiguration),s="ERC721"===r.type?"1":r.amount,a=await o.getSignableTransferV1({getSignableTransferRequest:{sender:i,token:_B(r),amount:s,receiver:r.receiver}}),{signable_message:u,payload_hash:c}=a.data,f=await wB(u,e),d=await t.signMessage(c),h={sender_stark_key:a.data.sender_stark_key,sender_vault_id:a.data.sender_vault_id,receiver_stark_key:a.data.receiver_stark_key,receiver_vault_id:a.data.receiver_vault_id,asset_id:a.data.asset_id,amount:a.data.amount,nonce:a.data.nonce,expiration_timestamp:a.data.expiration_timestamp,stark_signature:d},l=await o.createTransferV1({createTransferRequest:h,xImxEthAddress:i,xImxEthSignature:f});return{sent_signature:l?.data.sent_signature,status:l?.data.status?.toString(),time:l?.data.time,transfer_id:l?.data.transfer_id}}({signers:this.signers,request:e,config:this.config})}}const dj={SWITCH_CHAIN:"wallet_switchEthereumChain",CONNECT:"eth_requestAccounts"};const hj="The Metamask provider was not found";async function lj({chainID:e}){const t=await JB();if(!function(e){return!!e?.request}(t))throw new Error(hj);return await async function(e,t){await e.request({method:dj.CONNECT}),t&&await e.request({method:dj.SWITCH_CHAIN,params:[{chainId:`0x${t.toString(16)}`}]})}(t,e),new Bu(t)}const pj="message";var gj,mj;function yj(e,t){e&&e.contentWindow&&e.contentWindow.postMessage(t,new URL(e.src).origin)}function bj(e,t,r,n){if(e&&t.source!==e.contentWindow)return;const i=t.data;i.type===r&&n(i.details)}!function(e){e.GET_CONNECTION_REQUEST="GET_CONNECTION_REQUEST",e.CONNECT_WALLET_REQUEST="CONNECT_WALLET_REQUEST",e.SIGN_MESSAGE_REQUEST="SIGN_MESSAGE_REQUEST",e.DISCONNECT_WALLET_REQUEST="DISCONNECT_WALLET_REQUEST"}(gj||(gj={})),function(e){e.CONNECT_WALLET_RESPONSE="CONNECT_WALLET_RESPONSE",e.SIGN_MESSAGE_RESPONSE="SIGN_MESSAGE_RESPONSE",e.GET_CONNECTION_RESPONSE="GET_CONNECTION_RESPONSE",e.DISCONNECT_WALLET_RESPONSE="DISCONNECT_WALLET_RESPONSE"}(mj||(mj={}));class vj{publicAddress;iframe;constructor(e,t){this.publicAddress=e,this.iframe=t}getAddress(){return this.publicAddress}signMessage(e){return new Promise(((t,r)=>{const n=e=>{bj(this.iframe,e,mj.SIGN_MESSAGE_RESPONSE,(e=>{window.removeEventListener(pj,n),e.success||r(new Error(e.error?.message)),t(e.data.signedMessage)}))};window.addEventListener(pj,n),yj(this.iframe,{type:gj.SIGN_MESSAGE_REQUEST,details:{starkPublicKey:this.publicAddress,message:e}})}))}getIFrame(){return this.iframe}}const wj="imx-wallet-app",_j={[e.Environment.SANDBOX]:"https://wallets.sandbox.immutable.com",[e.Environment.PRODUCTION]:"https://wallets.immutable.com"},Ej="display: none;";async function Aj(e){const t=document.querySelector(`iframe#${wj}`);return t||await async function(e){return new Promise((t=>{const r=document.createElement("iframe");r.setAttribute("id",wj),r.setAttribute("src",_j[e]),r.setAttribute("style",Ej),document.body.appendChild(r),r.onload=()=>t(r)}))}(e)}var Sj;!function(e){e.PROVIDER_CONNECTION_ERROR="PROVIDER_CONNECTION_ERROR",e.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR"}(Sj||(Sj={}));class kj extends Error{type;constructor(e,t){super(e),this.type=t}}const xj=async(e,t)=>{try{return await e()}catch(e){const r=t.message||`${e.message}`||"UnknownError";throw new kj(r,t.type)}};class Tj extends fj{static imxSigner;static async connect(e){return await xj((async()=>{const t=await lj({chainID:e.immutableXConfig.ethConfiguration.chainID});return this.imxSigner=await async function(e,t){const r=e.getSigner(),n=await r.getAddress(),i=await r.signMessage("Only sign this request if you’ve initiated an action with Immutable X."),o=await Aj(t);return new Promise(((e,t)=>{const r=n=>{bj(o,n,mj.CONNECT_WALLET_RESPONSE,(n=>{window.removeEventListener(pj,r),n.success||t(new Error("The L2 IMX Wallet connection has failed")),e(new vj(n.data.starkPublicKey,o))}))};window.addEventListener(pj,r),yj(o,{type:gj.CONNECT_WALLET_REQUEST,details:{ethAddress:n,signature:i}})}))}(t,e.baseConfig.environment),new Tj(e,t.getSigner(),this.imxSigner)}),{type:Sj.WALLET_CONNECTION_ERROR})}static async disconnect(){if(!this.imxSigner)throw new kj("Attempted to disconnect from the MetaMask IMX provider without an established connection",Sj.PROVIDER_CONNECTION_ERROR);return xj((async()=>{await async function(e){const t=e.getIFrame();return new Promise(((r,n)=>{const i=e=>{bj(t,e,mj.DISCONNECT_WALLET_RESPONSE,(e=>{window.removeEventListener(pj,i),!e.success&&e.error&&n(e.error),t.remove(),r()}))};window.addEventListener(pj,i),yj(t,{type:gj.DISCONNECT_WALLET_REQUEST,details:{starkPublicKey:e.getAddress()}})}))}(this.imxSigner)}),{type:Sj.PROVIDER_CONNECTION_ERROR})}static async signMessage(e){if(!this.imxSigner)throw new kj("Attempted to sign a message with the MetaMask IMX provider without an established connection",Sj.PROVIDER_CONNECTION_ERROR);return xj((async()=>await this.imxSigner.signMessage(e)),{type:Sj.PROVIDER_CONNECTION_ERROR})}}e.GenericIMXProvider=fj,e.ImmutableConfiguration=class{environment;apiKey;constructor(e){this.environment=e.environment,this.apiKey=e.apiKey}},e.ImmutableXClient=GT,e.MetaMaskIMXProvider=Tj,e.Passport=class{authManager;config;confirmationScreen;immutableXClient;magicAdapter;passportImxProviderFactory;constructor(e){this.config=new qB(e),this.authManager=new OB(this.config),this.magicAdapter=new MB(this.config),this.confirmationScreen=new XB(this.config),this.immutableXClient=e.overrides?.immutableXClient||new GT({baseConfig:e.baseConfig}),this.passportImxProviderFactory=new UB({authManager:this.authManager,config:this.config,confirmationScreen:this.confirmationScreen,immutableXClient:this.immutableXClient,magicAdapter:this.magicAdapter})}async connectImxSilent(){return this.passportImxProviderFactory.getProviderSilent()}async connectImx(){return this.passportImxProviderFactory.getProvider()}async loginWithDeviceFlow(){return this.authManager.loginWithDeviceFlow()}async connectImxDeviceFlow(e,t,r){return this.passportImxProviderFactory.getProviderWithDeviceFlow(e,t,r)}checkStoredDeviceFlowCredentials(){return this.authManager.checkStoredDeviceFlowCredentials()}async connectImxWithCredentials(e){return this.passportImxProviderFactory.getProviderWithCredentials(e)}async loginCallback(){return this.authManager.loginCallback()}async logout(){return this.authManager.logout()}async logoutDeviceFlow(){return this.authManager.logoutDeviceFlow()}async getUserInfo(){const e=await this.authManager.getUser();return e?.profile}async getUserInfoDeviceFlow(){const e=await this.authManager.getUserDeviceFlow();return e?.profile}async getIdToken(){const e=await this.authManager.getUser();return e?.idToken}async getAccessToken(){const e=await this.authManager.getUser();return e?.accessToken}},e.PassportError=AB,e.ProviderConfiguration=class{immutableXConfig;baseConfig;constructor({baseConfig:t,overrides:r}){if(this.baseConfig=t,r)this.immutableXConfig=r.immutableXConfig;else switch(t.environment){case e.Environment.SANDBOX:this.immutableXConfig=Rk.SANDBOX;break;case e.Environment.PRODUCTION:this.immutableXConfig=Rk.PRODUCTION}}},e.imxClientCreateStarkSigner=LA,e.imxClientGenerateLegacyStarkPrivateKey=NA}));
|
|
32
|
+
//# sourceMappingURL=index.browser.js.map
|