1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9496],{7604:function(e,t,n){n.d(t,{cR:function(){return cA}});var r,i,o=n(80751),a=n.n(o),s=n(31464),l=n.n(s),c=n(96653),d=n.n(c),u=n(99222),h=n(66737),f=n(37511);function p(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var g=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m=[],y=[],v="undefined"!=typeof Uint8Array?Uint8Array:Array,b=!1;function E(){b=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)m[t]=e[t],y[e.charCodeAt(t)]=t;y["-".charCodeAt(0)]=62,y["_".charCodeAt(0)]=63}function w(e){var t;b||E();for(var n=e.length,r=n%3,i="",o=[],a=0,s=n-r;a<s;a+=16383)o.push(function(e,t,n){for(var r,i=[],o=t;o<n;o+=3)i.push(m[(r=(e[o]<<16)+(e[o+1]<<8)+e[o+2])>>18&63]+m[r>>12&63]+m[r>>6&63]+m[63&r]);return i.join("")}(e,a,a+16383>s?s:a+16383));return 1===r?i+=m[(t=e[n-1])>>2]+m[t<<4&63]+"==":2===r&&(i+=m[(t=(e[n-2]<<8)+e[n-1])>>10]+m[t>>4&63]+m[t<<2&63]+"="),o.push(i),o.join("")}function S(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<<s)-1,c=l>>1,d=-7,u=n?i-1:0,h=n?-1:1,f=e[t+u];for(u+=h,o=f&(1<<-d)-1,f>>=-d,d+=s;d>0;o=256*o+e[t+u],u+=h,d-=8);for(a=o&(1<<-d)-1,o>>=-d,d+=r;d>0;a=256*a+e[t+u],u+=h,d-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function _(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,d=(1<<c)-1,u=d>>1,h=23===i?5960464477539062e-23:0,f=r?0:o-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=d):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+u>=1?h/l:h*Math.pow(2,1-u))*l>=2&&(a++,l/=2),a+u>=d?(s=0,a=d):a+u>=1?(s=(t*l-1)*Math.pow(2,i),a+=u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*g}var C={}.toString,x=Array.isArray||function(e){return"[object Array]"==C.call(e)};I.TYPED_ARRAY_SUPPORT=void 0===g.TYPED_ARRAY_SUPPORT||g.TYPED_ARRAY_SUPPORT;var k=M();function M(){return I.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function A(e,t){if(M()<t)throw RangeError("Invalid typed array length");return I.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=I.prototype:(null===e&&(e=new I(t)),e.length=t),e}function I(e,t,n){if(!(I.TYPED_ARRAY_SUPPORT||this instanceof I))return new I(e,t,n);if("number"==typeof e){if("string"==typeof t)throw Error("If encoding is specified then the first argument must be a string");return T(this,e)}return R(this,e,t,n)}function R(e,t,n,r){if("number"==typeof t)throw TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),I.TYPED_ARRAY_SUPPORT?(e=t).__proto__=I.prototype:e=O(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!I.isEncoding(n))throw TypeError('"encoding" must be a valid string encoding');var r=0|$(t,n),i=(e=A(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(N(t)){var n,r=0|L(t.length);return 0===(e=A(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?A(e,0):O(e,t);if("Buffer"===t.type&&x(t.data))return O(e,t.data)}throw TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function P(e){if("number"!=typeof e)throw TypeError('"size" argument must be a number');if(e<0)throw RangeError('"size" argument must not be negative')}function T(e,t){if(P(t),e=A(e,t<0?0:0|L(t)),!I.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function O(e,t){var n=t.length<0?0:0|L(t.length);e=A(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function L(e){if(e>=M())throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+M().toString(16)+" bytes");return 0|e}function N(e){return!(null==e||!e._isBuffer)}function $(e,t){if(N(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&
vendor: 15,388 bytes, line 1
1(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return X(e).length;default:if(r)return J(e).length;t=(""+t).toLowerCase(),r=!0}}function D(e,t,n){var r,i,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var o="",a=t;a<n;++a)o+=(r=e[a])<16?"0"+r.toString(16):r.toString(16);return o}(this,t,n);case"utf8":case"utf-8":return j(this,t,n);case"ascii":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":return r=t,i=n,0===r&&i===this.length?w(this):w(this.slice(r,i));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(this,t,n);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function B(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function K(e,t,n,r,i){if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),isNaN(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return -1;n=e.length-1}else if(n<0){if(!i)return -1;n=0}if("string"==typeof t&&(t=I.from(t,r)),N(t))return 0===t.length?-1:U(e,t,n,r,i);if("number"==typeof t)return t&=255,I.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):U(e,[t],n,r,i);throw TypeError("val must be string, number or Buffer")}function U(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var d=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===d?0:o-d)){if(-1===d&&(d=o),o-d+1===l)return d*a}else -1!==d&&(o-=o-d),d=-1}else for(n+l>s&&(n=s-l),o=n;o>=0;o--){for(var u=!0,h=0;h<l;h++)if(c(e,o+h)!==c(t,h)){u=!1;break}if(u)return o}return -1}function j(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,l,c=e[i],d=null,u=c>239?4:c>223?3:c>191?2:1;if(i+u<=n)switch(u){case 1:c<128&&(d=c);break;case 2:128==(192&(o=e[i+1]))&&(l=(31&c)<<6|63&o)>127&&(d=l);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(d=l)}null===d?(d=65533,u=1):d>65535&&(d-=65536,r.push(d>>>10&1023|55296),d=56320|1023&d),r.push(d),i+=u}return function(e){var t=e.length;if(t<=H)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=H));return n}(r)}I.poolSize=8192,I._augment=function(e){return e.__proto__=I.prototype,e},I.from=function(e,t,n){return R(null,e,t,n)},I.TYPED_ARRAY_SUPPORT&&(I.prototype.__proto__=Uint8Array.prototype,I.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&I[Symbol.species]),I.alloc=function(e,t,n){return P(e),e<=0?A(null,e):void 0!==t?"string"==typeof n?A(null,e).fill(t,n):A(null,e).fill(t):A(null,e)},I.allocUnsafe=function(e){return T(null,e)},I.allocUnsafeSlow=function(e){return T(null,e)},I.isBuffer=ee,I.compare=function(e,t){if(!N(e)||!N(t))throw TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},I.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}},I.concat=function(e,t){if(!x(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return I.alloc(0);if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var n,r=I.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!N(o))throw TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},I.byteLength=$,I.prototype._isBuffer=!0,I.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)B(this,t,t+1);return this},I.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)B(this,t,t+3),B(this,t+1,t+2);return this},I.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)B(this,t,t+7),B(this,t+1,t+6),B(this,t+2,t+5),B(this,t+3,t+4);return this},I.prototype.toString=function(){var e=0|this.length;return 0===e?"":0==arguments.length?j(this,0,e):D.apply(this,arguments)},I.prototype.equals=function(e){if(!N(e))throw TypeError("Argument must be a Buffer");return this===e||0===I.compare(this,e)},I.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+">"},I.prototype.compare=function(e,t,n,r,i){if(!N(e))throw TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),l=this.slice(r,i),c=e.slice(t,n),d=0;d<s;++d)if(l[d]!==c[d]){o=l[d],a=c[d];break}return o<a?-1:a<o?1:0},I.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},I.prototype.indexOf=function(e,t,n){return K(this,e,t,n,!0)},I.prototype.lastIndexOf=function(e,t,n){return K(this,e,t,n,!1)},I.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i,o,a,s,l,c,d,u,h,f,p=this.length-t;if((void 0===n||n>p)&&(n=p),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var g=!1;;)switch(r){case"hex":return function(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))break;e[n+a]=s}return a}(this,e,t,n);case"utf8":case"utf-8":return l=t,c=n,Q(J(e,this.length-l),this,l,c);case"ascii":case"latin1":case"binary":return i=this,o=e,a=t,s=n,Q(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(o),i,a,s);case"base64":return d=t,u=n,Q(X(e),this,d,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h=t,f=n,Q(function(e,t){for(var n,r,i=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i.push(n%256),i.push(r);return i}(e,this.length-h),this,h,f);default:if(g)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),g=!0}},I.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;function F(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function z(e,t,n,r,i,o){if(!N(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function q(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function W(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function V(e,t,n,r,i,o){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function G(e,t,n,r,i){return i||V(e,0,n,4),_(e,t,n,r,23,4),n+4}function Y(e,t,n,r,i){return i||V(e,0,n,8),_(e,t,n,r,52,8),n+8}I.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),I.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=I.prototype;else{var i=t-e;n=new I(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},I.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},I.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},I.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},I.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},I.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},I.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},I.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},I.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},I.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},I.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},I.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},I.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},I.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},I.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},I.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),S(this,e,!0,23,4)},I.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),S(this,e,!1,23,4)},I.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),S(this,e,!0,52,8)},I.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),S(this,e,!1,52,8)},I.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||z(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},I.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||z(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},I.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,1,255,0),I.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},I.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,2,65535,0),I.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},I.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,2,65535,0),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},I.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,4,4294967295,0),I.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):W(this,e,t,!0),t+4},I.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,4,4294967295,0),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):W(this,e,t,!1),t+4},I.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);z(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},I.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);z(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},I.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,1,127,-128),I.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},I.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,2,32767,-32768),I.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):q(this,e,t,!0),t+2},I.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,2,32767,-32768),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):q(this,e,t,!1),t+2},I.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,4,2147483647,-2147483648),I.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):W(this,e,t,!0),t+4},I.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),I.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):W(this,e,t,!1),t+4},I.prototype.writeFloatLE=function(e,t,n){return G(this,e,t,!0,n)},I.prototype.writeFloatBE=function(e,t,n){return G(this,e,t,!1,n)},I.prototype.writeDoubleLE=function(e,t,n){return Y(this,e,t,!0,n)},I.prototype.writeDoubleBE=function(e,t,n){return Y(this,e,t,!1,n)},I.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("sourceStart out of bounds");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!I.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},I.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i,o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!I.isEncoding(r))throw TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=N(e)?e:J(new I(e,r).toString()),s=a.length;for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};var Z=/[^+\/0-9A-Za-z-_]/g;function J(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319||a+1===r){(t-=3)>
1-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function X(e){return function(e){b||E();var t,n,r,i,o,a,s=e.length;if(s%4>0)throw Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new v(3*s/4-o),r=o>0?s-4:s;var l=0;for(t=0,n=0;t<r;t+=4,n+=3)i=y[e.charCodeAt(t)]<<18|y[e.charCodeAt(t+1)]<<12|y[e.charCodeAt(t+2)]<<6|y[e.charCodeAt(t+3)],a[l++]=i>>16&255,a[l++]=i>>8&255,a[l++]=255&i;return 2===o?(i=y[e.charCodeAt(t)]<<2|y[e.charCodeAt(t+1)]>>4,a[l++]=255&i):1===o&&(i=y[e.charCodeAt(t)]<<10|y[e.charCodeAt(t+1)]<<4|y[e.charCodeAt(t+2)]>>2,a[l++]=i>>8&255,a[l++]=255&i),a}(function(e){var t;if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(Z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Q(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ee(e){return null!=e&&(!!e._isBuffer||et(e)||"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&et(e.slice(0,0)))}function et(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var en=Object.freeze({__proto__:null,Buffer:I,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),I.alloc(+e)},isBuffer:ee,kMaxLength:k}),er="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function eo(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var ea={},es={},el={};function ec(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function ed(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function eu(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function eh(e,...t){if(!eu(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function ef(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("hash must be wrapped by utils.wrapConstructor");ec(e.outputLen),ec(e.blockLen)}function ep(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function eg(e,t){eh(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}
1Object.defineProperty(el,"__esModule",{value:!0}),el.isBytes=eu,el.number=ec,el.bool=ed,el.bytes=eh,el.hash=ef,el.exists=ep,el.output=eg,el.default={number:ec,bool:ed,bytes:eh,hash:ef,exists:ep,output:eg},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u16=e.u8=void 0,e.bytesToHex=r,e.hexToBytes=a,e.hexToNumber=s,e.bytesToNumberBE=function(e){return s(r(e))},e.numberToBytesBE=function(e,t){return a(e.toString(16).padStart(2*t,"0"))},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);let t=Date.now()-i;t>=0&&t<n||(await (0,e.nextTick)(),i+=t)}},e.utf8ToBytes=l,e.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},e.toBytes=function(e){if("string"==typeof e)e=l(e);else{if(!(0,t.isBytes)(e))throw Error("Uint8Array expected, got "+typeof e);e=d(e)}return e},e.concatBytes=function(...e){let n=0;for(let r=0;r<e.length;r++){let i=e[r];(0,t.bytes)(i),n+=i.length}let r=new Uint8Array(n);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r},e.checkOpts=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)},e.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},e.setBigUint64=c,e.u64Lengths=function(t,n){let r=new Uint8Array(16),i=(0,e.createView)(r);return c(i,0,BigInt(n?n.length:0),!0),c(i,8,BigInt(t.length),!0),r},e.isAligned32=function(e){return e.byteOffset%4==0},e.copyBytes=d,e.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)};let t=el;if(e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u16=e=>new Uint16Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/2)),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw Error("Non little-endian hardware is not supported");let n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r(e){(0,t.bytes)(e);let r="";for(let t=0;t<e.length;t++)r+=n[e[t]];return r}let i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function a(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=o(e.charCodeAt(i)),a=o(e.charCodeAt(i+1));if(void 0===n||void 0===a)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);r[t]=16*n+a}return r}function s(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function l(e){if("string"!=typeof e)throw Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function c(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);let i=BigInt(32),o=BigInt(4294967295),a=Number(n>>i&o),s=Number(n&o),l=r?4:0,c=r?0:4;e.setUint32(t+l,a,r),e.setUint32(t+c,s,r)}function d(e){return Uint8Array.from(e)}e.nextTick=async()=>{},e.Hash=class{},e.wrapCipher=(e,t)=>(Object.assign(t,e),t)}(es);var em={},ey={};Object.defineProperty(ey,"__esModule",{value:!0}),ey.AEAD_TAG_LENGTH=ey.XCHACHA20_NONCE_LENGTH=ey.CURVE25519_PUBLIC_KEY_SIZE=ey.ETH_PUBLIC_KEY_SIZE=ey.UNCOMPRESSED_PUBLIC_KEY_SIZE=ey.COMPRESSED_PUBLIC_KEY_SIZE=ey.SECRET_KEY_LENGTH=void 0,ey.SECRET_KEY_LENGTH=32,ey.COMPRESSED_PUBLIC_KEY_SIZE=33,ey.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,ey.ETH_PUBLIC_KEY_SIZE=64,ey.CURVE25519_PUBLIC_KEY_SIZE=32,ey.XCHACHA20_NONCE_LENGTH=24,ey.AEAD_TAG_LENGTH=16,Object.defineProperty(em,"__esModule",{value:!0}),em.ephemeralKeySize=em.symmetricNonceLength=em.symmetricAlgorithm=em.isHkdfKeyCompressed=em.isEphemeralKeyCompressed=em.ellipticCurve=em.ECIES_CONFIG=void 0,em.ECIES_CONFIG=new function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16},em.ellipticCurve=function(){return em.ECIES_CONFIG.ellipticCurve},em.isEphemeralKeyCompressed=function(){return em.ECIES_CONFIG.isEphemeralKeyCompressed},em.isHkdfKeyCompressed=function(){return em.ECIES_CONFIG.isHkdfKeyCompressed},em.symmetricAlgorithm=function(){return em.ECIES_CONFIG.symmetricAlgorithm},em.symmetricNonceLength=function(){return em.ECIES_CONFIG.symmetricNonceLength},em.ephemeralKeySize=function(){var e={secp256k1:em.ECIES_CONFIG.isEphemeralKeyCompressed?ey.COMPRESSED_PUBLIC_KEY_SIZE:ey.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:ey.CURVE25519_PUBLIC_KEY_SIZE,ed25519:ey.CURVE25519_PUBLIC_KEY_SIZE};if(em.ECIES_CONFIG.ellipticCurve in e)return e[em.ECIES_CONFIG.ellipticCurve];throw Error("Not implemented")};var ev={},eb={},eE={},ew={},eS={},e_={};
1Object.defineProperty(e_,"__esModule",{value:!0}),e_.crypto=void 0,e_.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=r,e.getWebcryptoSubtle=i,e.managedNonce=function(e){return(0,t.number)(e.nonceLength),(t,...i)=>({encrypt(o,...a){let{nonceLength:s}=e,l=r(s),c=e(t,l,...i).encrypt(o,...a),d=(0,n.concatBytes)(l,c);return c.fill(0),d},decrypt(n,...r){let{nonceLength:o}=e,a=n.subarray(0,o),s=n.subarray(o);return e(t,a,...i).decrypt(s,...r)}})};let t=el,n=es;function r(e=32){if(e_.crypto&&"function"==typeof e_.crypto.getRandomValues)return e_.crypto.getRandomValues(new Uint8Array(e));if(e_.crypto&&"function"==typeof e_.crypto.randomBytes)return e_.crypto.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}function i(){if(e_.crypto&&"object"==typeof e_.crypto.subtle&&null!=e_.crypto.subtle)return e_.crypto.subtle;throw Error("crypto.subtle must be defined")}e.utils={async encrypt(e,t,n,r){let o=i(),a=await o.importKey("raw",e,t,!0,["encrypt"]);return new Uint8Array(await o.encrypt(n,a,r))},async decrypt(e,t,n,r){let o=i(),a=await o.importKey("raw",e,t,!0,["decrypt"]);return new Uint8Array(await o.decrypt(n,a,r))}};let o={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function a(n){return(r,i,a)=>{(0,t.bytes)(r),(0,t.bytes)(i);let s={name:n,length:8*r.length},l=function(e,t,n){if(e===o.CBC)return{name:o.CBC,iv:t};if(e===o.CTR)return{name:o.CTR,counter:t,length:64};if(e===o.GCM)return n?{name:o.GCM,iv:t,additionalData:n}:{name:o.GCM,iv:t};throw Error("unknown aes block mode")}(n,i,a);return{encrypt:n=>((0,t.bytes)(n),e.utils.encrypt(r,s,l,n)),decrypt:n=>((0,t.bytes)(n),e.utils.decrypt(r,s,l,n))}}}e.cbc=a(o.CBC),e.ctr=a(o.CTR),e.gcm=a(o.GCM)}(eS);var eC={},ex={},ek={},eM={};function eA(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, not ${e}`)}function eI(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function eR(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function eP(e,...t){if(!eR(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function eT(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");eA(e.outputLen),eA(e.blockLen)}function eO(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function eL(e,t){eP(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(eM,"__esModule",{value:!0}),eM.isBytes=eR,eM.number=eA,eM.bool=eI,eM.bytes=eP,eM.hash=eT,eM.exists=eO,eM.output=eL,eM.default={number:eA,bool:eI,bytes:eP,hash:eT,exists:eO,output:eL};var eN={},e$={};Object.defineProperty(e$,"__esModule",{value:!0}),e$.crypto=void 0,e$.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},e.byteSwap32=function(t){for(let n=0;n<t.length;n++)t[n]=(0,e.byteSwap)(t[n])},e.bytesToHex=function(e){(0,n.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=r[e[n]];return t},e.hexToBytes=function(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=o(e.charCodeAt(i)),a=o(e.charCodeAt(i+1));if(void 0===n||void 0===a)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);r[t]=16*n+a}return r},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);let t=Date.now()-i;t>=0&&t<n||(await (0,e.nextTick)(),i+=t)}},e.utf8ToBytes=a,e.toBytes=s,e.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];(0,n.bytes)(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r},e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==l.call(t))throw Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){let t=t=>e().update(s(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(s(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){let t=(t,n)=>e(n).update(s(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw Error("crypto.getRandomValues must be defined")};let t=e$,n=eM;e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>
1new DataView(e.buffer,e.byteOffset,e.byteLength),e.rotr=(e,t)=>e<<32-t|e>>>t,e.rotl=(e,t)=>e<<t|e>>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t);let r=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function a(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function s(e){return"string"==typeof e&&(e=a(e)),(0,n.bytes)(e),e}e.nextTick=async()=>{},e.Hash=class{clone(){return this._cloneInto()}};let l={}.toString}(eN),Object.defineProperty(ek,"__esModule",{value:!0}),ek.HashMD=ek.Maj=ek.Chi=void 0;let eD=eN;ek.Chi=(e,t,n)=>e&t^~e&n,ek.Maj=(e,t,n)=>e&t^e&n^t&n,ek.HashMD=class extends eD.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,eD.createView)(this.buffer)}update(e){(0,eM.exists)(this);let{view:t,buffer:n,blockLen:r}=this,i=(e=(0,eD.toBytes)(e)).length;for(let o=0;o<i;){let a=Math.min(r-this.pos,i-o);if(a!==r)n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0);else{let t=(0,eD.createView)(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,eM.exists)(this),(0,eM.output)(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let e=o;e<r;e++)t[e]=0;(function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);let i=BigInt(32),o=BigInt(4294967295),a=Number(n>>i&o),s=Number(n&o),l=r?4:0,c=r?0:4;e.setUint32(t+l,a,r),e.setUint32(t+c,s,r)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);let a=(0,eD.createView)(e),s=this.outputLen;if(s%4)throw Error("_sha2: outputLen should be aligned to 32bit");let l=s/4,c=this.get();if(l>c.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)a.setUint32(4*e,c[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}};var eB={};Object.defineProperty(eB,"__esModule",{value:!0}),eB.add5L=eB.add5H=eB.add4H=eB.add4L=eB.add3H=eB.add3L=eB.rotlBL=eB.rotlBH=eB.rotlSL=eB.rotlSH=eB.rotr32L=eB.rotr32H=eB.rotrBL=eB.rotrBH=eB.rotrSL=eB.rotrSH=eB.shrSL=eB.shrSH=eB.toBig=void 0,eB.fromBig=ej,eB.split=eH,eB.add=e2;let eK=BigInt(4294967296-1),eU=BigInt(32);function ej(e,t=!1){return t?{h:Number(e&eK),l:Number(e>>eU&eK)}:{h:0|Number(e>>eU&eK),l:0|Number(e&eK)}}
1function eH(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:o,l:a}=ej(e[i],t);[n[i],r[i]]=[o,a]}return[n,r]}let eF=(e,t)=>BigInt(e>>>0)<<eU|BigInt(t>>>0);eB.toBig=eF;let ez=(e,t,n)=>e>>>n;eB.shrSH=ez;let eq=(e,t,n)=>e<<32-n|t>>>n;eB.shrSL=eq;let eW=(e,t,n)=>e>>>n|t<<32-n;eB.rotrSH=eW;let eV=(e,t,n)=>e<<32-n|t>>>n;eB.rotrSL=eV;let eG=(e,t,n)=>e<<64-n|t>>>n-32;eB.rotrBH=eG;let eY=(e,t,n)=>e>>>n-32|t<<64-n;eB.rotrBL=eY;let eZ=(e,t)=>t;eB.rotr32H=eZ;let eJ=(e,t)=>e;eB.rotr32L=eJ;let eX=(e,t,n)=>e<<n|t>>>32-n;eB.rotlSH=eX;let eQ=(e,t,n)=>t<<n|e>>>32-n;eB.rotlSL=eQ;let e0=(e,t,n)=>t<<n-32|e>>>64-n;eB.rotlBH=e0;let e1=(e,t,n)=>e<<n-32|t>>>64-n;function e2(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/4294967296|0)|0,l:0|i}}eB.rotlBL=e1;let e3=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);eB.add3L=e3;let e5=(e,t,n,r)=>t+n+r+(e/4294967296|0)|0;eB.add3H=e5;let e8=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);eB.add4L=e8;let e6=(e,t,n,r,i)=>t+n+r+i+(e/4294967296|0)|0;eB.add4H=e6;let e4=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);eB.add5L=e4;let e9=(e,t,n,r,i,o)=>t+n+r+i+o+(e/4294967296|0)|0;eB.add5H=e9,eB.default={fromBig:ej,split:eH,toBig:eF,shrSH:ez,shrSL:eq,rotrSH:eW,rotrSL:eV,rotrBH:eG,rotrBL:eY,rotr32H:eZ,rotr32L:eJ,rotlSH:eX,rotlSL:eQ,rotlBH:e0,rotlBL:e1,add:e2,add3L:e3,add3H:e5,add4L:e8,add4H:e6,add5H:e9,add5L:e4},Object.defineProperty(ex,"__esModule",{value:!0}),ex.sha384=ex.sha512_256=ex.sha512_224=ex.sha512=ex.SHA384=ex.SHA512_256=ex.SHA512_224=ex.SHA512=void 0;let e7=ek,[te,tt]=eB.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),tn=new Uint32Array(80),tr=new Uint32Array(80);class ti extends e7.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:a,Dl:s,Eh:l,El:c,Fh:d,Fl:u,Gh:h,Gl:f,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,a,s,l,c,d,u,h,f,p,g]}set(e,t,n,r,i,o,a,s,l,c,d,u,h,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|l,this.El=0|c,this.Fh=0|d,this.Fl=0|u,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let n=0;n<16;n++,t+=4)tn[n]=e.getUint32(t),tr[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|tn[e-15],n=0|tr[e-15],r=eB.default.rotrSH(t,n,1)^eB.default.rotrSH(t,n,8)^eB.default.shrSH(t,n,7),i=eB.default.rotrSL(t,n,1)^eB.default.rotrSL(t,n,8)^eB.default.shrSL(t,n,7),o=0|tn[e-2],a=0|tr[e-2],s=eB.default.rotrSH(o,a,19)^eB.default.rotrBH(o,a,61)^eB.default.shrSH(o,a,6),l=eB.default.rotrSL(o,a,19)^eB.default.rotrBL(o,a,61)^eB.default.shrSL(o,a,6),c=eB.default.add4L(i,l,tr[e-7],tr[e-16]),d=eB.default.add4H(c,r,s,tn[e-7],tn[e-16]);tn[e]=0|d,tr[e]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:a,Cl:s,Dh:l,Dl:c,Eh:d,El:u,Fh:h,Fl:f,Gh:p,Gl:g,Hh:m,Hl:y}=this;for(let e=0;e<80;e++){let t=eB.default.rotrSH(d,u,14)^eB.default.rotrSH(d,u,18)^eB.default.rotrBH(d,u,41),v=eB.default.rotrSL(d,u,14)^eB.default.rotrSL(d,u,18)^eB.default.rotrBL(d,u,41),b=d&h^~d&p,E=u&f^~u&g,w=eB.default.add5L(y,v,E,tt[e],tr[e]),S=eB.default.add5H(w,m,t,b,te[e],tn[e]),_=0|w,C=eB.default.rotrSH(n,r,28)^eB.default.rotrBH(n,r,34)^eB.default.rotrBH(n,r,39),x=eB.default.rotrSL(n,r,28)^eB.default.rotrBL(n,r,34)^eB.default.rotrBL(n,r,39),k=n&i^n&a^i&a,M=r&o^r&s^o&s;m=0|p,y=0|g,p=0|h,g=0|f,h=0|d,f=0|u,({h:d,l:u}=eB.default.add(0|l,0|c,0|S,0|_)),l=0|a,c=0|s,a=0|i,s=0|o,i=0|n,o=0|r;let A=eB.default.add3L(_,x,M);n=eB.default.add3H(A,S,C,k),r=0|A}({h:n,l:r}=eB.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=eB.default.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=eB.default.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:l,l:c}=eB.default.add(0|this.Dh,0|this.Dl,0|l,0|c)),({h:d,l:u}=eB.default.add(0|this.Eh,0|this.El,0|d,0|u)),({h:h,l:f}=eB.default.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:g}=eB.default.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:y}=eB.default.add(0|this.Hh,0|this.Hl,0|m,0|y)),this.set(n,r,i,o,a,s,l,c,d,u,h,f,p,g,m,y)}roundClean(){tn.fill(0),tr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}ex.SHA512=ti;class to extends ti{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}ex.SHA512_224=to;class ta extends ti{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}ex.SHA512_256=ta;class ts extends ti{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}ex.SHA384=ts,ex.sha512=(0,eN.wrapConstructor)(()=>new ti),ex.sha512_224=(0,eN.wrapConstructor)(()=>new to),ex.sha512_256=(0,eN.wrapConstructor)(()=>new ta),ex.sha384=(0,eN.wrapConstructor)(()=>new ts);var tl={},tc={},td={},tu={};
1Object.defineProperty(tu,"__esModule",{value:!0}),tu.notImplemented=tu.bitMask=void 0,tu.isBytes=tg,tu.abytes=tm,tu.abool=function(e,t){if("boolean"!=typeof t)throw Error(`${e} must be valid boolean, got "${t}".`)},tu.bytesToHex=tv,tu.numberToHexUnpadded=tb,tu.hexToNumber=tE,tu.hexToBytes=t_,tu.bytesToNumberBE=function(e){return tE(tv(e))},tu.bytesToNumberLE=function(e){return tm(e),tE(tv(Uint8Array.from(e).reverse()))},tu.numberToBytesBE=tC,tu.numberToBytesLE=function(e,t){return tC(e,t).reverse()},tu.numberToVarBytesBE=function(e){return t_(tb(e))},tu.ensureBytes=function(e,t,n){let r;if("string"==typeof t)try{r=t_(t)}catch(n){throw Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else{if(!tg(t))throw Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}let i=r.length;if("number"==typeof n&&i!==n)throw Error(`${e} expected ${n} bytes, got ${i}`);return r},tu.concatBytes=tx,tu.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},tu.utf8ToBytes=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},tu.inRange=tM,tu.aInRange=function(e,t,n,r){if(!tM(t,n,r))throw Error(`expected valid ${e}: ${n} <= n < ${r}, got ${typeof t} ${t}`)},tu.bitLen=function(e){let t;for(t=0;e>th;e>>=tf,t+=1);return t},tu.bitGet=function(e,t){return e>>BigInt(t)&tf},tu.bitSet=function(e,t,n){return e|(n?tf:th)<<BigInt(t)},tu.createHmacDrbg=function(e,t,n){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof n)throw Error("hmacFn must be a function");let r=tA(e),i=tA(e),o=0,a=()=>{r.fill(1),i.fill(0),o=0},s=(...e)=>n(i,r,...e),l=(e=tA())=>{i=s(tI([0]),e),r=s(),0!==e.length&&(i=s(tI([1]),e),r=s())},c=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let e=0,n=[];for(;e<t;){let t=(r=s()).slice();n.push(t),e+=r.length}return tx(...n)};return(e,t)=>{let n;for(a(),l(e);!(n=t(c()));)l();return a(),n}},tu.validateObject=function(e,t,n={}){let r=(t,n,r)=>{let i=tR[n];if("function"!=typeof i)throw Error(`Invalid validator "${n}", expected function`);let o=e[t];if(!(r&&void 0===o||i(o,e)))throw Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e},tu.memoized=function(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(void 0!==i)return i;let o=e(n,...r);return t.set(n,o),o}};let th=BigInt(0),tf=BigInt(1),tp=BigInt(2);function tg(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function tm(e){if(!tg(e))throw Error("Uint8Array expected")}let ty=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tv(e){tm(e);let t="";for(let n=0;n<e.length;n++)t+=ty[e[n]];return t}function tb(e){let t=e.toString(16);return 1&t.length?`0${t}`:t}function tE(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}let tw={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function tS(e){return e>=tw._0&&e<=tw._9?e-tw._0:e>=tw._A&&e<=tw._F?e-(tw._A-10):e>=tw._a&&e<=tw._f?e-(tw._a-10):void 0}function t_(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=tS(e.charCodeAt(i)),o=tS(e.charCodeAt(i+1));if(void 0===n||void 0===o)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);r[t]=16*n+o}return r}function tC(e,t){return t_(e.toString(16).padStart(2*t,"0"))}function tx(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];tm(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}let tk=e=>"bigint"==typeof e&&th<=e;function tM(e,t,n){return tk(e)&&tk(t)&&tk(n)&&t<=e&&e<n}tu.bitMask=e=>(tp<<BigInt(e-1))-tf;let tA=e=>new Uint8Array(e),tI=e=>Uint8Array.from(e),tR={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||tg(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};tu.notImplemented=()=>{throw Error("not implemented")},Object.defineProperty(td,"__esModule",{value:!0}),td.isNegativeLE=void 0,td.mod=tK,td.pow=tU,td.pow2=function(e,t,n){let r=e;for(;t-- >tT;)r*=r,r%=n;return r},td.invert=tj,td.tonelliShanks=tH,td.FpSqrt=tF,td.validateField=function(e){let t=tz.reduce((e,t)=>
1(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,tP.validateObject)(e,t)},td.FpPow=tq,td.FpInvertBatch=tW,td.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?tj(n,e.ORDER):e.inv(n))},td.FpLegendre=tV,td.FpIsSquare=function(e){let t=tV(e.ORDER);return n=>{let r=t(e,n);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},td.nLength=tG,td.Field=function(e,t,n=!1,r={}){if(e<=tT)throw Error(`Expected Field ORDER > 0, got ${e}`);let{nBitLength:i,nByteLength:o}=tG(e,t);if(o>2048)throw Error("Field lengths over 2048 bytes are not supported");let a=tF(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(0,tP.bitMask)(i),ZERO:tT,ONE:tO,create:t=>tK(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("Invalid field element: expected bigint, got "+typeof t);return tT<=t&&t<e},is0:e=>e===tT,isOdd:e=>(e&tO)===tO,neg:t=>tK(-t,e),eql:(e,t)=>e===t,sqr:t=>tK(t*t,e),add:(t,n)=>tK(t+n,e),sub:(t,n)=>tK(t-n,e),mul:(t,n)=>tK(t*n,e),pow:(e,t)=>tq(s,e,t),div:(t,n)=>tK(t*tj(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>tj(t,e),sqrt:r.sqrt||(e=>a(s,e)),invertBatch:e=>tW(s,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,tP.numberToBytesLE)(e,o):(0,tP.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?(0,tP.bytesToNumberLE)(e):(0,tP.bytesToNumberBE)(e)}});return Object.freeze(s)},td.FpSqrtOdd=function(e,t){if(!e.isOdd)throw Error("Field doesn't have isOdd");let n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},td.FpSqrtEven=function(e,t){if(!e.isOdd)throw Error("Field doesn't have isOdd");let n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},td.hashToPrivateScalar=function(e,t,n=!1){let r=(e=(0,tP.ensureBytes)("privateHash",e)).length,i=tG(t).nByteLength+8;if(i<24||r<i||r>1024)throw Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);return tK(n?(0,tP.bytesToNumberLE)(e):(0,tP.bytesToNumberBE)(e),t-tO)+tO},td.getFieldBytesLength=tY,td.getMinHashLength=tZ,td.mapHashToField=function(e,t,n=!1){let r=e.length,i=tY(t),o=tZ(t);if(r<16||r<o||r>1024)throw Error(`expected ${o}-1024 bytes of input, got ${r}`);let a=tK(n?(0,tP.bytesToNumberBE)(e):(0,tP.bytesToNumberLE)(e),t-tO)+tO;return n?(0,tP.numberToBytesLE)(a,i):(0,tP.numberToBytesBE)(a,i)};let tP=tu,tT=BigInt(0),tO=BigInt(1),tL=BigInt(2),tN=BigInt(3),t$=BigInt(4),tD=BigInt(5),tB=BigInt(8);function tK(e,t){let n=e%t;return n>=tT?n:t+n}function tU(e,t,n){if(n<=tT||t<tT)throw Error("Expected power/modulo > 0");if(n===tO)return tT;let r=tO;for(;t>tT;)t&tO&&(r=r*e%n),e=e*e%n,t>>=tO;return r}function tj(e,t){if(e===tT||t<=tT)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=tK(e,t),r=t,i=tT,o=tO;for(;n!==tT;){let e=r%n,t=i-r/n*o;r=n,n=e,i=o,o=t}if(r!==tO)throw Error("invert: does not exist");return tK(i,t)}function tH(e){let t,n,r;let i=(e-tO)/tL;for(t=e-tO,n=0;t%tL===tT;t/=tL,n++);for(r=tL;r<e&&tU(r,i,e)!==e-tO;r++);if(1===n){let t=(e+tO)/t$;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error("Cannot find square root");return r}}let o=(t+tO)/tL;return function(e,a){if(e.pow(a,i)===e.neg(e.ONE))throw Error("Cannot find square root");let s=n,l=e.pow(e.mul(e.ONE,r),t),c=e.pow(a,o),d=e.pow(a,t);for(;!e.eql(d,e.ONE);){if(e.eql(d,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(d);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);let n=e.pow(l,tO<<BigInt(s-t-1));l=e.sqr(n),c=e.mul(c,n),d=e.mul(d,l),s=t}return c}}function tF(e){if(e%t$===tN){let t=(e+tO)/t$;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error("Cannot find square root");return r}}if(e%tB===tD){let t=(e-tD)/tB;return function(e,n){let r=e.mul(n,tL),i=e.pow(r,t),o=e.mul(n,i),a=e.mul(e.mul(o,tL),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),n))throw Error("Cannot find square root");return s}}return tH(e)}BigInt(9),BigInt(16),td.isNegativeLE=(e,t)=>(tK(e,t)&tO)===tO;let tz=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tq(e,t,n){if(n<tT)throw Error("Expected power > 0");if(n===tT)return e.ONE;if(n===tO)return t;let r=e.ONE,i=t;for(;n>tT;)n&tO&&(r=e.mul(r,i)),i=e.sqr(i),n>>=tO;return r}function tW(e,t){let n=Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function tV(e){let t=(e-tO)/tL;return(e,n)=>e.pow(n,t)}function tG(e,t){let n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function tY(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function tZ(e){let t=tY(e);return t+Math.ceil(t/2)}Object.defineProperty(tc,"__esModule",{value:!0}),tc.wNAF=function(e,t){let n=(e,t)=>{let n=t.negate();return e?n:t},r=e=>{if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`Wrong window size=${e}, should be [1..${t}]`)},i=e=>(r(e),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;
1for(;n>tQ;)n&t0&&(r=r.add(i)),i=i.double(),n>>=t0;return r},precomputeWindow(e,t){let{windows:n,windowSize:r}=i(t),o=[],a=e,s=a;for(let e=0;e<n;e++){s=a,o.push(s);for(let e=1;e<r;e++)s=s.add(a),o.push(s);a=s.double()}return o},wNAF(t,r,o){let{windows:a,windowSize:s}=i(t),l=e.ZERO,c=e.BASE,d=BigInt(2**t-1),u=2**t,h=BigInt(t);for(let e=0;e<a;e++){let t=e*s,i=Number(o&d);o>>=h,i>s&&(i-=u,o+=t0);let a=t+Math.abs(i)-1,f=e%2!=0,p=i<0;0===i?c=c.add(n(f,r[t])):l=l.add(n(p,r[a]))}return{p:l,f:c}},wNAFCached(e,t,n){let r=t2.get(e)||1,i=t1.get(e);return i||(i=this.precomputeWindow(e,r),1!==r&&t1.set(e,n(i))),this.wNAF(r,i,t)},setWindowSize(e,t){r(t),t2.set(e,t),t1.delete(e)}}},tc.pippenger=function(e,t,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw Error("arrays of points and scalars must have equal length");r.forEach((e,n)=>{if(!t.isValid(e))throw Error(`wrong scalar at index ${n}`)}),n.forEach((t,n)=>{if(!(t instanceof e))throw Error(`wrong point at index ${n}`)});let i=(0,tX.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,s=Array(a+1).fill(e.ZERO),l=Math.floor((t.BITS-1)/o)*o,c=e.ZERO;for(let t=l;t>=0;t-=o){s.fill(e.ZERO);for(let e=0;e<r.length;e++){let i=Number(r[e]>>BigInt(t)&BigInt(a));s[i]=s[i].add(n[e])}let i=e.ZERO;for(let t=s.length-1,n=e.ZERO;t>0;t--)n=n.add(s[t]),i=i.add(n);if(c=c.add(i),0!==t)for(let e=0;e<o;e++)c=c.double()}return c},tc.validateBasic=function(e){return(0,tJ.validateField)(e.Fp),(0,tX.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,tJ.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})};let tJ=td,tX=tu,tQ=BigInt(0),t0=BigInt(1),t1=new WeakMap,t2=new WeakMap;Object.defineProperty(tl,"__esModule",{value:!0}),tl.twistedEdwards=function(e){let t=function(e){let t=(0,t3.validateBasic)(e);return t8.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:a,nByteLength:s,h:l}=t,c=t7<<BigInt(8*s)-t9,d=n.create,u=(0,t5.Field)(t.n,t.nBitLength),h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(e){return{isValid:!1,value:t4}}}),f=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,n)=>{if((0,t6.abool)("phflag",n),t.length||n)throw Error("Contexts/pre-hash are not supported");return e});function g(e,t){t8.aInRange("coordinate "+e,t,t4,c)}function m(e){if(!(e instanceof b))throw Error("ExtendedPoint expected")}let y=(0,t6.memoized)((e,t)=>{let{ex:r,ey:i,ez:o}=e,a=e.is0();null==t&&(t=a?ne:n.inv(o));let s=d(r*t),l=d(i*t),c=d(o*t);if(a)return{x:t4,y:t9};if(c!==t9)throw Error("invZ was invalid");return{x:s,y:l}}),v=(0,t6.memoized)(e=>{let{a:n,d:r}=t;if(e.is0())throw Error("bad point: ZERO");let{ex:i,ey:o,ez:a,et:s}=e,l=d(i*i),c=d(o*o),u=d(a*a),h=d(u*u),f=d(l*n);if(d(u*d(f+c))!==d(h+d(r*d(l*c))))throw Error("bad point: equation left != right (1)");if(d(i*o)!==d(a*s))throw Error("bad point: equation left != right (2)");return!0});class b{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,g("x",e),g("y",t),g("z",n),g("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof b)throw Error("extended point not allowed");let{x:t,y:n}=e||{};return g("x",t),g("y",n),new b(t,n,t9,d(t*n))}static normalizeZ(e){let t=n.invertBatch(e.map(e=>e.ez));return e.map((e,n)=>e.toAffine(t[n])).map(b.fromAffine)}static msm(e,t){return(0,t3.pippenger)(b,u,e,t)}_setWindowSize(e){S.setWindowSize(this,e)}assertValidity(){v(this)}equals(e){m(e);let{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:a}=e,s=d(t*a),l=d(i*r),c=d(n*a),u=d(o*r);return s===l&&c===u}is0(){return this.equals(b.ZERO)}negate(){return new b(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){let{a:e}=t,{ex:n,ey:r,ez:i}=this,o=d(n*n),a=d(r*r),s=d(t7*d(i*i)),l=d(e*o),c=n+r,u=d(d(c*c)-o-a),h=l+a,f=h-s,p=l-a,g=d(u*f),m=d(h*p),y=d(u*p);return new b(g,m,d(f*h),y)}add(e){m(e);let{a:n,d:r}=t,{ex:i,ey:o,ez:a,et:s}=this,{ex:l,ey:c,ez:u,et:h}=e;if(n===BigInt(-1)){let e=d((o-i)*(c+l)),t=d((o+i)*(c-l)),n=d(t-e);if(n===t4)return this.double();let r=d(a*t7*h),f=d(s*t7*u),p=f+r,g=t+e,m=f-r,y=d(p*n),v=d(g*m),E=d(p*m);return new b(y,v,d(n*g),E)}
1let f=d(i*l),p=d(o*c),g=d(s*r*h),y=d(a*u),v=d((i+o)*(l+c)-f-p),E=y-g,w=y+g,S=d(p-n*f),_=d(v*E),C=d(w*S),x=d(v*S);return new b(_,C,d(E*w),x)}subtract(e){return this.add(e.negate())}wNAF(e){return S.wNAFCached(this,e,b.normalizeZ)}multiply(e){t8.aInRange("scalar",e,t9,r);let{p:t,f:n}=this.wNAF(e);return b.normalizeZ([t,n])[0]}multiplyUnsafe(e){return t8.aInRange("scalar",e,t4,r),e===t4?w:this.equals(w)||e===t9?this:this.equals(E)?this.wNAF(e).p:S.unsafeLadder(this,e)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return S.unsafeLadder(this,r).is0()}toAffine(e){return y(this,e)}clearCofactor(){let{h:e}=t;return e===t9?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){let{d:i,a:o}=t,a=n.BYTES;e=(0,t6.ensureBytes)("pointHex",e,a),(0,t6.abool)("zip215",r);let s=e.slice(),l=e[a-1];s[a-1]=-129&l;let u=t8.bytesToNumberLE(s),f=r?c:n.ORDER;t8.aInRange("pointHex.y",u,t4,f);let p=d(u*u),{isValid:g,value:m}=h(d(p-t9),d(i*p-o));if(!g)throw Error("Point.fromHex: invalid y coordinate");let y=(m&t9)===t9,v=0!=(128&l);if(!r&&m===t4&&v)throw Error("Point.fromHex: x=0 and x_0=1");return v!==y&&(m=d(-m)),b.fromAffine({x:m,y:u})}static fromPrivateKey(e){return x(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=t8.numberToBytesLE(t,n.BYTES);return r[r.length-1]|=e&t9?128:0,r}toHex(){return t8.bytesToHex(this.toRawBytes())}}b.BASE=new b(t.Gx,t.Gy,t9,d(t.Gx*t.Gy)),b.ZERO=new b(t4,t9,t9,t4);let{BASE:E,ZERO:w}=b,S=(0,t3.wNAF)(b,8*s);function _(e){return(0,t5.mod)(e,r)}function C(e){return _(t8.bytesToNumberLE(e))}function x(e){e=(0,t6.ensureBytes)("private key",e,s);let t=(0,t6.ensureBytes)("hashed private key",o(e),2*s),n=f(t.slice(0,s)),r=t.slice(s,2*s),i=C(n),a=E.multiply(i),l=a.toRawBytes();return{head:n,prefix:r,scalar:i,point:a,pointBytes:l}}function k(e=new Uint8Array,...t){return C(o(p(t8.concatBytes(...t),(0,t6.ensureBytes)("context",e),!!i)))}return E._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return x(e).pointBytes},sign:function(e,t,o={}){e=(0,t6.ensureBytes)("message",e),i&&(e=i(e));let{prefix:a,scalar:l,pointBytes:c}=x(t),d=k(o.context,a,e),u=E.multiply(d).toRawBytes(),h=_(d+k(o.context,u,c,e)*l);t8.aInRange("signature.s",h,t4,r);let f=t8.concatBytes(u,t8.numberToBytesLE(h,n.BYTES));return(0,t6.ensureBytes)("result",f,2*s)},verify:function(e,t,r,o=nt){let a,s,l;let{context:c,zip215:d}=o,u=n.BYTES;e=(0,t6.ensureBytes)("signature",e,2*u),t=(0,t6.ensureBytes)("message",t),void 0!==d&&(0,t6.abool)("zip215",d),i&&(t=i(t));let h=t8.bytesToNumberLE(e.slice(u,2*u));try{a=b.fromHex(r,d),s=b.fromHex(e.slice(0,u),d),l=E.multiplyUnsafe(h)}catch(e){return!1}if(!d&&a.isSmallOrder())return!1;let f=k(c,s.toRawBytes(),a.toRawBytes(),t);return s.add(a.multiplyUnsafe(f)).subtract(l).clearCofactor().equals(b.ZERO)},ExtendedPoint:b,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>a(n.BYTES),precompute:(e=8,t=b.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}};let t3=tc,t5=td,t8=tu,t6=tu,t4=BigInt(0),t9=BigInt(1),t7=BigInt(2),ne=BigInt(8),nt={zip215:!0};var nn={};Object.defineProperty(nn,"__esModule",{value:!0}),nn.expand_message_xmd=na,nn.expand_message_xof=ns,nn.hash_to_field=nl,nn.isogenyMap=function(e,t){let n=t.map(e=>Array.from(e).reverse());return(t,r)=>{let[i,o,a,s]=n.map(n=>n.reduce((n,r)=>e.add(e.mul(n,t),r)));return t=e.div(i,o),r=e.mul(r,e.div(a,s)),{x:t,y:r}}},nn.createHasher=function(e,t,n){if("function"!=typeof t)throw Error("mapToCurve() must be defined");return{hashToCurve(r,i){let o=nl(r,2,{...n,DST:n.DST,...i}),a=e.fromAffine(t(o[0])),s=e.fromAffine(t(o[1])),l=a.add(s).clearCofactor();return l.assertValidity(),l},encodeToCurve(r,i){let o=nl(r,1,{...n,DST:n.encodeDST,...i}),a=e.fromAffine(t(o[0])).clearCofactor();return a.assertValidity(),a},mapToCurve(n){if(!Array.isArray(n))throw Error("mapToCurve: expected array of bigints");for(let e of n)if("bigint"!=typeof e)throw Error(`mapToCurve: expected array of bigints, got ${e} in array`);let r=e.fromAffine(t(n)).clearCofactor();return r.assertValidity(),r}}};let nr=tu.bytesToNumberBE;function ni(e,t){if(no(e),no(t),e<0||e>=1<<8*t)throw Error(`bad I2OSP call: value=${e} length=${t}`);let n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=255&e,e>>>=8;return new Uint8Array(n)}function no(e){if(!Number.isSafeInteger(e))throw Error("number expected")}function na(e,t,n,r){(0,tu.abytes)(e),(0,tu.abytes)(t),no(n),t.length>255&&(t=r((0,tu.concatBytes)((0,tu.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));let{outputLen:i,blockLen:o}=r,a=Math.ceil(n/i);if(n>65535||a>
1255)throw Error("expand_message_xmd: invalid lenInBytes");let s=(0,tu.concatBytes)(t,ni(t.length,1)),l=ni(0,o),c=ni(n,2),d=Array(a),u=r((0,tu.concatBytes)(l,e,c,ni(0,1),s));d[0]=r((0,tu.concatBytes)(u,ni(1,1),s));for(let e=1;e<=a;e++){let t=[function(e,t){let n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}(u,d[e-1]),ni(e+1,1),s];d[e]=r((0,tu.concatBytes)(...t))}return(0,tu.concatBytes)(...d).slice(0,n)}function ns(e,t,n,r,i){if((0,tu.abytes)(e),(0,tu.abytes)(t),no(n),t.length>255&&(t=i.create({dkLen:Math.ceil(2*r/8)}).update((0,tu.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()),n>65535||t.length>255)throw Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(e).update(ni(n,2)).update(t).update(ni(t.length,1)).digest()}function nl(e,t,n){let r;(0,tu.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:i,k:o,m:a,hash:s,expand:l,DST:c}=n;(0,tu.abytes)(e),no(t);let d="string"==typeof c?(0,tu.utf8ToBytes)(c):c,u=Math.ceil((i.toString(2).length+o)/8),h=t*a*u;if("xmd"===l)r=na(e,d,h,s);else if("xof"===l)r=ns(e,d,h,o,s);else{if("_internal_pass"!==l)throw Error('expand must be "xmd" or "xof"');r=e}let f=Array(t);for(let e=0;e<t;e++){let t=Array(a);for(let n=0;n<a;n++){let o=u*(n+e*a),s=r.subarray(o,o+u);t[n]=(0,td.mod)(nr(s),i)}f[e]=t}return f}var nc={};Object.defineProperty(nc,"__esModule",{value:!0}),nc.montgomery=function(e){let t=((0,nu.validateObject)(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:n}=t,r=e=>(0,nd.mod)(e,n),i=t.montgomeryBits,o=Math.ceil(i/8),a=t.nByteLength,s=t.adjustScalarBytes||(e=>e),l=t.powPminus2||(e=>(0,nd.pow)(e,n-BigInt(2),n));function c(e,t,n){let i=r(e*(t-n));return[t=r(t-i),n=r(n+i)]}let d=(t.a-BigInt(2))/BigInt(4);function u(e){return(0,nu.numberToBytesLE)(r(e),o)}function h(e,t){let h=function(e,t){(0,nu.aInRange)("u",e,nh,n),(0,nu.aInRange)("scalar",t,nh,n);let o,a=nf,s=nh,u=e,h=nf,f=nh;for(let n=BigInt(i-1);n>=nh;n--){let i=t>>n&nf;f^=i,a=(o=c(f,a,u))[0],u=o[1],s=(o=c(f,s,h))[0],h=o[1],f=i;let l=a+s,p=r(l*l),g=a-s,m=r(g*g),y=p-m,v=u+h,b=r((u-h)*l),E=r(v*g),w=b+E,S=b-E;u=r(w*w),h=r(e*r(S*S)),a=r(p*m),s=r(y*(p+r(d*y)))}return a=(o=c(f,a,u))[0],u=o[1],s=(o=c(f,s,h))[0],h=o[1],r(a*l(s))}(function(e){let t=(0,nu.ensureBytes)("u coordinate",e,o);return 32===a&&(t[31]&=127),(0,nu.bytesToNumberLE)(t)}(t),function(e){let t=(0,nu.ensureBytes)("scalar",e),n=t.length;if(n!==o&&n!==a)throw Error(`Expected ${o} or ${a} bytes, got ${n}`);return(0,nu.bytesToNumberLE)(s(t))}(e));if(h===nh)throw Error("Invalid private or public key received");return u(h)}let f=u(t.Gu);function p(e){return h(e,f)}return{scalarMult:h,scalarMultBase:p,getSharedSecret:(e,t)=>h(e,t),getPublicKey:e=>p(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:f}};let nd=td,nu=tu,nh=BigInt(0),nf=BigInt(1);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=g,e.edwardsToMontgomeryPriv=function(e){let t=f.hash(e.subarray(0,32));return f.adjustScalarBytes(t).subarray(0,32)};let t=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),n=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),r=BigInt(0),i=BigInt(1),o=BigInt(2),a=BigInt(3),s=BigInt(5),l=BigInt(8);function c(e){let n=BigInt(10),r=BigInt(20),a=BigInt(40),l=BigInt(80),c=e*e%t*e%t,d=(0,td.pow2)(c,o,t)*c%t,u=(0,td.pow2)(d,i,t)*e%t,h=(0,td.pow2)(u,s,t)*u%t,f=(0,td.pow2)(h,n,t)*h%t,p=(0,td.pow2)(f,r,t)*f%t,g=(0,td.pow2)(p,a,t)*p%t,m=(0,td.pow2)(g,l,t)*g%t,y=(0,td.pow2)(m,l,t)*g%t,v=(0,td.pow2)(y,n,t)*h%t;return{pow_p_5_8:(0,td.pow2)(v,o,t)*e%t,b2:c}}function d(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function u(e,r){let i=(0,td.mod)(r*r*r,t),o=c(e*(0,td.mod)(i*i*r,t)).pow_p_5_8,a=(0,td.mod)(e*i*o,t),s=(0,td.mod)(r*a*a,t),l=a,d=(0,td.mod)(a*n,t),u=s===e,h=s===(0,td.mod)(-e,t),f=s===(0,td.mod)(-e*n,t);return u&&(a=l),(h||f)&&(a=d),(0,td.isNegativeLE)(a,t)&&(a=(0,td.mod)(-a,t)),{isValid:u||h,value:a}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];let h=(0,td.Field)(t,void 0,!0),f={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:h,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:l,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ex.sha512,randomBytes:eN.randomBytes,adjustScalarBytes:d,uvRatio:u};function p(e,t,n){if(t.length>255)throw Error("Context is too big");return(0,eN.concatBytes)((0,eN.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([n?1:0,t.length]),t,e)}function g(t){let{y:n}=e.ed25519.ExtendedPoint.fromHex(t),r=BigInt(1);return h.toBytes(h.create((r+n)*h.inv(r-n)))}e.ed25519=(0,tl.twistedEdwards)(f),e.ed25519ctx=(0,tl.twistedEdwards)({...f,domain:p}),e.ed25519ph=(0,tl.twistedEdwards)(Object.assign({},f,{domain:p,prehash:ex.sha512})),e.x25519=(0,nc.montgomery)({P:t,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>
1{let{pow_p_5_8:n,b2:r}=c(e);return(0,td.mod)((0,td.pow2)(n,a,t)*r,t)},adjustScalarBytes:d,randomBytes:eN.randomBytes}),e.edwardsToMontgomery=g;let m=(h.ORDER+a)/l,y=h.pow(o,m),v=h.sqrt(h.neg(h.ONE)),b=(0,td.FpSqrtEven)(h,h.neg(BigInt(486664))),E=(0,nn.createHasher)(e.ed25519.ExtendedPoint,e=>(function(e){let{xMn:t,xMd:n,yMn:r,yMd:a}=function(e){let t=(h.ORDER-s)/l,n=BigInt(486662),r=h.sqr(e);r=h.mul(r,o);let a=h.add(r,h.ONE),c=h.neg(n),d=h.sqr(a),u=h.mul(d,a),f=h.mul(r,n);f=h.mul(f,c),f=h.add(f,d),f=h.mul(f,c);let p=h.sqr(u);d=h.sqr(p),p=h.mul(p,u),p=h.mul(p,f),d=h.mul(d,p);let g=h.pow(d,t);g=h.mul(g,p);let m=h.mul(g,v);d=h.sqr(g),d=h.mul(d,u);let b=h.eql(d,f),E=h.cmov(m,g,b),w=h.mul(c,r),S=h.mul(g,e);S=h.mul(S,y);let _=h.mul(S,v),C=h.mul(f,r);d=h.sqr(S),d=h.mul(d,u);let x=h.eql(d,C),k=h.cmov(_,S,x);d=h.sqr(E),d=h.mul(d,u);let M=h.eql(d,f),A=h.cmov(w,c,M),I=h.cmov(k,E,M),R=h.isOdd(I);return{xMn:A,xMd:a,yMn:I=h.cmov(I,h.neg(I),M!==R),yMd:i}}(e),c=h.mul(t,a);c=h.mul(c,b);let d=h.mul(n,r),u=h.sub(t,n),f=h.add(t,n),p=h.mul(d,f),g=h.eql(p,h.ZERO);c=h.cmov(c,h.ZERO,g),d=h.cmov(d,h.ONE,g),u=h.cmov(u,h.ONE,g),f=h.cmov(f,h.ONE,g);let m=h.invertBatch([d,f]);return{x:h.mul(c,m[0]),y:h.mul(u,m[1])}})(e[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:h.ORDER,m:1,k:128,expand:"xmd",hash:ex.sha512});function w(e){if(!(e instanceof R))throw Error("RistrettoPoint expected")}e.hashToCurve=E.hashToCurve,e.encodeToCurve=E.encodeToCurve;let S=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),_=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),C=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),x=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),k=e=>u(i,e),M=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),A=t=>e.ed25519.CURVE.Fp.create((0,tu.bytesToNumberLE)(t)&M);function I(t){let{d:r}=e.ed25519.CURVE,o=e.ed25519.CURVE.Fp.ORDER,a=e.ed25519.CURVE.Fp.create,s=a(n*t*t),l=a((s+i)*C),c=BigInt(-1),d=a((c-r*s)*a(s+r)),{isValid:h,value:f}=u(l,d),p=a(f*t);(0,td.isNegativeLE)(p,o)||(p=a(-p)),h||(f=p),h||(c=s);let g=a(c*(s-i)*x-d),m=f*f,y=a((f+f)*d),v=a(g*S),b=a(i-m),E=a(i+m);return new e.ed25519.ExtendedPoint(a(y*E),a(b*v),a(v*E),a(y*b))}class R{constructor(e){this.ep=e}static fromAffine(t){return new R(e.ed25519.ExtendedPoint.fromAffine(t))}static hashToCurve(e){let t=I(A((e=(0,tu.ensureBytes)("ristrettoHash",e,64)).slice(0,32))),n=I(A(e.slice(32,64)));return new R(t.add(n))}static fromHex(t){t=(0,tu.ensureBytes)("ristrettoHex",t,32);let{a:n,d:o}=e.ed25519.CURVE,a=e.ed25519.CURVE.Fp.ORDER,s=e.ed25519.CURVE.Fp.create,l="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",c=A(t);if(!(0,tu.equalBytes)((0,tu.numberToBytesLE)(c,32),t)||(0,td.isNegativeLE)(c,a))throw Error(l);let d=s(c*c),u=s(i+n*d),h=s(i-n*d),f=s(u*u),p=s(h*h),g=s(n*o*f-p),{isValid:m,value:y}=k(s(g*p)),v=s(y*h),b=s(y*v*g),E=s((c+c)*v);(0,td.isNegativeLE)(E,a)&&(E=s(-E));let w=s(u*b),S=s(E*w);if(!m||(0,td.isNegativeLE)(S,a)||w===r)throw Error(l);return new R(new e.ed25519.ExtendedPoint(E,w,i,S))}toRawBytes(){let t,{ex:r,ey:i,ez:o,et:a}=this.ep,s=e.ed25519.CURVE.Fp.ORDER,l=e.ed25519.CURVE.Fp.create,c=l(l(o+i)*l(o-i)),d=l(r*i),u=l(d*d),{value:h}=k(l(c*u)),f=l(h*c),p=l(h*d),g=l(f*p*a);if((0,td.isNegativeLE)(a*g,s)){let e=l(i*n),o=l(r*n);r=e,i=o,t=l(f*_)}else t=p;(0,td.isNegativeLE)(r*g,s)&&(i=l(-i));let m=l((o-i)*t);return(0,td.isNegativeLE)(m,s)&&(m=l(-m)),(0,tu.numberToBytesLE)(m,32)}toHex(){return(0,tu.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(t){w(t);let{ex:n,ey:r}=this.ep,{ex:i,ey:o}=t.ep,a=e.ed25519.CURVE.Fp.create,s=a(n*o)===a(r*i),l=a(r*o)===a(n*i);return s||l}add(e){return w(e),new R(this.ep.add(e.ep))}subtract(e){return w(e),new R(this.ep.subtract(e.ep))}multiply(e){return new R(this.ep.multiply(e))}multiplyUnsafe(e){return new R(this.ep.multiplyUnsafe(e))}double(){return new R(this.ep.double())}negate(){return new R(this.ep.negate())}}e.RistrettoPoint=(R.BASE||(R.BASE=new R(e.ed25519.ExtendedPoint.BASE)),R.ZERO||(R.ZERO=new R(e.ed25519.ExtendedPoint.ZERO)),R),e.hashToRistretto255=(e,t)=>{let n=t.DST,r="string"==typeof n?(0,eN.utf8ToBytes)(n):n,i=(0,nn.exp
1and_message_xmd)(e,r,64,ex.sha512);return R.hashToCurve(i)},e.hash_to_ristretto255=e.hashToRistretto255}(eC);var np={},ng={};Object.defineProperty(ng,"__esModule",{value:!0}),ng.sha224=ng.sha256=ng.SHA256=void 0;let nm=ek,ny=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]),nv=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),nb=new Uint32Array(64);class nE extends nm.HashMD{constructor(){super(64,32,8,!1),this.A=0|nv[0],this.B=0|nv[1],this.C=0|nv[2],this.D=0|nv[3],this.E=0|nv[4],this.F=0|nv[5],this.G=0|nv[6],this.H=0|nv[7]}get(){let{A:e,B:t,C:n,D:r,E:i,F:o,G:a,H:s}=this;return[e,t,n,r,i,o,a,s]}set(e,t,n,r,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let n=0;n<16;n++,t+=4)nb[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=nb[e-15],n=nb[e-2],r=(0,eN.rotr)(t,7)^(0,eN.rotr)(t,18)^t>>>3,i=(0,eN.rotr)(n,17)^(0,eN.rotr)(n,19)^n>>>10;nb[e]=i+nb[e-7]+r+nb[e-16]|0}let{A:n,B:r,C:i,D:o,E:a,F:s,G:l,H:c}=this;for(let e=0;e<64;e++){let t=c+((0,eN.rotr)(a,6)^(0,eN.rotr)(a,11)^(0,eN.rotr)(a,25))+(0,nm.Chi)(a,s,l)+ny[e]+nb[e]|0,d=((0,eN.rotr)(n,2)^(0,eN.rotr)(n,13)^(0,eN.rotr)(n,22))+(0,nm.Maj)(n,r,i)|0;c=l,l=s,s=a,a=o+t|0,o=i,i=r,r=n,n=t+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,o,a,s,l,c)}roundClean(){nb.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}ng.SHA256=nE;class nw extends nE{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}ng.sha256=(0,eN.wrapConstructor)(()=>new nE),ng.sha224=(0,eN.wrapConstructor)(()=>new nw);var nS={},n_={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;let t=eN;class n extends t.Hash{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,(0,eM.hash)(e);let r=(0,t.toBytes)(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),o.fill(0)}update(e){return(0,eM.exists)(this),this.iHash.update(e),this}digestInto(e){(0,eM.exists)(this),(0,eM.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n,e.hmac=(e,t,r)=>new n(e,t).update(r).digest(),e.hmac.create=(e,t)=>new n(e,t)}(n_);var nC={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=f,e.weierstrass=function(a){let s=function(e){let n=(0,t.validateBasic)(e);return r.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}(a),{Fp:d,n:u}=s,h=d.BYTES+1,p=2*d.BYTES+1;function g(e){return n.mod(e,u)}function m(e){return n.invert(e,u)}let{ProjectivePoint:y,normPrivateKeyToScalar:v,weierstrassEquation:b,isWithinCurveOrder:E}
1=f({...s,toBytes(e,t,n){let o=t.toAffine(),a=d.toBytes(o.x),s=r.concatBytes;return(0,i.abool)("isCompressed",n),n?s(Uint8Array.from([t.hasEvenY()?2:3]),a):s(Uint8Array.from([4]),a,d.toBytes(o.y))},fromBytes(e){let t=e.length,n=e[0],i=e.subarray(1);if(t!==h||2!==n&&3!==n){if(t===p&&4===n)return{x:d.fromBytes(i.subarray(0,d.BYTES)),y:d.fromBytes(i.subarray(d.BYTES,2*d.BYTES))};throw Error(`Point of length ${t} was invalid. Expected ${h} compressed bytes or ${p} uncompressed bytes`)}{let e;let t=r.bytesToNumberBE(i);if(!r.inRange(t,c,d.ORDER))throw Error("Point is not on curve");let o=b(t);try{e=d.sqrt(o)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return 1==(1&n)!=((e&c)===c)&&(e=d.neg(e)),{x:t,y:e}}}}),w=e=>r.bytesToHex(r.numberToBytesBE(e,s.nByteLength)),S=(e,t,n)=>r.bytesToNumberBE(e.slice(t,n));class _{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){let t=s.nByteLength;return new _(S(e=(0,i.ensureBytes)("compactSignature",e,2*t),0,t),S(e,t,2*t))}static fromDER(t){let{r:n,s:r}=e.DER.toSig((0,i.ensureBytes)("DER",t));return new _(n,r)}assertValidity(){r.aInRange("r",this.r,c,u),r.aInRange("s",this.s,c,u)}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){let{r:t,s:n,recovery:r}=this,o=k((0,i.ensureBytes)("msgHash",e));if(null==r||![0,1,2,3].includes(r))throw Error("recovery id invalid");let a=2===r||3===r?t+s.n:t;if(a>=d.ORDER)throw Error("recovery id 2 or 3 invalid");let l=0==(1&r)?"02":"03",c=y.fromHex(l+w(a)),u=m(a),h=g(-o*u),f=g(n*u),p=y.BASE.multiplyAndAddUnsafe(c,h,f);if(!p)throw Error("point at infinify");return p.assertValidity(),p}hasHighS(){return this.s>u>>c}normalizeS(){return this.hasHighS()?new _(this.r,g(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}function C(e){let t=r.isBytes(e),n="string"==typeof e,i=(t||n)&&e.length;return t?i===h||i===p:n?i===2*h||i===2*p:e instanceof y}let x=s.bits2int||function(e){let t=r.bytesToNumberBE(e),n=8*e.length-s.nBitLength;return n>0?t>>BigInt(n):t},k=s.bits2int_modN||function(e){return g(x(e))},M=r.bitMask(s.nBitLength);function A(e){return r.aInRange(`num < 2^${s.nBitLength}`,e,l,M),r.numberToBytesBE(e,s.nByteLength)}let I={lowS:s.lowS,prehash:!1},R={lowS:s.lowS,prehash:!1};return y.BASE._setWindowSize(8),{CURVE:s,getPublicKey:function(e,t=!0){return y.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(C(e))throw Error("first arg must be private key");if(!C(t))throw Error("second arg must be public key");return y.fromHex(t).multiply(v(e)).toRawBytes(n)},sign:function(e,t,n=I){let{seed:a,k2sig:h}=function(e,t,n=I){if(["recovered","canonical"].some(e=>e in n))throw Error("sign() legacy options not supported");let{hash:a,randomBytes:h}=s,{lowS:f,prehash:p,extraEntropy:b}=n;null==f&&(f=!0),e=(0,i.ensureBytes)("msgHash",e),o(n),p&&(e=(0,i.ensureBytes)("prehashed msgHash",a(e)));let w=k(e),S=v(t),C=[A(S),A(w)];if(null!=b&&!1!==b){let e=!0===b?h(d.BYTES):b;C.push((0,i.ensureBytes)("extraEntropy",e))}return{seed:r.concatBytes(...C),k2sig:function(e){let t=x(e);if(!E(t))return;let n=m(t),r=y.BASE.multiply(t).toAffine(),i=g(r.x);if(i===l)return;let o=g(n*g(w+i*S));if(o===l)return;let a=(r.x===i?0:2)|Number(r.y&c),s=o;return f&&o>u>>c&&(s=o>u>>c?g(-o):o,a^=1),new _(i,s,a)}}}(e,t,n);return r.createHmacDrbg(s.hash.outputLen,s.nByteLength,s.hmac)(a,h)},verify:function(t,n,a,l=R){let c,d;if(n=(0,i.ensureBytes)("msgHash",n),a=(0,i.ensureBytes)("publicKey",a),"strict"in l)throw Error("options.strict was renamed to lowS");o(l);let{lowS:u,prehash:h}=l;try{if("string"==typeof t||r.isBytes(t))try{c=_.fromDER(t)}catch(n){if(!(n instanceof e.DER.Err))throw n;c=_.fromCompact(t)}else{if("object"!=typeof t||"bigint"!=typeof t.r||"bigint"!=typeof t.s)throw Error("PARSE");{let{r:e,s:n}=t;c=new _(e,n)}}d=y.fromHex(a)}catch(e){if("PARSE"===e.message)throw Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&c.hasHighS())return!1;h&&(n=s.hash(n));
1let{r:f,s:p}=c,v=k(n),b=m(p),E=g(v*b),w=g(f*b),S=y.BASE.multiplyAndAddUnsafe(d,E,w)?.toAffine();return!!S&&g(S.x)===f},ProjectivePoint:y,Signature:_,utils:{isValidPrivateKey(e){try{return v(e),!0}catch(e){return!1}},normPrivateKeyToScalar:v,randomPrivateKey:()=>{let e=n.getMinHashLength(s.n);return n.mapHashToField(s.randomBytes(e),s.n)},precompute:(e=8,t=y.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}},e.SWUFpSqrtRatio=p,e.mapToCurveSimpleSWU=function(e,t){if(n.validateField(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw Error("mapToCurveSimpleSWU: invalid opts");let r=p(e,t.Z);if(!e.isOdd)throw Error("Fp.isOdd is not implemented!");return n=>{let i,o,a,s,l,c,d,u;i=e.sqr(n),i=e.mul(i,t.Z),o=e.sqr(i),o=e.add(o,i),a=e.add(o,e.ONE),a=e.mul(a,t.B),s=e.cmov(t.Z,e.neg(o),!e.eql(o,e.ZERO)),s=e.mul(s,t.A),o=e.sqr(a),c=e.sqr(s),l=e.mul(c,t.A),o=e.add(o,l),o=e.mul(o,a),c=e.mul(c,s),l=e.mul(c,t.B),o=e.add(o,l),d=e.mul(i,a);let{isValid:h,value:f}=r(o,c);u=e.mul(i,n),u=e.mul(u,f),d=e.cmov(d,a,h),u=e.cmov(u,f,h);let p=e.isOdd(n)===e.isOdd(u);return u=e.cmov(e.neg(u),u,p),{x:d=e.div(d,s),y:u}}};let t=tc,n=td,r=tu,i=tu;function o(e){void 0!==e.lowS&&(0,i.abool)("lowS",e.lowS),void 0!==e.prehash&&(0,i.abool)("prehash",e.prehash)}let{bytesToNumberBE:a,hexToBytes:s}=r;e.DER={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(t,n)=>{let{Err:i}=e.DER;if(t<0||t>256)throw new i("tlv.encode: wrong tag");if(1&n.length)throw new i("tlv.encode: unpadded data");let o=n.length/2,a=r.numberToHexUnpadded(o);if(a.length/2&128)throw new i("tlv.encode: long form length too big");let s=o>127?r.numberToHexUnpadded(a.length/2|128):"";return`${r.numberToHexUnpadded(t)}${s}${a}${n}`},decode(t,n){let{Err:r}=e.DER,i=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(n.length<2||n[i++]!==t)throw new r("tlv.decode: wrong tlv");let o=n[i++],a=0;if(128&o){let e=127&o;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let t=n.subarray(i,i+e);if(t.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===t[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of t)a=a<<8|e;if(i+=e,a<128)throw new r("tlv.decode(long): not minimal encoding")}else a=o;let s=n.subarray(i,i+a);if(s.length!==a)throw new r("tlv.decode: wrong value length");return{v:s,l:n.subarray(i+a)}}},_int:{encode(t){let{Err:n}=e.DER;if(t<l)throw new n("integer: negative integers are not allowed");let i=r.numberToHexUnpadded(t);if(8&Number.parseInt(i[0],16)&&(i="00"+i),1&i.length)throw new n("unexpected assertion");return i},decode(t){let{Err:n}=e.DER;if(128&t[0])throw new n("Invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new n("Invalid signature integer: unnecessary leading zero");return a(t)}},toSig(t){let{Err:n,_int:i,_tlv:o}=e.DER,a="string"==typeof t?s(t):t;r.abytes(a);let{v:l,l:c}=o.decode(48,a);if(c.length)throw new n("Invalid signature: left bytes after parsing");let{v:d,l:u}=o.decode(2,l),{v:h,l:f}=o.decode(2,u);if(f.length)throw new n("Invalid signature: left bytes after parsing");return{r:i.decode(d),s:i.decode(h)}},hexFromSig(t){let{_tlv:n,_int:r}=e.DER,i=`${n.encode(2,r.encode(t.r))}${n.encode(2,r.encode(t.s))}`;return n.encode(48,i)}};let l=BigInt(0),c=BigInt(1),d=BigInt(2),u=BigInt(3),h=BigInt(4);function f(e){let o=function(e){let n=(0,t.validateBasic)(e);r.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:i,Fp:o,a:a}=n;if(i){if(!o.eql(a,o.ZERO))throw Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof i||"bigint"!=typeof i.beta||"function"!=typeof i.splitScalar)throw Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}(e),{Fp:a}=o,s=n.Field(o.n,o.nBitLength),d=o.toBytes||((e,t,n)=>{let i=t.toAffine();return r.concatBytes(Uint8Array.from([4]),a.toBytes(i.x),a.toBytes(i.y))}),h=o.fromBytes||(e=>{let t=e.subarray(1);return{x:a.fromBytes(t.subarray(0,a.BYTES)),y:a.fromBytes(t.subarray(a.BYTES,2*a.BYTES))}});function f(e){let{a:t,b:n}=o,r=a.sqr(e),i=a.mul(r,e);return a.add(a.add(i,a.mul(e,t)),n)}if(!a.eql(a.sqr(o.Gy),f(o.Gx)))throw Error("bad generator point: equation left != right");function p(e){let t;let{allowedPrivateKeyLengths:a,nByteLength:s,wrapPrivateKey:l,n:d}=o;if(a&&"bigint"!=typeof e){if(r.isBytes(e)&&(e=r.bytesToHex(e)),"string"!=typeof e||!a.includes(e.length))throw Error("Invalid key");e=e.padStart(2*s,"0")}try{t="bigint"==typeof e?e:r.bytesToNumberBE((0,i.ensureBytes)("private key",e,s))}catch(t){throw Error(`private key must be ${s} bytes, hex or bigint, not ${typeof e}`)}return l&&(t=n.mod(t,d)),r.aInRange("private key",t,c,d),t}function g(e){if(!(e instanceof v))throw Error("ProjectivePoint expected")}let m=(0,i.memoized)((e,t)=>{let{px:n,py:r,pz:i}=e;if(a.eql(i,a.ONE))return{x:n,y:r};let o=e.is0();null==t&&(t=o?a.ONE:a.inv(i));let s=a.mul(n,t),l=a.mul(r,t),c=a.mul(i,t);if(o)return{x:a.ZERO,y:a.ZERO};
1if(!a.eql(c,a.ONE))throw Error("invZ was invalid");return{x:s,y:l}}),y=(0,i.memoized)(e=>{if(e.is0()){if(o.allowInfinityPoint&&!a.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=e.toAffine();if(!a.isValid(t)||!a.isValid(n))throw Error("bad point: x or y not FE");let r=a.sqr(n),i=f(t);if(!a.eql(r,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class v{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!a.isValid(e))throw Error("x required");if(null==t||!a.isValid(t))throw Error("y required");if(null==n||!a.isValid(n))throw Error("z required");Object.freeze(this)}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!a.isValid(t)||!a.isValid(n))throw Error("invalid affine point");if(e instanceof v)throw Error("projective point not allowed");let r=e=>a.eql(e,a.ZERO);return r(t)&&r(n)?v.ZERO:new v(t,n,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=a.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(v.fromAffine)}static fromHex(e){let t=v.fromAffine(h((0,i.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return v.BASE.multiply(p(e))}static msm(e,n){return(0,t.pippenger)(v,s,e,n)}_setWindowSize(e){E.setWindowSize(this,e)}assertValidity(){y(this)}hasEvenY(){let{y:e}=this.toAffine();if(a.isOdd)return!a.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){g(e);let{px:t,py:n,pz:r}=this,{px:i,py:o,pz:s}=e,l=a.eql(a.mul(t,s),a.mul(i,r)),c=a.eql(a.mul(n,s),a.mul(o,r));return l&&c}negate(){return new v(this.px,a.neg(this.py),this.pz)}double(){let{a:e,b:t}=o,n=a.mul(t,u),{px:r,py:i,pz:s}=this,l=a.ZERO,c=a.ZERO,d=a.ZERO,h=a.mul(r,r),f=a.mul(i,i),p=a.mul(s,s),g=a.mul(r,i);return g=a.add(g,g),d=a.mul(r,s),d=a.add(d,d),l=a.mul(e,d),c=a.mul(n,p),c=a.add(l,c),l=a.sub(f,c),c=a.add(f,c),c=a.mul(l,c),l=a.mul(g,l),d=a.mul(n,d),p=a.mul(e,p),g=a.sub(h,p),g=a.mul(e,g),g=a.add(g,d),d=a.add(h,h),h=a.add(d,h),h=a.add(h,p),h=a.mul(h,g),c=a.add(c,h),p=a.mul(i,s),p=a.add(p,p),h=a.mul(p,g),l=a.sub(l,h),d=a.mul(p,f),d=a.add(d,d),new v(l,c,d=a.add(d,d))}add(e){g(e);let{px:t,py:n,pz:r}=this,{px:i,py:s,pz:l}=e,c=a.ZERO,d=a.ZERO,h=a.ZERO,f=o.a,p=a.mul(o.b,u),m=a.mul(t,i),y=a.mul(n,s),b=a.mul(r,l),E=a.add(t,n),w=a.add(i,s);E=a.mul(E,w),w=a.add(m,y),E=a.sub(E,w),w=a.add(t,r);let S=a.add(i,l);return w=a.mul(w,S),S=a.add(m,b),w=a.sub(w,S),S=a.add(n,r),c=a.add(s,l),S=a.mul(S,c),c=a.add(y,b),S=a.sub(S,c),h=a.mul(f,w),c=a.mul(p,b),h=a.add(c,h),c=a.sub(y,h),h=a.add(y,h),d=a.mul(c,h),y=a.add(m,m),y=a.add(y,m),b=a.mul(f,b),w=a.mul(p,w),y=a.add(y,b),b=a.sub(m,b),b=a.mul(f,b),w=a.add(w,b),m=a.mul(y,w),d=a.add(d,m),m=a.mul(S,w),c=a.mul(E,c),c=a.sub(c,m),m=a.mul(E,y),h=a.mul(S,h),new v(c,d,h=a.add(h,m))}subtract(e){return this.add(e.negate())}is0(){return this.equals(v.ZERO)}wNAF(e){return E.wNAFCached(this,e,v.normalizeZ)}multiplyUnsafe(e){r.aInRange("scalar",e,l,o.n);let t=v.ZERO;if(e===l)return t;if(e===c)return this;let{endo:n}=o;if(!n)return E.unsafeLadder(this,e);let{k1neg:i,k1:s,k2neg:d,k2:u}=n.splitScalar(e),h=t,f=t,p=this;for(;s>l||u>l;)s&c&&(h=h.add(p)),u&c&&(f=f.add(p)),p=p.double(),s>>=c,u>>=c;return i&&(h=h.negate()),d&&(f=f.negate()),f=new v(a.mul(f.px,n.beta),f.py,f.pz),h.add(f)}multiply(e){let t,n;let{endo:i,n:s}=o;if(r.aInRange("scalar",e,c,s),i){let{k1neg:r,k1:o,k2neg:s,k2:l}=i.splitScalar(e),{p:c,f:d}=this.wNAF(o),{p:u,f:h}=this.wNAF(l);c=E.constTimeNegate(r,c),u=E.constTimeNegate(s,u),u=new v(a.mul(u.px,i.beta),u.py,u.pz),t=c.add(u),n=d.add(h)}else{let{p:r,f:i}=this.wNAF(e);t=r,n=i}return v.normalizeZ([t,n])[0]}multiplyAndAddUnsafe(e,t,n){let r=v.BASE,i=(e,t)=>t!==l&&t!==c&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return m(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=o;if(e===c)return!0;if(t)return t(v,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=o;return e===c?this:t?t(v,this):this.multiplyUnsafe(o.h)}toRawBytes(e=!0){return(0,i.abool)("isCompressed",e),this.assertValidity(),d(v,this,e)}toHex(e=!0){return(0,i.abool)("isCompressed",e),r.bytesToHex(this.toRawBytes(e))}}v.BASE=new v(o.Gx,o.Gy,a.ONE),v.ZERO=new v(a.ZERO,a.ONE,a.ZERO);
1let b=o.nBitLength,E=(0,t.wNAF)(v,o.endo?Math.ceil(b/2):b);return{CURVE:o,ProjectivePoint:v,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:function(e){return r.inRange(e,c,o.n)}}}function p(e,t){let n=e.ORDER,r=l;for(let e=n-c;e%d===l;e/=d)r+=c;let i=r,o=d<<i-c-c,a=o*d,s=(n-c)/a,f=(s-c)/d,p=a-c,g=e.pow(t,s),m=e.pow(t,(s+c)/d),y=(t,n)=>{let r=g,a=e.pow(n,p),s=e.sqr(a);s=e.mul(s,n);let l=e.mul(t,s);l=e.pow(l,f),l=e.mul(l,a),a=e.mul(l,n),s=e.mul(l,t);let u=e.mul(s,a);l=e.pow(u,o);let h=e.eql(l,e.ONE);a=e.mul(s,m),l=e.mul(u,r),s=e.cmov(a,s,h),u=e.cmov(l,u,h);for(let t=i;t>c;t--){let n=t-d;n=d<<n-c;let i=e.pow(u,n),o=e.eql(i,e.ONE);a=e.mul(s,r),r=e.mul(r,r),i=e.mul(u,r),s=e.cmov(a,s,o),u=e.cmov(i,u,o)}return{isValid:h,value:s}};if(e.ORDER%h===u){let n=(e.ORDER-u)/h,r=e.sqrt(e.neg(t));y=(t,i)=>{let o=e.sqr(i),a=e.mul(t,i);o=e.mul(o,a);let s=e.pow(o,n);s=e.mul(s,a);let l=e.mul(s,r),c=e.mul(e.sqr(s),i),d=e.eql(c,t);return{isValid:d,value:e.cmov(l,s,d)}}}return y}}(nC),Object.defineProperty(nS,"__esModule",{value:!0}),nS.getHash=nk,nS.createCurve=function(e,t){let n=t=>(0,nx.weierstrass)({...e,...nk(t)});return Object.freeze({...n(t),create:n})};let nx=nC;function nk(e){return{hash:e,hmac:(t,...n)=>(0,n_.hmac)(e,t,(0,eN.concatBytes)(...n)),randomBytes:eN.randomBytes}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;let t=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),r=BigInt(1),i=BigInt(2),o=(e,t)=>(e+t/i)/t;function a(e){let n=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),l=BigInt(23),c=BigInt(44),d=BigInt(88),u=e*e*e%t,h=u*u*e%t,f=(0,td.pow2)(h,n,t)*h%t,p=(0,td.pow2)(f,n,t)*h%t,g=(0,td.pow2)(p,i,t)*u%t,m=(0,td.pow2)(g,o,t)*g%t,y=(0,td.pow2)(m,a,t)*m%t,v=(0,td.pow2)(y,c,t)*y%t,b=(0,td.pow2)(v,d,t)*v%t,E=(0,td.pow2)(b,c,t)*y%t,w=(0,td.pow2)(E,n,t)*h%t,S=(0,td.pow2)(w,l,t)*m%t,_=(0,td.pow2)(S,r,t)*u%t,C=(0,td.pow2)(_,i,t);if(!s.eql(s.sqr(C),e))throw Error("Cannot find square root");return C}let s=(0,td.Field)(t,void 0,void 0,{sqrt:a});e.secp256k1=(0,nS.createCurve)({a:BigInt(0),b:BigInt(7),Fp:s,n:n,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-r*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=BigInt("0x100000000000000000000000000000000"),l=o(t*e,n),c=o(-i*e,n),d=(0,td.mod)(e-l*t-c*a,n),u=(0,td.mod)(-l*i-c*t,n),h=d>s,f=u>s;if(h&&(d=n-d),f&&(u=n-u),d>s||u>s)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:d,k2neg:f,k2:u}}}},ng.sha256);let l=BigInt(0),c={};function d(e,...t){let n=c[e];if(void 0===n){let t=(0,ng.sha256)(Uint8Array.from(e,e=>e.charCodeAt(0)));n=(0,tu.concatBytes)(t,t),c[e]=n}return(0,ng.sha256)((0,tu.concatBytes)(n,...t))}let u=e=>e.toRawBytes(!0).slice(1),h=e=>(0,tu.numberToBytesBE)(e,32),f=e=>(0,td.mod)(e,t),p=e=>(0,td.mod)(e,n),g=e.secp256k1.ProjectivePoint,m=(e,t,n)=>g.BASE.multiplyAndAddUnsafe(e,t,n);function y(t){let n=e.secp256k1.utils.normPrivateKeyToScalar(t),r=g.fromPrivateKey(n);return{scalar:r.hasEvenY()?n:p(-n),bytes:u(r)}}function v(e){(0,tu.aInRange)("x",e,r,t);let n=f(e*e),o=a(f(n*e+BigInt(7)));o%i!==l&&(o=f(-o));let s=new g(e,o,r);return s.assertValidity(),s}let b=tu.bytesToNumberBE;function E(...e){return p(b(d("BIP0340/challenge",...e)))}function w(e,i,o){let a=(0,tu.ensureBytes)("signature",e,64),s=(0,tu.ensureBytes)("message",i),l=(0,tu.ensureBytes)("publicKey",o,32);try{let e=v(b(l)),i=b(a.subarray(0,32));if(!(0,tu.inRange)(i,r,t))return!1;let o=b(a.subarray(32,64));if(!(0,tu.inRange)(o,r,n))return!1;let c=E(h(i),u(e),s),d=m(e,o,p(-c));return!(!d||!d.hasEvenY()||d.toAffine().x!==i)}catch(e){return!1}}e.schnorr={getPublicKey:function(e){return y(e).bytes},sign:function(e,t,n=(0,eN.randomBytes)(32)){let r=(0,tu.ensureBytes)("message",e),{bytes:i,scalar:o}=y(t),a=h(o^b(d("BIP0340/aux",(0,tu.ensureBytes)("auxRand",n,32)))),s=p(b(d("BIP0340/nonce",a,i,r)));if(s===l)throw Error("sign failed: k is zero");let{bytes:c,scalar:u}=y(s),f=E(c,i,r),g=new Uint8Array(64);if(g.set(c,0),g.set(h(p(u+f*o)),32),!w(g,r,i))throw Error("sign: Invalid signature produced");return g},verify:w,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:v,pointToBytes:u,numberToBytesBE:tu.numberToBytesBE,bytesToNumberBE:tu.bytesToNumberBE,taggedHash:d,mod:td.mod}};let S=(0,nn.isogenyMap)(s,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a4
113deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(e=>BigInt(e)))),_=(0,nC.mapToCurveSimpleSWU)(s,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:s.create(BigInt("-11"))}),C=(0,nn.createHasher)(e.secp256k1.ProjectivePoint,e=>{let{x:t,y:n}=_(s.create(e[0]));return S(t,n)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:s.ORDER,m:1,k:128,expand:"xmd",hash:ng.sha256});e.hashToCurve=C.hashToCurve,e.encodeToCurve=C.encodeToCurve}(np);var nM={};Object.defineProperty(nM,"__esModule",{value:!0}),nM.decodeHex=nM.remove0x=void 0,nM.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e},nM.decodeHex=function(e){return(0,es.hexToBytes)((0,nM.remove0x)(e))},function(e){function t(e,t,n,r){if("secp256k1"===e)return t(np.secp256k1);if("x25519"===e)return n(eC.x25519);if("ed25519"===e)return r(eC.ed25519);throw Error("Not implemented")}Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0,e.getValidSecret=function(){var t;do t=(0,eS.randomBytes)(ey.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(t));return t},e.isValidPrivateKey=function(e){return t((0,em.ellipticCurve)(),function(t){return t.utils.isValidPrivateKey(e)},function(){return!0},function(){return!0})},e.getPublicKey=function(e){return t((0,em.ellipticCurve)(),function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)})},e.getSharedPoint=function(e,n,i){return t((0,em.ellipticCurve)(),function(t){return t.getSharedSecret(e,n,i)},function(t){return t.getSharedSecret(e,n)},function(t){return r(t,e,n)})},e.convertPublicKeyFormat=function(e,n){return t((0,em.ellipticCurve)(),function(t){return t.getSharedSecret(BigInt(1),e,n)},function(){return e},function(){return e})},e.hexToPublicKey=function(e){var r=(0,nM.decodeHex)(e);return t((0,em.ellipticCurve)(),function(){return n(r)},function(){return r},function(){return r})};var n=function(e){if(e.length===ey.ETH_PUBLIC_KEY_SIZE){var t=new Uint8Array(1+e.length);return t.set([4]),t.set(e,1),t}return e},r=function(e,t,n){var r=e.utils.getExtendedPublicKey(t).scalar;return e.ExtendedPoint.fromHex(n).multiply(r).toRawBytes()}}(ew);var nA={},nI={};function nR(e,t,n){return(0,eM.hash)(e),void 0===n&&(n=new Uint8Array(e.outputLen)),(0,n_.hmac)(e,(0,eN.toBytes)(n),(0,eN.toBytes)(t))}Object.defineProperty(nI,"__esModule",{value:!0}),nI.hkdf=void 0,nI.extract=nR,nI.expand=nO;let nP=new Uint8Array([0]),nT=new Uint8Array;function nO(e,t,n,r=32){if((0,eM.hash)(e),(0,eM.number)(r),r>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let i=Math.ceil(r/e.outputLen);void 0===n&&(n=nT);let o=new Uint8Array(i*e.outputLen),a=n_.hmac.create(e,t),s=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let t=0;t<i;t++)nP[0]=t+1,s.update(0===t?nT:l).update(n).update(nP).digestInto(l),o.set(l,e.outputLen*t),a._cloneInto(s);return a.destroy(),s.destroy(),l.fill(0),nP.fill(0),o.slice(0,r)}nI.hkdf=(e,t,n,r,i)=>nO(e,nR(e,t,n),r,i),Object.defineProperty(nA,"__esModule",{value:!0}),nA.getSharedKey=nA.deriveKey=void 0,nA.deriveKey=function(e,t,n){return(0,nI.hkdf)(ng.sha256,e,t,n,32)},nA.getSharedKey=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0,nA.deriveKey)(es.concatBytes.apply(void 0,e))};var nL={},nN={},n$={},nD={};Object.defineProperty(nD,"__esModule",{value:!0}
1),nD.polyval=nD.ghash=void 0,nD._toGHASHKey=nj;let nB=new Uint8Array(16),nK=(0,es.u32)(nB),nU=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function nj(e){e.reverse();let t=1&e[15],n=0;for(let t=0;t<e.length;t++){let r=e[t];e[t]=r>>>1|n,n=(1&r)<<7}return e[0]^=225&-t,e}class nH{constructor(e,t){var n,r,i,o;let a;this.blockLen=16,this.outputLen=16,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,es.toBytes)(e),(0,el.bytes)(e,16);let s=(0,es.createView)(e),l=s.getUint32(0,!1),c=s.getUint32(4,!1),d=s.getUint32(8,!1),u=s.getUint32(12,!1),h=[];for(let e=0;e<128;e++)h.push({s0:nU(l),s1:nU(c),s2:nU(d),s3:nU(u)}),{s0:l,s1:c,s2:d,s3:u}={s3:(i=d)<<31|(o=u)>>>1,s2:(r=c)<<31|i>>>1,s1:(n=l)<<31|r>>>1,s0:n>>>1^-520093696&-(1&o)};let f=(a=t||1024)>65536?8:a>1024?4:2;if(![1,2,4,8].includes(f))throw Error(`ghash: wrong window size=${f}, should be 2, 4 or 8`);this.W=f;let p=128/f,g=this.windowSize=2**f,m=[];for(let e=0;e<p;e++)for(let t=0;t<g;t++){let n=0,r=0,i=0,o=0;for(let a=0;a<f;a++){if(!(t>>>f-a-1&1))continue;let{s0:s,s1:l,s2:c,s3:d}=h[f*e+a];n^=s,r^=l,i^=c,o^=d}m.push({s0:n,s1:r,s2:i,s3:o})}this.t=m}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;let{W:i,t:o,windowSize:a}=this,s=0,l=0,c=0,d=0,u=(1<<i)-1,h=0;for(let f of[e,t,n,r])for(let e=0;e<4;e++){let t=f>>>8*e&255;for(let e=8/i-1;e>=0;e--){let{s0:n,s1:r,s2:f,s3:p}=o[h*a+(t>>>i*e&u)];s^=n,l^=r,c^=f,d^=p,h+=1}}this.s0=s,this.s1=l,this.s2=c,this.s3=d}update(e){e=(0,es.toBytes)(e),(0,el.exists)(this);let t=(0,es.u32)(e),n=Math.floor(e.length/16),r=e.length%16;for(let e=0;e<n;e++)this._updateBlock(t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]);return r&&(nB.set(e.subarray(16*n)),this._updateBlock(nK[0],nK[1],nK[2],nK[3]),(0,es.clean)(nK)),this}destroy(){let{t:e}=this;for(let t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){(0,el.exists)(this),(0,el.output)(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,o=(0,es.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e}digest(){let e=new Uint8Array(16);return this.digestInto(e),this.destroy(),e}}class nF extends nH{constructor(e,t){e=(0,es.toBytes)(e);let n=nj((0,es.copyBytes)(e));super(n,t),(0,es.clean)(n)}update(e){e=(0,es.toBytes)(e),(0,el.exists)(this);let t=(0,es.u32)(e),n=e.length%16,r=Math.floor(e.length/16);for(let e=0;e<r;e++)this._updateBlock(nU(t[4*e+3]),nU(t[4*e+2]),nU(t[4*e+1]),nU(t[4*e+0]));return n&&(nB.set(e.subarray(16*r)),this._updateBlock(nU(nK[3]),nU(nK[2]),nU(nK[1]),nU(nK[0])),(0,es.clean)(nK)),this}digestInto(e){(0,el.exists)(this),(0,el.output)(e,this),this.finished=!0;let{s0:t,s1:n,s2:r,s3:i}=this,o=(0,es.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e.reverse()}}function nz(e){let t=(t,n)=>e(n,t.length).update((0,es.toBytes)(t)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}nD.ghash=nz((e,t)=>new nH(e,t)),nD.polyval=nz((e,t)=>new nF(e,t)),Object.defineProperty(n$,"__esModule",{value:!0}),n$.unsafe=n$.aeskwp=n$.aeskw=n$.siv=n$.gcm=n$.cfb=n$.cbc=n$.ecb=n$.ctr=void 0,n$.expandKeyLE=n3,n$.expandKeyDecLE=n5;let nq=new Uint8Array(16);function nW(e){return e<<1^283&-(e>>7)}function nV(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(1&t),e=nW(e);return n}let nG=(()=>{let e=new Uint8Array(256);for(let t=0,n=1;t<256;t++,n^=nW(n))e[t]=n;let t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,es.clean)(e),t})(),nY=nG.map((e,t)=>nG.indexOf(t)),nZ=e=>e<<24|e>>>8,nJ=e=>e<<8|e>>>24,nX=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function nQ(e,t){if(256!==e.length)throw Error("Wrong sbox length");let n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(nJ),i=r.map(nJ),o=i.map(nJ),a=new Uint32Array(65536),s=new Uint32Array(65536),l=new Uint16Array(65536);for(let t=0;t<256;t++)for(let c=0;c<256;c++){let d=256*t+c;a[d]=n[t]^r[c],s[d]=i[t]^o[c],l[d]=e[t]<<8|e[c]}return{sbox:e,sbox2:l,T0:n,T1:r,T2:i,T3:o,T01:a,T23:s}}let n0=nQ(nG,e=>nV(e,3)<<24|e<<16|e<<8|nV(e,2)),n1=nQ(nY,e=>nV(e,11)<<24|nV(e,13)<<16|nV(e,9)<<8|nV(e,14)),n2=(()=>{let e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=nW(n))e[t]=n;return e})();function n3(e){(0,el.bytes)(e);let t=e.length;if(![16,24,32].includes(t))throw Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);let{sbox2:n}=n0,r=[];(0,es.isAligned32)(e)||r.push(e=(0,es.copyBytes)(e));let i=(0,es.u32)(e),o=i.length,a=e=>n6(n,e,e,e,e),s=new Uint32Array(t+28);s.set(i);for(let e=o;e<s.length;e++){let t=s[e-1];e%o==0?t=a(nZ(t))^n2[e/o-1]:o>6&&e%o==4&&(t=a(t)),s[e]=s[e-o]^t}return(0,es.clean)(...r),s}function n5(e){let t=n3(e),n=t.slice(),r=t.length,{sbox2:i}=n0,{T0:o,T1:a,T2:s,T3:l}=n1;for(let e=0;e<r;e+=4)for(let i=0;i<4;i++)n[e+i]=t[r-e-4+i];(0,es.clean)(t);for(let e=4;e<r-4;e++){let t=n[e],r=n6(i,t,t,t,t);n[e]=o[255&r]^a[r>>>8&255]^s[r>>>16&255]^l[r>>>24]}return n}function n8(e,t,n,r,i,o){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|o>>>24&255]}function n6(e,t,n,r,i){return e[255&t|65280&n]|e[r>>>16&255|i>>>16&65280]<<16}
1function n4(e,t,n,r,i){let{sbox2:o,T01:a,T23:s}=n0,l=0;t^=e[l++],n^=e[l++],r^=e[l++],i^=e[l++];let c=e.length/4-2;for(let o=0;o<c;o++){let o=e[l++]^n8(a,s,t,n,r,i),c=e[l++]^n8(a,s,n,r,i,t),d=e[l++]^n8(a,s,r,i,t,n),u=e[l++]^n8(a,s,i,t,n,r);t=o,n=c,r=d,i=u}return{s0:e[l++]^n6(o,t,n,r,i),s1:e[l++]^n6(o,n,r,i,t),s2:e[l++]^n6(o,r,i,t,n),s3:e[l++]^n6(o,i,t,n,r)}}function n9(e,t,n,r,i){let{sbox2:o,T01:a,T23:s}=n1,l=0;t^=e[l++],n^=e[l++],r^=e[l++],i^=e[l++];let c=e.length/4-2;for(let o=0;o<c;o++){let o=e[l++]^n8(a,s,t,i,r,n),c=e[l++]^n8(a,s,n,t,i,r),d=e[l++]^n8(a,s,r,n,t,i),u=e[l++]^n8(a,s,i,r,n,t);t=o,n=c,r=d,i=u}return{s0:e[l++]^n6(o,t,i,r,n),s1:e[l++]^n6(o,n,t,i,r),s2:e[l++]^n6(o,r,n,t,i),s3:e[l++]^n6(o,i,r,n,t)}}function n7(e,t){if(void 0===t)return new Uint8Array(e);if((0,el.bytes)(t),t.length<e)throw Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);if(!(0,es.isAligned32)(t))throw Error("unaligned dst");return t}function re(e,t,n,r){(0,el.bytes)(t,16),(0,el.bytes)(n);let i=n.length;r=n7(i,r);let o=(0,es.u32)(t),{s0:a,s1:s,s2:l,s3:c}=n4(e,o[0],o[1],o[2],o[3]),d=(0,es.u32)(n),u=(0,es.u32)(r);for(let n=0;n+4<=d.length;n+=4){u[n+0]=d[n+0]^a,u[n+1]=d[n+1]^s,u[n+2]=d[n+2]^l,u[n+3]=d[n+3]^c;let r=1;for(let e=t.length-1;e>=0;e--)r=r+(255&t[e])|0,t[e]=255&r,r>>>=8;({s0:a,s1:s,s2:l,s3:c}=n4(e,o[0],o[1],o[2],o[3]))}let h=16*Math.floor(d.length/4);if(h<i){let e=new Uint32Array([a,s,l,c]),t=(0,es.u8)(e);for(let e=h,o=0;e<i;e++,o++)r[e]=n[e]^t[o];(0,es.clean)(e)}return r}function rt(e,t,n,r,i){(0,el.bytes)(n,16),(0,el.bytes)(r),i=n7(r.length,i);let o=(0,es.u32)(n),a=(0,es.createView)(n),s=(0,es.u32)(r),l=(0,es.u32)(i),c=t?0:12,d=r.length,u=a.getUint32(c,t),{s0:h,s1:f,s2:p,s3:g}=n4(e,o[0],o[1],o[2],o[3]);for(let n=0;n+4<=s.length;n+=4)l[n+0]=s[n+0]^h,l[n+1]=s[n+1]^f,l[n+2]=s[n+2]^p,l[n+3]=s[n+3]^g,u=u+1>>>0,a.setUint32(c,u,t),{s0:h,s1:f,s2:p,s3:g}=n4(e,o[0],o[1],o[2],o[3]);let m=16*Math.floor(s.length/4);if(m<d){let e=new Uint32Array([h,f,p,g]),t=(0,es.u8)(e);for(let e=m,n=0;e<d;e++,n++)i[e]=r[e]^t[n];(0,es.clean)(e)}return i}function rn(e){if((0,el.bytes)(e),e.length%16!=0)throw Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function rr(e,t,n){(0,el.bytes)(e);let r=e.length,i=r%16;if(!t&&0!==i)throw Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,es.isAligned32)(e)||(e=(0,es.copyBytes)(e));let o=(0,es.u32)(e);if(t){let e=16-i;e||(e=16),r+=e}let a=n7(r,n);return{b:o,o:(0,es.u32)(a),out:a}}function ri(e,t){if(!t)return e;let n=e.length;if(!n)throw Error("aes/pcks5: empty ciphertext not allowed");let r=e[n-1];if(r<=0||r>16)throw Error("aes/pcks5: wrong padding");let i=e.subarray(0,-r);for(let t=0;t<r;t++)if(e[n-t-1]!==r)throw Error("aes/pcks5: wrong padding");return i}function ro(e){let t=new Uint8Array(16),n=(0,es.u32)(t);t.set(e);let r=16-e.length;for(let e=16-r;e<16;e++)t[e]=r;return n}function ra(e,t,n,r,i){let o=null==i?0:i.length,a=e.create(n,r.length+o);i&&a.update(i),a.update(r);let s=new Uint8Array(16),l=(0,es.createView)(s);i&&(0,es.setBigUint64)(l,0,BigInt(8*o),t),(0,es.setBigUint64)(l,8,BigInt(8*r.length),t),a.update(s);let c=a.digest();return(0,es.clean)(s),c}n$.ctr=(0,es.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r){if((0,el.bytes)(n),void 0!==r&&((0,el.bytes)(r),!(0,es.isAligned32)(r)))throw Error("unaligned destination");let i=n3(e),o=(0,es.copyBytes)(t),a=[i,o];(0,es.isAligned32)(n)||a.push(n=(0,es.copyBytes)(n));let s=re(i,o,n,r);return(0,es.clean)(...a),s}return(0,el.bytes)(e),(0,el.bytes)(t,16),{encrypt:(e,t)=>n(e,t),decrypt:(e,t)=>n(e,t)}}),n$.ecb=(0,es.wrapCipher)({blockSize:16},function(e,t={}){(0,el.bytes)(e);let n=!t.disablePadding;return{encrypt(t,r){let{b:i,o:o,out:a}=rr(t,n,r),s=n3(e),l=0;for(;l+4<=i.length;){let{s0:e,s1:t,s2:n,s3:r}=n4(s,i[l+0],i[l+1],i[l+2],i[l+3]);o[l++]=e,o[l++]=t,o[l++]=n,o[l++]=r}if(n){let e=ro(t.subarray(4*l)),{s0:n,s1:r,s2:i,s3:a}=n4(s,e[0],e[1],e[2],e[3]);o[l++]=n,o[l++]=r,o[l++]=i,o[l++]=a}return(0,es.clean)(s),a},decrypt(t,r){rn(t);let i=n5(e),o=n7(t.length,r),a=[i];(0,es.isAligned32)(t)||a.push(t=(0,es.copyBytes)(t));let s=(0,es.u32)(t),l=(0,es.u32)(o);for(let e=0;e+4<=s.length;){let{s0:t,s1:n,s2:r,s3:o}=n9(i,s[e+0],s[e+1],s[e+2],s[e+3]);
1l[e++]=t,l[e++]=n,l[e++]=r,l[e++]=o}return(0,es.clean)(...a),ri(o,n)}}}),n$.cbc=(0,es.wrapCipher)({blockSize:16,nonceLength:16},function(e,t,n={}){(0,el.bytes)(e),(0,el.bytes)(t,16);let r=!n.disablePadding;return{encrypt(n,i){let o=n3(e),{b:a,o:s,out:l}=rr(n,r,i),c=t,d=[o];(0,es.isAligned32)(c)||d.push(c=(0,es.copyBytes)(c));let u=(0,es.u32)(c),h=u[0],f=u[1],p=u[2],g=u[3],m=0;for(;m+4<=a.length;)h^=a[m+0],f^=a[m+1],p^=a[m+2],g^=a[m+3],({s0:h,s1:f,s2:p,s3:g}=n4(o,h,f,p,g)),s[m++]=h,s[m++]=f,s[m++]=p,s[m++]=g;if(r){let e=ro(n.subarray(4*m));h^=e[0],f^=e[1],p^=e[2],g^=e[3],({s0:h,s1:f,s2:p,s3:g}=n4(o,h,f,p,g)),s[m++]=h,s[m++]=f,s[m++]=p,s[m++]=g}return(0,es.clean)(...d),l},decrypt(n,i){rn(n);let o=n5(e),a=t,s=[o];(0,es.isAligned32)(a)||s.push(a=(0,es.copyBytes)(a));let l=(0,es.u32)(a),c=n7(n.length,i);(0,es.isAligned32)(n)||s.push(n=(0,es.copyBytes)(n));let d=(0,es.u32)(n),u=(0,es.u32)(c),h=l[0],f=l[1],p=l[2],g=l[3];for(let e=0;e+4<=d.length;){let t=h,n=f,r=p,i=g;h=d[e+0];let{s0:a,s1:s,s2:l,s3:c}=n9(o,h,f=d[e+1],p=d[e+2],g=d[e+3]);u[e++]=a^t,u[e++]=s^n,u[e++]=l^r,u[e++]=c^i}return(0,es.clean)(...s),ri(c,r)}}}),n$.cfb=(0,es.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r,i){(0,el.bytes)(n);let o=n.length;i=n7(o,i);let a=n3(e),s=t,l=[a];(0,es.isAligned32)(s)||l.push(s=(0,es.copyBytes)(s)),(0,es.isAligned32)(n)||l.push(n=(0,es.copyBytes)(n));let c=(0,es.u32)(n),d=(0,es.u32)(i),u=r?d:c,h=(0,es.u32)(s),f=h[0],p=h[1],g=h[2],m=h[3];for(let e=0;e+4<=c.length;){let{s0:t,s1:n,s2:r,s3:i}=n4(a,f,p,g,m);d[e+0]=c[e+0]^t,d[e+1]=c[e+1]^n,d[e+2]=c[e+2]^r,d[e+3]=c[e+3]^i,f=u[e++],p=u[e++],g=u[e++],m=u[e++]}let y=16*Math.floor(c.length/4);if(y<o){({s0:f,s1:p,s2:g,s3:m}=n4(a,f,p,g,m));let e=(0,es.u8)(new Uint32Array([f,p,g,m]));for(let t=y,r=0;t<o;t++,r++)i[t]=n[t]^e[r];(0,es.clean)(e)}return(0,es.clean)(...l),i}return(0,el.bytes)(e),(0,el.bytes)(t,16),{encrypt:(e,t)=>n(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}}),n$.gcm=(0,es.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){if((0,el.bytes)(e),(0,el.bytes)(t),void 0!==n&&(0,el.bytes)(n),t.length<8)throw Error("aes/gcm: invalid nonce length");function r(e,t,r){let i=ra(nD.ghash,!1,e,r,n);for(let e=0;e<t.length;e++)i[e]^=t[e];return i}function i(){let n=n3(e),r=nq.slice(),i=nq.slice();if(rt(n,!1,i,i,r),12===t.length)i.set(t);else{let e=nq.slice(),n=(0,es.createView)(e);(0,es.setBigUint64)(n,8,BigInt(8*t.length),!1);let o=nD.ghash.create(r).update(t).update(e);o.digestInto(i),o.destroy()}return{xk:n,authKey:r,counter:i,tagMask:rt(n,!1,i,nq)}}return{encrypt(e){(0,el.bytes)(e);let{xk:t,authKey:n,counter:o,tagMask:a}=i(),s=new Uint8Array(e.length+16),l=[t,n,o,a];(0,es.isAligned32)(e)||l.push(e=(0,es.copyBytes)(e)),rt(t,!1,o,e,s);let c=r(n,a,s.subarray(0,s.length-16));return l.push(c),s.set(c,e.length),(0,es.clean)(...l),s},decrypt(e){if((0,el.bytes)(e),e.length<16)throw Error("aes/gcm: ciphertext less than tagLen (16)");let{xk:t,authKey:n,counter:o,tagMask:a}=i(),s=[t,n,a,o];(0,es.isAligned32)(e)||s.push(e=(0,es.copyBytes)(e));let l=e.subarray(0,-16),c=e.subarray(-16),d=r(n,a,l);if(s.push(d),!(0,es.equalBytes)(d,c))throw Error("aes/gcm: invalid ghash tag");let u=rt(t,!1,o,l);return(0,es.clean)(...s),u}}});let rs=(e,t,n)=>r=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)};function rl(e){return null!=e&&"object"==typeof e&&(e instanceof Uint32Array||"Uint32Array"===e.constructor.name)}function rc(e,t){if((0,el.bytes)(t,16),!rl(e))throw Error("_encryptBlock accepts result of expandKeyLE");let n=(0,es.u32)(t),{s0:r,s1:i,s2:o,s3:a}=n4(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,t}function rd(e,t){if((0,el.bytes)(t,16),!rl(e))throw Error("_decryptBlock accepts result of expandKeyLE");let n=(0,es.u32)(t),{s0:r,s1:i,s2:o,s3:a}=n9(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=a,t}n$.siv=(0,es.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){let r=rs("AAD",0,68719476736),i=rs("plaintext",0,68719476736),o=rs("nonce",12,12),a=rs("ciphertext",16,68719476736+16);function s(){let n=n3(e),r=new Uint8Array(e.length),i=new Uint8Array(16),o=[n,r],a=t;(0,es.isAligned32)(a)||o.push(a=(0,es.copyBytes)(a));let s=(0,es.u32)(a),l=0,c=s[0],d=s[1],u=s[2],h=0;for(let e of[i,r].map(es.u32)){let t=(0,es.u32)(e);for(let e=0;e<t.length;e+=2){let{s0:r,s1:i}=n4(n,l,c,d,u);t[e+0]=r,t[e+1]=i,l=++h}}let f={authKey:i,encKey:n3(r)};return(0,es.clean)(...o),f}function l(e,r,i){let o=ra(nD.polyval,!0,r,i,n);for(let e=0;e<12;e++)o[e]^=t[e];o[15]&=127;let a=(0,es.u32)(o),s=a[0],l=a[1],c=a[2],d=a[3];return{s0:s,s1:l,s2:c,s3:d}=n4(e,s,l,c,d),a[0]=s,a[1]=l,a[2]=c,a[3]=d,o}
1function c(e,t,n){let r=(0,es.copyBytes)(t);r[15]|=128;let i=rt(e,!0,r,n);return(0,es.clean)(r),i}return(0,el.bytes)(e,16,24,32),(0,el.bytes)(t),o(t.length),void 0!==n&&((0,el.bytes)(n),r(n.length)),{encrypt(e){(0,el.bytes)(e),i(e.length);let{encKey:t,authKey:n}=s(),r=l(t,n,e),o=[t,n,r];(0,es.isAligned32)(e)||o.push(e=(0,es.copyBytes)(e));let a=new Uint8Array(e.length+16);return a.set(r,e.length),a.set(c(t,r,e)),(0,es.clean)(...o),a},decrypt(e){(0,el.bytes)(e),a(e.length);let t=e.subarray(-16),{encKey:n,authKey:r}=s(),i=[n,r];(0,es.isAligned32)(e)||i.push(e=(0,es.copyBytes)(e));let o=c(n,t,e.subarray(0,-16)),d=l(n,r,o);if(i.push(d),!(0,es.equalBytes)(t,d))throw(0,es.clean)(...i),Error("invalid polyval tag");return(0,es.clean)(...i),o}}});let ru={encrypt(e,t){if(t.length>=4294967296)throw Error("plaintext should be less than 4gb");let n=n3(e);if(16===t.length)rc(n,t);else{let e=(0,es.u32)(t),r=e[0],i=e[1];for(let t=0,o=1;t<6;t++)for(let t=2;t<e.length;t+=2,o++){let{s0:a,s1:s,s2:l,s3:c}=n4(n,r,i,e[t],e[t+1]);r=a,i=s^nX(o),e[t]=l,e[t+1]=c}e[0]=r,e[1]=i}n.fill(0)},decrypt(e,t){if(t.length-8>=4294967296)throw Error("ciphertext should be less than 4gb");let n=n5(e),r=t.length/8-1;if(1===r)rd(n,t);else{let e=(0,es.u32)(t),i=e[0],o=e[1];for(let t=0,a=6*r;t<6;t++)for(let t=2*r;t>=1;t-=2,a--){let{s0:r,s1:s,s2:l,s3:c}=n9(n,i,o^=nX(a),e[t],e[t+1]);i=r,o=s,e[t]=l,e[t+1]=c}e[0]=i,e[1]=o}n.fill(0)}},rh=new Uint8Array(8).fill(166);n$.aeskw=(0,es.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,el.bytes)(t),!t.length||t.length%8!=0)throw Error("invalid plaintext length");if(8===t.length)throw Error("8-byte keys not allowed in AESKW, use AESKWP instead");let n=(0,es.concatBytes)(rh,t);return ru.encrypt(e,n),n},decrypt(t){if((0,el.bytes)(t),t.length%8!=0||t.length<24)throw Error("invalid ciphertext length");let n=(0,es.copyBytes)(t);if(ru.decrypt(e,n),!(0,es.equalBytes)(n.subarray(0,8),rh))throw Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}})),n$.aeskwp=(0,es.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,el.bytes)(t),!t.length)throw Error("invalid plaintext length");let n=new Uint8Array(8+8*Math.ceil(t.length/8));n.set(t,8);let r=(0,es.u32)(n);return r[0]=2790873510,r[1]=nX(t.length),ru.encrypt(e,n),n},decrypt(t){if((0,el.bytes)(t),t.length<16)throw Error("invalid ciphertext length");let n=(0,es.copyBytes)(t),r=(0,es.u32)(n);ru.decrypt(e,n);let i=nX(r[1])>>>0,o=8*Math.ceil(i/8);if(2790873510!==r[0]||n.length-8!==o)throw Error("integrity check failed");for(let e=i;e<o;e++)if(0!==n[8+e])throw Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),n$.unsafe={expandKeyLE:n3,expandKeyDecLE:n5,encrypt:n4,decrypt:n9,encryptBlock:rc,decryptBlock:rd,ctrCounter:re,ctr32:rt},Object.defineProperty(nN,"__esModule",{value:!0}),nN.aes256cbc=nN.aes256gcm=void 0,nN.aes256gcm=function(e,t,n){return(0,n$.gcm)(e,t,n)},nN.aes256cbc=function(e,t,n){return(0,n$.cbc)(e,t)};var rf={},rp={},rg={};Object.defineProperty(rg,"__esModule",{value:!0}),rg.sigma=void 0,rg.rotl=function(e,t){return e<<t|e>>>32-t},rg.createCipher=function(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:a}=(0,ry.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return(0,rm.number)(i),(0,rm.number)(a),(0,rm.bool)(o),(0,rm.bool)(n),(t,s,l,c,d=0)=>{(0,rm.bytes)(t),(0,rm.bytes)(s),(0,rm.bytes)(l);let u=l.length;if(void 0===c&&(c=new Uint8Array(u)),(0,rm.bytes)(c),(0,rm.number)(d),d<0||d>=rk)throw Error("arx: counter overflow");if(c.length<u)throw Error(`arx: output (${c.length}) is shorter than data (${u})`);let h=[],f,p,g=t.length;if(32===g)h.push(f=(0,ry.copyBytes)(t)),p=rS;else{if(16!==g||!n)throw Error(`arx: invalid 32-byte key, got length=${g}`);(f=new Uint8Array(32)).set(t),f.set(t,16),p=rw,h.push(f)}r_(s)||h.push(s=(0,ry.copyBytes)(s));let m=(0,ry.u32)(f);if(r){if(24!==s.length)throw Error("arx: extended nonce must be 24 bytes");r(p,m,(0,ry.u32)(s.subarray(0,16)),m),s=s.subarray(16)}let y=16-i;if(y!==s.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(s,o?0:12-s.length),s=e,h.push(s)}return function(e,t,n,r,i,o,a,s){let l=i.length,c=new Uint8Array(rC
1),d=(0,ry.u32)(c),u=r_(i)&&r_(o),h=u?(0,ry.u32)(i):rM,f=u?(0,ry.u32)(o):rM;for(let p=0;p<l;a++){if(e(t,n,r,d,a,s),a>=rk)throw Error("arx: counter overflow");let g=Math.min(rC,l-p);if(u&&g===rC){let e=p/4;if(p%4!=0)throw Error("arx: invalid block position");for(let t,n=0;n<rx;n++)f[t=e+n]=h[t]^d[n];p+=rC}else{for(let e,t=0;t<g;t++)o[e=p+t]=i[e]^c[t];p+=g}}}(e,p,m,(0,ry.u32)(s),l,c,d,a),(0,ry.clean)(...h),c}};let rm=el,ry=es,rv=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),rb=rv("expand 16-byte k"),rE=rv("expand 32-byte k"),rw=(0,ry.u32)(rb),rS=(0,ry.u32)(rE);function r_(e){return e.byteOffset%4==0}rg.sigma=rS.slice();let rC=64,rx=16,rk=4294967296-1,rM=new Uint32Array;var rA={};Object.defineProperty(rA,"__esModule",{value:!0}),rA.poly1305=void 0,rA.wrapConstructorWithKey=rP;let rI=(e,t)=>255&e[t++]|(255&e[t++])<<8;class rR{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,es.toBytes)(e),(0,el.bytes)(e,32);let t=rI(e,0),n=rI(e,2),r=rI(e,4),i=rI(e,6),o=rI(e,8),a=rI(e,10),s=rI(e,12),l=rI(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|a<<2),this.r[7]=8065&(a>>>11|s<<5),this.r[8]=8191&(s>>>8|l<<8),this.r[9]=l>>>5&127;for(let t=0;t<8;t++)this.pad[t]=rI(e,16+2*t)}process(e,t,n=!1){let{h:r,r:i}=this,o=i[0],a=i[1],s=i[2],l=i[3],c=i[4],d=i[5],u=i[6],h=i[7],f=i[8],p=i[9],g=rI(e,t+0),m=rI(e,t+2),y=rI(e,t+4),v=rI(e,t+6),b=rI(e,t+8),E=rI(e,t+10),w=rI(e,t+12),S=rI(e,t+14),_=r[0]+(8191&g),C=r[1]+(8191&(g>>>13|m<<3)),x=r[2]+(8191&(m>>>10|y<<6)),k=r[3]+(8191&(y>>>7|v<<9)),M=r[4]+(8191&(v>>>4|b<<12)),A=r[5]+(b>>>1&8191),I=r[6]+(8191&(b>>>14|E<<2)),R=r[7]+(8191&(E>>>11|w<<5)),P=r[8]+(8191&(w>>>8|S<<8)),T=r[9]+(S>>>5|(n?0:2048)),O=0,L=0+_*o+5*p*C+5*f*x+5*h*k+5*u*M;O=L>>>13,L&=8191,L+=5*d*A+5*c*I+5*l*R+5*s*P+5*a*T,O+=L>>>13,L&=8191;let N=O+_*a+C*o+5*p*x+5*f*k+5*h*M;O=N>>>13,N&=8191,N+=5*u*A+5*d*I+5*c*R+5*l*P+5*s*T,O+=N>>>13,N&=8191;let $=O+_*s+C*a+x*o+5*p*k+5*f*M;O=$>>>13,$&=8191,$+=5*h*A+5*u*I+5*d*R+5*c*P+5*l*T,O+=$>>>13,$&=8191;let D=O+_*l+C*s+x*a+k*o+5*p*M;O=D>>>13,D&=8191,D+=5*f*A+5*h*I+5*u*R+5*d*P+5*c*T,O+=D>>>13,D&=8191;let B=O+_*c+C*l+x*s+k*a+M*o;O=B>>>13,B&=8191,B+=5*p*A+5*f*I+5*h*R+5*u*P+5*d*T,O+=B>>>13,B&=8191;let K=O+_*d+C*c+x*l+k*s+M*a;O=K>>>13,K&=8191,K+=A*o+5*p*I+5*f*R+5*h*P+5*u*T,O+=K>>>13,K&=8191;let U=O+_*u+C*d+x*c+k*l+M*s;O=U>>>13,U&=8191,U+=A*a+I*o+5*p*R+5*f*P+5*h*T,O+=U>>>13,U&=8191;let j=O+_*h+C*u+x*d+k*c+M*l;O=j>>>13,j&=8191,j+=A*s+I*a+R*o+5*p*P+5*f*T,O+=j>>>13,j&=8191;let H=O+_*f+C*h+x*u+k*d+M*c;O=H>>>13,H&=8191,H+=A*l+I*s+R*a+P*o+5*p*T,O+=H>>>13,H&=8191;let F=O+_*p+C*f+x*h+k*u+M*d;O=F>>>13,F&=8191,F+=A*c+I*l+R*s+P*a+T*o,O+=F>>>13,F&=8191,L=8191&(O=(O=(O<<2)+O|0)+L|0),O>>>=13,N+=O,r[0]=L,r[1]=N,r[2]=$,r[3]=D,r[4]=B,r[5]=K,r[6]=U,r[7]=j,r[8]=H,r[9]=F}finalize(){let{h:e,pad:t}=this,n=new Uint16Array(10),r=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=r,r=e[t]>>>13,e[t]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let t=1;t<10;t++)n[t]=e[t]+r,r=n[t]>>>13,n[t]&=8191;n[9]-=8192;let i=(1^r)-1;for(let e=0;e<10;e++)n[e]&=i;i=~i;for(let t=0;t<10;t++)e[t]=e[t]&i|n[t];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let n=1;n<8;n++)o=(e[n]+t[n]|0)+(o>>>16)|0,e[n]=65535&o;(0,es.clean)(n)}update(e){(0,el.exists)(this);let{buffer:t,blockLen:n}=this,r=(e=(0,es.toBytes)(e)).length;for(let i=0;i<r;){let o=Math.min(n-this.pos,r-i);if(o!==n)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(e,i)}return this}destroy(){(0,es.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,el.exists)(this),(0,el.output)(e,this),this.finished=!0;let{buffer:t,h:n}=this,{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let t=0;t<8;t++)e[i++]=n[t]>>>0,e[i++]=n[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}}function rP(e){let t=(t,n)=>e(n).update((0,es.toBytes)(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}rA.poly1305=rP(e=>new rR(e)),function(e){function t(e,t,n,r,i,o=20){let a=e[0],s=e[1],l=e[2],c=e[3],d=t[0],u=t[1],h=t[2],f=t[3],p=t[4],g=t[5],m=t[6],y=t[7],v=n[0],b=n[1],E=n[2],w=a,S=s,_=l,C=c,x=d,k=u,M=h,A=f,I=p,R=g,P=m,T=y,O=i,L=v,N=b,$=E;for(let e=0;e<o;e+=2)w=w+x|0,I=I+(O=(0,rg.rotl)(O^w,16))|0,w=w+(x=(0,rg.rotl)(x^I,12))|0,I=I+(O=(0,rg.rotl)(O^w,8))|0,x=(0,rg.rotl)(x^I,7),S=S+k|0,R=R+(L=(0,rg.rotl)(L^S,16))|0,S=S+(k=(0,rg.rotl)(k^R,12))|0,R=R+(L=(0,rg.rotl)(L^S,8))|0,k=(0,rg.rotl)(k^R,7),_=_+M|0,P=P+(N=(0,rg.rotl)(N^_,16))|0,_=_+(M=(0,rg.rotl)(M^P,12))|0,P=P+(N=(0,rg.rotl)(N^_,8))|0,M=(0,rg.rotl)(M^P,7),C=C+A|0,T=T+($=(0,rg.rotl)($^C,16))|0,C=C+(A=(0,rg.rotl)(A^T,12))|0,T=T+($=(0,rg.rotl)($^C,8))|0,A=(0,rg.rotl)(A^T,7),w=w+k|0,P=P+($=(0,rg.rotl)($^w,16))|0,w=w+(k=(0,rg.rotl)(k^P,12))|0,P=P+($=(0,rg.rotl)($^w,8))|0,k=(0,rg.rotl)(k^P,7),S=S+M|0,T=T+(O=(0,rg.rotl)(O^S,16))|0,S=S+(M=(0,rg.rotl)(M^T,12))|0,T=T+(O=(0,rg.rotl)(O^S,8))|0,M=(0,rg.rotl)(M^T,7),_=_+A|0,I=I+(L=(0,rg.rotl)(L^_,16))|0,_=_+(A=(0,rg.rotl)(A^I,12))|0,I=I+(L=(0,rg.rotl)(L^_,8))|0,A=(0,rg.rotl)(A^I,7),C=C+x|0,R=R+(N=(0,rg.rotl)(N^C,16))|0,C=C+(x=(0,rg.rotl)(x^R,12))|0,R=R+(N=(0,rg.rotl)(N^C,8))|0,x=(0,rg.rotl)(x^R,7);let D=0;r[D++]=a+w|0,r[D++]=s+S|0,r[D++]=l+_|0,r[D++]=c+C|0,r[D++]=d+x|0,r[D++]=u+k|0,r[D++]=h+M|0,r[D++]=f+A|0,r[D++]=p+I|0,r[D++]=g+
1R|0,r[D++]=m+P|0,r[D++]=y+T|0,r[D++]=i+O|0,r[D++]=v+L|0,r[D++]=b+N|0,r[D++]=E+$|0}function n(e,t,n,r){let i=e[0],o=e[1],a=e[2],s=e[3],l=t[0],c=t[1],d=t[2],u=t[3],h=t[4],f=t[5],p=t[6],g=t[7],m=n[0],y=n[1],v=n[2],b=n[3];for(let e=0;e<20;e+=2)i=i+l|0,h=h+(m=(0,rg.rotl)(m^i,16))|0,i=i+(l=(0,rg.rotl)(l^h,12))|0,h=h+(m=(0,rg.rotl)(m^i,8))|0,l=(0,rg.rotl)(l^h,7),o=o+c|0,f=f+(y=(0,rg.rotl)(y^o,16))|0,o=o+(c=(0,rg.rotl)(c^f,12))|0,f=f+(y=(0,rg.rotl)(y^o,8))|0,c=(0,rg.rotl)(c^f,7),a=a+d|0,p=p+(v=(0,rg.rotl)(v^a,16))|0,a=a+(d=(0,rg.rotl)(d^p,12))|0,p=p+(v=(0,rg.rotl)(v^a,8))|0,d=(0,rg.rotl)(d^p,7),s=s+u|0,g=g+(b=(0,rg.rotl)(b^s,16))|0,s=s+(u=(0,rg.rotl)(u^g,12))|0,g=g+(b=(0,rg.rotl)(b^s,8))|0,u=(0,rg.rotl)(u^g,7),i=i+c|0,p=p+(b=(0,rg.rotl)(b^i,16))|0,i=i+(c=(0,rg.rotl)(c^p,12))|0,p=p+(b=(0,rg.rotl)(b^i,8))|0,c=(0,rg.rotl)(c^p,7),o=o+d|0,g=g+(m=(0,rg.rotl)(m^o,16))|0,o=o+(d=(0,rg.rotl)(d^g,12))|0,g=g+(m=(0,rg.rotl)(m^o,8))|0,d=(0,rg.rotl)(d^g,7),a=a+u|0,h=h+(y=(0,rg.rotl)(y^a,16))|0,a=a+(u=(0,rg.rotl)(u^h,12))|0,h=h+(y=(0,rg.rotl)(y^a,8))|0,u=(0,rg.rotl)(u^h,7),s=s+l|0,f=f+(v=(0,rg.rotl)(v^s,16))|0,s=s+(l=(0,rg.rotl)(l^f,12))|0,f=f+(v=(0,rg.rotl)(v^s,8))|0,l=(0,rg.rotl)(l^f,7);let E=0;r[E++]=i,r[E++]=o,r[E++]=a,r[E++]=s,r[E++]=m,r[E++]=y,r[E++]=v,r[E++]=b}Object.defineProperty(e,"__esModule",{value:!0}),e.xchacha20poly1305=e.chacha20poly1305=e._poly1305_aead=e.chacha12=e.chacha8=e.xchacha20=e.chacha20=e.chacha20orig=void 0,e.hchacha=n,e.chacha20orig=(0,rg.createCipher)(t,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,rg.createCipher)(t,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,rg.createCipher)(t,{counterRight:!1,counterLength:8,extendNonceFn:n,allowShortKeys:!1}),e.chacha8=(0,rg.createCipher)(t,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,rg.createCipher)(t,{counterRight:!1,counterLength:4,rounds:12});let r=new Uint8Array(16),i=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(r.subarray(n))},o=new Uint8Array(32);function a(e,t,n,r,a){let s=e(t,n,o),l=rA.poly1305.create(s);a&&i(l,a),i(l,r);let c=new Uint8Array(16),d=(0,es.createView)(c);(0,es.setBigUint64)(d,0,BigInt(a?a.length:0),!0),(0,es.setBigUint64)(d,8,BigInt(r.length),!0),l.update(c);let u=l.digest();return(0,es.clean)(s,c),u}e._poly1305_aead=e=>(t,n,r)=>((0,el.bytes)(t,32),(0,el.bytes)(n),{encrypt(i,o){let s=i.length,l=s+16;o?(0,el.bytes)(o,l):o=new Uint8Array(l),e(t,n,i,o,1);let c=a(e,t,n,o.subarray(0,-16),r);return o.set(c,s),(0,es.clean)(c),o},decrypt(i,o){let s=i.length,l=s-16;if(s<16)throw Error("encrypted data must be at least 16 bytes");o?(0,el.bytes)(o,l):o=new Uint8Array(l);let c=i.subarray(0,-16),d=i.subarray(-16),u=a(e,t,n,c,r);if(!(0,es.equalBytes)(d,u))throw Error("invalid tag");return e(t,n,c,o,1),(0,es.clean)(u),o}}),e.chacha20poly1305=(0,es.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,es.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))}(rp),Object.defineProperty(rf,"__esModule",{value:!0}),rf.xchacha20=void 0,rf.xchacha20=function(e,t,n){return(0,rp.xchacha20poly1305)(e,t,n)},function(e){function t(e,t,n,r){var i=(0,em.symmetricAlgorithm)();if("aes-256-gcm"===i)return e(nN.aes256gcm,t,n,(0,em.symmetricNonceLength)(),ey.AEAD_TAG_LENGTH,r);if("xchacha20"===i)return e(rf.xchacha20,t,n,ey.XCHACHA20_NONCE_LENGTH,ey.AEAD_TAG_LENGTH,r);if("aes-256-cbc"===i)return e(nN.aes256cbc,t,n,16,0);throw Error("Not implemented")}function n(e,t,n,r,i,o){var a=(0,eS.randomBytes)(r),s=e(t,a,o).encrypt(n);if(0===i)return(0,es.concatBytes)(a,s);var l=s.length-i,c=s.subarray(0,l),d=s.subarray(l);return(0,es.concatBytes)(a,d,c)}function r(e,t,n,r,i,o){var a=n.subarray(0,r),s=e(t,Uint8Array.from(a),o),l=n.subarray(r);if(0===i)return s.decrypt(l);var c=l.subarray(0,i),d=l.subarray(i);return s.decrypt((0,es.concatBytes)(d,c))}Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0,e.symEncrypt=function(e,r,i){return t(n,e,r,i)},e.symDecrypt=function(e,n,i){return t(r,e,n,i)},e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt}(nL),iK=er&&er.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);
1i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),iU=er&&er.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||iK(t,e,n)},Object.defineProperty(eE,"__esModule",{value:!0}),iU(ew,eE),iU(nA,eE),iU(nM,eE),iU(nL,eE);var rT={};Object.defineProperty(rT,"__esModule",{value:!0}),rT.PublicKey=void 0;var rO=function(){function e(e){this.data=(0,eE.convertPublicKeyFormat)(e,!0)}return e.fromHex=function(t){return new e((0,eE.hexToPublicKey)(t))},Object.defineProperty(e.prototype,"uncompressed",{get:function(){return I.from((0,eE.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compressed",{get:function(){return I.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(e){return void 0===e&&(e=!0),(0,es.bytesToHex)(e?this.data:this.uncompressed)},e.prototype.decapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.data:this.uncompressed,r=e.multiply(this,t);return(0,eE.getSharedKey)(n,r)},e.prototype.equals=function(e){return(0,es.equalBytes)(this.data,e.data)},e}();rT.PublicKey=rO,Object.defineProperty(eb,"__esModule",{value:!0}),eb.PrivateKey=void 0;var rL=function(){function e(e){if(void 0===e)this.data=(0,eE.getValidSecret)();else{if(!(0,eE.isValidPrivateKey)(e))throw Error("Invalid private key");this.data=e}this.publicKey=new rT.PublicKey((0,eE.getPublicKey)(this.data))}return e.fromHex=function(t){return new e((0,eE.decodeHex)(t))},Object.defineProperty(e.prototype,"secret",{get:function(){return I.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,es.bytesToHex)(this.data)},e.prototype.encapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.publicKey.compressed:this.publicKey.uncompressed,r=this.multiply(e,t);return(0,eE.getSharedKey)(n,r)},e.prototype.multiply=function(e,t){return void 0===t&&(t=!1),(0,eE.getSharedPoint)(this.data,e.compressed,t)},e.prototype.equals=function(e){return(0,es.equalBytes)(this.data,e.data)},e}();
1eb.PrivateKey=rL,Object.defineProperty(ev,"__esModule",{value:!0}),ev.PublicKey=ev.PrivateKey=void 0,Object.defineProperty(ev,"PrivateKey",{enumerable:!0,get:function(){return eb.PrivateKey}}),Object.defineProperty(ev,"PublicKey",{enumerable:!0,get:function(){return rT.PublicKey}}),Object.defineProperty(ea,"__esModule",{value:!0}),ea.utils=ea.PublicKey=ea.PrivateKey=ea.ECIES_CONFIG=void 0,ea.encrypt=function(e,t){var n=new iF.PrivateKey,r=e instanceof Uint8Array?new iF.PublicKey(e):iF.PublicKey.fromHex(e),i=n.encapsulate(r,(0,iH.isHkdfKeyCompressed)()),o=(0,iH.isEphemeralKeyCompressed)()?n.publicKey.compressed:n.publicKey.uncompressed,a=(0,iz.symEncrypt)(i,t);return I.from((0,ij.concatBytes)(o,a))},ea.decrypt=function(e,t){var n=e instanceof Uint8Array?new iF.PrivateKey(e):iF.PrivateKey.fromHex(e),r=(0,iH.ephemeralKeySize)(),i=new iF.PublicKey(t.subarray(0,r)),o=t.subarray(r),a=i.decapsulate(n,(0,iH.isHkdfKeyCompressed)());return I.from((0,iz.symDecrypt)(a,o))},ij=es,iH=em,iF=ev,iz=eE,Object.defineProperty(ea,"ECIES_CONFIG",{enumerable:!0,get:function(){return em.ECIES_CONFIG}}),Object.defineProperty(ea,"PrivateKey",{enumerable:!0,get:function(){return ev.PrivateKey}}),Object.defineProperty(ea,"PublicKey",{enumerable:!0,get:function(){return ev.PublicKey}}),ea.utils={aesEncrypt:iz.aesEncrypt,aesDecrypt:iz.aesDecrypt,symEncrypt:iz.symEncrypt,symDecrypt:iz.symDecrypt,decodeHex:iz.decodeHex,getValidSecret:iz.getValidSecret,remove0x:iz.remove0x};let rN=l()("KeyExchange:Layer"),r$=l()("SocketService:Layer"),rD=l()("Ecies:Layer"),rB=l()("RemoteCommunication:Layer");rN.color="##95c44e",r$.color="#f638d7",rD.color="#465b9c",rB.color="#47a2be";let rK={KeyExchange:rN,SocketService:r$,Ecies:rD,RemoteCommunication:rB},rU,rj=[],rH=[],rF=(e,t)=>p(void 0,void 0,void 0,function*(){rU=t,rH.push(e),(function(e){return p(this,void 0,void 0,function*(){if(!rU||!e)return;!function(){let e=rH;rH=rj,rj=e}();let t=rU.endsWith("/")?`${rU}evt`:`${rU}/evt`,n=Object.assign({},e);if(delete n.params,e.params)for(let[t,r]of Object.entries(e.params))n[t]=r;let r=JSON.stringify(n);rK.RemoteCommunication(`[sendBufferedEvents] Sending ${rj.length} analytics events to ${t}`);try{let e=yield a()(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),n=yield e.text();rK.RemoteCommunication(`[sendBufferedEvents] Response: ${n}`),rj.length=0}catch(e){}})})(e).catch(()=>{})});class rz{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&l().enable("Ecies:Layer"),this.ecies=(null==e?void 0:e.privateKey)?ea.PrivateKey.fromHex(e.privateKey):new ea.PrivateKey,rK.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),rK.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),rK.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new ea.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{rK.Ecies("[ECIES: encrypt()] using otherPublicKey",t);let r=I.from(e),i=ea.encrypt(t,r);n=I.from(i).toString("base64")}catch(n){throw rK.Ecies("[ECIES: encrypt()] error encrypt:",n),rK.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),rK.Ecies("[ECIES: encrypt()] data: ",e),rK.Ecies("[ECIES: encrypt()] otherkey: ",t),n}return n}decrypt(e){let t=e;if(this.enabled)try{rK.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());let n=I.from(e.toString(),"base64");t=ea.decrypt(this.ecies.toHex(),n).toString()}catch(t){throw rK.Ecies("[ECIES: decrypt()] error decrypt",t),rK.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),rK.Ecies("[ECIES: decrypt()] encryptedData: ",e),t}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){rK.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var rq={version:"0.32.0"};let rW="https://metamask-sdk.api.cx.metamask.io/",rV=["websocket"],rG={ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function rY(e){let{context:t}=e;rK.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}(i5=iX||(iX={})).DISCONNECTED="disconnected",i5.WAITING="waiting",i5.TIMEOUT="timeout",i5.LINKED="linked",i5.PAUSED="paused",i5.TERMINATED="terminated",(iq=iQ||(iQ={})).KEY_INFO="key_info",iq.SERVICE_STATUS="service_status",iq.PROVIDER_UPDATE="provider_update",iq.RPC_UPDATE="rpc_update",iq.KEY
1S_EXCHANGED="keys_exchanged",iq.JOIN_CHANNEL="join_channel",iq.PUBLIC_KEY="public_key",iq.CHANNEL_CREATED="channel_created",iq.CLIENTS_CONNECTED="clients_connected",iq.CLIENTS_DISCONNECTED="clients_disconnected",iq.CLIENTS_WAITING="clients_waiting",iq.CLIENTS_READY="clients_ready",iq.REJECTED="rejected",iq.WALLET_INIT="wallet_init",iq.CHANNEL_PERSISTENCE="channel_persistence",iq.CONFIG="config",iq.MESSAGE_ACK="ack",iq.SOCKET_DISCONNECTED="socket_disconnected",iq.SOCKET_RECONNECT="socket_reconnect",iq.OTP="otp",iq.SDK_RPC_CALL="sdk_rpc_call",iq.AUTHORIZED="authorized",iq.CONNECTION_STATUS="connection_status",iq.MESSAGE="message",iq.TERMINATE="terminate",(i0||(i0={})).KEY_EXCHANGE="key_exchange",(iW=i1||(i1={})).KEY_HANDSHAKE_START="key_handshake_start",iW.KEY_HANDSHAKE_CHECK="key_handshake_check",iW.KEY_HANDSHAKE_SYN="key_handshake_SYN",iW.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",iW.KEY_HANDSHAKE_ACK="key_handshake_ACK",iW.KEY_HANDSHAKE_WALLET="key_handshake_wallet",iW.KEY_HANDSHAKE_NONE="none";class rZ extends c.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}
1){super(),this.keysExchanged=!1,this.step=i1.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(rK.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new rz(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(i0.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){let{relayPersistence:t}=this.communicationLayer.remote.state;if(rK.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${t}`,e),t)return void rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");let{message:n}=e;this.keysExchanged&&rK.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(iQ.KEY_INFO,n.type),n.type===i1.KEY_HANDSHAKE_SYN?(this.checkStep([i1.KEY_HANDSHAKE_NONE,i1.KEY_HANDSHAKE_ACK]),rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:i1.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(e=>{rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",e)}),this.setStep(i1.KEY_HANDSHAKE_ACK)):n.type===i1.KEY_HANDSHAKE_SYNACK?(this.checkStep([i1.KEY_HANDSHAKE_SYNACK,i1.KEY_HANDSHAKE_ACK,i1.KEY_HANDSHAKE_NONE]),rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:i1.KEY_HANDSHAKE_ACK}).catch(e=>{rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",e)}),this.keysExchanged=!0,this.setStep(i1.KEY_HANDSHAKE_ACK),this.emit(iQ.KEYS_EXCHANGED)):n.type===i1.KEY_HANDSHAKE_ACK&&(rK.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([i1.KEY_HANDSHAKE_ACK,i1.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(i1.KEY_HANDSHAKE_ACK),this.emit(iQ.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new rz(e)}clean(){rK.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(i1.KEY_HANDSHAKE_NONE),this.emit(iQ.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){let{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state;n?rK.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(rK.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==i1.KEY_HANDSHAKE_NONE&&this.step!==i1.KEY_HANDSHAKE_SYNACK)||t?(rK.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(i1.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:i1.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(e=>{rK.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",e)})):rK.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?rK.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):r>=2?this.communicationLayer.sendMessage({type:i1.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(e=>{rK.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",e)}):(this.communicationLayer.sendMessage({type:i1.KEY_HANDSHAKE_START}).catch(e=>{rK.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",e)}),this.clean()))}
1setStep(e){this.step=e,this.emit(iQ.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new rz({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){rK.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){return JSON.stringify({keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step})}}(iV=i2||(i2={})).TERMINATE="terminate",iV.ANSWER="answer",iV.OFFER="offer",iV.CANDIDATE="candidate",iV.JSONRPC="jsonrpc",iV.WALLET_INFO="wallet_info",iV.WALLET_INIT="wallet_init",iV.ORIGINATOR_INFO="originator_info",iV.PAUSE="pause",iV.OTP="otp",iV.AUTHORIZED="authorized",iV.PING="ping",iV.READY="ready",(iG=i3||(i3={})).REQUEST="sdk_connect_request_started",iG.REQUEST_MOBILE="sdk_connect_request_started_mobile",iG.RECONNECT="sdk_reconnect_request_started",iG.CONNECTED="sdk_connection_established",iG.CONNECTED_MOBILE="sdk_connection_established_mobile",iG.AUTHORIZED="sdk_connection_authorized",iG.REJECTED="sdk_connection_rejected",iG.TERMINATED="sdk_connection_terminated",iG.DISCONNECTED="sdk_disconnected",iG.SDK_USE_EXTENSION="sdk_use_extension",iG.SDK_RPC_REQUEST="sdk_rpc_request",iG.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",iG.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",iG.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",iG.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser";let rJ=(e,t,n)=>p(void 0,void 0,void 0,function*(){var r,i,o,a,s,l;let{remote:c,state:d}=e,{channelId:u,isOriginator:h}=d;if("error_terminated"===t)return rK.SocketService(`handleJoinChannelResults: Channel ${u} terminated`),void e.emit(iQ.TERMINATE);if(!n)return void rK.SocketService(`handleJoinChannelResults: No result for channel ${u}`);let{persistence:f,walletKey:p,rejected:g}=n;if(rK.SocketService(`handleJoinChannelResults: Channel ${u} persistence=${f} walletKey=${p} rejected=${g}`),g)return rK.SocketService(`handleJoinChannelResults: Channel ${u} rejected`),yield e.remote.disconnect({terminate:!0}),e.remote.emit(iQ.REJECTED,{channelId:u}),void e.remote.emitServiceStatusEvent();if(p&&!(null===(r=c.state.channelConfig)||void 0===r?void 0:r.otherKey)){e.getKeyExchange().setOtherPublicKey(p),null===(i=e.state.keyExchange)||void 0===i||i.setKeysExchanged(!0),c.state.ready=!0,c.state.authorized=!0,c.emit(iQ.AUTHORIZED);let{communicationLayer:t,storageManager:n}=c.state,r=Object.assign(Object.assign({},c.state.channelConfig),{channelId:null!==(o=c.state.channelId)&&void 0!==o?o:"",validUntil:Date.now()+6048e5,localKey:null==t?void 0:t.getKeyInfo().ecies.private,otherKey:p});e.sendMessage({type:i1.KEY_HANDSHAKE_ACK}).catch(e=>{}),null===(a=e.state.socket)||void 0===a||a.emit(i2.PING,{id:u,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield null==n?void 0:n.persistChannelConfig(r),c.emitServiceStatusEvent(),c.setConnectionStatus(iX.LINKED)}f&&(e.emit(iQ.CHANNEL_PERSISTENCE),null===(s=e.state.keyExchange)||void 0===s||s.setKeysExchanged(!0),c.state.ready=!0,c.state.authorized=!0,c.emit(iQ.AUTHORIZED),rF(Object.assign(Object.assign({id:null!=u?u:"",event:h?i3.CONNECTED:i3.CONNECTED_MOBILE},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:rq.version,walletVersion:null===(l=e.remote.state.walletInfo)||void 0===l?void 0:l.version}),d.communicationServerUrl).catch(e=>{}))}),rX=e=>new Promise(t=>{setTimeout(t,e)}),rQ=(e,t,...n)=>p(void 0,[e,t,...n],void 0,function*(e,t,n=200){let r;let i=Date.now(),o=!1;for(;!o;){if(o=Date.now()-i>3e5,void 0!==(r=t[e]).elapsedTime)return r;yield rX(n)}throw Error(`RPC ${e} timed out`)}),r0=e=>p(void 0,void 0,void 0,function*(){let{state:t}=e,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:a}=t;if(a)return rK.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",e),!1;if(!n)return rK.SocketService("[SocketService: reconnectSocket()] socket is not defined",e),!1;if(!r)return!1;let{connected:s}=n;t.isReconnecting=!0,t.reconnectionAttempts=0,rK.SocketService(`[SocketService: reconnectSocket()] connected=${s}
1 trying to reconnect after socketio disconnection`,e);try{for(;3>t.reconnectionAttempts;){if(rK.SocketService(`[SocketService: reconnectSocket()] Attempt ${t.reconnectionAttempts+1} of 3`,e),yield rX(200),n.connected)return rK.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(i2.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;t.resumed=!0,n.connect(),e.emit(iQ.SOCKET_RECONNECT);try{if(yield new Promise((t,a)=>{n.emit(iQ.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(n,r)=>p(void 0,void 0,void 0,function*(){try{yield rJ(e,n,r),t()}catch(e){a(e)}}))}),yield rX(100),n.connected)return rK.SocketService(`Reconnection successful on attempt ${t.reconnectionAttempts+1}`),!0}catch(e){rK.SocketService(`Error during reconnection attempt ${t.reconnectionAttempts+1}:`,e)}t.reconnectionAttempts+=1,3>t.reconnectionAttempts&&(yield rX(200))}return rK.SocketService("Failed to reconnect after 3 attempts"),!1}finally{t.isReconnecting=!1,t.reconnectionAttempts=0}});function r1(e,t){return p(this,void 0,void 0,function*(){var n;let r=null===(n=e.state.keyExchange)||void 0===n?void 0:n.encryptMessage(JSON.stringify(t)),i={id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:r,plaintext:e.state.hasPlaintext?JSON.stringify(t):void 0};return rK.SocketService(`[SocketService: encryptAndSendMessage()] context=${e.state.context}`,i),t.type===i2.TERMINATE&&(e.state.manualDisconnect=!0),new Promise((t,n)=>{var r;null===(r=e.state.socket)||void 0===r||r.emit(iQ.MESSAGE,i,(e,r)=>{var i;e&&(rK.SocketService(`[SocketService: encryptAndSendMessage()] error=${e}`),n(e)),rK.SocketService("[encryptAndSendMessage] response",r),t(null!==(i=null==r?void 0:r.success)&&void 0!==i&&i)})})})}(iY=i8||(i8={})).RPC_CHECK="rpcCheck",iY.SKIPPED_RPC="skippedRpc";let r2=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase()),r3=[{event:iQ.CLIENTS_CONNECTED,handler:function(e,t){return n=>p(this,void 0,void 0,function*(){var n,r,i,o,a,s,l,c,d,u,h;let f=null!==(r=null===(n=e.remote.state.channelConfig)||void 0===n?void 0:n.relayPersistence)&&void 0!==r&&r;if(rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected-${t}' relayPersistence=${f} resumed=${e.state.resumed} clientsPaused=${e.state.clientsPaused} keysExchanged=${null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(iQ.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:null===(o=e.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged(),context:e.state.context}),e.state.resumed)e.state.isOriginator||(rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} 'clients_connected' / keysExchanged=${null===(a=e.state.keyExchange)||void 0===a?void 0:a.areKeysExchanged()} -- backward compatibility`),null===(s=e.state.keyExchange)||void 0===s||s.start({isOriginator:null!==(l=e.state.isOriginator)&&void 0!==l&&l})),e.state.resumed=!1;else if(e.state.clientsPaused)rK.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!e.state.isOriginator){let t=!f;rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null===(c=e.state.keyExchange)||void 0===c?void 0:c.areKeysExchanged()} -- force=${t} -- backward compatibility`),rK.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null===(d=e.state.keyExchange)||void 0===d?void 0:d.areKeysExchanged()} -- force=${t} -- backward compatibility`),null===(u=e.state.keyExchange)||void 0===u||u.start({isOriginator:null!==(h=e.state.isOriginator)&&void 0!==h&&h,force:t})}e.state.clientsConnected=!0,e.state.clientsPaused=!1})}},{event:iQ.CHANNEL_CREATED,handler:function(e,t){return n=>{rK.SocketService(`[SocketService: handleChannelCreated()] context=${e.state.context} on 'channel_created-${t}'`,n),e.emit(iQ.CHANNEL_CREATED,n)}}},{event:iQ.CLIENTS_DISCONNECTED,handler:function(e,t){return()=>{var n;e.state.clientsConnected=!1,rK.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}'`),e.remote.state.relayPersistence?rK.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}' - relayPersistence enabled, skipping key exchange cleanup.`):(e.state.isOriginator&&!e.state.clientsPaused&&(null===(n=e.state.keyExchange)||void 0===n||n.clean()),e.emit(iQ.CLIENTS_DISCONNECTED,t))}}},{event:iQ.CONFIG,handler:function(e,t){return n=>p(this,void 0,void 0,function*(){var r,i,o;rK.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${t}'`,n);let{persistence:a,walletKey:s}=n;e.state.isOriginator&&e.remote.state.channelConfig?(n.walletKey&&!e.remote.state.channelConfig.otherKey&&(rK.SocketService(`Setting wallet key ${s}`),e.remote.state.channelConfig.otherKey=s,e.getKeyExchange().setOtherPublicKey(n.walletKey),null===(r=e.state.keyExchange)||void 0===r||r.setKeysExchanged(!0),yield e.remote.sendMessage({type:i1.KEY_HANDSHAKE_ACK}),yield e.remote.sendMessage({type:i2.PING}),yield null===(i=e.remote.state.storageManager)||void 0===i?void 0:i.persist
1ChannelConfig(e.remote.state.channelConfig)),!0!==a||e.remote.state.channelConfig.relayPersistence||(rK.SocketService(`Setting relay persistence ${a}`),e.remote.state.channelConfig.relayPersistence=a,e.remote.state.relayPersistence=!0,e.remote.emit(iQ.CHANNEL_PERSISTENCE),e.remote.state.authorized=!0,e.remote.state.ready=!0,e.remote.emit(iQ.AUTHORIZED),yield null===(o=e.remote.state.storageManager)||void 0===o?void 0:o.persistChannelConfig(e.remote.state.channelConfig))):e.state.isOriginator||n.persistence&&(e.remote.state.relayPersistence=!0,e.remote.emit(iQ.CHANNEL_PERSISTENCE))})}},{event:iQ.MESSAGE,handler:function(e,t){return n=>{var r,i,o,a,s,l,c,d,u,h,f,p,g,m,y,v,b,E;let{ackId:w,message:S,error:_}=n,C=null!==(r=e.remote.state.relayPersistence)&&void 0!==r&&r;if(rK.SocketService(`[SocketService handleMessage()] relayPersistence=${C} context=${e.state.context} on 'message' ${t} keysExchanged=${null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged()}`,n),_)throw rK.SocketService(` 2 [SocketService handleMessage()] context=${e.state.context}::on 'message' error=${_}`),Error(_);let x="string"==typeof S;if(!x&&(null==S?void 0:S.type)===i1.KEY_HANDSHAKE_START){if(C)return;return rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,S),void(null===(o=e.state.keyExchange)||void 0===o||o.start({isOriginator:null!==(a=e.state.isOriginator)&&void 0!==a&&a,force:!0}))}if(!x&&(null===(s=null==S?void 0:S.type)||void 0===s?void 0:s.startsWith("key_handshake"))){if(C)return;return rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' emit KEY_EXCHANGE`,S),void e.emit(i0.KEY_EXCHANGE,{message:S,context:e.state.context})}if(!x||(null===(l=e.state.keyExchange)||void 0===l?void 0:l.areKeysExchanged())){if(!x&&(null==S?void 0:S.type))return void e.emit(iQ.MESSAGE,S)}else{let t=!1;try{rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' trying to decrypt message`),null===(c=e.state.keyExchange)||void 0===c||c.decryptMessage(S),t=!0}catch(t){rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' error`,t)}if(!t)return e.state.isOriginator?null===(u=e.state.keyExchange)||void 0===u||u.start({isOriginator:null!==(h=e.state.isOriginator)&&void 0!==h&&h}):e.sendMessage({type:i1.KEY_HANDSHAKE_START}).catch(e=>{}),void rK.SocketService(`Message ignored because invalid key exchange status. step=${null===(f=e.state.keyExchange)||void 0===f?void 0:f.getKeyInfo().step}`,null===(p=e.state.keyExchange)||void 0===p?void 0:p.getKeyInfo(),S);rK.SocketService("Invalid key exchange status detected --- updating it."),null===(d=e.state.keyExchange)||void 0===d||d.setKeysExchanged(!0)}if(!x)return void e.emit(iQ.MESSAGE,S);let k=null===(g=e.state.keyExchange)||void 0===g?void 0:g.decryptMessage(S),M=JSON.parse(null!=k?k:"{}");if(w&&(null==w?void 0:w.length)>0&&(rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' ackid=${w} channelId=${t}`),null===(m=e.state.socket)||void 0===m||m.emit(iQ.MESSAGE_ACK,{ackId:w,channelId:t,clientType:e.state.isOriginator?"dapp":"wallet"})),e.state.clientsPaused=(null==M?void 0:M.type)===i2.PAUSE,e.state.isOriginator&&M.data){let t=M.data,n=e.state.rpcMethodTracker[t.id];if(n){let r=Date.now()-n.timestamp;rK.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received answer for id=${t.id} method=${n.method} responseTime=${r}`,M),e.remote.state.analytics&&r2.includes(n.method.toLowerCase())&&rF(Object.assign(Object.assign({id:null!==(y=e.remote.state.channelId)&&void 0!==y?y:"",event:i3.SDK_RPC_REQUEST_DONE,sdkVersion:e.remote.state.sdkVersion,commLayerVersion:rq.version},e.remote.state.originatorInfo),{walletVersion:null===(v=e.remote.state.walletInfo)||void 0===v?void 0:v.version,params:{method:n.method,from:"mobile"}}),e.remote.state.communicationServerUrl).catch(e=>{});let i=Object.assign(Object.assign({},n),{result:t.result,error:t.error?{code:null===(b=t.error)||void 0===b?void 0:b.code,message:null===(E=t.error)||void 0===E?void 0:E.message}:void 0,elapsedTime:r});e.state.rpcMethodTracker[t.id]=i,e.emit(iQ.RPC_UPDATE,i)}}e.emit(iQ.MESSAGE,{message:M})}}},{event:iQ.REJECTED,handler:function(e,t){return n=>p(this,void 0,void 0,function*(){var n;e.state.isOriginator&&!e.remote.state.ready?(rK.SocketService(`[SocketService: handleChannelRejected()] context=${e.state.context} channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`,e.remote.state.originatorInfo),rF(Object.assign(Object.assign({id:t,event:i3.REJECTED},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:rq.version,walletVersion:null===(n=e.remote.state.walletInfo)||void 0===n?void 0:n.version}),e.remote.state.communicationServerUrl).catch(e=>{}),yield e.remote.disconnect({terminate:!0}
2),e.remote.emit(iQ.REJECTED,{channelId:t}),e.remote.setConnectionStatus(iX.DISCONNECTED)):rK.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`)})}},{event:"clients_waiting_to_join",handler:function(e,t){return n=>{rK.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${e.state.context} on 'clients_waiting_to_join-${t}'`,n),e.emit(iQ.CLIENTS_WAITING,n)}}}],r5=[{event:iQ.KEY_INFO,handler:function(e){return t=>{rK.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",t),e.emit(iQ.KEY_INFO,t)}}},{event:iQ.KEYS_EXCHANGED,handler:function(e){return()=>{var t,n,r;rK.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`);let{channelConfig:i}=e.remote.state;if(i){let t=e.getKeyExchange().getKeyInfo().ecies;i.localKey=t.private,i.otherKey=t.otherPubKey,e.remote.state.channelConfig=i,null===(n=e.remote.state.storageManager)||void 0===n||n.persistChannelConfig(i).catch(e=>{})}e.emit(iQ.KEYS_EXCHANGED,{keysExchanged:null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});let o={keyInfo:e.getKeyInfo()};e.emit(iQ.SERVICE_STATUS,o)}}}];function r8(e,t){rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} setting socket listeners for channel ${t}...`);let{socket:n}=e.state,{keyExchange:r}=e.state;n&&e.state.isOriginator&&(e.state.debug&&(null==n||n.io.on("error",t=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=error`,t)}),null==n||n.io.on("reconnect",t=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect`,t),r0(e).catch(e=>{})}),null==n||n.io.on("reconnect_error",t=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_error`,t)}),null==n||n.io.on("reconnect_failed",()=>{rK.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_failed`)})),null==n||n.on("disconnect",t=>(rK.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${t}' begin recovery...`),void(rK.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,t),e.state.manualDisconnect||(e.emit(iQ.SOCKET_DISCONNECTED),r0(e).catch(e=>{})))))),r3.forEach(({event:r,handler:i})=>{null==n||n.on(`${r}-${t}`,i(e,t))}),r5.forEach(({event:t,handler:n})=>{null==r||r.on(t,n(e))}),e.state.setupChannelListeners=!0}class r6 extends c.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;let{reconnect:t,communicationLayerPreference:n,communicationServerUrl:r,context:i,remote:o,logging:a}=e;this.state.resumed=t,this.state.context=i,this.state.isOriginator=o.state.isOriginator,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==a?void 0:a.serviceLayer),this.remote=o,!0===(null==a?void 0:a.serviceLayer)&&l().enable("SocketService:Layer"),this.state.communicationServerUrl=r,this.state.hasPlaintext=this.state.communicationServerUrl!==rW&&!0===(null==a?void 0:a.plaintext),rK.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;let{otherPublicKey:t,ecies:n,logging:r}=this.options,i=this.state.communicationServerUrl;rK.SocketService(`[SocketService: initSocket()] Socket IO url: ${i}`),this.state.socket=(0,f.io)(i,{autoConnect:!1,transports:rV,withCredentials:!0}),function(e){if("undefined"!=typeof window&&"undefined"!=typeof document&&(rK.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,e),!e.state.focusListenerAdded)){let t=()=>{rK.SocketService("Document has focus --- reconnecting socket"),r0(e).catch(e=>{})};window.addEventListener("focus",t),e.state.focusListenerAdded=!0,e.state.removeFocusListener=()=>{window.removeEventListener("focus",t),e.state.focusListenerAdded=!1}}}(this);let o={communicationLayer:this,otherPublicKey:t,sendPublicKey:!1,context:null!==(e=this.state.context)&&void 0!==e?e:"",ecies:n,logging:r};this.state.keyExchange=new rZ(o)}resetKeys(){var e;return rK.SocketService("[SocketService: resetKeys()] Resetting keys."),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys())}createChannel(){return p(this,void 0,void 0,function*(){return function(e){return p(this,void 0,void 0,function*(){var t,n,r;if(rK.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),null===(t=e.state.socket)||void 0===t?void 0:t.connected)throw Error("socket already connected");null===(n=e.state.socket)||void 0===n||n.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;let i=(0,u.Z)();e.state.channelId=i,r8(e,i),yield new Promise((t,n)=>{var r;null===(r=e.state.socket)||void 0===r||r.emit(iQ.JOIN_CHANNEL,{channelId:i,context:`${e.state.context}createChannel`,clientType:"dapp"},(r,i)=>p(this,void 0,void 0,function*(){try{yield rJ(e,r,i),t()}catch(e){n(e)}}))});let o=null===(r=e.state.keyExchange)||void 0===r?void 0:r.getKeyInfo();return{channelId:i,pubKey:(null==o?void 0:o.ecies.public)||"",privKey:(null==o?void 0:o.ecies.private)||""}})}(this)})}
2connectToChannel({channelId:e,withKeyExchange:t=!1,authorized:n}){return function(e){return p(this,arguments,void 0,function*({options:e,instance:t}){let{channelId:n,authorized:r,withKeyExchange:i}=e,{state:o,remote:a}=t,{isOriginator:s=!1,socket:l,keyExchange:c}=o,{channelConfig:d}=a.state;if(null==l?void 0:l.connected)throw Error("socket already connected");if(s&&(null==d?void 0:d.relayPersistence)){let{localKey:e,otherKey:t}=d;e&&t&&(null==c||c.setRelayPersistence({localKey:e,otherKey:t}))}return Object.assign(o,{manualDisconnect:!1,withKeyExchange:i,isOriginator:s,channelId:n}),null==l||l.connect(),r8(t,n),!s&&r&&(null==c||c.setKeysExchanged(!0),Object.assign(a.state,{ready:!0,authorized:!0})),new Promise(e=>{var i;let a=null===(i=null==c?void 0:c.getKeyInfo())||void 0===i?void 0:i.ecies.public;null==l||l.emit(iQ.JOIN_CHANNEL,{channelId:n,context:`${o.context}_connectToChannel`,clientType:s?"dapp":"wallet",publicKey:r&&!s?a:void 0},(n,r)=>p(this,void 0,void 0,function*(){yield rJ(t,n,r),e()}))})})}({options:{channelId:e,withKeyExchange:t,authorized:n},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e;null===(e=this.state.socket)||void 0===e||e.emit(iQ.MESSAGE,{id:this.state.channelId,context:this.state.context,message:{type:i1.KEY_HANDSHAKE_CHECK,pubkey:this.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return p(this,void 0,void 0,function*(){return function(e,t){return p(this,void 0,void 0,function*(){var n,r,i,o;if(!e.state.channelId)throw rK.SocketService("handleSendMessage: no channelId - Create a channel first"),Error("Create a channel first");
2if(rK.SocketService(`[SocketService: handleSendMessage()] context=${e.state.context} areKeysExchanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`,t),null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.startsWith("key_handshake"))return rK.SocketService(`[SocketService: handleKeyHandshake()] context=${e.state.context}`,t),null===(o=e.state.socket)||void 0===o||o.emit(iQ.MESSAGE,{id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:t}),!0;!function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&!e.remote.state.relayPersistence)throw rK.SocketService(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),Error("Keys not exchanged BBB")}(e,t),function(e,t){var n;let r=null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"",i=null==t?void 0:t.id;e.state.isOriginator&&i&&(e.state.rpcMethodTracker[i]={id:i,timestamp:Date.now(),method:r},e.emit(iQ.RPC_UPDATE,e.state.rpcMethodTracker[i]))}(e,t);let a=yield r1(e,t);return e.remote.state.analytics&&e.remote.state.isOriginator&&t.method&&r2.includes(t.method.toLowerCase())&&rF({id:null!==(i=e.remote.state.channelId)&&void 0!==i?i:"",event:i3.SDK_RPC_REQUEST,params:{method:t.method,from:"mobile"}},e.remote.state.communicationServerUrl).catch(e=>{}),(function(e,t){return p(this,void 0,void 0,function*(){var n;let r=null==t?void 0:t.id,i=null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"";if(e.state.isOriginator&&r)try{let n=rQ(r,e.state.rpcMethodTracker,200).then(e=>({type:i8.RPC_CHECK,result:e})),o=p(this,void 0,void 0,function*(){let t;let n=yield(t={instance:e,rpcId:r},p(void 0,[t],void 0,function*({rpcId:e,instance:t}){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield rX(200);return t.state.lastRpcId})),i=yield rQ(n,e.state.rpcMethodTracker,200);return{type:i8.SKIPPED_RPC,result:i}}),a=yield Promise.race([n,o]);if(a.type===i8.RPC_CHECK){let e=a.result;rK.SocketService(`[SocketService:handleRpcReplies()] id=${t.id} ${i} ( ${e.elapsedTime} ms)`,e.result)}else{if(a.type!==i8.SKIPPED_RPC)throw Error(`Error handling RPC replies for ${r}`);{let t=Object.assign(Object.assign({},e.state.rpcMethodTracker[r]),{error:Error("SDK_CONNECTION_ISSUE")});e.emit(iQ.RPC_UPDATE,t);let n={data:Object.assign(Object.assign({},t),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(iQ.MESSAGE,{message:n})}}}catch(e){throw e}})})(e,t).catch(e=>{}),a})}(this,e)})}ping(){return function(e){return p(this,void 0,void 0,function*(){var t,n;rK.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`),null===(n=e.state.socket)||void 0===n||n.emit(i2.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return p(this,void 0,void 0,function*(){var t,n;rK.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,(null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged())&&(yield e.sendMessage({type:i2.PAUSE})),null===(n=e.state.socket)||void 0===n||n.disconnect()})}(this)}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){return function(e){return p(this,void 0,void 0,function*(){let{state:t,remote:n}=e,{socket:r,channelId:i,context:o,keyExchange:a,isOriginator:s}=t,{isOriginator:l}=n.state;if(rK.SocketService(`[SocketService: resume()] channelId=${i} context=${o} connected=${null==r?void 0:r.connected} manualDisconnect=${t.manualDisconnect} resumed=${t.resumed} keysExchanged=${null==a?void 0:a.areKeysExchanged()}`),!i)throw rK.SocketService("[SocketService: resume()] channelId is not defined"),Error("ChannelId is not defined");(null==r?void 0:r.connected)?(rK.SocketService("[SocketService: resume()] already connected."),r.emit(i2.PING,{id:i,clientType:l?"dapp":"wallet",context:"on_channel_config",message:""}),n.hasRelayPersistence()||(null==a?void 0:a.areKeysExchanged())||(s?yield e.sendMessage({type:i2.READY}):null==a||a.start({isOriginator:!1}))):(null==r||r.connect(),rK.SocketService(`[SocketService: resume()] after connecting socket --> connected=${null==r?void 0:r.connected}`),null==r||r.emit(iQ.JOIN_CHANNEL,{channelId:i,context:`${o}_resume`,clientType:l?"dapp":"wallet"},(t,n)=>p(this,void 0,void 0,function*(){try{yield rJ(e,t,n)}catch(e){}}))),t.manualDisconnect=!1,t.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){var t,n,r,i,o;rK.SocketService(`[SocketService: disconnect()] context=${this.state.context}`,e),(null==e?void 0:e.terminate)&&(null===(n=(t=this.state).removeFocusListener)||void 0===n||n.call(t),this.state.channelId=e.channelId,null===(r=this.state.socket)||void 0===r||r.removeAllListeners(),null===(i=this.state.keyExchange)||void 0===i||i.clean(),this.remote.state.ready=!1,this.state.socket=void 0,this.state.rpcMethodTracker={}),this.state.manualDisconnect=!0,null===(o=this.state.socket)||void 0===o||o.disconnect()}}
2function r4({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,ecies:r,communicationServerUrl:i=rW,instance:o}){var a,s,l,c,d,u,h,f,g,m,y;let{state:v}=o;if(rK.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(v,null,2)),e!==i6.SOCKET)throw Error("Invalid communication protocol");v.communicationLayer=new r6({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,transports:v.transports,communicationServerUrl:i,context:v.context,ecies:r,logging:v.logging,remote:o});let b="undefined"!=typeof document&&document.URL||"",E="undefined"!=typeof document&&document.title||"";(null===(a=v.dappMetadata)||void 0===a?void 0:a.url)&&(b=v.dappMetadata.url),(null===(s=v.dappMetadata)||void 0===s?void 0:s.name)&&(E=v.dappMetadata.name);let w=null!==(u=null!==(c=null===(l=v.dappMetadata)||void 0===l?void 0:l.name)&&void 0!==c?c:null===(d=v.dappMetadata)||void 0===d?void 0:d.url)&&void 0!==u?u:"N/A",S="undefined"!=typeof window&&void 0!==window.location&&null!==(h=window.location.hostname)&&void 0!==h?h:w,_={url:b,title:E,source:null===(f=v.dappMetadata)||void 0===f?void 0:f.source,dappId:S,icon:(null===(g=v.dappMetadata)||void 0===g?void 0:g.iconUrl)||(null===(m=v.dappMetadata)||void 0===m?void 0:m.base64Icon),platform:v.platformType,apiVersion:rq.version,connector:null===(y=v.dappMetadata)||void 0===y?void 0:y.connector};for(let[t,n]of(v.originatorInfo=_,Object.entries({[iQ.AUTHORIZED]:function(e){return()=>p(this,void 0,void 0,function*(){var t,n,r;let{state:i}=e;if(i.authorized)return;yield p(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield rX(500)});let o="7.3".localeCompare((null===(t=i.walletInfo)||void 0===t?void 0:t.version)||"");if(rK.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null===(n=i.walletInfo)||void 0===n?void 0:n.version} compareValue=${o}`),1!==o)return;let a=i.platformType===i4.MobileWeb||i.platformType===i4.ReactNative||i.platformType===i4.MetaMaskMobileWebview;rK.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${a} channel=${i.channelId} walletVersion=${null===(r=i.walletInfo)||void 0===r?void 0:r.version}`),a&&(i.authorized=!0,e.emit(iQ.AUTHORIZED))})}(o),[iQ.MESSAGE]:e=>{let t=e;e.message&&(t=t.message),function(e,t){let{state:n}=t;if(rK.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${n.context} on 'message' typeof=${typeof e}`,e),t.state.ready=!0,n.isOriginator||e.type!==i2.ORIGINATOR_INFO){if(n.isOriginator&&e.type===i2.WALLET_INFO)!function(e,t){let{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(t,e);else{if(n.isOriginator&&e.type===i2.WALLET_INIT)(function(e,t){return p(this,void 0,void 0,function*(){var n,r,i;let{state:o}=e;if(o.isOriginator){let o=t.data||{};if("object"==typeof o&&"accounts"in o&&"chainId"in o&&"walletKey"in o)try{let{channelConfig:t}=e.state;if(rK.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(t,null,2)),t){let a=o.accounts,s=o.chainId,l=o.walletKey,c,d=!1;"deeplinkProtocol"in o&&(d=!!o.deeplinkProtocol,e.state.deeplinkProtocolAvailable=d),"walletVersion"in o&&(c=o.walletVersion),yield null===(n=e.state.storageManager)||void 0===n?void 0:n.persistChannelConfig(Object.assign(Object.assign({},t),{otherKey:l,walletVersion:c,deeplinkProtocolAvailable:d,relayPersistence:!0})),yield null===(r=e.state.storageManager)||void 0===r?void 0:r.persistAccounts(a),yield null===(i=e.state.storageManager)||void 0===i?void 0:i.persistChainId(s)}e.emit(iQ.WALLET_INIT,{accounts:o.accounts,chainId:o.chainId})}catch(e){}}})})(t,e).catch(e=>{rK.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===i2.TERMINATE)(function(e){return p(this,void 0,void 0,function*(){let{state:t}=e;t.isOriginator&&(yield r9({options:{terminate:!0,sendMessage:!1},instance:e}),e.emit(iQ.TERMINATE))})})(t).catch(e=>{rK.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===i2.PAUSE)!function(e){let{state:t}=e;t.paused=!0,e.setConnectionStatus(iX.PAUSED)}(t);else if(e.type===i2.READY&&n.isOriginator)!function(e){let{state:t}=e;e.setConnectionStatus(iX.LINKED);let n=t.paused;t.paused=!1,e.emit(iQ.CLIENTS_READY,{isOriginator:t.isOriginator,walletInfo:t.walletInfo}),n&&(t.authorized=!0,e.emit(iQ.AUTHORIZED))}(t);else{if(e.type===i2.OTP&&n.isOriginator)return void function(e,t){var n;let{state:r}=e;e.emit(iQ.OTP,t.otpAnswer),1==="6.6".localeCompare((null===(n=r.walletInfo)||void 0===n?void 0:n.version)||"")&&e.emit(iQ.SDK_RPC_CALL,{method:rG.ETH_REQUESTACCOUNTS,params:[]})}(t,e);e.type===i2.AUTHORIZED&&n.isOriginator&&function(e){let{state:t}=e;t.authorized=!0,e.emit(iQ.AUTHORIZED)}(t)}t.emit(iQ.MESSAGE,e)}}else!function(e,t){var n;let{state:r}=e;null===(n=r.communicationLayer)||void 0===n||n.sendMessage({type:i2.WALLET_INFO,walletInfo:r.walletInfo}),r.originatorInfo=t.originatorInfo||t.originator,e.emit(iQ.CLIENTS_READY,{isOriginator:r.isOriginator,originatorInfo:r.originatorInfo}),r.paused=!1}(t,e)}(t,o)}
2,[iQ.CHANNEL_PERSISTENCE]:function(e){return()=>p(this,void 0,void 0,function*(){var t,n,r,i,o,a,s;let{state:l}=e;rK.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${l.context}`),e.state.ready=!0,e.state.clientsConnected=!0,e.state.authorized=!0,e.state.relayPersistence=!0,null===(t=e.state.communicationLayer)||void 0===t||t.getKeyExchange().setKeysExchanged(!0),e.emit(iQ.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),e.emit(iQ.AUTHORIZED),e.emit(iQ.CLIENTS_READY),e.emit(iQ.CHANNEL_PERSISTENCE);try{l.channelConfig=Object.assign(Object.assign({},l.channelConfig),{localKey:null===(n=l.communicationLayer)||void 0===n?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:null===(r=l.communicationLayer)||void 0===r?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:null!==(i=l.channelId)&&void 0!==i?i:"",validUntil:null!==(a=null===(o=l.channelConfig)||void 0===o?void 0:o.validUntil)&&void 0!==a?a:6048e5,relayPersistence:!0}),yield null===(s=l.storageManager)||void 0===s?void 0:s.persistChannelConfig(l.channelConfig)}catch(e){}})}(o),[iQ.CLIENTS_CONNECTED]:()=>{var t,n,r,i;let{state:a}=o;rK.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${a.channelId} keysExchanged=${null===(n=null===(t=a.communicationLayer)||void 0===t?void 0:t.getKeyInfo())||void 0===n?void 0:n.keysExchanged}`),a.analytics&&rF(Object.assign(Object.assign({id:null!==(r=a.channelId)&&void 0!==r?r:"",event:a.reconnection?i3.RECONNECT:a.isOriginator?i3.REQUEST:i3.REQUEST_MOBILE},a.originatorInfo),{commLayer:e,sdkVersion:a.sdkVersion,walletVersion:null===(i=a.walletInfo)||void 0===i?void 0:i.version,commLayerVersion:rq.version}),a.communicationServerUrl).catch(e=>{}),a.clientsConnected=!0,a.originatorInfoSent=!1,o.emit(iQ.CLIENTS_CONNECTED)},[iQ.KEYS_EXCHANGED]:t=>{var n,r,i,a,s,l,c,d;let{state:u}=o;if(rK.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${u.context} on commLayer.'keys_exchanged' channel=${u.channelId}`,t),null===(r=null===(n=u.communicationLayer)||void 0===n?void 0:n.getKeyInfo())||void 0===r?void 0:r.keysExchanged){let e=Object.assign(Object.assign({},u.channelConfig),{channelId:null!==(i=u.channelId)&&void 0!==i?i:"",validUntil:(null===(a=u.channelConfig)||void 0===a?void 0:a.validUntil)||6048e5,localKey:u.communicationLayer.getKeyInfo().ecies.private,otherKey:u.communicationLayer.getKeyInfo().ecies.otherPubKey});null===(s=u.storageManager)||void 0===s||s.persistChannelConfig(e).catch(e=>{}),o.setConnectionStatus(iX.LINKED)}(function(e,t){var n,r,i,o,a,s,l,c;let{state:d}=e;rK.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${d.channelId}`,t);let u=Object.assign(Object.assign({},d.channelConfig),{channelId:null!==(n=d.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=d.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,relayPersistence:d.relayPersistence,localKey:null===(a=null===(o=d.communicationLayer)||void 0===o?void 0:o.state.keyExchange)||void 0===a?void 0:a.getKeyInfo().ecies.private,otherKey:null===(l=null===(s=d.communicationLayer)||void 0===s?void 0:s.state.keyExchange)||void 0===l?void 0:l.getKeyInfo().ecies.otherPubKey,lastActive:t.getTime()});null===(c=d.storageManager)||void 0===c||c.persistChannelConfig(u)})(o,new Date),u.analytics&&u.channelId&&rF(Object.assign(Object.assign({id:u.channelId,event:t.isOriginator?i3.CONNECTED:i3.CONNECTED_MOBILE},u.originatorInfo),{sdkVersion:u.sdkVersion,commLayer:e,commLayerVersion:rq.version,walletVersion:null===(l=u.walletInfo)||void 0===l?void 0:l.version}),u.communicationServerUrl).catch(e=>{}),u.isOriginator=t.isOriginator,t.isOriginator||(null===(c=u.communicationLayer)||void 0===c||c.sendMessage({type:i2.READY}),u.ready=!0,u.paused=!1),t.isOriginator&&!u.originatorInfoSent&&(null===(d=u.communicationLayer)||void 0===d||d.sendMessage({type:i2.ORIGINATOR_INFO,originatorInfo:u.originatorInfo,originator:u.originatorInfo}),u.originatorInfoSent=!0)},[iQ.SOCKET_DISCONNECTED]:()=>{let{state:e}=o;rK.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to fal
2se"),e.ready=!1},[iQ.SOCKET_RECONNECT]:()=>{let{state:e}=o;rK.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,rY(e),o.emitServiceStatusEvent({context:"socket_reconnect"})},[iQ.CLIENTS_DISCONNECTED]:e=>{let{state:t}=o;rK.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${t.context} on 'clients_disconnected' channelId=${e}`),t.relayPersistence||(t.clientsConnected=!1,t.ready=!1,t.authorized=!1),o.emit(iQ.CLIENTS_DISCONNECTED,t.channelId),o.setConnectionStatus(iX.DISCONNECTED)},[iQ.KEY_INFO]:()=>{},[iQ.CHANNEL_CREATED]:e=>{let{state:t}=o;rK.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${t.context} on 'channel_created' channelId=${e}`),o.emit(iQ.CHANNEL_CREATED,e)},[iQ.CLIENTS_WAITING]:e=>{var t;let{state:n}=o;if(rK.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${n.context} on 'clients_waiting' numberUsers=${e} ready=${n.ready} autoStarted=${n.originatorConnectStarted}`),o.setConnectionStatus(iX.WAITING),o.emit(iQ.CLIENTS_WAITING,e),n.originatorConnectStarted){rK.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${n.originatorConnectStarted} timeout`,n.autoConnectOptions);let e=(null===(t=n.autoConnectOptions)||void 0===t?void 0:t.timeout)||3e3,r=setTimeout(()=>{rK.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${e}) terminate channelConfig`,n.autoConnectOptions),n.originatorConnectStarted=!1,n.ready||o.setConnectionStatus(iX.TIMEOUT),clearTimeout(r)},e)}},[iQ.RPC_UPDATE]:e=>{o.emit(iQ.RPC_UPDATE,e)}})))try{v.communicationLayer.on(t,n)}catch(e){}}function r9(e){return p(this,arguments,void 0,function*({options:e,instance:t}){let{state:n}=t;return rK.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${n.channelId}`,e),new Promise((r,i)=>{var o,a,s,l,c,d;(null==e?void 0:e.terminate)?(t.state.ready&&rF({id:null!==(o=t.state.channelId)&&void 0!==o?o:"",event:i3.TERMINATED},t.state.communicationServerUrl).catch(e=>{}),n.ready=!1,n.paused=!1,null===(a=n.storageManager)||void 0===a||a.terminate(null!==(s=n.channelId)&&void 0!==s?s:""),t.state.terminated=!0,e.sendMessage?(null===(l=n.communicationLayer)||void 0===l?void 0:l.getKeyInfo().keysExchanged)&&t.state.communicationLayer&&r1(t.state.communicationLayer,{type:i2.TERMINATE}).then(()=>{r(!0)}).catch(e=>{i(e)}):r(!0),n.authorized=!1,n.relayPersistence=!1,n.channelId=(0,u.Z)(),e.channelId=n.channelId,n.channelConfig=void 0,n.originatorConnectStarted=!1,null===(c=n.communicationLayer)||void 0===c||c.disconnect(e),t.setConnectionStatus(iX.TERMINATED)):(null===(d=n.communicationLayer)||void 0===d||d.disconnect(e),t.setConnectionStatus(iX.DISCONNECTED),r(!0))})})}(i6||(i6={})).SOCKET="socket",(iZ=i4||(i4={})).NonBrowser="nodejs",iZ.MetaMaskMobileWebview="in-app-browser",iZ.DesktopWeb="web-desktop",iZ.MobileWeb="web-mobile",iZ.ReactNative="react-native";class r7 extends c.EventEmitter2{constructor(e){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:rW,context:"",persist:!1,clientsConnected:!1,sessionDuration:6048e5,originatorConnectStarted:!1,debug:!1,_connectionStatus:iX.DISCONNECTED},this._options=e;let{platformType:t,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:a,protocolVersion:s,transports:c,context:d,relayPersistence:u,ecies:h,analytics:f=!1,storage:p,sdkVersion:g,communicationServerUrl:m=rW,logging:y,autoConnect:v={timeout:3e3}}=e;this.state.otherPublicKey=r,this.state.dappMetadata=a,this.state.walletInfo=o,this.state.transports=c,this.state.platformType=t,this.state.analytics=f,this.state.protocolVersion=null!=s?s:1,this.state.isOriginator=!r,this.state.relayPersistence=u,this.state.communicationServerUrl=m,this.state.context=d,this.state.terminated=!1,this.state.sdkVersion=g,this.setMaxListeners(50),this.setConnectionStatus(iX.DISCONNECTED),(null==p?void 0:p.duration)&&(this.state.sessionDuration=6048e5),this.state.storageOptions=p,this.state.autoConnectOptions=v,this.state.debug=!0===(null==y?void 0:y.remoteLayer),!0===(null==y?void 0:y.remoteLayer)&&l().enable("RemoteCommunication:Layer"),!0===(null==y?void 0:y.serviceLayer)&&l().enable("SocketService:Layer"),!0===(null==y?void 0:y.eciesLayer)&&l().enable("ECIES:Layer"),!0===(null==y?void 0:y.keyExchangeLayer)&&l().enable("KeyExchange:Layer"),this.state.logging=y,(null==p?void 0:p.storageManager)&&(this.state.storageManager=p.storageManager),rK.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${s} relayPersistence=${u} isOriginator=${this.state.isOriginator} communicationLayerPreference=${n} otherPublicKey=${r} reconnect=${i}`),this.state.isOriginator||r4({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:h,communicationServerUrl:m,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return p(this,void 0,void 0,function*(){var e;if(this.state.storageManager){let t=yield this.state.storageManager.getPersistedChannelConfig({});t&&(this.state.channelConfig=t,this.state.channelId=t.channelId,this.state.deeplinkProtocolAvailable=null!==(e=t.deeplinkProtocolAvailable)&&void 0!==e&&e,t.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(iX.LINKED),yield this.connectToChannel
2({channelId:t.channelId})))}r4({communicationLayerPreference:i6.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return p(this,void 0,void 0,function*(){return yield function(e){return p(this,void 0,void 0,function*(){var t;let{state:n}=e;if(!n.storageManager)return void rK.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");let r=yield n.storageManager.getPersistedChannelConfig({});if(rK.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null===(t=n.communicationLayer)||void 0===t?void 0:t.isConnected())return rK.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),r;if(r){if(r.validUntil>Date.now())return n.channelConfig=r,n.originatorConnectStarted=!0,n.channelId=null==r?void 0:r.channelId,n.reconnection=!0,r;rK.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return p(this,void 0,void 0,function*(){return function(e){return p(this,void 0,void 0,function*(){var t,n,r,i,o,a;if(!e.communicationLayer)throw Error("communication layer not initialized");if(e.ready)throw Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.private,pubKey:null===(a=null===(o=e.communicationLayer)||void 0===o?void 0:o.getKeyInfo())||void 0===a?void 0:a.ecies.public};rK.RemoteCommunication("[RemoteCommunication: generateChannelId()]");let s=yield e.communicationLayer.createChannel();rK.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",s);let l=Object.assign(Object.assign({},e.channelConfig),{channelId:s.channelId,localKey:s.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=s.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:s.pubKey,privKey:s.privKey}})}(this.state)})}clean(){return rY(this.state)}connectToChannel({channelId:e,withKeyExchange:t,authorized:n}){return function(e){return p(this,arguments,void 0,function*({channelId:e,withKeyExchange:t,authorized:n,state:r}){var i,o,a;if(!(0,h.Z)(e))throw rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} channelId=${e} withKeyExchange=${t}`),null===(i=r.communicationLayer)||void 0===i?void 0:i.isConnected())return void rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} already connected - interrupt connection.`);r.channelId=e,yield null===(o=r.communicationLayer)||void 0===o?void 0:o.connectToChannel({channelId:e,authorized:n,withKeyExchange:t});let s=Object.assign(Object.assign({},r.channelConfig),{channelId:e,validUntil:Date.now()+r.sessionDuration});r.channelConfig=s,null===(a=r.storageManager)||void 0===a||a.persistChannelConfig(s)})}({channelId:e,authorized:n,withKeyExchange:t,state:this.state})}sendMessage(e){return function(e,t){return p(this,void 0,void 0,function*(){var n,r;let{state:i}=e;rK.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} paused=${i.paused} ready=${i.ready} relayPersistence=${i.relayPersistence} authorized=${i.authorized} socket=${null===(n=i.communicationLayer)||void 0===n?void 0:n.isConnected()} clientsConnected=${i.clientsConnected} status=${i._connectionStatus}`,t),i.relayPersistence||i.ready&&(null===(r=i.communicationLayer)||void 0===r?void 0:r.isConnected())&&i.clientsConnected||(rK.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.c
2ontext} SKIP message waiting for MM mobile readiness.`),yield new Promise(t=>{e.once(iQ.CLIENTS_READY,t)}),rK.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(e,t){return p(this,void 0,void 0,function*(){return new Promise(n=>{var r;let{state:i}=e;rK.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} ready=${i.ready} authorized=${i.authorized} method=${t.method}`),!i.isOriginator||i.authorized||i.relayPersistence?null===(r=i.communicationLayer)||void 0===r||r.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)}):e.once(iQ.AUTHORIZED,()=>{var e;rK.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=i.communicationLayer)||void 0===e||e.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)})})})})}(e,t)}catch(e){throw e}})}(this,e)}testStorage(){return p(this,void 0,void 0,function*(){return function(e){return p(this,void 0,void 0,function*(){var t;let n=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig();rK.RemoteCommunication("[RemoteCommunication: testStorage()] res",n)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return p(this,void 0,void 0,function*(){var e;rK.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield null===(e=this.state.communicationLayer)||void 0===e?void 0:e.ping()})}testLogger(){rK.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),rK.SocketService(`testLogger() channel=${this.state.channelId}`),rK.Ecies(`testLogger() channel=${this.state.channelId}`),rK.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;rK.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(iQ.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(iQ.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;let n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){return p(this,void 0,void 0,function*(){var e;rK.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield null===(e=this.state.communicationLayer)||void 0===e?void 0:e.pause(),this.setConnectionStatus(iX.PAUSED)})}getVersion(){return rq.version}hasRelayPersistence(){var e;return null!==(e=this.state.relayPersistence)&&void 0!==e&&e}resume(){return p(this,void 0,void 0,function*(){return function(e){return p(this,void 0,void 0,function*(){var t;let{state:n}=e;rK.RemoteCommunication(`[RemoteCommunication: resume()] channel=${n.channelId}`),yield null===(t=n.communicationLayer)||void 0===t?void 0:t.resume(),e.setConnectionStatus(iX.LINKED)})}(this)})}encrypt(e){var t,n,r;let i=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange(),o=null==i?void 0:i.getOtherPublicKey();
2if(!o)throw Error("KeyExchange not completed");return null===(r=null===(n=this.state.communicationLayer)||void 0===n?void 0:n.state.eciesInstance)||void 0===r?void 0:r.encrypt(e,o)}decrypt(e){var t,n,r;if(!(null===(t=this.state.communicationLayer)||void 0===t?void 0:t.state.eciesInstance))throw Error("ECIES instance is not initialized");return null===(r=null===(n=this.state.communicationLayer)||void 0===n?void 0:n.state.eciesInstance)||void 0===r?void 0:r.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return function(e){return p(this,arguments,void 0,function*({channelId:e,state:t}){var n,r,i;if(!(0,h.Z)(e))throw rK.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${t.context} invalid channel channelId=${e}`),Error(`Invalid channel ${e}`);if(t.isOriginator)return void rK.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} isOriginator=${t.isOriginator} channelId=${e}`);let{socket:o}=null!==(r=null===(n=t.communicationLayer)||void 0===n?void 0:n.state)&&void 0!==r?r:{};(null==o?void 0:o.connected)||(rK.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket already connected`),null==o||o.connect()),rF(Object.assign(Object.assign({id:e,event:i3.REJECTED},t.originatorInfo),{sdkVersion:t.sdkVersion,commLayerVersion:rq.version,walletVersion:null===(i=t.walletInfo)||void 0===i?void 0:i.version}),t.communicationServerUrl).catch(e=>{}),yield new Promise((n,r)=>{null==o||o.emit(iQ.REJECTED,{channelId:e},(e,i)=>{rK.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket=${null==o?void 0:o.id}`,{error:e,response:i}),e?r(e):n(i)})})})}({channelId:e,state:this.state})}disconnect(e){return p(this,void 0,void 0,function*(){return r9({options:e,instance:this})})}}(iJ=i9||(i9={})).RENEW="renew",iJ.LINK="link";var ie={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:"MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",networkVersionDeprecation:"MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",selectedAddressDeprecation:"MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",walletWatchAssetNFTExperimental:"MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}}
2,it=Math.floor(4294967295*Math.random()),ir=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ii=(e,t,n)=>(ir(e,t,"read from private field"),n?n.call(e):t.get(e)),io=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ia=(e,t,n,r)=>(ir(e,t,"write to private field"),t.set(e,n),n),is=(e,t,n)=>(ir(e,t,"access private method"),n),il={invalidRequest:-32600,internal:-32603},ic={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function id(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}var iu=(e,t)=>Object.hasOwnProperty.call(e,t);class ih extends TypeError{constructor(e,t){let n;let{message:r,explanation:i,...o}=e,{path:a}=e,s=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function ip(e){return"object"==typeof e&&null!=e}function ig(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*im(e,t,n,r){var i;for(let o of(ip(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:o}=t,{type:a}=n,{refinement:s,message:l=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${ig(r)}\``}=e;return{value:r,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:l}}(o,t,n,r);e&&(yield e)}}function*iy(e,t,n={}){let{path:r=[],branch:i=[e],coerce:o=!1,mask:a=!1}=n,s={path:r,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&ip(t.schema)&&ip(e)&&!Array.isArray(e)))for(let n in e)void 0===t.schema[n]&&delete e[n];let l="valid";for(let r of t.validator(e,s))r.explanation=n.message,l="not_valid",yield[r,void 0];for(let[c,d,u]of t.entries(e,s))for(let t of iy(d,u,{path:void 0===c?r:[...r,c],branch:void 0===c?i:[...i,d],c
2oerce:o,mask:a,message:n.message}))t[0]?(l=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(d=t[1],void 0===c?e=d:e instanceof Map?e.set(c,d):e instanceof Set?e.add(d):ip(e)&&(void 0!==d||c in e)&&(e[c]=d));if("not_valid"!==l)for(let r of t.refiner(e,s))r.explanation=n.message,l="not_refined",yield[r,void 0];"valid"===l&&(yield[void 0,e])}class iv{constructor(e){let{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>im(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>im(i(e,t),t,this,e):()=>[]}assert(e,t){return ib(e,this,t)}create(e,t){return iE(e,this,t)}is(e){return iw(e,this)}mask(e,t){return function(e,t,n){let r=iS(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return iS(e,this,t)}}function ib(e,t,n){let r=iS(e,t,{message:n});if(r[0])throw r[0]}function iE(e,t,n){let r=iS(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function iw(e,t){return!iS(e,t)[0]}function iS(e,t,n={}){let r=iy(e,t,n),i=function(e){let{done:t,value:n}=e.next();return t?void 0:n}(r);return i[0]?[new ih(i[0],function*(){for(let e of r)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function i_(e,t){return new iv({type:e,schema:null,validator:t})}function iC(e){let t;return new iv({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function ix(e){return new iv({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ig(e)}`})}function ik(e){let t=ig(e),n=typeof e;return new iv({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${ig(n)}`})}function iM(){return i_("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${ig(e)}`)}function iA(e){let t=e?Object.keys(e):[],n=i_("never",()=>!1);return new iv({type:"object",schema:e||null,*entries(r){if(e&&ip(r)){let i=new Set(Object.keys(r));for(let n of t)i.delete(n),yield[n,r[n],e[n]];for(let e of i)yield[e,r[e],n]}},validator:e=>ip(e)||`Expected an object, but received: ${ig(e)}`,coercer:e=>ip(e)?{...e}:e})}function iI(e){return new iv({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function iR(e,t){return new iv({type:"record",schema:null,*entries(n){if(ip(n))for(let r in n){let i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>ip(e)||`Expected an object, but received: ${ig(e)}`})}function iP(){return i_("string",e=>"string"==typeof e||`Expected a string, but received: ${ig(e)}`)}function iT(e){let t=e.map(e=>e.type).join(" | ");return new iv({type:"union",schema:null,coercer(t){for(let n of e){let[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){let i=[];for(let t of e){let[...e]=iy(n,t,r),[o]=e;if(!o[0])return[];for(let[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ig(n)}`,...i]}})}var iO=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function iL(){throw Error("setTimeout has not been defined")}function iN(){throw Error("clearTimeout has not been defined")}var i$=iL,iD=iN;function iB(e){if(i$===setTimeout)return setTimeout(e,0);if((i$===iL||!i$)&&setTimeout)return i$=setTimeout,setTimeout(e,0);try{return i$(e,0)}catch(t){try{return i$.call(null,e,0)}catch(t){return i$.call(this,e,0)}}}"function"==typeof g.setTimeout&&(i$=setTimeout),"function"==typeof g.clearTimeout&&(iD=clearTimeout);var iK,iU,ij,iH,iF,iz,iq,iW,iV,iG,iY,iZ,iJ,iX,iQ,i0,i1,i2,i3,i5,i8,i6,i4,i9,i7,oe=[],ot=!1,on=-1;function or(){ot&&i7&&(ot=!1,i7.length?oe=i7.concat(oe):on=-1,oe.length&&oi())}function oi(){if(!ot){var e=iB(or);ot=!0;for(var t=oe.length;t;){for(i7=oe,oe=[];++on<t;)i7&&i7[on].run();on=-1,t=oe.length}i7=null,ot=!1,function(e){if(iD===clearTimeout)return clearTimeout(e);if((iD===iN||!iD)&&clearTimeout)return iD=clearTimeout,clearTimeout(e);try{iD(e)}catch(t){try{return iD.call(null,e)}catch(t){return iD.call(this,e)}}}(e)}}function oo(e,t){this.fun=e,this.array=t}function oa(){}oo.prototype.run=function(){this.fun.apply(null,this.array)};var os=g.performance||{},ol=os.now||os.mozNow||os.msNow||os.oNow||os.webkitNow||function(){return(new Date).getTime()},oc=new Date,od={nextTick:function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];oe.push(new oo(e,t)),1!==oe.length||ot||iB(oi)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:oa,addListener:oa,once:oa,off:oa,removeListener:oa,removeAllListeners:oa,emit:oa,binding:function(e){throw Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ol.call(os),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-oc)/1e3}},ou=e=>iA(e);function oh({path:e,branch:t}){let n=e[e.length-1];return iu(t[t.length-2],n)}function of(e){return new iv({...e,type:`optional ${e.type}`,validator:(t,n)=>!oh(n)||e.validator(t,n),refiner:(t,n)=>!oh(n)||e.refiner(t,n)})}var op,og,om=iT([ik(null),i_("boolean",e=>"boolean"==typeof e),i_("finite number",e=>iw(e,iM())&&Number.isFinite(e)),iP(),ix(iC(()=>om)),iR(iP(),iC(()=>om))]),oy=(op=i_("any",()=>!0),og=e=>((function(e,t,n="Assertion failed",r=iO){try{ib(e,t)}catch(e){var i;throw i=`${n}: ${("object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:null==e?"":String(e)).replace(/\.$/u,"")}.`,"string"==typeof r?.prototype?.constructor?.name?new r({message:i}):r({message:i})}})(e,om),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))),new iv({...om,coercer:(e,t)=>iw(e,op)?om.coercer(og(e,t),t):om.coercer(e,t)}));function ov(e){try{return iE(e,oy),!0}catch{return!1}}var ob=ik("2.0"),oE=new iv({...o3=iT([iM(),iP()]),validator:(e,t)=>
2null===e||o3.validator(e,t),refiner:(e,t)=>null===e||o3.refiner(e,t)}),ow=ou({code:i_("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ig(e)}`),message:iP(),data:of(oy),stack:of(iP())}),oS=iT([iR(iP(),oy),ix(oy)]),o_=ou({id:oE,jsonrpc:ob,method:iP(),params:of(oS)}),oC=ou({jsonrpc:ob,method:iP(),params:of(oS)});iA({id:oE,jsonrpc:ob,result:iI(i_("unknown",()=>!0)),error:iI(ow)}),iT([ou({id:oE,jsonrpc:ob,result:oy}),ou({id:oE,jsonrpc:ob,error:ow})]);var ox=il.internal,ok={code:ox,message:oM(ox)};function oM(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){let t=e.toString();if(iu(ic,t))return ic[t].message;if(e>=-32099&&e<=-32e3)return"Unspecified server error."}return t}function oA(e,{fallbackError:t=ok,shouldIncludeStack:n=!0}={}){if(!iw(t,ow))throw Error("Must provide fallback error with integer number code and string message.");let r=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(iw(e,ow))return e;let n=oI(e);return{...t,data:{cause:n}}}(e,t);return n||delete r.stack,r}function oI(e){return Array.isArray(e)?e.map(e=>ov(e)?e:id(e)?oR(e):null):id(e)?oR(e):ov(e)?e:null}function oR(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{let r=e[n];return ov(r)&&(t[n]=r),t},{})}o$.default=o$,o$.stable=oK,o$.stableStringify=oK;var oP="[...]",oT="[Circular]",oO=[],oL=[];function oN(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function o$(e,t,n,r){var i;void 0===r&&(r=oN()),function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;l<i.length;l++)if(i[l]===t)return void oD(oT,t,n,o);if(void 0!==s.depthLimit&&a>s.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void oD(oP,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;l<t.length;l++)e(t[l],l,l,i,t,a,s);else{var c=Object.keys(t);for(l=0;l<c.length;l++){var d=c[l];e(t[d],d,l,i,t,a,s)}}i.pop()}}(e,"",0,[],void 0,0,r);try{i=0===oL.length?JSON.stringify(e,t,n):JSON.stringify(e,oU(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==oO.length;){var o=oO.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function oD(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),oO.push([r,n,t,i])):oL.push([t,n,e]):(r[n]=e,oO.push([r,n,t]))}function oB(e,t){return e<t?-1:e>t?1:0}function oK(e,t,n,r){void 0===r&&(r=oN());var i,o=function e(t,n,r,i,o,a,s){var l;if(a+=1,"object"==typeof t&&null!==t){for(l=0;l<i.length;l++)if(i[l]===t)return void oD(oT,t,n,o);try{if("function"==typeof t.toJSON)return}catch(e){return}if(void 0!==s.depthLimit&&a>s.depthLimit||void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void oD(oP,t,n,o);if(i.push(t),Array.isArray(t))for(l=0;l<t.length;l++)e(t[l],l,l,i,t,a,s);else{var c={},d=Object.keys(t).sort(oB);for(l=0;l<d.length;l++){var u=d[l];e(t[u],u,l,i,t,a,s),c[u]=t[u]}if(void 0===o)return c;oO.push([o,n,t]),o[n]=c}i.pop()}}(e,"",0,[],void 0,0,r)||e;try{i=0===oL.length?JSON.stringify(o,t,n):JSON.stringify(o,oU(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==oO.length;){var a=oO.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function oU(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(oL.length>0)for(var r=0;r<oL.length;r++){var i=oL[r];if(i[1]===t&&i[0]===n){n=i[2],oL.splice(r,1);break}}return e.call(this,t,n)}}var oj=ei(o$),oH=class extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){let e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=oI(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return oj(this.serialize(),oF,2)}};function oF(e,t){if("[Circular]"!==t)return t}var oz=e=>(function(e,t){let[n,r]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;
vendor: 4,325 bytes, line 2
2if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t??void 0,n]}}return[]}(t);return new oH(e,n??oM(e),r)})(il.invalidRequest,e),oq={};function oW(){}function oV(){oV.init.call(this)}function oG(e){return void 0===e._maxListeners?oV.defaultMaxListeners:e._maxListeners}function oY(e,t,n,r){var i,o,a;if("function"!=typeof n)throw TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]):(o=e._events=new oW,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),!a.warned&&(i=oG(e))&&i>0&&a.length>i){a.warned=!0;var s=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=n,++e._eventsCount;return e}function oZ(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function oJ(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function oX(e,t){for(var n=Array(t);t--;)n[t]=e[t];return n}oW.prototype=Object.create(null),oV.EventEmitter=oV,oV.usingDomains=!1,oV.prototype.domain=void 0,oV.prototype._events=void 0,oV.prototype._maxListeners=void 0,oV.defaultMaxListeners=10,oV.init=function(){this.domain=null,oV.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new oW,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},oV.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},oV.prototype.getMaxListeners=function(){return oG(this)},oV.prototype.emit=function(e){var t,n,r,i,o,a,s,l="error"===e;if(a=this._events)l=l&&null==a.error;else if(!l)return!1;if(s=this.domain,l){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var d="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=oX(e,r),o=0;o<r;++o)i[o].call(n)}(n,d,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=oX(e,i),a=0;a<i;++a)o[a].call(n,r)}(n,d,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,a=oX(e,o),s=0;s<o;++s)a[s].call(n,r,i)}(n,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var a=e.length,s=oX(e,a),l=0;l<a;++l)s[l].call(n,r,i,o)}(n,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=oX(e,i),a=0;a<i;++a)o[a].apply(n,r)}(n,d,this,i)}return!0},oV.prototype.addListener=function(e,t){return oY(this,e,t,!1)},oV.prototype.on=oV.prototype.addListener,oV.prototype.prependListener=function(e,t){return oY(this,e,t,!0)},oV.prototype.once=function(e,t){if("function"!=typeof t)throw TypeError('"listener" argument must be a function');return this.on(e,oZ(this,e,t)),this},oV.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw TypeError('"listener" argument must be a function');return this.prependListener(e,oZ(this,e,t)),this},oV.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw TypeError('"listener" argument must be a function');if(!(r=this._events)||!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new oW:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new oW,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);
2r.removeListener&&this.emit("removeListener",e,a||t)}return this},oV.prototype.off=function(e,t){return this.removeListener(e,t)},oV.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0==arguments.length?(this._events=new oW,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new oW:delete n[e]),this;if(0==arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new oW,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do this.removeListener(e,t[t.length-1]);while(t[0]);return this},oV.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},oV.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):oJ.call(e,t)},oV.prototype.listenerCount=oJ,oV.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var oQ=eo(Object.freeze({__proto__:null,EventEmitter:oV,default:oV}));Object.defineProperty(oq,"__esModule",{value:!0});let o0=oQ;function o1(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}let o2=class extends o0.EventEmitter{emit(e,...t){let n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;let n=Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}let i=r[e];if(void 0===i)return!1;if("function"==typeof i)o1(i,this,t);else{let e=i.length,n=function(e){let t=e.length,n=Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)o1(n[r],this,t)}return!0}};var o3,o5,o8,o6,o4,o9,o7,ae,at,an,ar,ai,ao,aa,as,al,ac,ad,au,ah,af=oq.default=o2,ap=class e extends af{constructor({notificationHandler:e}={}){super(),io(this,o4),io(this,o7),io(this,at),io(this,o5,!1),io(this,o8,void 0),io(this,o6,void 0),ia(this,o8,[]),ia(this,o6,e)}destroy(){ii(this,o8).forEach(e=>{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),ia(this,o8,[]),ia(this,o5,!0)}push(e){is(this,o4,o9).call(this),ii(this,o8).push(e)}handle(e,t){if(is(this,o4,o9).call(this),t&&"function"!=typeof t)throw Error('"callback" must be a function if provided.');return Array.isArray(e)?t?is(this,o7,ae).call(this,e,t):is(this,o7,ae).call(this,e):t?is(this,at,an).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return is(this,o4,o9).call(this),async(t,n,r,i)=>{try{let[o,a,s]=await is(e,ao,aa).call(e,t,n,ii(this,o8));return a?(await is(e,ac,ad).call(e,s),i(o)):r(async t=>{try{await is(e,ac,ad).call(e,s)}catch(e){return t(e)}return t()})}catch(e){return i(e)}}}async _promiseHandle(e){return new Promise((t,n)=>{is(this,at,an).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})}};function ag(e){return JSON.stringify(e,null,2)}o5=new WeakMap,o8=new WeakMap,o6=new WeakMap,o4=new WeakSet,o9=function(){if(ii(this,o5))throw Error("This engine is destroyed and can no longer be used.")},o7=new WeakSet,ae=async function(e,t){try{if(0===e.length){let e=[{id:null,jsonrpc:"2.0",error:new oH(il.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,e):e}let n=(await Promise.all(e.map(this._promiseHandle.bind(this)))).filter(e=>void 0!==e);return t?t(null,n):n}catch(e){if(t)return t(e);throw e}},at=new WeakSet,an=async function(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){let n=new oH(il.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:null,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){let n=new oH(il.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return ii(this,o6)&&!iw(e,o_)?t(null):t(n,{id:e.id??null,jsonrpc:"2.0",error:n})}if(ii(this,o6)&&iw(e,oC)&&!iw(e,o_)){try{await ii(this,o6).call(this,e)}catch(e){return t(e)}return t(null)}let n=null,r={...e}
2,i={id:r.id,jsonrpc:r.jsonrpc};try{await is(ap,ar,ai).call(ap,r,i,ii(this,o8))}catch(e){n=e}return n&&(delete i.result,i.error||(i.error=oA(n))),t(n,i)},ar=new WeakSet,ai=async function(e,t,n){let[r,i,o]=await is(ap,ao,aa).call(ap,e,t,n);if(is(ap,au,ah).call(ap,e,t,i),await is(ap,ac,ad).call(ap,o),r)throw r},ao=new WeakSet,aa=async function(e,t,n){let r=[],i=null,o=!1;for(let a of n)if([i,o]=await is(ap,as,al).call(ap,e,t,a,r),o)break;return[i,o,r.reverse()]},as=new WeakSet,al=async function(e,t,n,r){return new Promise(i=>{let o=e=>{let n=e||t.error;n&&(t.error=oA(n)),i([n,!0])};try{n(e,t,n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new oH(il.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request: 3${ag(e)}`,{request:e})),r.push(n)),i([null,!1]))},o)}catch(e){o(e)}})},ac=new WeakSet,ad=async function(e){for(let t of e)await new Promise((e,n)=>{t(t=>t?n(t):e())})},au=new WeakSet,ah=function(e,t,n){if(!iu(t,"result")&&!iu(t,"error"))throw new oH(il.internal,`JsonRpcEngine: Response has no error or result for request: 4${ag(e)}`,{request:e});if(!n)throw new oH(il.internal,`JsonRpcEngine: Nothing ended request: 5${ag(e)}`,{request:e})},io(ap,ar),io(ap,ao),io(ap,as),io(ap,ac),io(ap,au);var am=Object.freeze(["eth_subscription"]),ay=(e=console)=>[(e,t,n,r)=>{let i=e.id,o=it=(it+1)%4294967295;e.id=o,t.id=o,n(n=>{e.id=i,t.id=i,n()})},(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=oz({message:"The request 'method' must be a non-empty string.",data:t})),r(t=>{let{error:r}=n;return r&&e.error(`MetaMask - RPC Error: ${r.message}`,r),t()})},function(e){let t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{t.ethDecryptDeprecation||"eth_decrypt"!==n.method?t.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==n.method?!t.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===n.method&&["ERC721","ERC1155"].includes(n.params?.type||"")&&(e.warn(ie.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(ie.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(ie.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),i()}}(e)],av=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},ab=e=>!!e&&"string"==typeof e&&e.startsWith("0x"),aE=()=>{};async function aw(e,t){try{let t=await async function(){return{name:function(e){let{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;let r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}(window),icon:await aS(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},aE)}catch(e){t.error({message:ie.errors.sendSiteMetadata(),originalError:e})}}async function aS(e){let{document:t}=e;for(let e of Array.from(t.querySelectorAll('head > link[rel~="icon"]')))if(e&&await a_(e.href))return e.href;return null}async function a_(e){return new Promise((t,n)=>{try{let n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(e){n(e)}})}var aC=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},ax=(e,t,n)=>(aC(e,t,"read from private field"),n?n.call(e):t.get(e)),ak=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},aM=(e,t,n,r)=>(aC(e,t,"write to private field"),t.set(e,n),n);function aA(e,t,n){try{Reflect.apply(e,t,n)}catch(e){setTimeout(()=>{throw e})}}class aI extends oV{emit(e,...t){let n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;let n=Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}let i=r[e];if(void 0===i)return!1;if("function"==typeof i)aA(i,this,t);else{let e=i.length,n=function(e){let t=e.length,n=Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)aA(n[r],this,t)}return!0}}var aR,aP,aT=ei(function e(t,n){if(t===n)return!0;
5if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var r,i,o,a=o[i];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}),aO=class e extends aI{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),ak(this,aR,void 0),ak(this,aP,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},aM(this,aP,null),aM(this,aR,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);let i=new ap;r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return ax(this,aR)}get selectedAddress(){return ax(this,aP)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw oz({message:ie.errors.invalidRequestArgs(),data:e});let{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw oz({message:ie.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw oz({message:ie.errors.invalidRequestParams(),data:e});let r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,av(e,t))})}_initializeState(e){if(this._state.initialized)throw Error("Provider already initialized.");if(e){let{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result??[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(ie.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new oH(1013,t??ie.errors.disconnected()),this._log.debug(n)):(n=new oH(1011,t??ie.errors.permanentlyDisconnected()),this._log.error(n),aM(this,aR,null),this._state.accounts=null,aM(this,aP,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){ab(e)?(this._handleConnect(e),e!==ax(this,aR)&&(aM(this,aR,e),this._state.initialized&&this.emit("chainChanged",ax(this,aR)))):this._log.error(ie.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;for(let t of(Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]),e))if("string"!=typeof t){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}if(!aT(this._state.accounts,n)&&(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,ax(this,aP)!==n[0]&&aM(this,aP,n[0]||null),this._state.initialized)){let e=[...n];this.emit("accountsChanged",e)}}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invali
5d isUnlocked parameter. Please report this bug.")}};aR=new WeakMap,aP=new WeakMap,aO._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var aL,aN,a$=aO,aD={exports:{}};function aB(){return aN?aL:(aN=1,aL=oQ.EventEmitter)}var aK,aU=eo(en);aK="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 n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var aj=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},aH=/%[sdj%]/g;function aF(e){if(!a8(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(aG(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(aH,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),a=r[n];n<i;a=r[++n])a2(a)||!a7(a)?o+=" "+a:o+=" "+aG(a);return o}function az(e,t){if(a4(g.process))return function(){return az(e,t).apply(this,arguments)};if(!0===od.noDeprecation)return e;var n=!1;return function(){if(!n){if(od.throwDeprecation)throw Error(t);od.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var aq,aW={};function aV(e){return a4(aq)&&(aq=od.env.NODE_DEBUG||""),aW[e=e.toUpperCase()]||(RegExp("\\b"+e+"\\b","i").test(aq)?aW[e]=function(){var t=aF.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:aW[e]=function(){}),aW[e]}function aG(e,t){var n={seen:[],stylize:aZ};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),a1(t)?n.showHidden=t:t&&sc(n,t),a4(n.showHidden)&&(n.showHidden=!1),a4(n.depth)&&(n.depth=2),a4(n.colors)&&(n.colors=!1),a4(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=aY),aJ(n,e,n.depth)}function aY(e,t){var n=aG.styles[t];return n?"\x1b["+aG.colors[n][0]+"m"+e+"\x1b["+aG.colors[n][1]+"m":e}function aZ(e,t){return e}function aJ(e,t,n){if(e.customInspect&&t&&sn(t.inspect)&&t.inspect!==aG&&(!t.constructor||t.constructor.prototype!==t)){var r,i,o=t.inspect(n,e);return a8(o)||(o=aJ(e,o,n)),o}var a=function(e,t){if(a4(t))return e.stylize("undefined","undefined");if(a8(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return a5(t)?e.stylize(""+t,"number"):a1(t)?e.stylize(""+t,"boolean"):a2(t)?e.stylize("null","null"):void 0}(e,t);if(a)return a;var s=Object.keys(t),l=(d={},s.forEach(function(e,t){d[e]=!0}),d);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),st(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return aX(t);if(0===s.length){if(sn(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(a9(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(se(t))return e.stylize(Date.prototype.toString.call(t),"date");if(st(t))return aX(t)}var d,u,h="",f=!1,p=["{","}"];return a0(t)&&(f=!0,p=["[","]"]),sn(t)&&(h=" [Function"+(t.name?": "+t.name:"")+"]"),a9(t)&&(h=" "+RegExp.prototype.toString.call(t)),se(t)&&(h=" "+Date.prototype.toUTCString.call(t)),st(t)&&(h=" "+aX(t)),0!==s.length||f&&0!=t.length?n<0?a9(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=f?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)sd(t,String(a))?o.push(aQ(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(aQ(e,t,n,r,i,!0))}),o}(e,t,n,l,s):s.map(function(r){return aQ(e,t,n,l,r,f)}),e.seen.pop(),r=h,i=p,u.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?i[0]+(""===r?"":r+"\n ")+" "+u.join(",\n ")+" "+i[1]:i[0]+r+" "+u.join(", ")+" "+i[1]):p[0]+h+p[1]}function aX(e){return"["+Error.prototype.toString.call(e)+"]"}function aQ(e,t,n,r,i,o){var a,s,l;if((l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[
5Setter]","special")),sd(r,i)||(a="["+i+"]"),s||(0>e.seen.indexOf(l.value)?(s=a2(n)?aJ(e,l.value,null):aJ(e,l.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),a4(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function a0(e){return Array.isArray(e)}function a1(e){return"boolean"==typeof e}function a2(e){return null===e}function a3(e){return null==e}function a5(e){return"number"==typeof e}function a8(e){return"string"==typeof e}function a6(e){return"symbol"==typeof e}function a4(e){return void 0===e}function a9(e){return a7(e)&&"[object RegExp]"===so(e)}function a7(e){return"object"==typeof e&&null!==e}function se(e){return a7(e)&&"[object Date]"===so(e)}function st(e){return a7(e)&&("[object Error]"===so(e)||e instanceof Error)}function sn(e){return"function"==typeof e}function sr(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function si(e){return I.isBuffer(e)}function so(e){return Object.prototype.toString.call(e)}function sa(e){return e<10?"0"+e.toString(10):e.toString(10)}aG.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]},aG.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var ss=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function sl(){var e,t;console.log("%s - %s",(t=[sa((e=new Date).getHours()),sa(e.getMinutes()),sa(e.getSeconds())].join(":"),[e.getDate(),ss[e.getMonth()],t].join(" ")),aF.apply(null,arguments))}function sc(e,t){if(!t||!a7(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function sd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var su="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function sh(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');if(su&&e[su]){var t;if("function"!=typeof(t=e[su]))throw TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,su,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,r){e?n(e):t(r)});try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),su&&Object.defineProperty(t,su,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,aj(e))}function sf(e,t){if(!e){var n=Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function sp(e){if("function"!=typeof e)throw TypeError('The "original" argument must be of type Function');function t(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var r=t.pop();if("function"!=typeof r)throw TypeError("The last argument must be of type Function");var i=this,o=function(){return r.apply(i,arguments)};e.apply(this,t).then(function(e){od.nextTick(o.bind(null,null,e))},function(e){od.nextTick(sf.bind(null,e,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,aj(e)),t}sh.custom=su;var sg,sm,sy,sv,sb=eo(Object.freeze({__proto__:null,_extend:sc,callbackify:sp,debuglog:aV,default:{inherits:aK,_extend:sc,log:sl,isBuffer:si,isPrimitive:sr,isFunction:sn,isError:st,isDate:se,isObject:a7,isRegExp:a9,isUndefined:a4,isSymbol:a6,isString:a8,isNumber:a5,isNullOrUndefined:a3,isNull:a2,isBoolean:a1,isArray:a0,inspect:aG,deprecate:az,format:aF,debuglog:aV,promisify:sh,callbackify:sp},deprecate:az,format:aF,inherits:aK,inspect:aG,isArray:a0,isBoolean:a1,isBuffer:si,isDate:se,isError:st,isFunction:sn,isNull:a2,isNullOrUndefined:a3,isNumber:a5,isObject:a7,isPrimitive:sr,isRegExp:a9,isString:a8,isSymbol:a6,isUndefined:a4,log:sl,promisify:sh}));function sE(){if(sv)return sy;function e(e,r){n(e,r),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return sv=1,sy={destroy:function(r,i){var o=this,a=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return a||s?i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,od.nextTick(n,this,r)):od.nextTick(n,this,r)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(n){!i&&n?o._writableState?o._writableState.errorEmitted?od.nextTick(t,o):(o._writableState.errorEmitted=!0,od.nextTick(e,o,n)):od.nextTick(e,o,n):i?(od.nextTick(t,o),i(n)):od.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 n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}var sw,sS,s_={},sC={};function sx(e,t,n){n||(n=Error);var r=function(e){function n(n,r,i){return e.call(this,"string"==typeof t?t:t(n,r,i))||this}return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e,n}(n);r.prototype.name=n.name,r.prototype.code=e,sC[e]=r}function sk(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"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 sM(){if(sS)return sw;sS=1;var e=s_.codes.ERR_INVALID_OPT_VALUE;return sw={getHighWaterMark:function(t,n,r,i){var o=null!=n.highWaterMark?n.highWaterMark:i?n[r]:null;
5if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new e(i?r:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}}sx("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),sx("ERR_INVALID_ARG_TYPE",function(e,t,n){if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",a=" argument",(void 0===s||s>e.length)&&(s=e.length),e.substring(s-a.length,s)===a)o="The ".concat(e," ").concat(r," ").concat(sk(t,"type"));else{var r,i,o,a,s,l,c=("number"!=typeof l&&(l=0),l+1>e.length||-1===e.indexOf(".",l))?"argument":"property";o='The "'.concat(e,'" ').concat(c," ").concat(r," ").concat(sk(t,"type"))}return o+". Received type ".concat(typeof n)},TypeError),sx("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),sx("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),sx("ERR_STREAM_PREMATURE_CLOSE","Premature close"),sx("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),sx("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),sx("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),sx("ERR_STREAM_WRITE_AFTER_END","write after end"),sx("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),sx("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),sx("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),s_.codes=sC;var sA,sI,sR,sP,sT,sO,sL=eo(Object.freeze({__proto__:null,default:"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 n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}));function sN(){if(sP)return sR;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(void 0),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}sP=1,sR=w,w.WritableState=E;var t,n,r={deprecate:function(){if(sI)return sA;function e(e){try{if(!er.localStorage)return!1}catch(e){return!1}var t=er.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return sI=1,sA=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}}}()},i=aB(),o=aU.Buffer,a=(void 0!==er?er:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=sE(),l=sM().getHighWaterMark,c=s_.codes,d=c.ERR_INVALID_ARG_TYPE,u=c.ERR_METHOD_NOT_IMPLEMENTED,h=c.ERR_MULTIPLE_CALLBACK,f=c.ERR_STREAM_CANNOT_PIPE,p=c.ERR_STREAM_DESTROYED,g=c.ERR_STREAM_NULL_VALUES,m=c.ERR_STREAM_WRITE_AFTER_END,y=c.ERR_UNKNOWN_ENCODING,v=s.errorOrDestroy;function b(){}function E(n,r,i){t=t||s$(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=l(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.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 n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new h;if(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)--n.pendingcb,r?(od.nextTick(i,t),od.nextTick(M,e,n),e._writableState.errorEmitted=!0,v(e,t)):(i(t),e._writableState.errorEmitted=!0,v(e,t),M(e,n));else{var o=x(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||C(e,n),r?od.nextTick(_,e,n,o,i):_(e,n,o,i)}}(r,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!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function w(e){var r=this instanceof(t=t||s$());if(!r&&!n.call(w,this))return new w(e);this._writableState=new E(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 S(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function _(e,t,n,r){n||0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain")),t.pendingcb--,r(),M(e,t)}function C(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=Array(n.bufferedRequestCount),o=n.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)i[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;
5i.allBuffers=s,S(t,n,!0,n.length,i,"",o.finish),n.pendingcb++,n.lastBufferedRequest=null,o.next?(n.corkedRequestsFree=o.next,o.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,d=r.callback;if(S(t,n,!1,n.objectMode?1:l.length,l,c,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&v(e,n),t.prefinished=!0,e.emit("prefinish"),M(e,t)})}function M(e,t){var n=x(t);if(n&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,od.nextTick(k,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return sL(w,i),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:r.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]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===w&&e&&e._writableState instanceof E}})):n=function(e){return e instanceof this},w.prototype.pipe=function(){v(this,new f)},w.prototype.write=function(e,t,n){var r,i,s,l,c,u,h,f=this._writableState,p=!1,y=!f.objectMode&&(h=e,o.isBuffer(h)||h instanceof a);return y&&!o.isBuffer(e)&&(r=e,e=o.from(r)),"function"==typeof t&&(n=t,t=null),y?t="buffer":t||(t=f.defaultEncoding),"function"!=typeof n&&(n=b),f.ending?(i=n,v(this,s=new m),od.nextTick(i,s)):!y&&(l=e,c=n,null===l?u=new g:"string"==typeof l||f.objectMode||(u=new d("chunk",["string","Buffer"],l)),u&&(v(this,u),od.nextTick(c,u),1))||(f.pendingcb++,p=function(e,t,n,r,i,a){if(!n){var s,l,c=(s=r,l=i,t.objectMode||!1===t.decodeStrings||"string"!=typeof s||(s=o.from(s,l)),s);r!==c&&(n=!0,i="buffer",r=c)}var d=t.objectMode?1:r.length;t.length+=d;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var h=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else S(e,t,!1,d,r,i,a);return u}(this,f,y,e,t,n)),p},w.prototype.cork=function(){this._writableState.corked++},w.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||C(this,e))},w.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 y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(w.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(e,t,n){n(new u("_write()"))},w.prototype._writev=null,w.prototype.end=function(e,t,n){var r,i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||(r=n,i.ending=!0,M(this,i),r&&(i.finished?od.nextTick(r):this.once("finish",r)),i.ended=!0,this.writable=!1),this},Object.defineProperty(w.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(w.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),w.prototype.destroy=s.destroy,w.prototype._undestroy=s.undestroy,w.prototype._destroy=function(e,t){t(e)},sR}function s$(){if(sO)return sT;sO=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};sT=a;var t=sX(),n=sN();sL(a,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];a.prototype[o]||(a.prototype[o]=n.prototype[o])}function a(e){if(!(this instanceof a))return new a(e);t.call(this,e),n.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",s)))}function s(){this._writableState.ended||od.nextTick(l,this)}function l(e){e.end()}return Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(a.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)}}),sT}var sD=I.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 sB(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!sD(e))throw Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=sU;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=sj;break;default:return void(this.write=sK)}this.charBuffer=new I(6),this.charReceived=0,this.charLength=0}function sK(e){return e.toString(this.encoding)}function sU(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function sj(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}sB.prototype.write=function(e){for(var t,n="";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),!((t=(n=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCo
5deAt(n.length-1))>=55296&&t<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return n;break}this.charLength+=this.surrogateSize,n=""}this.detectIncompleteChar(e);var i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(n+=e.toString(this.encoding,0,i)).length-1,(t=n.charCodeAt(i))>=55296&&t<=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),n.substring(0,i)}return n},sB.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},sB.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var sH=eo(Object.freeze({__proto__:null,StringDecoder:sB})),sF=s_.codes.ERR_STREAM_PREMATURE_CLOSE;function sz(){}var sq,sW,sV,sG,sY,sZ,sJ=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),i=r||sz,o=!1,r=function(){if(!o){o=!0;for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i.apply(this,t)}};var i,o,a=n.readable||!1!==n.readable&&t.readable,s=n.writable||!1!==n.writable&&t.writable,l=function(){t.writable||d()},c=t._writableState&&t._writableState.finished,d=function(){s=!1,c=!0,a||r.call(t)},u=t._readableState&&t._readableState.endEmitted,h=function(){a=!1,u=!0,s||r.call(t)},f=function(e){r.call(t,e)},p=function(){var e;return a&&!u?(t._readableState&&t._readableState.ended||(e=new sF),r.call(t,e)):s&&!c?(t._writableState&&t._writableState.ended||(e=new sF),r.call(t,e)):void 0},g=function(){t.req.on("finish",d)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",d),t.on("abort",p),t.req?g():t.on("request",g)):s&&!t._writableState&&(t.on("end",l),t.on("close",l)),t.on("end",h),t.on("finish",d),!1!==n.error&&t.on("error",f),t.on("close",p),function(){t.removeListener("complete",d),t.removeListener("abort",p),t.removeListener("request",g),t.req&&t.req.removeListener("finish",d),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",f),t.removeListener("close",p)}};function sX(){if(sZ)return sY;sZ=1,sY=E,E.ReadableState=b,oQ.EventEmitter;var e=function(e,t){return e.listeners(t).length},t=aB(),n=aU.Buffer,r=(void 0!==er?er:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};o=sb&&sb.debuglog?sb.debuglog("stream"):function(){};var i,o,a,s,l,c=function(){if(sm)return sg;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){var r,o;r=e,o=i[e],(r=n(r))in t?Object.defineProperty(t,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[r]=o}):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 n(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}sm=1;var r=aU.Buffer,i=sb.inspect,o=i&&i.custom||"inspect";return sg=function(){var e;function a(){(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,a),this.head=null,this.tail=null,this.length=0}return e=[{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,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return r.alloc(0);for(var t,n,i=r.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,n=a,r.prototype.copy.call(t,i,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=r.allocUnsafe(e),n=this.head,i=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,a),0==(e-=a)){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,t}},{key:o,value:function(e,n){return i(this,t(t({},n),{},{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var i=t[r];
vendor: 5,511 bytes, line 5
5i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}(a.prototype,e),Object.defineProperty(a,"prototype",{writable:!1}),a}()}(),d=sE(),u=sM().getHighWaterMark,h=s_.codes,f=h.ERR_INVALID_ARG_TYPE,p=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;sL(E,t);var y=d.errorOrDestroy,v=["error","close","destroy","pause","resume"];function b(e,t,n){i=i||s$(),e=e||{},"boolean"!=typeof n&&(n=t instanceof i),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=u(this,e,"readableHighWaterMark",n),this.buffer=new c,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!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(a||(a=sH.StringDecoder),this.decoder=new a(e.encoding),this.encoding=e.encoding)}function E(e){if(i=i||s$(),!(this instanceof E))return new E(e);var n=this instanceof i;this._readableState=new b(e,this,n),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),t.call(this)}function w(e,t,i,a,s){o("readableAddChunk",t);var l,c,d,u,h=e._readableState;if(null===t)h.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?C(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,x(e)))}}(e,h);else if(s||(l=t,n.isBuffer(l)||l instanceof r||"string"==typeof l||void 0===l||h.objectMode||(c=new f("chunk",["string","Buffer","Uint8Array"],l)),u=c),u)y(e,u);else if(h.objectMode||t&&t.length>0){if("string"==typeof t||h.objectMode||Object.getPrototypeOf(t)===n.prototype||(d=t,t=n.from(d)),a)h.endEmitted?y(e,new m):S(e,h,t,!0);else if(h.ended)y(e,new p);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!i?(t=h.decoder.write(t),h.objectMode||0!==t.length?S(e,h,t,!1):k(e,h)):S(e,h,t,!1)}}else a||(h.reading=!1,k(e,h));return!h.ended&&(h.length<h.highWaterMark||0===h.length)}function S(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&C(e)),k(e,t)}function _(e,t){var n;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=((n=e)>=1073741824?n=1073741824:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,od.nextTick(x,e))}function x(e){var t=e._readableState;o("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,P(e)}function k(e,t){t.readingMore||(t.readingMore=!0,od.nextTick(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(o("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function A(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 I(e){o("readable nexttick read 0"),e.read(0)}function R(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),P(e),t.flowing&&!t.reading&&e.read(0)}function P(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function T(e,t){var n;return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n)}function O(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,od.nextTick(L,t,e))}function L(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function N(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return -1}return 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=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=n.from(e,t),t=""),r=!0),w(this,e,t,!1,r)},E.prototype.unshift=function(e){return w(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){a||(a=sH.StringDecoder);var t=new a(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;
vendor: 2,616 bytes, line 5
5for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this},E.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):C(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(r=e>0?T(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),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},E.prototype._read=function(e){y(this,new g("_read()"))},E.prototype.pipe=function(t,n){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,n);var a=n&&!1===n.end||t===od.stdout||t===od.stderr?p:s;function s(){o("onend"),t.end()}i.endEmitted?od.nextTick(a):r.once("end",a),t.on("unpipe",function e(n,a){o("onunpipe"),n===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),t.removeListener("close",h),t.removeListener("finish",f),t.removeListener("drain",l),t.removeListener("error",u),t.removeListener("unpipe",e),r.removeListener("end",s),r.removeListener("end",p),r.removeListener("data",d),c=!0,i.awaitDrain&&(!t._writableState||t._writableState.needDrain)&&l())});var l=function(){var t=r._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e(r,"data")&&(t.flowing=!0,P(r))};t.on("drain",l);var c=!1;function d(e){o("ondata");var n=t.write(e);o("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==N(i.pipes,t))&&!c&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function u(n){o("onerror",n),p(),t.removeListener("error",u),0===e(t,"error")&&y(t,n)}function h(){t.removeListener("finish",f),p()}function f(){o("onfinish"),t.removeListener("close",h),p()}function p(){o("unpipe"),r.unpipe(t)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prepe
vendor: 4,554 bytes, line 5
5ndListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(t,"error",u),t.once("close",h),t.once("finish",f),t.emit("pipe",r),i.flowing||(o("pipe resume"),r.resume()),t},E.prototype.unpipe=function(e){var t=this._readableState,n={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,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=N(t.pipes,e);return -1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},E.prototype.on=function(e,n){var r=t.prototype.on.call(this,e,n),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,o("on readable",i.length,i.reading),i.length?C(this):i.reading||od.nextTick(I,this))),r},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,n){var r=t.prototype.removeListener.call(this,e,n);return"readable"===e&&od.nextTick(A,this),r},E.prototype.removeAllListeners=function(e){var n=t.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||od.nextTick(A,this),n},E.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,e.resumeScheduled||(e.resumeScheduled=!0,od.nextTick(R,this,e))),e.paused=!1,this},E.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(o("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(t.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));for(var a=0;a<v.length;a++)e.on(v[a],this.emit.bind(this,v[a]));return this._read=function(t){o("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===s&&(s=function(){if(sW)return sq;function e(e,t,n){var r;return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}sW=1;var t,n=Symbol("lastResolve"),r=Symbol("lastReject"),i=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),s=Symbol("handlePromise"),l=Symbol("stream");function c(e,t){return{value:e,done:t}}function d(e){var t=e[n];if(null!==t){var i=e[l].read();null!==i&&(e[a]=null,e[n]=null,e[r]=null,t(c(i,!1)))}}function u(e){od.nextTick(d,e)}var h=Object.getPrototypeOf(function(){}),f=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var e,t=this,n=this[i];if(null!==n)return Promise.reject(n);if(this[o])return Promise.resolve(c(void 0,!0));if(this[l].destroyed)return new Promise(function(e,n){od.nextTick(function(){t[i]?n(t[i]):e(c(void 0,!0))})});var r,d=this[a];if(d)r=new Promise((e=this,function(t,n){d.then(function(){e[o]?t(c(void 0,!0)):e[s](t,n)},n)}));else{var u=this[l].read();if(null!==u)return Promise.resolve(c(u,!1));r=new Promise(this[s])}return this[a]=r,r}},Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(c(void 0,!0))})})}),t),h);return sq=function(t){var d,h=Object.create(f,(e(d={},l,{value:t,writable:!0}),e(d,n,{value:null,writable:!0}),e(d,r,{value:null,writable:!0}),e(d,i,{value:null,writable:!0}),e(d,o,{value:t._readableState.endEmitted,writable:!0}),e(d,s,{value:function(e,t){var i=h[l].read();i?(h[a]=null,h[n]=null,h[r]=null,e(c(i,!1))):(h[n]=e,h[r]=t)},writable:!0}),d));
5return h[a]=null,sJ(t,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[r];return null!==t&&(h[a]=null,h[n]=null,h[r]=null,t(e)),void(h[i]=e)}var s=h[n];null!==s&&(h[a]=null,h[n]=null,h[r]=null,s(c(void 0,!0))),h[o]=!0}),t.on("readable",u.bind(null,h)),h}}()),s(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=T,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===l&&(l=sG?sV:(sG=1,sV=function(){throw Error("Readable.from is not available in the browser")})),l(E,e,t)}),sY}var sQ=s_.codes,s0=sQ.ERR_METHOD_NOT_IMPLEMENTED,s1=sQ.ERR_MULTIPLE_CALLBACK,s2=sQ.ERR_TRANSFORM_ALREADY_TRANSFORMING,s3=sQ.ERR_TRANSFORM_WITH_LENGTH_0,s5=s$();function s8(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new s1);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function s6(e){if(!(this instanceof s6))return new s6(e);s5.call(this,e),this._transformState={afterTransform:s8.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",s4)}function s4(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?s9(this,null,null):this._flush(function(t,n){s9(e,t,n)})}function s9(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new s3;if(e._transformState.transforming)throw new s2;return e.push(null)}function s7(e){if(!(this instanceof s7))return new s7(e);s6.call(this,e)}sL(s6,s5),s6.prototype.push=function(e,t){return this._transformState.needTransform=!1,s5.prototype.push.call(this,e,t)},s6.prototype._transform=function(e,t,n){n(new s0("_transform()"))},s6.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s6.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))},s6.prototype._destroy=function(e,t){s5.prototype._destroy.call(this,e,function(e){t(e)})},sL(s7,s6),s7.prototype._transform=function(e,t,n){n(null,e)};var le=s_.codes,lt=le.ERR_MISSING_ARGS,ln=le.ERR_STREAM_DESTROYED;function lr(e){if(e)throw e}function li(e){e()}function lo(e,t){return e.pipe(t)}lC=aD.exports,(lC=aD.exports=sX()).Stream=lC,lC.Readable=lC,lC.Writable=sN(),lC.Duplex=s$(),lC.Transform=s6,lC.PassThrough=s7,lC.finished=sJ,lC.pipeline=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i,o=(r=t).length?"function"!=typeof r[r.length-1]?lr:r.pop():lr;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new lt("streams");var a=t.map(function(e,n){var r,s,l,c,d,u,h=n<t.length-1;return r=n>0,l=s=function(e){i||(i=e),e&&a.forEach(li),h||(a.forEach(li),o(i))},c=!1,s=function(){c||(c=!0,l.apply(void 0,arguments))},d=!1,e.on("close",function(){d=!0}),void 0===l_&&(l_=sJ),l_(e,{readable:h,writable:r},function(e){if(e)return s(e);d=!0,s()}),u=!1,function(t){if(!d&&!u)return u=!0,e.setHeader&&"function"==typeof e.abort?e.abort():"function"==typeof e.destroy?e.destroy():void s(t||new ln("pipe"))}});return t.reduce(lo)};var la=aD.exports,ls={},ll={exports:{}},lc=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];
5return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}};function ld(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function lu(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}ll.exports=lc(ld),ll.exports.strict=lc(lu),ld.proto=ld(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return ld(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return lu(this)},configurable:!0})});var lh=ll.exports,lf={};Object.defineProperty(lf,"__esModule",{value:!0}),lf.Substream=void 0;let lp=la;class lg extends lp.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),this._parent=e,this._name=t}_read(){}_write(e,t,n){this._parent.push({name:this._name,data:e}),n()}}lf.Substream=lg;var lm=er&&er.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ls,"__esModule",{value:!0}),ls.ObjectMultiplex=void 0;let ly=la,lv=lm(lh),lb=Symbol("IGNORE_SUBSTREAM"),lE=class extends ly.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){if(this.destroyed)throw Error(`ObjectMultiplex - parent stream for name "${e}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw Error(`ObjectMultiplex - parent stream for name "${e}" already ended`);if(!e)throw Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw Error(`ObjectMultiplex - Substream for name "${e}" already exists`);let t=new lf.Substream({parent:this,name:e});return this._substreams[e]=t,function(e,t){let n=(0,lv.default)(t);(0,ly.finished)(e,{readable:!1},n),(0,ly.finished)(e,{writable:!1},n)}(this,e=>t.destroy(e||void 0)),t}ignoreStream(e){if(!e)throw Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=lb}_read(){}_write(e,t,n){let{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();let o=this._substreams[r];return o?o!==lb&&o.push(i):console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n()}};ls.ObjectMultiplex=lE;var lw=ei(ls.ObjectMultiplex);let lS=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;lS.writable=e=>lS(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,lS.readable=e=>lS(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,lS.duplex=e=>lS.writable(e)&&lS.readable(e),lS.transform=e=>lS.duplex(e)&&"function"==typeof e._transform;var l_,lC,lx,lk=class extends a${constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!lS.duplex(e))throw Error(ie.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);let o=new lw;la.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=function(e={}){let t={},n=new la.Duplex({objectMode:!0,read:()=>{},write:function(i,o,a){let s=null;try{i.id?function(e){let{id:n}=e;if(null===n)return;let r=t[n];if(!r)return void console.warn(`StreamMiddleware - Unknown response id "${n}"`);delete t[n],Object.assign(r.res,e),setTimeout(r.end)}(i):(e?.retryOnMessage&&i.method===e.retryOnMessage&&Object.values(t).forEach(({req:e,retryCount:r=0})=>{if(!e.id)return;if(r>=3)throw Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);let i=t[e.id];i&&(i.retryCount=r+1),n.push(e)}),r.emit("notification",i))}catch(e){s=e}a(s)}}),r=new af;return{events:r,middleware:(e,r,i,o)=>{t[e.id]={req:e,res:r,next:i,end:o},n.push(e)},stream:n}}({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),la.pipeline(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",t=>{let{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):am.includes(n)?this.emit
5("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(Error(ie.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;t?.stack&&(n+=` 6${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){let n;ab(e)&&(n=t)&&"string"==typeof n?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(ie.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},lM=class extends lk{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:ay(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},ak(this,lx,void 0),this._initializeStateAsync(),aM(this,lx,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",e=>{let{method:t}=e;am.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))}),i){if("complete"===document.readyState)aw(this._rpcEngine,this._log);else{let e=()=>{aw(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(ie.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(ie.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),ax(this,lx)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(ie.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),ax(this,lx)&&!e&&aM(this,lx,null)}_warnOfDeprecation(e){!1===this._sentWarnings?.events[e]&&(this._log.warn(ie.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(ie.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},av(e,t))}catch(e){t(e)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(ie.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},av(n,r,!1))}catch(e){r(e)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,aE),t=!0;break;case"net_version":t=ax(this,lx)??null;break;default:throw Error(ie.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw oz({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,av(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(ie.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==ax(this,lx)&&(aM(this,lx,t),this._state.initialized&&this.emit
6("networkChanged",ax(this,lx)))}};lx=new WeakMap;let lA=l()("MM_SDK");lA.color="#FFAC1C";var lI={},lR={};Object.defineProperty(lR,"__esModule",{value:!0}),lR.EthereumProviderError=lR.EthereumRpcError=void 0;class lP extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){let e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return o$.default(this.serialize(),lT,2)}}function lT(e,t){if("[Circular]"!==t)return t}lR.EthereumRpcError=lP,lR.EthereumProviderError=class extends lP{constructor(e,t,n){if(!(Number.isInteger(e)&&e>=1e3&&e<=4999))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}};var lO={},lL={};Object.defineProperty(lL,"__esModule",{value:!0}),lL.errorValues=lL.errorCodes=void 0,lL.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},lL.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;let t=lL.errorCodes.rpc.internal,n={code:t,message:r(t)};function r(t,n="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(t)){let n=t.toString();if(a(lL.errorValues,n))return lL.errorValues[n].message;if(t>=-32099&&t<=-32e3)return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function i(e){if(!Number.isInteger(e))return!1;let t=e.toString();return!!lL.errorValues[t]||!!(e>=-32099&&e<=-32e3)}function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=i,e.serializeError=function(e,{fallbackError:t=n,shouldIncludeStack:s=!1}={}){if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw Error("Must provide fallback error with integer number code and string message.");if(e instanceof lR.EthereumRpcError)return e.serialize();let l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&a(e,"code")&&i(e.code))l.code=e.code,e.message&&"string"==typeof e.message?(l.message=e.message,a(e,"data")&&(l.data=e.data)):(l.message=r(l.code),l.data={originalError:o(e)});else{l.code=t.code;let n=null==e?void 0:e.message;l.message=n&&"string"==typeof n?n:t.message,l.data={originalError:o(e)}}let c=null==e?void 0:e.stack;return s&&e&&c&&"string"==typeof c&&(l.stack=c),l}}(lO);var lN={};function l$(e,t){let[n,r]=lB(t);return new lR.EthereumRpcError(e,n||lO.getMessageFromCode(e),r)}function lD(e,t){let[n,r]=lB(t);return new lR.EthereumProviderError(e,n||lO.getMessageFromCode(e),r)}function lB(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:n}=e;
6if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,n]}}return[]}Object.defineProperty(lN,"__esModule",{value:!0}),lN.ethErrors=void 0,lN.ethErrors={rpc:{parse:e=>l$(lL.errorCodes.rpc.parse,e),invalidRequest:e=>l$(lL.errorCodes.rpc.invalidRequest,e),invalidParams:e=>l$(lL.errorCodes.rpc.invalidParams,e),methodNotFound:e=>l$(lL.errorCodes.rpc.methodNotFound,e),internal:e=>l$(lL.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code <= -32005');return l$(t,e)},invalidInput:e=>l$(lL.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>l$(lL.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>l$(lL.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>l$(lL.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>l$(lL.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>l$(lL.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>lD(lL.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>lD(lL.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>lD(lL.errorCodes.provider.unsupportedMethod,e),disconnected:e=>lD(lL.errorCodes.provider.disconnected,e),chainDisconnected:e=>lD(lL.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw Error('"message" must be a nonempty string');return new lR.EthereumProviderError(t,n,r)}}},Object.defineProperty(lI,"__esModule",{value:!0}),lI.getMessageFromCode=lI.serializeError=lI.EthereumProviderError=lI.EthereumRpcError=lI.ethErrors=lI.errorCodes=void 0,Object.defineProperty(lI,"EthereumRpcError",{enumerable:!0,get:function(){return lR.EthereumRpcError}}),Object.defineProperty(lI,"EthereumProviderError",{enumerable:!0,get:function(){return lR.EthereumProviderError}}),Object.defineProperty(lI,"serializeError",{enumerable:!0,get:function(){return lO.serializeError}}),Object.defineProperty(lI,"getMessageFromCode",{enumerable:!0,get:function(){return lO.getMessageFromCode}}),Object.defineProperty(lI,"ethErrors",{enumerable:!0,get:function(){return lN.ethErrors}}),Object.defineProperty(lI,"errorCodes",{enumerable:!0,get:function(){return lL.errorCodes}});var lK={exports:{}};lK.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,(function(t){return e[t]}).bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";
vendor: 24,060 bytes, line 6
6case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),a=Math.max(i,o),s=0,l=e.map([t,n],function(t){var n=a-e.getVersionPrecision(t),r=t+Array(n+1).join(".0");return e.map(r.split("."),function(e){return Array(20-e.length).join("0")+e}).reverse()});for(r&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(l[0][a]>l[1][a])return 1;if(l[0][a]===l[1][a]){if(a===s)return 0;a-=1}else if(l[0][a]<l[1][a])return -1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(Object.assign)return Object.assign.apply(Object,[e].concat(i));for(t=0,n=i.length;t<n;t+=1)(function(){var n=i[t];"object"==typeof n&&null!==n&&Object.keys(n).forEach(function(t){e[t]=n[t]})})();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18),a=function(){function e(){}return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e,[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}]),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=l(n(92)),i=l(n(93)),o=l(n(94)),a=l(n(95)),s=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(r.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach(function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==typeof a&&(n[t]=a,r+=1)}),r>0){var a=Object.keys(n),l=s.default.find(a,function(e){return t.isOS(e)});if(l){var c=this.satisfies(n[l]);if(void 0!==c)return c}var d=s.default.find(a,function(e){return t.isPlatform(e)});if(d){var u=this.satisfies(n[d]);if(void 0!==u)return u}}if(o>0){var h=Object.keys(i),f=s.default.find(h,function(e){return t.isBrowser(e,!0)});if(void 0!==f)return this.compareVersion(i[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(s.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=c,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}});var lU=ei(lK.exports);let lj={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class lH{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSe
6ndMetadata:n=!1,shouldShimWeb3:r,sdkInstance:i}){let o=new lq({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),a=new Proxy(o,{deleteProperty:()=>!0});if(this.provider=a,this.sdkInstance=i,e&&"undefined"!=typeof window)try{window.ethereum=o,window.dispatchEvent(new Event("ethereum#initialized"))}catch(e){lA("[Ethereum] Unable to set global provider - window.ethereum may be read-only",e)}if(r&&"undefined"!=typeof window)try{!function(e,t=console){let n=!1,r=!1;if(!window.web3){let i="__isMetaMaskShim__",o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,a,...s)=>("currentProvider"!==a||n?"currentProvider"===a||a===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch(e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)})):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,a,...s)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}}(this.provider)}catch(e){lA("[Ethereum] Unable to shim web3 - window.web3 may be read-only",e)}this.provider.on("display_uri",e=>{this.sdkInstance.emit(lj.DisplayURI,e)}),this.provider.on("_initialized",()=>{let e={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(lj.Initialized,e),lA("[Ethereum: constructor()] provider initialized",e)})}static init(e){var t;return lA("[Ethereum: init()] Initializing Ethereum service"),this.instance=new lH(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class lF{constructor({useDeepLink:e,preferredOpenLink:t,debug:n=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.debug=n}openDeeplink(e,t,n){return function(e,t,n,r){let{state:i}=e;lA(`[PlatfformManager: openDeeplink()] universalLink --> ${t}`),lA(`[PlatfformManager: openDeeplink()] deepLink --> ${n}`);try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(lA(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${i.useDeeplink} link=${i.useDeeplink?n:t}`),i.useDeeplink)"undefined"!=typeof window&&(window.location.href=n);else if("undefined"!=typeof document){let e=document.createElement("a");e.href=t,e.target="_self",e.rel="noreferrer noopener",e.click()}}catch(e){console.log("[PlatfformManager: openDeeplink()] can't open link",e)}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null==window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(){let e=lH.getProvider()||(null==window?void 0:window.ethereum);return lA(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;let n=lU.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===i4.MobileWeb}static isNotBrowser(){var e;return"undefined"==typeof window||!(null==window?void 0:window.navigator)||void 0!==g&&"ReactNative"===(null===(e=null==g?void 0:g.navigator)||void 0===e?void 0:e.product)||"ReactNative"===(null==navigator?void 0:navigator.product)}isNotBrowser(){return lF.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return lF.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){let{state:t}=e;return t.platformType?t.platformType:e.isReactNative()?i4.ReactNative:e.isNotBrowser()?i4.NonBrowser:e.isMetaMaskMobileWebView()?i4.MetaMaskMobileWebview:e.isMobile()?i4.MobileWeb:i4.DesktopWeb}(this)}}let lz=e=>p(void 0,void 0,void 0,function*(){if(lF.isBrowser()){let{StorageManagerWeb:t}=yield Promise.resolve().then(function(){return cI});return new t(e)}return Promise.resolve({persistChannelConfig:()=>p(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>p(void 0,void 0,void 0,function*(){}),persistAccounts:()=>p(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>p(void 0,void 0,void 0,function*(){return[]}
6),persistChainId:()=>p(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>p(void 0,void 0,void 0,function*(){}),terminate:()=>p(void 0,void 0,void 0,function*(){})})});class lq extends lM{constructor({connectionStream:e,shouldSendMetadata:t,autoRequestAccounts:n=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},lA(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return p(this,void 0,void 0,function*(){return lA(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){lA("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;let{accounts:t}=this._state;return t&&0!==t.length?(null===(e=t[0])||void 0===e?void 0:e.toLowerCase())||"":(lA("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,t){return this._handleAccountsChanged(e,t)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){let{state:n}=t;lA(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${e}`,t),e&&(t._state.accounts=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",lI.ethErrors.provider.disconnected()),n.providerStateRequested=!1}({terminate:e,instance:this})}_initializeStateAsync(){return p(this,void 0,void 0,function*(){return function(e){var t,n;return p(this,void 0,void 0,function*(){let r;void 0===e.state&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});let{state:i}=e;if(i.providerStateRequested)lA("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let o;i.providerStateRequested=!0;let a=null,s=!1,l=!1,c=yield lz({enabled:!0});if(c){let e=yield c.getPersistedChannelConfig({});s=null!==(t=null==e?void 0:e.relayPersistence)&&void 0!==t&&t,o=yield c.getCachedChainId();let n=yield c.getCachedAccounts();n.length>0&&(a=n[0])}if(lA(`[SDKProvider: initializeStateAsync()] relayPersistence=${s}`,{relayPersistence:s,cachedChainId:o,cachedSelectedAddress:a}),s){if(o&&a)r={accounts:[a],chainId:o,isUnlocked:!1},l=!0;else try{r=yield e.request({method:"metamask_getProviderState"})}catch(t){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",t),void(i.providerStateRequested=!1)}}if(0===(null===(n=null==r?void 0:r.accounts)||void 0===n?void 0:n.length)){if(e.getSelectedAddress())r.accounts=[e.getSelectedAddress()];else{lA("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");let t=yield e.request({method:"eth_requestAccounts",params:[]});r.accounts=t}}e._initializeState(r),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:null==r?void 0:r.chainId}))}})}(this)})}_initializeState(e){var t;return lA("[SDKProvider: _initializeState()]",e),t=super._initializeState.bind(this),lA("[SDKProvider: initializeState()] set state._initialized to false"),this._state.initialized=!1,t(e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.state.chainId=e,this.state.networkVersion=t,function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){lA(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let i=n;n||(lA("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),i="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:i})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var lW,lV={version:"0.32.1"};(c2=lW||(lW={})).INPAGE="metamask-inpage",c2.CONTENT_SCRIPT="metamask-contentscript",c2.PROVIDER="metamask-provider";let lG="direct",lY="https://metamask.app.link/connect",lZ="metamask://connect",lJ={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},lX=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,lQ={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPE
6RMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},l0={[lQ.ETH_REQUESTACCOUNTS]:!0,[lQ.ETH_SENDTRANSACTION]:!0,[lQ.ETH_SIGNTRANSACTION]:!0,[lQ.ETH_SIGN]:!0,[lQ.PERSONAL_SIGN]:!0,[lQ.ETH_ACCOUNTS]:!1,[lQ.ETH_CHAINID]:!1,[lQ.PERSONAL_SIGN]:!0,[lQ.ETH_SIGNTYPEDDATA]:!0,[lQ.ETH_SIGNTYPEDDATA_V3]:!0,[lQ.ETH_SIGNTYPEDDATA_V4]:!0,[lQ.WALLET_REQUESTPERMISSIONS]:!0,[lQ.WALLET_GETPERMISSIONS]:!0,[lQ.WALLET_WATCHASSET]:!0,[lQ.WALLET_ADDETHEREUMCHAIN]:!0,[lQ.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[lQ.METAMASK_CONNECTSIGN]:!0,[lQ.METAMASK_CONNECTWITH]:!0,[lQ.PERSONAL_EC_RECOVER]:!0,[lQ.METAMASK_BATCH]:!0,[lQ.METAMASK_OPEN]:!0},l1=Object.keys(l0).filter(e=>!0===l0[e]).map(e=>e.toLowerCase()),l2=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),l3=".sdk-comm",l5="providerType",l8=".MMSDK_cached_address",l6=".MMSDK_cached_chainId",l4={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"};(c3=c8||(c8={})).TERMINATE="terminate",c3.EXTENSION="extension",c3.INITIALIZED="initialized";let l9="undefined"!=typeof window&&window.localStorage;function l7(e){var t,n;return p(this,void 0,void 0,function*(){lA("[MetaMaskSDK: connectWithExtensionProvider()] ",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{let e=yield null===(t=window.extension)||void 0===t?void 0:t.request({method:"eth_requestAccounts"});lA(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(e){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",e)}localStorage.setItem(l5,"extension"),e.extensionActive=!0,e.emit(lj.ProviderUpdate,c8.EXTENSION),e.options.enableAnalytics&&(null===(n=e.analytics)||void 0===n||n.send({event:i3.SDK_USE_EXTENSION}))})}function ce(e){let t;if(void 0!==I)t=I.from(e,"utf8").toString("base64");else if("function"==typeof btoa)t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/gu,(e,t)=>String.fromCharCode(parseInt(t,16))));else{if("object"!=typeof g||!("Buffer"in g))throw Error("Unable to base64 encode: No available method.");t=g.Buffer.from(e,"utf8").toString("base64")}return t}class ct extends la.Duplex{constructor({name:e,remote:t,deeplinkProtocol:n,platformManager:r}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=t,this.state.deeplinkProtocol=n,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(iQ.MESSAGE,this._onMessage)}_write(e,t,n){return p(this,void 0,void 0,function*(){return function(e,t,n,r){var i,o,a,s,l,c,d,u,h,f,g,m,y,v,b,E,w,S,_,C;return p(this,void 0,void 0,function*(){let n=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),p=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),x=null===(a=e.state.remote)||void 0===a?void 0:a.isPaused(),k=lH.getProvider(),M=null===(s=e.state.remote)||void 0===s?void 0:s.getChannelId(),A=null===(l=e.state.remote)||void 0===l?void 0:l.isAuthorized(),{deeplinkProtocol:R}=e.state,{method:P,data:T,triggeredInstaller:O}=(e=>{var t,n,r,i;let o;I.isBuffer(e)?(o=e.toJSON())._isBuffer=!0:o=e;let a=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.method,s=!1;return"object"==typeof(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.params)&&!0===(null===(i=null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.params)||void 0===i?void 0:i.__triggeredInstaller)&&(s=!0,o.data.params=o.data.params.wrappedParams),{method:a,data:o,triggeredInstaller:s}})(t);if(lA(`[RCPMS: write()] method='${P}' isRemoteReady=${n} channelId=${M} isSocketConnected=${p} isRemotePaused=${x} providerConnected=${k.isConnected()}`,t),!M)return P!==lQ.METAMASK_GETPROVIDERSTATE&&lA(`[RCPMS: write()] ${P} --> channelId is undefined`),r(Error("disconnected"));
6lA(`[RCPMS: write()] remote.isPaused()=${null===(c=e.state.remote)||void 0===c?void 0:c.isPaused()} authorized=${A} ready=${n} socketConnected=${p}`,t);let L=null===(d=e.state.platformManager)||void 0===d?void 0:d.isSecure(),N=null!==(h=null===(u=e.state.platformManager)||void 0===u?void 0:u.isMobileWeb())&&void 0!==h&&h,$=null!==(g=null===(f=e.state.remote)||void 0===f?void 0:f.hasDeeplinkProtocol())&&void 0!==g&&g&&N&&A;try{if(!O){let t=JSON.stringify(null==T?void 0:T.data);if(t.length>1e6)return r(Error(`Message size ${t.length} exceeds maximum allowed size of 1000000 bytes`));null===(m=e.state.remote)||void 0===m||m.sendMessage(null==T?void 0:T.data).then(()=>{lA(`[RCPMS: _write()] ${P} sent successfully`)}).catch(e=>{lA("[RCPMS: _write()] error sending message",e)})}if(!L)return lA(`[RCPMS: _write()] unsecure platform for method ${P} -- return callback`),r();if(O)return lA("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();let t=null!==(b=null===(v=null===(y=e.state.remote)||void 0===y?void 0:y.getKeyInfo())||void 0===v?void 0:v.ecies.public)&&void 0!==b?b:"",n=encodeURI(`channelId=${M}&pubkey=${t}&comm=socket&t=d&v=2`);if($){let t=JSON.stringify(null==T?void 0:T.data),i=null===(E=e.state.remote)||void 0===E?void 0:E.encrypt(t);if(!i)return lA("[RCPMS: _write()] error encrypting message"),r(Error("RemoteCommunicationPostMessageStream - disconnected"));n+=`&scheme=${R}&rpc=${ce(i)}`}if(!(null===(w=e.state.platformManager)||void 0===w?void 0:w.isMetaMaskInstalled()))return lA("[RCPMS: _write()] prevent deeplink until installation is completed."),r();l0[P]?(lA(`[RCPMS: _write()] redirect link for '${P}' socketConnected=${p} connect?${n}`),null===(S=e.state.platformManager)||void 0===S||S.openDeeplink(`${lY}?${n}`,`${lZ}?${n}`,"_self")):(null===(_=e.state.remote)||void 0===_?void 0:_.isPaused())?(lA(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${P}`),null===(C=e.state.platformManager)||void 0===C||C.openDeeplink(`${lY}?redirect=true&${n}`,`${lZ}?redirect=true&${n}`,"_self")):lA(`[RCPMS: _write()] method ${P} doesn't need redirect.`)}catch(e){return lA("[RCPMS: _write()] error sending message",e),r(Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}(this,e,0,n)})}_read(){}_onMessage(e){return function(e,t){try{if(lA("[RCPMS: onMessage()] message",t),!t||"object"!=typeof t||"object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return void lA("[RCPMS: onMessage()] ignore message without name",t);if((null==t?void 0:t.name)!==lW.PROVIDER)return void lA(`[RCPMS: onMessage()] ignore message with wrong name message=${t}`);if(I.isBuffer(t)){let n=I.from(t);e.push(n)}else e.push(t)}catch(e){lA(`[RCPMS: onMessage()] ignore message error err=${e}`)}}(this,e)}start(){}}let cn=1,cr=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)}),ci=({checkInstallationOnAllCalls:e=!1,communicationLayerPreference:t,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:s,remoteConnection:l,debug:c})=>p(void 0,void 0,void 0,function*(){var d,u;let h=(({name:e,remoteConnection:t})=>{if(!t||!(null==t?void 0:t.getConnector()))throw Error("Missing remote connection parameter");return new ct({name:e,remote:null==t?void 0:t.getConnector(),deeplinkProtocol:null==t?void 0:t.state.deeplinkProtocol,platformManager:null==t?void 0:t.getPlatformManager()})})({name:lW.INPAGE,target:lW.CONTENT_SCRIPT,platformManager:i,communicationLayerPreference:t,remoteConnection:l}),f=i.getPlatformType(),g=s.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${lV.version} Platform/${f} dApp/${null!==(d=g.url)&&void 0!==d?d:g.name} dAppTitle/${g.name}`,y=null,v=null,b=null===(u=s.options.storage)||void 0===u?void 0:u.storageManager;if(b){try{let e=yield b.getCachedAccounts();e.length>0&&(y=e[0])}catch(e){console.error(`[initializeMobileProvider] failed to get cached addresses: ${e}`)}try{let e=yield b.getCachedChainId();e&&(v=e)}catch(e){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${e}`)}}lA(`[initializeMobileProvider] cachedAccountAddress: ${y}, cachedChainId: ${v}`);let E=!(!n||f===i4.NonBrowser||f===i4.ReactNative),w=lH.init({shouldSetOnWindow:E,connectionStream:h,shouldShimWeb3:r,sdkInstance:s}),S=!1,_=e=>{S=e},C=()=>S,x=(t,n,r,c)=>p(void 0,void 0,void 0,function*(){var d,u,h,f,g,E,w,x,k;let M=lH.getProvider();if(S){M.emit("display_uri",(null==l?void 0:l.state.qrcodeLink)||""),null==l||l.showActiveModal();let e=C();for(;e;){let t=C(),n=null==l?void 0:l.isAuthorized();e=t&&!n,lA(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${t} authorized: ${n}`),yield cr(1e3)}return lA("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),r(...n)}let A=i.isMetaMaskInstalled(),I=null==l?void 0:l.isConnected(),R=null,P=null,T=null;if(R=null!==(d=M.getSelectedAddress())&&void 0!==d?d:y,T=M.getChainId()||v,R&&b&&R!==y&&b.persistAccounts([R]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}),T&&(v=T,b&&b.persistChainId(T).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),lA("[initializeMobileProvider: sendRequest()]",{selectedAddress:R,chainId:T}),c&&lA(`[initializeMobileProvider: sendRequest()] method=${t} ongoing=${S} selectedAddress=${R} isInstalled=${A} checkInstallationOnAllCalls=${e} socketConnected=${I}`),R&&t.toLowerCase()===lQ.ETH_ACCOUNTS.toLowerCase())return[R];if(T&&t.toLowerCase()===lQ.ETH_CHAINID.toLowerCase())return T;let O=[lQ.ETH_REQUESTACCOUNTS,lQ.WALLET_REQUESTPERMISSIONS,lQ.METAMASK_CONNECTSIGN,lQ.METAMASK_CONNECTWITH],L=!l0[t],N=null===(u=s.options.readonlyRPCMap)||void 0===u?void 0:u[T];if(N&&L)try{let e=null===(h=null==n?void 0:n[0])||void 0===h?void 0:h.params,r=yield(({rpcEndpoint:e,method:t,sdkInfo:n,params:r})=>p(void 0,void 0,void 0,function*(){let i;let o=JSON.stringify({jsonrpc:"2.0",method:t,params:r,id:cn+=1}),s={Accept:"application/json","Content-Type":"application/json"};e.includes("infura")&&(s["Metamask-Sdk-Info"]=n);try{i=yield a()(e,{method:"POST",headers:s,body:o})}catch(e){throw e instanceof Error?Error(`Failed to fetch from RPC: ${e.message}`):Error(`Failed to fetch from RPC: ${e}`)}if(!i.ok)throw Error(`Server responded with a status of ${i.status}`);return(yield i.json()).result}))({rpcEndpoint:N,sdkInfo:m,method:t,params:e||[]});return c&&lA(`initializeProvider::ReadOnlyRPCResponse ${r}`),r}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${t} readOnlyRPCRequest failed:`,e)}if((!A||A&&!I)&&t!==lQ.METAMASK_GETPROVIDERSTATE){let a=(null===(f=null==n?void 0:n[0])||void 0===f?void 0:f.params)||[];if(-1!==O.indexOf(t)||e){_(!0);let e=t===lQ.METAMASK_CONNECTWITH,i=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:e?{method:t,id:i,params:a}:void 0}),yield new Promise((e,t)=>
6{(null==l?void 0:l.isAuthorized())&&(lA("[initializeMobileProvider: sendRequest()] already authorized"),e(!0)),null==l||l.getConnector().once(iQ.AUTHORIZED,()=>{e(!0)}),s.once(iQ.PROVIDER_UPDATE,e=>{lA(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${e}`),e===c8.EXTENSION?t(iQ.PROVIDER_UPDATE):t(Error("Connection Terminated"))})})}catch(e){if(c8.EXTENSION===e){if(lA(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${t} on the active provider`),t.toLowerCase()===lQ.METAMASK_CONNECTSIGN.toLowerCase()){let e=yield null===(g=s.getProvider())||void 0===g?void 0:g.request({method:lQ.ETH_REQUESTACCOUNTS,params:[]});if(!e.length)throw Error("SDK state invalid -- undefined accounts");let t=yield null===(E=s.getProvider())||void 0===E?void 0:E.request({method:lQ.PERSONAL_SIGN,params:[a[0],e[0]]});return s.emit(lj.ConnectWithResponse,t),t}if(t.toLowerCase()===lQ.METAMASK_CONNECTWITH.toLowerCase()){let[e]=a,t=yield(({method:e,sdk:t,params:n})=>p(void 0,void 0,void 0,function*(){var r,i,o,a;if(!t.isExtensionActive())throw Error("SDK state invalid -- extension is not active");lA("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);let s=yield null===(r=t.getProvider())||void 0===r?void 0:r.request({method:lQ.ETH_REQUESTACCOUNTS,params:[]});if(!s.length)throw Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===lQ.PERSONAL_SIGN.toLowerCase()){let r={method:e,params:[n[0],s[0]]};return yield null===(i=t.getProvider())||void 0===i?void 0:i.request(r)}if((null==e?void 0:e.toLowerCase())===lQ.ETH_SENDTRANSACTION.toLowerCase()){let r={method:e,params:[Object.assign(Object.assign({},n[0]),{from:s[0]})]};return yield null===(o=t.getProvider())||void 0===o?void 0:o.request(r)}return l2.includes(e.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${e} -- not handled by the extension -- call separately`),s):yield null===(a=t.getProvider())||void 0===a?void 0:a.request({method:e,params:n})}))({method:e.method,sdk:s,params:e.params});return s.emit(lj.ConnectWithResponse,t),t}return lA(`[initializeMobileProvider: sendRequest()] sending '${t}' on active provider`,a),yield null===(w=s.getProvider())||void 0===w?void 0:w.request({method:t,params:a})}if(e===iQ.REJECTED)throw null==l||l.closeModal(),null===(x=s.getProvider())||void 0===x||x.handleDisconnect({terminate:!1}),Object.assign(Error("User rejected connection"),{code:4001});throw lA(`[initializeMobileProvider: sendRequest()] failed to start installer: ${e}`),e}finally{_(!1)}if(t===lQ.ETH_REQUESTACCOUNTS)return P=yield new Promise(e=>{let t=setInterval(()=>{let{accounts:n}=M.getState();n&&(clearInterval(t),e(n))},100)}),lA(`[initializeMobileProvider: sendRequest()] selectedAddress: ${R} --- SKIP rpc call`),P;if(t===lQ.METAMASK_CONNECTWITH)try{let e,t,n=0,r=({resolve:e,reject:t})=>{n+=1;let r=null==l?void 0:l.getConnector().getRPCMethodTracker(),o=null==r?void 0:r[i];return lA(`TRACKER: update method ${i}`,o),(null==o?void 0:o.result)?(lA("[initializeMobileProvider: sendRequest()] found result",o.result),s.emit(lj.ConnectWithResponse,o.result),void e(o.result)):(null==o?void 0:o.error)?(lA("[initializeMobileProvider: sendRequest()] found error",o.error),void t(o.error)):n>=5?(lA("[initializeMobileProvider: sendRequest()] max message count reached without result"),void t(Error("Max message count reached without result"))):void lA("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")},o=yield new Promise((n,o)=>{let a=null==l?void 0:l.getConnector().getRPCMethodTracker();lA(`TRACKER: method ${i}`,a),(null==a?void 0:a[i].result)?(lA("[initializeMobileProvider: sendRequest()] found result",null==a?void 0:a[i].result),n(null==a?void 0:a[i].result)):(null==a?void 0:a[i].error)&&(lA("[initializeMobileProvider: sendRequest()] found error",null==a?void 0:a[i].error),o(null==a?void 0:a[i].error)),t=()=>r({resolve:n,reject:o}),e=null==l?void 0:l.getConnector().on(iQ.RPC_UPDATE,t)});return t&&(null==e||e.off(iQ.RPC_UPDATE,t)),lA("TRACKER: result",o),o}catch(e){throw lA("[initializeMobileProvider: sendRequest()] error:",e),e}return n[0]&&"object"==typeof n[0]&&(n[0].params={__triggeredInstaller:!0,wrappedParams:n[0].params}),r(...n)}if(i.isSecure()&&l0[t])return r(...n);if(s.isExtensionActive())return lA(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${t}' to it`,n,a),yield null===(k=s.getProvider())||void 0===k?void 0:k.request({method:t,params:a});throw lA(`[initializeMobileProvider: sendRequest()] method=${t} --- skip --- not connected/installed`),Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{let e=yield r(...n);if(lA(`[initializeMobileProvider: sendRequest()] method=${t} rpcResponse`,e),t===lQ.WALLET_REQUESTPERMISSIONS){let t=e.reduce((e,t)=>
6{var n;if("eth_accounts"===t.parentCapability){let r=null===(n=t.caveats.find(e=>"restrictReturnedAccounts"===e.type))||void 0===n?void 0:n.value;r&&e.push(...r)}return e},[]);lA("[initializeMobileProvider: sendRequest()] accountsToPersist:",t),t.length>0&&(M.handleAccountsChanged(t,!1),null==b||b.persistAccounts(t))}return e}catch(e){throw console.error("[initializeMobileProvider: sendRequest()] error:",e),e}}),{request:k}=w;w.request=(...e)=>p(void 0,void 0,void 0,function*(){return x(null==e?void 0:e[0].method,e,k,c)});let{send:M}=w;return w.send=(...e)=>p(void 0,void 0,void 0,function*(){return x(null==e?void 0:e[0],e,M,c)}),lA("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),h.start(),w});class co{constructor({serverUrl:e,enabled:t,originatorInfo:n}){this.serverURL=rW,this.serverURL=e,this.originatorInfo=n,this.enabled=null==t||t}send({event:e,params:t}){if(!this.enabled)return;let n=Object.assign(Object.assign({id:"sdk",event:e,sdkVersion:lV.version},this.originatorInfo),{params:t});lA(`[Analytics: send()] event: ${e}`,n),rF(n,this.serverURL).catch(e=>{lA(`[Analytics: send()] error: ${e}`)})}}let ca=()=>{let e;if("undefined"==typeof document)return;let t=document.getElementsByTagName("link");for(let n=0;n<t.length;n++)"icon"!==t[n].getAttribute("rel")&&"shortcut icon"!==t[n].getAttribute("rel")||(e=t[n].getAttribute("href"));return e};function cs(e){var t,n,r;let{dappMetadata:i}=e,o=function({url:e,name:t}){var n;let r=ce(e+t);if(!localStorage)return"";let i=null!==(n=localStorage.getItem(r))&&void 0!==n?n:"";if(!i){i=(0,u.Z)();try{localStorage.setItem(r,i)}catch(e){return""}}return i}({url:null!==(t=null==i?void 0:i.url)&&void 0!==t?t:"no_url",name:null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"no_name"}),a=null===(r=e.platformManager)||void 0===r?void 0:r.getPlatformType(),s=a===i4.DesktopWeb,l=a===i4.MetaMaskMobileWebview,c="N/A";return s?c="extension":l&&(c="mobile"),{id:o,from:c}}let cl=({provider:e,sdkInstance:t})=>{if("state"in e)throw Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(e){var r,i;return p(this,void 0,void 0,function*(){lA("[wrapExtensionProvider()] Overwriting request method",e);let{method:o,params:a}=e,s=l1.includes(o.toLowerCase()),{id:l,from:c}=cs(t);if(s&&(null===(r=t.analytics)||void 0===r||r.send({event:i3.SDK_RPC_REQUEST,params:{method:o,from:c,id:l}})),o===lQ.METAMASK_BATCH&&Array.isArray(a))return(({target:e,args:t,trackEvent:n,sdkInstance:r})=>p(void 0,void 0,void 0,function*(){var i,o;if("metamask_batch"!==t.method)throw Error("Invalid usage");let a=[];for(let n of null!==(i=null==t?void 0:t.params)&&void 0!==i?i:[]){let t=yield null==e?void 0:e.request({method:n.method,params:n.params});a.push(t)}let{id:s,from:l}=cs(r);return n&&(null===(o=r.analytics)||void 0===o||o.send({event:i3.SDK_RPC_REQUEST_DONE,params:{method:t.method,from:l,id:s}})),a}))({target:n,args:e,trackEvent:s,sdkInstance:t});if(o.toLowerCase()===lQ.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(a))return(({target:e,params:t})=>p(void 0,void 0,void 0,function*(){let n=yield e.request({method:lQ.ETH_REQUESTACCOUNTS,params:[]});if(!n.length)throw Error("SDK state invalid -- undefined accounts");return yield e.request({method:lQ.PERSONAL_SIGN,params:[t[0],n[0]]})}))({target:n,params:a});if(o.toLowerCase()===lQ.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(a))return(({target:e,params:t})=>p(void 0,void 0,void 0,function*(){let[n]=t,r=n.method,i=n.params,o=yield e.request({method:lQ.ETH_REQUESTACCOUNTS,params:[]});if(!o.length)throw Error("SDK state invalid -- undefined accounts");return(null==r?void 0:r.toLowerCase())===lQ.PERSONAL_SIGN.toLowerCase()?yield e.request({method:r,params:[i[0],o[0]]}):(null==r?void 0:r.toLowerCase())===lQ.ETH_SENDTRANSACTION.toLowerCase()?yield e.request({method:r,params:[Object.assign(Object.assign({},i[0]),{from:o[0]})]}):l2.includes(r.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${r} -- not handled by the extension -- call separately`),o):yield e.request({method:r,params:i})}))({target:n,params:a});try{return yield n.request(e)}
6finally{s&&(null===(i=t.analytics)||void 0===i||i.send({event:i3.SDK_RPC_REQUEST_DONE,params:{method:o,from:c,id:l}}))}})}:"getChainId"===r?function(){return e.chainId}:"getNetworkVersion"===r?function(){return e.networkVersion}:"getSelectedAddress"===r?function(){return e.selectedAddress}:"isConnected"===r?function(){return e._state.isConnected}:n[r]})};(c5=c6||(c6={})).Announce="eip6963:announceProvider",c5.Request="eip6963:requestProvider";let cc=e=>p(void 0,void 0,void 0,function*(){let{options:t}=e,{infuraAPIKey:n}=t;if(!n)return;let r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};e.options.readonlyRPCMap?e.options.readonlyRPCMap=Object.assign(Object.assign({},e.options.readonlyRPCMap),r):e.options.readonlyRPCMap=r}),cd=e=>p(void 0,void 0,void 0,function*(){let{options:t}=e,{readonlyRPCMap:n}=t;if(n)try{lA("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),e.setReadOnlyRPCCalls(!0)}catch(e){throw Error("Invalid Infura Settings")}});var cu="INSTALLED",ch="NOT_INSTALLED",cf="REGISTERED",cp="REGISTERING",cg="RELOADING",cm={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},cy="REGISTRATION_IN_PROGRESS",cv="FORWARDER_ID",cb=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=n.forwarderMode,o=void 0===i?e.FORWARDER_MODE.INJECT:i;this.forwarderOrigin=void 0===r?"https://fwd.metamask.io":r,this.forwarderMode=o,this.state=e.isMetaMaskInstalled()?cu:ch;var a=e._detectBrowser();this.downloadUrl=a?cm[a]:cm.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),o===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(cy)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},e.prototype._onMessageUnknownStateError=function(e){throw Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){var n,r,i;return n=this,r=void 0,i=function(){return function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,function(n){switch(n.label){case 0:switch(this.state){case cg:return[3,1];case ch:return[3,2];case cu:return[3,3];case cp:return[3,5];case cf:return[3,6]}return[3,7];case 1:return console.debug("Ignoring message while reloading"),[3,8];case 2:return console.debug("Reloading now to register with MetaMask"),this.state=cg,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=cp,[4,e._register()];case 4:return n.sent(),this.state=cf,t.source.postMessage({type:"metamask:registrationCompleted"},t.origin),this.stopOnboarding(),[3,8];case 5:return console.debug("Already registering - ignoring reload message"),[3,8];case 6:return console.debug("Already registered - ignoring reload message"),[3,8];case 7:this._onMessageUnknownStateError(this.state),n.label=8;case 8:return[2]}})},new(r||(r=Promise))(function(e,t){function o(e){try{s(i.next(e))}catch(e){t(e)}}function a(e){try{s(i.throw(e))}catch(e){t(e)}}function s(t){var n;t.done?e(t.value):((n=t.value)instanceof r?n:new r(function(e){e(n)})).then(o,a)}s((i=i.apply(n,[])).next())})},e.prototype.startOnboarding=function(){sessionStorage.setItem(cy,"true"),this._openDownloadPage(),this._openForwarder()},e.prototype.stopOnboarding=function(){"true"===sessionStorage.getItem(cy)&&(this.forwarderMode===e.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),e._removeForwarder()),sessionStorage.setItem(cy,"false"))},e.prototype._openForwarder=function(){this.forwarderMode===e.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):e._injectForwarder(this.forwarderOrigin)},e.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},e.isMetaMaskInstalled=function(){return!!(window.ethereum&&window.ethereum.isMetaMask)},e._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},e._injectForwarder=function(e){var t=document.body,n=document.createElement("iframe");n.setAttribute("height","0"),n.setAttribute("width","0"),n.setAttribute("style","display: none;"),n.setAttribute("src",e),n.setAttribute("id",cv),t.insertBefore(n,t.children[0])},e._removeForwarder=function(){var e;null===(e=document.getElementById(cv))||void 0===e||e.remove()},e._detectBrowser=function(){var e=lU.parse(window.navigator.userAgent);return"Firefox"===e.browser.name?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},e.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},e}();class cE{constructor({remote:e,preferDesktop:t,platformManager:n,debug:r=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=t,this.state.platformManager=n,this.state.debug=r}startDesktopOnboarding(){return function(){return p(this,void 0,void 0,function*(){lA("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),(new cb).startOnboarding()})}()}redirectToProperInstall(){return p(this,void 0,void 0,function*(){return function(e){var t,n;return p(this,void 0,void 0,function*(){let{state:r}=e,i=null===(t=r.platformManager)||void 0===t?void 0:t.getPlatformType();if(lA(`[MetamaskInstaller: redirectToProperInstall()] platform=${i}`),i===i4.MetaMaskMobileWebview)return!1;r.isInstalling=!0;try{yield null===(n=r.remote)||void 0===n?void 0:n.startConnection({connectWith:r.connectWith}),r.isInstalling=!1,r.hasInstalled=!0}catch(e){throw r.isInstalling=!1,e}return!0})}(this)})}checkInstallation(){return p(this,void 0,void 0,function*(){return function(e){var t;return p(this,void 0,void 0,function*(){let{state:n}=e,r=null===(t=n.platformManager)||void 0===t?void 0:t.isMetaMaskInstalled();return lA(`[MetamaskInstaller: checkInstallation()] isInstalled=${r}`),!!r||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:t}){return p(this,void 0,void 0,function*(){this.state.connectWith=t,lA(`[MetaMaskInstaller: start()] w
6ait=${e}`,t),yield function(e,{wait:t=!1}){return p(this,void 0,void 0,function*(){return lA(`[MetamaskInstaller: startInstaller()] wait=${t}`),t&&(yield cr(1e3)),yield e.checkInstallation()})}(this,{wait:e})})}}class cw{constructor({debug:e,sdkVersion:t}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=null!=e&&e,this.sdkVersion=t}loadComponent(e){return p(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{let e=yield Promise.resolve().then(function(){return dq});console.log("loader",e),e.defineCustomElements()}catch(t){console.error(`Failed to load ${e} modal:`,t)}}})}renderInstallModal(e){var t;return p(this,void 0,void 0,function*(){this.debug&&console.debug("ModalLoader: renderInstallModal",e),this.containers.install=e.parentElement,yield this.loadComponent("install");let n=document.createElement("mm-install-modal");n.link=e.link,n.preferDesktop=e.preferDesktop,n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),n.addEventListener("trackAnalytics",t=>{var n;return null===(n=e.onAnalyticsEvent)||void 0===n?void 0:n.call(e,t.detail)}),e.parentElement.appendChild(n)})}renderSelectModal(e){var t;return p(this,void 0,void 0,function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");let n=document.createElement("mm-select-modal");n.link=e.link,n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.preferDesktop=e.preferDesktop,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(n),setTimeout(()=>this.updateQRCode(e.link),100)})}renderPendingModal(e){var t;return p(this,void 0,void 0,function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");let n=document.createElement("mm-pending-modal");n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.displayOTP=e.displayOTP,n.addEventListener("close",e.onClose),n.addEventListener("updateOTPValue",({detail:{otpValue:t}})=>e.updateOTPValue(t)),e.onDisconnect&&n.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(n)})}updateOTPValue(e){let t=()=>{var t;let n=null===(t=this.containers.pending)||void 0===t?void 0:t.querySelector("mm-pending-modal");return!!n&&(n.otpCode=e,!0)};setTimeout(()=>{t()},800)}updateQRCode(e){var t,n;let r=null===(t=this.containers.install)||void 0===t?void 0:t.querySelector("mm-install-modal");if(r)r.link=e;else{let t=null===(n=this.containers.select)||void 0===n?void 0:n.querySelector("mm-select-modal");t&&(t.link=e)}}unmount(){Object.entries(this.containers).forEach(([e,t])=>{var n;null===(n=null==t?void 0:t.parentNode)||void 0===n||n.removeChild(t),this.containers[e]=void 0})}}let cS=({link:e,debug:t,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:a})=>{let s=null,l=null;lA("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),lA(`[UI: InstallModal-web: sdkWebInstallModal()] link=${e}`),lA(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --ios`),lA(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --android`),lA(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${e}"`);let c=e=>{var t;lA("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",e,l),(null==l?void 0:l.parentNode)&&(null===(t=l.parentNode)||void 0===t||t.removeChild(l)),l=null,s=null,!0===e&&(null==r||r())};return{mount:r=>{if(lA("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",l),l)return l.style.display="block",void(null==s||s.updateQRCode(r));s=new cw({debug:t,sdkVersion:lV.version}),l=document.createElement("div"),document.body.appendChild(l),window.extension?s.renderSelectModal({parentElement:l,connectWithExtension:()=>{c(),null==i||i()},onClose:c,link:e,preferDesktop:null!=o&&o}).catch(e=>{console.error(e)}):s.renderInstallModal({parentElement:l,preferDesktop:null!=o&&o,link:e,metaMaskInstaller:n,onClose:c,onAnalyticsEvent:a}).catch(e=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",e)})},unmount:c}},c_=({onDisconnect:e,debug:t})=>{let n=null,r=null,i=()=>{lA("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),(null==n?void 0:n.parentNode)&&n.parentNode.removeChild(n),n=null,r=null},o=e=>{lA("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",e),r&&r.updateOTPValue(e)},a=({displayOTP:a}={displayOTP:!0})=>{lA("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new cw({debug:t,sdkVersion:lV.version}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:e,updateOTPValue:o,displayOTP:a}).catch(e=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",e)}))};return a(),{mount:a,unmount:i,updateOTPValue:o}};function cC(e,t){var n,r,i,o;e.connector||(lA("[RemoteConnection: initializeConnector()] initialize connector"),e.connector=new r7({platformType:t.platformManager.getPlatformType(),communicationLayerPreference:t.communicationLayerPreference,transports:t.transports,dappMetadata:Object.assign(Object.assign({},t.dappMetadata),{source:t._source}),analytics:t.enableAnalytics,communicationServerUrl:t.communicationServerUrl,sdkVersion:lV.version,context:"dapp",ecies:t.ecies,storage:t.storage,logging:t.logging}),t.timer&&(lA("[RemoteConnection: initializeConnector()] reset background timer",t.timer),null===(r=null===(n=t.timer)||void 0===n?void 0:n.stopBackgroun
6dTimer)||void 0===r||r.call(n),null===(o=null===(i=t.timer)||void 0===i?void 0:i.runBackgroundTimer)||void 0===o||o.call(i,()=>!1,1e4)))}function cx(e){e.listeners.forEach(({event:t,handler:n})=>{var r;null===(r=e.connector)||void 0===r||r.off(t,n)}),e.listeners=[]}function ck(e,t){function n(t,n){var r;null===(r=e.connector)||void 0===r||r.on(t,n),e.listeners.push({event:t,handler:n})}e.connector&&(cx(e),n(iQ.WALLET_INIT,({accounts:e,chainId:t})=>p(this,void 0,void 0,function*(){lA(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${e} chainId=${t}`);let n=lH.getProvider();n._setConnected(),n._initializeState({accounts:e,chainId:t,isUnlocked:!1}),n.emit("chainChanged",t),n.emit("accountsChanged",e)})),n(iQ.AUTHORIZED,()=>p(this,void 0,void 0,function*(){var t,n,r,i;try{lA("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",e.pendingModal,e.installModal);let o=lH.getProvider();o._setConnected(),null===(n=null===(t=e.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),null===(i=null===(r=e.installModal)||void 0===r?void 0:r.unmount)||void 0===i||i.call(r,!1),e.otpAnswer=void 0,e.authorized=!0,lA("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",o.getState()),yield o.forceInitializeState()}catch(e){}})),n(iQ.TERMINATE,()=>{var t,n,r,i,o;null===(n=null===(t=e.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),null===(i=null===(r=e.installModal)||void 0===r?void 0:r.unmount)||void 0===i||i.call(r,!0),e.pendingModal=void 0,e.installModal=void 0,e.otpAnswer=void 0,null===(o=e.connector)||void 0===o||o.disconnect({terminate:!0}),e.authorized=!1,lH.getProvider().handleDisconnect({terminate:!0}),cx(e),lA("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}class cM{constructor(e){var t,n,r;this.state={connector:void 0,qrcodeLink:void 0,analytics:void 0,developerMode:!1,authorized:!1,reconnection:!1,preferDesktop:!1,deeplinkProtocol:!1,listeners:[],communicationLayerPreference:void 0,platformManager:void 0,pendingModal:void 0,installModal:void 0,otpAnswer:void 0},this.options=e;let i=!0===(null===(t=e.logging)||void 0===t?void 0:t.developerMode)||!0===(null===(n=e.logging)||void 0===n?void 0:n.sdk);this.state.developerMode=i,this.state.analytics=e.analytics,this.state.preferDesktop=null!==(r=e.preferDesktop)&&void 0!==r&&r,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=cS),e.modals.otp||(e.modals.otp=c_)}startConnection(e){return p(this,void 0,void 0,function*(){return function(e,t,{initialCheck:n,connectWith:r}={}){var i,o,a,s,l,c,d,u,h,f,g,m,y,v,b,E,w,S,_;return p(this,void 0,void 0,function*(){try{if(cC(e,t),!e.connector)throw Error("no connector defined");ck(e);let C=lH.getProvider();e.authorized=!1,C.emit("connecting");let x=yield null===(i=e.connector)||void 0===i?void 0:i.originatorSessionConnect();lA(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,x);let k=null!==(o=null==x?void 0:x.channelId)&&void 0!==o?o:"",M=null!==(s=null===(a=e.connector.getKeyInfo())||void 0===a?void 0:a.ecies.public)&&void 0!==s?s:"",A=null!==(c=null===(l=e.connector.getKeyInfo())||void 0===l?void 0:l.ecies.private)&&void 0!==c?c:"";if(n&&!x)return Promise.resolve();if(!x&&!n){let t=yield e.connector.generateChannelIdConnect();k=null!==(d=t.channelId)&&void 0!==d?d:"",M=null!==(u=t.pubKey)&&void 0!==u?u:"",A=null!==(h=t.privKey)&&void 0!==h?h:"";let n=Date.now();null===(f=e.connector.state.storageManager)||void 0===f||f.persistChannelConfig({channelId:k,localKey:A,lastActive:n,validUntil:n+6048e5})}if(n&&(null==x?void 0:x.channelId))return(null===(g=e.connector)||void 0===g?void 0:g.isConnected())||(lA(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,x),yield null===(m=e.connector)||void 0===m?void 0:m.connectToChannel({channelId:k})),Promise.resolve();!x||(null===(y=e.connector)||void 0===y?void 0:y.isConnected())||(lA("[RemoteConnection: startConnection()] reconnecting to channel",x),yield null===(v=e.connector)||void 0===v?void 0:v.connectToChannel
6({channelId:k}));let I=(null===(b=e.platformManager)||void 0===b?void 0:b.isSecure())?"":"&t=q",R=lV.version,{iconUrl:P,name:T,url:O,scheme:L}=t.dappMetadata||{},N=null===(E=e.platformManager)||void 0===E?void 0:E.getPlatformType(),$="N/A";"undefined"!=typeof window&&window.location&&window.location.hostname?$=window.location.hostname:void 0!==T?$=T:void 0!==O&&($=O);let D={url:null!=O?O:"",title:null!=T?T:"",icon:P,scheme:null!=L?L:"",apiVersion:R,dappId:$||O||"N/A",platform:null!=N?N:"",source:null!==(w=t._source)&&void 0!==w?w:""},B=ce(JSON.stringify(D)),K=`channelId=${k}&v=2&comm=${null!==(S=e.communicationLayerPreference)&&void 0!==S?S:""}&pubkey=${M}${I}&originatorInfo=${B}`;if(r){K+=`&rpc=${ce(JSON.stringify(r))}`;let t=e.connector.getRPCMethodTracker();t&&(t[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}let U=encodeURI(K),j=`${e.useDeeplink?lZ:lY}?${K}`;return e.qrcodeLink=j,e.developerMode&&lA(`[RemoteConnection: startConnection()] qrcodeLink=${U}`),C.emit("display_uri",j),(null===(_=e.platformManager)||void 0===_?void 0:_.isSecure())?(yield function(e,t){var n,r;return p(this,void 0,void 0,function*(){let i=`${lY}?${t}`,o=`${lZ}?${t}`;null===(r=null===(n=e.platformManager)||void 0===n?void 0:n.openDeeplink)||void 0===r||r.call(n,i,o,"_self")})}(e,U),new Promise((t,n)=>{var r,i,o;(null===(r=e.connector)||void 0===r?void 0:r.isAuthorized())?t():(null===(i=e.connector)||void 0===i||i.once(iQ.AUTHORIZED,()=>{t()}),null===(o=e.connector)||void 0===o||o.once(iQ.REJECTED,()=>{n(iQ.REJECTED)}))})):function(e,t,n){return p(this,void 0,void 0,function*(){return new Promise((r,i)=>{var o,a,s,l;if(!e.connector)return void i(Error("No connector available"));lA("[RemoteConnection: connectWithModalInstaller()]",{state:e,options:t,linkParams:n});let c=`${e.useDeeplink?lZ:lY}?${n}`;e.installModal=null===(a=(o=t.modals).install)||void 0===a?void 0:a.call(o,{link:c,preferDesktop:e.preferDesktop,installer:t.getMetaMaskInstaller(),terminate:()=>{lA("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),t.sdk.terminate().catch(e=>{console.warn("[MMSDK] failed to terminate connection",e)})},debug:e.developerMode,connectWithExtension:()=>{var e;return null===(e=t.connectWithExtensionProvider)||void 0===e||e.call(t),!1},onAnalyticsEvent:({event:n,params:r})=>{var i,o,a;let s=Object.assign(Object.assign({},r),{sdkVersion:t.sdk.getVersion(),dappId:null===(i=t.dappMetadata)||void 0===i?void 0:i.name,source:t._source,url:null===(o=t.dappMetadata)||void 0===o?void 0:o.url});null===(a=e.analytics)||void 0===a||a.send({event:n,params:s})}}),null===(l=null===(s=e.installModal)||void 0===s?void 0:s.mount)||void 0===l||l.call(s,c),t.sdk.once(iQ.PROVIDER_UPDATE,e=>p(this,void 0,void 0,function*(){(lA("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),e!==c8.TERMINATE)?i(e):i({code:4001,message:"User rejected the request."})})),e.connector.once(iQ.AUTHORIZED,()=>{r()}),e.connector.once(iQ.REJECTED,()=>{i(iQ.REJECTED)}),e.connector.once(iQ.CLIENTS_READY,()=>p(this,void 0,void 0,function*(){lA("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),r()}))})})}(e,t,U)}catch(e){throw console.error("[startConnection] error",e),e}})}(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var t,n,r;return p(this,void 0,void 0,function*(){let i=yield null===(n=null===(t=e.options.storage)||void 0===t?void 0:t.storageManager)||void 0===n?void 0:n.getPersistedChannelConfig();if(!this.options.ecies){let e={privateKey:null==i?void 0:i.localKey};this.options.ecies=e}cC(this.state,this.options),yield null===(r=this.getConnector())||void 0===r?void 0:r.initFromDappStorage(),ck(this.state,this.options)})}showActiveModal(){var e,t,n,r,i;(e=this.state).authorized?lA("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?null===(n=(t=e.pendingModal).mount)||void 0===n||n.call(t):e.installModal&&(null===(i=(r=e.installModal).mount)||void 0===i||i.call(r,e.qrcodeLink||""))}closeModal(){var e,t,n,r;null===(t=null===(e=this.state.pendingModal)||void 0===e?void 0:e.unmount)||void 0===t||t.call(e),null===(r=null===(n=this.state.installModal)||void 0===n?void 0:n.unmount)||void 0===r||r.call(n,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.getChannelConfig()}
6getKeyInfo(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return(null===(e=this.state.connector)||void 0===e?void 0:e.isReady())||!1}isAuthorized(){var e;return(null===(e=this.state.connector)||void 0===e?void 0:e.isAuthorized())||!1}isPaused(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.isPaused()}disconnect(e){var t,n,r,i;lA("[RemoteConnection: disconnect()]",e),(null==e?void 0:e.terminate)&&(lH.getProvider().handleDisconnect({terminate:!0}),null===(n=null===(t=this.state.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),this.state.otpAnswer=void 0),null===(r=this.state.connector)||void 0===r||r.disconnect(e),i=this.state,lA("[RemoteConnection: cleanupConnector()] cleaning up connector"),i.connector&&(cx(i),i.connector.disconnect({terminate:!0}).catch(e=>{lA("[RemoteConnection: cleanupConnector()] error disconnecting connector",e)}))}}class cA extends d(){constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:lG,i18nOptions:{enabled:!1}}){var t,n,r;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],l().disable();let i=!0===(null===(t=e.logging)||void 0===t?void 0:t.developerMode);if(((null===(n=e.logging)||void 0===n?void 0:n.sdk)||i)&&l().enable("MM_SDK"),lA("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(null===(r=e.dappMetadata)||void 0===r?void 0:r.url)){if("undefined"==typeof window||"undefined"==typeof document)throw Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=lG),this.init().then(()=>{lA("[MetaMaskSDK: constructor()]: initialized successfully."),"undefined"!=typeof window&&(window.mmsdk=this)}).catch(e=>{console.error("[MetaMaskSDK: constructor()] error during initialization",e)})}init(){return p(this,void 0,void 0,function*(){return function(e){var t;return p(this,void 0,void 0,function*(){if("undefined"!=typeof window&&(null===(t=window.mmsdk)||void 0===t?void 0:t.isInitialized()))return lA("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return lA("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return lA("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=function(e){var t,n,r,i,o,a,s,c,d,u,h;return p(this,void 0,void 0,function*(){let{options:f}=e;if(f.logging=null!==(t=f.logging)&&void 0!==t?t:{},f.communicationLayerPreference=null!==(n=f.communicationLayerPreference)&&void 0!==n?n:i6.SOCKET,void 0!==f.enableDebug&&(l().enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),f.enableAnalytics=null===(r=f.enableAnalytics)||void 0===r||r,f.injectProvider=null===(i=f.injectProvider)||void 0===i||i,f.shouldShimWeb3=null===(o=f.shouldShimWeb3)||void 0===o||o,f.extensionOnly=null===(a=f.extensionOnly)||void 0===a||a,f.useDeeplink=null===(s=f.useDeeplink)||void 0===s||s,f.storage=null!==(c=f.storage)&&void 0!==c?c:{enabled:!0},f.headless){l()("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");let e=()=>{};f.modals={install:()=>({mount:e,unmount:e})},f.ui={installer:e}}let g=!0===(null===(d=f.logging)||void 0===d?void 0:d.developerMode);e.debug=(null===(u=f.logging)||void 0===u?void 0:u.sdk)||g,lA("[MetaMaskSDK: performSDKInitialization()] options",e.options);let m=Object.assign({},f.logging);g&&(m.sdk=!0,m.eciesLayer=!0,m.keyExchangeLayer=!0,m.remoteLayer=!0,m.serviceLayer=!0,m.plaintext=!0),yield function(e){var t;return p(this,void 0,void 0,function*(){let{options:n}=e;e.platformManager=new lF({useDeepLink:null!==(t=n.useDeeplink)&&void 0!==t&&t,preferredOpenLink:n.openDeeplink,debug:e.debug})})}(e),yield function(e){var t,n,r,i,o,a,s,l,c;return p(this,void 0,void 0,function*(){let{options:d}=e,u=null===(t=e.platformManager)||void 0===t?void 0:t.getPlatformType();e.analytics=new co({serverUrl:null!==(n=d.communicationServerUrl)&&void 0!==n?n:rW,enabled:d.enableAnalytics,originatorInfo:{url:null!==(r=d.dappMetadata.url)&&void 0!==r?r:"",title:null!==(i=d.dappMetadata.name)&&void 0!==i?i:"",dappId:"undefined"==typeof window||void 0===window.location?null!==(l=null!==(a=null===(o=d.dappMetadata)||void 0===o?void 0:o.name)&&void 0!==a?a:null===(s=d.dappMetadata)||void 0===s?void 0:s.url)&&void 0!==l?l:"N/A":window.location.hostname,platform:null!=u?u:"",source:null!==(c=d._source)&&void 0!==c?c:""}})})}(e),yield function(e){var t;return p(this,void 0,void 0,function*(){let{options:n}=e;!0!==(null===(t=n.storage)||void 0===t?void 0:t.enabled)||n.storage.storageManager||(n.storage.storageManager=yield lz(n.storage))})}(e),yield function(e){return p(this,void 0,void 0,function*(){let{options:t}=e,n=/^(http|https):\/\/[^\s]*$/;if(t.dappMetadata){t.dappMetadata.iconUrl&&!n.test(t.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),t.dappMetadata.iconUrl=void 0),t.dappMetadata.base64Icon&&t.dappMetadata.base64Icon.length>163400&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),t.dappMetadata.base64Icon=void 0),t.dappMetadata.url&&!n.test(t.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");let e=ca();if(e&&!t.dappMetadata.iconUrl&&!t.dappMetadata.base64Icon){let n=`${window.location.protocol}//${window.location.host}${e}`;t.dappMetadata.iconUrl=n}}e.dappMetadata=t.dappMetadata})}(e),yield cc(e),yield cd(e);let{metamaskBrowserExtension:y,preferExtension:v,shouldReturn:b}=yield function(e){var t,n,r,i;return p(this,void 0,void 0,function*(){let{options:o}=e,a,s=!1,l=!1;if("undefined"==typeof window||!window.ethereum||(null===(t=e.platformManager)||void 0===t?void 0:t.isMetaMaskMobileWebView()))(null===(n=e.platformManager)||void 0===n?void 0:n.isMetaMaskMobileWebView())&&(null===(r=e.anal
6ytics)||void 0===r||r.send({event:i3.SDK_USE_INAPP_BROWSER}),e.activeProvider=cl({provider:window.ethereum,sdkInstance:e}),e._initialized=!0,l=!0);else{s="extension"===localStorage.getItem(l5);try{a=yield function({mustBeMetaMask:e,sdkInstance:t}){return p(this,void 0,void 0,function*(){if("undefined"==typeof window)throw Error("window not available");try{let e=yield new Promise((e,t)=>{let n=setTimeout(()=>{t(Error("eip6963RequestProvider timed out"))},500);window.addEventListener(c6.Announce,t=>{let{detail:{info:r,provider:i}={}}=t,{name:o,rdns:a,uuid:s}=null!=r?r:{};lX.test(s)&&o.startsWith(lJ.NAME)&&lJ.RDNS.includes(a)&&(clearTimeout(n),e(i))}),window.dispatchEvent(new Event(c6.Request))});return cl({provider:e,sdkInstance:t})}catch(n){if(!e&&window.ethereum)return cl({provider:window.ethereum,sdkInstance:t});throw Error("Provider not found")}})}({mustBeMetaMask:!0,sdkInstance:e}),window.extension=a,a.on(l4.CHAIN_CHANGED,t=>{lA(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${t}`),e.sdkProvider&&e.getMobileProvider().emit(l4.CHAIN_CHANGED,t)}),a.on(l4.ACCOUNTS_CHANGED,t=>p(this,void 0,void 0,function*(){var n;lA(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${t}`);let r=!!e.sdkProvider,i=!!e.extensionActive;if(r&&e.getMobileProvider().emit(l4.ACCOUNTS_CHANGED,t),i&&0===(null==t?void 0:t.length)&&0===(yield null===(n=e.getProvider())||void 0===n?void 0:n.request({method:lQ.WALLET_GETPERMISSIONS,params:[]})).length)try{yield e.terminate()}catch(e){lA("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",e)}})),a.on(l4.DISCONNECT,t=>{lA(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${t}`),e.sdkProvider&&e.getMobileProvider().emit(l4.DISCONNECT,t)}),a.on(l4.CONNECT,t=>{lA(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${t}`),e.sdkProvider&&e.getMobileProvider().emit(l4.CONNECT,t)}),a.on(l4.CONNECTED,t=>{lA("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",t),e.sdkProvider&&e.getMobileProvider().emit(l4.CONNECTED,t)})}catch(e){window.extension=void 0}}return a&&o.extensionOnly&&(lA("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),null===(i=e.analytics)||void 0===i||i.send({event:i3.SDK_USE_EXTENSION}),e.activeProvider=a,e.extensionActive=!0,e.extension=a,e._initialized=!0,l=!0),{preferExtension:s,shouldReturn:l,metamaskBrowserExtension:a}})}(e);if(b)lA("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(e,t){var n,r,i,o,a;return p(this,void 0,void 0,function*(){let{options:s}=e,l=Object.assign({},s.logging);e.remoteConnection=new cM({preferDesktop:null!==(n=s.preferDesktop)&&void 0!==n&&n,communicationLayerPreference:null!==(r=s.communicationLayerPreference)&&void 0!==r?r:i6.SOCKET,analytics:e.analytics,dappMetadata:s.dappMetadata,_source:s._source,enableAnalytics:null===(i=s.enableAnalytics)||void 0===i||i,timer:s.timer,sdk:e,platformManager:e.platformManager,transports:s.transports,communicationServerUrl:s.communicationServerUrl,storage:null!==(o=s.storage)&&void 0!==o?o:{enabled:!0},getMetaMaskInstaller:()=>{if(!e.installer)throw Error("Invalid SDK status -- installer not initialized");return e.installer},logging:l,connectWithExtensionProvider:void 0===t?void 0:()=>l7(e),modals:Object.assign(Object.assign({},s.modals),{onPendingModalDisconnect:e.terminate.bind(e)})}),yield e.remoteConnection.initRemoteCommunication({sdkInstance:e}),e.installer=new cE({remote:e.remoteConnection,preferDesktop:null!==(a=s.preferDesktop)&&void 0!==a&&a,platformManager:e.platformManager,debug:e.debug})})}(e,y),yield function(e){var t,n,r,i;return p(this,void 0,void 0,function*(){var o,a,s,l;let{options:c}=e,d={communicationLayerPreference:null!==(t=c.communicationLayerPreference)&&void 0!==t?t:i6.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:c.checkInstallationOnAllCalls,injectProvider:null===(n=c.injectProvider)||void 0===n||n,shouldShimWeb3:null===(r=c.shouldShimWeb3)||void 0===r||r,extensionOnly:null===(i=c.extensionOnly)||void 0===i||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug},u=yield ci(d);e.activeProvider=u,null===(a=null===(o=e.remoteConnection)||void 0===o?void 0:o.getConnector())||void 0===a||a.on(lj.ConnectionStatus,t=>{e.emit(lj.ConnectionStatus,t)}),null===(l=null===(s=e.remoteConnection)||void 0===s?void 0:s.getConnector())||void 0===l||l.on(lj.ServiceStatus,t=>{e.emit(lj.ServiceStatus,t)})})}(e),yield function(e,t){var n,r;return p(this,void 0,void 0,function*(){let{options:i}=e;t?(lA("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),null===(n=e.analytics)||void 0===n||n.send({event:i3.SDK_EXTENSION_UTILIZED}),l7(e).catch(e=>{console.warn("Can't connect with MetaMask extension...",e),localStorage.removeItem(l5)})):i.checkInstallationImmediately&&((null===(r=e.platformManager)||void 0===r?void 0:r.isDesktopWeb())?(lA("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),e.connect().catch(e=>{lA(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${e}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),e._initialized=!0})}(e,v);try{yield null===(h=e.remoteConnection)||void 0===h?void 0:h.startConnection({initialCheck:!0})}catch(e){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",e)}
6e.emit(lj.ProviderUpdate,c8.INITIALIZED)}})}(e),yield e.sdkInitPromise}catch(e){throw console.error(e),e}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return"undefined"!=typeof window&&!!(null===(e=window.ethereum)||void 0===e?void 0:e.isMetaMask)}connect(){return p(this,void 0,void 0,function*(){return function(e){return p(this,void 0,void 0,function*(){if(e._initialized||(lA("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),lA(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");let t=e.activeProvider.getSelectedAddress();return t?[t]:e.activeProvider.request({method:lQ.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return p(this,void 0,void 0,function*(){return function({instance:e,msg:t}){return p(this,void 0,void 0,function*(){if(e._initialized||(lA("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield e.init()),lA(`[MetaMaskSDK: connectAndSign()] activeProvider=${e.activeProvider}`),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");let n=/^0x([0-9A-Fa-f]{2})*$/u.test(t)?t:function(e){let t;if(void 0!==I)t=I.from(e,"utf8").toString("hex");else if("undefined"!=typeof TextEncoder)t=Array.from((new TextEncoder).encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("");else{if("object"!=typeof g||!("Buffer"in g))throw Error("Unable to convert string to hex: No available method.");t=g.Buffer.from(e,"utf8").toString("hex")}return`0x${t}`}(t);return e.activeProvider.request({method:lQ.METAMASK_CONNECTWITH,params:[{method:lQ.PERSONAL_SIGN,params:[n]}]})})}({instance:this,msg:e})})}connectWith(e){return p(this,void 0,void 0,function*(){return function({instance:e,rpc:t}){return p(this,void 0,void 0,function*(){if(e._initialized||(lA("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield e.init()),lA(`[MetaMaskSDK: connectWith()] method: ${t.method} rpc=${t}`),!e.activeProvider)throw Error("SDK state invalid -- undefined provider");return e.activeProvider.request({method:lQ.METAMASK_CONNECTWITH,params:[t]})})}({instance:this,rpc:e})})}resume(){return function(e){var t,n,r;return p(this,void 0,void 0,function*(){if(!(null===(n=null===(t=e.remoteConnection)||void 0===t?void 0:t.getConnector())||void 0===n?void 0:n.isReady()))return lA("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void(null===(r=e.remoteConnection)||void 0===r||r.startConnection());lA("[MetaMaskSDK: resume()] channel is ready")})}(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;null===(e=this.remoteConnection)||void 0===e||e.isAuthorized()}terminate(){return function(e){var t,n,r;return p(this,void 0,void 0,function*(){if(!(null===(t=e.platformManager)||void 0===t?void 0:t.isMetaMaskMobileWebView())){if(l9&&(window.localStorage.removeItem(l5),window.localStorage.removeItem(l6),window.localStorage.removeItem(l8)),e.extensionActive){try{yield null===(n=e.activeProvider)||void 0===n?void 0:n.request({method:lQ.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(e){lA("[MetaMaskSDK: terminate()] error revoking permissions",e)}return e.options.extensionOnly?(e.emit(lj.ProviderUpdate,c8.TERMINATE),void lA("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(lj.ProviderUpdate,c8.TERMINATE))}e.emit(lj.ProviderUpdate,c8.TERMINATE),lA(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),null===(r=e.remoteConnection)||void 0===r||r.disconnect({terminate:!0,sendMessage:!0})}})}(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}
6getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;let t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getUniversalLink();if(!t)throw Error("No Universal Link available, please call eth_requestAccounts first.");return t}getChannelId(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getChannelConfig())||void 0===t?void 0:t.channelId}getRPCHistory(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getRPCMethodTracker()}getVersion(){return lV.version}getWalletStatus(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getConnectionStatus()}_getChannelConfig(){var e;return null===(e=this.remoteConnection)||void 0===e?void 0:e.getChannelConfig()}_ping(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.ping()}_keyCheck(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.keyCheck()}_getServiceStatus(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return null===(e=this.remoteConnection)||void 0===e?void 0:e.getKeyInfo()}_resetKeys(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,t){return super.emit(e,t)}on(e,t){return super.on(e,t)}}var cI=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return p(this,void 0,void 0,function*(){let t=JSON.stringify(e);lA(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(l3,t)})}getPersistedChannelConfig(){return p(this,void 0,void 0,function*(){let e;try{if(lA(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(l3),lA("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;let t=JSON.parse(e);return lA("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(e){return p(this,void 0,void 0,function*(){lA(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);let t=JSON.stringify(e);localStorage.setItem(l8,t)})}getCachedAccounts(){return p(this,void 0,void 0,function*(){try{let e=localStorage.getItem(l8);return e?JSON.parse(e):[]}catch(e){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",e),e}})}persistChainId(e){return p(this,void 0,void 0,function*(){lA(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(l6,e)})}getCachedChainId(){return p(this,void 0,void 0,function*(){try{let e=localStorage.getItem(l6);return null!=e?e:void 0}catch(e){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",e),e}})}terminate(){return p(this,void 0,void 0,function*(){lA(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(l3)})}}}),cR=Object.defineProperty,cP=new WeakMap,cT=e=>cP.get(e),cO=(e,t)=>cP.set(t.$lazyInstance$=e,t),cL=(e,t)=>t in e,cN=(e,t)=>(0,console.error)(e,t),c$=new Map,cD=new Map,cB="slot-fb{display:contents}slot-fb[hidden]{display:none}",cK="undefined"!=typeof window?window:{},cU=cK.document||{head:{}},cj={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},cH=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),cF=!1,cz=[],cq=[],cW=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){cN(e)}e.length=0},cV=()=>
6{cW(cz),cW(cq),(cF=cz.length>0)&&cj.raf(cV)},cG=e=>Promise.resolve(void 0).then(e),cY=e=>{cq.push(e),cF||(cF=!0,4&cj.$flags$?cG(cV):cj.raf(cV))},cZ={},cJ=e=>"object"==(e=typeof e)||"function"===e;function cX(e){var t,n,r;return null!=(r=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?r:void 0}((e,t)=>{for(var n in t)cR(e,n,{get:t[n],enumerable:!0})})({},{err:()=>c0,map:()=>c1,ok:()=>cQ,unwrap:()=>c9,unwrapErr:()=>c7});var cQ=e=>({isOk:!0,isErr:!1,value:e}),c0=e=>({isOk:!1,isErr:!0,value:e});function c1(e,t){if(e.isOk){let n=t(e.value);return n instanceof Promise?n.then(e=>cQ(e)):cQ(n)}if(e.isErr)return c0(e.value);throw"should never get here"}var c2,c3,c5,c8,c6,c4,c9=e=>{if(e.isOk)return e.value;throw e.value},c7=e=>{if(e.isErr)return e.value;throw e.value},de=(e,t,...n)=>{let r=null,i=!1,o=!1,a=[],s=t=>{for(let n=0;n<t.length;n++)Array.isArray(r=t[n])?s(r):null!=r&&"boolean"!=typeof r&&((i="function"!=typeof e&&!cJ(r))&&(r=String(r)),i&&o?a[a.length-1].$text$+=r:a.push(i?dt(null,r):r),o=i)};if(s(n),t){let e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}if("function"==typeof e)return e(null===t?{}:t,a,dr);let l=dt(e,null);return l.$attrs$=t,a.length>0&&(l.$children$=a),l},dt=(e,t)=>
6({$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null}),dn={},dr={forEach:(e,t)=>e.map(di).forEach(t),map:(e,t)=>e.map(di).map(t).map(da)},di=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),da=e=>{if("function"==typeof e.vtag){let t={...e.vattrs};return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),de(e.vtag,t,...e.vchildren||[])}let t=dt(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},ds=e=>cT(e).$hostElement$,dl=(e,t,n)=>{let r=ds(e);return{emit:e=>dc(r,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},dc=(e,t,n)=>{let r=cj.ce(t,n);return e.dispatchEvent(r),r},dd=new WeakMap,du=e=>{let t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$,i=(t.$tagName$,()=>{}),o=((e,t,n)=>{var r;let i=dh(t),o=cD.get(i);if(e=11===e.nodeType?e:cU,o){if("string"==typeof o){e=e.head||e;let n,a=dd.get(e);if(a||dd.set(e,a=new Set),!a.has(i)){{(n=cU.createElement("style")).innerHTML=o;let i=null!=(r=cj.$nonce$)?r:cX(cU);if(null!=i&&n.setAttribute("nonce",i),!(1&t.$flags$)){if("HEAD"===e.nodeName){let t=e.querySelectorAll("link[rel=preconnect]"),r=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(n,r)}else if("host"in e){if(cH){let t=new CSSStyleSheet;t.replaceSync(o),e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{let t=e.querySelector("style");t?t.innerHTML=o+t.innerHTML:e.prepend(n)}}else e.append(n)}1&t.$flags$&&"HEAD"!==e.nodeName&&e.insertBefore(n,null)}4&t.$flags$&&(n.innerHTML+=cB),a&&a.add(i)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o])}return i})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&r&&2&r&&(n["s-sc"]=o,n.classList.add(o+"-h")),i()},dh=(e,t)=>"sc-"+e.$tagName$,df=(e,t,n,r,i,o)=>{if(n!==r){let a=cL(e,t),s=t.toLowerCase();if("class"===t){let t=e.classList,i=dg(n),o=dg(r);t.remove(...i.filter(e=>e&&!o.includes(e))),t.add(...o.filter(e=>e&&!i.includes(e)))}else if("style"===t){for(let t in n)r&&null!=r[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(let t in r)n&&r[t]===n[t]||(t.includes("-")?e.style.setProperty(t,r[t]):e.style[t]=r[t])}else if(a||"o"!==t[0]||"n"!==t[1]){let s=cJ(r);if((a||s&&null!==r)&&!i)try{if(e.tagName.includes("-"))e[t]=r;else{let i=null==r?"":r;"list"===t?a=!1:null!=n&&e[t]==i||("function"==typeof e.__lookupSetter__(t)?e[t]=i:e.setAttribute(t,i))}}catch(e){}null==r||!1===r?!1===r&&""!==e.getAttribute(t)||e.removeAttribute(t):(!a||4&o||i)&&!s&&(r=!0===r?"":r,e.setAttribute(t,r))}else if(t="-"===t[2]?t.slice(3):cL(cK,s)?s.slice(2):s[2]+t.slice(3),n||r){let i=t.endsWith(dm);t=t.replace(dy,""),n&&cj.rel(e,t,n,i),r&&cj.ael(e,t,r,i)}}},dp=/\s/,dg=e=>e?e.split(dp):[],dm="Capture",dy=RegExp(dm+"$"),dv=(e,t,n)=>{let r=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||cZ,o=t.$attrs$||cZ;for(let e of db(Object.keys(i)))e in o||df(r,e,i[e],void 0,n,t.$flags$);for(let e of db(Object.keys(o)))df(r,e,i[e],o[e],n,t.$flags$)};function db(e){return e.includes("ref")?[...e.filter(e=>"ref"!==e),"ref"]:e}var dE=!1,dw=(e,t,n,r)=>{let i=t.$children$[n],o,a,s=0;if(null!==i.$text$)o=i.$elm$=cU.createTextNode(i.$text$);else{if(dE||(dE="svg"===i.$tag$),o=i.$elm$=cU.createElementNS(dE?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),dE&&"foreignObject"===i.$tag$&&(dE=!1),dv(null,i,dE),o.getRootNode().querySelector("body"),i.$children$)for(s=0;s<i.$children$.length;++s)(a=dw(e,i,s))&&o.appendChild(a);"svg"===i.$tag$?dE=!1:"foreignObject"===o.tagName&&(dE=!0)}return o["s-hn"]=c4,o},dS=(e,t,n,r,i,o)=>{let a,s=e;for(s.shadowRoot&&s.tagName===c4&&(s=s.shadowRoot);i<=o;++i)r[i]&&(a=dw(null,n,i))&&(r[i].$elm$=a,dk(s,a,t))},d_=(e,t,n)=>{for(let r=t;r<=n;++r){let t=e[r];if(t){let e=t.$elm$;e&&e.remove()}}},dC=(e,t,n=!1)=>e.$tag$===t.$tag$,dx=(e,t,n=!1)=>{let r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,a=t.$tag$,s=t.$text$;null===s?(dv(e,t,dE="svg"===a||"foreignObject"!==a&&dE),null!==i&&null!==o?((e,t,n,r,i=!1)=>{let o,a=0,s=0,l=t.length-1,c=t[0],d=t[l],u=r.length-1,h=r[0],f=r[u];for(;a<=l&&s<=u;)null==c?c=t[++a]:null==d?d=t[--l]:null==h?h=r[++s]:null==f?f=r[--u]:dC(c,h,i)?(dx(c,h,i),c=t[++a],h=r[++s]):dC(d,f,i
6)?(dx(d,f,i),d=t[--l],f=r[--u]):dC(c,f,i)?(dx(c,f,i),dk(e,c.$elm$,d.$elm$.nextSibling),c=t[++a],f=r[--u]):dC(d,h,i)?(dx(d,h,i),dk(e,d.$elm$,c.$elm$),d=t[--l],h=r[++s]):(o=dw(t&&t[s],n,s),h=r[++s],o&&dk(c.$elm$.parentNode,o,c.$elm$));a>l?dS(e,null==r[u+1]?null:r[u+1].$elm$,n,r,s,u):s>u&&d_(t,a,l)})(r,i,t,o,n):null!==o?(null!==e.$text$&&(r.textContent=""),dS(r,null,t,o,0,o.length-1)):n||null===i||d_(i,0,i.length-1),dE&&"svg"===a&&(dE=!1)):e.$text$!==s&&(r.data=s)},dk=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),dM=(e,t,n=!1)=>{let r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||dt(null,null),a=t&&t.$tag$===dn?t:de(null,null,t);if(c4=r.tagName,n&&a.$attrs$)for(let e of Object.keys(a.$attrs$))r.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(a.$attrs$[e]=r[e]);a.$tag$=null,a.$flags$|=4,e.$vnode$=a,a.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],i.$flags$,dx(o,a,n)},dA=(e,t)=>{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.$onRenderResolve$=t))},dI=(e,t)=>(e.$flags$|=16,4&e.$flags$)?void(e.$flags$|=512):(dA(e,e.$ancestorComponent$),cY(()=>dR(e,t))),dR=(e,t)=>{let n=e.$hostElement$,r=(e.$cmpMeta$.$tagName$,()=>{}),i=e.$lazyInstance$;if(!i)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return r(),dP(void 0,()=>dO(e,i,t))},dP=(e,t)=>
6dT(e)?e.then(t).catch(e=>{console.error(e),t()}):t(),dT=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,dO=async(e,t,n)=>{var r;let i=e.$hostElement$,o=(e.$cmpMeta$.$tagName$,()=>{}),a=i["s-rc"];n&&du(e);let s=(e.$cmpMeta$.$tagName$,()=>{});dL(e,t,i,n),a&&(a.map(e=>e()),i["s-rc"]=void 0),s(),o();{let t=null!=(r=i["s-p"])?r:[],n=()=>dN(e);0===t.length?n():(Promise.all(t).then(n),e.$flags$|=4,t.length=0)}},dL=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,dM(e,t,r)}catch(t){cN(t,e.$hostElement$)}return null},dN=e=>{e.$cmpMeta$.$tagName$;let t=e.$hostElement$,n=()=>{},r=e.$lazyInstance$,i=e.$ancestorComponent$;64&e.$flags$?n():(e.$flags$|=64,dB(t),dD(r,"componentDidLoad"),n(),e.$onReadyResolve$(t),i||d$()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),512&e.$flags$&&cG(()=>dI(e,!1)),e.$flags$&=-517},d$=e=>{dB(cU.documentElement),cG(()=>dc(cK,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},dD=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){cN(e)}},dB=e=>e.classList.add("hydrated"),dK=(e,t,n,r)=>{var i,o;let a=cT(e);if(!a)throw Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);let s=a.$hostElement$,l=a.$instanceValues$.get(t),c=a.$flags$,d=a.$lazyInstance$;i=n,o=r.$members$[t][0],n=null==i||cJ(i)?i:4&o?"false"!==i&&(""===i||!!i):1&o?String(i):i;let u=Number.isNaN(l)&&Number.isNaN(n);if((!(8&c)||void 0===l)&&n!==l&&!u&&(a.$instanceValues$.set(t,n),d)){if(r.$watchers$&&128&c){let e=r.$watchers$[t];e&&e.map(e=>{try{d[e](n,l,t)}catch(e){cN(e,s)}})}2==(18&c)&&dI(a,!1)}},dU=(e,t,n)=>{var r,i;let o=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);let a=Object.entries(null!=(r=t.$members$)?r:{});if(a.map(([e,[r]])=>{(31&r||2&n&&32&r)&&Object.defineProperty(o,e,{get(){return cT(this).$instanceValues$.get(e)},set(n){dK(this,e,n,t)},configurable:!0,enumerable:!0})}),1&n){let n=new Map;o.attributeChangedCallback=function(e,r,i){cj.jmp(()=>{var a;let s=n.get(e);if(this.hasOwnProperty(s))i=this[s],delete this[s];else{if(o.hasOwnProperty(s)&&"number"==typeof this[s]&&this[s]==i)return;if(null==s){let n=cT(this),o=null==n?void 0:n.$flags$;if(o&&!(8&o)&&128&o&&i!==r){let o=n.$lazyInstance$,s=null==(a=t.$watchers$)?void 0:a[e];null==s||s.forEach(t=>{null!=o[t]&&o[t].call(o,i,r,e)})}return}}this[s]=(null!==i||"boolean"!=typeof this[s])&&i})},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=t.$watchers$)?i:{}),...a.filter(([e,t])=>15&t[0]).map(([e,t])=>{let r=t[1]||e;return n.set(r,e),r})]))}}return e},dj=async(e,t,n,r)=>{let i;if(0==(32&t.$flags$)){if(t.$flags$|=32,n.$lazyBundleId$){let e=((e,t,n)=>{let r=e.$tagName$.replace(/-/g,"_"),i=e.$lazyBundleId$;if(!i)return;let o=c$.get(i);return o?o[r]:"mm-install-modal_3"===i?Promise.resolve().then(function(){return uy}).then(e=>(c$.set(i,e),e[r]),cN):import(`./${i}.entry.js`).then(e=>(c$.set(i,e),e[r]),cN)})(n);if(!(i=e&&"then"in e?await e:e))throw Error(`Constructor for "${n.$tagName$}#${t.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,dU(i,n,2),i.isProxied=!0);let r=(n.$tagName$,()=>{});t.$flags$|=8;try{new i(t)}catch(e){cN(e)}t.$flags$&=-9,t.$flags$|=128,r(),dH(t.$lazyInstance$)}else{i=e.constructor;let n=e.localName;customElements.whenDefined(n).then(()=>t.$flags$|=128)}if(i&&i.style){let e;"string"==typeof i.style&&(e=i.style);let t=dh(n);if(!cD.has(t)){var o,a;let r;let i=(n.$tagName$,()=>{});o=e,a=!!(1&n.$flags$),r=cD.get(t),cH&&a?"string"==typeof(r=r||new CSSStyleSheet)?r=o:r.replaceSync(o):r=o,cD.set(t,r),i()}}}let s=t.$ancestorComponent$,l=()=>dI(t,!0);s&&s["s-rc"]?s["s-rc"].push(l):l()},dH=e=>{dD(e,"connectedCallback")},dF=e=>{dD(e,"disconnectedCallback")},dz=(e,t={})=>{var n;let r=[],i=t.exclude||[],o=cK.customElements,a=cU.head,s=a.querySelector("meta[charset]"),l=cU.createElement("style"),c=[],d,u=!0;Object.assign(cj,t),cj.$resourcesUrl$=new URL(t.resourcesUrl||"./",cU.baseURI).href;let h=!1;if(e.map(e=>{e[1].map(t=>{var n;let a={$flags$:t[0],$tagName$:t[1],$members$:t[2],$listeners$:t[3]};4&a.$flags$&&(h=!0),a.$members$=t[2],a.$watchers$=null!=(n=t[4])?n:{};let s=a.$tagName$,l=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,t)=>{let n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};n.$onReadyPromise$=new Promise(e=>
6n.$onReadyResolve$=e),e["s-p"]=[],e["s-rc"]=[],cP.set(e,n)})(e=this,a),1&a.$flags$){if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${a.$tagName$}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}}connectedCallback(){cT(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),d&&(clearTimeout(d),d=null),u?c.push(this):cj.jmp(()=>(e=>{if(0==(1&cj.$flags$)){let t=cT(e),n=t.$cmpMeta$,r=(n.$tagName$,()=>{});if(1&t.$flags$)(null==t?void 0:t.$lazyInstance$)?dH(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>dH(t.$lazyInstance$));else{t.$flags$|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){dA(t,t.$ancestorComponent$=n);break}}n.$members$&&Object.entries(n.$members$).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){let n=e[t];delete e[t],e[t]=n}}),dj(e,t,n)}r()}})(this))}disconnectedCallback(){cj.jmp(()=>(async e=>{if(0==(1&cj.$flags$)){let t=cT(e);(null==t?void 0:t.$lazyInstance$)?dF(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>dF(t.$lazyInstance$))}})(this))}componentOnReady(){return cT(this).$onReadyPromise$}};a.$lazyBundleId$=e[0],i.includes(s)||o.get(s)||(r.push(s),o.define(s,dU(l,a,1)))})}),r.length>0&&(h&&(l.textContent+=cB),l.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",l.innerHTML.length)){l.setAttribute("data-styles","");let e=null!=(n=cj.$nonce$)?n:cX(cU);null!=e&&l.setAttribute("nonce",e),a.insertBefore(l,s?s.nextSibling:a.firstChild)}u=!1,c.length?c.map(e=>e.connectedCallback()):cj.jmp(()=>d=setTimeout(d$,30))};!function(){if("undefined"!=typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}();var dq=Object.freeze({__proto__:null,defineCustomElements:async(e,t)=>{if("undefined"!=typeof window)return await void 0,dz([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],t)},setNonce:e=>cj.$nonce$=e});let dW={fontFamily:"Roboto, sans-serif"},dV=({className:e},t)=>de("div",{style:dW,class:e},t),dG=({Icon:e,text:t})=>de("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},de("div",{class:"flexItem1"},de(e,null)),de("div",{class:"flexItem11"},de("span",{style:{lineHeight:"2",color:"black"}},t))),dY=()=>de("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502C15.8502 7.1702 16.3602 6.9502 16.9202 6.9502H19.0002C19.5602 6.9702 20.0002 7.4202 20.0002 7.9702Z",fill:"#037DD6"}),de("path",{d:"M18.47 12.55H17.04C15.14 12.55 13.54 11.12 13.38 9.3C13.29 8.26 13.67 7.22 14.43 6.48C15.07 5.82 15.96 5.45 16.92 5.45H18.47C18.76 5.45 19 5.21 18.97 4.92C18.75 2.49 17.14 0.83 14.75 0.55C14.51 0.51 14.26 0.5 14 0.5H5C4.72 0.5 4.45 0.52 4.19 0.56C1.64 0.88 0 2.78 0 5.5V12.5C0 15.26 2.24 17.5 5 17.5H14C16.8 17.5 18.73 15.75 18.97 13.08C19 12.79 18.76 12.55 18.47 12.55ZM11 6.75H5C4.59 6.75 4.25 6.41 4.25 6C4.25 5.59 4.59 5.25 5 5.25H11C11.41 5.25 11.75 5.59 11.75 6C11.75 6.41 11.41 6.75 11 6.75Z",fill:"#037DD6"})),dZ=()=>de("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("path",{d:"M14.44 0.0999756C12.63 0.0999756 11.01 0.979976 10 2.32998C8.99 0.979976 7.37 0.0999756 5.56 0.0999756C2.49 0.0999756 0 2.59998 0 5.68998C0 6.87998 0.19 7.97998 0.52 8.99998C2.1 14 6.97 16.99 9.38 17.81C9.72 17.93 10.28 17.93 10.62 17.81C13.03 16.99 17.9 14 19.48 8.99998C19.81 7.97998 20 6.87998 20 5.68998C20 2.59998 17.51 0.0999756 14.44 0.0999756Z",fill:"#037DD6"})),dJ=()=>de("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("path",{d:"M16.28 7.53V6.28C16.28 3.58 15.63 0 10 0C4.37 0 3.72 3.58 3.72 6.28V7.53C0.92 7.88 0 9.3 0 12.79V14.65C0 18.75 1.25 20 5.35 20H14.65C18.75 20 20 18.75 20 14.65V12.79C20 9.3 19.08 7.88 16.28 7.53ZM10 16.74C8.33 16.74 6.98 15.38 6.98 13.72C6.98 12.05 8.34 10.7 10 10.7C11.66 10.7 13.02 12.06 13.02 13.72C13.02 15.39 11.67 16.74 10 16.74ZM5.35 7.44C5.27 7.44 5.2 7.44 5.12 7.44V6.28C5.12 3.35 5.95 1.4 10 1.4C14.05 1.4 14.88 3.35 14.88 6.28V7.45C14.8 7.45 14.73 7.45 14.65 7.45H5.35V7.44Z",fill:"#037DD6"})),dX=()=>de("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("path",{d:"M16.4405 8.8999C20.0405 9.2099 21.5105 11.0599 21.5105 15.1099V15.2399C21.5105 19.7099 19.7205 21.4999 15.2505 21.4999H8.74047C4.27047 21.4999 2.48047 19.7099 2.48047 15.2399V15.1099C2.48047 11.0899 3.93047 9.2399 7.47047 8.9099",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),de("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),de("path",{d:"M15.3504 12.6499L12.0004 15.9999L8.65039 12.6499",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}));function dQ({version:e}){return de("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",e?`v${e}`:"unknown")}let d0=()=>de("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("rect",{width:"16",height:"16",fill:"white"}),de("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554
6C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),d1=()=>de("svg",{width:"120",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 127 63"},de("path",{fill:"currentColor",d:"M71.554 48.607v13.81h-7.072v-9.568l-8.059.945c-1.77.205-2.548.79-2.548 1.864 0 1.575 1.478 2.239 4.648 2.239 1.932 0 4.073-.29 5.963-.79l-3.66 5.225c-1.479.332-2.92.496-4.44.496-6.414 0-10.074-2.57-10.074-7.132 0-4.023 2.877-6.136 9.416-6.884l8.638-1.012c-.467-2.532-2.362-3.633-6.13-3.633-3.537 0-7.443.912-10.937 2.613l1.111-6.18c3.248-1.369 6.95-2.074 10.69-2.074 8.226 0 12.461 3.444 12.461 10.075l-.008.005ZM7.938 31.315.208 62.416h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73l-7.73-31.105-14.518 17.388L7.934 31.311l.004.004ZM36.97.21 22.452 17.598 7.938.21.208 31.315h7.73l3.836-15.628 6.65 8.039h8.06l6.65-8.039 3.836 15.628h7.73L36.97.21Zm53.17 48.107-6.25-.912c-1.562-.247-2.178-.747-2.178-1.617 0-1.41 1.52-2.032 4.647-2.032 3.62 0 6.868.747 10.283 2.364l-.862-6.094c-2.757-.995-5.922-1.491-9.212-1.491-7.688 0-11.886 2.696-11.886 7.547 0 3.776 2.303 5.889 7.196 6.636l6.335.954c1.603.248 2.261.87 2.261 1.865 0 1.41-1.478 2.074-4.481 2.074-3.948 0-8.225-.953-11.72-2.654l.7 6.094c3.003 1.122 6.91 1.785 10.57 1.785 7.896 0 12.007-2.78 12.007-7.715 0-3.94-2.303-6.057-7.4-6.8l-.01-.004ZM100.3 34.09v28.325h7.071V34.091H100.3Zm15.334 15.595 9.833-10.744h-8.8l-9.296 11.114 9.912 12.356h8.925l-10.574-12.73v.004Zm-16.321-25.09c0 4.56 3.66 7.13 10.074 7.13 1.52 0 2.961-.167 4.44-.495l3.66-5.225c-1.89.496-4.031.79-5.963.79-3.166 0-4.648-.664-4.648-2.239 0-1.079.783-1.659 2.549-1.864l8.058-.945v9.567h7.072v-13.81c0-6.635-4.236-10.075-12.461-10.075-3.744 0-7.442.705-10.691 2.075l-1.112 6.178c3.495-1.701 7.401-2.613 10.937-2.613 3.769 0 5.664 1.1 6.13 3.633l-8.637 1.013c-6.539.747-9.417 2.86-9.417 6.883l.009-.004Zm-19.779-1.492c0 5.725 3.29 8.627 9.787 8.627 2.59 0 4.732-.416 6.785-1.37l.903-6.261c-1.974 1.2-3.99 1.822-6.005 1.822-3.044 0-4.402-1.243-4.402-4.023v-8.295h10.732V7.84H86.601V2.948l-13.448 7.174v3.482h6.372V23.1l.008.004Zm-6.95-2.612v1.411H53.47c.862 2.873 3.423 4.187 7.97 4.187 3.62 0 6.993-.747 9.992-2.196l-.862 6.056c-2.757 1.16-6.251 1.785-9.829 1.785-9.5 0-14.68-4.23-14.68-12.066 0-7.838 5.264-12.235 13.406-12.235s13.119 4.771 13.119 13.062l-.005-.004ZM53.378 17.09h12.086c-.637-2.751-2.732-4.188-6.08-4.188-3.349 0-5.335 1.399-6.006 4.188Z"}));function d2(e,t){return e.toString(2).padStart(t,"0")}function d3(e,t){let n=e%t;return n>=0?n:t+n}function d5(e,t){return Array(e).fill(t)}function d8(...e){let t=0;for(let n of e)t=Math.max(t,n.length);let n=[];for(let r=0;r<t;r++)for(let t of e)r>=t.length||n.push(t[r]);return new Uint8Array(n)}function d6(e,t,n){if(n<0||n+t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[n+r])return!1;return!0}function d4(e){return{has:t=>e.includes(t),decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw Error(`alphabet.decode: not string element=${t}`);let n=e.indexOf(t);if(-1===n)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})},encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(function(e){if(!Number.isSafeInteger(e))throw Error(`Wrong integer: ${e}`)}(t),t<0||t>=e.length)throw Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})}}}class d9{static size(e,t){if("number"==typeof e&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return void 0!==t&&(e={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}),e}static fromString(e){let t;let n=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split("\n"),r=n.length,i=Array(r);for(let e of n){let n=e.split("").map(e=>{if("X"===e)return!0;
6if(" "===e)return!1;if("?"!==e)throw Error(`Bitmap.fromString: unknown symbol=${e}`)});if(t&&n.length!==t)throw Error(`Bitmap.fromString different row sizes: width=${t} cur=${n.length}`);t=n.length,i.push(n)}return t||(t=0),new d9({height:r,width:t},i)}constructor(e,t){let{height:n,width:r}=d9.size(e);this.data=t||Array.from({length:n},()=>d5(r,void 0)),this.height=n,this.width=r}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};let{x:t,y:n}=this.xy(e);return{height:this.height-n,width:this.width-t}}xy(e){if("number"==typeof e&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw Error(`Bitmap: wrong y=${e.y}`);return e.x=d3(e.x,this.width),e.y=d3(e.y,this.height),e}rect(e,t,n){let{x:r,y:i}=this.xy(e),{height:o,width:a}=d9.size(t,this.size({x:r,y:i}));for(let e=0;e<o;e++)for(let t=0;t<a;t++)this.data[i+e][r+t]="function"==typeof n?n({x:t,y:e},this.data[i+e][r+t]):n;return this}rectRead(e,t,n){return this.rect(e,t,(e,t)=>(n(e,t),t))}hLine(e,t,n){return this.rect(e,{width:t,height:1},n)}vLine(e,t,n){return this.rect(e,{width:1,height:t},n)}border(e=2,t){let n=this.height+2*e,r=this.width+2*e,i=d5(e,t),o=Array.from({length:e},()=>d5(r,t));return new d9({height:n,width:r},[...o,...this.data.map(e=>[...i,...e,...i]),...o])}embed(e,t){return this.rect(e,t.size(),({x:e,y:n})=>t.data[n][e])}rectSlice(e,t=this.size()){let n=new d9(d9.size(t,this.size(this.xy(e))));return this.rect(e,t,({x:e,y:t},r)=>n.data[t][e]=r),n}inverse(){let{height:e,width:t}=this;return new d9({height:t,width:e}).rect({x:0,y:0},1/0,({x:e,y:t})=>this.data[e][t])}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw Error(`Wrong scale factor: ${e}`);let{height:t,width:n}=this;return new d9({height:e*t,width:e*n}).rect({x:0,y:0},1/0,({x:t,y:n})=>this.data[Math.floor(n/e)][Math.floor(t/e)])}clone(){return new d9(this.size()).rect({x:0,y:0},this.size(),({x:e,y:t})=>this.data[t][e])}assertDrawn(){this.rectRead(0,1/0,(e,t)=>{if("boolean"!=typeof t)throw Error("Invalid color type="+typeof t)})}toString(){return this.data.map(e=>e.map(e=>void 0===e?"?":e?"X":" ").join("")).join("\n")}toASCII(){let{height:e,width:t,data:n}=this,r="";for(let i=0;i<e;i+=2){for(let o=0;o<t;o++){let t=n[i][o],a=i+1>=e||n[i+1][o];t||a?!t&&a?r+="â":t&&!a?r+="â":t&&a&&(r+=" "):r+="â"}r+="\n"}return r}toTerm(){let e="\x1b[0m",t=`�[1;47m ${e}`,n=`�[40m ${e}`;return this.data.map(e=>e.map(e=>e?n:t).join("")).join("\n")}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,({x:t,y:n},r)=>{r&&(e+=`<rect x="${t}" y="${n}" width="1" height="1" />`)}),e+="</svg>"}toGIF(){let e=e=>[255&e,e>>>8&255],t=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,(e,t)=>n.push(+(!0===t)));let r=[71,73,70,56,55,97,...t,246,0,0,255,255,255,...d5(381,0),44,0,0,0,0,...t,0,7],i=Math.floor(n.length/126);for(let e=0;e<i;e++)r.push(127,128,...n.slice(126*e,126*(e+1)).map(e=>+e));return r.push(n.length%126+1,128,...n.slice(126*i).map(e=>+e)),r.push(1,129,0,59),new Uint8Array(r)}toImage(e=!1){let{height:t,width:n}=this.size(),r=new Uint8Array(t*n*(e?3:4)),i=0;for(let o=0;o<t;o++)for(let t=0;t<n;t++){let n=this.data[o][t]?0:255;r[i++]=n,r[i++]=n,r[i++]=n,e||(r[i++]=255)}return{height:t,width:n,data:r}}}let d7=["low","medium","quartile","high"],ue=["numeric","alphanumeric","byte","kanji","eci"],ut=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],un={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]}
6,ur={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},ui={size:{encode:e=>21+4*(e-1),decode:e=>(e-17)/4},sizeType:e=>Math.floor((e+7)/17),alignmentPatterns(e){if(1===e)return[];let t=ui.size.encode(e)-6-1,n=t-6,r=Math.ceil(n/28),i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);let o=[6];for(let e=1;e<r;e++)o.push(t-(r-e)*i);return o.push(t),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(e,t){let n=ui.ECCode[e]<<3|t,r=n;for(let e=0;e<10;e++)r=r<<1^1335*(r>>9);return(n<<10|r)^ui.formatMask},versionBits(e){let t=e;for(let e=0;e<12;e++)t=t<<1^7973*(t>>11);return e<<12|t},alphabet:{numeric:d4("0123456789"),alphanumerc:d4("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(e,t)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]})[t][ui.sizeType(e)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(e,t){let n=ut[e-1],r=un[t][e-1],i=ur[t][e-1],o=Math.floor(n/i)-r,a=i-n%i;return{words:r,numBlocks:i,shortBlocks:a,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-a}}},uo=[(e,t)=>(e+t)%2==0,(e,t)=>t%2==0,(e,t)=>e%3==0,(e,t)=>(e+t)%3==0,(e,t)=>(Math.floor(t/2)+Math.floor(e/3))%2==0,(e,t)=>e*t%2+e*t%3==0,(e,t)=>(e*t%2+e*t%3)%2==0,(e,t)=>((e+t)%2+e*t%3)%2==0],ua={tables:(e=>{let t=d5(256,0),n=d5(256,0);for(let e=0,r=1;e<256;e++)t[e]=r,n[r]=e,256&(r<<=1)&&(r^=285);return{exp:t,log:n}})(),exp:e=>ua.tables.exp[e],log(e){if(0===e)throw Error(`GF.log: wrong arg=${e}`);return ua.tables.log[e]%255},mul:(e,t)=>
60===e||0===t?0:ua.tables.exp[(ua.tables.log[e]+ua.tables.log[t])%255],add:(e,t)=>e^t,pow:(e,t)=>ua.tables.exp[ua.tables.log[e]*t%255],inv(e){if(0===e)throw Error(`GF.inverse: wrong arg=${e}`);return ua.tables.exp[255-ua.tables.log[e]]},polynomial(e){if(0==e.length)throw Error("GF.polymomial: wrong length");if(0!==e[0])return e;let t=0;for(;t<e.length-1&&0==e[t];t++);return e.slice(t)},monomial(e,t){if(e<0)throw Error(`GF.monomial: wrong degree=${e}`);if(0==t)return[0];let n=d5(e+1,0);return n[0]=t,ua.polynomial(n)},degree:e=>e.length-1,coefficient:(e,t)=>e[ua.degree(e)-t],mulPoly(e,t){if(0===e[0]||0===t[0])return[0];let n=d5(e.length+t.length-1,0);for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)n[r+i]=ua.add(n[r+i],ua.mul(e[r],t[i]));return ua.polynomial(n)},mulPolyScalar(e,t){if(0==t)return[0];if(1==t)return e;let n=d5(e.length,0);for(let r=0;r<e.length;r++)n[r]=ua.mul(e[r],t);return ua.polynomial(n)},mulPolyMonomial(e,t,n){if(t<0)throw Error("GF.mulPolyMonomial: wrong degree");if(0==n)return[0];let r=d5(e.length+t,0);for(let t=0;t<e.length;t++)r[t]=ua.mul(e[t],n);return ua.polynomial(r)},addPoly(e,t){if(0===e[0])return t;if(0===t[0])return e;let n=e,r=t;n.length>r.length&&([n,r]=[r,n]);let i=d5(r.length,0),o=r.length-n.length,a=r.slice(0,o);for(let e=0;e<a.length;e++)i[e]=a[e];for(let e=o;e<r.length;e++)i[e]=ua.add(n[e-o],r[e]);return ua.polynomial(i)},remainderPoly(e,t){let n=Array.from(e);for(let r=0;r<e.length-t.length+1;r++){let e=n[r];if(0!==e)for(let i=1;i<t.length;i++)0!==t[i]&&(n[r+i]=ua.add(n[r+i],ua.mul(t[i],e)))}return n.slice(e.length-t.length+1,n.length)},divisorPoly(e){let t=[1];for(let n=0;n<e;n++)t=ua.mulPoly(t,[1,ua.pow(2,n)]);return t},evalPoly(e,t){if(0==t)return ua.coefficient(e,0);let n=e[0];for(let r=1;r<e.length;r++)n=ua.add(ua.mul(t,n),e[r]);return n},euclidian(e,t,n){ua.degree(e)<ua.degree(t)&&([e,t]=[t,e]);let r=e,i=t,o=[0],a=[1];for(;2*ua.degree(i)>=n;){let e=r,t=o;if(r=i,o=a,0===r[0])throw Error("rLast[0] === 0");i=e;let n=[0],s=ua.inv(r[0]);for(;ua.degree(i)>=ua.degree(r)&&0!==i[0];){let e=ua.degree(i)-ua.degree(r),t=ua.mul(i[0],s);n=ua.addPoly(n,ua.monomial(e,t)),i=ua.addPoly(i,ua.mulPolyMonomial(r,e,t))}if(n=ua.mulPoly(n,o),a=ua.addPoly(n,t),ua.degree(i)>=ua.degree(r))throw Error(`Division failed r: ${i}, rLast: ${r}`)}let s=ua.coefficient(a,0);if(0==s)throw Error("sigmaTilde(0) was zero");let l=ua.inv(s);return[ua.mulPolyScalar(a,l),ua.mulPolyScalar(i,l)]}};function us(e,t,n,r){let i="",o=n.length;if("numeric"===r){let e=ui.alphabet.numeric.decode(n.split("")),t=e.length;for(let n=0;n<t-2;n+=3)i+=d2(100*e[n]+10*e[n+1]+e[n+2],10);t%3==1?i+=d2(e[t-1],4):t%3==2&&(i+=d2(10*e[t-2]+e[t-1],7))}else if("alphanumeric"===r){let e=ui.alphabet.alphanumerc.decode(n.split("")),t=e.length;for(let n=0;n<t-1;n+=2)i+=d2(45*e[n]+e[n+1],11);t%2==1&&(i+=d2(e[t-1],6))}else{if("byte"!==r)throw Error("encode: unsupported type");{let e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(n);o=e.length,i=Array.from(e).map(e=>d2(e,8)).join("")}}let{capacity:a}=ui.capacity(e,t),s=d2(o,ui.lengthBits(e,r)),l=ui.modeBits[r]+s+i;if(l.length>a)throw Error("Capacity overflow");(l+="0".repeat(Math.min(4,Math.max(0,a-l.length)))).length%8&&(l+="0".repeat(8-l.length%8));for(let e=0;l.length!==a;e++)l+="1110110000010001"[e%16];let c=Uint8Array.from(l.match(/(.{8})/g).map(e=>Number(`0b${e}`)));return(function(e,t){let{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:a}=ui.capacity(e,t),s={encode(e){let t=ua.divisorPoly(n),r=Array.from(e);return r.push(...t.slice(0,-1).fill(0)),Uint8Array.from(ua.remainderPoly(r,t))},decode(e){let t=e.slice(),r=ua.polynomial(Array.from(e)),i=d5(n,0),o=!1;for(let e=0;e<n;e++){let t=ua.evalPoly(r,ua.exp(e));i[i.length-1-e]=t,0!==t&&(o=!0)}if(!o)return t;i=ua.polynomial(i);let a=ua.monomial(n,1),[s,l]=ua.euclidian(a,i,n),c=d5(ua.degree(s),0),d=0;for(let e=1;e<256&&d<c.length;e++)0===ua.evalPoly(s,e)&&(c[d++]=ua.inv(e));if(d!==c.length)throw Error("RS.decode: wrong errors number");for(let e=0;e<c.length;e++){let n=t.length-1-ua.log(c[e]);if(n<0)throw Error("RS.decode: wrong error location");let r=ua.inv(c[e]),i=1;for(let t=0;t<c.length;t++)e!==t&&(i=ua.mul(i,ua.add(1,ua.mul(c[t],r))));t[n]=ua.add(t[n],ua.mul(ua.evalPoly(l,r),ua.inv(i)))}return t}};return{encode(e){let t=[],n=[];for(let a=0;a<i;a++){let i=o+(a<r?0:1);t.push(e.subarray(0,i)),n.push(s.encode(e.subarray(0,i))),e=e.subarray(i)}let a=d8(...t),l=d8(...n),c=new Uint8Array(a.length+l.length);return c.set(a),c.set(l,a.length),c},decode(e){if(e.length!==a)throw Error(`interleave.decode: len(data)=${e.length}, total=${a}`);let t=[];for(let e=0;e<i;e++){let i=e<r;t.push(new Uint8Array(n+o+(i?0:1)))}let l=0;for(let n=0;n<o;n++)for(let r=0;r<i;r++)t[r][n]=e[l++];for(let n=r;n<i;n++)t[n][o]=e[l++];for(let a=o;a<o+n;a++)for(let n=0;n<i;n++){let i=n<r;t[n][a+(i?0:1)]=e[l++]}let c=[];for(let e of t)c.push(...Array.from(s.decode(e)).slice(0,-n));return Uint8Array.from(c)}}})(e,t).encode(c)}function ul(e,t,n,r,i=!1){let o=function(e,t,n,r=!1){let i=ui.size.encode(e),o=new d9(i+2),a=new d9(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);o=(o=o.embed(0,a).embed({x:-a.width,y:0},a).embed({x:0,y:-a.height},a)).rectSlice(1,i);let s=new d9(1).rect(0,1,!0).border(1,!1).border(1,!0),l=ui.alignmentPatterns(e);for(let e of l)for(let t of l)void 0===o.data[e][t]&&o.embed({x:t-2,y:e-2},s);o=o.hLine({x:0,y:6},1/0,({x:e},t)=>void 0===t?e%2==0:t).vLine({x:6,y:0},1/0,({y:e},t)=>void 0===t?e%2==0:t);
6{let e=ui.formatBits(t,n),a=t=>!r&&1==(e>>t&1);for(let e=0;e<6;e++)o.data[e][8]=a(e);for(let e=6;e<8;e++)o.data[e+1][8]=a(e);for(let e=8;e<15;e++)o.data[i-15+e][8]=a(e);for(let e=0;e<8;e++)o.data[8][i-e-1]=a(e);for(let e=8;e<9;e++)o.data[8][15-e-1+1]=a(e);for(let e=9;e<15;e++)o.data[8][15-e-1]=a(e);o.data[i-8][8]=!r}if(e>=7){let t=ui.versionBits(e);for(let e=0;e<18;e+=1){let n=!r&&1==(t>>e&1),a=Math.floor(e/3),s=e%3+i-8-3;o.data[a][s]=n,o.data[s][a]=n}}return o}(e,t,r,i),a=0,s=8*n.length;if(function(e,t,n){let r=e.height,i=uo[t],o=-1,a=r-1;for(let t=r-1;t>0;t-=2){for(6==t&&(t=5);;a+=o){for(let r=0;r<2;r+=1){let o=t-r;void 0===e.data[a][o]&&n(o,a,i(o,a))}if(a+o<0||a+o>=r)break}o=-o}}(o,r,(e,t,r)=>{let i=!1;a<s&&(i=0!=(n[a>>>3]>>(7-a&7)&1),a++),o.data[t][e]=i!==r}),a!==s)throw Error("QR: bytes left after draw");return o}function uc(e,t="raw",n={}){let r=void 0!==n.ecc?n.ecc:"medium";!function(e){if(!d7.includes(e))throw Error(`Invalid error correction mode=${e}. Expected: ${d7}`)}(r);let i=void 0!==n.encoding?n.encoding:function(e){let t="numeric";for(let n of e)if(!ui.alphabet.numeric.has(n)&&(t="alphanumeric",!ui.alphabet.alphanumerc.has(n)))return"byte";return t}(e);!function(e){if(!ue.includes(e))throw Error(`Encoding: invalid mode=${e}. Expected: ${ue}`);if("kanji"===e||"eci"===e)throw Error(`Encoding: ${e} is not supported (yet?).`)}(i),void 0!==n.mask&&function(e){if(![0,1,2,3,4,5,6,7].includes(e)||!uo[e])throw Error(`Invalid mask=${e}. Expected number [0..7]`)}(n.mask);let o,a=n.version,s=Error("Unknown error");if(void 0!==a)!function(e){if(!Number.isSafeInteger(e)||e<1||e>40)throw Error(`Invalid version=${e}. Expected number [1..40]`)}(a),o=us(a,r,e,i);else for(let t=1;t<=40;t++)try{o=us(t,r,e,i),a=t;break}catch(e){s=e}if(!a||!o)throw s;let l=function(e,t,n,r){if(void 0===r){let i,o;let a=(o=1/0,{add(e,t){e>=o||(i=t,o=e)},get:()=>i,score:()=>o});for(let r=0;r<uo.length;r++)a.add(function(e){let t=e.inverse(),n=e=>{let t=0;for(let n,r=0,i=1;r<e.length;r++)n===e[r]&&(i++,r!==e.length-1)||(i>=5&&(t+=i-5+3),n=e[r],i=1);return t},r=0;e.data.forEach(e=>r+=n(e)),t.data.forEach(e=>r+=n(e));let i=0,o=e.data,a=e.width-1,s=e.height-1;for(let e=0;e<a;e++)for(let t=0;t<s;t++){let n=e+1,r=t+1;o[e][t]===o[n][t]&&o[n][t]===o[e][r]&&o[n][t]===o[n][r]&&(i+=3)}let l=e=>{let t=[!0,!1,!0,!0,!0,!1,!0],n=[!1,!1,!1,!1],r=[...t,...n],i=[...n,...t],o=0;for(let t=0;t<e.length;t++)d6(e,r,t)&&(o+=40),d6(e,i,t)&&(o+=40);return o},c=0;for(let t of e.data)c+=l(t);for(let e of t.data)c+=l(e);let d=0;e.rectRead(0,1/0,(e,t)=>d+=t?1:0);let u=d/(e.height*e.width)*100;return r+i+c+10*Math.floor(Math.abs(u-50)/5)}(ul(e,t,n,r,!0)),r);r=a.get()}if(void 0===r)throw Error("Cannot find mask");return ul(e,t,n,r)}(a,r,o,n.mask);l.assertDrawn();let c=void 0===n.border?2:n.border;if(!Number.isSafeInteger(c))throw Error("Wrong border type="+typeof c);if(l=l.border(c,!1),void 0!==n.scale&&(l=l.scale(n.scale)),"raw"===t)return l.data;if("ascii"===t)return l.toASCII();if("svg"===t)return l.toSVG();if("gif"===t)return l.toGIF();if("term"===t)return l.toTerm();throw Error(`Unknown output: ${t}`)}let ud={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}};class uu{constructor(e){var t;this.translations=ud,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=null!==(t=null==e?void 0:e.baseUrl)&&void 0!==t?t:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(e=>e.toLowerCase().startsWith("en")))return"en";let e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){let t=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(t)}async loadTranslations(e){let t=e.split("-")[0];if("en"!==t&&this.supportedLocales.includes(t))try{let e=`${this.baseUrl}/${t}.json`,n=await fetch(e);if(!n.ok)throw Error(`HTTP error! status: ${n.status}`);this.translations=await n.json()}catch(e){console.warn(`â Failed to load ${t} translations, falling back to English:`,e),this.translations=ud}else this.translations=ud}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,t){let n=e.split("."),r=t;for(let e of n){if("object"!=typeof r)return"";r=r[e]}return"string"==typeof r?r:""}}(r=i||(i={})).SDK_MODAL_VIEWED="sdk_modal_viewed",r.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",r.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed";let uh=class{constructor(e){cO(this,e),this.close=dl(this,"close",7),this.startDesktopOnboarding=dl(this,"startDesktopOnboarding",7),this.trackAnalytics=dl(this,"trackA
6nalytics",7),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.setTab=this.setTab.bind(this),this.render=this.render.bind(this),this.setTab(this.preferDesktop?1:2),this.i18nInstance=new uu}componentDidLoad(){this.trackAnalytics.emit({event:i.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:1===this.tab?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}onClose(e=!1){this.close.emit({shouldTerminate:e})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:i.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(e,t=!1){t&&this.trackAnalytics.emit({event:i.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:1===this.tab?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=e,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;let e=e=>this.i18nInstance.t(e),t=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=uc(this.link,"svg",{ecc:"medium",scale:2});return de(dV,{className:"install-model"},de("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),de("div",{class:"modal"},de("div",{class:"closeButtonContainer"},de("div",{class:"right"},de("span",{class:"closeButton",onClick:()=>this.onClose(!0)},de(d0,null)))),de("div",{class:"logoContainer"},de(d1,null)),de("div",null,de("div",{class:"tabcontainer"},de("div",{class:"flexContainer"},de("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(1===t?"tabactive":"")},e("DESKTOP")),de("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(2===t?"tabactive":"")},e("MOBILE")))),de("div",{style:{display:1===t?"none":"block"}},de("div",{class:"flexContainer"},de("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&de("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),de("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT")," ",de("br",null),de("span",{class:"blue"},de("b",null,e("META_MASK_MOBILE_APP"))))))),de("div",{style:{display:2===t?"none":"block"}},de("div",{class:"item"},de(dG,{Icon:dZ,text:e("INSTALL_MODAL.TRUSTED_BY_USERS")})),de("div",{class:"item"},de(dG,{Icon:dY,text:e("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),de("div",{class:"item"},de(dG,{Icon:dJ,text:e("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),de("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},de(dX,null),de("span",{class:"installExtensionText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),de(dQ,{version:this.sdkVersion})))}get el(){return ds(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};uh.style=
vendor: 3,083 bytes, line 6
6".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";
6let uf=class{constructor(e){cO(this,e),this.close=dl(this,"close",7),this.disconnect=dl(this,"disconnect",7),this.updateOTPValue=dl(this,"updateOTPValue",7),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new uu}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(e){this.updateOTPValue.emit({otpValue:e})}disconnectedCallback(){this.onClose()}render(){var e;if(!this.translationsLoaded)return null;let t=null===(e=this.displayOTP)||void 0===e||e,n=this.sdkVersion,r=e=>this.i18nInstance.t(e);return de(dV,{className:"pending-modal"},de("div",{class:"backdrop",onClick:()=>this.onClose()}),de("div",{class:"modal"},de("div",{class:"closeButtonContainer"},de("div",{class:"right"},de("span",{class:"closeButton",onClick:()=>this.onClose()},de(d0,null)))),de("div",{class:"logoContainer"},de(d1,null)),de("div",null,de("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},de("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(t?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),de("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&de("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),de("div",{style:{marginTop:"20px"}},de("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),de(dQ,{version:n})))}get el(){return ds(this)}};uf.style=
vendor: 3,083 bytes, line 6
6".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";
6let up=()=>de("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("path",{d:"M14.1364 14.9851C13.5909 14.9851 13.2273 14.5851 13.2273 13.9851C13.2273 13.3851 13.5909 12.9851 14.1364 12.9851C16.6818 12.9851 18.6818 10.7851 18.6818 7.98508C18.6818 5.18508 16.6818 2.98508 14.1364 2.98508C11.5909 2.98508 9.59091 5.18508 9.59091 7.98508C9.59091 8.58508 9.22727 8.98508 8.68182 8.98508C8.13636 8.98508 7.77273 8.58508 7.77273 7.98508C7.77273 4.08508 10.5909 0.985077 14.1364 0.985077C17.6818 0.985077 20.5 4.08508 20.5 7.98508C20.5 11.8851 17.6818 14.9851 14.1364 14.9851ZM6.68182 14.7851C3.22727 14.7851 0.5 11.6851 0.5 7.98508C0.5 4.28508 3.22727 1.18508 6.68182 1.18508C7.22727 1.18508 7.59091 1.58508 7.59091 2.18508C7.59091 2.78508 7.22727 3.18508 6.68182 3.18508C4.22727 3.18508 2.31818 5.38508 2.31818 7.98508C2.31818 10.5851 4.22727 12.7851 6.68182 12.7851C9.13636 12.7851 11.0455 10.6851 11.0455 7.98508C11.0455 7.38508 11.4091 6.98508 11.9545 6.98508C12.5 6.98508 12.8636 7.38508 12.8636 7.98508C12.7727 11.6851 10.0455 14.7851 6.68182 14.7851Z",fill:"white"})),ug=()=>de("svg",{width:"400",height:"300",viewBox:"0 0 400 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},de("rect",{width:"400",height:"300",fill:"white"}),de("path",{d:"M300.116 242.46L250.485 227.681L213.057 250.055L186.944 250.045L149.493 227.681L99.8843 242.46L84.7939 191.518L99.8843 134.979L84.7939 87.1777L99.8843 27.9336L177.402 74.2466H222.598L300.116 27.9336L315.206 87.1777L300.116 134.979L315.206 191.518L300.116 242.46Z",fill:"#FF5C16"}),de("path",{d:"M99.8955 27.9336L177.414 74.2792L174.331 106.085L99.8955 27.9336Z",fill:"#FF5C16"}),de("path",{d:"M149.505 191.539L183.612 217.521L149.505 227.681V191.539Z",fill:"#FF5C16"}),de("path",{d:"M180.886 148.585L174.33 106.107L132.369 134.991L132.348 134.98V135.001L132.477 164.732L149.493 148.585H149.504H180.886Z",fill:"#FF5C16"}),de("path",{d:"M300.116 27.9336L222.598 74.2792L225.67 106.085L300.116 27.9336Z",fill:"#FF5C16"}),de("path",{d:"M250.508 191.539L216.4 217.521L250.508 227.681V191.539Z",fill:"#FF5C16"}),de("path",{d:"M267.652 135.001H267.663H267.652V134.98L267.641 134.991L225.68 106.107L219.125 148.585H250.507L267.533 164.732L267.652 135.001Z",fill:"#FF5C16"}),de("path",{d:"M149.493 227.681L99.8843 242.46L84.7939 191.54H149.493V227.681Z",fill:"#E34807"}),de("path",{d:"M180.875 148.574L190.351 209.98L177.219 175.838L132.456 164.732L149.483 148.574H180.864H180.875Z",fill:"#E34807"}),de("path",{d:"M250.507 227.681L300.116 242.46L315.206 191.54H250.507V227.681Z",fill:"#E34807"}),de("path",{d:"M219.126 148.574L209.649 209.98L222.782 175.838L267.545 164.732L250.507 148.574H219.126Z",fill:"#E34807"}),de("path",{d:"M84.7939 191.517L99.8843 134.979H132.337L132.456 164.721L177.219 175.826L190.351 209.969L183.601 217.488L149.493 191.506H84.7939V191.517Z",fill:"#FF8D5D"}),de("path",{d:"M315.206 191.517L300.116 134.979H267.664L267.545 164.721L222.782 175.826L209.649 209.969L216.4 217.488L250.507 191.506H315.206V191.517Z",fill:"#FF8D5D"}),de("path",{d:"M222.598 74.2466H200H177.402L174.33 106.053L190.351 209.936H209.649L225.681 106.053L222.598 74.2466Z",fill:"#FF8D5D"}),de("path",{d:"M99.8843 27.9336L84.7939 87.1777L99.8843 134.979H132.337L174.319 106.085L99.8843 27.9336Z",fill:"#661800"}),de("path",{d:"M171.496 160.906H156.795L148.79 168.752L177.229 175.804L171.496 160.896V160.906Z",fill:"#661800"}),de("path",{d:"M300.116 27.9336L315.206 87.1777L300.116 134.979H267.663L225.681 106.085L300.116 27.9336Z",fill:"#661800"}),de("path",{d:"M228.525 160.906H243.248L251.253 168.763L222.781 175.826L228.525 160.896V160.906Z",fill:"#661800"}),de("path",{d:"M213.046 229.789L216.399 217.51L209.649 209.991H190.34L183.59 217.51L186.943 229.789",fill:"#661800"}),de("path",{d:"M213.047 229.789V250.066H186.944V229.789H213.047Z",fill:"#C0C4CD"}),de("path",{d:"M149.504 227.66L186.965 250.056V229.779L183.611 217.5L149.504 227.66Z",fill:"#E7EBF6"}),de("path",{d:"M250.506 227.66L213.045 250.056V229.779L216.398 217.5L250.506 227.66Z",fill:"#E7EBF6"})),um=class{constructor(e){cO(this,e),this.close=dl(this,"close",7),this.connectWithExtension=dl(this,"connectWithExtension",7),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new uu,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(e=!1){this.close.emit({shouldTerminate:e})}
6connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(e){this.tab=e,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;let e=e=>this.i18nInstance.t(e),t=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=uc(this.link,"svg",{ecc:"medium",scale:2});return de(dV,{className:"select-modal"},de("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),de("div",{class:"modal"},de("div",{class:"closeButtonContainer"},de("div",{class:"right"},de("span",{class:"closeButton",onClick:()=>this.onClose(!0)},de(d0,null)))),de("div",{class:"logoContainer"},de(d1,null)),de("div",null,de("div",{class:"tabcontainer"},de("div",{class:"flexContainer"},de("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(1===n?"tabactive":"")},e("DESKTOP")),de("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(2===n?"tabactive":"")},e("MOBILE")))),de("div",{style:{display:1===n?"none":"block"}},de("div",{class:"flexContainer"},de("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},de("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),de("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT"),de("br",null),de("span",{class:"blue"},de("b",null,e("META_MASK_MOBILE_APP"))))))),de("div",{style:{display:2===n?"none":"block"}},de("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},de(ug,null)),de("div",{class:"extensionLabel"},e("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),de("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},de(up,null),de("span",{class:"installExtensionText"},e("CONNECT_WITH_EXTENSION"))))),de(dQ,{version:t})))}get el(){return ds(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};um.style=
vendor: 3,083 bytes, line 6
6".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";
6var uy=Object.freeze({__proto__:null,mm_install_modal:uh,mm_pending_modal:uf,mm_select_modal:um})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.