@reown/appkit-cdn 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/appkit.js CHANGED
@@ -7,7 +7,7 @@ read:function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,l=c>>1,u=-7,d=r?i-1:0,h=r?
7
7
  * @author Feross Aboukhadijeh <https://feross.org>
8
8
  * @license MIT
9
9
  */
10
- !function(e){const t=base64Js,r=ieee754,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i;const{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:a}=globalThis;function c(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new o(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=c(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(s.isView(e))return function(e){if(J(e,o)){const t=new o(e);return f(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,s)||e&&J(e.buffer,s))return f(e,t,r);if(void 0!==a&&(J(e,a)||e&&J(e.buffer,a)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);const i=function(e){if(l.isBuffer(e)){const t=0|m(e.length),r=c(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Q(e.length)?c(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return d(e),c(e<0?0:0|m(e))}function p(e){const t=e.length<0?0:0|m(e.length),r=c(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new o(e):void 0===r?new o(e,t):new o(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(s.isView(e)||J(e,s))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function b(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof o.prototype.indexOf?i?o.prototype.indexOf.call(e,t,r):o.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(l(e,o+n)!==l(t,n)){r=!1;break}if(r)return o}return-1}function _(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Q(n))return s;e[r+s]=n}return s}function $(e,t,r,n){return Z(K(t,e.length-r),e,r,n)}function C(e,t,r,n){return Z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return Z(G(t),e,r,n)}function S(e,t,r,n){return Z(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function x(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function A(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e2){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,o.prototype),Object.setPrototypeOf(l,o),l.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?c(e):void 0!==t?"string"==typeof r?c(e).fill(t,r):c(e).fill(t):c(e)}(e,t,r)},l.allocUnsafe=function(e){return h(e)},l.allocUnsafeSlow=function(e){return h(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(J(e,o)&&(e=l.from(e,e.offset,e.byteLength)),J(t,o)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=l.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,o))i+t.length>n.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(n,i)):o.prototype.set.call(n,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):b.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(J(e,o)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),d=e.slice(t,r);for(let o=0;o<c;++o)if(u[o]!==d[o]){s=u[o],a=d[o];break}return s<a?-1:a<s?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return $(this,e,t,r);case"ascii":case"latin1":case"binary":return C(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function T(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=t;o<r;++o)i+=Y[e[o]];return i}function P(e,t,r){const n=e.slice(t,r);let i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function N(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){z(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function O(e,t,r,n,i){z(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,n,i,o){return t=+t,n>>>=0,o||L(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function D(e,t,n,i,o){return t=+t,n>>>=0,o||L(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const r=this.length;(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);const n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),l.prototype.readBigUInt64BE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=X((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=X((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=X((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=X((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof o.prototype.copyWithin?this.copyWithin(t,r,n):o.prototype.set.call(e,this.subarray(r,n),t),i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=l.isBuffer(e)?e:l.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const W={};function j(e,t,r){W[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function F(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function z(e,t,r,n,i,o){if(e>r||e<t){const r="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new W.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!=typeof e)throw new W.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new W.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function K(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}}(buffer$3);const Buffer$7=buffer$3.Buffer,Blob$2=buffer$3.Blob,BlobOptions=buffer$3.BlobOptions,Buffer$1$1=buffer$3.Buffer,File=buffer$3.File,FileOptions=buffer$3.FileOptions,INSPECT_MAX_BYTES=buffer$3.INSPECT_MAX_BYTES,SlowBuffer=buffer$3.SlowBuffer,TranscodeEncoding=buffer$3.TranscodeEncoding,atob$1=buffer$3.atob,btoa$1=buffer$3.btoa,constants$9=buffer$3.constants,isAscii=buffer$3.isAscii,isUtf8=buffer$3.isUtf8,kMaxLength=buffer$3.kMaxLength,kStringMaxLength=buffer$3.kStringMaxLength,resolveObjectURL=buffer$3.resolveObjectURL,transcode=buffer$3.transcode,dist$7=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$2,BlobOptions:BlobOptions,Buffer:Buffer$1$1,File:File,FileOptions:FileOptions,INSPECT_MAX_BYTES:INSPECT_MAX_BYTES,SlowBuffer:SlowBuffer,TranscodeEncoding:TranscodeEncoding,atob:atob$1,btoa:btoa$1,constants:constants$9,default:Buffer$7,isAscii:isAscii,isUtf8:isUtf8,kMaxLength:kMaxLength,kStringMaxLength:kStringMaxLength,resolveObjectURL:resolveObjectURL,transcode:transcode},Symbol.toStringTag,{value:"Module"}));"undefined"!=typeof window&&(window.Buffer||(window.Buffer=Buffer$1$1),window.global||(window.global=window),window.process||(window.process={}),(null==(_a2=window.process)?void 0:_a2.env)||(window.process={env:{}}));const t$6=Symbol(),s$5=Object.getPrototypeOf,c$8=new WeakMap,l$6=e=>e&&(c$8.has(e)?c$8.get(e):s$5(e)===Object.prototype||s$5(e)===Array.prototype),y$7=e=>l$6(e)&&e[t$6]||null,h$8=(e,t=!0)=>{c$8.set(e,t)};var define_import_meta_env_default$3={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const isObject$3=e=>"object"==typeof e&&null!==e,proxyStateMap$1=new WeakMap,refSet$1=new WeakSet,buildProxyFunction$1=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject$3(e)&&!refSet$1.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},i=new WeakMap,o=(e,t,r=n)=>{const s=i.get(e);if((null==s?void 0:s[0])===t)return s[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$8(a,!0),i.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const n=Reflect.get(e,t),i={value:n,enumerable:!0,configurable:!0};if(refSet$1.has(n))h$8(n,!1);else if(n instanceof Promise)delete i.value,i.get=()=>r(n);else if(proxyStateMap$1.has(n)){const[e,t]=proxyStateMap$1.get(n);i.value=o(e,t(),r)}Object.defineProperty(a,t,i)})),Object.preventExtensions(a)},s=new WeakMap,a=[1,1],c=n=>{if(!isObject$3(n))throw new Error("object required");const i=s.get(n);if(i)return i;let l=a[0];const u=new Set,d=(e,t=++a[0])=>{l!==t&&(l=t,u.forEach((r=>r(e,t))))};let h=a[1];const p=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},f=new Map,m=e=>{var t;const r=f.get(e);r&&(f.delete(e),null==(t=r[1])||t.call(r))},g=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),b=t(g,{deleteProperty(e,t){const r=Reflect.get(e,t);m(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,i,o){const a=Reflect.has(t,n),l=Reflect.get(t,n,o);if(a&&(e(l,i)||s.has(i)&&e(l,s.get(i))))return!0;m(n),isObject$3(i)&&(i=y$7(i)||i);let h=i;if(i instanceof Promise)i.then((e=>{i.status="fulfilled",i.value=e,d(["resolve",[n],e])})).catch((e=>{i.status="rejected",i.reason=e,d(["reject",[n],e])}));else{!proxyStateMap$1.has(i)&&r(i)&&(h=c(i));const e=!refSet$1.has(h)&&proxyStateMap$1.get(h);e&&((e,t)=>{if("production"!==(define_import_meta_env_default$3?"production":void 0)&&f.has(e))throw new Error("prop listener already exists");if(u.size){const r=t[3](p(e));f.set(e,[t,r])}else f.set(e,[t])})(n,e)}return Reflect.set(t,n,h,o),d(["set",[n],i,l]),!0}});s.set(n,b);const y=[g,(e=++a[1])=>(h===e||u.size||(h=e,f.forEach((([t])=>{const r=t[1](e);r>l&&(l=r)}))),l),o,e=>{u.add(e),1===u.size&&f.forEach((([e,t],r)=>{if("production"!==(define_import_meta_env_default$3?"production":void 0)&&t)throw new Error("remove already exists");const n=e[3](p(r));f.set(r,[e,n])}));return()=>{u.delete(e),0===u.size&&f.forEach((([e,t],r)=>{t&&(t(),f.set(r,[e]))}))}}];return proxyStateMap$1.set(b,y),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(b[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(g,e,t)})),b})=>[c,proxyStateMap$1,refSet$1,e,t,r,n,i,o,s,a],[defaultProxyFunction$1]=buildProxyFunction$1();function proxy$1(e={}){return defaultProxyFunction$1(e)}function subscribe$1(e,t,r){const n=proxyStateMap$1.get(e);let i;"production"===(define_import_meta_env_default$3?"production":void 0)||n||console.warn("Please use proxy object");const o=[],s=n[3];let a=!1;const c=s((e=>{o.push(e),i||(i=Promise.resolve().then((()=>{i=void 0,a&&t(o.splice(0))})))}));return a=!0,()=>{a=!1,c()}}function snapshot(e,t){const r=proxyStateMap$1.get(e);"production"===(define_import_meta_env_default$3?"production":void 0)||r||console.warn("Please use proxy object");const[n,i,o]=r;return o(n,i(),t)}function ref$2(e){return refSet$1.add(e),e}function subscribeKey$1(e,t,r,n){let i=e[t];return subscribe$1(e,(()=>{const n=e[t];Object.is(i,n)||r(i=n)}))}function proxyMap(e){const t=proxy$1({data:Array.from([]),has(e){return this.data.some((t=>t[0]===e))},set(e,t){const r=this.data.find((t=>t[0]===e));return r?r[1]=t:this.data.push([e,t]),this},get(e){var t;return null==(t=this.data.find((t=>t[0]===e)))?void 0:t[1]},delete(e){const t=this.data.findIndex((t=>t[0]===e));return-1!==t&&(this.data.splice(t,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(e){this.data.forEach((t=>{e(t[1],t[0],this)}))},keys(){return this.data.map((e=>e[0])).values()},values(){return this.data.map((e=>e[1])).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs$2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var dayjs_min={exports:{}},module2;module2=dayjs_min,module2.exports=function(){var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",s="hour",a="day",c="week",l="month",u="quarter",d="year",h="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},b=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},y={s:b,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+b(n,2,"0")+":"+b(i,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),i=t.clone().add(n,l),o=r-i<0,s=t.clone().add(n+(o?-1:1),l);return+(-(n+(r-i)/(o?i-s:s-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:a,D:h,h:s,m:o,s:i,ms:n,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},w="en",v={};v[w]=g;var _="$isDayjsObject",$=function(e){return e instanceof x||!(!e||!e[_])},C=function e(t,r,n){var i;if(!t)return w;if("string"==typeof t){var o=t.toLowerCase();v[o]&&(i=o),r&&(v[o]=r,i=o);var s=t.split("-");if(!i&&s.length>1)return e(s[0])}else{var a=t.name;v[a]=t,i=a}return!n&&i&&(w=i),i||!n&&w},E=function(e,t){if($(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new x(r)},S=y;S.l=C,S.i=$,S.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var x=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[_]=!0}var b=g.prototype;return b.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(S.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(f);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.init()},b.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},b.$utils=function(){return S},b.isValid=function(){return!(this.$d.toString()===p)},b.isSame=function(e,t){var r=E(e);return this.startOf(t)<=r&&r<=this.endOf(t)},b.isAfter=function(e,t){return E(e)<this.startOf(t)},b.isBefore=function(e,t){return this.endOf(t)<E(e)},b.$g=function(e,t,r){return S.u(e)?this[t]:this.set(r,e)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(e,t){var r=this,n=!!S.u(t)||t,u=S.p(e),p=function(e,t){var i=S.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return n?i:i.endOf(a)},f=function(e,t){return S.w(r.toDate()[e].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},m=this.$W,g=this.$M,b=this.$D,y="set"+(this.$u?"UTC":"");switch(u){case d:return n?p(1,0):p(31,11);case l:return n?p(1,g):p(0,g+1);case c:var w=this.$locale().weekStart||0,v=(m<w?m+7:m)-w;return p(n?b-v:b+(6-v),g);case a:case h:return f(y+"Hours",0);case s:return f(y+"Minutes",1);case o:return f(y+"Seconds",2);case i:return f(y+"Milliseconds",3);default:return this.clone()}},b.endOf=function(e){return this.startOf(e,!1)},b.$set=function(e,t){var r,c=S.p(e),u="set"+(this.$u?"UTC":""),p=(r={},r[a]=u+"Date",r[h]=u+"Date",r[l]=u+"Month",r[d]=u+"FullYear",r[s]=u+"Hours",r[o]=u+"Minutes",r[i]=u+"Seconds",r[n]=u+"Milliseconds",r)[c],f=c===a?this.$D+(t-this.$W):t;if(c===l||c===d){var m=this.clone().set(h,1);m.$d[p](f),m.init(),this.$d=m.set(h,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},b.set=function(e,t){return this.clone().$set(e,t)},b.get=function(e){return this[S.p(e)]()},b.add=function(n,u){var h,p=this;n=Number(n);var f=S.p(u),m=function(e){var t=E(p);return S.w(t.date(t.date()+Math.round(e*n)),p)};if(f===l)return this.set(l,this.$M+n);if(f===d)return this.set(d,this.$y+n);if(f===a)return m(1);if(f===c)return m(7);var g=(h={},h[o]=t,h[s]=r,h[i]=e,h)[f]||1,b=this.$d.getTime()+n*g;return S.w(b,this)},b.subtract=function(e,t){return this.add(-1*e,t)},b.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||p;var n=e||"YYYY-MM-DDTHH:mm:ssZ",i=S.z(this),o=this.$H,s=this.$m,a=this.$M,c=r.weekdays,l=r.months,u=r.meridiem,d=function(e,r,i,o){return e&&(e[r]||e(t,n))||i[r].slice(0,o)},h=function(e){return S.s(o%12||12,e,"0")},f=u||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(m,(function(e,n){return n||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return S.s(t.$y,4,"0");case"M":return a+1;case"MM":return S.s(a+1,2,"0");case"MMM":return d(r.monthsShort,a,l,3);case"MMMM":return d(l,a);case"D":return t.$D;case"DD":return S.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(r.weekdaysMin,t.$W,c,2);case"ddd":return d(r.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(o);case"HH":return S.s(o,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return f(o,s,!0);case"A":return f(o,s,!1);case"m":return String(s);case"mm":return S.s(s,2,"0");case"s":return String(t.$s);case"ss":return S.s(t.$s,2,"0");case"SSS":return S.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")}))},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(n,h,p){var f,m=this,g=S.p(h),b=E(n),y=(b.utcOffset()-this.utcOffset())*t,w=this-b,v=function(){return S.m(m,b)};switch(g){case d:f=v()/12;break;case l:f=v();break;case u:f=v()/3;break;case c:f=(w-y)/6048e5;break;case a:f=(w-y)/864e5;break;case s:f=w/r;break;case o:f=w/t;break;case i:f=w/e;break;default:f=w}return p?f:S.a(f)},b.daysInMonth=function(){return this.endOf(l).$D},b.$locale=function(){return v[this.$L]},b.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=C(e,t,!0);return n&&(r.$L=n),r},b.clone=function(){return S.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},g}(),A=x.prototype;return E.prototype=A,[["$ms",n],["$s",i],["$m",o],["$H",s],["$W",a],["$M",l],["$y",d],["$D",h]].forEach((function(e){A[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),E.extend=function(e,t){return e.$i||(e(t,x,E),e.$i=!0),E},E.locale=C,E.isDayjs=$,E.unix=function(e){return E(1e3*e)},E.en=v[w],E.Ls=v,E.p={},E}();var dayjs_minExports=dayjs_min.exports;const dayjs=getDefaultExportFromCjs$2(dayjs_minExports);var en$2={exports:{}};!function(e,t){e.exports={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}}}(en$2);var enExports=en$2.exports;const englishLocale=getDefaultExportFromCjs$2(enExports);var relativeTime$1={exports:{}};!function(e,t){e.exports=function(e,t,r){e=e||{};var n=t.prototype,i={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function o(e,t,r,i){return n.fromToBase(e,t,r,i)}r.en.relativeTime=i,n.fromToBase=function(t,n,o,s,a){for(var c,l,u,d=o.$locale().relativeTime||i,h=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],p=h.length,f=0;f<p;f+=1){var m=h[f];m.d&&(c=s?r(t).diff(o,m.d,!0):o.diff(t,m.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=m.r||!m.r){g<=1&&f>0&&(m=h[f-1]);var b=d[m.l];a&&(g=a(""+g)),l="string"==typeof b?b.replace("%d",g):b(g,n,m.l,u);break}}if(n)return l;var y=u?d.future:d.past;return"function"==typeof y?y(l):y.replace("%s",l)},n.to=function(e,t){return o(e,t,this,!0)},n.from=function(e,t){return o(e,t,this)};var s=function(e){return e.$u?r.utc():r()};n.toNow=function(e){return this.to(s(this),e)},n.fromNow=function(e){return this.from(s(this),e)}}}(relativeTime$1);var relativeTimeExports=relativeTime$1.exports;const relativeTime=getDefaultExportFromCjs$2(relativeTimeExports);var updateLocale$1={exports:{}};!function(e,t){e.exports=function(e,t,r){r.updateLocale=function(e,t){var n=r.Ls[e];if(n)return(t?Object.keys(t):[]).forEach((function(e){n[e]=t[e]})),n}}}(updateLocale$1);var updateLocaleExports=updateLocale$1.exports;const updateLocale=getDefaultExportFromCjs$2(updateLocaleExports);dayjs.extend(relativeTime),dayjs.extend(updateLocale);const localeObject={...englishLocale,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}};dayjs.locale("en-web3-modal",localeObject);const DateUtil={getYear:(e=(new Date).toISOString())=>dayjs(e).year(),getRelativeDateFromNow:e=>dayjs(e).locale("en-web3-modal").fromNow(!0),formatDate:(e,t="DD MMM")=>dayjs(e).format(t)},NetworkUtil={caipNetworkIdToNumber:e=>e?Number(e.split(":")[1]):void 0,parseEvmChainId(e){return"string"==typeof e?this.caipNetworkIdToNumber(e):e}};var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$2=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX$1=1e9;function clone(e){var t,r,n,i,o,s=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),c=20,l=4,u=-7,d=21,h=-1e7,p=1e7,f=!1,m=1,g=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},y="0123456789abcdefghijklmnopqrstuvwxyz",w=!0;function v(e,t){var i,o,s,a,u,d,f,m,g=this;if(!(g instanceof v))return new v(e,t);if(null==t){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>p?g.c=g.e=null:e.e<h?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((d="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,u=e;u>=10;u/=10,a++);return void(a>p?g.c=g.e=null:(g.e=a,g.c=[e]))}m=String(e)}else{if(!isNumeric.test(m=String(e)))return n(g,m,d);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(a=m.indexOf("."))>-1&&(m=m.replace(".","")),(u=m.search(/e/i))>0?(a<0&&(a=u),a+=+m.slice(u+1),m=m.substring(0,u)):a<0&&(a=m.length)}else{if(intCheck(t,2,y.length,"Base"),10==t&&w)return E(g=new v(e),c+g.e+1,l);if(m=String(e),d="number"==typeof e){if(0*e!=0)return n(g,m,d,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,v.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(i=y.slice(0,t),a=u=0,f=m.length;u<f;u++)if(i.indexOf(o=m.charAt(u))<0){if("."==o){if(u>a){a=f;continue}}else if(!s&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){s=!0,u=-1,a=0;continue}return n(g,String(e),d,t)}d=!1,(a=(m=r(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):a=m.length}for(u=0;48===m.charCodeAt(u);u++);for(f=m.length;48===m.charCodeAt(--f););if(m=m.slice(u,++f)){if(f-=u,d&&v.DEBUG&&f>15&&(e>MAX_SAFE_INTEGER$2||e!==mathfloor(e)))throw Error(tooManyDigits+g.s*e);if((a=a-u-1)>p)g.c=g.e=null;else if(a<h)g.c=[g.e=0];else{if(g.e=a,g.c=[],u=(a+1)%LOG_BASE,a<0&&(u+=LOG_BASE),u<f){for(u&&g.c.push(+m.slice(0,u)),f-=LOG_BASE;u<f;)g.c.push(+m.slice(u,u+=LOG_BASE));u=LOG_BASE-(m=m.slice(u)).length}else u-=f;for(;u--;m+="0");g.c.push(+m)}}else g.c=[g.e=0]}function _(e,t,r,n){var i,o,s,a,c;if(null==r?r=l:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)c=coeffToString(e.c),c=1==n||2==n&&(s<=u||s>=d)?toExponential(c,s):toFixedPoint(c,s,"0");else if(o=(e=E(new v(e),t,r)).e,a=(c=coeffToString(e.c)).length,1==n||2==n&&(t<=o||o<=u)){for(;a<t;c+="0",a++);c=toExponential(c,o)}else if(t-=s,c=toFixedPoint(c,o,"0"),o+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function $(e,t){for(var r,n,i=1,o=new v(e[0]);i<e.length;i++)(!(n=new v(e[i])).s||(r=compare$d(o,n))===t||0===r&&o.s===t)&&(o=n);return o}function C(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*LOG_BASE-1)>p?e.c=e.e=null:r<h?e.c=[e.e=0]:(e.e=r,e.c=t),e}function E(e,t,r,n){var i,o,s,a,c,l,u,d=e.c,f=POWS_TEN;if(d){e:{for(i=1,a=d[0];a>=10;a/=10,i++);if((o=t-i)<0)o+=LOG_BASE,s=t,c=d[l=0],u=mathfloor(c/f[i-s-1]%10);else if((l=mathceil((o+1)/LOG_BASE))>=d.length){if(!n)break e;for(;d.length<=l;d.push(0));c=u=0,i=1,s=(o%=LOG_BASE)-LOG_BASE+1}else{for(c=a=d[l],i=1;a>=10;a/=10,i++);u=(s=(o%=LOG_BASE)-LOG_BASE+i)<0?0:mathfloor(c/f[i-s-1]%10)}if(n=n||t<0||null!=d[l+1]||(s<0?c:c%f[i-s-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(o>0?s>0?c/f[i-s]:0:d[l-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,n?(t-=e.e+1,d[0]=f[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):d[0]=e.e=0,e;if(0==o?(d.length=l,a=1,l--):(d.length=l+1,a=f[LOG_BASE-o],d[l]=s>0?mathfloor(c/f[i-s]%f[s])*a:0),n)for(;;){if(0==l){for(o=1,s=d[0];s>=10;s/=10,o++);for(s=d[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,d[0]==BASE&&(d[0]=1));break}if(d[l]+=a,d[l]!=BASE)break;d[l--]=0,a=1}for(o=d.length;0===d[--o];d.pop());}e.e>p?e.c=e.e=null:e.e<h&&(e.c=[e.e=0])}return e}function S(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=u||r>=d?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return v.clone=clone,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX$1,t),c=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),l=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX$1,0,t),intCheck(r[1],0,MAX$1,t),u=r[0],d=r[1]):(intCheck(r,-MAX$1,MAX$1,t),u=-(d=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX$1,-1,t),intCheck(r[1],1,MAX$1,t),h=r[0],p=r[1];else{if(intCheck(r,-MAX$1,MAX$1,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);h=-(p=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw f=!r,Error(bignumberError+"crypto unavailable");f=r}else f=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),m=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX$1,t),g=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);b=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);w="0123456789"==r.slice(0,10),y=r}}return{DECIMAL_PLACES:c,ROUNDING_MODE:l,EXPONENTIAL_AT:[u,d],RANGE:[h,p],CRYPTO:f,MODULO_MODE:m,POW_PRECISION:g,FORMAT:b,ALPHABET:y}},v.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!v.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX$1&&i<=MAX$1&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=BASE||r!==mathfloor(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},v.maximum=v.max=function(){return $(arguments,-1)},v.minimum=v.min=function(){return $(arguments,1)},v.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,l=0,u=[],d=new v(a);if(null==e?e=c:intCheck(e,0,MAX$1),i=mathceil(e/LOG_BASE),f)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));l<i;)(s=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(u.push(s%1e14),l+=2);l=i/2}else{if(!crypto.randomBytes)throw f=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);l<i;)(s=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(u.push(s%1e14),l+=7);l=i/7}if(!f)for(;l<i;)(s=o())<9e15&&(u[l++]=s%1e14);for(i=u[--l],e%=LOG_BASE,i&&e&&(s=POWS_TEN[LOG_BASE-e],u[l]=mathfloor(i/s)*s);0===u[l];u.pop(),l--);if(l<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=LOG_BASE);for(l=1,s=u[0];s>=10;s/=10,l++);l<LOG_BASE&&(n-=LOG_BASE-l)}return d.e=n,d.c=u,d}),v.sum=function(){for(var e=1,t=arguments,r=new v(t[0]);e<t.length;)r=r.plus(t[e++]);return r},r=function(){var e="0123456789";function r(e,t,r,n){for(var i,o,s=[0],a=0,c=e.length;a<c;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var u,d,h,p,f,m,b,w,_=n.indexOf("."),$=c,C=l;for(_>=0&&(p=g,g=0,n=n.replace(".",""),m=(w=new v(i)).pow(n.length-_),g=p,w.c=r(toFixedPoint(coeffToString(m.c),m.e,"0"),10,o,e),w.e=w.c.length),h=p=(b=r(n,i,o,a?(u=y,e):(u=e,y))).length;0==b[--p];b.pop());if(!b[0])return u.charAt(0);if(_<0?--h:(m.c=b,m.e=h,m.s=s,b=(m=t(m,w,$,C,o)).c,f=m.r,h=m.e),_=b[d=h+$+1],p=o/2,f=f||d<0||null!=b[d+1],f=C<4?(null!=_||f)&&(0==C||C==(m.s<0?3:2)):_>p||_==p&&(4==C||f||6==C&&1&b[d-1]||C==(m.s<0?8:7)),d<1||!b[0])n=f?toFixedPoint(u.charAt(1),-$,u.charAt(0)):u.charAt(0);else{if(b.length=d,f)for(--o;++b[--d]>o;)b[d]=0,d||(++h,b=[1].concat(b));for(p=b.length;!b[--p];);for(_=0,n="";_<=p;n+=u.charAt(b[_++]));n=toFixedPoint(n,h,u.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,l=t%SQRT_BASE,u=t/SQRT_BASE|0;for(e=e.slice();c--;)a=((i=l*(o=e[c]%SQRT_BASE)+(n=u*o+(s=e[c]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+u*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,s,a){var c,l,u,d,h,p,f,m,g,b,y,w,_,$,C,S,x,A=n.s==i.s?1:-1,k=n.c,T=i.c;if(!(k&&k[0]&&T&&T[0]))return new v(n.s&&i.s&&(k?!T||k[0]!=T[0]:T)?k&&0==k[0]||!T?0*A:A/0:NaN);for(g=(m=new v(A)).c=[],A=o+(l=n.e-i.e)+1,a||(a=BASE,l=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),A=A/LOG_BASE|0),u=0;T[u]==(k[u]||0);u++);if(T[u]>(k[u]||0)&&l--,A<0)g.push(1),d=!0;else{for($=k.length,S=T.length,u=0,A+=2,(h=mathfloor(a/(T[0]+1)))>1&&(T=e(T,h,a),k=e(k,h,a),S=T.length,$=k.length),_=S,y=(b=k.slice(0,S)).length;y<S;b[y++]=0);x=T.slice(),x=[0].concat(x),C=T[0],T[1]>=a/2&&C++;do{if(h=0,(c=t(T,b,S,y))<0){if(w=b[0],S!=y&&(w=w*a+(b[1]||0)),(h=mathfloor(w/C))>1)for(h>=a&&(h=a-1),f=(p=e(T,h,a)).length,y=b.length;1==t(p,b,f,y);)h--,r(p,S<f?x:T,f,a),f=p.length,c=1;else 0==h&&(c=h=1),f=(p=T.slice()).length;if(f<y&&(p=[0].concat(p)),r(b,p,y,a),y=b.length,-1==c)for(;t(T,b,S,y)<1;)h++,r(b,S<y?x:T,y,a),y=b.length}else 0===c&&(h++,b=[0]);g[u++]=h,b[0]?b[y++]=k[_]||0:(b=[k[_]],y=1)}while((_++<$||null!=b[0])&&A--);d=null!=b[0],g[0]||g.splice(0,1)}if(a==BASE){for(u=1,A=g[0];A>=10;A/=10,u++);E(m,o+(m.e=u+l*LOG_BASE-1)+1,s,d)}else m.e=l,m.r=+d;return m}}(),n=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,a,c){var l,u=a?s:s.replace(i,"");if(n.test(u))o.s=isNaN(u)?null:u<0?-1:1;else{if(!a&&(u=u.replace(e,(function(e,t,r){return l="x"==(r=r.toLowerCase())?16:"b"==r?2:8,c&&c!=l?e:t})),c&&(l=c,u=u.replace(t,"$1").replace(r,"0.$1")),s!=u))return new v(u,l);if(v.DEBUG)throw Error(bignumberError+"Not a"+(c?" base "+c:"")+" number: "+s);o.s=null}o.c=o.e=null}}(),s.absoluteValue=s.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},s.comparedTo=function(e,t){return compare$d(this,new v(e,t))},s.decimalPlaces=s.dp=function(e,t){var r,n,i,o=this;if(null!=e)return intCheck(e,0,MAX$1),null==t?t=l:intCheck(t,0,8),E(new v(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},s.dividedBy=s.div=function(e,r){return t(this,new v(e,r),c,l)},s.dividedToIntegerBy=s.idiv=function(e,r){return t(this,new v(e,r),0,1)},s.exponentiatedBy=s.pow=function(e,t){var r,n,i,o,s,c,u,d,h=this;if((e=new v(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+S(e));if(null!=t&&(t=new v(t)),s=e.e>14,!h.c||!h.c[0]||1==h.c[0]&&!h.e&&1==h.c.length||!e.c||!e.c[0])return d=new v(Math.pow(+S(h),s?e.s*(2-isOdd(e)):+S(e))),t?d.mod(t):d;if(c=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);(n=!c&&h.isInteger()&&t.isInteger())&&(h=h.mod(t))}else{if(e.e>9&&(h.e>0||h.e<-1||(0==h.e?h.c[0]>1||s&&h.c[1]>=24e7:h.c[0]<8e13||s&&h.c[0]<=9999975e7)))return o=h.s<0&&isOdd(e)?-0:0,h.e>-1&&(o=1/o),new v(c?1/o:o);g&&(o=mathceil(g/LOG_BASE+2))}for(s?(r=new v(.5),c&&(e.s=1),u=isOdd(e)):u=(i=Math.abs(+S(e)))%2,d=new v(a);;){if(u){if(!(d=d.times(h)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;u=i%2}else if(E(e=e.times(r),e.e+1,1),e.e>14)u=isOdd(e);else{if(0===(i=+S(e)))break;u=i%2}h=h.times(h),o?h.c&&h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}return n?d:(c&&(d=a.div(d)),t?d.mod(t):o?E(d,g,l,undefined):d)},s.integerValue=function(e){var t=new v(this);return null==e?e=l:intCheck(e,0,8),E(t,t.e+1,e)},s.isEqualTo=s.eq=function(e,t){return 0===compare$d(this,new v(e,t))},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(e,t){return compare$d(this,new v(e,t))>0},s.isGreaterThanOrEqualTo=s.gte=function(e,t){return 1===(t=compare$d(this,new v(e,t)))||0===t},s.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},s.isLessThan=s.lt=function(e,t){return compare$d(this,new v(e,t))<0},s.isLessThanOrEqualTo=s.lte=function(e,t){return-1===(t=compare$d(this,new v(e,t)))||0===t},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&0==this.c[0]},s.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new v(e,t)).s,!a||!t)return new v(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/LOG_BASE,u=e.e/LOG_BASE,d=s.c,h=e.c;if(!c||!u){if(!d||!h)return d?(e.s=-t,e):new v(h?s:NaN);if(!d[0]||!h[0])return h[0]?(e.s=-t,e):new v(d[0]?s:3==l?-0:0)}if(c=bitFloor(c),u=bitFloor(u),d=d.slice(),a=c-u){for((o=a<0)?(a=-a,i=d):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=d.length)<(t=h.length))?a:t,a=t=0;t<n;t++)if(d[t]!=h[t]){o=d[t]<h[t];break}if(o&&(i=d,d=h,h=i,e.s=-e.s),(t=(n=h.length)-(r=d.length))>0)for(;t--;d[r++]=0);for(t=BASE-1;n>a;){if(d[--n]<h[n]){for(r=n;r&&!d[--r];d[r]=t);--d[r],d[n]+=BASE}d[n]-=h[n]}for(;0==d[0];d.splice(0,1),--u);return d[0]?C(e,d,u):(e.s=3==l?-1:1,e.c=[e.e=0],e)},s.modulo=s.mod=function(e,r){var n,i,o=this;return e=new v(e,r),!o.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||o.c&&!o.c[0]?new v(o):(9==m?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,m),(e=o.minus(n.times(e))).c[0]||1!=m||(e.s=o.s),e)},s.multipliedBy=s.times=function(e,t){var r,n,i,o,s,a,c,l,u,d,h,p,f,m,g,b=this,y=b.c,w=(e=new v(e,t)).c;if(!(y&&w&&y[0]&&w[0]))return!b.s||!e.s||y&&!y[0]&&!w||w&&!w[0]&&!y?e.c=e.e=e.s=null:(e.s*=b.s,y&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(b.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=b.s,(c=y.length)<(d=w.length)&&(f=y,y=w,w=f,i=c,c=d,d=i),i=c+d,f=[];i--;f.push(0));for(m=BASE,g=SQRT_BASE,i=d;--i>=0;){for(r=0,h=w[i]%g,p=w[i]/g|0,o=i+(s=c);o>i;)r=((l=h*(l=y[--s]%g)+(a=p*l+(u=y[s]/g|0)*h)%g*g+f[o]+r)/m|0)+(a/g|0)+p*u,f[o--]=l%m;f[o]=r}return r?++n:f.splice(0,1),C(e,f,n)},s.negated=function(){var e=new v(this);return e.s=-e.s||null,e},s.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new v(e,t)).s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,s=e.e/LOG_BASE,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new v(i/0);if(!a[0]||!c[0])return c[0]?e:new v(a[0]?n:0*i)}if(o=bitFloor(o),s=bitFloor(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/BASE|0,a[t]=BASE===a[t]?0:a[t]%BASE;return i&&(a=[i].concat(a),++s),C(e,a,s)},s.precision=s.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX$1),null==t?t=l:intCheck(t,0,8),E(new v(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*LOG_BASE+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},s.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+e)},s.squareRoot=s.sqrt=function(){var e,r,n,i,o,s=this,a=s.c,u=s.s,d=s.e,h=c+4,p=new v("0.5");if(1!==u||!a||!a[0])return new v(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+S(s)))||u==1/0?(((r=coeffToString(a)).length+d)%2==0&&(r+="0"),u=Math.sqrt(+r),d=bitFloor((d+1)/2)-(d<0||d%2),n=new v(r=u==1/0?"5e"+d:(r=u.toExponential()).slice(0,r.indexOf("e")+1)+d)):n=new v(u+""),n.c[0])for((u=(d=n.e)+h)<3&&(u=0);;)if(o=n,n=p.times(o.plus(t(s,o,h,1))),coeffToString(o.c).slice(0,u)===(r=coeffToString(n.c)).slice(0,u)){if(n.e<d&&--u,"9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(E(n,n.e+c+2,1),e=!n.times(n).eq(s));break}if(!i&&(E(o,o.e+c+2,0),o.times(o).eq(s))){n=o;break}h+=4,u+=4,i=1}return E(n,n.e+c+1,l,e)},s.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX$1),e++),_(this,e,t,1)},s.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX$1),e=e+this.e+1),_(this,e,t)},s.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=b;else if("object"!=typeof r)throw Error(bignumberError+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",u=s[0],d=s[1],h=i.s<0,p=h?u.slice(1):u,f=p.length;if(c&&(o=a,a=c,c=o,f-=o),a>0&&f>0){for(o=f%a||a,u=p.substr(0,o);o<f;o+=a)u+=l+p.substr(o,a);c>0&&(u+=l+p.slice(o)),h&&(u="-"+u)}n=d?u+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):u}return(r.prefix||"")+n+(r.suffix||"")},s.toFraction=function(e){var r,n,i,o,s,c,u,d,h,f,m,g,b=this,y=b.c;if(null!=e&&(!(u=new v(e)).isInteger()&&(u.c||1!==u.s)||u.lt(a)))throw Error(bignumberError+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+S(u));if(!y)return new v(b);for(r=new v(a),h=n=new v(a),i=d=new v(a),g=coeffToString(y),s=r.e=g.length-b.e-1,r.c[0]=POWS_TEN[(c=s%LOG_BASE)<0?LOG_BASE+c:c],e=!e||u.comparedTo(r)>0?s>0?r:h:u,c=p,p=1/0,u=new v(g),d.c[0]=0;f=t(u,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,h=d.plus(f.times(o=h)),d=o,r=u.minus(f.times(o=r)),u=o;return o=t(e.minus(n),i,0,1),d=d.plus(o.times(h)),n=n.plus(o.times(i)),d.s=h.s=b.s,m=t(h,i,s*=2,l).minus(b).abs().comparedTo(t(d,n,s,l).minus(b).abs())<1?[h,i]:[d,n],p=c,m},s.toNumber=function(){return+S(this)},s.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX$1),_(this,e,t,2)},s.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=u||o>=d?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&w?t=toFixedPoint(coeffToString((n=E(new v(n),c+o+1,l)).c),n.e,"0"):(intCheck(e,2,y.length,"Base"),t=r(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},s.valueOf=s.toJSON=function(){return S(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,null!=e&&v.set(e),v}function bitFloor(e){var t=0|e;return e>0||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare$d(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,c=e.e,l=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=c==l,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>l^r?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==l?0:c>l^r?1:-1}function intCheck(e,t,r,n){if(e<t||e>r||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();const NumberUtil={bigNumber:e=>new BigNumber(e),multiply(e,t){if(void 0===e||void 0===t)return BigNumber(0);const r=new BigNumber(e),n=new BigNumber(t);return r.multipliedBy(n)},formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})},InputUtil={numericInputKeyDown(e,t,r){const n=e.metaKey||e.ctrlKey,i=e.key,o=i.toLocaleLowerCase(),s=","===i,a="."===i,c=i>="0"&&i<="9";!n&&("a"===o||"c"===o||"v"===o||"x"===o)&&e.preventDefault(),"0"!==t||s||a||"0"!==i||e.preventDefault(),"0"===t&&c&&(r(i),e.preventDefault()),(s||a)&&(t||(r("0."),e.preventDefault()),((null==t?void 0:t.includes("."))||(null==t?void 0:t.includes(",")))&&e.preventDefault()),c||["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"].includes(i)||a||s||e.preventDefault()}},erc20ABI=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],usdtABI=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],ConstantsUtil$3={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot"},CHAIN_NAME_MAP:{eip155:"Ethereum",solana:"Solana",polkadot:"Polkadot"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"]},ContractUtil={getERC20Abi:e=>ConstantsUtil$3.USDT_CONTRACT_ADDRESSES.includes(e)?usdtABI:erc20ABI},NavigationUtil={URLS:{FAQ:"https://walletconnect.com/faq"}},SafeLocalStorageKeys={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_CONNECTOR:"@appkit/connected_connector",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit/connected_social_username",RECENT_WALLETS:"@appkit/recent_wallets",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE"},SafeLocalStorage={setItem(e,t){isSafe$1()&&localStorage.setItem(e,t)},getItem(e){if(isSafe$1())return localStorage.getItem(e)||void 0},removeItem(e){isSafe$1()&&localStorage.removeItem(e)},clear(){isSafe$1()&&localStorage.clear()}};function isSafe$1(){return"undefined"!=typeof window&&"undefined"!=typeof localStorage}function getW3mThemeVariables(e,t){return"light"===t?{"--w3m-accent":(null==e?void 0:e["--w3m-accent"])||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":(null==e?void 0:e["--w3m-accent"])||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}function isReownName(e){return(null==e?void 0:e.endsWith(ConstantsUtil$3.WC_NAME_SUFFIX_LEGACY))||(null==e?void 0:e.endsWith(ConstantsUtil$3.WC_NAME_SUFFIX))}const SECURE_SITE="https://secure.walletconnect.org",ONRAMP_PROVIDERS=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["eip155"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],MELD_DEV_PUBLIC_KEY="WXETMsajb7XcQBm7mcxAab:q3MtzJpiEMtXVNXsqYkAnAaBkgStybGVtZ",MELD_PROD_PUBLIC_KEY="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",ConstantsUtil$2={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:SECURE_SITE,SECURE_SITE_DASHBOARD:`${SECURE_SITE}/dashboard`,SECURE_SITE_FAVICON:`${SECURE_SITE}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in a new browser tab"},DEFAULT_FEATURES:{swaps:!0,onramp:!0,email:!0,emailShowWallets:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],history:!0,analytics:!0,allWallets:!0}},CoreHelperUtil={isMobile:()=>"undefined"!=typeof window&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),checkCaipNetwork:(e,t="")=>null==e?void 0:e.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase()),isAndroid(){const e=window.navigator.userAgent.toLowerCase();return CoreHelperUtil.isMobile()&&e.includes("android")},isIos(){const e=window.navigator.userAgent.toLowerCase();return CoreHelperUtil.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isClient:()=>"undefined"!=typeof window,isPairingExpired:e=>!e||e-Date.now()<=ConstantsUtil$2.TEN_SEC_MS,isAllowedRetry:e=>Date.now()-e>=ConstantsUtil$2.ONE_SEC_MS,copyToClopboard(e){navigator.clipboard.writeText(e)},getPairingExpiry:()=>Date.now()+ConstantsUtil$2.FOUR_MINUTES_MS,getNetworkId:e=>null==e?void 0:e.split(":")[1],getPlainAddress:e=>null==e?void 0:e.split(":")[2],wait:async e=>new Promise((t=>{setTimeout(t,e)})),debounce(e,t=500){let r;return(...n)=>{r&&clearTimeout(r),r=setTimeout((function(){e(...n)}),t)}},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),formatNativeUrl(e,t){if(CoreHelperUtil.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));return{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}},formatUniversalUrl(e,t){if(!CoreHelperUtil.isHttpUrl(e))return this.formatNativeUrl(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);return{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}},getOpenTargetForPlatform(e){return this.isTelegram()?"_blank":e},openHref(e,t,r){window.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},returnOpenHref(e,t,r){return window.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},isTelegram:()=>"undefined"!=typeof window&&(Boolean(window.TelegramWebviewProxy)||Boolean(window.Telegram)||Boolean(window.TelegramWebviewProxyProto)),async preloadImage(e){const t=new Promise(((t,r)=>{const n=new Image;n.onload=t,n.onerror=r,n.crossOrigin="anonymous",n.src=e}));return Promise.race([t,CoreHelperUtil.wait(2e3)])},formatBalance(e,t){let r="0.000";if("string"==typeof e){const t=Number(e);if(t){const e=Math.floor(1e3*t)/1e3;e&&(r=e.toString())}}return`${r}${t?` ${t}`:""}`},formatBalance2(e,t){var r;let n;if("0"===e)n="0";else if("string"==typeof e){const t=Number(e);t&&(n=null==(r=t.toString().match(/^-?\d+(?:\.\d{0,3})?/u))?void 0:r[0])}return{value:n??"0",rest:"0"===n?"000":"",symbol:t}},getApiUrl:()=>ConstantsUtil$3.W3M_API_URL,getBlockchainApiUrl:()=>ConstantsUtil$3.BLOCKCHAIN_API_RPC_URL,getAnalyticsUrl:()=>ConstantsUtil$3.PULSE_API_URL,getUUID:()=>(null==crypto?void 0:crypto.randomUUID)?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),parseError(e){var t,r;return"string"==typeof e?e:"string"==typeof(null==(r=null==(t=null==e?void 0:e.issues)?void 0:t[0])?void 0:r.message)?e.issues[0].message:e instanceof Error?e.message:"Unknown error"},sortRequestedNetworks(e,t=[]){const r={};return t&&e&&(e.forEach(((e,t)=>{r[e]=t})),t.sort(((e,t)=>{const n=r[e.id],i=r[t.id];return void 0!==n&&void 0!==i?n-i:void 0!==n?-1:void 0!==i?1:0}))),t},calculateBalance(e){let t=0;for(const r of e)t+=r.value??0;return t},formatTokenBalance(e){const t=e.toFixed(2),[r,n]=t.split(".");return{dollars:r,pennies:n}},isAddress(e,t="eip155"){switch(t){case"eip155":return!!/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&!(!/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&!/^(?:0x)?[0-9A-F]{40}$/iu.test(e));case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);default:return!1}},uniqueBy(e,t){const r=new Set;return e.filter((e=>{const n=e[t];return!r.has(n)&&(r.add(n),!0)}))},generateSdkVersion:(e,t,r)=>`${t}-${0===e.length?"universal":e.map((e=>e.adapterType)).join(",")}-${r}`};async function fetchData(...e){const t=await fetch(...e);if(!t.ok){throw new Error(`HTTP status code: ${t.status}`,{cause:t})}return t}class FetchUtil{constructor({baseUrl:e,clientId:t}){this.baseUrl=e,this.clientId=t}async get({headers:e,signal:t,cache:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"GET",headers:e,signal:t,cache:r})).json()}async getBlob({headers:e,signal:t,...r}){const n=this.createUrl(r);return(await fetchData(n,{method:"GET",headers:e,signal:t})).blob()}async post({body:e,headers:t,signal:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"POST",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:t,signal:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"PUT",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:t,signal:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"DELETE",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:t}){const r=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach((([e,t])=>{t&&r.searchParams.append(e,t)})),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}const state$o=proxy$1({features:ConstantsUtil$2.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined"}),OptionsController={state:state$o,subscribeKey:(e,t)=>subscribeKey$1(state$o,e,t),setOptions(e){Object.assign(state$o,e)},setFeatures(e){e&&Object.entries(e).forEach((([e,t])=>{state$o.features||(state$o.features=ConstantsUtil$2.DEFAULT_FEATURES),e in state$o.features&&(state$o.features[e]=t)}))},setProjectId(e){state$o.projectId=e},setAllWallets(e){state$o.allWallets=e},setIncludeWalletIds(e){state$o.includeWalletIds=e},setExcludeWalletIds(e){state$o.excludeWalletIds=e},setFeaturedWalletIds(e){state$o.featuredWalletIds=e},setTokens(e){state$o.tokens=e},setTermsConditionsUrl(e){state$o.termsConditionsUrl=e},setPrivacyPolicyUrl(e){state$o.privacyPolicyUrl=e},setCustomWallets(e){state$o.customWallets=e},setIsSiweEnabled(e){state$o.isSiweEnabled=e},setIsUniversalProvider(e){state$o.isUniversalProvider=e},setSdkVersion(e){state$o.sdkVersion=e},setMetadata(e){state$o.metadata=e},setDisableAppend(e){state$o.disableAppend=e},setEIP6963Enabled(e){state$o.enableEIP6963=e},setDebug(e){state$o.debug=e},setEnableWalletConnect(e){state$o.enableWalletConnect=e},setEnableWallets(e){state$o.enableWallets=e},setHasMultipleAddresses(e){state$o.hasMultipleAddresses=e}},DEFAULT_OPTIONS={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},baseUrl$2=CoreHelperUtil.getBlockchainApiUrl(),state$n=proxy$1({clientId:null,api:new FetchUtil({baseUrl:baseUrl$2,clientId:null})}),BlockchainApiController={state:state$n,fetchIdentity:({address:e})=>state$n.api.get({path:`/v1/identity/${e}`,params:{projectId:OptionsController.state.projectId,sender:ChainController.state.activeCaipAddress?CoreHelperUtil.getPlainAddress(ChainController.state.activeCaipAddress):void 0}}),fetchTransactions:({account:e,projectId:t,cursor:r,onramp:n,signal:i,cache:o,chainId:s})=>state$n.api.get({path:`/v1/account/${e}/history`,params:{projectId:t,cursor:r,onramp:n,chainId:s},signal:i,cache:o}),fetchSwapQuote:({projectId:e,amount:t,userAddress:r,from:n,to:i,gasPrice:o})=>state$n.api.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{projectId:e,amount:t,userAddress:r,from:n,to:i,gasPrice:o}}),fetchSwapTokens:({projectId:e,chainId:t})=>state$n.api.get({path:"/v1/convert/tokens",params:{projectId:e,chainId:t}}),fetchTokenPrice:({projectId:e,addresses:t})=>state$n.api.post({path:"/v1/fungible/price",body:{projectId:e,currency:"usd",addresses:t},headers:{"Content-Type":"application/json"}}),fetchSwapAllowance({projectId:e,tokenAddress:t,userAddress:r}){const{sdkType:n,sdkVersion:i}=OptionsController.state;return state$n.api.get({path:"/v1/convert/allowance",params:{projectId:e,tokenAddress:t,userAddress:r},headers:{"Content-Type":"application/json","x-sdk-type":n,"x-sdk-version":i||"html-wagmi-4.2.2"}})},fetchGasPrice({projectId:e,chainId:t}){const{sdkType:r,sdkVersion:n}=OptionsController.state;return state$n.api.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json","x-sdk-type":r,"x-sdk-version":n||"html-wagmi-4.2.2"},params:{projectId:e,chainId:t}})},generateSwapCalldata:({amount:e,from:t,projectId:r,to:n,userAddress:i})=>state$n.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:ConstantsUtil$2.CONVERT_SLIPPAGE_TOLERANCE},from:t,projectId:r,to:n,userAddress:i}}),generateApproveCalldata({from:e,projectId:t,to:r,userAddress:n}){const{sdkType:i,sdkVersion:o}=OptionsController.state;return state$n.api.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json","x-sdk-type":i,"x-sdk-version":o||"html-wagmi-4.2.2"},params:{projectId:t,userAddress:n,from:e,to:r}})},async getBalance(e,t,r){const{sdkType:n,sdkVersion:i}=OptionsController.state;return state$n.api.get({path:`/v1/account/${e}/balance`,headers:{"x-sdk-type":n,"x-sdk-version":i||"html-wagmi-4.2.2"},params:{currency:"usd",projectId:OptionsController.state.projectId,chainId:t,forceUpdate:r}})},lookupEnsName:async e=>state$n.api.get({path:`/v1/profile/account/${e}`,params:{projectId:OptionsController.state.projectId,apiVersion:"2"}}),reverseLookupEnsName:async({address:e})=>state$n.api.get({path:`/v1/profile/reverse/${e}`,params:{sender:AccountController.state.address,projectId:OptionsController.state.projectId,apiVersion:"2"}}),getEnsNameSuggestions:async e=>state$n.api.get({path:`/v1/profile/suggestions/${e}`,params:{projectId:OptionsController.state.projectId}}),registerEnsName:async({coinType:e,address:t,message:r,signature:n})=>state$n.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:r,signature:n},headers:{"Content-Type":"application/json"}}),generateOnRampURL:async({destinationWallets:e,partnerUserId:t,defaultNetwork:r,purchaseAmount:n,paymentAmount:i})=>(await state$n.api.post({path:"/v1/generators/onrampurl",params:{projectId:OptionsController.state.projectId},body:{destinationWallets:e,defaultNetwork:r,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:n,presetFiatAmount:i}})).url,async getOnrampOptions(){try{return await state$n.api.get({path:"/v1/onramp/options",params:{projectId:OptionsController.state.projectId}})}catch(e2){return DEFAULT_OPTIONS}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:r,network:n}){try{return await state$n.api.post({path:"/v1/onramp/quote",params:{projectId:OptionsController.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:r,network:n}})}catch(e2){return{coinbaseFee:{amount:r,currency:t.id},networkFee:{amount:r,currency:t.id},paymentSubtotal:{amount:r,currency:t.id},paymentTotal:{amount:r,currency:t.id},purchaseAmount:{amount:r,currency:t.id},quoteId:"mocked-quote-id"}}},setClientId(e){state$n.clientId=e,state$n.api=new FetchUtil({baseUrl:baseUrl$2,clientId:e})}},state$m=proxy$1({message:"",variant:"success",open:!1}),SnackController={state:state$m,subscribeKey:(e,t)=>subscribeKey$1(state$m,e,t),showLoading(e){state$m.message=e,state$m.variant="loading",state$m.open=!0},showSuccess(e){state$m.message=e,state$m.variant="success",state$m.open=!0},showError(e){const t=CoreHelperUtil.parseError(e);state$m.message=t,state$m.variant="error",state$m.open=!0},hide(){state$m.open=!1}},baseUrl$1=CoreHelperUtil.getAnalyticsUrl(),api$3=new FetchUtil({baseUrl:baseUrl$1,clientId:null}),excluded=["MODAL_CREATED"],state$l=proxy$1({timestamp:Date.now(),data:{type:"track",event:"MODAL_CREATED"}}),EventsController={state:state$l,subscribe:e=>subscribe$1(state$l,(()=>e(state$l))),_getApiHeaders(){const{projectId:e,sdkType:t,sdkVersion:r}=OptionsController.state;return{"x-project-id":e,"x-sdk-type":t,"x-sdk-version":r||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(e){try{if(excluded.includes(e.data.event)||"undefined"==typeof window)return;await api$3.post({path:"/e",headers:EventsController._getApiHeaders(),body:{eventId:CoreHelperUtil.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:e.data}})}catch{}},sendEvent(e){var t;state$l.timestamp=Date.now(),state$l.data=e,(null==(t=OptionsController.state.features)?void 0:t.analytics)&&EventsController._sendAnalyticsEvent(state$l)}};function getDefaultExportFromCjs$1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var browser$i={exports:{}},process=browser$i.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(e2){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(e2){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e2){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e2){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop$2(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop$2,process.addListener=noop$2,process.once=noop$2,process.off=noop$2,process.removeListener=noop$2,process.removeAllListeners=noop$2,process.emit=noop$2,process.prependListener=noop$2,process.prependOnceListener=noop$2,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};var browserExports$1=browser$i.exports;const process$1=getDefaultExportFromCjs$1(browserExports$1),SECURE_SITE_SDK=process$1.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL||"https://secure.walletconnect.org/sdk",DEFAULT_LOG_LEVEL=process$1.env.NEXT_PUBLIC_DEFAULT_LOG_LEVEL||"error",W3mFrameConstants={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},W3mFrameRpcConstants={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}};var util$d,util2,objectUtil,objectUtil2;util2=util$d||(util$d={}),util2.assertEqual=e=>e,util2.assertIs=function(e){},util2.assertNever=function(e){throw new Error},util2.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},util2.getValidEnumValues=e=>{const t=util2.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const n of t)r[n]=e[n];return util2.objectValues(r)},util2.objectValues=e=>util2.objectKeys(e).map((function(t){return e[t]})),util2.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},util2.find=(e,t)=>{for(const r of e)if(t(r))return r},util2.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,util2.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},util2.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,objectUtil2=objectUtil||(objectUtil={}),objectUtil2.mergeShapes=(e,t)=>({...e,...t});const ZodParsedType=util$d.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(e)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(e)?ZodParsedType.array:null===e?ZodParsedType.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ZodParsedType.promise:"undefined"!=typeof Map&&e instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&e instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&e instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$d.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$d.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let r;switch(e.code){case ZodIssueCode.invalid_type:r=e.received===ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util$d.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${util$d.joinValues(e.keys,", ")}`;break;case ZodIssueCode.invalid_union:r="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${util$d.joinValues(e.options)}`;break;case ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${util$d.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ZodIssueCode.invalid_date:r="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util$d.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ZodIssueCode.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:r="Invalid input";break;case ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,util$d.assertNever(e)}return{message:r}};let overrideErrorMap=errorMap;function setErrorMap(e){overrideErrorMap=e}function getErrorMap(){return overrideErrorMap}const makeIssue=e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};let a="";const c=n.filter((e=>!!e)).slice().reverse();for(const l of c)a=l(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}},EMPTY_PATH=[];function addIssueToContext(e,t){const r=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e))});e.common.issues.push(r)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return INVALID;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const n of t)r.push({key:await n.key,value:await n.value});return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return INVALID;if("aborted"===i.status)return INVALID;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!n.alwaysSet||(r[t.value]=i.value)}return{status:e.value,value:r}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;var errorUtil,errorUtil2;errorUtil2=errorUtil||(errorUtil={}),errorUtil2.errToObj=e=>"string"==typeof e?{message:e}:e||{},errorUtil2.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=r?r:t.defaultError},description:i}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parseSync({data:e,path:n.path,parent:n});return handleResult(n,i)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(isAsync(n)?n:Promise.resolve(n));return handleResult(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),o=()=>n.addIssue({code:ZodIssueCode.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(o(),!1))):!!i||(o(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[a-z][a-z0-9]*$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,datetimeRegex=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function isValidIP(e,t){return!("v4"!==t&&t||!ipv4Regex.test(e))||!("v6"!==t&&t||!ipv6Regex.test(e))}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ZodParsedType.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:t.parsedType}),INVALID}const t=new ParseStatus;let r;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const n=e.data.length>i.value,o=e.data.length<i.value;(n||o)&&(r=this._getOrReturnCtx(e,r),n?addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)emailRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"email",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"emoji",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)uuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"uuid",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)cuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)cuid2Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)ulidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ulid",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(n){r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"url",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"regex",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){datetimeRegex(i).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else"ip"===i.kind?isValidIP(e.data,i.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ip",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty()):util$d.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(r)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...errorUtil.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...errorUtil.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...errorUtil.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...errorUtil.errToObj(t)})}nonempty(e){return this.min(1,errorUtil.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const n of this._def.checks)if("int"===n.kind)util$d.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==floatSafeRemainder(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_finite,message:n.message}),r.dirty()):util$d.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,n){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&util$d.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==ZodParsedType.bigint){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util$d.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,n){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:t.parsedType}),INVALID}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:t.parsedType}),INVALID}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:ZodIssueCode.invalid_date}),INVALID}const t=new ParseStatus;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):util$d.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:t.parsedType}),INVALID}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:t.parsedType}),INVALID}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:t.parsedType}),INVALID}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:t.parsedType}),INVALID}}ZodNever.create=e=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:t.parsedType}),INVALID}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==ZodParsedType.array)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:t.parsedType}),INVALID;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>ParseStatus.mergeArray(r,e)));const i=[...t.data].map(((e,r)=>n.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return ParseStatus.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ZodOptional.create(deepPartialify(n))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util$d.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ZodParsedType.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const a in r.data)i.includes(a)||o.push(a);const s=[];for(const a of i){const e=n[a],t=r.data[a];s.push({key:{status:"valid",value:a},value:e._parse(new ParseInputLazyPath(r,t,r.path,a)),alwaysSet:a in r.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:r.data[t]}});else if("strict"===e)o.length>0&&(addIssueToContext(r,{code:ZodIssueCode.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,o,s;const a=null!==(o=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==o?o:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=errorUtil.errToObj(e).message)&&void 0!==s?s:a}:{message:a}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return util$d.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return util$d.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return util$d.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return util$d.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ZodOptional;)e=e._def.innerType;t[r]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(util$d.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const r=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:r}),INVALID}));{let e;const n=[];for(const o of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=o._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map((e=>new ZodError(e)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:i}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?Object.keys(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:null;class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.object)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID;const r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const i of t){const t=getDiscriminator(i.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(n.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);n.set(r,i)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...processCreateParams(r)})}}function mergeValues(e,t){const r=getParsedType(e),n=getParsedType(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType.object&&n===ZodParsedType.object){const r=util$d.objectKeys(t),n=util$d.objectKeys(e).filter((e=>-1!==r.indexOf(e))),i={...e,...t};for(const o of n){const r=mergeValues(e[o],t[o]);if(!r.valid)return{valid:!1};i[o]=r.data}return{valid:!0,data:i}}if(r===ZodParsedType.array&&n===ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=mergeValues(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===ZodParsedType.date&&n===ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(isAborted(e)||isAborted(n))return INVALID;const i=mergeValues(e.value,n.value);return i.valid?((isDirty(e)||isDirty(n))&&t.dirty(),{status:t.value,value:i.data}):(addIssueToContext(r,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.array)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:r.parsedType}),INVALID;if(r.data.length<this._def.items.length)return addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&r.data.length>this._def.items.length&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new ParseInputLazyPath(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.object)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:r.parsedType}),INVALID;const n=[],i=this._def.keyType,o=this._def.valueType;for(const s in r.data)n.push({key:i._parse(new ParseInputLazyPath(r,s,r.path,s)),value:o._parse(new ParseInputLazyPath(r,r.data[s],r.path,s))});return r.common.async?ParseStatus.mergeObjectAsync(t,n):ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(r)}:{keyType:ZodString.create(),valueType:e,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.map)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:r.parsedType}),INVALID;const n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map((([e,t],o)=>({key:n._parse(new ParseInputLazyPath(r,e,r.path,[o,"key"])),value:i._parse(new ParseInputLazyPath(r,t,r.path,[o,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of o){const n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return INVALID;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of o){const n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return INVALID;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.set)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:r.parsedType}),INVALID;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const r=new Set;for(const n of e){if("aborted"===n.status)return INVALID;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const s=[...r.data.values()].map(((e,t)=>i._parse(new ParseInputLazyPath(r,e,r.path,t))));return r.common.async?Promise.all(s).then((e=>o(e))):o(s)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.function)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:t.parsedType}),INVALID;function r(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:r}})}function n(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:r}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const s=new ZodError([]),a=await e._def.args.parseAsync(t,i).catch((e=>{throw s.addIssue(r(t,e)),s})),c=await Reflect.apply(o,this,a);return await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw s.addIssue(n(c,e)),s}))}))}{const e=this;return OK((function(...t){const s=e._def.args.safeParse(t,i);if(!s.success)throw new ZodError([r(t,s.error)]);const a=Reflect.apply(o,this,s.data),c=e._def.returns.safeParse(a,i);if(!c.success)throw new ZodError([n(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(r)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{expected:util$d.joinValues(r),received:t.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_enum_value,options:r}),INVALID}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ZodEnum.create(e)}exclude(e){return ZodEnum.create(this.options.filter((t=>!e.includes(t))))}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(e){const t=util$d.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ZodParsedType.string&&r.parsedType!==ZodParsedType.number){const e=util$d.objectValues(t);return addIssueToContext(r,{expected:util$d.joinValues(e),received:r.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(-1===t.indexOf(e.data)){const e=util$d.objectValues(t);return addIssueToContext(r,{received:r.data,code:ZodIssueCode.invalid_enum_value,options:e}),INVALID}return OK(e.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.promise&&!1===t.common.async)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:t.parsedType}),INVALID;const r=t.parsedType===ZodParsedType.promise?t.data:Promise.resolve(t.data);return OK(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{addIssueToContext(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){const e=n.transform(r.data,i);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r}))):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?INVALID:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?INVALID:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!isValid(e))return e;const o=n.transform(e.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>isValid(e)?Promise.resolve(n.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}util$d.assertNever(n)}}ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:t,...processCreateParams(r)}),ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return isAsync(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:t.parsedType}),INVALID}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(e)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e);return isValid(t)&&(t.value=Object.freeze(t.value)),t}}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(t)});const custom$1=(e,t={},r)=>e?ZodAny.create().superRefine(((n,i)=>{var o,s;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,a=null===(s=null!==(o=e.fatal)&&void 0!==o?o:r)||void 0===s||s,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:a})}})):ZodAny.create(),late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind,ZodFirstPartyTypeKind2;ZodFirstPartyTypeKind2=ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}),ZodFirstPartyTypeKind2.ZodString="ZodString",ZodFirstPartyTypeKind2.ZodNumber="ZodNumber",ZodFirstPartyTypeKind2.ZodNaN="ZodNaN",ZodFirstPartyTypeKind2.ZodBigInt="ZodBigInt",ZodFirstPartyTypeKind2.ZodBoolean="ZodBoolean",ZodFirstPartyTypeKind2.ZodDate="ZodDate",ZodFirstPartyTypeKind2.ZodSymbol="ZodSymbol",ZodFirstPartyTypeKind2.ZodUndefined="ZodUndefined",ZodFirstPartyTypeKind2.ZodNull="ZodNull",ZodFirstPartyTypeKind2.ZodAny="ZodAny",ZodFirstPartyTypeKind2.ZodUnknown="ZodUnknown",ZodFirstPartyTypeKind2.ZodNever="ZodNever",ZodFirstPartyTypeKind2.ZodVoid="ZodVoid",ZodFirstPartyTypeKind2.ZodArray="ZodArray",ZodFirstPartyTypeKind2.ZodObject="ZodObject",ZodFirstPartyTypeKind2.ZodUnion="ZodUnion",ZodFirstPartyTypeKind2.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ZodFirstPartyTypeKind2.ZodIntersection="ZodIntersection",ZodFirstPartyTypeKind2.ZodTuple="ZodTuple",ZodFirstPartyTypeKind2.ZodRecord="ZodRecord",ZodFirstPartyTypeKind2.ZodMap="ZodMap",ZodFirstPartyTypeKind2.ZodSet="ZodSet",ZodFirstPartyTypeKind2.ZodFunction="ZodFunction",ZodFirstPartyTypeKind2.ZodLazy="ZodLazy",ZodFirstPartyTypeKind2.ZodLiteral="ZodLiteral",ZodFirstPartyTypeKind2.ZodEnum="ZodEnum",ZodFirstPartyTypeKind2.ZodEffects="ZodEffects",ZodFirstPartyTypeKind2.ZodNativeEnum="ZodNativeEnum",ZodFirstPartyTypeKind2.ZodOptional="ZodOptional",ZodFirstPartyTypeKind2.ZodNullable="ZodNullable",ZodFirstPartyTypeKind2.ZodDefault="ZodDefault",ZodFirstPartyTypeKind2.ZodCatch="ZodCatch",ZodFirstPartyTypeKind2.ZodPromise="ZodPromise",ZodFirstPartyTypeKind2.ZodBranded="ZodBranded",ZodFirstPartyTypeKind2.ZodPipeline="ZodPipeline",ZodFirstPartyTypeKind2.ZodReadonly="ZodReadonly";const instanceOfType=(e,t={message:`Input not instance of ${e.name}`})=>custom$1((t=>t instanceof e),t),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$5={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},NEVER=INVALID;var z$8=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util$d},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom$1,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$5,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError});const zError=z$8.object({message:z$8.string()});function zType(e){return z$8.literal(W3mFrameConstants[e])}z$8.object({accessList:z$8.array(z$8.string()),blockHash:z$8.string().nullable(),blockNumber:z$8.string().nullable(),chainId:z$8.string().or(z$8.number()),from:z$8.string(),gas:z$8.string(),hash:z$8.string(),input:z$8.string().nullable(),maxFeePerGas:z$8.string(),maxPriorityFeePerGas:z$8.string(),nonce:z$8.string(),r:z$8.string(),s:z$8.string(),to:z$8.string(),transactionIndex:z$8.string().nullable(),type:z$8.string(),v:z$8.string(),value:z$8.string()});const AppSwitchNetworkRequest=z$8.object({chainId:z$8.string().or(z$8.number())}),AppConnectEmailRequest=z$8.object({email:z$8.string().email()}),AppConnectOtpRequest=z$8.object({otp:z$8.string()}),AppConnectSocialRequest=z$8.object({uri:z$8.string()}),AppGetUserRequest=z$8.object({chainId:z$8.optional(z$8.string().or(z$8.number())),preferredAccountType:z$8.optional(z$8.string())}),AppGetSocialRedirectUriRequest=z$8.object({provider:z$8.enum(["google","github","apple","facebook","x","discord"])}),AppUpdateEmailRequest=z$8.object({email:z$8.string().email()}),AppUpdateEmailPrimaryOtpRequest=z$8.object({otp:z$8.string()}),AppUpdateEmailSecondaryOtpRequest=z$8.object({otp:z$8.string()}),AppSyncThemeRequest=z$8.object({themeMode:z$8.optional(z$8.enum(["light","dark"])),themeVariables:z$8.optional(z$8.record(z$8.string(),z$8.string().or(z$8.number()))),w3mThemeVariables:z$8.optional(z$8.record(z$8.string(),z$8.string()))}),AppSyncDappDataRequest=z$8.object({metadata:z$8.object({name:z$8.string(),description:z$8.string(),url:z$8.string(),icons:z$8.array(z$8.string())}).optional(),sdkVersion:z$8.string().optional(),sdkType:z$8.string().optional(),projectId:z$8.string()}),AppSetPreferredAccountRequest=z$8.object({type:z$8.string()}),FrameConnectEmailResponse=z$8.object({action:z$8.enum(["VERIFY_DEVICE","VERIFY_OTP"])}),FrameGetFarcasterUriResponse=z$8.object({url:z$8.string()}),FrameConnectFarcasterResponse=z$8.object({userName:z$8.string()}),FrameConnectSocialResponse=z$8.object({email:z$8.string(),address:z$8.string(),chainId:z$8.string().or(z$8.number()),accounts:z$8.array(z$8.object({address:z$8.string(),type:z$8.enum([W3mFrameRpcConstants.ACCOUNT_TYPES.EOA,W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:z$8.string().optional()}),FrameUpdateEmailResponse=z$8.object({action:z$8.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),FrameGetUserResponse=z$8.object({email:z$8.string().email().optional().nullable(),address:z$8.string(),chainId:z$8.string().or(z$8.number()),smartAccountDeployed:z$8.optional(z$8.boolean()),accounts:z$8.array(z$8.object({address:z$8.string(),type:z$8.enum([W3mFrameRpcConstants.ACCOUNT_TYPES.EOA,W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:z$8.optional(z$8.string())}),FrameGetSocialRedirectUriResponse=z$8.object({uri:z$8.string()}),FrameIsConnectedResponse=z$8.object({isConnected:z$8.boolean()}),FrameGetChainIdResponse=z$8.object({chainId:z$8.string().or(z$8.number())}),FrameSwitchNetworkResponse=z$8.object({chainId:z$8.string().or(z$8.number())}),FrameUpdateEmailSecondaryOtpResponse=z$8.object({newEmail:z$8.string().email()}),FrameGetSmartAccountEnabledNetworksResponse=z$8.object({smartAccountEnabledNetworks:z$8.array(z$8.number())});z$8.object({address:z$8.string(),isDeployed:z$8.boolean()});const FrameReadyResponse=z$8.object({version:z$8.string().optional()}),FrameSetPreferredAccountResponse=z$8.object({type:z$8.string(),address:z$8.string()}),RpcResponse=z$8.any(),RpcEthAccountsRequest=z$8.object({method:z$8.literal("eth_accounts")}),RpcEthBlockNumber=z$8.object({method:z$8.literal("eth_blockNumber")}),RpcEthCall=z$8.object({method:z$8.literal("eth_call"),params:z$8.array(z$8.any())}),RpcEthChainId=z$8.object({method:z$8.literal("eth_chainId")}),RpcEthEstimateGas=z$8.object({method:z$8.literal("eth_estimateGas"),params:z$8.array(z$8.any())}),RpcEthFeeHistory=z$8.object({method:z$8.literal("eth_feeHistory"),params:z$8.array(z$8.any())}),RpcEthGasPrice=z$8.object({method:z$8.literal("eth_gasPrice")}),RpcEthGetAccount=z$8.object({method:z$8.literal("eth_getAccount"),params:z$8.array(z$8.any())}),RpcEthGetBalance=z$8.object({method:z$8.literal("eth_getBalance"),params:z$8.array(z$8.any())}),RpcEthGetBlockyByHash=z$8.object({method:z$8.literal("eth_getBlockByHash"),params:z$8.array(z$8.any())}),RpcEthGetBlockByNumber=z$8.object({method:z$8.literal("eth_getBlockByNumber"),params:z$8.array(z$8.any())}),RpcEthGetBlockReceipts=z$8.object({method:z$8.literal("eth_getBlockReceipts"),params:z$8.array(z$8.any())}),RcpEthGetBlockTransactionCountByHash=z$8.object({method:z$8.literal("eth_getBlockTransactionCountByHash"),params:z$8.array(z$8.any())}),RcpEthGetBlockTransactionCountByNumber=z$8.object({method:z$8.literal("eth_getBlockTransactionCountByNumber"),params:z$8.array(z$8.any())}),RpcEthGetCode=z$8.object({method:z$8.literal("eth_getCode"),params:z$8.array(z$8.any())}),RpcEthGetFilter=z$8.object({method:z$8.literal("eth_getFilterChanges"),params:z$8.array(z$8.any())}),RpcEthGetFilterLogs=z$8.object({method:z$8.literal("eth_getFilterLogs"),params:z$8.array(z$8.any())}),RpcEthGetLogs=z$8.object({method:z$8.literal("eth_getLogs"),params:z$8.array(z$8.any())}),RpcEthGetProof=z$8.object({method:z$8.literal("eth_getProof"),params:z$8.array(z$8.any())}),RpcEthGetStorageAt=z$8.object({method:z$8.literal("eth_getStorageAt"),params:z$8.array(z$8.any())}),RpcEthGetTransactionByBlockHashAndIndex=z$8.object({method:z$8.literal("eth_getTransactionByBlockHashAndIndex"),params:z$8.array(z$8.any())}),RpcEthGetTransactionByBlockNumberAndIndex=z$8.object({method:z$8.literal("eth_getTransactionByBlockNumberAndIndex"),params:z$8.array(z$8.any())}),RpcEthGetTransactionByHash=z$8.object({method:z$8.literal("eth_getTransactionByHash"),params:z$8.array(z$8.any())}),RpcEthGetTransactionCount=z$8.object({method:z$8.literal("eth_getTransactionCount"),params:z$8.array(z$8.any())}),RpcEthGetTransactionReceipt=z$8.object({method:z$8.literal("eth_getTransactionReceipt"),params:z$8.array(z$8.any())}),RpcEthGetUncleCountByBlockHash=z$8.object({method:z$8.literal("eth_getUncleCountByBlockHash"),params:z$8.array(z$8.any())}),RpcEthGetUncleCountByBlockNumber=z$8.object({method:z$8.literal("eth_getUncleCountByBlockNumber"),params:z$8.array(z$8.any())}),RpcEthMaxPriorityFeePerGas=z$8.object({method:z$8.literal("eth_maxPriorityFeePerGas")}),RpcEthNewBlockFilter=z$8.object({method:z$8.literal("eth_newBlockFilter")}),RpcEthNewFilter=z$8.object({method:z$8.literal("eth_newFilter"),params:z$8.array(z$8.any())}),RpcEthNewPendingTransactionFilter=z$8.object({method:z$8.literal("eth_newPendingTransactionFilter")}),RpcEthSendRawTransaction=z$8.object({method:z$8.literal("eth_sendRawTransaction"),params:z$8.array(z$8.any())}),RpcEthSyncing=z$8.object({method:z$8.literal("eth_syncing"),params:z$8.array(z$8.any())}),RpcUnistallFilter=z$8.object({method:z$8.literal("eth_uninstallFilter"),params:z$8.array(z$8.any())}),RpcPersonalSignRequest=z$8.object({method:z$8.literal("personal_sign"),params:z$8.array(z$8.any())}),RpcEthSignTypedDataV4=z$8.object({method:z$8.literal("eth_signTypedData_v4"),params:z$8.array(z$8.any())}),RpcEthSendTransactionRequest=z$8.object({method:z$8.literal("eth_sendTransaction"),params:z$8.array(z$8.any())}),RpcSolanaSignMessageRequest=z$8.object({method:z$8.literal("solana_signMessage"),params:z$8.object({message:z$8.string(),pubkey:z$8.string()})}),RpcSolanaSignTransactionRequest=z$8.object({method:z$8.literal("solana_signTransaction"),params:z$8.object({transaction:z$8.string()})}),RpcSolanaSignAllTransactionsRequest=z$8.object({method:z$8.literal("solana_signAllTransactions"),params:z$8.object({transactions:z$8.array(z$8.string())})}),RpcSolanaSignAndSendTransactionRequest=z$8.object({method:z$8.literal("solana_signAndSendTransaction"),params:z$8.object({transaction:z$8.string(),options:z$8.object({skipPreflight:z$8.boolean().optional(),preflightCommitment:z$8.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:z$8.number().optional(),minContextSlot:z$8.number().optional()}).optional()})}),WalletSendCallsRequest=z$8.object({method:z$8.literal("wallet_sendCalls"),params:z$8.array(z$8.object({chainId:z$8.string().or(z$8.number()).optional(),from:z$8.string().optional(),version:z$8.string().optional(),capabilities:z$8.any().optional(),calls:z$8.array(z$8.object({to:z$8.string().startsWith("0x"),data:z$8.string().startsWith("0x").optional(),value:z$8.string().optional()}))}))}),WalletGetCallsReceiptRequest=z$8.object({method:z$8.literal("wallet_getCallsStatus"),params:z$8.array(z$8.string())}),WalletGetCapabilitiesRequest=z$8.object({method:z$8.literal("wallet_getCapabilities")}),WalletGrantPermissionsRequest=z$8.object({method:z$8.literal("wallet_grantPermissions"),params:z$8.array(z$8.any())}),FrameSession=z$8.object({token:z$8.string()}),EventSchema=z$8.object({id:z$8.string().optional()}),W3mFrameSchema={appEvent:EventSchema.extend({type:zType("APP_SWITCH_NETWORK"),payload:AppSwitchNetworkRequest}).or(EventSchema.extend({type:zType("APP_CONNECT_EMAIL"),payload:AppConnectEmailRequest})).or(EventSchema.extend({type:zType("APP_CONNECT_DEVICE")})).or(EventSchema.extend({type:zType("APP_CONNECT_OTP"),payload:AppConnectOtpRequest})).or(EventSchema.extend({type:zType("APP_CONNECT_SOCIAL"),payload:AppConnectSocialRequest})).or(EventSchema.extend({type:zType("APP_GET_FARCASTER_URI")})).or(EventSchema.extend({type:zType("APP_CONNECT_FARCASTER")})).or(EventSchema.extend({type:zType("APP_GET_USER"),payload:z$8.optional(AppGetUserRequest)})).or(EventSchema.extend({type:zType("APP_GET_SOCIAL_REDIRECT_URI"),payload:AppGetSocialRedirectUriRequest})).or(EventSchema.extend({type:zType("APP_SIGN_OUT")})).or(EventSchema.extend({type:zType("APP_IS_CONNECTED"),payload:z$8.optional(FrameSession)})).or(EventSchema.extend({type:zType("APP_GET_CHAIN_ID")})).or(EventSchema.extend({type:zType("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(EventSchema.extend({type:zType("APP_INIT_SMART_ACCOUNT")})).or(EventSchema.extend({type:zType("APP_SET_PREFERRED_ACCOUNT"),payload:AppSetPreferredAccountRequest})).or(EventSchema.extend({type:zType("APP_RPC_REQUEST"),payload:RpcPersonalSignRequest.or(RpcEthSendTransactionRequest).or(RpcEthAccountsRequest).or(RpcEthBlockNumber).or(RpcEthCall).or(RpcEthChainId).or(RpcEthEstimateGas).or(RpcEthFeeHistory).or(RpcEthGasPrice).or(RpcEthGetAccount).or(RpcEthGetBalance).or(RpcEthGetBlockyByHash).or(RpcEthGetBlockByNumber).or(RpcEthGetBlockReceipts).or(RcpEthGetBlockTransactionCountByHash).or(RcpEthGetBlockTransactionCountByNumber).or(RpcEthGetCode).or(RpcEthGetFilter).or(RpcEthGetFilterLogs).or(RpcEthGetLogs).or(RpcEthGetProof).or(RpcEthGetStorageAt).or(RpcEthGetTransactionByBlockHashAndIndex).or(RpcEthGetTransactionByBlockNumberAndIndex).or(RpcEthGetTransactionByHash).or(RpcEthGetTransactionCount).or(RpcEthGetTransactionReceipt).or(RpcEthGetUncleCountByBlockHash).or(RpcEthGetUncleCountByBlockNumber).or(RpcEthMaxPriorityFeePerGas).or(RpcEthNewBlockFilter).or(RpcEthNewFilter).or(RpcEthNewPendingTransactionFilter).or(RpcEthSendRawTransaction).or(RpcEthSyncing).or(RpcUnistallFilter).or(RpcPersonalSignRequest).or(RpcEthSignTypedDataV4).or(RpcEthSendTransactionRequest).or(RpcSolanaSignMessageRequest).or(RpcSolanaSignTransactionRequest).or(RpcSolanaSignAllTransactionsRequest).or(RpcSolanaSignAndSendTransactionRequest).or(WalletGetCallsReceiptRequest).or(WalletSendCallsRequest).or(WalletGetCapabilitiesRequest).or(WalletGrantPermissionsRequest)})).or(EventSchema.extend({type:zType("APP_UPDATE_EMAIL"),payload:AppUpdateEmailRequest})).or(EventSchema.extend({type:zType("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:AppUpdateEmailPrimaryOtpRequest})).or(EventSchema.extend({type:zType("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:AppUpdateEmailSecondaryOtpRequest})).or(EventSchema.extend({type:zType("APP_SYNC_THEME"),payload:AppSyncThemeRequest})).or(EventSchema.extend({type:zType("APP_SYNC_DAPP_DATA"),payload:AppSyncDappDataRequest})),frameEvent:EventSchema.extend({type:zType("FRAME_SWITCH_NETWORK_ERROR"),payload:zError}).or(EventSchema.extend({type:zType("FRAME_SWITCH_NETWORK_SUCCESS"),payload:FrameSwitchNetworkResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_EMAIL_SUCCESS"),payload:FrameConnectEmailResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_EMAIL_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:FrameGetFarcasterUriResponse})).or(EventSchema.extend({type:zType("FRAME_GET_FARCASTER_URI_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:FrameConnectFarcasterResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_FARCASTER_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_OTP_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_OTP_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_CONNECT_DEVICE_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_DEVICE_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:FrameConnectSocialResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_SOCIAL_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_USER_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_USER_SUCCESS"),payload:FrameGetUserResponse})).or(EventSchema.extend({type:zType("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:FrameGetSocialRedirectUriResponse})).or(EventSchema.extend({type:zType("FRAME_SIGN_OUT_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SIGN_OUT_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_IS_CONNECTED_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_IS_CONNECTED_SUCCESS"),payload:FrameIsConnectedResponse})).or(EventSchema.extend({type:zType("FRAME_GET_CHAIN_ID_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_CHAIN_ID_SUCCESS"),payload:FrameGetChainIdResponse})).or(EventSchema.extend({type:zType("FRAME_RPC_REQUEST_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_RPC_REQUEST_SUCCESS"),payload:RpcResponse})).or(EventSchema.extend({type:zType("FRAME_SESSION_UPDATE"),payload:FrameSession})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_SUCCESS"),payload:FrameUpdateEmailResponse})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:FrameUpdateEmailSecondaryOtpResponse})).or(EventSchema.extend({type:zType("FRAME_SYNC_THEME_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SYNC_THEME_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_SYNC_DAPP_DATA_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:FrameGetSmartAccountEnabledNetworksResponse})).or(EventSchema.extend({type:zType("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:FrameSetPreferredAccountResponse})).or(EventSchema.extend({type:zType("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_READY"),payload:FrameReadyResponse}))},W3mFrameStorage={set(e,t){W3mFrameHelpers.isClient&&localStorage.setItem(`${W3mFrameConstants.STORAGE_KEY}${e}`,t)},get:e=>W3mFrameHelpers.isClient?localStorage.getItem(`${W3mFrameConstants.STORAGE_KEY}${e}`):null,delete(e,t){W3mFrameHelpers.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${W3mFrameConstants.STORAGE_KEY}${e}`))}},RegexUtil={address:/^0x(?:[A-Fa-f0-9]{40})$/u,transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},EMAIL_MINIMUM_TIMEOUT=3e4,W3mFrameHelpers={checkIfAllowedToTriggerEmail(){const e=W3mFrameStorage.get(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME);if(e){const t=Date.now()-Number(e);if(t<EMAIL_MINIMUM_TIMEOUT){const e=Math.ceil((EMAIL_MINIMUM_TIMEOUT-t)/1e3);throw new Error(`Please try again after ${e} seconds`)}}},getTimeToNextEmailLogin(){const e=W3mFrameStorage.get(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME);if(e){const t=Date.now()-Number(e);if(t<EMAIL_MINIMUM_TIMEOUT)return Math.ceil((EMAIL_MINIMUM_TIMEOUT-t)/1e3)}return 0},checkIfRequestExists:e=>W3mFrameRpcConstants.NOT_SAFE_RPC_METHODS.includes(e.method)||W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(e.method),getResponseType:e=>"string"==typeof e&&((null==e?void 0:e.match(RegexUtil.transactionHash))||(null==e?void 0:e.match(RegexUtil.signedMessage)))?W3mFrameConstants.RPC_RESPONSE_TYPE_TX:W3mFrameConstants.RPC_RESPONSE_TYPE_OBJECT,checkIfRequestIsSafe:e=>W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(e.method),isClient:"undefined"!=typeof window};class W3mFrame{constructor(e,t=!1,r="eip155:1"){if(this.iframe=null,this.rpcUrl=ConstantsUtil$3.BLOCKCHAIN_API_RPC_URL,this.events={registerFrameEventHandler:(e,t,r)=>{function n({data:r}){var i;if(!(null==(i=r.type)?void 0:i.includes(W3mFrameConstants.FRAME_EVENT_KEY)))return;const o=W3mFrameSchema.frameEvent.parse(r);o.id===e&&(t(o),window.removeEventListener("message",n))}W3mFrameHelpers.isClient&&(window.addEventListener("message",n),r.addEventListener("abort",(()=>{window.removeEventListener("message",n)})))},onFrameEvent:e=>{W3mFrameHelpers.isClient&&window.addEventListener("message",(({data:t})=>{var r;if(!(null==(r=t.type)?void 0:r.includes(W3mFrameConstants.FRAME_EVENT_KEY)))return;const n=W3mFrameSchema.frameEvent.parse(t);e(n)}))},onAppEvent:e=>{W3mFrameHelpers.isClient&&window.addEventListener("message",(({data:t})=>{var r;if(!(null==(r=t.type)?void 0:r.includes(W3mFrameConstants.APP_EVENT_KEY)))return;const n=W3mFrameSchema.appEvent.parse(t);e(n)}))},postAppEvent:e=>{var t;if(W3mFrameHelpers.isClient){if(!(null==(t=this.iframe)?void 0:t.contentWindow))throw new Error("W3mFrame: iframe is not set");W3mFrameSchema.appEvent.parse(e),this.iframe.contentWindow.postMessage(e,"*")}},postFrameEvent:e=>{if(W3mFrameHelpers.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");W3mFrameSchema.frameEvent.parse(e),parent.postMessage(e,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise(((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}})),t&&(this.frameLoadPromise=new Promise(((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}})),W3mFrameHelpers.isClient)){const t=document.createElement("iframe");t.id="w3m-iframe",t.src=`${SECURE_SITE_SDK}?projectId=${e}&chainId=${r}`,t.name="w3m-secure-iframe",t.style.position="fixed",t.style.zIndex="999999",t.style.display="none",t.style.animationDelay="0s, 50ms",t.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",t.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",document.body.appendChild(t),this.iframe=t,this.iframe.onload=()=>{var e;null==(e=this.frameLoadPromiseResolver)||e.resolve(void 0)},this.iframe.onerror=()=>{var e;null==(e=this.frameLoadPromiseResolver)||e.reject("Unable to load email login dependency")}}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map((e=>({[e]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${e}&projectId=${this.projectId}`,chainId:e}})));return Object.assign({},...e)}}function tryStringify(e){try{return JSON.stringify(e)}catch(e2){return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(e,t,r){var n=r&&r.stringify||tryStringify;if("object"==typeof e&&null!==e){var i=t.length+1;if(1===i)return e;var o=new Array(i);o[0]=n(e);for(var s=1;s<i;s++)o[s]=n(t[s]);return o.join(" ")}if("string"!=typeof e)return e;var a=t.length;if(0===a)return e;for(var c="",l=0,u=-1,d=e&&e.length||0,h=0;h<d;){if(37===e.charCodeAt(h)&&h+1<d){switch(u=u>-1?u:0,e.charCodeAt(h+1)){case 100:case 102:if(l>=a)break;if(null==t[l])break;u<h&&(c+=e.slice(u,h)),c+=Number(t[l]),u=h+2,h++;break;case 105:if(l>=a)break;if(null==t[l])break;u<h&&(c+=e.slice(u,h)),c+=Math.floor(Number(t[l])),u=h+2,h++;break;case 79:case 111:case 106:if(l>=a)break;if(void 0===t[l])break;u<h&&(c+=e.slice(u,h));var p=typeof t[l];if("string"===p){c+="'"+t[l]+"'",u=h+2,h++;break}if("function"===p){c+=t[l].name||"<anonymous>",u=h+2,h++;break}c+=n(t[l]),u=h+2,h++;break;case 115:if(l>=a)break;u<h&&(c+=e.slice(u,h)),c+=String(t[l]),u=h+2,h++;break;case 37:u<h&&(c+=e.slice(u,h)),c+="%",u=h+2,h++,l--}++l}++h}return-1===u?e:(u<d&&(c+=e.slice(u)),c)}const format=quickFormatUnescaped;var browser$h=pino;const _console=pfGlobalThisOrFallback().console||{},stdSerializers={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue};function shouldSerialize(e,t){if(Array.isArray(e)){return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const r=e.browser.write||_console;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},i=shouldSerialize(e.browser.serialize,n);let o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");const s=e.level||"info",a=Object.create(r);a.log||(a.log=noop$1),Object.defineProperty(a,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(a,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set$2(c,a,"error","log"),set$2(c,a,"fatal","error"),set$2(c,a,"warn","error"),set$2(c,a,"info","log"),set$2(c,a,"debug","log"),set$2(c,a,"trace","log")}});const c={transmit:t,serialize:i,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:getTimeFunction(e)};return a.levels=pino.levels,a.level=s,a.setMaxListeners=a.getMaxListeners=a.emit=a.addListener=a.on=a.prependListener=a.once=a.prependOnceListener=a.removeListener=a.removeAllListeners=a.listeners=a.listenerCount=a.eventNames=a.write=a.flush=noop$1,a.serializers=n,a._serialize=i,a._stdErrSerialize=o,a.child=function(r,o){if(!r)throw new Error("missing bindings for child Pino");o=o||{},i&&r.serializers&&(o.serializers=r.serializers);const s=o.serializers;if(i&&s){var a=Object.assign({},n,s),c=!0===e.browser.serialize?Object.keys(a):i;delete r.serializers,applySerializers([r],c,a,this._stdErrSerialize)}function l(e){this._childLevel=1+(0|e._childLevel),this.error=bind(e,r,"error"),this.fatal=bind(e,r,"fatal"),this.warn=bind(e,r,"warn"),this.info=bind(e,r,"info"),this.debug=bind(e,r,"debug"),this.trace=bind(e,r,"trace"),a&&(this.serializers=a,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,r)))}return l.prototype=this,new l(this)},t&&(a._logEvent=createLogEventShape()),a}function set$2(e,t,r,n){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?noop$1:i[r]?i[r]:_console[r]||_console[n]||noop$1,wrap(e,t,r)}function wrap(e,t,r){(e.transmit||t[r]!==noop$1)&&(t[r]=function(n){return function(){const i=e.timestamp(),o=new Array(arguments.length),s=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var a=0;a<o.length;a++)o[a]=arguments[a];if(e.serialize&&!e.asObject&&applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(s,asObject(this,r,o,i)):n.apply(s,o),e.transmit){const n=e.transmit.level||t.level,s=pino.levels.values[n],a=pino.levels.values[r];if(a<s)return;transmit(this,{ts:i,methodLevel:r,methodValue:a,transmitLevel:n,transmitValue:pino.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},o)}}}(t[r]))}function asObject(e,t,r,n){e._serialize&&applySerializers(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let o=i[0];const s={};n&&(s.time=n),s.level=pino.levels.values[t];let a=1+(0|e._childLevel);if(a<1&&(a=1),null!==o&&"object"==typeof o){for(;a--&&"object"==typeof i[0];)Object.assign(s,i.shift());o=i.length?format(i.shift(),i):void 0}else"string"==typeof o&&(o=format(i.shift(),i));return void 0!==o&&(s.msg=o),s}function applySerializers(e,t,r,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i]))for(const n in e[i])t&&t.indexOf(n)>-1&&n in r&&(e[i][n]=r[n](e[i][n]))}function bind(e,t,r){return function(){const n=new Array(1+arguments.length);n[0]=t;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[r].apply(this,n)}}function transmit(e,t,r){const n=t.send,i=t.ts,o=t.methodLevel,s=t.methodValue,a=t.val,c=e._logEvent.bindings;applySerializers(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=s,n(o,e._logEvent,a),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop$1(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e2){return e(self)||e(window)||e(this)||{}}}pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},pino.stdSerializers=stdSerializers,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime});const Mg=getDefaultExportFromCjs$2(browser$h),JSONStringify=e=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString()+"n":t)),JSONParse=e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))};function safeJsonParse(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSONParse(e)}catch(t){return e}}function safeJsonStringify(e){return"string"==typeof e?e:JSONStringify(e)||""}const c$7={level:"info"},n$8="custom_context",l$5=1024e3;let O$5=class{constructor(e){this.nodeValue=e,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},d$5=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new O$5(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},L$2=class{constructor(e,t=l$5){this.level=e??"error",this.levelValue=browser$h.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d$5(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===browser$h.levels.values.error?console.error(e):t===browser$h.levels.values.warn?console.warn(e):t===browser$h.levels.values.debug?console.debug(e):t===browser$h.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(safeJsonStringify({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d$5(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(safeJsonStringify({extraMetadata:e})),new Blob(t,{type:"application/json"})}},m$3=class{constructor(e,t=l$5){this.baseChunkLogger=new L$2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},B$3=class{constructor(e,t=l$5){this.baseChunkLogger=new L$2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var x$6=Object.defineProperty,S$5=Object.defineProperties,_$5=Object.getOwnPropertyDescriptors,p$5=Object.getOwnPropertySymbols,T$5=Object.prototype.hasOwnProperty,z$7=Object.prototype.propertyIsEnumerable,f$9=(e,t,r)=>t in e?x$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i$8=(e,t)=>{for(var r in t||(t={}))T$5.call(t,r)&&f$9(e,r,t[r]);if(p$5)for(var r of p$5(t))z$7.call(t,r)&&f$9(e,r,t[r]);return e},g$5=(e,t)=>S$5(e,_$5(t));function k$4(e){return g$5(i$8({},e),{level:(null==e?void 0:e.level)||c$7.level})}function v$6(e,t=n$8){return e[t]||""}function b$4(e,t,r=n$8){return e[r]=t,e}function y$6(e,t=n$8){let r="";return r=typeof e.bindings>"u"?v$6(e,t):e.bindings().context||"",r}function w$6(e,t,r=n$8){const n=y$6(e,r);return n.trim()?`${n}/${t}`:t}function E$4(e,t,r=n$8){const n=w$6(e,t,r);return b$4(e.child({context:n}),n,r)}function C$4(e){var t,r;const n=new m$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:Mg(g$5(i$8({},e.opts),{level:"trace",browser:g$5(i$8({},null==(r=e.opts)?void 0:r.browser),{write:e=>n.write(e)})})),chunkLoggerController:n}}function I$3(e){var t;const r=new B$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:Mg(g$5(i$8({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}function A$3(e){return typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C$4(e):I$3(e)}class W3mFrameLogger{constructor(e){var t;const r=k$4({level:DEFAULT_LOG_LEVEL}),{logger:n,chunkLoggerController:i}=A$3({opts:r});this.logger=E$4(n,this.constructor.name),this.chunkLoggerController=i,"undefined"!=typeof window&&(null==(t=this.chunkLoggerController)?void 0:t.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var t;(null==(t=this.chunkLoggerController)?void 0:t.downloadLogsBlobInBrowser)&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}class W3mFrameProvider{constructor({projectId:e,chainId:t,onTimeout:r}){this.openRpcRequests=[],this.w3mLogger=new W3mFrameLogger(e),this.w3mFrame=new W3mFrame(e,!0,t),this.onTimeout=r}getLoginEmailUsed(){return Boolean(W3mFrameStorage.get(W3mFrameConstants.EMAIL_LOGIN_USED_KEY))}getEmail(){return W3mFrameStorage.get(W3mFrameConstants.EMAIL)}async connectEmail(e){try{W3mFrameHelpers.checkIfAllowedToTriggerEmail();const t=await this.appEvent({type:W3mFrameConstants.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting email"),t}}async connectDevice(){try{return this.appEvent({type:W3mFrameConstants.APP_CONNECT_DEVICE})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting device"),e}}async connectOtp(e){try{return this.appEvent({type:W3mFrameConstants.APP_CONNECT_OTP,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting otp"),t}}async isConnected(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_IS_CONNECTED});return e.isConnected||this.deleteAuthLoginCache(),e}catch(e){throw this.deleteAuthLoginCache(),this.w3mLogger.logger.error({error:e},"Error checking connection"),e}}async getChainId(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_GET_CHAIN_ID});return this.setLastUsedChainId(e.chainId),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting chain id"),e}}async getSocialRedirectUri(e){try{return this.appEvent({type:W3mFrameConstants.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error getting social redirect uri"),t}}async updateEmail(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error updating email"),t}}async updateEmailPrimaryOtp(e){try{return this.appEvent({type:W3mFrameConstants.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error updating email primary otp"),t}}async updateEmailSecondaryOtp(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(t.newEmail),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error updating email secondary otp"),t}}async syncTheme(e){try{return this.appEvent({type:W3mFrameConstants.APP_SYNC_THEME,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error syncing theme"),t}}async syncDappData(e){try{return this.appEvent({type:W3mFrameConstants.APP_SYNC_DAPP_DATA,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error syncing dapp data"),t}}async getSmartAccountEnabledNetworks(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(e.smartAccountEnabledNetworks),e}catch(e){throw this.persistSmartAccountEnabledNetworks([]),this.w3mLogger.logger.error({error:e},"Error getting smart account enabled networks"),e}}async setPreferredAccount(e){try{return this.appEvent({type:W3mFrameConstants.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error setting preferred account"),t}}async connect(e){try{const t=(null==e?void 0:e.chainId)||this.getLastUsedChainId()||1,r=await this.appEvent({type:W3mFrameConstants.APP_GET_USER,payload:{...e,chainId:t}});return this.setLoginSuccess(r.email),this.setLastUsedChainId(r.chainId),r}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting"),t}}async getUser(e){try{const t=(null==e?void 0:e.chainId)||this.getLastUsedChainId()||1;return await this.appEvent({type:W3mFrameConstants.APP_GET_USER,payload:{...e,chainId:t}})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting"),t}}async connectSocial(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_CONNECT_SOCIAL,payload:{uri:e}});return t.userName&&this.setSocialLoginSuccess(t.userName),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting social"),t}}async getFarcasterUri(){try{return await this.appEvent({type:W3mFrameConstants.APP_GET_FARCASTER_URI})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting farcaster uri"),e}}async connectFarcaster(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_CONNECT_FARCASTER});return e.userName&&this.setSocialLoginSuccess(e.userName),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting farcaster"),e}}async switchNetwork(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(t.chainId),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error switching network"),t}}async disconnect(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_SIGN_OUT});return this.deleteAuthLoginCache(),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error disconnecting"),e}}async request(e){var t,r,n;try{if(W3mFrameRpcConstants.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();null==(t=this.rpcRequestHandler)||t.call(this,e);const n=await this.appEvent({type:W3mFrameConstants.APP_RPC_REQUEST,payload:e});return null==(r=this.rpcSuccessHandler)||r.call(this,n,e),n}catch(i){throw null==(n=this.rpcErrorHandler)||n.call(this,i,e),this.w3mLogger.logger.error({error:i},"Error requesting"),i}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_IS_CONNECTED_SUCCESS&&t.payload.isConnected&&e()}))}onNotConnected(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_IS_CONNECTED_ERROR&&e(),t.type!==W3mFrameConstants.FRAME_IS_CONNECTED_SUCCESS||t.payload.isConnected||e()}))}onConnect(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_GET_USER_SUCCESS&&e(t.payload)}))}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(t.payload):t.type===W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:W3mFrameRpcConstants.ACCOUNT_TYPES.EOA})}))}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(t.payload.smartAccountEnabledNetworks):t.type===W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])}))}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){try{this.openRpcRequests.forEach((({abortController:e,method:t})=>{W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(t)||e.abort()})),this.openRpcRequests=[]}catch(e2){this.w3mLogger.logger.error({error:e2},"Error aborting RPC request")}}async appEvent(e){let t;function r(e){return e.replace("@w3m-app/","")}await this.w3mFrame.frameLoadPromise;const n=new AbortController,i=r(e.type);return[W3mFrameConstants.APP_CONNECT_EMAIL,W3mFrameConstants.APP_CONNECT_DEVICE,W3mFrameConstants.APP_CONNECT_OTP,W3mFrameConstants.APP_CONNECT_SOCIAL,W3mFrameConstants.APP_GET_SOCIAL_REDIRECT_URI,W3mFrameConstants.APP_GET_FARCASTER_URI].map(r).includes(i)&&(t=setTimeout((()=>{var e;null==(e=this.onTimeout)||e.call(this),n.abort()}),3e4)),new Promise(((r,o)=>{var s,a;const c=Math.random().toString(36).substring(7);if(null==(a=(s=this.w3mLogger.logger).info)||a.call(s,{event:e,id:c},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:c}),"RPC_REQUEST"===i){const t=e;this.openRpcRequests=[...this.openRpcRequests,{...t.payload,abortController:n}]}n.signal.addEventListener("abort",(()=>{o("RPC_REQUEST"===i?new Error("Request was aborted"):new Error("Something went wrong"))})),this.w3mFrame.events.registerFrameEventHandler(c,(e=>{return n=e,s=this.w3mLogger,void(n.id===c&&(null==(l=(a=s.logger).info)||l.call(a,{framEvent:n,id:c},"Received frame response"),n.type===`@w3m-frame/${i}_SUCCESS`?(t&&clearTimeout(t),"payload"in n&&r(n.payload),r(void 0)):n.type===`@w3m-frame/${i}_ERROR`&&(t&&clearTimeout(t),"payload"in n&&o(new Error((null==(u=n.payload)?void 0:u.message)||"An error occurred")),o(new Error("An error occurred")))));var n,s,a,l,u}),n.signal)}))}setNewLastEmailLoginTime(){W3mFrameStorage.set(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){W3mFrameStorage.set(W3mFrameConstants.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&W3mFrameStorage.set(W3mFrameConstants.EMAIL,e),W3mFrameStorage.set(W3mFrameConstants.EMAIL_LOGIN_USED_KEY,"true"),W3mFrameStorage.delete(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){W3mFrameStorage.delete(W3mFrameConstants.EMAIL_LOGIN_USED_KEY),W3mFrameStorage.delete(W3mFrameConstants.EMAIL),W3mFrameStorage.delete(W3mFrameConstants.LAST_USED_CHAIN_KEY),W3mFrameStorage.delete(W3mFrameConstants.SOCIAL_USERNAME)}setLastUsedChainId(e){e&&W3mFrameStorage.set(W3mFrameConstants.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){return Number(W3mFrameStorage.get(W3mFrameConstants.LAST_USED_CHAIN_KEY))}persistSmartAccountEnabledNetworks(e){W3mFrameStorage.set(W3mFrameConstants.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}const state$k=proxy$1({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),TransactionsController={state:state$k,subscribe:e=>subscribe$1(state$k,(()=>e(state$k))),setLastNetworkInView(e){state$k.lastNetworkInView=e},async fetchTransactions(e,t){var r;const{projectId:n}=OptionsController.state;if(!n||!e)throw new Error("Transactions can't be fetched without a projectId and an accountAddress");state$k.loading=!0;try{const i=await BlockchainApiController.fetchTransactions({account:e,projectId:n,cursor:state$k.next,onramp:t,cache:"coinbase"===t?"no-cache":void 0,chainId:null==(r=ChainController.state.activeCaipNetwork)?void 0:r.caipNetworkId}),o=this.filterSpamTransactions(i.data),s=this.filterByConnectedChain(o),a=[...state$k.transactions,...s];state$k.loading=!1,"coinbase"===t?state$k.coinbaseTransactions=this.groupTransactionsByYearAndMonth(state$k.coinbaseTransactions,i.data):(state$k.transactions=a,state$k.transactionsByYear=this.groupTransactionsByYearAndMonth(state$k.transactionsByYear,s)),state$k.empty=0===a.length,state$k.next=i.next?i.next:void 0}catch(i){EventsController.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:n,cursor:state$k.next,isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),SnackController.showError("Failed to fetch transactions"),state$k.loading=!1,state$k.empty=!0,state$k.next=void 0}},groupTransactionsByYearAndMonth(e={},t=[]){const r=e;return t.forEach((e=>{const t=new Date(e.metadata.minedAt).getFullYear(),n=new Date(e.metadata.minedAt).getMonth(),i=r[t]??{},o=(i[n]??[]).filter((t=>t.id!==e.id));r[t]={...i,[n]:[...o,e].sort(((e,t)=>new Date(t.metadata.minedAt).getTime()-new Date(e.metadata.minedAt).getTime()))}})),r},filterSpamTransactions:e=>e.filter((e=>!e.transfers.every((e=>{var t;return!0===(null==(t=e.nft_info)?void 0:t.flags.is_spam)})))),filterByConnectedChain(e){var t;const r=null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId;return e.filter((e=>e.metadata.chain===r))},clearCursor(){state$k.next=void 0},resetTransactions(){state$k.transactions=[],state$k.transactionsByYear={},state$k.lastNetworkInView=void 0,state$k.loading=!1,state$k.empty=!1,state$k.next=void 0}},state$j=proxy$1({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),ThemeController={state:state$j,subscribe:e=>subscribe$1(state$j,(()=>e(state$j))),setThemeMode(e){state$j.themeMode=e;try{const t=ConnectorController.getAuthConnector();if(t){const r=ThemeController.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:r,w3mThemeVariables:getW3mThemeVariables(r,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){state$j.themeVariables={...state$j.themeVariables,...e};try{const e=ConnectorController.getAuthConnector();if(e){const t=ThemeController.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:t,w3mThemeVariables:getW3mThemeVariables(state$j.themeVariables,state$j.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot:()=>snapshot(state$j)},state$i=proxy$1({allConnectors:[],connectors:[]}),ConnectorController={state:state$i,subscribeKey:(e,t)=>subscribeKey$1(state$i,e,t),setConnectors(e){const t=e.filter((e=>{try{proxy$1(e)}catch(t){return console.error("ConnectorController.setConnectors: Not possible to add connector",{newConnector:e,error:t}),!1}return!state$i.allConnectors.some((t=>t.id===e.id&&this.getConnectorName(t.name)===this.getConnectorName(e.name)&&t.chain===e.chain))}));state$i.allConnectors=[...state$i.connectors,...t],state$i.connectors=this.mergeMultiChainConnectors(state$i.allConnectors)},mergeMultiChainConnectors(e){const t=this.generateConnectorMapByName(e),r=[];return t.forEach((e=>{const t=e[0],n="w3mAuth"===(null==t?void 0:t.id);e.length>1?r.push({name:null==t?void 0:t.name,imageUrl:null==t?void 0:t.imageUrl,imageId:null==t?void 0:t.imageId,connectors:[...e],type:n?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(null==t?void 0:t.id)||""}):t&&r.push(t)})),r},generateConnectorMapByName(e){const t=new Map;return e.forEach((e=>{const{name:r}=e,n=this.getConnectorName(r);if(!n)return;const i=t.get(n)||[];i.find((t=>t.chain===e.chain))||i.push(e),t.set(n,i)})),t},getConnectorName(e){if(!e)return e;return{"Trust Wallet":"Trust"}[e]||e},getUniqueConnectorsByName(e){const t=[];return e.forEach((e=>{t.find((t=>t.chain===e.chain))||t.push(e)})),t},addConnector(e){var t,r;if("w3mAuth"===e.id){const n=e,i=snapshot(OptionsController.state),o=ThemeController.getSnapshot().themeMode,s=ThemeController.getSnapshot().themeVariables;null==(r=null==(t=null==n?void 0:n.provider)?void 0:t.syncDappData)||r.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),n.provider.syncTheme({themeMode:o,themeVariables:s,w3mThemeVariables:getW3mThemeVariables(s,o)}),this.setConnectors([e])}else this.setConnectors([e])},getAuthConnector(){var e;const t=ChainController.state.activeChain,r=state$i.connectors.find((e=>"w3mAuth"===e.id));if(r){if(null==(e=null==r?void 0:r.connectors)?void 0:e.length){return r.connectors.find((e=>e.chain===t))}return r}},getAnnouncedConnectorRdns:()=>state$i.connectors.filter((e=>"ANNOUNCED"===e.type)).map((e=>{var t;return null==(t=e.info)?void 0:t.rdns})),getConnectors:()=>state$i.connectors,getConnector:(e,t)=>state$i.connectors.find((r=>{var n;return r.explorerId===e||(null==(n=r.info)?void 0:n.rdns)===t})),syncIfAuthConnector(e){var t,r;if("w3mAuth"!==e.id)return;const n=e,i=snapshot(OptionsController.state),o=ThemeController.getSnapshot().themeMode,s=ThemeController.getSnapshot().themeVariables;null==(r=null==(t=null==n?void 0:n.provider)?void 0:t.syncDappData)||r.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,sdkType:i.sdkType,projectId:i.projectId}),n.provider.syncTheme({themeMode:o,themeVariables:s,w3mThemeVariables:getW3mThemeVariables(s,o)})}},state$h=proxy$1({wcError:!1,buffering:!1,status:"disconnected"});let wcConnectionPromise;const ConnectionController={state:state$h,subscribeKey:(e,t)=>subscribeKey$1(state$h,e,t),_getClient:e=>ChainController.getConnectionControllerClient(e),setClient(e){state$h._client=ref$2(e)},async connectWalletConnect(){var e,t,r,n;if(StorageUtil.setConnectedConnector("WALLET_CONNECT"),CoreHelperUtil.isTelegram()){if(wcConnectionPromise){try{await wcConnectionPromise}catch(i){}return void(wcConnectionPromise=void 0)}if(!CoreHelperUtil.isPairingExpired(null==state$h?void 0:state$h.wcPairingExpiry)){const e=state$h.wcUri;return void(state$h.wcUri=e)}wcConnectionPromise=new Promise((async(e,t)=>{var r,n,i,o;await(null==(o=null==(i=null==(n=null==(r=ChainController.state)?void 0:r.universalAdapter)?void 0:n.connectionControllerClient)?void 0:i.connectWalletConnect)?void 0:o.call(i,(e=>{state$h.wcUri=e,state$h.wcPairingExpiry=CoreHelperUtil.getPairingExpiry()})).catch(t)),e()})),this.state.status="connecting",await wcConnectionPromise,wcConnectionPromise=void 0,state$h.wcPairingExpiry=void 0,this.state.status="connected"}else await(null==(n=null==(r=null==(t=null==(e=ChainController.state)?void 0:e.universalAdapter)?void 0:t.connectionControllerClient)?void 0:r.connectWalletConnect)?void 0:n.call(r,(e=>{state$h.wcUri=e,state$h.wcPairingExpiry=CoreHelperUtil.getPairingExpiry()})))},async connectExternal(e,t,r=!0){var n,i;await(null==(i=(n=this._getClient(t)).connectExternal)?void 0:i.call(n,e)),r&&(ChainController.setActiveNamespace(t),StorageUtil.setConnectedConnector(e.type))},async reconnectExternal(e){var t,r;await(null==(r=(t=this._getClient()).reconnectExternal)?void 0:r.call(t,e)),StorageUtil.setConnectedConnector(e.type)},async setPreferredAccountType(e){var t;ModalController.setLoading(!0);const r=ConnectorController.getAuthConnector();r&&(await(null==r?void 0:r.provider.setPreferredAccount(e)),await this.reconnectExternal(r),ModalController.setLoading(!1),EventsController.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:(null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId)||""}}))},async signMessage(e){return this._getClient().signMessage(e)},parseUnits(e,t){return this._getClient().parseUnits(e,t)},formatUnits(e,t){return this._getClient().formatUnits(e,t)},async sendTransaction(e){return this._getClient().sendTransaction(e)},async getCapabilities(e){return this._getClient().getCapabilities(e)},async grantPermissions(e){return this._getClient().grantPermissions(e)},async estimateGas(e){return this._getClient().estimateGas(e)},async writeContract(e){return this._getClient().writeContract(e)},async getEnsAddress(e){return this._getClient().getEnsAddress(e)},async getEnsAvatar(e){return this._getClient().getEnsAvatar(e)},checkInstalled(e,t){var r,n;return(null==(n=(r=this._getClient(t)).checkInstalled)?void 0:n.call(r,e))||!1},resetWcConnection(){state$h.wcUri=void 0,state$h.wcPairingExpiry=void 0,state$h.wcLinking=void 0,state$h.recentWallet=void 0,state$h.status="disconnected",TransactionsController.resetTransactions(),StorageUtil.deleteWalletConnectDeepLink()},setWcLinking(e){state$h.wcLinking=e},setWcError(e){state$h.wcError=e,state$h.buffering=!1},setRecentWallet(e){state$h.recentWallet=e},setBuffering(e){state$h.buffering=e},setStatus(e){state$h.status=e},async disconnect(){const e=this._getClient();try{await(null==e?void 0:e.disconnect()),this.resetWcConnection()}catch(t){throw new Error("Failed to disconnect")}}},SwapApiUtil={async getTokenList(){var e;const t=ChainController.state.activeCaipNetwork,r=await BlockchainApiController.fetchSwapTokens({chainId:null==t?void 0:t.caipNetworkId,projectId:OptionsController.state.projectId});return(null==(e=null==r?void 0:r.tokens)?void 0:e.map((e=>({...e,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0}))))||[]},async fetchGasPrice(){const e=OptionsController.state.projectId,t=ChainController.state.activeCaipNetwork;if(!t)return null;try{if("solana"===t.chainNamespace){const e=(await ConnectionController.estimateGas({chainNamespace:"solana"})).toString();return{standard:e,fast:e,instant:e}}return await BlockchainApiController.fetchGasPrice({projectId:e,chainId:t.caipNetworkId})}catch{return null}},async fetchSwapAllowance({tokenAddress:e,userAddress:t,sourceTokenAmount:r,sourceTokenDecimals:n}){const i=OptionsController.state.projectId,o=await BlockchainApiController.fetchSwapAllowance({projectId:i,tokenAddress:e,userAddress:t});if((null==o?void 0:o.allowance)&&r&&n){const e=ConnectionController.parseUnits(r,n)||0;return BigInt(o.allowance)>=e}return!1},async getMyTokensWithBalance(e){const t=AccountController.state.address,r=ChainController.state.activeCaipNetwork;if(!t||!r)return[];const n=(await BlockchainApiController.getBalance(t,r.caipNetworkId,e)).balances.filter((e=>"0"!==e.quantity.decimals));return AccountController.setTokenBalance(n,ChainController.state.activeChain),this.mapBalancesToSwapTokens(n)},mapBalancesToSwapTokens:e=>(null==e?void 0:e.map((e=>({...e,address:(null==e?void 0:e.address)?e.address:ChainController.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))))||[]},state$g=proxy$1({view:"Connect",history:["Connect"],transactionStack:[]}),RouterController={state:state$g,subscribeKey:(e,t)=>subscribeKey$1(state$g,e,t),pushTransactionStack(e){state$g.transactionStack.push(e)},popTransactionStack(e){var t,r;const n=state$g.transactionStack.pop();if(n)if(e)this.goBack(),null==(t=null==n?void 0:n.onCancel)||t.call(n);else{if(n.goBack)this.goBack();else if(n.replace){const e=state$g.history.indexOf("ConnectingSiwe");e>0?this.goBackToIndex(e-1):(ModalController.close(),state$g.history=[])}else n.view&&this.reset(n.view);null==(r=null==n?void 0:n.onSuccess)||r.call(n)}},push(e,t){e!==state$g.view&&(state$g.view=e,state$g.history.push(e),state$g.data=t)},reset(e){state$g.view=e,state$g.history=[e]},replace(e,t){state$g.history.at(-1)===e||(state$g.view=e,state$g.history[state$g.history.length-1]=e,state$g.data=t)},goBack(){if(state$g.history.length>1){state$g.history.pop();const[e]=state$g.history.slice(-1);e&&(state$g.view=e)}else ModalController.close()},goBackToIndex(e){if(state$g.history.length>1){state$g.history=state$g.history.slice(0,e+1);const[t]=state$g.history.slice(-1);t&&(state$g.view=t)}}},SwapCalculationUtil={getGasPriceInEther:(e,t)=>Number(t*e)/1e18,getGasPriceInUSD(e,t,r){const n=SwapCalculationUtil.getGasPriceInEther(t,r);return NumberUtil.bigNumber(e).multipliedBy(n).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:r,toTokenAmount:n}){const i=NumberUtil.bigNumber(e).multipliedBy(t),o=NumberUtil.bigNumber(n).multipliedBy(r);return i.minus(o).dividedBy(i).multipliedBy(100).toNumber()},getMaxSlippage(e,t){const r=NumberUtil.bigNumber(e).dividedBy(100);return NumberUtil.multiply(t,r).toNumber()},getProviderFee:(e,t=.0085)=>NumberUtil.bigNumber(e).multipliedBy(t).toString(),isInsufficientNetworkTokenForGas(e,t){const r=t||"0";return!!NumberUtil.bigNumber(e).isZero()||NumberUtil.bigNumber(NumberUtil.bigNumber(r)).isGreaterThan(e)},isInsufficientSourceTokenForSwap(e,t,r){var n,i;const o=null==(i=null==(n=null==r?void 0:r.find((e=>e.address===t)))?void 0:n.quantity)?void 0:i.numeric;return NumberUtil.bigNumber(o||"0").isLessThan(e)},getToTokenAmount({sourceToken:e,toToken:t,sourceTokenPrice:r,toTokenPrice:n,sourceTokenAmount:i}){if("0"===i)return"0";if(!e||!t)return"0";const o=e.decimals,s=r,a=t.decimals,c=n;if(c<=0)return"0";const l=NumberUtil.bigNumber(i).multipliedBy(.0085),u=NumberUtil.bigNumber(i).minus(l).multipliedBy(NumberUtil.bigNumber(10).pow(o)),d=NumberUtil.bigNumber(s).dividedBy(c),h=o-a;return u.multipliedBy(d).dividedBy(NumberUtil.bigNumber(10).pow(h)).dividedBy(NumberUtil.bigNumber(10).pow(a)).toFixed(a).toString()}},INITIAL_GAS_LIMIT=15e4,TO_AMOUNT_DECIMALS=6,initialState={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:ConstantsUtil$2.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},state$f=proxy$1(initialState),SwapController={state:state$f,subscribe:e=>subscribe$1(state$f,(()=>e(state$f))),subscribeKey:(e,t)=>subscribeKey$1(state$f,e,t),getParams(){var e,t,r,n,i,o,s,a;const c=ChainController.state.activeCaipAddress,l=CoreHelperUtil.getPlainAddress(c),u=ChainController.getActiveNetworkTokenAddress(),d=StorageUtil.getConnectedConnector();if(!l)throw new Error("No address found to swap the tokens from.");const h=!(null==(e=state$f.toToken)?void 0:e.address)||!(null==(t=state$f.toToken)?void 0:t.decimals),p=!(null==(r=state$f.sourceToken)?void 0:r.address)||!(null==(n=state$f.sourceToken)?void 0:n.decimals)||!NumberUtil.bigNumber(state$f.sourceTokenAmount).isGreaterThan(0),f=!state$f.sourceTokenAmount;return{networkAddress:u,fromAddress:l,fromCaipAddress:c,sourceTokenAddress:null==(i=state$f.sourceToken)?void 0:i.address,toTokenAddress:null==(o=state$f.toToken)?void 0:o.address,toTokenAmount:state$f.toTokenAmount,toTokenDecimals:null==(s=state$f.toToken)?void 0:s.decimals,sourceTokenAmount:state$f.sourceTokenAmount,sourceTokenDecimals:null==(a=state$f.sourceToken)?void 0:a.decimals,invalidToToken:h,invalidSourceToken:p,invalidSourceTokenAmount:f,availableToSwap:c&&!h&&!p&&!f,isAuthConnector:"AUTH"===d}},setSourceToken(e){if(!e)return state$f.sourceToken=e,state$f.sourceTokenAmount="",void(state$f.sourceTokenPriceInUSD=0);state$f.sourceToken=e,this.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){state$f.sourceTokenAmount=e},setToToken(e){if(!e)return state$f.toToken=e,state$f.toTokenAmount="",void(state$f.toTokenPriceInUSD=0);state$f.toToken=e,this.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){state$f.toTokenAmount=e?NumberUtil.formatNumberToLocalString(e,TO_AMOUNT_DECIMALS):""},async setTokenPrice(e,t){const{availableToSwap:r}=this.getParams();let n=state$f.tokensPriceMap[e]||0;n||(state$f.loadingPrices=!0,n=await this.getAddressPrice(e)),"sourceToken"===t?state$f.sourceTokenPriceInUSD=n:"toToken"===t&&(state$f.toTokenPriceInUSD=n),state$f.loadingPrices&&(state$f.loadingPrices=!1,r&&this.swapTokens())},switchTokens(){if(state$f.initializing||!state$f.initialized)return;const e=state$f.toToken?{...state$f.toToken}:void 0,t=state$f.sourceToken?{...state$f.sourceToken}:void 0,r=e&&""===state$f.toTokenAmount?"1":state$f.toTokenAmount;this.setSourceToken(e),this.setToToken(t),this.setSourceTokenAmount(r),this.setToTokenAmount(""),this.swapTokens()},resetState(){state$f.myTokensWithBalance=initialState.myTokensWithBalance,state$f.tokensPriceMap=initialState.tokensPriceMap,state$f.initialized=initialState.initialized,state$f.sourceToken=initialState.sourceToken,state$f.sourceTokenAmount=initialState.sourceTokenAmount,state$f.sourceTokenPriceInUSD=initialState.sourceTokenPriceInUSD,state$f.toToken=initialState.toToken,state$f.toTokenAmount=initialState.toTokenAmount,state$f.toTokenPriceInUSD=initialState.toTokenPriceInUSD,state$f.networkPrice=initialState.networkPrice,state$f.networkTokenSymbol=initialState.networkTokenSymbol,state$f.networkBalanceInUSD=initialState.networkBalanceInUSD,state$f.inputError=initialState.inputError},resetValues(){var e;const{networkAddress:t}=this.getParams(),r=null==(e=state$f.tokens)?void 0:e.find((e=>e.address===t));this.setSourceToken(r),this.setToToken(void 0)},getApprovalLoadingState:()=>state$f.loadingApprovalTransaction,clearError(){state$f.transactionError=void 0},async initializeState(){if(!state$f.initializing){if(state$f.initializing=!0,!state$f.initialized)try{await this.fetchTokens(),state$f.initialized=!0}catch(e){state$f.initialized=!1,SnackController.showError("Failed to initialize swap"),RouterController.goBack()}state$f.initializing=!1}},async fetchTokens(){var e;const{networkAddress:t}=this.getParams();await this.getTokenList(),await this.getNetworkTokenPrice(),await this.getMyTokensWithBalance();const r=null==(e=state$f.tokens)?void 0:e.find((e=>e.address===t));r&&(state$f.networkTokenSymbol=r.symbol,this.setSourceToken(r),this.setSourceTokenAmount("1"))},async getTokenList(){const e=await SwapApiUtil.getTokenList();state$f.tokens=e,state$f.popularTokens=e.sort(((e,t)=>e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0)),state$f.suggestedTokens=e.filter((e=>!!ConstantsUtil$2.SWAP_SUGGESTED_TOKENS.includes(e.symbol)),{})},async getAddressPrice(e){var t,r;const n=state$f.tokensPriceMap[e];if(n)return n;const i=(await BlockchainApiController.fetchTokenPrice({projectId:OptionsController.state.projectId,addresses:[e]})).fungibles||[],o=[...state$f.tokens||[],...state$f.myTokensWithBalance||[]],s=null==(t=null==o?void 0:o.find((t=>t.address===e)))?void 0:t.symbol,a=(null==(r=i.find((e=>e.symbol.toLowerCase()===(null==s?void 0:s.toLowerCase()))))?void 0:r.price)||0,c=parseFloat(a.toString());return state$f.tokensPriceMap[e]=c,c},async getNetworkTokenPrice(){var e;const{networkAddress:t}=this.getParams(),r=null==(e=(await BlockchainApiController.fetchTokenPrice({projectId:OptionsController.state.projectId,addresses:[t]}).catch((()=>(SnackController.showError("Failed to fetch network token price"),{fungibles:[]})))).fungibles)?void 0:e[0],n=(null==r?void 0:r.price.toString())||"0";state$f.tokensPriceMap[t]=parseFloat(n),state$f.networkTokenSymbol=(null==r?void 0:r.symbol)||"",state$f.networkPrice=n},async getMyTokensWithBalance(e){const t=await SwapApiUtil.getMyTokensWithBalance(e);t&&(await this.getInitialGasPrice(),this.setBalances(t))},setBalances(e){const{networkAddress:t}=this.getParams(),r=ChainController.state.activeCaipNetwork;if(!r)return;const n=e.find((e=>e.address===t));e.forEach((e=>{state$f.tokensPriceMap[e.address]=e.price||0})),state$f.myTokensWithBalance=e.filter((e=>e.address.startsWith(r.caipNetworkId))),state$f.networkBalanceInUSD=n?NumberUtil.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var e,t;const r=await SwapApiUtil.fetchGasPrice();if(!r)return{gasPrice:null,gasPriceInUSD:null};if("solana"===(null==(t=null==(e=ChainController.state)?void 0:e.activeCaipNetwork)?void 0:t.chainNamespace))return state$f.gasFee=r.standard,state$f.gasPriceInUSD=NumberUtil.multiply(r.standard,state$f.networkPrice).dividedBy(1e9).toNumber(),{gasPrice:BigInt(state$f.gasFee),gasPriceInUSD:Number(state$f.gasPriceInUSD)};{const e=r.standard,t=BigInt(e),n=BigInt(INITIAL_GAS_LIMIT),i=SwapCalculationUtil.getGasPriceInUSD(state$f.networkPrice,n,t);return state$f.gasFee=e,state$f.gasPriceInUSD=i,{gasPrice:t,gasPriceInUSD:i}}},async swapTokens(){var e,t;const r=AccountController.state.address,n=state$f.sourceToken,i=state$f.toToken,o=NumberUtil.bigNumber(state$f.sourceTokenAmount).isGreaterThan(0);if(!i||!n||state$f.loadingPrices||!o)return;state$f.loadingQuote=!0;const s=NumberUtil.bigNumber(state$f.sourceTokenAmount).multipliedBy(10**n.decimals).integerValue(),a=await BlockchainApiController.fetchSwapQuote({userAddress:r,projectId:OptionsController.state.projectId,from:n.address,to:i.address,gasPrice:state$f.gasFee,amount:s.toString()});state$f.loadingQuote=!1;const c=null==(t=null==(e=null==a?void 0:a.quotes)?void 0:e[0])?void 0:t.toAmount;if(!c)return;const l=NumberUtil.bigNumber(c).dividedBy(10**i.decimals).toString();this.setToTokenAmount(l);this.hasInsufficientToken(state$f.sourceTokenAmount,n.address)?state$f.inputError="Insufficient balance":(state$f.inputError=void 0,this.setTransactionDetails())},async getTransaction(){const{fromCaipAddress:e,availableToSwap:t}=this.getParams(),r=state$f.sourceToken,n=state$f.toToken;if(e&&t&&r&&n&&!state$f.loadingQuote)try{state$f.loadingBuildTransaction=!0;let t;return t=await SwapApiUtil.fetchSwapAllowance({userAddress:e,tokenAddress:r.address,sourceTokenAmount:state$f.sourceTokenAmount,sourceTokenDecimals:r.decimals})?await this.createSwapTransaction():await this.createAllowanceTransaction(),state$f.loadingBuildTransaction=!1,state$f.fetchError=!1,t}catch(i){return RouterController.goBack(),SnackController.showError("Failed to check allowance"),state$f.loadingBuildTransaction=!1,state$f.approvalTransaction=void 0,state$f.swapTransaction=void 0,void(state$f.fetchError=!0)}},async createAllowanceTransaction(){const{fromCaipAddress:e,fromAddress:t,sourceTokenAddress:r,toTokenAddress:n}=this.getParams();if(e&&n){if(!r)throw new Error("createAllowanceTransaction - No source token address found.");try{const i=await BlockchainApiController.generateApproveCalldata({projectId:OptionsController.state.projectId,from:r,to:n,userAddress:e}),o=await ConnectionController.estimateGas({address:t,to:CoreHelperUtil.getPlainAddress(i.tx.to),data:i.tx.data}),s={data:i.tx.data,to:CoreHelperUtil.getPlainAddress(i.tx.from),gas:o,gasPrice:BigInt(i.tx.eip155.gasPrice),value:BigInt(i.tx.value),toAmount:state$f.toTokenAmount};return state$f.swapTransaction=void 0,state$f.approvalTransaction=s,s}catch(i){return RouterController.goBack(),SnackController.showError("Failed to create approval transaction"),state$f.approvalTransaction=void 0,state$f.swapTransaction=void 0,void(state$f.fetchError=!0)}}},async createSwapTransaction(){const{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:r}=this.getParams(),n=state$f.sourceToken,i=state$f.toToken;if(!(t&&r&&n&&i))return;const o=ConnectionController.parseUnits(r,n.decimals).toString();try{const r=await BlockchainApiController.generateSwapCalldata({projectId:OptionsController.state.projectId,userAddress:t,from:n.address,to:i.address,amount:o}),s=n.address===e,a=BigInt(r.tx.eip155.gas),c=BigInt(r.tx.eip155.gasPrice),l={data:r.tx.data,to:CoreHelperUtil.getPlainAddress(r.tx.to),gas:a,gasPrice:c,value:s?BigInt(o):BigInt("0"),toAmount:state$f.toTokenAmount};return state$f.gasPriceInUSD=SwapCalculationUtil.getGasPriceInUSD(state$f.networkPrice,a,c),state$f.approvalTransaction=void 0,state$f.swapTransaction=l,l}catch(s){return RouterController.goBack(),SnackController.showError("Failed to create transaction"),state$f.approvalTransaction=void 0,state$f.swapTransaction=void 0,void(state$f.fetchError=!0)}},async sendTransactionForApproval(e){const{fromAddress:t,isAuthConnector:r}=this.getParams();state$f.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";r?RouterController.pushTransactionStack({view:null,goBack:!0,onSuccess(){SnackController.showLoading(n)}}):SnackController.showLoading(n);try{await ConnectionController.sendTransaction({address:t,to:e.to,data:e.data,value:BigInt(e.value),gasPrice:BigInt(e.gasPrice)}),await this.swapTokens(),await this.getTransaction(),state$f.approvalTransaction=void 0,state$f.loadingApprovalTransaction=!1}catch(i){const e=i;state$f.transactionError=null==e?void 0:e.shortMessage,state$f.loadingApprovalTransaction=!1,SnackController.showError((null==e?void 0:e.shortMessage)||"Transaction error")}},async sendTransactionForSwap(e){var t,r,n,i,o,s,a,c,l,u,d,h;if(!e)return;const{fromAddress:p,toTokenAmount:f,isAuthConnector:m}=this.getParams();state$f.loadingTransaction=!0;const g=`Swapping ${null==(t=state$f.sourceToken)?void 0:t.symbol} to ${NumberUtil.formatNumberToLocalString(f,3)} ${null==(r=state$f.toToken)?void 0:r.symbol}`,b=`Swapped ${null==(n=state$f.sourceToken)?void 0:n.symbol} to ${NumberUtil.formatNumberToLocalString(f,3)} ${null==(i=state$f.toToken)?void 0:i.symbol}`;m?RouterController.pushTransactionStack({view:"Account",goBack:!1,onSuccess(){SnackController.showLoading(g),SwapController.resetState()}}):SnackController.showLoading("Confirm transaction in your wallet");try{const t=[null==(o=state$f.sourceToken)?void 0:o.address,null==(s=state$f.toToken)?void 0:s.address].join(","),r=await ConnectionController.sendTransaction({address:p,to:e.to,data:e.data,gas:e.gas,gasPrice:BigInt(e.gasPrice),value:e.value});return state$f.loadingTransaction=!1,SnackController.showSuccess(b),EventsController.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:(null==(a=ChainController.state.activeCaipNetwork)?void 0:a.caipNetworkId)||"",swapFromToken:(null==(c=this.state.sourceToken)?void 0:c.symbol)||"",swapToToken:(null==(l=this.state.toToken)?void 0:l.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),SwapController.resetState(),m||RouterController.replace("Account"),SwapController.getMyTokensWithBalance(t),r}catch(y){const e=y;return state$f.transactionError=null==e?void 0:e.shortMessage,state$f.loadingTransaction=!1,SnackController.showError((null==e?void 0:e.shortMessage)||"Transaction error"),void EventsController.sendEvent({type:"track",event:"SWAP_ERROR",properties:{network:(null==(u=ChainController.state.activeCaipNetwork)?void 0:u.caipNetworkId)||"",swapFromToken:(null==(d=this.state.sourceToken)?void 0:d.symbol)||"",swapToToken:(null==(h=this.state.toToken)?void 0:h.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}})}},hasInsufficientToken(e,t){const r=SwapCalculationUtil.isInsufficientSourceTokenForSwap(e,t,state$f.myTokensWithBalance);if(AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT)return!0;return SwapCalculationUtil.isInsufficientNetworkTokenForGas(state$f.networkBalanceInUSD,state$f.gasPriceInUSD)||r},setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=this.getParams();e&&t&&(state$f.gasPriceInUSD=SwapCalculationUtil.getGasPriceInUSD(state$f.networkPrice,BigInt(state$f.gasFee),BigInt(INITIAL_GAS_LIMIT)),state$f.priceImpact=SwapCalculationUtil.getPriceImpact({sourceTokenAmount:state$f.sourceTokenAmount,sourceTokenPriceInUSD:state$f.sourceTokenPriceInUSD,toTokenPriceInUSD:state$f.toTokenPriceInUSD,toTokenAmount:state$f.toTokenAmount}),state$f.maxSlippage=SwapCalculationUtil.getMaxSlippage(state$f.slippage,state$f.toTokenAmount),state$f.providerFee=SwapCalculationUtil.getProviderFee(state$f.sourceTokenAmount))}},state$e=proxy$1({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),AccountController={state:state$e,replaceState(e){e&&Object.assign(state$e,ref$2(e))},subscribe:e=>ChainController.subscribeChainProp("accountState",(t=>{if(t)return e(t)})),subscribeKey(e,t,r){let n;return ChainController.subscribeChainProp("accountState",(r=>{if(r){const i=r[e];n!==i&&(n=i,t(i))}}),r)},setStatus(e,t){ChainController.setAccountProp("status",e,t)},getCaipAddress:e=>ChainController.getAccountProp("caipAddress",e),setProvider(e,t){e&&ChainController.setAccountProp("provider",e,t)},setCaipAddress(e,t){const r=e?CoreHelperUtil.getPlainAddress(e):void 0;ChainController.state.activeCaipAddress=e,ChainController.setAccountProp("caipAddress",e,t),ChainController.setAccountProp("address",r,t)},setBalance(e,t,r){ChainController.setAccountProp("balance",e,r),ChainController.setAccountProp("balanceSymbol",t,r)},setProfileName(e,t){ChainController.setAccountProp("profileName",e,t)},setProfileImage(e,t){ChainController.setAccountProp("profileImage",e,t)},setAddressExplorerUrl(e,t){ChainController.setAccountProp("addressExplorerUrl",e,t)},setSmartAccountDeployed(e,t){ChainController.setAccountProp("smartAccountDeployed",e,t)},setCurrentTab(e){ChainController.setAccountProp("currentTab",e,ChainController.state.activeChain)},setTokenBalance(e,t){e&&ChainController.setAccountProp("tokenBalance",e,t)},setShouldUpdateToAddress(e,t){ChainController.setAccountProp("shouldUpdateToAddress",e,t)},setAllAccounts(e,t){ChainController.setAccountProp("allAccounts",e,t)},addAddressLabel(e,t,r){const n=ChainController.getAccountProp("addressLabels",r)||new Map;n.set(e,t),ChainController.setAccountProp("addressLabels",n,r)},removeAddressLabel(e,t){const r=ChainController.getAccountProp("addressLabels",t)||new Map;r.delete(e),ChainController.setAccountProp("addressLabels",r,t)},setConnectedWalletInfo(e,t){ChainController.setAccountProp("connectedWalletInfo",e,t,!1)},setPreferredAccountType(e,t){ChainController.setAccountProp("preferredAccountType",e,t)},setSocialProvider(e,t){e&&ChainController.setAccountProp("socialProvider",e,t)},setSocialWindow(e,t){e&&ChainController.setAccountProp("socialWindow",ref$2(e),t)},setFarcasterUrl(e,t){e&&ChainController.setAccountProp("farcasterUrl",e,t)},async fetchTokenBalance(){var e,t;const r=null==(e=ChainController.state.activeCaipNetwork)?void 0:e.caipNetworkId,n=null==(t=ChainController.state.activeCaipNetwork)?void 0:t.chainNamespace,i=ChainController.state.activeCaipAddress,o=i?CoreHelperUtil.getPlainAddress(i):void 0;try{if(o&&r&&n){const e=await BlockchainApiController.getBalance(o,r),t=e.balances.filter((e=>"0"!==e.quantity.decimals));this.setTokenBalance(t,n),SwapController.setBalances(SwapApiUtil.mapBalancesToSwapTokens(e.balances))}}catch(s){SnackController.showError("Failed to fetch token balance")}},resetAccount(e){ChainController.resetAccount(e)},setSiweStatus(e){ChainController.setAccountProp("siweStatus",e,ChainController.state.activeChain)}},state$d=proxy$1({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0}),PublicStateController={state:state$d,subscribe:e=>subscribe$1(state$d,(()=>e(state$d))),set(e){Object.assign(state$d,{...state$d,...e})}},accountState={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]},networkState={supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},state$c=proxy$1({chains:proxyMap(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0}}),ChainController={state:state$c,subscribe:e=>subscribe$1(state$c,(()=>{e(state$c)})),subscribeKey:(e,t)=>subscribeKey$1(state$c,e,t),subscribeChainProp(e,t,r){let n;return subscribe$1(state$c.chains,(()=>{var i;const o=r||state$c.activeChain;if(o){const r=null==(i=state$c.chains.get(o))?void 0:i[e];n!==r&&(n=r,t(r))}}))},initialize(e){const t=null==e?void 0:e[0];0===(null==e?void 0:e.length)&&(state$c.noAdapters=!0),state$c.noAdapters||(state$c.activeChain=null==t?void 0:t.chainNamespace,PublicStateController.set({activeChain:null==t?void 0:t.chainNamespace}),e.forEach((e=>{state$c.chains.set(e.chainNamespace,{chainNamespace:e.chainNamespace,connectionControllerClient:e.connectionControllerClient,networkControllerClient:e.networkControllerClient,adapterType:e.adapterType,accountState:accountState,networkState:networkState,caipNetworks:e.caipNetworks})})))},initializeUniversalAdapter(e,t){var r,n;if(state$c.universalAdapter=e,0===t.length){const t=StorageUtil.getStoredActiveCaipNetwork();try{state$c.activeChain=t?t.chainNamespace:(null==(r=null==e?void 0:e.defaultNetwork)?void 0:r.chainNamespace)??(null==(n=e.caipNetworks[0])?void 0:n.chainNamespace)}catch(i){console.warn(">>> Error setting active caip network",i)}}[...new Set(e.caipNetworks.map((e=>e.chainNamespace)))].forEach((t=>{state$c.chains.set(t,{chainNamespace:t,connectionControllerClient:void 0,networkControllerClient:void 0,adapterType:e.adapterType,accountState:accountState,networkState:networkState,caipNetworks:e.caipNetworks})}))},setAdapterNetworkState(e,t){const r=state$c.chains.get(e);r&&(r.networkState=ref$2({...r.networkState,...t}),state$c.chains.set(e,ref$2(r)))},setChainAccountData(e,t,r=!0){if(!e)throw new Error("Chain is required to update chain account data");const n=state$c.chains.get(e);n&&(n.accountState=ref$2({...n.accountState,...t}),state$c.chains.set(e,n),(r||1===state$c.chains.size||state$c.activeChain===e)&&(t.caipAddress&&(state$c.activeCaipAddress=t.caipAddress),AccountController.replaceState(n.accountState)))},setAccountProp(e,t,r,n=!0){this.setChainAccountData(r,{[e]:t},n)},setActiveNamespace(e){var t,r;state$c.activeChain=e;const n=e?state$c.chains.get(e):void 0,i=null==(t=null==n?void 0:n.networkState)?void 0:t.caipNetwork;(null==i?void 0:i.id)&&(state$c.activeCaipAddress=null==(r=null==n?void 0:n.accountState)?void 0:r.caipAddress,state$c.activeCaipNetwork=i,SafeLocalStorage.setItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID,null==i?void 0:i.caipNetworkId),PublicStateController.set({activeChain:e,selectedNetworkId:null==i?void 0:i.caipNetworkId}))},setActiveCaipNetwork(e){var t,r;if(!e)return;const n=state$c.chains.get(e.chainNamespace);state$c.activeChain=e.chainNamespace,state$c.activeCaipNetwork=e,state$c.activeCaipAddress=null==(t=null==n?void 0:n.accountState)?void 0:t.caipAddress,n&&AccountController.replaceState(n.accountState),PublicStateController.set({activeChain:state$c.activeChain,selectedNetworkId:null==(r=state$c.activeCaipNetwork)?void 0:r.caipNetworkId}),SafeLocalStorage.setItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID,e.caipNetworkId);this.checkIfSupportedNetwork(e.chainNamespace)||this.showUnsupportedChainUI()},async switchActiveNetwork(e){const t=this.getNetworkControllerClient(e.chainNamespace);t&&await t.switchCaipNetwork(e),this.setActiveCaipNetwork(e),e&&EventsController.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}})},setActiveConnector(e){e&&(state$c.activeConnector=ref$2(e))},getNetworkControllerClient(e){const t=SafeLocalStorage.getItem(SafeLocalStorageKeys.WALLET_ID),r=e||state$c.activeChain,n="walletConnect"===t,i=state$c.universalAdapter.networkControllerClient;if(n||state$c.noAdapters){if(!i)throw new Error("Universal Adapter's networkControllerClient is not set");return i}if(!r)throw new Error("Chain is required to get network controller client");const o=state$c.chains.get(r);if(!o)throw new Error("Chain adapter not found");if(!o.networkControllerClient)throw new Error("NetworkController client not set");return o.networkControllerClient},getConnectionControllerClient(e){var t;const r=e||state$c.activeChain,n="WALLET_CONNECT"===SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_CONNECTOR),i=state$c.universalAdapter.connectionControllerClient,o="wagmi"===(null==(t=state$c.chains.get("eip155"))?void 0:t.adapterType);if(n&&!o||state$c.noAdapters){if(!i)throw new Error("Universal Adapter's ConnectionControllerClient is not set");return i}if(!r)throw new Error("Chain is required to get connection controller client");const s=state$c.chains.get(r);if(!s)throw new Error("Chain adapter not found");if(!s.connectionControllerClient)throw new Error("ConnectionController client not set");return s.connectionControllerClient},getAccountProp(e,t){var r;let n=state$c.activeChain;if(t&&(n=t),!n)return;const i=null==(r=state$c.chains.get(n))?void 0:r.accountState;return i?i[e]:void 0},getNetworkProp(e,t){var r;const n=null==(r=state$c.chains.get(t))?void 0:r.networkState;if(n)return n[e]},getRequestedCaipNetworks(e){const t=state$c.chains.get(e),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:n=[]}=(null==t?void 0:t.networkState)||{};return CoreHelperUtil.sortRequestedNetworks(r,n)},getAllRequestedCaipNetworks(){const e=[];return state$c.chains.forEach((t=>{const r=this.getRequestedCaipNetworks(t.chainNamespace);e.push(...r)})),e},setRequestedCaipNetworks(e,t){this.setAdapterNetworkState(t,{requestedCaipNetworks:e})},getAllApprovedCaipNetworkIds(){const e=[];return state$c.chains.forEach((t=>{const r=this.getApprovedCaipNetworkIds(t.chainNamespace);e.push(...r)})),e},getActiveCaipNetwork:()=>state$c.activeCaipNetwork,getActiveCaipAddress:()=>state$c.activeCaipAddress,getApprovedCaipNetworkIds(e){var t;const r=state$c.chains.get(e);return(null==(t=null==r?void 0:r.networkState)?void 0:t.approvedCaipNetworkIds)||[]},async setApprovedCaipNetworksData(e){const t=this.getNetworkControllerClient(),r=await(null==t?void 0:t.getApprovedCaipNetworksData());this.setAdapterNetworkState(e,{approvedCaipNetworkIds:null==r?void 0:r.approvedCaipNetworkIds,supportsAllNetworks:null==r?void 0:r.supportsAllNetworks})},checkIfSupportedNetwork(e){const t=this.state.activeCaipNetwork,r=this.getRequestedCaipNetworks(e);return!r.length||(null==r?void 0:r.some((e=>e.id===(null==t?void 0:t.id))))},setSmartAccountEnabledNetworks(e,t){this.setAdapterNetworkState(t,{smartAccountEnabledNetworks:e})},checkIfSmartAccountEnabled(){var e;const t=NetworkUtil.caipNetworkIdToNumber(null==(e=state$c.activeCaipNetwork)?void 0:e.caipNetworkId),r=this.state.activeChain;if(!r||!t)return!1;const n=this.getNetworkProp("smartAccountEnabledNetworks",r);return Boolean(null==n?void 0:n.includes(Number(t)))},getActiveNetworkTokenAddress(){var e,t;const r=(null==(e=this.state.activeCaipNetwork)?void 0:e.chainNamespace)||"eip155";return`${r}:${(null==(t=this.state.activeCaipNetwork)?void 0:t.id)||1}:${ConstantsUtil$2.NATIVE_TOKEN_ADDRESS[r]}`},showUnsupportedChainUI(){setTimeout((()=>{ModalController.open({view:"UnsupportedChain"})}),300)},checkIfNamesSupported(){const e=state$c.activeCaipNetwork;return Boolean((null==e?void 0:e.chainNamespace)&&ConstantsUtil$2.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){this.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(e){const t=e;if(!t)throw new Error("Chain is required to set account prop");this.state.activeCaipAddress=void 0,this.setChainAccountData(t,ref$2({smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,provider:void 0}))}},StorageUtil={setWalletConnectDeepLink({name:e,href:t}){try{SafeLocalStorage.setItem(SafeLocalStorageKeys.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{SafeLocalStorage.removeItem(SafeLocalStorageKeys.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setAppKitRecent(e){try{const t=StorageUtil.getRecentWallets();t.find((t=>t.id===e.id))||(t.unshift(e),t.length>2&&t.pop(),SafeLocalStorage.setItem(SafeLocalStorageKeys.RECENT_WALLETS,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnector(e){try{SafeLocalStorage.setItem(SafeLocalStorageKeys.CONNECTED_CONNECTOR,e)}catch{console.info("Unable to set Connected Connector")}},getConnectedConnector(){try{return SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_CONNECTOR)}catch{console.info("Unable to get Connected Connector")}},setConnectedSocialProvider(e){try{SafeLocalStorage.setItem(SafeLocalStorageKeys.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set Connected Social Provider")}},getConnectedSocialProvider(){try{return SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_SOCIAL)}catch{console.info("Unable to get Connected Social Provider")}},getConnectedSocialUsername(){try{return SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get Connected Social Username")}},getStoredActiveCaipNetwork(){const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID),t=ChainController.getAllRequestedCaipNetworks();return null==t?void 0:t.find((t=>t.caipNetworkId===e))}},state$b=proxy$1({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),AssetController={state:state$b,subscribeNetworkImages:e=>subscribe$1(state$b.networkImages,(()=>e(state$b.networkImages))),subscribeKey:(e,t)=>subscribeKey$1(state$b,e,t),subscribe:e=>subscribe$1(state$b,(()=>e(state$b))),setWalletImage(e,t){state$b.walletImages[e]=t},setNetworkImage(e,t){state$b.networkImages[e]=t},setChainImage(e,t){state$b.chainImages[e]=t},setConnectorImage(e,t){state$b.connectorImages[e]=t},setTokenImage(e,t){state$b.tokenImages[e]=t},setCurrencyImage(e,t){state$b.currencyImages[e]=t}},baseUrl=CoreHelperUtil.getApiUrl(),api$2=new FetchUtil({baseUrl:baseUrl,clientId:null}),entries="40",recommendedEntries="4",imageCountToFetch=20,state$a=proxy$1({page:1,count:0,featured:[],recommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedRDNS:[]}),ApiController={state:state$a,subscribeKey:(e,t)=>subscribeKey$1(state$a,e,t),_getApiHeaders(){const{projectId:e,sdkType:t,sdkVersion:r}=OptionsController.state;return{"x-project-id":e,"x-sdk-type":t||"appkit","x-sdk-version":r||"html-wagmi-4.2.2"}},_filterOutExtensions:e=>OptionsController.state.isUniversalProvider?e.filter((e=>Boolean(e.mobile_link||e.desktop_link||e.webapp_link))):e,async _fetchWalletImage(e){const t=`${api$2.baseUrl}/getWalletImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setWalletImage(e,URL.createObjectURL(r))},async _fetchNetworkImage(e){const t=`${api$2.baseUrl}/public/getAssetImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setNetworkImage(e,URL.createObjectURL(r))},async _fetchConnectorImage(e){const t=`${api$2.baseUrl}/public/getAssetImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setConnectorImage(e,URL.createObjectURL(r))},async _fetchCurrencyImage(e){const t=`${api$2.baseUrl}/public/getCurrencyImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setCurrencyImage(e,URL.createObjectURL(r))},async _fetchTokenImage(e){const t=`${api$2.baseUrl}/public/getTokenImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setTokenImage(e,URL.createObjectURL(r))},async fetchNetworkImages(){const e=ChainController.getAllRequestedCaipNetworks(),t=null==e?void 0:e.map((({assets:e})=>null==e?void 0:e.imageId)).filter(Boolean);t&&await Promise.allSettled(t.map((e=>ApiController._fetchNetworkImage(e))))},async fetchConnectorImages(){const{connectors:e}=ConnectorController.state,t=e.map((({imageId:e})=>e)).filter(Boolean);await Promise.allSettled(t.map((e=>ApiController._fetchConnectorImage(e))))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map((e=>ApiController._fetchCurrencyImage(e))))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map((e=>ApiController._fetchTokenImage(e))))},async fetchFeaturedWallets(){const{featuredWalletIds:e}=OptionsController.state;if(null==e?void 0:e.length){const{data:t}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",entries:(null==e?void 0:e.length)?String(e.length):recommendedEntries,include:null==e?void 0:e.join(",")}});t.sort(((t,r)=>e.indexOf(t.id)-e.indexOf(r.id)));const r=t.map((e=>e.image_id)).filter(Boolean);await Promise.allSettled(r.map((e=>ApiController._fetchWalletImage(e)))),state$a.featured=t}},async fetchRecommendedWallets(){var e;try{const{includeWalletIds:t,excludeWalletIds:r,featuredWalletIds:n}=OptionsController.state,i=[...r??[],...n??[]].filter(Boolean),{data:o,count:s}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",chains:null==(e=ChainController.state.activeCaipNetwork)?void 0:e.caipNetworkId,entries:recommendedEntries,include:null==t?void 0:t.join(","),exclude:null==i?void 0:i.join(",")}}),a=StorageUtil.getRecentWallets(),c=o.map((e=>e.image_id)).filter(Boolean),l=a.map((e=>e.image_id)).filter(Boolean);await Promise.allSettled([...c,...l].map((e=>ApiController._fetchWalletImage(e)))),state$a.recommended=o,state$a.count=s??0}catch{}},async fetchWallets({page:e}){var t;const{includeWalletIds:r,excludeWalletIds:n,featuredWalletIds:i}=OptionsController.state,o=[...state$a.recommended.map((({id:e})=>e)),...n??[],...i??[]].filter(Boolean),{data:s,count:a}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:String(e),entries:entries,chains:null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId,include:null==r?void 0:r.join(","),exclude:o.join(",")}}),c=s.slice(0,imageCountToFetch).map((e=>e.image_id)).filter(Boolean);await Promise.allSettled(c.map((e=>ApiController._fetchWalletImage(e)))),state$a.wallets=CoreHelperUtil.uniqueBy([...state$a.wallets,...ApiController._filterOutExtensions(s)],"id"),state$a.count=a>state$a.count?a:state$a.count,state$a.page=e},async searchWalletByIds({ids:e}){var t;const{data:r}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",entries:String(e.length),chains:null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId,include:null==e?void 0:e.join(",")}});r&&r.forEach((e=>{(null==e?void 0:e.rdns)&&state$a.excludedRDNS.push(e.rdns)}))},async searchWallet({search:e}){var t;const{includeWalletIds:r,excludeWalletIds:n}=OptionsController.state;state$a.search=[];const{data:i}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",entries:"100",search:null==e?void 0:e.trim(),chains:null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId,include:null==r?void 0:r.join(","),exclude:null==n?void 0:n.join(",")}}),o=i.map((e=>e.image_id)).filter(Boolean);await Promise.allSettled([...o.map((e=>ApiController._fetchWalletImage(e))),CoreHelperUtil.wait(300)]),state$a.search=ApiController._filterOutExtensions(i)},async reFetchWallets(){state$a.page=1,state$a.wallets=[],await ApiController.fetchFeaturedWallets(),await ApiController.fetchRecommendedWallets()},prefetch(){var e;const t=[ApiController.fetchFeaturedWallets(),ApiController.fetchRecommendedWallets(),ApiController.fetchNetworkImages(),ApiController.fetchConnectorImages()];(null==(e=OptionsController.state.features)?void 0:e.analytics)&&t.push(ApiController.fetchAnalyticsConfig()),state$a.prefetchPromise=Promise.race([Promise.allSettled(t)])},async fetchAnalyticsConfig(){const{isAnalyticsEnabled:e}=await api$2.get({path:"/getAnalyticsConfig",headers:ApiController._getApiHeaders()});OptionsController.setFeatures({analytics:e})}},state$9=proxy$1({loading:!1,open:!1,shake:!1}),ModalController={state:state$9,subscribe:e=>subscribe$1(state$9,(()=>e(state$9))),subscribeKey:(e,t)=>subscribeKey$1(state$9,e,t),async open(e){await ApiController.state.prefetchPromise;const t=ChainController.state.activeCaipAddress,r=ChainController.state.noAdapters;(null==e?void 0:e.view)?RouterController.reset(e.view):t?RouterController.reset("Account"):r&&!CoreHelperUtil.isMobile()?RouterController.reset("ConnectingWalletConnect"):RouterController.reset("Connect"),state$9.open=!0,PublicStateController.set({open:!0}),EventsController.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:Boolean(t)}})},close(){const e=Boolean(ChainController.state.activeCaipAddress);state$9.open=!1,PublicStateController.set({open:!1}),EventsController.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:e}})},setLoading(e){state$9.loading=e,PublicStateController.set({loading:e})},shake(){state$9.shake||(state$9.shake=!0,setTimeout((()=>{state$9.shake=!1}),500))}},USDC_CURRENCY_DEFAULT={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},USD_CURRENCY_DEFAULT={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},defaultState={providers:ONRAMP_PROVIDERS,selectedProvider:null,error:null,purchaseCurrency:USDC_CURRENCY_DEFAULT,paymentCurrency:USD_CURRENCY_DEFAULT,purchaseCurrencies:[USDC_CURRENCY_DEFAULT],paymentCurrencies:[],quotesLoading:!1},state$8=proxy$1(defaultState),OnRampController={state:state$8,subscribe:e=>subscribe$1(state$8,(()=>e(state$8))),subscribeKey:(e,t)=>subscribeKey$1(state$8,e,t),setSelectedProvider(e){if(e&&"meld"===e.name){const t="production"===process$1.env.NODE_ENV?MELD_PROD_PUBLIC_KEY:MELD_DEV_PUBLIC_KEY,r=ChainController.state.activeChain===ConstantsUtil$3.CHAIN.SOLANA?"SOL":"USDC",n=AccountController.state.address??"",i=new URL(e.url);i.searchParams.append("publicKey",t),i.searchParams.append("destinationCurrencyCode",r),i.searchParams.append("walletAddress",n),e.url=i.toString()}state$8.selectedProvider=e},setPurchaseCurrency(e){state$8.purchaseCurrency=e},setPaymentCurrency(e){state$8.paymentCurrency=e},setPurchaseAmount(e){this.state.purchaseAmount=e},setPaymentAmount(e){this.state.paymentAmount=e},async getAvailableCurrencies(){const e=await BlockchainApiController.getOnrampOptions();state$8.purchaseCurrencies=e.purchaseCurrencies,state$8.paymentCurrencies=e.paymentCurrencies,state$8.paymentCurrency=e.paymentCurrencies[0]||USD_CURRENCY_DEFAULT,state$8.purchaseCurrency=e.purchaseCurrencies[0]||USDC_CURRENCY_DEFAULT,await ApiController.fetchCurrencyImages(e.paymentCurrencies.map((e=>e.id))),await ApiController.fetchTokenImages(e.purchaseCurrencies.map((e=>e.symbol)))},async getQuote(){var e,t;state$8.quotesLoading=!0;try{const r=await BlockchainApiController.getOnrampQuote({purchaseCurrency:state$8.purchaseCurrency,paymentCurrency:state$8.paymentCurrency,amount:(null==(e=state$8.paymentAmount)?void 0:e.toString())||"0",network:null==(t=state$8.purchaseCurrency)?void 0:t.symbol});return state$8.quotesLoading=!1,state$8.purchaseAmount=Number(r.purchaseAmount.amount),r}catch(r){return state$8.error=r.message,state$8.quotesLoading=!1,null}finally{state$8.quotesLoading=!1}},resetState(){state$8.providers=ONRAMP_PROVIDERS,state$8.selectedProvider=null,state$8.error=null,state$8.purchaseCurrency=USDC_CURRENCY_DEFAULT,state$8.paymentCurrency=USD_CURRENCY_DEFAULT,state$8.purchaseCurrencies=[USDC_CURRENCY_DEFAULT],state$8.paymentCurrencies=[],state$8.paymentAmount=void 0,state$8.purchaseAmount=void 0,state$8.quotesLoading=!1}},state$7=proxy$1({loading:!1}),SendController={state:state$7,subscribe:e=>subscribe$1(state$7,(()=>e(state$7))),subscribeKey:(e,t)=>subscribeKey$1(state$7,e,t),setToken(e){e&&(state$7.token=ref$2(e))},setTokenAmount(e){state$7.sendTokenAmount=e},setReceiverAddress(e){state$7.receiverAddress=e},setReceiverProfileImageUrl(e){state$7.receiverProfileImageUrl=e},setReceiverProfileName(e){state$7.receiverProfileName=e},setGasPrice(e){state$7.gasPrice=e},setGasPriceInUsd(e){state$7.gasPriceInUSD=e},setLoading(e){state$7.loading=e},sendToken(){var e;switch(null==(e=ChainController.state.activeCaipNetwork)?void 0:e.chainNamespace){case"eip155":return void this.sendEvmToken();case"solana":return void this.sendSolanaToken();default:throw new Error("Unsupported chain")}},sendEvmToken(){var e,t,r,n,i;(null==(e=this.state.token)?void 0:e.address)&&this.state.sendTokenAmount&&this.state.receiverAddress?(EventsController.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:(null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId)||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&(null==(r=this.state.token)?void 0:r.quantity.decimals)&&(EventsController.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:null==(n=this.state.token)?void 0:n.symbol,amount:this.state.sendTokenAmount,network:(null==(i=ChainController.state.activeCaipNetwork)?void 0:i.caipNetworkId)||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async sendNativeToken(e){var t,r,n,i;RouterController.pushTransactionStack({view:"Account",goBack:!1});const o=e.receiverAddress,s=AccountController.state.address,a=ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{await ConnectionController.sendTransaction({to:o,address:s,data:"0x",value:a,gasPrice:e.gasPrice}),SnackController.showSuccess("Transaction started"),EventsController.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:(null==(t=this.state.token)?void 0:t.symbol)||"",amount:e.sendTokenAmount,network:(null==(r=ChainController.state.activeCaipNetwork)?void 0:r.caipNetworkId)||""}}),this.resetSend()}catch(c){EventsController.sendEvent({type:"track",event:"SEND_ERROR",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:(null==(n=this.state.token)?void 0:n.symbol)||"",amount:e.sendTokenAmount,network:(null==(i=ChainController.state.activeCaipNetwork)?void 0:i.caipNetworkId)||""}}),SnackController.showError("Something went wrong")}},async sendERC20Token(e){RouterController.pushTransactionStack({view:"Account",goBack:!1});const t=ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{if(AccountController.state.address&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){const r=CoreHelperUtil.getPlainAddress(e.tokenAddress);await ConnectionController.writeContract({fromAddress:AccountController.state.address,tokenAddress:r,receiverAddress:e.receiverAddress,tokenAmount:t,method:"transfer",abi:ContractUtil.getERC20Abi(r)}),SnackController.showSuccess("Transaction started"),this.resetSend()}}catch(r){SnackController.showError("Something went wrong")}},sendSolanaToken(){this.state.sendTokenAmount&&this.state.receiverAddress?(RouterController.pushTransactionStack({view:"Account",goBack:!1}),ConnectionController.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then((()=>{this.resetSend(),AccountController.fetchTokenBalance()})).catch((e=>{SnackController.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",e)}))):SnackController.showError("Please enter a valid amount and receiver address")},resetSend(){state$7.token=void 0,state$7.sendTokenAmount=void 0,state$7.receiverAddress=void 0,state$7.receiverProfileImageUrl=void 0,state$7.receiverProfileName=void 0,state$7.loading=!1}},state$6=proxy$1({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),TooltipController={state:state$6,subscribe:e=>subscribe$1(state$6,(()=>e(state$6))),subscribeKey:(e,t)=>subscribeKey$1(state$6,e,t),showTooltip({message:e,triggerRect:t,variant:r}){state$6.open=!0,state$6.message=e,state$6.triggerRect=t,state$6.variant=r},hide(){state$6.open=!1,state$6.message="",state$6.triggerRect={width:0,height:0,top:0,left:0}}},SLIP44_MSB=2147483648,EnsUtil={convertEVMChainIdToCoinType(e){if(e>=SLIP44_MSB)throw new Error("Invalid chainId");return(SLIP44_MSB|e)>>>0}},state$5=proxy$1({suggestions:[],loading:!1}),EnsController={state:state$5,subscribe:e=>subscribe$1(state$5,(()=>e(state$5))),subscribeKey:(e,t)=>subscribeKey$1(state$5,e,t),async resolveName(e){var t,r;try{return await BlockchainApiController.lookupEnsName(e)}catch(e2){throw new Error((null==(r=null==(t=null==e2?void 0:e2.reasons)?void 0:t[0])?void 0:r.description)||"Error resolving name")}},async isNameRegistered(e){try{return await BlockchainApiController.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{state$5.loading=!0,state$5.suggestions=[];const t=await BlockchainApiController.getEnsNameSuggestions(e);return state$5.suggestions=t.suggestions.map((e=>({...e,name:e.name})))||[],state$5.suggestions}catch(e2){const t=this.parseEnsApiError(e2,"Error fetching name suggestions");throw new Error(t)}finally{state$5.loading=!1}},async getNamesForAddress(e){try{if(!ChainController.state.activeCaipNetwork)return[];return await BlockchainApiController.reverseLookupEnsName({address:e})}catch(e2){const t=this.parseEnsApiError(e2,"Error fetching names for address");throw new Error(t)}},async registerName(e){const t=ChainController.state.activeCaipNetwork;if(!t)throw new Error("Network not found");const r=AccountController.state.address,n=ConnectorController.getAuthConnector();if(!r||!n)throw new Error("Address or auth connector not found");state$5.loading=!0;try{const n=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now())});RouterController.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){state$5.loading=!1}});const i=await ConnectionController.signMessage(n),o=t.id;if(!o)throw new Error("Network not found");const s=EnsUtil.convertEVMChainIdToCoinType(Number(o));await BlockchainApiController.registerEnsName({coinType:s,address:r,signature:i,message:n}),AccountController.setProfileName(e,t.chainNamespace),RouterController.replace("RegisterAccountNameSuccess")}catch(e2){const r=this.parseEnsApiError(e2,`Error registering name ${e}`);throw RouterController.replace("RegisterAccountName"),new Error(r)}finally{state$5.loading=!1}},validateName:e=>/^[a-zA-Z0-9-]{4,}$/u.test(e),parseEnsApiError(e,t){var r,n;return(null==(n=null==(r=null==e?void 0:e.reasons)?void 0:r[0])?void 0:n.description)||t}},state$4=proxy$1({message:"",variant:"info",open:!1}),AlertController={state:state$4,subscribeKey:(e,t)=>subscribeKey$1(state$4,e,t),open(e,t){const{debug:r}=OptionsController.state,{shortMessage:n,longMessage:i}=e;r&&(state$4.message=n,state$4.variant=t,state$4.open=!0),i&&console.error("function"==typeof i?i():i)},close(){state$4.open=!1,state$4.message="",state$4.variant="info"}},namespaceImageIds={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:""},AssetUtil={async fetchWalletImage(e){if(e)return await ApiController._fetchWalletImage(e),this.getWalletImageById(e)},getWalletImageById(e){if(e)return AssetController.state.walletImages[e]},getWalletImage:e=>(null==e?void 0:e.image_url)?null==e?void 0:e.image_url:(null==e?void 0:e.image_id)?AssetController.state.walletImages[e.image_id]:void 0,getNetworkImage(e){var t,r,n;return(null==(t=null==e?void 0:e.assets)?void 0:t.imageUrl)?null==(r=null==e?void 0:e.assets)?void 0:r.imageUrl:(null==(n=null==e?void 0:e.assets)?void 0:n.imageId)?AssetController.state.networkImages[e.assets.imageId]:void 0},getNetworkImageById(e){if(e)return AssetController.state.networkImages[e]},getConnectorImage:e=>(null==e?void 0:e.imageUrl)?e.imageUrl:(null==e?void 0:e.imageId)?AssetController.state.connectorImages[e.imageId]:void 0,getChainImage:e=>AssetController.state.networkImages[namespaceImageIds[e]]},t$5=globalThis,e$5=t$5.ShadowRoot&&(void 0===t$5.ShadyCSS||t$5.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$4=Symbol(),o$6=new WeakMap;let n$7=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==s$4)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(e$5&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=o$6.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&o$6.set(t,e))}return e}toString(){return this.cssText}};const r$9=e=>new n$7("string"==typeof e?e:e+"",void 0,s$4),i$7=(e,...t)=>{const r=1===e.length?e[0]:t.reduce(((t,r,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[n+1]),e[0]);return new n$7(r,e,s$4)},S$4=(e,t)=>{if(e$5)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const r of t){const t=document.createElement("style"),n=t$5.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}},c$6=e$5?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return r$9(t)})(e):e
10
+ !function(e){const t=base64Js,r=ieee754,n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i;const{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:a}=globalThis;function c(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new o(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=c(r);const i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(s.isView(e))return function(e){if(J(e,o)){const t=new o(e);return f(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,s)||e&&J(e.buffer,s))return f(e,t,r);if(void 0!==a&&(J(e,a)||e&&J(e.buffer,a)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return l.from(n,t,r);const i=function(e){if(l.isBuffer(e)){const t=0|m(e.length),r=c(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||Q(e.length)?c(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return d(e),c(e<0?0:0|m(e))}function p(e){const t=e.length<0?0:0|m(e.length),r=c(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new o(e):void 0===r?new o(e,t):new o(e,t,r),Object.setPrototypeOf(n,l.prototype),n}function m(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function g(e,t){if(l.isBuffer(e))return e.length;if(s.isView(e)||J(e,s))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function b(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return x(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function w(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof o.prototype.indexOf?i?o.prototype.indexOf.call(e,t,r):o.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(l(e,o+n)!==l(t,n)){r=!1;break}if(r)return o}return-1}function _(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Q(n))return s;e[r+s]=n}return s}function $(e,t,r,n){return Z(K(t,e.length-r),e,r,n)}function C(e,t,r,n){return Z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function E(e,t,r,n){return Z(G(t),e,r,n)}function S(e,t,r,n){return Z(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function x(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function A(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e2){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(l.prototype,o.prototype),Object.setPrototypeOf(l,o),l.alloc=function(e,t,r){return function(e,t,r){return d(e),e<=0?c(e):void 0!==t?"string"==typeof r?c(e).fill(t,r):c(e).fill(t):c(e)}(e,t,r)},l.allocUnsafe=function(e){return h(e)},l.allocUnsafeSlow=function(e){return h(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(J(e,o)&&(e=l.from(e,e.offset,e.byteLength)),J(t,o)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},l.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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=l.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(J(t,o))i+t.length>n.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(n,i)):o.prototype.set.call(n,t,i);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},l.byteLength=g,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):b.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(e,t,r,n,i){if(J(e,o)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const c=Math.min(s,a),u=this.slice(n,i),d=e.slice(t,r);for(let o=0;o<c;++o)if(u[o]!==d[o]){s=u[o],a=d[o];break}return s<a?-1:a<s?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return w(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return w(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return $(this,e,t,r);case"ascii":case"latin1":case"binary":return C(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function T(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=t;o<r;++o)i+=Y[e[o]];return i}function P(e,t,r){const n=e.slice(t,r);let i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function N(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){z(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function O(e,t,r,n,i){z(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,n,i,o){return t=+t,n>>>=0,o||L(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function D(e,t,n,i,o){return t=+t,n>>>=0,o||L(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const r=this.length;(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);const n=this.subarray(e,t);return Object.setPrototypeOf(n,l.prototype),n},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),l.prototype.readBigUInt64BE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),l.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=X((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){M(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=X((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=X((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=X((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=X((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof o.prototype.copyWithin?this.copyWithin(t,r,n):o.prototype.set.call(e,this.subarray(r,n),t),i},l.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=l.isBuffer(e)?e:l.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const W={};function j(e,t,r){W[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function F(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function z(e,t,r,n,i,o){if(e>r||e<t){const r="bigint"==typeof t?"n":"";let n;throw n=0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new W.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!=typeof e)throw new W.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new W.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function K(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?ee:e}function ee(){throw new Error("BigInt not supported")}}(buffer$3);const Buffer$7=buffer$3.Buffer,Blob$2=buffer$3.Blob,BlobOptions=buffer$3.BlobOptions,Buffer$1$1=buffer$3.Buffer,File=buffer$3.File,FileOptions=buffer$3.FileOptions,INSPECT_MAX_BYTES=buffer$3.INSPECT_MAX_BYTES,SlowBuffer=buffer$3.SlowBuffer,TranscodeEncoding=buffer$3.TranscodeEncoding,atob$1=buffer$3.atob,btoa$1=buffer$3.btoa,constants$9=buffer$3.constants,isAscii=buffer$3.isAscii,isUtf8=buffer$3.isUtf8,kMaxLength=buffer$3.kMaxLength,kStringMaxLength=buffer$3.kStringMaxLength,resolveObjectURL=buffer$3.resolveObjectURL,transcode=buffer$3.transcode,dist$7=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$2,BlobOptions:BlobOptions,Buffer:Buffer$1$1,File:File,FileOptions:FileOptions,INSPECT_MAX_BYTES:INSPECT_MAX_BYTES,SlowBuffer:SlowBuffer,TranscodeEncoding:TranscodeEncoding,atob:atob$1,btoa:btoa$1,constants:constants$9,default:Buffer$7,isAscii:isAscii,isUtf8:isUtf8,kMaxLength:kMaxLength,kStringMaxLength:kStringMaxLength,resolveObjectURL:resolveObjectURL,transcode:transcode},Symbol.toStringTag,{value:"Module"}));"undefined"!=typeof window&&(window.Buffer||(window.Buffer=Buffer$1$1),window.global||(window.global=window),window.process||(window.process={}),(null==(_a2=window.process)?void 0:_a2.env)||(window.process={env:{}}));const t$6=Symbol(),s$5=Object.getPrototypeOf,c$8=new WeakMap,l$6=e=>e&&(c$8.has(e)?c$8.get(e):s$5(e)===Object.prototype||s$5(e)===Array.prototype),y$7=e=>l$6(e)&&e[t$6]||null,h$8=(e,t=!0)=>{c$8.set(e,t)};var define_import_meta_env_default$3={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const isObject$3=e=>"object"==typeof e&&null!==e,proxyStateMap$1=new WeakMap,refSet$1=new WeakSet,buildProxyFunction$1=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject$3(e)&&!refSet$1.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},i=new WeakMap,o=(e,t,r=n)=>{const s=i.get(e);if((null==s?void 0:s[0])===t)return s[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$8(a,!0),i.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const n=Reflect.get(e,t),i={value:n,enumerable:!0,configurable:!0};if(refSet$1.has(n))h$8(n,!1);else if(n instanceof Promise)delete i.value,i.get=()=>r(n);else if(proxyStateMap$1.has(n)){const[e,t]=proxyStateMap$1.get(n);i.value=o(e,t(),r)}Object.defineProperty(a,t,i)})),Object.preventExtensions(a)},s=new WeakMap,a=[1,1],c=n=>{if(!isObject$3(n))throw new Error("object required");const i=s.get(n);if(i)return i;let l=a[0];const u=new Set,d=(e,t=++a[0])=>{l!==t&&(l=t,u.forEach((r=>r(e,t))))};let h=a[1];const p=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},f=new Map,m=e=>{var t;const r=f.get(e);r&&(f.delete(e),null==(t=r[1])||t.call(r))},g=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),b=t(g,{deleteProperty(e,t){const r=Reflect.get(e,t);m(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,i,o){const a=Reflect.has(t,n),l=Reflect.get(t,n,o);if(a&&(e(l,i)||s.has(i)&&e(l,s.get(i))))return!0;m(n),isObject$3(i)&&(i=y$7(i)||i);let h=i;if(i instanceof Promise)i.then((e=>{i.status="fulfilled",i.value=e,d(["resolve",[n],e])})).catch((e=>{i.status="rejected",i.reason=e,d(["reject",[n],e])}));else{!proxyStateMap$1.has(i)&&r(i)&&(h=c(i));const e=!refSet$1.has(h)&&proxyStateMap$1.get(h);e&&((e,t)=>{if("production"!==(define_import_meta_env_default$3?"production":void 0)&&f.has(e))throw new Error("prop listener already exists");if(u.size){const r=t[3](p(e));f.set(e,[t,r])}else f.set(e,[t])})(n,e)}return Reflect.set(t,n,h,o),d(["set",[n],i,l]),!0}});s.set(n,b);const y=[g,(e=++a[1])=>(h===e||u.size||(h=e,f.forEach((([t])=>{const r=t[1](e);r>l&&(l=r)}))),l),o,e=>{u.add(e),1===u.size&&f.forEach((([e,t],r)=>{if("production"!==(define_import_meta_env_default$3?"production":void 0)&&t)throw new Error("remove already exists");const n=e[3](p(r));f.set(r,[e,n])}));return()=>{u.delete(e),0===u.size&&f.forEach((([e,t],r)=>{t&&(t(),f.set(r,[e]))}))}}];return proxyStateMap$1.set(b,y),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(b[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(g,e,t)})),b})=>[c,proxyStateMap$1,refSet$1,e,t,r,n,i,o,s,a],[defaultProxyFunction$1]=buildProxyFunction$1();function proxy$1(e={}){return defaultProxyFunction$1(e)}function subscribe$1(e,t,r){const n=proxyStateMap$1.get(e);let i;"production"===(define_import_meta_env_default$3?"production":void 0)||n||console.warn("Please use proxy object");const o=[],s=n[3];let a=!1;const c=s((e=>{o.push(e),i||(i=Promise.resolve().then((()=>{i=void 0,a&&t(o.splice(0))})))}));return a=!0,()=>{a=!1,c()}}function snapshot(e,t){const r=proxyStateMap$1.get(e);"production"===(define_import_meta_env_default$3?"production":void 0)||r||console.warn("Please use proxy object");const[n,i,o]=r;return o(n,i(),t)}function ref$2(e){return refSet$1.add(e),e}function subscribeKey$1(e,t,r,n){let i=e[t];return subscribe$1(e,(()=>{const n=e[t];Object.is(i,n)||r(i=n)}))}function proxyMap(e){const t=proxy$1({data:Array.from([]),has(e){return this.data.some((t=>t[0]===e))},set(e,t){const r=this.data.find((t=>t[0]===e));return r?r[1]=t:this.data.push([e,t]),this},get(e){var t;return null==(t=this.data.find((t=>t[0]===e)))?void 0:t[1]},delete(e){const t=this.data.findIndex((t=>t[0]===e));return-1!==t&&(this.data.splice(t,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(e){this.data.forEach((t=>{e(t[1],t[0],this)}))},keys(){return this.data.map((e=>e[0])).values()},values(){return this.data.map((e=>e[1])).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs$2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var dayjs_min={exports:{}},module2;module2=dayjs_min,module2.exports=function(){var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",o="minute",s="hour",a="day",c="week",l="month",u="quarter",d="year",h="date",p="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}},b=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},y={s:b,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+b(n,2,"0")+":"+b(i,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),i=t.clone().add(n,l),o=r-i<0,s=t.clone().add(n+(o?-1:1),l);return+(-(n+(r-i)/(o?i-s:s-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:a,D:h,h:s,m:o,s:i,ms:n,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},w="en",v={};v[w]=g;var _="$isDayjsObject",$=function(e){return e instanceof x||!(!e||!e[_])},C=function e(t,r,n){var i;if(!t)return w;if("string"==typeof t){var o=t.toLowerCase();v[o]&&(i=o),r&&(v[o]=r,i=o);var s=t.split("-");if(!i&&s.length>1)return e(s[0])}else{var a=t.name;v[a]=t,i=a}return!n&&i&&(w=i),i||!n&&w},E=function(e,t){if($(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new x(r)},S=y;S.l=C,S.i=$,S.w=function(e,t){return E(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var x=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[_]=!0}var b=g.prototype;return b.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(S.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(f);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(t)}(e),this.init()},b.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},b.$utils=function(){return S},b.isValid=function(){return!(this.$d.toString()===p)},b.isSame=function(e,t){var r=E(e);return this.startOf(t)<=r&&r<=this.endOf(t)},b.isAfter=function(e,t){return E(e)<this.startOf(t)},b.isBefore=function(e,t){return this.endOf(t)<E(e)},b.$g=function(e,t,r){return S.u(e)?this[t]:this.set(r,e)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(e,t){var r=this,n=!!S.u(t)||t,u=S.p(e),p=function(e,t){var i=S.w(r.$u?Date.UTC(r.$y,t,e):new Date(r.$y,t,e),r);return n?i:i.endOf(a)},f=function(e,t){return S.w(r.toDate()[e].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(t)),r)},m=this.$W,g=this.$M,b=this.$D,y="set"+(this.$u?"UTC":"");switch(u){case d:return n?p(1,0):p(31,11);case l:return n?p(1,g):p(0,g+1);case c:var w=this.$locale().weekStart||0,v=(m<w?m+7:m)-w;return p(n?b-v:b+(6-v),g);case a:case h:return f(y+"Hours",0);case s:return f(y+"Minutes",1);case o:return f(y+"Seconds",2);case i:return f(y+"Milliseconds",3);default:return this.clone()}},b.endOf=function(e){return this.startOf(e,!1)},b.$set=function(e,t){var r,c=S.p(e),u="set"+(this.$u?"UTC":""),p=(r={},r[a]=u+"Date",r[h]=u+"Date",r[l]=u+"Month",r[d]=u+"FullYear",r[s]=u+"Hours",r[o]=u+"Minutes",r[i]=u+"Seconds",r[n]=u+"Milliseconds",r)[c],f=c===a?this.$D+(t-this.$W):t;if(c===l||c===d){var m=this.clone().set(h,1);m.$d[p](f),m.init(),this.$d=m.set(h,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},b.set=function(e,t){return this.clone().$set(e,t)},b.get=function(e){return this[S.p(e)]()},b.add=function(n,u){var h,p=this;n=Number(n);var f=S.p(u),m=function(e){var t=E(p);return S.w(t.date(t.date()+Math.round(e*n)),p)};if(f===l)return this.set(l,this.$M+n);if(f===d)return this.set(d,this.$y+n);if(f===a)return m(1);if(f===c)return m(7);var g=(h={},h[o]=t,h[s]=r,h[i]=e,h)[f]||1,b=this.$d.getTime()+n*g;return S.w(b,this)},b.subtract=function(e,t){return this.add(-1*e,t)},b.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||p;var n=e||"YYYY-MM-DDTHH:mm:ssZ",i=S.z(this),o=this.$H,s=this.$m,a=this.$M,c=r.weekdays,l=r.months,u=r.meridiem,d=function(e,r,i,o){return e&&(e[r]||e(t,n))||i[r].slice(0,o)},h=function(e){return S.s(o%12||12,e,"0")},f=u||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(m,(function(e,n){return n||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return S.s(t.$y,4,"0");case"M":return a+1;case"MM":return S.s(a+1,2,"0");case"MMM":return d(r.monthsShort,a,l,3);case"MMMM":return d(l,a);case"D":return t.$D;case"DD":return S.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(r.weekdaysMin,t.$W,c,2);case"ddd":return d(r.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(o);case"HH":return S.s(o,2,"0");case"h":return h(1);case"hh":return h(2);case"a":return f(o,s,!0);case"A":return f(o,s,!1);case"m":return String(s);case"mm":return S.s(s,2,"0");case"s":return String(t.$s);case"ss":return S.s(t.$s,2,"0");case"SSS":return S.s(t.$ms,3,"0");case"Z":return i}return null}(e)||i.replace(":","")}))},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(n,h,p){var f,m=this,g=S.p(h),b=E(n),y=(b.utcOffset()-this.utcOffset())*t,w=this-b,v=function(){return S.m(m,b)};switch(g){case d:f=v()/12;break;case l:f=v();break;case u:f=v()/3;break;case c:f=(w-y)/6048e5;break;case a:f=(w-y)/864e5;break;case s:f=w/r;break;case o:f=w/t;break;case i:f=w/e;break;default:f=w}return p?f:S.a(f)},b.daysInMonth=function(){return this.endOf(l).$D},b.$locale=function(){return v[this.$L]},b.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=C(e,t,!0);return n&&(r.$L=n),r},b.clone=function(){return S.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},g}(),A=x.prototype;return E.prototype=A,[["$ms",n],["$s",i],["$m",o],["$H",s],["$W",a],["$M",l],["$y",d],["$D",h]].forEach((function(e){A[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),E.extend=function(e,t){return e.$i||(e(t,x,E),e.$i=!0),E},E.locale=C,E.isDayjs=$,E.unix=function(e){return E(1e3*e)},E.en=v[w],E.Ls=v,E.p={},E}();var dayjs_minExports=dayjs_min.exports;const dayjs=getDefaultExportFromCjs$2(dayjs_minExports);var en$2={exports:{}};!function(e,t){e.exports={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}}}(en$2);var enExports=en$2.exports;const englishLocale=getDefaultExportFromCjs$2(enExports);var relativeTime$1={exports:{}};!function(e,t){e.exports=function(e,t,r){e=e||{};var n=t.prototype,i={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function o(e,t,r,i){return n.fromToBase(e,t,r,i)}r.en.relativeTime=i,n.fromToBase=function(t,n,o,s,a){for(var c,l,u,d=o.$locale().relativeTime||i,h=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],p=h.length,f=0;f<p;f+=1){var m=h[f];m.d&&(c=s?r(t).diff(o,m.d,!0):o.diff(t,m.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=m.r||!m.r){g<=1&&f>0&&(m=h[f-1]);var b=d[m.l];a&&(g=a(""+g)),l="string"==typeof b?b.replace("%d",g):b(g,n,m.l,u);break}}if(n)return l;var y=u?d.future:d.past;return"function"==typeof y?y(l):y.replace("%s",l)},n.to=function(e,t){return o(e,t,this,!0)},n.from=function(e,t){return o(e,t,this)};var s=function(e){return e.$u?r.utc():r()};n.toNow=function(e){return this.to(s(this),e)},n.fromNow=function(e){return this.from(s(this),e)}}}(relativeTime$1);var relativeTimeExports=relativeTime$1.exports;const relativeTime=getDefaultExportFromCjs$2(relativeTimeExports);var updateLocale$1={exports:{}};!function(e,t){e.exports=function(e,t,r){r.updateLocale=function(e,t){var n=r.Ls[e];if(n)return(t?Object.keys(t):[]).forEach((function(e){n[e]=t[e]})),n}}}(updateLocale$1);var updateLocaleExports=updateLocale$1.exports;const updateLocale=getDefaultExportFromCjs$2(updateLocaleExports);dayjs.extend(relativeTime),dayjs.extend(updateLocale);const localeObject={...englishLocale,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}};dayjs.locale("en-web3-modal",localeObject);const DateUtil={getYear:(e=(new Date).toISOString())=>dayjs(e).year(),getRelativeDateFromNow:e=>dayjs(e).locale("en-web3-modal").fromNow(!0),formatDate:(e,t="DD MMM")=>dayjs(e).format(t)},NetworkUtil={caipNetworkIdToNumber:e=>e?Number(e.split(":")[1]):void 0,parseEvmChainId(e){return"string"==typeof e?this.caipNetworkIdToNumber(e):e}};var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER$2=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX$1=1e9;function clone(e){var t,r,n,i,o,s=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),c=20,l=4,u=-7,d=21,h=-1e7,p=1e7,f=!1,m=1,g=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},y="0123456789abcdefghijklmnopqrstuvwxyz",w=!0;function v(e,t){var i,o,s,a,u,d,f,m,g=this;if(!(g instanceof v))return new v(e,t);if(null==t){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>p?g.c=g.e=null:e.e<h?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((d="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,u=e;u>=10;u/=10,a++);return void(a>p?g.c=g.e=null:(g.e=a,g.c=[e]))}m=String(e)}else{if(!isNumeric.test(m=String(e)))return n(g,m,d);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(a=m.indexOf("."))>-1&&(m=m.replace(".","")),(u=m.search(/e/i))>0?(a<0&&(a=u),a+=+m.slice(u+1),m=m.substring(0,u)):a<0&&(a=m.length)}else{if(intCheck(t,2,y.length,"Base"),10==t&&w)return E(g=new v(e),c+g.e+1,l);if(m=String(e),d="number"==typeof e){if(0*e!=0)return n(g,m,d,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,v.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(i=y.slice(0,t),a=u=0,f=m.length;u<f;u++)if(i.indexOf(o=m.charAt(u))<0){if("."==o){if(u>a){a=f;continue}}else if(!s&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){s=!0,u=-1,a=0;continue}return n(g,String(e),d,t)}d=!1,(a=(m=r(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):a=m.length}for(u=0;48===m.charCodeAt(u);u++);for(f=m.length;48===m.charCodeAt(--f););if(m=m.slice(u,++f)){if(f-=u,d&&v.DEBUG&&f>15&&(e>MAX_SAFE_INTEGER$2||e!==mathfloor(e)))throw Error(tooManyDigits+g.s*e);if((a=a-u-1)>p)g.c=g.e=null;else if(a<h)g.c=[g.e=0];else{if(g.e=a,g.c=[],u=(a+1)%LOG_BASE,a<0&&(u+=LOG_BASE),u<f){for(u&&g.c.push(+m.slice(0,u)),f-=LOG_BASE;u<f;)g.c.push(+m.slice(u,u+=LOG_BASE));u=LOG_BASE-(m=m.slice(u)).length}else u-=f;for(;u--;m+="0");g.c.push(+m)}}else g.c=[g.e=0]}function _(e,t,r,n){var i,o,s,a,c;if(null==r?r=l:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)c=coeffToString(e.c),c=1==n||2==n&&(s<=u||s>=d)?toExponential(c,s):toFixedPoint(c,s,"0");else if(o=(e=E(new v(e),t,r)).e,a=(c=coeffToString(e.c)).length,1==n||2==n&&(t<=o||o<=u)){for(;a<t;c+="0",a++);c=toExponential(c,o)}else if(t-=s,c=toFixedPoint(c,o,"0"),o+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function $(e,t){for(var r,n,i=1,o=new v(e[0]);i<e.length;i++)(!(n=new v(e[i])).s||(r=compare$d(o,n))===t||0===r&&o.s===t)&&(o=n);return o}function C(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*LOG_BASE-1)>p?e.c=e.e=null:r<h?e.c=[e.e=0]:(e.e=r,e.c=t),e}function E(e,t,r,n){var i,o,s,a,c,l,u,d=e.c,f=POWS_TEN;if(d){e:{for(i=1,a=d[0];a>=10;a/=10,i++);if((o=t-i)<0)o+=LOG_BASE,s=t,c=d[l=0],u=mathfloor(c/f[i-s-1]%10);else if((l=mathceil((o+1)/LOG_BASE))>=d.length){if(!n)break e;for(;d.length<=l;d.push(0));c=u=0,i=1,s=(o%=LOG_BASE)-LOG_BASE+1}else{for(c=a=d[l],i=1;a>=10;a/=10,i++);u=(s=(o%=LOG_BASE)-LOG_BASE+i)<0?0:mathfloor(c/f[i-s-1]%10)}if(n=n||t<0||null!=d[l+1]||(s<0?c:c%f[i-s-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(o>0?s>0?c/f[i-s]:0:d[l-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,n?(t-=e.e+1,d[0]=f[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):d[0]=e.e=0,e;if(0==o?(d.length=l,a=1,l--):(d.length=l+1,a=f[LOG_BASE-o],d[l]=s>0?mathfloor(c/f[i-s]%f[s])*a:0),n)for(;;){if(0==l){for(o=1,s=d[0];s>=10;s/=10,o++);for(s=d[0]+=a,a=1;s>=10;s/=10,a++);o!=a&&(e.e++,d[0]==BASE&&(d[0]=1));break}if(d[l]+=a,d[l]!=BASE)break;d[l--]=0,a=1}for(o=d.length;0===d[--o];d.pop());}e.e>p?e.c=e.e=null:e.e<h&&(e.c=[e.e=0])}return e}function S(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=u||r>=d?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return v.clone=clone,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX$1,t),c=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),l=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX$1,0,t),intCheck(r[1],0,MAX$1,t),u=r[0],d=r[1]):(intCheck(r,-MAX$1,MAX$1,t),u=-(d=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX$1,-1,t),intCheck(r[1],1,MAX$1,t),h=r[0],p=r[1];else{if(intCheck(r,-MAX$1,MAX$1,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);h=-(p=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw f=!r,Error(bignumberError+"crypto unavailable");f=r}else f=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),m=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX$1,t),g=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);b=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);w="0123456789"==r.slice(0,10),y=r}}return{DECIMAL_PLACES:c,ROUNDING_MODE:l,EXPONENTIAL_AT:[u,d],RANGE:[h,p],CRYPTO:f,MODULO_MODE:m,POW_PRECISION:g,FORMAT:b,ALPHABET:y}},v.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!v.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX$1&&i<=MAX$1&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=BASE||r!==mathfloor(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},v.maximum=v.max=function(){return $(arguments,-1)},v.minimum=v.min=function(){return $(arguments,1)},v.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,l=0,u=[],d=new v(a);if(null==e?e=c:intCheck(e,0,MAX$1),i=mathceil(e/LOG_BASE),f)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));l<i;)(s=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(u.push(s%1e14),l+=2);l=i/2}else{if(!crypto.randomBytes)throw f=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);l<i;)(s=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(u.push(s%1e14),l+=7);l=i/7}if(!f)for(;l<i;)(s=o())<9e15&&(u[l++]=s%1e14);for(i=u[--l],e%=LOG_BASE,i&&e&&(s=POWS_TEN[LOG_BASE-e],u[l]=mathfloor(i/s)*s);0===u[l];u.pop(),l--);if(l<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=LOG_BASE);for(l=1,s=u[0];s>=10;s/=10,l++);l<LOG_BASE&&(n-=LOG_BASE-l)}return d.e=n,d.c=u,d}),v.sum=function(){for(var e=1,t=arguments,r=new v(t[0]);e<t.length;)r=r.plus(t[e++]);return r},r=function(){var e="0123456789";function r(e,t,r,n){for(var i,o,s=[0],a=0,c=e.length;a<c;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var u,d,h,p,f,m,b,w,_=n.indexOf("."),$=c,C=l;for(_>=0&&(p=g,g=0,n=n.replace(".",""),m=(w=new v(i)).pow(n.length-_),g=p,w.c=r(toFixedPoint(coeffToString(m.c),m.e,"0"),10,o,e),w.e=w.c.length),h=p=(b=r(n,i,o,a?(u=y,e):(u=e,y))).length;0==b[--p];b.pop());if(!b[0])return u.charAt(0);if(_<0?--h:(m.c=b,m.e=h,m.s=s,b=(m=t(m,w,$,C,o)).c,f=m.r,h=m.e),_=b[d=h+$+1],p=o/2,f=f||d<0||null!=b[d+1],f=C<4?(null!=_||f)&&(0==C||C==(m.s<0?3:2)):_>p||_==p&&(4==C||f||6==C&&1&b[d-1]||C==(m.s<0?8:7)),d<1||!b[0])n=f?toFixedPoint(u.charAt(1),-$,u.charAt(0)):u.charAt(0);else{if(b.length=d,f)for(--o;++b[--d]>o;)b[d]=0,d||(++h,b=[1].concat(b));for(p=b.length;!b[--p];);for(_=0,n="";_<=p;n+=u.charAt(b[_++]));n=toFixedPoint(n,h,u.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,l=t%SQRT_BASE,u=t/SQRT_BASE|0;for(e=e.slice();c--;)a=((i=l*(o=e[c]%SQRT_BASE)+(n=u*o+(s=e[c]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+u*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,s,a){var c,l,u,d,h,p,f,m,g,b,y,w,_,$,C,S,x,A=n.s==i.s?1:-1,k=n.c,T=i.c;if(!(k&&k[0]&&T&&T[0]))return new v(n.s&&i.s&&(k?!T||k[0]!=T[0]:T)?k&&0==k[0]||!T?0*A:A/0:NaN);for(g=(m=new v(A)).c=[],A=o+(l=n.e-i.e)+1,a||(a=BASE,l=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),A=A/LOG_BASE|0),u=0;T[u]==(k[u]||0);u++);if(T[u]>(k[u]||0)&&l--,A<0)g.push(1),d=!0;else{for($=k.length,S=T.length,u=0,A+=2,(h=mathfloor(a/(T[0]+1)))>1&&(T=e(T,h,a),k=e(k,h,a),S=T.length,$=k.length),_=S,y=(b=k.slice(0,S)).length;y<S;b[y++]=0);x=T.slice(),x=[0].concat(x),C=T[0],T[1]>=a/2&&C++;do{if(h=0,(c=t(T,b,S,y))<0){if(w=b[0],S!=y&&(w=w*a+(b[1]||0)),(h=mathfloor(w/C))>1)for(h>=a&&(h=a-1),f=(p=e(T,h,a)).length,y=b.length;1==t(p,b,f,y);)h--,r(p,S<f?x:T,f,a),f=p.length,c=1;else 0==h&&(c=h=1),f=(p=T.slice()).length;if(f<y&&(p=[0].concat(p)),r(b,p,y,a),y=b.length,-1==c)for(;t(T,b,S,y)<1;)h++,r(b,S<y?x:T,y,a),y=b.length}else 0===c&&(h++,b=[0]);g[u++]=h,b[0]?b[y++]=k[_]||0:(b=[k[_]],y=1)}while((_++<$||null!=b[0])&&A--);d=null!=b[0],g[0]||g.splice(0,1)}if(a==BASE){for(u=1,A=g[0];A>=10;A/=10,u++);E(m,o+(m.e=u+l*LOG_BASE-1)+1,s,d)}else m.e=l,m.r=+d;return m}}(),n=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,a,c){var l,u=a?s:s.replace(i,"");if(n.test(u))o.s=isNaN(u)?null:u<0?-1:1;else{if(!a&&(u=u.replace(e,(function(e,t,r){return l="x"==(r=r.toLowerCase())?16:"b"==r?2:8,c&&c!=l?e:t})),c&&(l=c,u=u.replace(t,"$1").replace(r,"0.$1")),s!=u))return new v(u,l);if(v.DEBUG)throw Error(bignumberError+"Not a"+(c?" base "+c:"")+" number: "+s);o.s=null}o.c=o.e=null}}(),s.absoluteValue=s.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},s.comparedTo=function(e,t){return compare$d(this,new v(e,t))},s.decimalPlaces=s.dp=function(e,t){var r,n,i,o=this;if(null!=e)return intCheck(e,0,MAX$1),null==t?t=l:intCheck(t,0,8),E(new v(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},s.dividedBy=s.div=function(e,r){return t(this,new v(e,r),c,l)},s.dividedToIntegerBy=s.idiv=function(e,r){return t(this,new v(e,r),0,1)},s.exponentiatedBy=s.pow=function(e,t){var r,n,i,o,s,c,u,d,h=this;if((e=new v(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+S(e));if(null!=t&&(t=new v(t)),s=e.e>14,!h.c||!h.c[0]||1==h.c[0]&&!h.e&&1==h.c.length||!e.c||!e.c[0])return d=new v(Math.pow(+S(h),s?e.s*(2-isOdd(e)):+S(e))),t?d.mod(t):d;if(c=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);(n=!c&&h.isInteger()&&t.isInteger())&&(h=h.mod(t))}else{if(e.e>9&&(h.e>0||h.e<-1||(0==h.e?h.c[0]>1||s&&h.c[1]>=24e7:h.c[0]<8e13||s&&h.c[0]<=9999975e7)))return o=h.s<0&&isOdd(e)?-0:0,h.e>-1&&(o=1/o),new v(c?1/o:o);g&&(o=mathceil(g/LOG_BASE+2))}for(s?(r=new v(.5),c&&(e.s=1),u=isOdd(e)):u=(i=Math.abs(+S(e)))%2,d=new v(a);;){if(u){if(!(d=d.times(h)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;u=i%2}else if(E(e=e.times(r),e.e+1,1),e.e>14)u=isOdd(e);else{if(0===(i=+S(e)))break;u=i%2}h=h.times(h),o?h.c&&h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}return n?d:(c&&(d=a.div(d)),t?d.mod(t):o?E(d,g,l,undefined):d)},s.integerValue=function(e){var t=new v(this);return null==e?e=l:intCheck(e,0,8),E(t,t.e+1,e)},s.isEqualTo=s.eq=function(e,t){return 0===compare$d(this,new v(e,t))},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(e,t){return compare$d(this,new v(e,t))>0},s.isGreaterThanOrEqualTo=s.gte=function(e,t){return 1===(t=compare$d(this,new v(e,t)))||0===t},s.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},s.isLessThan=s.lt=function(e,t){return compare$d(this,new v(e,t))<0},s.isLessThanOrEqualTo=s.lte=function(e,t){return-1===(t=compare$d(this,new v(e,t)))||0===t},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&0==this.c[0]},s.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new v(e,t)).s,!a||!t)return new v(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/LOG_BASE,u=e.e/LOG_BASE,d=s.c,h=e.c;if(!c||!u){if(!d||!h)return d?(e.s=-t,e):new v(h?s:NaN);if(!d[0]||!h[0])return h[0]?(e.s=-t,e):new v(d[0]?s:3==l?-0:0)}if(c=bitFloor(c),u=bitFloor(u),d=d.slice(),a=c-u){for((o=a<0)?(a=-a,i=d):(u=c,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=d.length)<(t=h.length))?a:t,a=t=0;t<n;t++)if(d[t]!=h[t]){o=d[t]<h[t];break}if(o&&(i=d,d=h,h=i,e.s=-e.s),(t=(n=h.length)-(r=d.length))>0)for(;t--;d[r++]=0);for(t=BASE-1;n>a;){if(d[--n]<h[n]){for(r=n;r&&!d[--r];d[r]=t);--d[r],d[n]+=BASE}d[n]-=h[n]}for(;0==d[0];d.splice(0,1),--u);return d[0]?C(e,d,u):(e.s=3==l?-1:1,e.c=[e.e=0],e)},s.modulo=s.mod=function(e,r){var n,i,o=this;return e=new v(e,r),!o.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||o.c&&!o.c[0]?new v(o):(9==m?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,m),(e=o.minus(n.times(e))).c[0]||1!=m||(e.s=o.s),e)},s.multipliedBy=s.times=function(e,t){var r,n,i,o,s,a,c,l,u,d,h,p,f,m,g,b=this,y=b.c,w=(e=new v(e,t)).c;if(!(y&&w&&y[0]&&w[0]))return!b.s||!e.s||y&&!y[0]&&!w||w&&!w[0]&&!y?e.c=e.e=e.s=null:(e.s*=b.s,y&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(b.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=b.s,(c=y.length)<(d=w.length)&&(f=y,y=w,w=f,i=c,c=d,d=i),i=c+d,f=[];i--;f.push(0));for(m=BASE,g=SQRT_BASE,i=d;--i>=0;){for(r=0,h=w[i]%g,p=w[i]/g|0,o=i+(s=c);o>i;)r=((l=h*(l=y[--s]%g)+(a=p*l+(u=y[s]/g|0)*h)%g*g+f[o]+r)/m|0)+(a/g|0)+p*u,f[o--]=l%m;f[o]=r}return r?++n:f.splice(0,1),C(e,f,n)},s.negated=function(){var e=new v(this);return e.s=-e.s||null,e},s.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new v(e,t)).s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,s=e.e/LOG_BASE,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new v(i/0);if(!a[0]||!c[0])return c[0]?e:new v(a[0]?n:0*i)}if(o=bitFloor(o),s=bitFloor(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/BASE|0,a[t]=BASE===a[t]?0:a[t]%BASE;return i&&(a=[i].concat(a),++s),C(e,a,s)},s.precision=s.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX$1),null==t?t=l:intCheck(t,0,8),E(new v(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*LOG_BASE+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},s.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+e)},s.squareRoot=s.sqrt=function(){var e,r,n,i,o,s=this,a=s.c,u=s.s,d=s.e,h=c+4,p=new v("0.5");if(1!==u||!a||!a[0])return new v(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+S(s)))||u==1/0?(((r=coeffToString(a)).length+d)%2==0&&(r+="0"),u=Math.sqrt(+r),d=bitFloor((d+1)/2)-(d<0||d%2),n=new v(r=u==1/0?"5e"+d:(r=u.toExponential()).slice(0,r.indexOf("e")+1)+d)):n=new v(u+""),n.c[0])for((u=(d=n.e)+h)<3&&(u=0);;)if(o=n,n=p.times(o.plus(t(s,o,h,1))),coeffToString(o.c).slice(0,u)===(r=coeffToString(n.c)).slice(0,u)){if(n.e<d&&--u,"9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(E(n,n.e+c+2,1),e=!n.times(n).eq(s));break}if(!i&&(E(o,o.e+c+2,0),o.times(o).eq(s))){n=o;break}h+=4,u+=4,i=1}return E(n,n.e+c+1,l,e)},s.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX$1),e++),_(this,e,t,1)},s.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX$1),e=e+this.e+1),_(this,e,t)},s.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=b;else if("object"!=typeof r)throw Error(bignumberError+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",u=s[0],d=s[1],h=i.s<0,p=h?u.slice(1):u,f=p.length;if(c&&(o=a,a=c,c=o,f-=o),a>0&&f>0){for(o=f%a||a,u=p.substr(0,o);o<f;o+=a)u+=l+p.substr(o,a);c>0&&(u+=l+p.slice(o)),h&&(u="-"+u)}n=d?u+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):u}return(r.prefix||"")+n+(r.suffix||"")},s.toFraction=function(e){var r,n,i,o,s,c,u,d,h,f,m,g,b=this,y=b.c;if(null!=e&&(!(u=new v(e)).isInteger()&&(u.c||1!==u.s)||u.lt(a)))throw Error(bignumberError+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+S(u));if(!y)return new v(b);for(r=new v(a),h=n=new v(a),i=d=new v(a),g=coeffToString(y),s=r.e=g.length-b.e-1,r.c[0]=POWS_TEN[(c=s%LOG_BASE)<0?LOG_BASE+c:c],e=!e||u.comparedTo(r)>0?s>0?r:h:u,c=p,p=1/0,u=new v(g),d.c[0]=0;f=t(u,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,h=d.plus(f.times(o=h)),d=o,r=u.minus(f.times(o=r)),u=o;return o=t(e.minus(n),i,0,1),d=d.plus(o.times(h)),n=n.plus(o.times(i)),d.s=h.s=b.s,m=t(h,i,s*=2,l).minus(b).abs().comparedTo(t(d,n,s,l).minus(b).abs())<1?[h,i]:[d,n],p=c,m},s.toNumber=function(){return+S(this)},s.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX$1),_(this,e,t,2)},s.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=u||o>=d?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&w?t=toFixedPoint(coeffToString((n=E(new v(n),c+o+1,l)).c),n.e,"0"):(intCheck(e,2,y.length,"Base"),t=r(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},s.valueOf=s.toJSON=function(){return S(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,null!=e&&v.set(e),v}function bitFloor(e){var t=0|e;return e>0||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare$d(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,c=e.e,l=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=c==l,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>l^r?1:-1;for(a=(c=i.length)<(l=o.length)?c:l,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==l?0:c>l^r?1:-1}function intCheck(e,t,r,n){if(e<t||e>r||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();const NumberUtil={bigNumber:e=>new BigNumber(e),multiply(e,t){if(void 0===e||void 0===t)return BigNumber(0);const r=new BigNumber(e),n=new BigNumber(t);return r.multipliedBy(n)},formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})},InputUtil={numericInputKeyDown(e,t,r){const n=e.metaKey||e.ctrlKey,i=e.key,o=i.toLocaleLowerCase(),s=","===i,a="."===i,c=i>="0"&&i<="9";!n&&("a"===o||"c"===o||"v"===o||"x"===o)&&e.preventDefault(),"0"!==t||s||a||"0"!==i||e.preventDefault(),"0"===t&&c&&(r(i),e.preventDefault()),(s||a)&&(t||(r("0."),e.preventDefault()),((null==t?void 0:t.includes("."))||(null==t?void 0:t.includes(",")))&&e.preventDefault()),c||["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"].includes(i)||a||s||e.preventDefault()}},erc20ABI=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],usdtABI=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],ConstantsUtil$3={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot"},CHAIN_NAME_MAP:{eip155:"Ethereum",solana:"Solana",polkadot:"Polkadot"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"]},ContractUtil={getERC20Abi:e=>ConstantsUtil$3.USDT_CONTRACT_ADDRESSES.includes(e)?usdtABI:erc20ABI},NavigationUtil={URLS:{FAQ:"https://walletconnect.com/faq"}},SafeLocalStorageKeys={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_CONNECTOR:"@appkit/connected_connector",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit/connected_social_username",RECENT_WALLETS:"@appkit/recent_wallets",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE"},SafeLocalStorage={setItem(e,t){isSafe$1()&&localStorage.setItem(e,t)},getItem(e){if(isSafe$1())return localStorage.getItem(e)||void 0},removeItem(e){isSafe$1()&&localStorage.removeItem(e)},clear(){isSafe$1()&&localStorage.clear()}};function isSafe$1(){return"undefined"!=typeof window&&"undefined"!=typeof localStorage}function getW3mThemeVariables(e,t){return"light"===t?{"--w3m-accent":(null==e?void 0:e["--w3m-accent"])||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":(null==e?void 0:e["--w3m-accent"])||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}function isReownName(e){return(null==e?void 0:e.endsWith(ConstantsUtil$3.WC_NAME_SUFFIX_LEGACY))||(null==e?void 0:e.endsWith(ConstantsUtil$3.WC_NAME_SUFFIX))}const SECURE_SITE="https://secure.walletconnect.org",ONRAMP_PROVIDERS=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["eip155"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],MELD_DEV_PUBLIC_KEY="WXETMsajb7XcQBm7mcxAab:q3MtzJpiEMtXVNXsqYkAnAaBkgStybGVtZ",MELD_PROD_PUBLIC_KEY="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",ConstantsUtil$2={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:SECURE_SITE,SECURE_SITE_DASHBOARD:`${SECURE_SITE}/dashboard`,SECURE_SITE_FAVICON:`${SECURE_SITE}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in a new browser tab"},DEFAULT_FEATURES:{swaps:!0,onramp:!0,email:!0,emailShowWallets:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],history:!0,analytics:!0,allWallets:!0}},CoreHelperUtil={isMobile:()=>"undefined"!=typeof window&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),checkCaipNetwork:(e,t="")=>null==e?void 0:e.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase()),isAndroid(){const e=window.navigator.userAgent.toLowerCase();return CoreHelperUtil.isMobile()&&e.includes("android")},isIos(){const e=window.navigator.userAgent.toLowerCase();return CoreHelperUtil.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isClient:()=>"undefined"!=typeof window,isPairingExpired:e=>!e||e-Date.now()<=ConstantsUtil$2.TEN_SEC_MS,isAllowedRetry:(e,t=ConstantsUtil$2.ONE_SEC_MS)=>Date.now()-e>=t,copyToClopboard(e){navigator.clipboard.writeText(e)},getPairingExpiry:()=>Date.now()+ConstantsUtil$2.FOUR_MINUTES_MS,getNetworkId:e=>null==e?void 0:e.split(":")[1],getPlainAddress:e=>null==e?void 0:e.split(":")[2],wait:async e=>new Promise((t=>{setTimeout(t,e)})),debounce(e,t=500){let r;return(...n)=>{r&&clearTimeout(r),r=setTimeout((function(){e(...n)}),t)}},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),formatNativeUrl(e,t){if(CoreHelperUtil.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));return{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}},formatUniversalUrl(e,t){if(!CoreHelperUtil.isHttpUrl(e))return this.formatNativeUrl(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);return{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}},getOpenTargetForPlatform(e){return this.isTelegram()?"_blank":e},openHref(e,t,r){window.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},returnOpenHref(e,t,r){return window.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},isTelegram:()=>"undefined"!=typeof window&&(Boolean(window.TelegramWebviewProxy)||Boolean(window.Telegram)||Boolean(window.TelegramWebviewProxyProto)),async preloadImage(e){const t=new Promise(((t,r)=>{const n=new Image;n.onload=t,n.onerror=r,n.crossOrigin="anonymous",n.src=e}));return Promise.race([t,CoreHelperUtil.wait(2e3)])},formatBalance(e,t){let r="0.000";if("string"==typeof e){const t=Number(e);if(t){const e=Math.floor(1e3*t)/1e3;e&&(r=e.toString())}}return`${r}${t?` ${t}`:""}`},formatBalance2(e,t){var r;let n;if("0"===e)n="0";else if("string"==typeof e){const t=Number(e);t&&(n=null==(r=t.toString().match(/^-?\d+(?:\.\d{0,3})?/u))?void 0:r[0])}return{value:n??"0",rest:"0"===n?"000":"",symbol:t}},getApiUrl:()=>ConstantsUtil$3.W3M_API_URL,getBlockchainApiUrl:()=>ConstantsUtil$3.BLOCKCHAIN_API_RPC_URL,getAnalyticsUrl:()=>ConstantsUtil$3.PULSE_API_URL,getUUID:()=>(null==crypto?void 0:crypto.randomUUID)?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),parseError(e){var t,r;return"string"==typeof e?e:"string"==typeof(null==(r=null==(t=null==e?void 0:e.issues)?void 0:t[0])?void 0:r.message)?e.issues[0].message:e instanceof Error?e.message:"Unknown error"},sortRequestedNetworks(e,t=[]){const r={};return t&&e&&(e.forEach(((e,t)=>{r[e]=t})),t.sort(((e,t)=>{const n=r[e.id],i=r[t.id];return void 0!==n&&void 0!==i?n-i:void 0!==n?-1:void 0!==i?1:0}))),t},calculateBalance(e){let t=0;for(const r of e)t+=r.value??0;return t},formatTokenBalance(e){const t=e.toFixed(2),[r,n]=t.split(".");return{dollars:r,pennies:n}},isAddress(e,t="eip155"){switch(t){case"eip155":return!!/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&!(!/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&!/^(?:0x)?[0-9A-F]{40}$/iu.test(e));case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);default:return!1}},uniqueBy(e,t){const r=new Set;return e.filter((e=>{const n=e[t];return!r.has(n)&&(r.add(n),!0)}))},generateSdkVersion:(e,t,r)=>`${t}-${0===e.length?"universal":e.map((e=>e.adapterType)).join(",")}-${r}`};async function fetchData(...e){const t=await fetch(...e);if(!t.ok){throw new Error(`HTTP status code: ${t.status}`,{cause:t})}return t}class FetchUtil{constructor({baseUrl:e,clientId:t}){this.baseUrl=e,this.clientId=t}async get({headers:e,signal:t,cache:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"GET",headers:e,signal:t,cache:r})).json()}async getBlob({headers:e,signal:t,...r}){const n=this.createUrl(r);return(await fetchData(n,{method:"GET",headers:e,signal:t})).blob()}async post({body:e,headers:t,signal:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"POST",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:t,signal:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"PUT",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:t,signal:r,...n}){const i=this.createUrl(n);return(await fetchData(i,{method:"DELETE",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:t}){const r=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach((([e,t])=>{t&&r.searchParams.append(e,t)})),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}const state$o=proxy$1({features:ConstantsUtil$2.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined"}),OptionsController={state:state$o,subscribeKey:(e,t)=>subscribeKey$1(state$o,e,t),setOptions(e){Object.assign(state$o,e)},setFeatures(e){e&&Object.entries(e).forEach((([e,t])=>{state$o.features||(state$o.features=ConstantsUtil$2.DEFAULT_FEATURES),e in state$o.features&&(state$o.features[e]=t)}))},setProjectId(e){state$o.projectId=e},setAllWallets(e){state$o.allWallets=e},setIncludeWalletIds(e){state$o.includeWalletIds=e},setExcludeWalletIds(e){state$o.excludeWalletIds=e},setFeaturedWalletIds(e){state$o.featuredWalletIds=e},setTokens(e){state$o.tokens=e},setTermsConditionsUrl(e){state$o.termsConditionsUrl=e},setPrivacyPolicyUrl(e){state$o.privacyPolicyUrl=e},setCustomWallets(e){state$o.customWallets=e},setIsSiweEnabled(e){state$o.isSiweEnabled=e},setIsUniversalProvider(e){state$o.isUniversalProvider=e},setSdkVersion(e){state$o.sdkVersion=e},setMetadata(e){state$o.metadata=e},setDisableAppend(e){state$o.disableAppend=e},setEIP6963Enabled(e){state$o.enableEIP6963=e},setDebug(e){state$o.debug=e},setEnableWalletConnect(e){state$o.enableWalletConnect=e},setEnableWallets(e){state$o.enableWallets=e},setHasMultipleAddresses(e){state$o.hasMultipleAddresses=e}},DEFAULT_OPTIONS={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},baseUrl$2=CoreHelperUtil.getBlockchainApiUrl(),state$n=proxy$1({clientId:null,api:new FetchUtil({baseUrl:baseUrl$2,clientId:null})}),BlockchainApiController={state:state$n,fetchIdentity:({address:e})=>state$n.api.get({path:`/v1/identity/${e}`,params:{projectId:OptionsController.state.projectId,sender:ChainController.state.activeCaipAddress?CoreHelperUtil.getPlainAddress(ChainController.state.activeCaipAddress):void 0}}),fetchTransactions:({account:e,projectId:t,cursor:r,onramp:n,signal:i,cache:o,chainId:s})=>state$n.api.get({path:`/v1/account/${e}/history`,params:{projectId:t,cursor:r,onramp:n,chainId:s},signal:i,cache:o}),fetchSwapQuote:({projectId:e,amount:t,userAddress:r,from:n,to:i,gasPrice:o})=>state$n.api.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{projectId:e,amount:t,userAddress:r,from:n,to:i,gasPrice:o}}),fetchSwapTokens:({projectId:e,chainId:t})=>state$n.api.get({path:"/v1/convert/tokens",params:{projectId:e,chainId:t}}),fetchTokenPrice:({projectId:e,addresses:t})=>state$n.api.post({path:"/v1/fungible/price",body:{projectId:e,currency:"usd",addresses:t},headers:{"Content-Type":"application/json"}}),fetchSwapAllowance({projectId:e,tokenAddress:t,userAddress:r}){const{sdkType:n,sdkVersion:i}=OptionsController.state;return state$n.api.get({path:"/v1/convert/allowance",params:{projectId:e,tokenAddress:t,userAddress:r},headers:{"Content-Type":"application/json","x-sdk-type":n,"x-sdk-version":i||"html-wagmi-4.2.2"}})},fetchGasPrice({projectId:e,chainId:t}){const{sdkType:r,sdkVersion:n}=OptionsController.state;return state$n.api.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json","x-sdk-type":r,"x-sdk-version":n||"html-wagmi-4.2.2"},params:{projectId:e,chainId:t}})},generateSwapCalldata:({amount:e,from:t,projectId:r,to:n,userAddress:i})=>state$n.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:ConstantsUtil$2.CONVERT_SLIPPAGE_TOLERANCE},from:t,projectId:r,to:n,userAddress:i}}),generateApproveCalldata({from:e,projectId:t,to:r,userAddress:n}){const{sdkType:i,sdkVersion:o}=OptionsController.state;return state$n.api.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json","x-sdk-type":i,"x-sdk-version":o||"html-wagmi-4.2.2"},params:{projectId:t,userAddress:n,from:e,to:r}})},async getBalance(e,t,r){const{sdkType:n,sdkVersion:i}=OptionsController.state;return state$n.api.get({path:`/v1/account/${e}/balance`,headers:{"x-sdk-type":n,"x-sdk-version":i||"html-wagmi-4.2.2"},params:{currency:"usd",projectId:OptionsController.state.projectId,chainId:t,forceUpdate:r}})},lookupEnsName:async e=>state$n.api.get({path:`/v1/profile/account/${e}`,params:{projectId:OptionsController.state.projectId,apiVersion:"2"}}),reverseLookupEnsName:async({address:e})=>state$n.api.get({path:`/v1/profile/reverse/${e}`,params:{sender:AccountController.state.address,projectId:OptionsController.state.projectId,apiVersion:"2"}}),getEnsNameSuggestions:async e=>state$n.api.get({path:`/v1/profile/suggestions/${e}`,params:{projectId:OptionsController.state.projectId,zone:"reown.id"}}),registerEnsName:async({coinType:e,address:t,message:r,signature:n})=>state$n.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:r,signature:n},headers:{"Content-Type":"application/json"}}),generateOnRampURL:async({destinationWallets:e,partnerUserId:t,defaultNetwork:r,purchaseAmount:n,paymentAmount:i})=>(await state$n.api.post({path:"/v1/generators/onrampurl",params:{projectId:OptionsController.state.projectId},body:{destinationWallets:e,defaultNetwork:r,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:n,presetFiatAmount:i}})).url,async getOnrampOptions(){try{return await state$n.api.get({path:"/v1/onramp/options",params:{projectId:OptionsController.state.projectId}})}catch(e2){return DEFAULT_OPTIONS}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:r,network:n}){try{return await state$n.api.post({path:"/v1/onramp/quote",params:{projectId:OptionsController.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:r,network:n}})}catch(e2){return{coinbaseFee:{amount:r,currency:t.id},networkFee:{amount:r,currency:t.id},paymentSubtotal:{amount:r,currency:t.id},paymentTotal:{amount:r,currency:t.id},purchaseAmount:{amount:r,currency:t.id},quoteId:"mocked-quote-id"}}},setClientId(e){state$n.clientId=e,state$n.api=new FetchUtil({baseUrl:baseUrl$2,clientId:e})}},state$m=proxy$1({message:"",variant:"success",open:!1}),SnackController={state:state$m,subscribeKey:(e,t)=>subscribeKey$1(state$m,e,t),showLoading(e){this._showMessage(e,"loading")},showSuccess(e){this._showMessage(e,"success")},showError(e){const t=CoreHelperUtil.parseError(e);this._showMessage(t,"error")},hide(){state$m.open=!1},_showMessage(e,t){state$m.open?(state$m.open=!1,setTimeout((()=>{state$m.message=e,state$m.variant=t,state$m.open=!0}),150)):(state$m.message=e,state$m.variant=t,state$m.open=!0)}},baseUrl$1=CoreHelperUtil.getAnalyticsUrl(),api$3=new FetchUtil({baseUrl:baseUrl$1,clientId:null}),excluded=["MODAL_CREATED"],state$l=proxy$1({timestamp:Date.now(),data:{type:"track",event:"MODAL_CREATED"}}),EventsController={state:state$l,subscribe:e=>subscribe$1(state$l,(()=>e(state$l))),_getApiHeaders(){const{projectId:e,sdkType:t,sdkVersion:r}=OptionsController.state;return{"x-project-id":e,"x-sdk-type":t,"x-sdk-version":r||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(e){try{if(excluded.includes(e.data.event)||"undefined"==typeof window)return;await api$3.post({path:"/e",headers:EventsController._getApiHeaders(),body:{eventId:CoreHelperUtil.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:e.data}})}catch{}},sendEvent(e){var t;state$l.timestamp=Date.now(),state$l.data=e,(null==(t=OptionsController.state.features)?void 0:t.analytics)&&EventsController._sendAnalyticsEvent(state$l)}};function getDefaultExportFromCjs$1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var browser$i={exports:{}},process=browser$i.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(e2){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(e2){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e2){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e2){cachedClearTimeout=defaultClearTimeout}}();var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop$2(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop$2,process.addListener=noop$2,process.once=noop$2,process.off=noop$2,process.removeListener=noop$2,process.removeAllListeners=noop$2,process.emit=noop$2,process.prependListener=noop$2,process.prependOnceListener=noop$2,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};var browserExports$1=browser$i.exports;const process$1=getDefaultExportFromCjs$1(browserExports$1),SECURE_SITE_SDK=process$1.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL||"https://secure.walletconnect.org/sdk",DEFAULT_LOG_LEVEL=process$1.env.NEXT_PUBLIC_DEFAULT_LOG_LEVEL||"error",W3mFrameConstants={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",FRAME_SWITCH_NETWORK_ERROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},W3mFrameRpcConstants={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}};var util$d,util2,objectUtil,objectUtil2;util2=util$d||(util$d={}),util2.assertEqual=e=>e,util2.assertIs=function(e){},util2.assertNever=function(e){throw new Error},util2.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},util2.getValidEnumValues=e=>{const t=util2.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),r={};for(const n of t)r[n]=e[n];return util2.objectValues(r)},util2.objectValues=e=>util2.objectKeys(e).map((function(t){return e[t]})),util2.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},util2.find=(e,t)=>{for(const r of e)if(t(r))return r},util2.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,util2.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},util2.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,objectUtil2=objectUtil||(objectUtil={}),objectUtil2.mergeShapes=(e,t)=>({...e,...t});const ZodParsedType=util$d.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(e)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(e)?ZodParsedType.array:null===e?ZodParsedType.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ZodParsedType.promise:"undefined"!=typeof Map&&e instanceof Map?ZodParsedType.map:"undefined"!=typeof Set&&e instanceof Set?ZodParsedType.set:"undefined"!=typeof Date&&e instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$d.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(n);else if("invalid_return_type"===i.code)n(i.returnTypeError);else if("invalid_arguments"===i.code)n(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,n=0;for(;n<i.path.length;){const r=i.path[n];n===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$d.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(e,t)=>{let r;switch(e.code){case ZodIssueCode.invalid_type:r=e.received===ZodParsedType.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,util$d.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${util$d.joinValues(e.keys,", ")}`;break;case ZodIssueCode.invalid_union:r="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${util$d.joinValues(e.options)}`;break;case ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${util$d.joinValues(e.options)}, received '${e.received}'`;break;case ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case ZodIssueCode.invalid_date:r="Invalid date";break;case ZodIssueCode.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:util$d.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ZodIssueCode.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ZodIssueCode.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ZodIssueCode.custom:r="Invalid input";break;case ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError,util$d.assertNever(e)}return{message:r}};let overrideErrorMap=errorMap;function setErrorMap(e){overrideErrorMap=e}function getErrorMap(){return overrideErrorMap}const makeIssue=e=>{const{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};let a="";const c=n.filter((e=>!!e)).slice().reverse();for(const l of c)a=l(s,{data:t,defaultError:a}).message;return{...i,path:o,message:i.message||a}},EMPTY_PATH=[];function addIssueToContext(e,t){const r=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e))});e.common.issues.push(r)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return INVALID;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const n of t)r.push({key:await n.key,value:await n.value});return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:i}=n;if("aborted"===t.status)return INVALID;if("aborted"===i.status)return INVALID;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!n.alwaysSet||(r[t.value]=i.value)}return{status:e.value,value:r}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;var errorUtil,errorUtil2;errorUtil2=errorUtil||(errorUtil={}),errorUtil2.errToObj=e=>"string"==typeof e?{message:e}:e||{},errorUtil2.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=r?r:t.defaultError},description:i}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parseSync({data:e,path:n.path,parent:n});return handleResult(n,i)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},n=this._parse({data:e,path:r.path,parent:r}),i=await(isAsync(n)?n:Promise.resolve(n));return handleResult(r,i)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),o=()=>n.addIssue({code:ZodIssueCode.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(o(),!1))):!!i||(o(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[a-z][a-z0-9]*$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,datetimeRegex=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function isValidIP(e,t){return!("v4"!==t&&t||!ipv4Regex.test(e))||!("v6"!==t&&t||!ipv6Regex.test(e))}class ZodString extends ZodType{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==ZodParsedType.string){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:t.parsedType}),INVALID}const t=new ParseStatus;let r;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const n=e.data.length>i.value,o=e.data.length<i.value;(n||o)&&(r=this._getOrReturnCtx(e,r),n?addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)emailRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"email",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"emoji",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)uuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"uuid",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)cuidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)cuid2Regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)ulidRegex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ulid",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(n){r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"url",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"regex",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){datetimeRegex(i).test(e.data)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else"ip"===i.kind?isValidIP(e.data,i.version)||(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{validation:"ip",code:ZodIssueCode.invalid_string,message:i.message}),t.dirty()):util$d.assertNever(i);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(r)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...errorUtil.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...errorUtil.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...errorUtil.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...errorUtil.errToObj(t)})}nonempty(e){return this.min(1,errorUtil.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==ZodParsedType.number){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const n of this._def.checks)if("int"===n.kind)util$d.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==floatSafeRemainder(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_finite,message:n.message}),r.dirty()):util$d.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,n){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&util$d.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==ZodParsedType.bigint){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:t.parsedType}),INVALID}let t;const r=new ParseStatus;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),addIssueToContext(t,{code:ZodIssueCode.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):util$d.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,errorUtil.toString(t))}setLimit(e,t,r,n){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:errorUtil.toString(n)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==ZodParsedType.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:t.parsedType}),INVALID}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==ZodParsedType.date){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:t.parsedType}),INVALID}if(isNaN(e.data.getTime())){return addIssueToContext(this._getOrReturnCtx(e),{code:ZodIssueCode.invalid_date}),INVALID}const t=new ParseStatus;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),addIssueToContext(r,{code:ZodIssueCode.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):util$d.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:t.parsedType}),INVALID}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:t.parsedType}),INVALID}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:t.parsedType}),INVALID}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:t.parsedType}),INVALID}}ZodNever.create=e=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:t.parsedType}),INVALID}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==ZodParsedType.array)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:t.parsedType}),INVALID;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:i?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(addIssueToContext(t,{code:ZodIssueCode.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>ParseStatus.mergeArray(r,e)));const i=[...t.data].map(((e,r)=>n.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return ParseStatus.mergeArray(r,i)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ZodOptional.create(deepPartialify(n))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=util$d.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ZodParsedType.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const a in r.data)i.includes(a)||o.push(a);const s=[];for(const a of i){const e=n[a],t=r.data[a];s.push({key:{status:"valid",value:a},value:e._parse(new ParseInputLazyPath(r,t,r.path,a)),alwaysSet:a in r.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of o)s.push({key:{status:"valid",value:t},value:{status:"valid",value:r.data[t]}});else if("strict"===e)o.length>0&&(addIssueToContext(r,{code:ZodIssueCode.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const n=r.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of s){const r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(e){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,i,o,s;const a=null!==(o=null===(i=(n=this._def).errorMap)||void 0===i?void 0:i.call(n,t,r).message)&&void 0!==o?o:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=errorUtil.errToObj(e).message)&&void 0!==s?s:a}:{message:a}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};return util$d.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};return util$d.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};return util$d.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new ZodObject({...this._def,shape:()=>t})}required(e){const t={};return util$d.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ZodOptional;)e=e._def.innerType;t[r]=e}})),new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(util$d.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const r=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:r}),INVALID}));{let e;const n=[];for(const o of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=o._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=n.map((e=>new ZodError(e)));return addIssueToContext(t,{code:ZodIssueCode.invalid_union,unionErrors:i}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>e instanceof ZodLazy?getDiscriminator(e.schema):e instanceof ZodEffects?getDiscriminator(e.innerType()):e instanceof ZodLiteral?[e.value]:e instanceof ZodEnum?e.options:e instanceof ZodNativeEnum?Object.keys(e.enum):e instanceof ZodDefault?getDiscriminator(e._def.innerType):e instanceof ZodUndefined?[void 0]:e instanceof ZodNull?[null]:null;class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.object)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:t.parsedType}),INVALID;const r=this.discriminator,n=t.data[r],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const i of t){const t=getDiscriminator(i.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(n.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);n.set(r,i)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...processCreateParams(r)})}}function mergeValues(e,t){const r=getParsedType(e),n=getParsedType(t);if(e===t)return{valid:!0,data:e};if(r===ZodParsedType.object&&n===ZodParsedType.object){const r=util$d.objectKeys(t),n=util$d.objectKeys(e).filter((e=>-1!==r.indexOf(e))),i={...e,...t};for(const o of n){const r=mergeValues(e[o],t[o]);if(!r.valid)return{valid:!1};i[o]=r.data}return{valid:!0,data:i}}if(r===ZodParsedType.array&&n===ZodParsedType.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const i=mergeValues(e[n],t[n]);if(!i.valid)return{valid:!1};r.push(i.data)}return{valid:!0,data:r}}return r===ZodParsedType.date&&n===ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(isAborted(e)||isAborted(n))return INVALID;const i=mergeValues(e.value,n.value);return i.valid?((isDirty(e)||isDirty(n))&&t.dirty(),{status:t.value,value:i.data}):(addIssueToContext(r,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.array)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:r.parsedType}),INVALID;if(r.data.length<this._def.items.length)return addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID;!this._def.rest&&r.data.length>this._def.items.length&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new ParseInputLazyPath(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.object)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:r.parsedType}),INVALID;const n=[],i=this._def.keyType,o=this._def.valueType;for(const s in r.data)n.push({key:i._parse(new ParseInputLazyPath(r,s,r.path,s)),value:o._parse(new ParseInputLazyPath(r,r.data[s],r.path,s))});return r.common.async?ParseStatus.mergeObjectAsync(t,n):ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(r)}:{keyType:ZodString.create(),valueType:e,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.map)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:r.parsedType}),INVALID;const n=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map((([e,t],o)=>({key:n._parse(new ParseInputLazyPath(r,e,r.path,[o,"key"])),value:i._parse(new ParseInputLazyPath(r,t,r.path,[o,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of o){const n=await r.key,i=await r.value;if("aborted"===n.status||"aborted"===i.status)return INVALID;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of o){const n=r.key,i=r.value;if("aborted"===n.status||"aborted"===i.status)return INVALID;"dirty"!==n.status&&"dirty"!==i.status||t.dirty(),e.set(n.value,i.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==ZodParsedType.set)return addIssueToContext(r,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:r.parsedType}),INVALID;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(addIssueToContext(r,{code:ZodIssueCode.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const r=new Set;for(const n of e){if("aborted"===n.status)return INVALID;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const s=[...r.data.values()].map(((e,t)=>i._parse(new ParseInputLazyPath(r,e,r.path,t))));return r.common.async?Promise.all(s).then((e=>o(e))):o(s)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.function)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:t.parsedType}),INVALID;function r(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:r}})}function n(e,r){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:r}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const s=new ZodError([]),a=await e._def.args.parseAsync(t,i).catch((e=>{throw s.addIssue(r(t,e)),s})),c=await Reflect.apply(o,this,a);return await e._def.returns._def.type.parseAsync(c,i).catch((e=>{throw s.addIssue(n(c,e)),s}))}))}{const e=this;return OK((function(...t){const s=e._def.args.safeParse(t,i);if(!s.success)throw new ZodError([r(t,s.error)]);const a=Reflect.apply(o,this,s.data),c=e._def.returns.safeParse(a,i);if(!c.success)throw new ZodError([n(a,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(r)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{expected:util$d.joinValues(r),received:t.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return addIssueToContext(t,{received:t.data,code:ZodIssueCode.invalid_enum_value,options:r}),INVALID}return OK(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ZodEnum.create(e)}exclude(e){return ZodEnum.create(this.options.filter((t=>!e.includes(t))))}}ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(e){const t=util$d.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ZodParsedType.string&&r.parsedType!==ZodParsedType.number){const e=util$d.objectValues(t);return addIssueToContext(r,{expected:util$d.joinValues(e),received:r.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(-1===t.indexOf(e.data)){const e=util$d.objectValues(t);return addIssueToContext(r,{received:r.data,code:ZodIssueCode.invalid_enum_value,options:e}),INVALID}return OK(e.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ZodParsedType.promise&&!1===t.common.async)return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:t.parsedType}),INVALID;const r=t.parsedType===ZodParsedType.promise?t.data:Promise.resolve(t.data);return OK(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,i={addIssue:e=>{addIssueToContext(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===n.type){const e=n.transform(r.data,i);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r}))):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?INVALID:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?INVALID:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!isValid(e))return e;const o=n.transform(e.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>isValid(e)?Promise.resolve(n.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}util$d.assertNever(n)}}ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:t,...processCreateParams(r)}),ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===ZodParsedType.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===ZodParsedType.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return isAsync(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==ZodParsedType.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:t.parsedType}),INVALID}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(e)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?INVALID:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e);return isValid(t)&&(t.value=Object.freeze(t.value)),t}}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(t)});const custom$1=(e,t={},r)=>e?ZodAny.create().superRefine(((n,i)=>{var o,s;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,a=null===(s=null!==(o=e.fatal)&&void 0!==o?o:r)||void 0===s||s,c="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...c,fatal:a})}})):ZodAny.create(),late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind,ZodFirstPartyTypeKind2;ZodFirstPartyTypeKind2=ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}),ZodFirstPartyTypeKind2.ZodString="ZodString",ZodFirstPartyTypeKind2.ZodNumber="ZodNumber",ZodFirstPartyTypeKind2.ZodNaN="ZodNaN",ZodFirstPartyTypeKind2.ZodBigInt="ZodBigInt",ZodFirstPartyTypeKind2.ZodBoolean="ZodBoolean",ZodFirstPartyTypeKind2.ZodDate="ZodDate",ZodFirstPartyTypeKind2.ZodSymbol="ZodSymbol",ZodFirstPartyTypeKind2.ZodUndefined="ZodUndefined",ZodFirstPartyTypeKind2.ZodNull="ZodNull",ZodFirstPartyTypeKind2.ZodAny="ZodAny",ZodFirstPartyTypeKind2.ZodUnknown="ZodUnknown",ZodFirstPartyTypeKind2.ZodNever="ZodNever",ZodFirstPartyTypeKind2.ZodVoid="ZodVoid",ZodFirstPartyTypeKind2.ZodArray="ZodArray",ZodFirstPartyTypeKind2.ZodObject="ZodObject",ZodFirstPartyTypeKind2.ZodUnion="ZodUnion",ZodFirstPartyTypeKind2.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ZodFirstPartyTypeKind2.ZodIntersection="ZodIntersection",ZodFirstPartyTypeKind2.ZodTuple="ZodTuple",ZodFirstPartyTypeKind2.ZodRecord="ZodRecord",ZodFirstPartyTypeKind2.ZodMap="ZodMap",ZodFirstPartyTypeKind2.ZodSet="ZodSet",ZodFirstPartyTypeKind2.ZodFunction="ZodFunction",ZodFirstPartyTypeKind2.ZodLazy="ZodLazy",ZodFirstPartyTypeKind2.ZodLiteral="ZodLiteral",ZodFirstPartyTypeKind2.ZodEnum="ZodEnum",ZodFirstPartyTypeKind2.ZodEffects="ZodEffects",ZodFirstPartyTypeKind2.ZodNativeEnum="ZodNativeEnum",ZodFirstPartyTypeKind2.ZodOptional="ZodOptional",ZodFirstPartyTypeKind2.ZodNullable="ZodNullable",ZodFirstPartyTypeKind2.ZodDefault="ZodDefault",ZodFirstPartyTypeKind2.ZodCatch="ZodCatch",ZodFirstPartyTypeKind2.ZodPromise="ZodPromise",ZodFirstPartyTypeKind2.ZodBranded="ZodBranded",ZodFirstPartyTypeKind2.ZodPipeline="ZodPipeline",ZodFirstPartyTypeKind2.ZodReadonly="ZodReadonly";const instanceOfType=(e,t={message:`Input not instance of ${e.name}`})=>custom$1((t=>t instanceof e),t),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce$5={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},NEVER=INVALID;var z$8=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:setErrorMap,getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:EMPTY_PATH,addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:INVALID,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return util$d},get objectUtil(){return objectUtil},ZodParsedType:ZodParsedType,getParsedType:getParsedType,ZodType:ZodType,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:BRAND,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom$1,Schema:ZodType,ZodSchema:ZodType,late:late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce:coerce$5,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean:oboolean,onumber:onumber,optional:optionalType,ostring:ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER:NEVER,ZodIssueCode:ZodIssueCode,quotelessJson:quotelessJson,ZodError:ZodError});const zError=z$8.object({message:z$8.string()});function zType(e){return z$8.literal(W3mFrameConstants[e])}z$8.object({accessList:z$8.array(z$8.string()),blockHash:z$8.string().nullable(),blockNumber:z$8.string().nullable(),chainId:z$8.string().or(z$8.number()),from:z$8.string(),gas:z$8.string(),hash:z$8.string(),input:z$8.string().nullable(),maxFeePerGas:z$8.string(),maxPriorityFeePerGas:z$8.string(),nonce:z$8.string(),r:z$8.string(),s:z$8.string(),to:z$8.string(),transactionIndex:z$8.string().nullable(),type:z$8.string(),v:z$8.string(),value:z$8.string()});const AppSwitchNetworkRequest=z$8.object({chainId:z$8.string().or(z$8.number())}),AppConnectEmailRequest=z$8.object({email:z$8.string().email()}),AppConnectOtpRequest=z$8.object({otp:z$8.string()}),AppConnectSocialRequest=z$8.object({uri:z$8.string()}),AppGetUserRequest=z$8.object({chainId:z$8.optional(z$8.string().or(z$8.number())),preferredAccountType:z$8.optional(z$8.string())}),AppGetSocialRedirectUriRequest=z$8.object({provider:z$8.enum(["google","github","apple","facebook","x","discord"])}),AppUpdateEmailRequest=z$8.object({email:z$8.string().email()}),AppUpdateEmailPrimaryOtpRequest=z$8.object({otp:z$8.string()}),AppUpdateEmailSecondaryOtpRequest=z$8.object({otp:z$8.string()}),AppSyncThemeRequest=z$8.object({themeMode:z$8.optional(z$8.enum(["light","dark"])),themeVariables:z$8.optional(z$8.record(z$8.string(),z$8.string().or(z$8.number()))),w3mThemeVariables:z$8.optional(z$8.record(z$8.string(),z$8.string()))}),AppSyncDappDataRequest=z$8.object({metadata:z$8.object({name:z$8.string(),description:z$8.string(),url:z$8.string(),icons:z$8.array(z$8.string())}).optional(),sdkVersion:z$8.string().optional(),sdkType:z$8.string().optional(),projectId:z$8.string()}),AppSetPreferredAccountRequest=z$8.object({type:z$8.string()}),FrameConnectEmailResponse=z$8.object({action:z$8.enum(["VERIFY_DEVICE","VERIFY_OTP"])}),FrameGetFarcasterUriResponse=z$8.object({url:z$8.string()}),FrameConnectFarcasterResponse=z$8.object({userName:z$8.string()}),FrameConnectSocialResponse=z$8.object({email:z$8.string(),address:z$8.string(),chainId:z$8.string().or(z$8.number()),accounts:z$8.array(z$8.object({address:z$8.string(),type:z$8.enum([W3mFrameRpcConstants.ACCOUNT_TYPES.EOA,W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:z$8.string().optional()}),FrameUpdateEmailResponse=z$8.object({action:z$8.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),FrameGetUserResponse=z$8.object({email:z$8.string().email().optional().nullable(),address:z$8.string(),chainId:z$8.string().or(z$8.number()),smartAccountDeployed:z$8.optional(z$8.boolean()),accounts:z$8.array(z$8.object({address:z$8.string(),type:z$8.enum([W3mFrameRpcConstants.ACCOUNT_TYPES.EOA,W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:z$8.optional(z$8.string())}),FrameGetSocialRedirectUriResponse=z$8.object({uri:z$8.string()}),FrameIsConnectedResponse=z$8.object({isConnected:z$8.boolean()}),FrameGetChainIdResponse=z$8.object({chainId:z$8.string().or(z$8.number())}),FrameSwitchNetworkResponse=z$8.object({chainId:z$8.string().or(z$8.number())}),FrameUpdateEmailSecondaryOtpResponse=z$8.object({newEmail:z$8.string().email()}),FrameGetSmartAccountEnabledNetworksResponse=z$8.object({smartAccountEnabledNetworks:z$8.array(z$8.number())});z$8.object({address:z$8.string(),isDeployed:z$8.boolean()});const FrameReadyResponse=z$8.object({version:z$8.string().optional()}),FrameSetPreferredAccountResponse=z$8.object({type:z$8.string(),address:z$8.string()}),RpcResponse=z$8.any(),RpcEthAccountsRequest=z$8.object({method:z$8.literal("eth_accounts")}),RpcEthBlockNumber=z$8.object({method:z$8.literal("eth_blockNumber")}),RpcEthCall=z$8.object({method:z$8.literal("eth_call"),params:z$8.array(z$8.any())}),RpcEthChainId=z$8.object({method:z$8.literal("eth_chainId")}),RpcEthEstimateGas=z$8.object({method:z$8.literal("eth_estimateGas"),params:z$8.array(z$8.any())}),RpcEthFeeHistory=z$8.object({method:z$8.literal("eth_feeHistory"),params:z$8.array(z$8.any())}),RpcEthGasPrice=z$8.object({method:z$8.literal("eth_gasPrice")}),RpcEthGetAccount=z$8.object({method:z$8.literal("eth_getAccount"),params:z$8.array(z$8.any())}),RpcEthGetBalance=z$8.object({method:z$8.literal("eth_getBalance"),params:z$8.array(z$8.any())}),RpcEthGetBlockyByHash=z$8.object({method:z$8.literal("eth_getBlockByHash"),params:z$8.array(z$8.any())}),RpcEthGetBlockByNumber=z$8.object({method:z$8.literal("eth_getBlockByNumber"),params:z$8.array(z$8.any())}),RpcEthGetBlockReceipts=z$8.object({method:z$8.literal("eth_getBlockReceipts"),params:z$8.array(z$8.any())}),RcpEthGetBlockTransactionCountByHash=z$8.object({method:z$8.literal("eth_getBlockTransactionCountByHash"),params:z$8.array(z$8.any())}),RcpEthGetBlockTransactionCountByNumber=z$8.object({method:z$8.literal("eth_getBlockTransactionCountByNumber"),params:z$8.array(z$8.any())}),RpcEthGetCode=z$8.object({method:z$8.literal("eth_getCode"),params:z$8.array(z$8.any())}),RpcEthGetFilter=z$8.object({method:z$8.literal("eth_getFilterChanges"),params:z$8.array(z$8.any())}),RpcEthGetFilterLogs=z$8.object({method:z$8.literal("eth_getFilterLogs"),params:z$8.array(z$8.any())}),RpcEthGetLogs=z$8.object({method:z$8.literal("eth_getLogs"),params:z$8.array(z$8.any())}),RpcEthGetProof=z$8.object({method:z$8.literal("eth_getProof"),params:z$8.array(z$8.any())}),RpcEthGetStorageAt=z$8.object({method:z$8.literal("eth_getStorageAt"),params:z$8.array(z$8.any())}),RpcEthGetTransactionByBlockHashAndIndex=z$8.object({method:z$8.literal("eth_getTransactionByBlockHashAndIndex"),params:z$8.array(z$8.any())}),RpcEthGetTransactionByBlockNumberAndIndex=z$8.object({method:z$8.literal("eth_getTransactionByBlockNumberAndIndex"),params:z$8.array(z$8.any())}),RpcEthGetTransactionByHash=z$8.object({method:z$8.literal("eth_getTransactionByHash"),params:z$8.array(z$8.any())}),RpcEthGetTransactionCount=z$8.object({method:z$8.literal("eth_getTransactionCount"),params:z$8.array(z$8.any())}),RpcEthGetTransactionReceipt=z$8.object({method:z$8.literal("eth_getTransactionReceipt"),params:z$8.array(z$8.any())}),RpcEthGetUncleCountByBlockHash=z$8.object({method:z$8.literal("eth_getUncleCountByBlockHash"),params:z$8.array(z$8.any())}),RpcEthGetUncleCountByBlockNumber=z$8.object({method:z$8.literal("eth_getUncleCountByBlockNumber"),params:z$8.array(z$8.any())}),RpcEthMaxPriorityFeePerGas=z$8.object({method:z$8.literal("eth_maxPriorityFeePerGas")}),RpcEthNewBlockFilter=z$8.object({method:z$8.literal("eth_newBlockFilter")}),RpcEthNewFilter=z$8.object({method:z$8.literal("eth_newFilter"),params:z$8.array(z$8.any())}),RpcEthNewPendingTransactionFilter=z$8.object({method:z$8.literal("eth_newPendingTransactionFilter")}),RpcEthSendRawTransaction=z$8.object({method:z$8.literal("eth_sendRawTransaction"),params:z$8.array(z$8.any())}),RpcEthSyncing=z$8.object({method:z$8.literal("eth_syncing"),params:z$8.array(z$8.any())}),RpcUnistallFilter=z$8.object({method:z$8.literal("eth_uninstallFilter"),params:z$8.array(z$8.any())}),RpcPersonalSignRequest=z$8.object({method:z$8.literal("personal_sign"),params:z$8.array(z$8.any())}),RpcEthSignTypedDataV4=z$8.object({method:z$8.literal("eth_signTypedData_v4"),params:z$8.array(z$8.any())}),RpcEthSendTransactionRequest=z$8.object({method:z$8.literal("eth_sendTransaction"),params:z$8.array(z$8.any())}),RpcSolanaSignMessageRequest=z$8.object({method:z$8.literal("solana_signMessage"),params:z$8.object({message:z$8.string(),pubkey:z$8.string()})}),RpcSolanaSignTransactionRequest=z$8.object({method:z$8.literal("solana_signTransaction"),params:z$8.object({transaction:z$8.string()})}),RpcSolanaSignAllTransactionsRequest=z$8.object({method:z$8.literal("solana_signAllTransactions"),params:z$8.object({transactions:z$8.array(z$8.string())})}),RpcSolanaSignAndSendTransactionRequest=z$8.object({method:z$8.literal("solana_signAndSendTransaction"),params:z$8.object({transaction:z$8.string(),options:z$8.object({skipPreflight:z$8.boolean().optional(),preflightCommitment:z$8.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:z$8.number().optional(),minContextSlot:z$8.number().optional()}).optional()})}),WalletSendCallsRequest=z$8.object({method:z$8.literal("wallet_sendCalls"),params:z$8.array(z$8.object({chainId:z$8.string().or(z$8.number()).optional(),from:z$8.string().optional(),version:z$8.string().optional(),capabilities:z$8.any().optional(),calls:z$8.array(z$8.object({to:z$8.string().startsWith("0x"),data:z$8.string().startsWith("0x").optional(),value:z$8.string().optional()}))}))}),WalletGetCallsReceiptRequest=z$8.object({method:z$8.literal("wallet_getCallsStatus"),params:z$8.array(z$8.string())}),WalletGetCapabilitiesRequest=z$8.object({method:z$8.literal("wallet_getCapabilities")}),WalletGrantPermissionsRequest=z$8.object({method:z$8.literal("wallet_grantPermissions"),params:z$8.array(z$8.any())}),FrameSession=z$8.object({token:z$8.string()}),EventSchema=z$8.object({id:z$8.string().optional()}),W3mFrameSchema={appEvent:EventSchema.extend({type:zType("APP_SWITCH_NETWORK"),payload:AppSwitchNetworkRequest}).or(EventSchema.extend({type:zType("APP_CONNECT_EMAIL"),payload:AppConnectEmailRequest})).or(EventSchema.extend({type:zType("APP_CONNECT_DEVICE")})).or(EventSchema.extend({type:zType("APP_CONNECT_OTP"),payload:AppConnectOtpRequest})).or(EventSchema.extend({type:zType("APP_CONNECT_SOCIAL"),payload:AppConnectSocialRequest})).or(EventSchema.extend({type:zType("APP_GET_FARCASTER_URI")})).or(EventSchema.extend({type:zType("APP_CONNECT_FARCASTER")})).or(EventSchema.extend({type:zType("APP_GET_USER"),payload:z$8.optional(AppGetUserRequest)})).or(EventSchema.extend({type:zType("APP_GET_SOCIAL_REDIRECT_URI"),payload:AppGetSocialRedirectUriRequest})).or(EventSchema.extend({type:zType("APP_SIGN_OUT")})).or(EventSchema.extend({type:zType("APP_IS_CONNECTED"),payload:z$8.optional(FrameSession)})).or(EventSchema.extend({type:zType("APP_GET_CHAIN_ID")})).or(EventSchema.extend({type:zType("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(EventSchema.extend({type:zType("APP_INIT_SMART_ACCOUNT")})).or(EventSchema.extend({type:zType("APP_SET_PREFERRED_ACCOUNT"),payload:AppSetPreferredAccountRequest})).or(EventSchema.extend({type:zType("APP_RPC_REQUEST"),payload:RpcPersonalSignRequest.or(RpcEthSendTransactionRequest).or(RpcEthAccountsRequest).or(RpcEthBlockNumber).or(RpcEthCall).or(RpcEthChainId).or(RpcEthEstimateGas).or(RpcEthFeeHistory).or(RpcEthGasPrice).or(RpcEthGetAccount).or(RpcEthGetBalance).or(RpcEthGetBlockyByHash).or(RpcEthGetBlockByNumber).or(RpcEthGetBlockReceipts).or(RcpEthGetBlockTransactionCountByHash).or(RcpEthGetBlockTransactionCountByNumber).or(RpcEthGetCode).or(RpcEthGetFilter).or(RpcEthGetFilterLogs).or(RpcEthGetLogs).or(RpcEthGetProof).or(RpcEthGetStorageAt).or(RpcEthGetTransactionByBlockHashAndIndex).or(RpcEthGetTransactionByBlockNumberAndIndex).or(RpcEthGetTransactionByHash).or(RpcEthGetTransactionCount).or(RpcEthGetTransactionReceipt).or(RpcEthGetUncleCountByBlockHash).or(RpcEthGetUncleCountByBlockNumber).or(RpcEthMaxPriorityFeePerGas).or(RpcEthNewBlockFilter).or(RpcEthNewFilter).or(RpcEthNewPendingTransactionFilter).or(RpcEthSendRawTransaction).or(RpcEthSyncing).or(RpcUnistallFilter).or(RpcPersonalSignRequest).or(RpcEthSignTypedDataV4).or(RpcEthSendTransactionRequest).or(RpcSolanaSignMessageRequest).or(RpcSolanaSignTransactionRequest).or(RpcSolanaSignAllTransactionsRequest).or(RpcSolanaSignAndSendTransactionRequest).or(WalletGetCallsReceiptRequest).or(WalletSendCallsRequest).or(WalletGetCapabilitiesRequest).or(WalletGrantPermissionsRequest)})).or(EventSchema.extend({type:zType("APP_UPDATE_EMAIL"),payload:AppUpdateEmailRequest})).or(EventSchema.extend({type:zType("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:AppUpdateEmailPrimaryOtpRequest})).or(EventSchema.extend({type:zType("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:AppUpdateEmailSecondaryOtpRequest})).or(EventSchema.extend({type:zType("APP_SYNC_THEME"),payload:AppSyncThemeRequest})).or(EventSchema.extend({type:zType("APP_SYNC_DAPP_DATA"),payload:AppSyncDappDataRequest})),frameEvent:EventSchema.extend({type:zType("FRAME_SWITCH_NETWORK_ERROR"),payload:zError}).or(EventSchema.extend({type:zType("FRAME_SWITCH_NETWORK_SUCCESS"),payload:FrameSwitchNetworkResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_EMAIL_SUCCESS"),payload:FrameConnectEmailResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_EMAIL_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:FrameGetFarcasterUriResponse})).or(EventSchema.extend({type:zType("FRAME_GET_FARCASTER_URI_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:FrameConnectFarcasterResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_FARCASTER_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_OTP_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_OTP_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_CONNECT_DEVICE_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_CONNECT_DEVICE_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:FrameConnectSocialResponse})).or(EventSchema.extend({type:zType("FRAME_CONNECT_SOCIAL_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_USER_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_USER_SUCCESS"),payload:FrameGetUserResponse})).or(EventSchema.extend({type:zType("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:FrameGetSocialRedirectUriResponse})).or(EventSchema.extend({type:zType("FRAME_SIGN_OUT_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SIGN_OUT_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_IS_CONNECTED_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_IS_CONNECTED_SUCCESS"),payload:FrameIsConnectedResponse})).or(EventSchema.extend({type:zType("FRAME_GET_CHAIN_ID_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_GET_CHAIN_ID_SUCCESS"),payload:FrameGetChainIdResponse})).or(EventSchema.extend({type:zType("FRAME_RPC_REQUEST_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_RPC_REQUEST_SUCCESS"),payload:RpcResponse})).or(EventSchema.extend({type:zType("FRAME_SESSION_UPDATE"),payload:FrameSession})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_SUCCESS"),payload:FrameUpdateEmailResponse})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:FrameUpdateEmailSecondaryOtpResponse})).or(EventSchema.extend({type:zType("FRAME_SYNC_THEME_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SYNC_THEME_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_SYNC_DAPP_DATA_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(EventSchema.extend({type:zType("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:FrameGetSmartAccountEnabledNetworksResponse})).or(EventSchema.extend({type:zType("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:FrameSetPreferredAccountResponse})).or(EventSchema.extend({type:zType("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:zError})).or(EventSchema.extend({type:zType("FRAME_READY"),payload:FrameReadyResponse}))},W3mFrameStorage={set(e,t){W3mFrameHelpers.isClient&&localStorage.setItem(`${W3mFrameConstants.STORAGE_KEY}${e}`,t)},get:e=>W3mFrameHelpers.isClient?localStorage.getItem(`${W3mFrameConstants.STORAGE_KEY}${e}`):null,delete(e,t){W3mFrameHelpers.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${W3mFrameConstants.STORAGE_KEY}${e}`))}},RegexUtil={address:/^0x(?:[A-Fa-f0-9]{40})$/u,transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u},EMAIL_MINIMUM_TIMEOUT=3e4,W3mFrameHelpers={checkIfAllowedToTriggerEmail(){const e=W3mFrameStorage.get(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME);if(e){const t=Date.now()-Number(e);if(t<EMAIL_MINIMUM_TIMEOUT){const e=Math.ceil((EMAIL_MINIMUM_TIMEOUT-t)/1e3);throw new Error(`Please try again after ${e} seconds`)}}},getTimeToNextEmailLogin(){const e=W3mFrameStorage.get(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME);if(e){const t=Date.now()-Number(e);if(t<EMAIL_MINIMUM_TIMEOUT)return Math.ceil((EMAIL_MINIMUM_TIMEOUT-t)/1e3)}return 0},checkIfRequestExists:e=>W3mFrameRpcConstants.NOT_SAFE_RPC_METHODS.includes(e.method)||W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(e.method),getResponseType:e=>"string"==typeof e&&((null==e?void 0:e.match(RegexUtil.transactionHash))||(null==e?void 0:e.match(RegexUtil.signedMessage)))?W3mFrameConstants.RPC_RESPONSE_TYPE_TX:W3mFrameConstants.RPC_RESPONSE_TYPE_OBJECT,checkIfRequestIsSafe:e=>W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(e.method),isClient:"undefined"!=typeof window};class W3mFrame{constructor(e,t=!1,r="eip155:1"){if(this.iframe=null,this.rpcUrl=ConstantsUtil$3.BLOCKCHAIN_API_RPC_URL,this.events={registerFrameEventHandler:(e,t,r)=>{function n({data:r}){var i;if(!(null==(i=r.type)?void 0:i.includes(W3mFrameConstants.FRAME_EVENT_KEY)))return;const o=W3mFrameSchema.frameEvent.parse(r);o.id===e&&(t(o),window.removeEventListener("message",n))}W3mFrameHelpers.isClient&&(window.addEventListener("message",n),r.addEventListener("abort",(()=>{window.removeEventListener("message",n)})))},onFrameEvent:e=>{W3mFrameHelpers.isClient&&window.addEventListener("message",(({data:t})=>{var r;if(!(null==(r=t.type)?void 0:r.includes(W3mFrameConstants.FRAME_EVENT_KEY)))return;const n=W3mFrameSchema.frameEvent.parse(t);e(n)}))},onAppEvent:e=>{W3mFrameHelpers.isClient&&window.addEventListener("message",(({data:t})=>{var r;if(!(null==(r=t.type)?void 0:r.includes(W3mFrameConstants.APP_EVENT_KEY)))return;const n=W3mFrameSchema.appEvent.parse(t);e(n)}))},postAppEvent:e=>{var t;if(W3mFrameHelpers.isClient){if(!(null==(t=this.iframe)?void 0:t.contentWindow))throw new Error("W3mFrame: iframe is not set");W3mFrameSchema.appEvent.parse(e),this.iframe.contentWindow.postMessage(e,"*")}},postFrameEvent:e=>{if(W3mFrameHelpers.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");W3mFrameSchema.frameEvent.parse(e),parent.postMessage(e,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise(((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}})),t&&(this.frameLoadPromise=new Promise(((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}})),W3mFrameHelpers.isClient)){const t=document.createElement("iframe");t.id="w3m-iframe",t.src=`${SECURE_SITE_SDK}?projectId=${e}&chainId=${r}`,t.name="w3m-secure-iframe",t.style.position="fixed",t.style.zIndex="999999",t.style.display="none",t.style.animationDelay="0s, 50ms",t.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",t.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",document.body.appendChild(t),this.iframe=t,this.iframe.onload=()=>{var e;null==(e=this.frameLoadPromiseResolver)||e.resolve(void 0)},this.iframe.onerror=()=>{var e;null==(e=this.frameLoadPromiseResolver)||e.reject("Unable to load email login dependency")}}}get networks(){const e=["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map((e=>({[e]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${e}&projectId=${this.projectId}`,chainId:e}})));return Object.assign({},...e)}}function tryStringify(e){try{return JSON.stringify(e)}catch(e2){return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(e,t,r){var n=r&&r.stringify||tryStringify;if("object"==typeof e&&null!==e){var i=t.length+1;if(1===i)return e;var o=new Array(i);o[0]=n(e);for(var s=1;s<i;s++)o[s]=n(t[s]);return o.join(" ")}if("string"!=typeof e)return e;var a=t.length;if(0===a)return e;for(var c="",l=0,u=-1,d=e&&e.length||0,h=0;h<d;){if(37===e.charCodeAt(h)&&h+1<d){switch(u=u>-1?u:0,e.charCodeAt(h+1)){case 100:case 102:if(l>=a)break;if(null==t[l])break;u<h&&(c+=e.slice(u,h)),c+=Number(t[l]),u=h+2,h++;break;case 105:if(l>=a)break;if(null==t[l])break;u<h&&(c+=e.slice(u,h)),c+=Math.floor(Number(t[l])),u=h+2,h++;break;case 79:case 111:case 106:if(l>=a)break;if(void 0===t[l])break;u<h&&(c+=e.slice(u,h));var p=typeof t[l];if("string"===p){c+="'"+t[l]+"'",u=h+2,h++;break}if("function"===p){c+=t[l].name||"<anonymous>",u=h+2,h++;break}c+=n(t[l]),u=h+2,h++;break;case 115:if(l>=a)break;u<h&&(c+=e.slice(u,h)),c+=String(t[l]),u=h+2,h++;break;case 37:u<h&&(c+=e.slice(u,h)),c+="%",u=h+2,h++,l--}++l}++h}return-1===u?e:(u<d&&(c+=e.slice(u)),c)}const format=quickFormatUnescaped;var browser$h=pino;const _console=pfGlobalThisOrFallback().console||{},stdSerializers={mapHttpRequest:mock,mapHttpResponse:mock,wrapRequestSerializer:passthrough,wrapResponseSerializer:passthrough,wrapErrorSerializer:passthrough,req:mock,res:mock,err:asErrValue};function shouldSerialize(e,t){if(Array.isArray(e)){return e.filter((function(e){return"!stdSerializers.err"!==e}))}return!0===e&&Object.keys(t)}function pino(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const r=e.browser.write||_console;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},i=shouldSerialize(e.browser.serialize,n);let o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");const s=e.level||"info",a=Object.create(r);a.log||(a.log=noop$1),Object.defineProperty(a,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(a,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,set$2(c,a,"error","log"),set$2(c,a,"fatal","error"),set$2(c,a,"warn","error"),set$2(c,a,"info","log"),set$2(c,a,"debug","log"),set$2(c,a,"trace","log")}});const c={transmit:t,serialize:i,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:getTimeFunction(e)};return a.levels=pino.levels,a.level=s,a.setMaxListeners=a.getMaxListeners=a.emit=a.addListener=a.on=a.prependListener=a.once=a.prependOnceListener=a.removeListener=a.removeAllListeners=a.listeners=a.listenerCount=a.eventNames=a.write=a.flush=noop$1,a.serializers=n,a._serialize=i,a._stdErrSerialize=o,a.child=function(r,o){if(!r)throw new Error("missing bindings for child Pino");o=o||{},i&&r.serializers&&(o.serializers=r.serializers);const s=o.serializers;if(i&&s){var a=Object.assign({},n,s),c=!0===e.browser.serialize?Object.keys(a):i;delete r.serializers,applySerializers([r],c,a,this._stdErrSerialize)}function l(e){this._childLevel=1+(0|e._childLevel),this.error=bind(e,r,"error"),this.fatal=bind(e,r,"fatal"),this.warn=bind(e,r,"warn"),this.info=bind(e,r,"info"),this.debug=bind(e,r,"debug"),this.trace=bind(e,r,"trace"),a&&(this.serializers=a,this._serialize=c),t&&(this._logEvent=createLogEventShape([].concat(e._logEvent.bindings,r)))}return l.prototype=this,new l(this)},t&&(a._logEvent=createLogEventShape()),a}function set$2(e,t,r,n){const i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?noop$1:i[r]?i[r]:_console[r]||_console[n]||noop$1,wrap(e,t,r)}function wrap(e,t,r){(e.transmit||t[r]!==noop$1)&&(t[r]=function(n){return function(){const i=e.timestamp(),o=new Array(arguments.length),s=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var a=0;a<o.length;a++)o[a]=arguments[a];if(e.serialize&&!e.asObject&&applySerializers(o,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(s,asObject(this,r,o,i)):n.apply(s,o),e.transmit){const n=e.transmit.level||t.level,s=pino.levels.values[n],a=pino.levels.values[r];if(a<s)return;transmit(this,{ts:i,methodLevel:r,methodValue:a,transmitLevel:n,transmitValue:pino.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},o)}}}(t[r]))}function asObject(e,t,r,n){e._serialize&&applySerializers(r,e._serialize,e.serializers,e._stdErrSerialize);const i=r.slice();let o=i[0];const s={};n&&(s.time=n),s.level=pino.levels.values[t];let a=1+(0|e._childLevel);if(a<1&&(a=1),null!==o&&"object"==typeof o){for(;a--&&"object"==typeof i[0];)Object.assign(s,i.shift());o=i.length?format(i.shift(),i):void 0}else"string"==typeof o&&(o=format(i.shift(),i));return void 0!==o&&(s.msg=o),s}function applySerializers(e,t,r,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=pino.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i]))for(const n in e[i])t&&t.indexOf(n)>-1&&n in r&&(e[i][n]=r[n](e[i][n]))}function bind(e,t,r){return function(){const n=new Array(1+arguments.length);n[0]=t;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[r].apply(this,n)}}function transmit(e,t,r){const n=t.send,i=t.ts,o=t.methodLevel,s=t.methodValue,a=t.val,c=e._logEvent.bindings;applySerializers(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=s,n(o,e._logEvent,a),e._logEvent=createLogEventShape(c)}function createLogEventShape(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function asErrValue(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}function getTimeFunction(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?nullTime:epochTime}function mock(){return{}}function passthrough(e){return e}function noop$1(){}function nullTime(){return!1}function epochTime(){return Date.now()}function unixTime(){return Math.round(Date.now()/1e3)}function isoTime(){return new Date(Date.now()).toISOString()}function pfGlobalThisOrFallback(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e2){return e(self)||e(window)||e(this)||{}}}pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},pino.stdSerializers=stdSerializers,pino.stdTimeFunctions=Object.assign({},{nullTime:nullTime,epochTime:epochTime,unixTime:unixTime,isoTime:isoTime});const Mg=getDefaultExportFromCjs$2(browser$h),JSONStringify=e=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString()+"n":t)),JSONParse=e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))};function safeJsonParse(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSONParse(e)}catch(t){return e}}function safeJsonStringify(e){return"string"==typeof e?e:JSONStringify(e)||""}const c$7={level:"info"},n$8="custom_context",l$5=1024e3;let O$5=class{constructor(e){this.nodeValue=e,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},d$5=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new O$5(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}},L$2=class{constructor(e,t=l$5){this.level=e??"error",this.levelValue=browser$h.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d$5(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===browser$h.levels.values.error?console.error(e):t===browser$h.levels.values.warn?console.warn(e):t===browser$h.levels.values.debug?console.debug(e):t===browser$h.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(safeJsonStringify({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new d$5(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(safeJsonStringify({extraMetadata:e})),new Blob(t,{type:"application/json"})}},m$3=class{constructor(e,t=l$5){this.baseChunkLogger=new L$2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}},B$3=class{constructor(e,t=l$5){this.baseChunkLogger=new L$2(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var x$6=Object.defineProperty,S$5=Object.defineProperties,_$5=Object.getOwnPropertyDescriptors,p$5=Object.getOwnPropertySymbols,T$5=Object.prototype.hasOwnProperty,z$7=Object.prototype.propertyIsEnumerable,f$9=(e,t,r)=>t in e?x$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i$8=(e,t)=>{for(var r in t||(t={}))T$5.call(t,r)&&f$9(e,r,t[r]);if(p$5)for(var r of p$5(t))z$7.call(t,r)&&f$9(e,r,t[r]);return e},g$5=(e,t)=>S$5(e,_$5(t));function k$4(e){return g$5(i$8({},e),{level:(null==e?void 0:e.level)||c$7.level})}function v$6(e,t=n$8){return e[t]||""}function b$4(e,t,r=n$8){return e[r]=t,e}function y$6(e,t=n$8){let r="";return r=typeof e.bindings>"u"?v$6(e,t):e.bindings().context||"",r}function w$6(e,t,r=n$8){const n=y$6(e,r);return n.trim()?`${n}/${t}`:t}function E$4(e,t,r=n$8){const n=w$6(e,t,r);return b$4(e.child({context:n}),n,r)}function C$4(e){var t,r;const n=new m$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:Mg(g$5(i$8({},e.opts),{level:"trace",browser:g$5(i$8({},null==(r=e.opts)?void 0:r.browser),{write:e=>n.write(e)})})),chunkLoggerController:n}}function I$3(e){var t;const r=new B$3(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:Mg(g$5(i$8({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}function A$3(e){return typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C$4(e):I$3(e)}class W3mFrameLogger{constructor(e){var t;const r=k$4({level:DEFAULT_LOG_LEVEL}),{logger:n,chunkLoggerController:i}=A$3({opts:r});this.logger=E$4(n,this.constructor.name),this.chunkLoggerController=i,"undefined"!=typeof window&&(null==(t=this.chunkLoggerController)?void 0:t.downloadLogsBlobInBrowser)&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{var t;(null==(t=this.chunkLoggerController)?void 0:t.downloadLogsBlobInBrowser)&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}class W3mFrameProvider{constructor({projectId:e,chainId:t,onTimeout:r}){this.openRpcRequests=[],this.w3mLogger=new W3mFrameLogger(e),this.w3mFrame=new W3mFrame(e,!0,t),this.onTimeout=r}getLoginEmailUsed(){return Boolean(W3mFrameStorage.get(W3mFrameConstants.EMAIL_LOGIN_USED_KEY))}getEmail(){return W3mFrameStorage.get(W3mFrameConstants.EMAIL)}async connectEmail(e){try{W3mFrameHelpers.checkIfAllowedToTriggerEmail();const t=await this.appEvent({type:W3mFrameConstants.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting email"),t}}async connectDevice(){try{return this.appEvent({type:W3mFrameConstants.APP_CONNECT_DEVICE})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting device"),e}}async connectOtp(e){try{return this.appEvent({type:W3mFrameConstants.APP_CONNECT_OTP,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting otp"),t}}async isConnected(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_IS_CONNECTED});return e.isConnected||this.deleteAuthLoginCache(),e}catch(e){throw this.deleteAuthLoginCache(),this.w3mLogger.logger.error({error:e},"Error checking connection"),e}}async getChainId(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_GET_CHAIN_ID});return this.setLastUsedChainId(e.chainId),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting chain id"),e}}async getSocialRedirectUri(e){try{return this.appEvent({type:W3mFrameConstants.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error getting social redirect uri"),t}}async updateEmail(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error updating email"),t}}async updateEmailPrimaryOtp(e){try{return this.appEvent({type:W3mFrameConstants.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error updating email primary otp"),t}}async updateEmailSecondaryOtp(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(t.newEmail),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error updating email secondary otp"),t}}async syncTheme(e){try{return this.appEvent({type:W3mFrameConstants.APP_SYNC_THEME,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error syncing theme"),t}}async syncDappData(e){try{return this.appEvent({type:W3mFrameConstants.APP_SYNC_DAPP_DATA,payload:e})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error syncing dapp data"),t}}async getSmartAccountEnabledNetworks(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(e.smartAccountEnabledNetworks),e}catch(e){throw this.persistSmartAccountEnabledNetworks([]),this.w3mLogger.logger.error({error:e},"Error getting smart account enabled networks"),e}}async setPreferredAccount(e){try{return this.appEvent({type:W3mFrameConstants.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error setting preferred account"),t}}async connect(e){try{const t=(null==e?void 0:e.chainId)||this.getLastUsedChainId()||1,r=await this.appEvent({type:W3mFrameConstants.APP_GET_USER,payload:{...e,chainId:t}});return this.setLoginSuccess(r.email),this.setLastUsedChainId(r.chainId),r}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting"),t}}async getUser(e){try{const t=(null==e?void 0:e.chainId)||this.getLastUsedChainId()||1;return await this.appEvent({type:W3mFrameConstants.APP_GET_USER,payload:{...e,chainId:t}})}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting"),t}}async connectSocial(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_CONNECT_SOCIAL,payload:{uri:e}});return t.userName&&this.setSocialLoginSuccess(t.userName),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error connecting social"),t}}async getFarcasterUri(){try{return await this.appEvent({type:W3mFrameConstants.APP_GET_FARCASTER_URI})}catch(e){throw this.w3mLogger.logger.error({error:e},"Error getting farcaster uri"),e}}async connectFarcaster(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_CONNECT_FARCASTER});return e.userName&&this.setSocialLoginSuccess(e.userName),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error connecting farcaster"),e}}async switchNetwork(e){try{const t=await this.appEvent({type:W3mFrameConstants.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(t.chainId),t}catch(t){throw this.w3mLogger.logger.error({error:t},"Error switching network"),t}}async disconnect(){try{const e=await this.appEvent({type:W3mFrameConstants.APP_SIGN_OUT});return this.deleteAuthLoginCache(),e}catch(e){throw this.w3mLogger.logger.error({error:e},"Error disconnecting"),e}}async request(e){var t,r,n;try{if(W3mFrameRpcConstants.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();null==(t=this.rpcRequestHandler)||t.call(this,e);const n=await this.appEvent({type:W3mFrameConstants.APP_RPC_REQUEST,payload:e});return null==(r=this.rpcSuccessHandler)||r.call(this,n,e),n}catch(i){throw null==(n=this.rpcErrorHandler)||n.call(this,i,e),this.w3mLogger.logger.error({error:i},"Error requesting"),i}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_IS_CONNECTED_SUCCESS&&t.payload.isConnected&&e()}))}onNotConnected(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_IS_CONNECTED_ERROR&&e(),t.type!==W3mFrameConstants.FRAME_IS_CONNECTED_SUCCESS||t.payload.isConnected||e()}))}onConnect(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_GET_USER_SUCCESS&&e(t.payload)}))}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(t.payload):t.type===W3mFrameConstants.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:W3mFrameRpcConstants.ACCOUNT_TYPES.EOA})}))}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent((t=>{t.type===W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(t.payload.smartAccountEnabledNetworks):t.type===W3mFrameConstants.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])}))}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){try{this.openRpcRequests.forEach((({abortController:e,method:t})=>{W3mFrameRpcConstants.SAFE_RPC_METHODS.includes(t)||e.abort()})),this.openRpcRequests=[]}catch(e2){this.w3mLogger.logger.error({error:e2},"Error aborting RPC request")}}async appEvent(e){let t;function r(e){return e.replace("@w3m-app/","")}await this.w3mFrame.frameLoadPromise;const n=new AbortController,i=r(e.type);return[W3mFrameConstants.APP_CONNECT_EMAIL,W3mFrameConstants.APP_CONNECT_DEVICE,W3mFrameConstants.APP_CONNECT_OTP,W3mFrameConstants.APP_CONNECT_SOCIAL,W3mFrameConstants.APP_GET_SOCIAL_REDIRECT_URI,W3mFrameConstants.APP_GET_FARCASTER_URI].map(r).includes(i)&&(t=setTimeout((()=>{var e;null==(e=this.onTimeout)||e.call(this),n.abort()}),3e4)),new Promise(((r,o)=>{var s,a;const c=Math.random().toString(36).substring(7);if(null==(a=(s=this.w3mLogger.logger).info)||a.call(s,{event:e,id:c},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:c}),"RPC_REQUEST"===i){const t=e;this.openRpcRequests=[...this.openRpcRequests,{...t.payload,abortController:n}]}n.signal.addEventListener("abort",(()=>{o("RPC_REQUEST"===i?new Error("Request was aborted"):new Error("Something went wrong"))})),this.w3mFrame.events.registerFrameEventHandler(c,(e=>{return n=e,s=this.w3mLogger,void(n.id===c&&(null==(l=(a=s.logger).info)||l.call(a,{framEvent:n,id:c},"Received frame response"),n.type===`@w3m-frame/${i}_SUCCESS`?(t&&clearTimeout(t),"payload"in n&&r(n.payload),r(void 0)):n.type===`@w3m-frame/${i}_ERROR`&&(t&&clearTimeout(t),"payload"in n&&o(new Error((null==(u=n.payload)?void 0:u.message)||"An error occurred")),o(new Error("An error occurred")))));var n,s,a,l,u}),n.signal)}))}setNewLastEmailLoginTime(){W3mFrameStorage.set(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){W3mFrameStorage.set(W3mFrameConstants.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&W3mFrameStorage.set(W3mFrameConstants.EMAIL,e),W3mFrameStorage.set(W3mFrameConstants.EMAIL_LOGIN_USED_KEY,"true"),W3mFrameStorage.delete(W3mFrameConstants.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){W3mFrameStorage.delete(W3mFrameConstants.EMAIL_LOGIN_USED_KEY),W3mFrameStorage.delete(W3mFrameConstants.EMAIL),W3mFrameStorage.delete(W3mFrameConstants.LAST_USED_CHAIN_KEY),W3mFrameStorage.delete(W3mFrameConstants.SOCIAL_USERNAME)}setLastUsedChainId(e){e&&W3mFrameStorage.set(W3mFrameConstants.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){return Number(W3mFrameStorage.get(W3mFrameConstants.LAST_USED_CHAIN_KEY))}persistSmartAccountEnabledNetworks(e){W3mFrameStorage.set(W3mFrameConstants.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}const state$k=proxy$1({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),TransactionsController={state:state$k,subscribe:e=>subscribe$1(state$k,(()=>e(state$k))),setLastNetworkInView(e){state$k.lastNetworkInView=e},async fetchTransactions(e,t){var r;const{projectId:n}=OptionsController.state;if(!n||!e)throw new Error("Transactions can't be fetched without a projectId and an accountAddress");state$k.loading=!0;try{const i=await BlockchainApiController.fetchTransactions({account:e,projectId:n,cursor:state$k.next,onramp:t,cache:"coinbase"===t?"no-cache":void 0,chainId:null==(r=ChainController.state.activeCaipNetwork)?void 0:r.caipNetworkId}),o=this.filterSpamTransactions(i.data),s=this.filterByConnectedChain(o),a=[...state$k.transactions,...s];state$k.loading=!1,"coinbase"===t?state$k.coinbaseTransactions=this.groupTransactionsByYearAndMonth(state$k.coinbaseTransactions,i.data):(state$k.transactions=a,state$k.transactionsByYear=this.groupTransactionsByYearAndMonth(state$k.transactionsByYear,s)),state$k.empty=0===a.length,state$k.next=i.next?i.next:void 0}catch(i){EventsController.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:n,cursor:state$k.next,isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),SnackController.showError("Failed to fetch transactions"),state$k.loading=!1,state$k.empty=!0,state$k.next=void 0}},groupTransactionsByYearAndMonth(e={},t=[]){const r=e;return t.forEach((e=>{const t=new Date(e.metadata.minedAt).getFullYear(),n=new Date(e.metadata.minedAt).getMonth(),i=r[t]??{},o=(i[n]??[]).filter((t=>t.id!==e.id));r[t]={...i,[n]:[...o,e].sort(((e,t)=>new Date(t.metadata.minedAt).getTime()-new Date(e.metadata.minedAt).getTime()))}})),r},filterSpamTransactions:e=>e.filter((e=>!e.transfers.every((e=>{var t;return!0===(null==(t=e.nft_info)?void 0:t.flags.is_spam)})))),filterByConnectedChain(e){var t;const r=null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId;return e.filter((e=>e.metadata.chain===r))},clearCursor(){state$k.next=void 0},resetTransactions(){state$k.transactions=[],state$k.transactionsByYear={},state$k.lastNetworkInView=void 0,state$k.loading=!1,state$k.empty=!1,state$k.next=void 0}},state$j=proxy$1({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),ThemeController={state:state$j,subscribe:e=>subscribe$1(state$j,(()=>e(state$j))),setThemeMode(e){state$j.themeMode=e;try{const t=ConnectorController.getAuthConnector();if(t){const r=ThemeController.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:r,w3mThemeVariables:getW3mThemeVariables(r,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){state$j.themeVariables={...state$j.themeVariables,...e};try{const e=ConnectorController.getAuthConnector();if(e){const t=ThemeController.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:t,w3mThemeVariables:getW3mThemeVariables(state$j.themeVariables,state$j.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot:()=>snapshot(state$j)},state$i=proxy$1({allConnectors:[],connectors:[]}),ConnectorController={state:state$i,subscribeKey:(e,t)=>subscribeKey$1(state$i,e,t),setConnectors(e){const t=e.filter((e=>{try{proxy$1(e)}catch(t){return console.error("ConnectorController.setConnectors: Not possible to add connector",{newConnector:e,error:t}),!1}return!state$i.allConnectors.some((t=>t.id===e.id&&this.getConnectorName(t.name)===this.getConnectorName(e.name)&&t.chain===e.chain))}));state$i.allConnectors=[...state$i.connectors,...t],state$i.connectors=this.mergeMultiChainConnectors(state$i.allConnectors)},mergeMultiChainConnectors(e){const t=this.generateConnectorMapByName(e),r=[];return t.forEach((e=>{const t=e[0],n="w3mAuth"===(null==t?void 0:t.id);e.length>1?r.push({name:null==t?void 0:t.name,imageUrl:null==t?void 0:t.imageUrl,imageId:null==t?void 0:t.imageId,connectors:[...e],type:n?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(null==t?void 0:t.id)||""}):t&&r.push(t)})),r},generateConnectorMapByName(e){const t=new Map;return e.forEach((e=>{const{name:r}=e,n=this.getConnectorName(r);if(!n)return;const i=t.get(n)||[];i.find((t=>t.chain===e.chain))||i.push(e),t.set(n,i)})),t},getConnectorName(e){if(!e)return e;return{"Trust Wallet":"Trust"}[e]||e},getUniqueConnectorsByName(e){const t=[];return e.forEach((e=>{t.find((t=>t.chain===e.chain))||t.push(e)})),t},addConnector(e){var t,r;if("w3mAuth"===e.id){const n=e,i=snapshot(OptionsController.state),o=ThemeController.getSnapshot().themeMode,s=ThemeController.getSnapshot().themeVariables;null==(r=null==(t=null==n?void 0:n.provider)?void 0:t.syncDappData)||r.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),n.provider.syncTheme({themeMode:o,themeVariables:s,w3mThemeVariables:getW3mThemeVariables(s,o)}),this.setConnectors([e])}else this.setConnectors([e])},getAuthConnector(){var e;const t=ChainController.state.activeChain,r=state$i.connectors.find((e=>"w3mAuth"===e.id));if(r){if(null==(e=null==r?void 0:r.connectors)?void 0:e.length){return r.connectors.find((e=>e.chain===t))}return r}},getAnnouncedConnectorRdns:()=>state$i.connectors.filter((e=>"ANNOUNCED"===e.type)).map((e=>{var t;return null==(t=e.info)?void 0:t.rdns})),getConnectors:()=>state$i.connectors,getConnector:(e,t)=>state$i.connectors.find((r=>{var n;return r.explorerId===e||(null==(n=r.info)?void 0:n.rdns)===t})),syncIfAuthConnector(e){var t,r;if("w3mAuth"!==e.id)return;const n=e,i=snapshot(OptionsController.state),o=ThemeController.getSnapshot().themeMode,s=ThemeController.getSnapshot().themeVariables;null==(r=null==(t=null==n?void 0:n.provider)?void 0:t.syncDappData)||r.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,sdkType:i.sdkType,projectId:i.projectId}),n.provider.syncTheme({themeMode:o,themeVariables:s,w3mThemeVariables:getW3mThemeVariables(s,o)})}},state$h=proxy$1({wcError:!1,buffering:!1,status:"disconnected"});let wcConnectionPromise;const ConnectionController={state:state$h,subscribeKey:(e,t)=>subscribeKey$1(state$h,e,t),_getClient:e=>ChainController.getConnectionControllerClient(e),setClient(e){state$h._client=ref$2(e)},async connectWalletConnect(){var e,t,r,n;if(StorageUtil.setConnectedConnector("WALLET_CONNECT"),CoreHelperUtil.isTelegram()){if(wcConnectionPromise){try{await wcConnectionPromise}catch(i){}return void(wcConnectionPromise=void 0)}if(!CoreHelperUtil.isPairingExpired(null==state$h?void 0:state$h.wcPairingExpiry)){const e=state$h.wcUri;return void(state$h.wcUri=e)}wcConnectionPromise=new Promise((async(e,t)=>{var r,n,i,o;await(null==(o=null==(i=null==(n=null==(r=ChainController.state)?void 0:r.universalAdapter)?void 0:n.connectionControllerClient)?void 0:i.connectWalletConnect)?void 0:o.call(i,(e=>{state$h.wcUri=e,state$h.wcPairingExpiry=CoreHelperUtil.getPairingExpiry()})).catch(t)),e()})),this.state.status="connecting",await wcConnectionPromise,wcConnectionPromise=void 0,state$h.wcPairingExpiry=void 0,this.state.status="connected"}else await(null==(n=null==(r=null==(t=null==(e=ChainController.state)?void 0:e.universalAdapter)?void 0:t.connectionControllerClient)?void 0:r.connectWalletConnect)?void 0:n.call(r,(e=>{state$h.wcUri=e,state$h.wcPairingExpiry=CoreHelperUtil.getPairingExpiry()})))},async connectExternal(e,t,r=!0){var n,i;await(null==(i=(n=this._getClient(t)).connectExternal)?void 0:i.call(n,e)),r&&(ChainController.setActiveNamespace(t),StorageUtil.setConnectedConnector(e.type))},async reconnectExternal(e){var t,r;await(null==(r=(t=this._getClient()).reconnectExternal)?void 0:r.call(t,e)),StorageUtil.setConnectedConnector(e.type)},async setPreferredAccountType(e){var t;ModalController.setLoading(!0);const r=ConnectorController.getAuthConnector();r&&(await(null==r?void 0:r.provider.setPreferredAccount(e)),await this.reconnectExternal(r),ModalController.setLoading(!1),EventsController.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:(null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId)||""}}))},async signMessage(e){return this._getClient().signMessage(e)},parseUnits(e,t){return this._getClient().parseUnits(e,t)},formatUnits(e,t){return this._getClient().formatUnits(e,t)},async sendTransaction(e){return this._getClient().sendTransaction(e)},async getCapabilities(e){return this._getClient().getCapabilities(e)},async grantPermissions(e){return this._getClient().grantPermissions(e)},async estimateGas(e){return this._getClient().estimateGas(e)},async writeContract(e){return this._getClient().writeContract(e)},async getEnsAddress(e){return this._getClient().getEnsAddress(e)},async getEnsAvatar(e){return this._getClient().getEnsAvatar(e)},checkInstalled(e,t){var r,n;return(null==(n=(r=this._getClient(t)).checkInstalled)?void 0:n.call(r,e))||!1},resetWcConnection(){state$h.wcUri=void 0,state$h.wcPairingExpiry=void 0,state$h.wcLinking=void 0,state$h.recentWallet=void 0,state$h.status="disconnected",TransactionsController.resetTransactions(),StorageUtil.deleteWalletConnectDeepLink()},setWcLinking(e){state$h.wcLinking=e},setWcError(e){state$h.wcError=e,state$h.buffering=!1},setRecentWallet(e){state$h.recentWallet=e},setBuffering(e){state$h.buffering=e},setStatus(e){state$h.status=e},async disconnect(){const e=this._getClient();try{await(null==e?void 0:e.disconnect()),this.resetWcConnection()}catch(t){throw new Error("Failed to disconnect")}}},SwapApiUtil={async getTokenList(){var e;const t=ChainController.state.activeCaipNetwork,r=await BlockchainApiController.fetchSwapTokens({chainId:null==t?void 0:t.caipNetworkId,projectId:OptionsController.state.projectId});return(null==(e=null==r?void 0:r.tokens)?void 0:e.map((e=>({...e,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0}))))||[]},async fetchGasPrice(){const e=OptionsController.state.projectId,t=ChainController.state.activeCaipNetwork;if(!t)return null;try{if("solana"===t.chainNamespace){const e=(await ConnectionController.estimateGas({chainNamespace:"solana"})).toString();return{standard:e,fast:e,instant:e}}return await BlockchainApiController.fetchGasPrice({projectId:e,chainId:t.caipNetworkId})}catch{return null}},async fetchSwapAllowance({tokenAddress:e,userAddress:t,sourceTokenAmount:r,sourceTokenDecimals:n}){const i=OptionsController.state.projectId,o=await BlockchainApiController.fetchSwapAllowance({projectId:i,tokenAddress:e,userAddress:t});if((null==o?void 0:o.allowance)&&r&&n){const e=ConnectionController.parseUnits(r,n)||0;return BigInt(o.allowance)>=e}return!1},async getMyTokensWithBalance(e){const t=AccountController.state.address,r=ChainController.state.activeCaipNetwork;if(!t||!r)return[];const n=(await BlockchainApiController.getBalance(t,r.caipNetworkId,e)).balances.filter((e=>"0"!==e.quantity.decimals));return AccountController.setTokenBalance(n,ChainController.state.activeChain),this.mapBalancesToSwapTokens(n)},mapBalancesToSwapTokens:e=>(null==e?void 0:e.map((e=>({...e,address:(null==e?void 0:e.address)?e.address:ChainController.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))))||[]},state$g=proxy$1({view:"Connect",history:["Connect"],transactionStack:[]}),RouterController={state:state$g,subscribeKey:(e,t)=>subscribeKey$1(state$g,e,t),pushTransactionStack(e){state$g.transactionStack.push(e)},popTransactionStack(e){var t,r;const n=state$g.transactionStack.pop();if(n)if(e)this.goBack(),null==(t=null==n?void 0:n.onCancel)||t.call(n);else{if(n.goBack)this.goBack();else if(n.replace){const e=state$g.history.indexOf("ConnectingSiwe");e>0?this.goBackToIndex(e-1):(ModalController.close(),state$g.history=[])}else n.view&&this.reset(n.view);null==(r=null==n?void 0:n.onSuccess)||r.call(n)}},push(e,t){e!==state$g.view&&(state$g.view=e,state$g.history.push(e),state$g.data=t)},reset(e){state$g.view=e,state$g.history=[e]},replace(e,t){state$g.history.at(-1)===e||(state$g.view=e,state$g.history[state$g.history.length-1]=e,state$g.data=t)},goBack(){if(state$g.history.length>1){state$g.history.pop();const[e]=state$g.history.slice(-1);e&&(state$g.view=e)}else ModalController.close()},goBackToIndex(e){if(state$g.history.length>1){state$g.history=state$g.history.slice(0,e+1);const[t]=state$g.history.slice(-1);t&&(state$g.view=t)}}},SwapCalculationUtil={getGasPriceInEther:(e,t)=>Number(t*e)/1e18,getGasPriceInUSD(e,t,r){const n=SwapCalculationUtil.getGasPriceInEther(t,r);return NumberUtil.bigNumber(e).multipliedBy(n).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:r,toTokenAmount:n}){const i=NumberUtil.bigNumber(e).multipliedBy(t),o=NumberUtil.bigNumber(n).multipliedBy(r);return i.minus(o).dividedBy(i).multipliedBy(100).toNumber()},getMaxSlippage(e,t){const r=NumberUtil.bigNumber(e).dividedBy(100);return NumberUtil.multiply(t,r).toNumber()},getProviderFee:(e,t=.0085)=>NumberUtil.bigNumber(e).multipliedBy(t).toString(),isInsufficientNetworkTokenForGas(e,t){const r=t||"0";return!!NumberUtil.bigNumber(e).isZero()||NumberUtil.bigNumber(NumberUtil.bigNumber(r)).isGreaterThan(e)},isInsufficientSourceTokenForSwap(e,t,r){var n,i;const o=null==(i=null==(n=null==r?void 0:r.find((e=>e.address===t)))?void 0:n.quantity)?void 0:i.numeric;return NumberUtil.bigNumber(o||"0").isLessThan(e)},getToTokenAmount({sourceToken:e,toToken:t,sourceTokenPrice:r,toTokenPrice:n,sourceTokenAmount:i}){if("0"===i)return"0";if(!e||!t)return"0";const o=e.decimals,s=r,a=t.decimals,c=n;if(c<=0)return"0";const l=NumberUtil.bigNumber(i).multipliedBy(.0085),u=NumberUtil.bigNumber(i).minus(l).multipliedBy(NumberUtil.bigNumber(10).pow(o)),d=NumberUtil.bigNumber(s).dividedBy(c),h=o-a;return u.multipliedBy(d).dividedBy(NumberUtil.bigNumber(10).pow(h)).dividedBy(NumberUtil.bigNumber(10).pow(a)).toFixed(a).toString()}},INITIAL_GAS_LIMIT=15e4,TO_AMOUNT_DECIMALS=6,initialState={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:ConstantsUtil$2.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},state$f=proxy$1(initialState),SwapController={state:state$f,subscribe:e=>subscribe$1(state$f,(()=>e(state$f))),subscribeKey:(e,t)=>subscribeKey$1(state$f,e,t),getParams(){var e,t,r,n,i,o,s,a;const c=ChainController.state.activeCaipAddress,l=CoreHelperUtil.getPlainAddress(c),u=ChainController.getActiveNetworkTokenAddress(),d=StorageUtil.getConnectedConnector();if(!l)throw new Error("No address found to swap the tokens from.");const h=!(null==(e=state$f.toToken)?void 0:e.address)||!(null==(t=state$f.toToken)?void 0:t.decimals),p=!(null==(r=state$f.sourceToken)?void 0:r.address)||!(null==(n=state$f.sourceToken)?void 0:n.decimals)||!NumberUtil.bigNumber(state$f.sourceTokenAmount).isGreaterThan(0),f=!state$f.sourceTokenAmount;return{networkAddress:u,fromAddress:l,fromCaipAddress:c,sourceTokenAddress:null==(i=state$f.sourceToken)?void 0:i.address,toTokenAddress:null==(o=state$f.toToken)?void 0:o.address,toTokenAmount:state$f.toTokenAmount,toTokenDecimals:null==(s=state$f.toToken)?void 0:s.decimals,sourceTokenAmount:state$f.sourceTokenAmount,sourceTokenDecimals:null==(a=state$f.sourceToken)?void 0:a.decimals,invalidToToken:h,invalidSourceToken:p,invalidSourceTokenAmount:f,availableToSwap:c&&!h&&!p&&!f,isAuthConnector:"AUTH"===d}},setSourceToken(e){if(!e)return state$f.sourceToken=e,state$f.sourceTokenAmount="",void(state$f.sourceTokenPriceInUSD=0);state$f.sourceToken=e,this.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){state$f.sourceTokenAmount=e},setToToken(e){if(!e)return state$f.toToken=e,state$f.toTokenAmount="",void(state$f.toTokenPriceInUSD=0);state$f.toToken=e,this.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){state$f.toTokenAmount=e?NumberUtil.formatNumberToLocalString(e,TO_AMOUNT_DECIMALS):""},async setTokenPrice(e,t){const{availableToSwap:r}=this.getParams();let n=state$f.tokensPriceMap[e]||0;n||(state$f.loadingPrices=!0,n=await this.getAddressPrice(e)),"sourceToken"===t?state$f.sourceTokenPriceInUSD=n:"toToken"===t&&(state$f.toTokenPriceInUSD=n),state$f.loadingPrices&&(state$f.loadingPrices=!1,r&&this.swapTokens())},switchTokens(){if(state$f.initializing||!state$f.initialized)return;const e=state$f.toToken?{...state$f.toToken}:void 0,t=state$f.sourceToken?{...state$f.sourceToken}:void 0,r=e&&""===state$f.toTokenAmount?"1":state$f.toTokenAmount;this.setSourceToken(e),this.setToToken(t),this.setSourceTokenAmount(r),this.setToTokenAmount(""),this.swapTokens()},resetState(){state$f.myTokensWithBalance=initialState.myTokensWithBalance,state$f.tokensPriceMap=initialState.tokensPriceMap,state$f.initialized=initialState.initialized,state$f.sourceToken=initialState.sourceToken,state$f.sourceTokenAmount=initialState.sourceTokenAmount,state$f.sourceTokenPriceInUSD=initialState.sourceTokenPriceInUSD,state$f.toToken=initialState.toToken,state$f.toTokenAmount=initialState.toTokenAmount,state$f.toTokenPriceInUSD=initialState.toTokenPriceInUSD,state$f.networkPrice=initialState.networkPrice,state$f.networkTokenSymbol=initialState.networkTokenSymbol,state$f.networkBalanceInUSD=initialState.networkBalanceInUSD,state$f.inputError=initialState.inputError},resetValues(){var e;const{networkAddress:t}=this.getParams(),r=null==(e=state$f.tokens)?void 0:e.find((e=>e.address===t));this.setSourceToken(r),this.setToToken(void 0)},getApprovalLoadingState:()=>state$f.loadingApprovalTransaction,clearError(){state$f.transactionError=void 0},async initializeState(){if(!state$f.initializing){if(state$f.initializing=!0,!state$f.initialized)try{await this.fetchTokens(),state$f.initialized=!0}catch(e){state$f.initialized=!1,SnackController.showError("Failed to initialize swap"),RouterController.goBack()}state$f.initializing=!1}},async fetchTokens(){var e;const{networkAddress:t}=this.getParams();await this.getTokenList(),await this.getNetworkTokenPrice(),await this.getMyTokensWithBalance();const r=null==(e=state$f.tokens)?void 0:e.find((e=>e.address===t));r&&(state$f.networkTokenSymbol=r.symbol,this.setSourceToken(r),this.setSourceTokenAmount("1"))},async getTokenList(){const e=await SwapApiUtil.getTokenList();state$f.tokens=e,state$f.popularTokens=e.sort(((e,t)=>e.symbol<t.symbol?-1:e.symbol>t.symbol?1:0)),state$f.suggestedTokens=e.filter((e=>!!ConstantsUtil$2.SWAP_SUGGESTED_TOKENS.includes(e.symbol)),{})},async getAddressPrice(e){var t,r;const n=state$f.tokensPriceMap[e];if(n)return n;const i=(await BlockchainApiController.fetchTokenPrice({projectId:OptionsController.state.projectId,addresses:[e]})).fungibles||[],o=[...state$f.tokens||[],...state$f.myTokensWithBalance||[]],s=null==(t=null==o?void 0:o.find((t=>t.address===e)))?void 0:t.symbol,a=(null==(r=i.find((e=>e.symbol.toLowerCase()===(null==s?void 0:s.toLowerCase()))))?void 0:r.price)||0,c=parseFloat(a.toString());return state$f.tokensPriceMap[e]=c,c},async getNetworkTokenPrice(){var e;const{networkAddress:t}=this.getParams(),r=null==(e=(await BlockchainApiController.fetchTokenPrice({projectId:OptionsController.state.projectId,addresses:[t]}).catch((()=>(SnackController.showError("Failed to fetch network token price"),{fungibles:[]})))).fungibles)?void 0:e[0],n=(null==r?void 0:r.price.toString())||"0";state$f.tokensPriceMap[t]=parseFloat(n),state$f.networkTokenSymbol=(null==r?void 0:r.symbol)||"",state$f.networkPrice=n},async getMyTokensWithBalance(e){const t=await SwapApiUtil.getMyTokensWithBalance(e);t&&(await this.getInitialGasPrice(),this.setBalances(t))},setBalances(e){const{networkAddress:t}=this.getParams(),r=ChainController.state.activeCaipNetwork;if(!r)return;const n=e.find((e=>e.address===t));e.forEach((e=>{state$f.tokensPriceMap[e.address]=e.price||0})),state$f.myTokensWithBalance=e.filter((e=>e.address.startsWith(r.caipNetworkId))),state$f.networkBalanceInUSD=n?NumberUtil.multiply(n.quantity.numeric,n.price).toString():"0"},async getInitialGasPrice(){var e,t;const r=await SwapApiUtil.fetchGasPrice();if(!r)return{gasPrice:null,gasPriceInUSD:null};if("solana"===(null==(t=null==(e=ChainController.state)?void 0:e.activeCaipNetwork)?void 0:t.chainNamespace))return state$f.gasFee=r.standard,state$f.gasPriceInUSD=NumberUtil.multiply(r.standard,state$f.networkPrice).dividedBy(1e9).toNumber(),{gasPrice:BigInt(state$f.gasFee),gasPriceInUSD:Number(state$f.gasPriceInUSD)};{const e=r.standard,t=BigInt(e),n=BigInt(INITIAL_GAS_LIMIT),i=SwapCalculationUtil.getGasPriceInUSD(state$f.networkPrice,n,t);return state$f.gasFee=e,state$f.gasPriceInUSD=i,{gasPrice:t,gasPriceInUSD:i}}},async swapTokens(){var e,t;const r=AccountController.state.address,n=state$f.sourceToken,i=state$f.toToken,o=NumberUtil.bigNumber(state$f.sourceTokenAmount).isGreaterThan(0);if(!i||!n||state$f.loadingPrices||!o)return;state$f.loadingQuote=!0;const s=NumberUtil.bigNumber(state$f.sourceTokenAmount).multipliedBy(10**n.decimals).integerValue(),a=await BlockchainApiController.fetchSwapQuote({userAddress:r,projectId:OptionsController.state.projectId,from:n.address,to:i.address,gasPrice:state$f.gasFee,amount:s.toString()});state$f.loadingQuote=!1;const c=null==(t=null==(e=null==a?void 0:a.quotes)?void 0:e[0])?void 0:t.toAmount;if(!c)return;const l=NumberUtil.bigNumber(c).dividedBy(10**i.decimals).toString();this.setToTokenAmount(l);this.hasInsufficientToken(state$f.sourceTokenAmount,n.address)?state$f.inputError="Insufficient balance":(state$f.inputError=void 0,this.setTransactionDetails())},async getTransaction(){const{fromCaipAddress:e,availableToSwap:t}=this.getParams(),r=state$f.sourceToken,n=state$f.toToken;if(e&&t&&r&&n&&!state$f.loadingQuote)try{state$f.loadingBuildTransaction=!0;let t;return t=await SwapApiUtil.fetchSwapAllowance({userAddress:e,tokenAddress:r.address,sourceTokenAmount:state$f.sourceTokenAmount,sourceTokenDecimals:r.decimals})?await this.createSwapTransaction():await this.createAllowanceTransaction(),state$f.loadingBuildTransaction=!1,state$f.fetchError=!1,t}catch(i){return RouterController.goBack(),SnackController.showError("Failed to check allowance"),state$f.loadingBuildTransaction=!1,state$f.approvalTransaction=void 0,state$f.swapTransaction=void 0,void(state$f.fetchError=!0)}},async createAllowanceTransaction(){const{fromCaipAddress:e,fromAddress:t,sourceTokenAddress:r,toTokenAddress:n}=this.getParams();if(e&&n){if(!r)throw new Error("createAllowanceTransaction - No source token address found.");try{const i=await BlockchainApiController.generateApproveCalldata({projectId:OptionsController.state.projectId,from:r,to:n,userAddress:e}),o=await ConnectionController.estimateGas({address:t,to:CoreHelperUtil.getPlainAddress(i.tx.to),data:i.tx.data}),s={data:i.tx.data,to:CoreHelperUtil.getPlainAddress(i.tx.from),gas:o,gasPrice:BigInt(i.tx.eip155.gasPrice),value:BigInt(i.tx.value),toAmount:state$f.toTokenAmount};return state$f.swapTransaction=void 0,state$f.approvalTransaction=s,s}catch(i){return RouterController.goBack(),SnackController.showError("Failed to create approval transaction"),state$f.approvalTransaction=void 0,state$f.swapTransaction=void 0,void(state$f.fetchError=!0)}}},async createSwapTransaction(){const{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:r}=this.getParams(),n=state$f.sourceToken,i=state$f.toToken;if(!(t&&r&&n&&i))return;const o=ConnectionController.parseUnits(r,n.decimals).toString();try{const r=await BlockchainApiController.generateSwapCalldata({projectId:OptionsController.state.projectId,userAddress:t,from:n.address,to:i.address,amount:o}),s=n.address===e,a=BigInt(r.tx.eip155.gas),c=BigInt(r.tx.eip155.gasPrice),l={data:r.tx.data,to:CoreHelperUtil.getPlainAddress(r.tx.to),gas:a,gasPrice:c,value:s?BigInt(o):BigInt("0"),toAmount:state$f.toTokenAmount};return state$f.gasPriceInUSD=SwapCalculationUtil.getGasPriceInUSD(state$f.networkPrice,a,c),state$f.approvalTransaction=void 0,state$f.swapTransaction=l,l}catch(s){return RouterController.goBack(),SnackController.showError("Failed to create transaction"),state$f.approvalTransaction=void 0,state$f.swapTransaction=void 0,void(state$f.fetchError=!0)}},async sendTransactionForApproval(e){const{fromAddress:t,isAuthConnector:r}=this.getParams();state$f.loadingApprovalTransaction=!0;const n="Approve limit increase in your wallet";r?RouterController.pushTransactionStack({view:null,goBack:!0,onSuccess(){SnackController.showLoading(n)}}):SnackController.showLoading(n);try{await ConnectionController.sendTransaction({address:t,to:e.to,data:e.data,value:BigInt(e.value),gasPrice:BigInt(e.gasPrice)}),await this.swapTokens(),await this.getTransaction(),state$f.approvalTransaction=void 0,state$f.loadingApprovalTransaction=!1}catch(i){const e=i;state$f.transactionError=null==e?void 0:e.shortMessage,state$f.loadingApprovalTransaction=!1,SnackController.showError((null==e?void 0:e.shortMessage)||"Transaction error")}},async sendTransactionForSwap(e){var t,r,n,i,o,s,a,c,l,u,d,h;if(!e)return;const{fromAddress:p,toTokenAmount:f,isAuthConnector:m}=this.getParams();state$f.loadingTransaction=!0;const g=`Swapping ${null==(t=state$f.sourceToken)?void 0:t.symbol} to ${NumberUtil.formatNumberToLocalString(f,3)} ${null==(r=state$f.toToken)?void 0:r.symbol}`,b=`Swapped ${null==(n=state$f.sourceToken)?void 0:n.symbol} to ${NumberUtil.formatNumberToLocalString(f,3)} ${null==(i=state$f.toToken)?void 0:i.symbol}`;m?RouterController.pushTransactionStack({view:"Account",goBack:!1,onSuccess(){SnackController.showLoading(g),SwapController.resetState()}}):SnackController.showLoading("Confirm transaction in your wallet");try{const t=[null==(o=state$f.sourceToken)?void 0:o.address,null==(s=state$f.toToken)?void 0:s.address].join(","),r=await ConnectionController.sendTransaction({address:p,to:e.to,data:e.data,gas:e.gas,gasPrice:BigInt(e.gasPrice),value:e.value});return state$f.loadingTransaction=!1,SnackController.showSuccess(b),EventsController.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:(null==(a=ChainController.state.activeCaipNetwork)?void 0:a.caipNetworkId)||"",swapFromToken:(null==(c=this.state.sourceToken)?void 0:c.symbol)||"",swapToToken:(null==(l=this.state.toToken)?void 0:l.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),SwapController.resetState(),m||RouterController.replace("Account"),SwapController.getMyTokensWithBalance(t),r}catch(y){const e=y;return state$f.transactionError=null==e?void 0:e.shortMessage,state$f.loadingTransaction=!1,SnackController.showError((null==e?void 0:e.shortMessage)||"Transaction error"),void EventsController.sendEvent({type:"track",event:"SWAP_ERROR",properties:{network:(null==(u=ChainController.state.activeCaipNetwork)?void 0:u.caipNetworkId)||"",swapFromToken:(null==(d=this.state.sourceToken)?void 0:d.symbol)||"",swapToToken:(null==(h=this.state.toToken)?void 0:h.symbol)||"",swapFromAmount:this.state.sourceTokenAmount||"",swapToAmount:this.state.toTokenAmount||"",isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}})}},hasInsufficientToken(e,t){const r=SwapCalculationUtil.isInsufficientSourceTokenForSwap(e,t,state$f.myTokensWithBalance);if(AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT)return!0;return SwapCalculationUtil.isInsufficientNetworkTokenForGas(state$f.networkBalanceInUSD,state$f.gasPriceInUSD)||r},setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=this.getParams();e&&t&&(state$f.gasPriceInUSD=SwapCalculationUtil.getGasPriceInUSD(state$f.networkPrice,BigInt(state$f.gasFee),BigInt(INITIAL_GAS_LIMIT)),state$f.priceImpact=SwapCalculationUtil.getPriceImpact({sourceTokenAmount:state$f.sourceTokenAmount,sourceTokenPriceInUSD:state$f.sourceTokenPriceInUSD,toTokenPriceInUSD:state$f.toTokenPriceInUSD,toTokenAmount:state$f.toTokenAmount}),state$f.maxSlippage=SwapCalculationUtil.getMaxSlippage(state$f.slippage,state$f.toTokenAmount),state$f.providerFee=SwapCalculationUtil.getProviderFee(state$f.sourceTokenAmount))}},state$e=proxy$1({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),AccountController={state:state$e,replaceState(e){e&&Object.assign(state$e,ref$2(e))},subscribe:e=>ChainController.subscribeChainProp("accountState",(t=>{if(t)return e(t)})),subscribeKey(e,t,r){let n;return ChainController.subscribeChainProp("accountState",(r=>{if(r){const i=r[e];n!==i&&(n=i,t(i))}}),r)},setStatus(e,t){ChainController.setAccountProp("status",e,t)},getCaipAddress:e=>ChainController.getAccountProp("caipAddress",e),setProvider(e,t){e&&ChainController.setAccountProp("provider",e,t)},setCaipAddress(e,t){const r=e?CoreHelperUtil.getPlainAddress(e):void 0;ChainController.state.activeCaipAddress=e,ChainController.setAccountProp("caipAddress",e,t),ChainController.setAccountProp("address",r,t)},setBalance(e,t,r){ChainController.setAccountProp("balance",e,r),ChainController.setAccountProp("balanceSymbol",t,r)},setProfileName(e,t){ChainController.setAccountProp("profileName",e,t)},setProfileImage(e,t){ChainController.setAccountProp("profileImage",e,t)},setAddressExplorerUrl(e,t){ChainController.setAccountProp("addressExplorerUrl",e,t)},setSmartAccountDeployed(e,t){ChainController.setAccountProp("smartAccountDeployed",e,t)},setCurrentTab(e){ChainController.setAccountProp("currentTab",e,ChainController.state.activeChain)},setTokenBalance(e,t){e&&ChainController.setAccountProp("tokenBalance",e,t)},setShouldUpdateToAddress(e,t){ChainController.setAccountProp("shouldUpdateToAddress",e,t)},setAllAccounts(e,t){ChainController.setAccountProp("allAccounts",e,t)},addAddressLabel(e,t,r){const n=ChainController.getAccountProp("addressLabels",r)||new Map;n.set(e,t),ChainController.setAccountProp("addressLabels",n,r)},removeAddressLabel(e,t){const r=ChainController.getAccountProp("addressLabels",t)||new Map;r.delete(e),ChainController.setAccountProp("addressLabels",r,t)},setConnectedWalletInfo(e,t){ChainController.setAccountProp("connectedWalletInfo",e,t,!1)},setPreferredAccountType(e,t){ChainController.setAccountProp("preferredAccountType",e,t)},setSocialProvider(e,t){e&&ChainController.setAccountProp("socialProvider",e,t)},setSocialWindow(e,t){e&&ChainController.setAccountProp("socialWindow",ref$2(e),t)},setFarcasterUrl(e,t){e&&ChainController.setAccountProp("farcasterUrl",e,t)},async fetchTokenBalance(){var e,t;const r=null==(e=ChainController.state.activeCaipNetwork)?void 0:e.caipNetworkId,n=null==(t=ChainController.state.activeCaipNetwork)?void 0:t.chainNamespace,i=ChainController.state.activeCaipAddress,o=i?CoreHelperUtil.getPlainAddress(i):void 0;if(!state$e.lastRetry||CoreHelperUtil.isAllowedRetry(state$e.lastRetry,ConstantsUtil$2.FIVE_SEC_MS))try{if(o&&r&&n){const e=await BlockchainApiController.getBalance(o,r),t=e.balances.filter((e=>"0"!==e.quantity.decimals));this.setTokenBalance(t,n),SwapController.setBalances(SwapApiUtil.mapBalancesToSwapTokens(e.balances)),state$e.lastRetry=void 0}}catch(s){state$e.lastRetry=Date.now(),SnackController.showError("Token Balance Unavailable")}},resetAccount(e){ChainController.resetAccount(e)},setSiweStatus(e){ChainController.setAccountProp("siweStatus",e,ChainController.state.activeChain)}},state$d=proxy$1({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0}),PublicStateController={state:state$d,subscribe:e=>subscribe$1(state$d,(()=>e(state$d))),set(e){Object.assign(state$d,{...state$d,...e})}},accountState={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]},networkState={supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},state$c=proxy$1({chains:proxyMap(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0}}),ChainController={state:state$c,subscribe:e=>subscribe$1(state$c,(()=>{e(state$c)})),subscribeKey:(e,t)=>subscribeKey$1(state$c,e,t),subscribeChainProp(e,t,r){let n;return subscribe$1(state$c.chains,(()=>{var i;const o=r||state$c.activeChain;if(o){const r=null==(i=state$c.chains.get(o))?void 0:i[e];n!==r&&(n=r,t(r))}}))},initialize(e){const t=null==e?void 0:e[0];0===(null==e?void 0:e.length)&&(state$c.noAdapters=!0),state$c.noAdapters||(state$c.activeChain=null==t?void 0:t.chainNamespace,PublicStateController.set({activeChain:null==t?void 0:t.chainNamespace}),e.forEach((e=>{state$c.chains.set(e.chainNamespace,{chainNamespace:e.chainNamespace,connectionControllerClient:e.connectionControllerClient,networkControllerClient:e.networkControllerClient,adapterType:e.adapterType,accountState:accountState,networkState:networkState,caipNetworks:e.caipNetworks})})))},initializeUniversalAdapter(e,t){var r,n;if(state$c.universalAdapter=e,0===t.length){const t=StorageUtil.getStoredActiveCaipNetwork();try{state$c.activeChain=t?t.chainNamespace:(null==(r=null==e?void 0:e.defaultNetwork)?void 0:r.chainNamespace)??(null==(n=e.caipNetworks[0])?void 0:n.chainNamespace)}catch(i){console.warn(">>> Error setting active caip network",i)}}[...new Set(e.caipNetworks.map((e=>e.chainNamespace)))].forEach((t=>{state$c.chains.set(t,{chainNamespace:t,connectionControllerClient:void 0,networkControllerClient:void 0,adapterType:e.adapterType,accountState:accountState,networkState:networkState,caipNetworks:e.caipNetworks})}))},setAdapterNetworkState(e,t){const r=state$c.chains.get(e);r&&(r.networkState=ref$2({...r.networkState,...t}),state$c.chains.set(e,ref$2(r)))},setChainAccountData(e,t,r=!0){if(!e)throw new Error("Chain is required to update chain account data");const n=state$c.chains.get(e);n&&(n.accountState=ref$2({...n.accountState,...t}),state$c.chains.set(e,n),(r||1===state$c.chains.size||state$c.activeChain===e)&&(t.caipAddress&&(state$c.activeCaipAddress=t.caipAddress),AccountController.replaceState(n.accountState)))},setAccountProp(e,t,r,n=!0){this.setChainAccountData(r,{[e]:t},n)},setActiveNamespace(e){var t,r;state$c.activeChain=e;const n=e?state$c.chains.get(e):void 0,i=null==(t=null==n?void 0:n.networkState)?void 0:t.caipNetwork;(null==i?void 0:i.id)&&(state$c.activeCaipAddress=null==(r=null==n?void 0:n.accountState)?void 0:r.caipAddress,state$c.activeCaipNetwork=i,SafeLocalStorage.setItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID,null==i?void 0:i.caipNetworkId),PublicStateController.set({activeChain:e,selectedNetworkId:null==i?void 0:i.caipNetworkId}))},setActiveCaipNetwork(e){var t,r;if(!e)return;const n=state$c.chains.get(e.chainNamespace);state$c.activeChain=e.chainNamespace,state$c.activeCaipNetwork=e,state$c.activeCaipAddress=null==(t=null==n?void 0:n.accountState)?void 0:t.caipAddress,n&&AccountController.replaceState(n.accountState),PublicStateController.set({activeChain:state$c.activeChain,selectedNetworkId:null==(r=state$c.activeCaipNetwork)?void 0:r.caipNetworkId}),SafeLocalStorage.setItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID,e.caipNetworkId);this.checkIfSupportedNetwork(e.chainNamespace)||this.showUnsupportedChainUI()},async switchActiveNetwork(e){const t=this.getNetworkControllerClient(e.chainNamespace);t&&await t.switchCaipNetwork(e),this.setActiveCaipNetwork(e),e&&EventsController.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}})},setActiveConnector(e){e&&(state$c.activeConnector=ref$2(e))},getNetworkControllerClient(e){const t=SafeLocalStorage.getItem(SafeLocalStorageKeys.WALLET_ID),r=e||state$c.activeChain,n="walletConnect"===t,i=state$c.universalAdapter.networkControllerClient;if(n||state$c.noAdapters){if(!i)throw new Error("Universal Adapter's networkControllerClient is not set");return i}if(!r)throw new Error("Chain is required to get network controller client");const o=state$c.chains.get(r);if(!o)throw new Error("Chain adapter not found");if(!o.networkControllerClient)throw new Error("NetworkController client not set");return o.networkControllerClient},getConnectionControllerClient(e){var t;const r=e||state$c.activeChain,n="WALLET_CONNECT"===SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_CONNECTOR),i=state$c.universalAdapter.connectionControllerClient,o="wagmi"===(null==(t=state$c.chains.get("eip155"))?void 0:t.adapterType);if(n&&!o||state$c.noAdapters){if(!i)throw new Error("Universal Adapter's ConnectionControllerClient is not set");return i}if(!r)throw new Error("Chain is required to get connection controller client");const s=state$c.chains.get(r);if(!s)throw new Error("Chain adapter not found");if(!s.connectionControllerClient)throw new Error("ConnectionController client not set");return s.connectionControllerClient},getAccountProp(e,t){var r;let n=state$c.activeChain;if(t&&(n=t),!n)return;const i=null==(r=state$c.chains.get(n))?void 0:r.accountState;return i?i[e]:void 0},getNetworkProp(e,t){var r;const n=null==(r=state$c.chains.get(t))?void 0:r.networkState;if(n)return n[e]},getRequestedCaipNetworks(e){const t=state$c.chains.get(e),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:n=[]}=(null==t?void 0:t.networkState)||{};return CoreHelperUtil.sortRequestedNetworks(r,n)},getAllRequestedCaipNetworks(){const e=[];return state$c.chains.forEach((t=>{const r=this.getRequestedCaipNetworks(t.chainNamespace);e.push(...r)})),e},setRequestedCaipNetworks(e,t){this.setAdapterNetworkState(t,{requestedCaipNetworks:e})},getAllApprovedCaipNetworkIds(){const e=[];return state$c.chains.forEach((t=>{const r=this.getApprovedCaipNetworkIds(t.chainNamespace);e.push(...r)})),e},getActiveCaipNetwork:()=>state$c.activeCaipNetwork,getActiveCaipAddress:()=>state$c.activeCaipAddress,getApprovedCaipNetworkIds(e){var t;const r=state$c.chains.get(e);return(null==(t=null==r?void 0:r.networkState)?void 0:t.approvedCaipNetworkIds)||[]},async setApprovedCaipNetworksData(e){const t=this.getNetworkControllerClient(),r=await(null==t?void 0:t.getApprovedCaipNetworksData());this.setAdapterNetworkState(e,{approvedCaipNetworkIds:null==r?void 0:r.approvedCaipNetworkIds,supportsAllNetworks:null==r?void 0:r.supportsAllNetworks})},checkIfSupportedNetwork(e){const t=this.state.activeCaipNetwork,r=this.getRequestedCaipNetworks(e);return!r.length||(null==r?void 0:r.some((e=>e.id===(null==t?void 0:t.id))))},setSmartAccountEnabledNetworks(e,t){this.setAdapterNetworkState(t,{smartAccountEnabledNetworks:e})},checkIfSmartAccountEnabled(){var e;const t=NetworkUtil.caipNetworkIdToNumber(null==(e=state$c.activeCaipNetwork)?void 0:e.caipNetworkId),r=this.state.activeChain;if(!r||!t)return!1;const n=this.getNetworkProp("smartAccountEnabledNetworks",r);return Boolean(null==n?void 0:n.includes(Number(t)))},getActiveNetworkTokenAddress(){var e,t;const r=(null==(e=this.state.activeCaipNetwork)?void 0:e.chainNamespace)||"eip155";return`${r}:${(null==(t=this.state.activeCaipNetwork)?void 0:t.id)||1}:${ConstantsUtil$2.NATIVE_TOKEN_ADDRESS[r]}`},showUnsupportedChainUI(){setTimeout((()=>{ModalController.open({view:"UnsupportedChain"})}),300)},checkIfNamesSupported(){const e=state$c.activeCaipNetwork;return Boolean((null==e?void 0:e.chainNamespace)&&ConstantsUtil$2.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){this.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(e){const t=e;if(!t)throw new Error("Chain is required to set account prop");this.state.activeCaipAddress=void 0,this.setChainAccountData(t,ref$2({smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,provider:void 0}))}},StorageUtil={setWalletConnectDeepLink({name:e,href:t}){try{SafeLocalStorage.setItem(SafeLocalStorageKeys.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{SafeLocalStorage.removeItem(SafeLocalStorageKeys.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setAppKitRecent(e){try{const t=StorageUtil.getRecentWallets();t.find((t=>t.id===e.id))||(t.unshift(e),t.length>2&&t.pop(),SafeLocalStorage.setItem(SafeLocalStorageKeys.RECENT_WALLETS,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnector(e){try{SafeLocalStorage.setItem(SafeLocalStorageKeys.CONNECTED_CONNECTOR,e)}catch{console.info("Unable to set Connected Connector")}},getConnectedConnector(){try{return SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_CONNECTOR)}catch{console.info("Unable to get Connected Connector")}},setConnectedSocialProvider(e){try{SafeLocalStorage.setItem(SafeLocalStorageKeys.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set Connected Social Provider")}},getConnectedSocialProvider(){try{return SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_SOCIAL)}catch{console.info("Unable to get Connected Social Provider")}},getConnectedSocialUsername(){try{return SafeLocalStorage.getItem(SafeLocalStorageKeys.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get Connected Social Username")}},getStoredActiveCaipNetwork(){const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID),t=ChainController.getAllRequestedCaipNetworks();return null==t?void 0:t.find((t=>t.caipNetworkId===e))}},state$b=proxy$1({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),AssetController={state:state$b,subscribeNetworkImages:e=>subscribe$1(state$b.networkImages,(()=>e(state$b.networkImages))),subscribeKey:(e,t)=>subscribeKey$1(state$b,e,t),subscribe:e=>subscribe$1(state$b,(()=>e(state$b))),setWalletImage(e,t){state$b.walletImages[e]=t},setNetworkImage(e,t){state$b.networkImages[e]=t},setChainImage(e,t){state$b.chainImages[e]=t},setConnectorImage(e,t){state$b.connectorImages[e]=t},setTokenImage(e,t){state$b.tokenImages[e]=t},setCurrencyImage(e,t){state$b.currencyImages[e]=t}},baseUrl=CoreHelperUtil.getApiUrl(),api$2=new FetchUtil({baseUrl:baseUrl,clientId:null}),entries="40",recommendedEntries="4",imageCountToFetch=20,state$a=proxy$1({page:1,count:0,featured:[],recommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedRDNS:[]}),ApiController={state:state$a,subscribeKey:(e,t)=>subscribeKey$1(state$a,e,t),_getApiHeaders(){const{projectId:e,sdkType:t,sdkVersion:r}=OptionsController.state;return{"x-project-id":e,"x-sdk-type":t||"appkit","x-sdk-version":r||"html-wagmi-4.2.2"}},_filterOutExtensions:e=>OptionsController.state.isUniversalProvider?e.filter((e=>Boolean(e.mobile_link||e.desktop_link||e.webapp_link))):e,async _fetchWalletImage(e){const t=`${api$2.baseUrl}/getWalletImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setWalletImage(e,URL.createObjectURL(r))},async _fetchNetworkImage(e){const t=`${api$2.baseUrl}/public/getAssetImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setNetworkImage(e,URL.createObjectURL(r))},async _fetchConnectorImage(e){const t=`${api$2.baseUrl}/public/getAssetImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setConnectorImage(e,URL.createObjectURL(r))},async _fetchCurrencyImage(e){const t=`${api$2.baseUrl}/public/getCurrencyImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setCurrencyImage(e,URL.createObjectURL(r))},async _fetchTokenImage(e){const t=`${api$2.baseUrl}/public/getTokenImage/${e}`,r=await api$2.getBlob({path:t,headers:ApiController._getApiHeaders()});AssetController.setTokenImage(e,URL.createObjectURL(r))},async fetchNetworkImages(){const e=ChainController.getAllRequestedCaipNetworks(),t=null==e?void 0:e.map((({assets:e})=>null==e?void 0:e.imageId)).filter(Boolean);t&&await Promise.allSettled(t.map((e=>ApiController._fetchNetworkImage(e))))},async fetchConnectorImages(){const{connectors:e}=ConnectorController.state,t=e.map((({imageId:e})=>e)).filter(Boolean);await Promise.allSettled(t.map((e=>ApiController._fetchConnectorImage(e))))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map((e=>ApiController._fetchCurrencyImage(e))))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map((e=>ApiController._fetchTokenImage(e))))},async fetchFeaturedWallets(){const{featuredWalletIds:e}=OptionsController.state;if(null==e?void 0:e.length){const{data:t}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",entries:(null==e?void 0:e.length)?String(e.length):recommendedEntries,include:null==e?void 0:e.join(",")}});t.sort(((t,r)=>e.indexOf(t.id)-e.indexOf(r.id)));const r=t.map((e=>e.image_id)).filter(Boolean);await Promise.allSettled(r.map((e=>ApiController._fetchWalletImage(e)))),state$a.featured=t}},async fetchRecommendedWallets(){var e;try{const{includeWalletIds:t,excludeWalletIds:r,featuredWalletIds:n}=OptionsController.state,i=[...r??[],...n??[]].filter(Boolean),{data:o,count:s}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",chains:null==(e=ChainController.state.activeCaipNetwork)?void 0:e.caipNetworkId,entries:recommendedEntries,include:null==t?void 0:t.join(","),exclude:null==i?void 0:i.join(",")}}),a=StorageUtil.getRecentWallets(),c=o.map((e=>e.image_id)).filter(Boolean),l=a.map((e=>e.image_id)).filter(Boolean);await Promise.allSettled([...c,...l].map((e=>ApiController._fetchWalletImage(e)))),state$a.recommended=o,state$a.count=s??0}catch{}},async fetchWallets({page:e}){var t;const{includeWalletIds:r,excludeWalletIds:n,featuredWalletIds:i}=OptionsController.state,o=[...state$a.recommended.map((({id:e})=>e)),...n??[],...i??[]].filter(Boolean),{data:s,count:a}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:String(e),entries:entries,chains:null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId,include:null==r?void 0:r.join(","),exclude:o.join(",")}}),c=s.slice(0,imageCountToFetch).map((e=>e.image_id)).filter(Boolean);await Promise.allSettled(c.map((e=>ApiController._fetchWalletImage(e)))),state$a.wallets=CoreHelperUtil.uniqueBy([...state$a.wallets,...ApiController._filterOutExtensions(s)],"id"),state$a.count=a>state$a.count?a:state$a.count,state$a.page=e},async searchWalletByIds({ids:e}){var t;const{data:r}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",entries:String(e.length),chains:null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId,include:null==e?void 0:e.join(",")}});r&&r.forEach((e=>{(null==e?void 0:e.rdns)&&state$a.excludedRDNS.push(e.rdns)}))},async searchWallet({search:e}){var t;const{includeWalletIds:r,excludeWalletIds:n}=OptionsController.state;state$a.search=[];const{data:i}=await api$2.get({path:"/getWallets",headers:ApiController._getApiHeaders(),params:{page:"1",entries:"100",search:null==e?void 0:e.trim(),chains:null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId,include:null==r?void 0:r.join(","),exclude:null==n?void 0:n.join(",")}}),o=i.map((e=>e.image_id)).filter(Boolean);await Promise.allSettled([...o.map((e=>ApiController._fetchWalletImage(e))),CoreHelperUtil.wait(300)]),state$a.search=ApiController._filterOutExtensions(i)},async reFetchWallets(){state$a.page=1,state$a.wallets=[],await ApiController.fetchFeaturedWallets(),await ApiController.fetchRecommendedWallets()},prefetch(){var e;const t=[ApiController.fetchFeaturedWallets(),ApiController.fetchRecommendedWallets(),ApiController.fetchNetworkImages(),ApiController.fetchConnectorImages()];(null==(e=OptionsController.state.features)?void 0:e.analytics)&&t.push(ApiController.fetchAnalyticsConfig()),state$a.prefetchPromise=Promise.race([Promise.allSettled(t)])},async fetchAnalyticsConfig(){const{isAnalyticsEnabled:e}=await api$2.get({path:"/getAnalyticsConfig",headers:ApiController._getApiHeaders()});OptionsController.setFeatures({analytics:e})}},state$9=proxy$1({loading:!1,open:!1,shake:!1}),ModalController={state:state$9,subscribe:e=>subscribe$1(state$9,(()=>e(state$9))),subscribeKey:(e,t)=>subscribeKey$1(state$9,e,t),async open(e){await ApiController.state.prefetchPromise;const t=ChainController.state.activeCaipAddress,r=ChainController.state.noAdapters;(null==e?void 0:e.view)?RouterController.reset(e.view):t?RouterController.reset("Account"):r&&!CoreHelperUtil.isMobile()?RouterController.reset("ConnectingWalletConnect"):RouterController.reset("Connect"),state$9.open=!0,PublicStateController.set({open:!0}),EventsController.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:Boolean(t)}})},close(){const e=Boolean(ChainController.state.activeCaipAddress);state$9.open=!1,PublicStateController.set({open:!1}),EventsController.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:e}})},setLoading(e){state$9.loading=e,PublicStateController.set({loading:e})},shake(){state$9.shake||(state$9.shake=!0,setTimeout((()=>{state$9.shake=!1}),500))}},USDC_CURRENCY_DEFAULT={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},USD_CURRENCY_DEFAULT={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},defaultState={providers:ONRAMP_PROVIDERS,selectedProvider:null,error:null,purchaseCurrency:USDC_CURRENCY_DEFAULT,paymentCurrency:USD_CURRENCY_DEFAULT,purchaseCurrencies:[USDC_CURRENCY_DEFAULT],paymentCurrencies:[],quotesLoading:!1},state$8=proxy$1(defaultState),OnRampController={state:state$8,subscribe:e=>subscribe$1(state$8,(()=>e(state$8))),subscribeKey:(e,t)=>subscribeKey$1(state$8,e,t),setSelectedProvider(e){if(e&&"meld"===e.name){const t="production"===process$1.env.NODE_ENV?MELD_PROD_PUBLIC_KEY:MELD_DEV_PUBLIC_KEY,r=ChainController.state.activeChain===ConstantsUtil$3.CHAIN.SOLANA?"SOL":"USDC",n=AccountController.state.address??"",i=new URL(e.url);i.searchParams.append("publicKey",t),i.searchParams.append("destinationCurrencyCode",r),i.searchParams.append("walletAddress",n),e.url=i.toString()}state$8.selectedProvider=e},setPurchaseCurrency(e){state$8.purchaseCurrency=e},setPaymentCurrency(e){state$8.paymentCurrency=e},setPurchaseAmount(e){this.state.purchaseAmount=e},setPaymentAmount(e){this.state.paymentAmount=e},async getAvailableCurrencies(){const e=await BlockchainApiController.getOnrampOptions();state$8.purchaseCurrencies=e.purchaseCurrencies,state$8.paymentCurrencies=e.paymentCurrencies,state$8.paymentCurrency=e.paymentCurrencies[0]||USD_CURRENCY_DEFAULT,state$8.purchaseCurrency=e.purchaseCurrencies[0]||USDC_CURRENCY_DEFAULT,await ApiController.fetchCurrencyImages(e.paymentCurrencies.map((e=>e.id))),await ApiController.fetchTokenImages(e.purchaseCurrencies.map((e=>e.symbol)))},async getQuote(){var e,t;state$8.quotesLoading=!0;try{const r=await BlockchainApiController.getOnrampQuote({purchaseCurrency:state$8.purchaseCurrency,paymentCurrency:state$8.paymentCurrency,amount:(null==(e=state$8.paymentAmount)?void 0:e.toString())||"0",network:null==(t=state$8.purchaseCurrency)?void 0:t.symbol});return state$8.quotesLoading=!1,state$8.purchaseAmount=Number(r.purchaseAmount.amount),r}catch(r){return state$8.error=r.message,state$8.quotesLoading=!1,null}finally{state$8.quotesLoading=!1}},resetState(){state$8.providers=ONRAMP_PROVIDERS,state$8.selectedProvider=null,state$8.error=null,state$8.purchaseCurrency=USDC_CURRENCY_DEFAULT,state$8.paymentCurrency=USD_CURRENCY_DEFAULT,state$8.purchaseCurrencies=[USDC_CURRENCY_DEFAULT],state$8.paymentCurrencies=[],state$8.paymentAmount=void 0,state$8.purchaseAmount=void 0,state$8.quotesLoading=!1}},state$7=proxy$1({loading:!1}),SendController={state:state$7,subscribe:e=>subscribe$1(state$7,(()=>e(state$7))),subscribeKey:(e,t)=>subscribeKey$1(state$7,e,t),setToken(e){e&&(state$7.token=ref$2(e))},setTokenAmount(e){state$7.sendTokenAmount=e},setReceiverAddress(e){state$7.receiverAddress=e},setReceiverProfileImageUrl(e){state$7.receiverProfileImageUrl=e},setReceiverProfileName(e){state$7.receiverProfileName=e},setGasPrice(e){state$7.gasPrice=e},setGasPriceInUsd(e){state$7.gasPriceInUSD=e},setLoading(e){state$7.loading=e},sendToken(){var e;switch(null==(e=ChainController.state.activeCaipNetwork)?void 0:e.chainNamespace){case"eip155":return void this.sendEvmToken();case"solana":return void this.sendSolanaToken();default:throw new Error("Unsupported chain")}},sendEvmToken(){var e,t,r,n,i;(null==(e=this.state.token)?void 0:e.address)&&this.state.sendTokenAmount&&this.state.receiverAddress?(EventsController.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:(null==(t=ChainController.state.activeCaipNetwork)?void 0:t.caipNetworkId)||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&(null==(r=this.state.token)?void 0:r.quantity.decimals)&&(EventsController.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:null==(n=this.state.token)?void 0:n.symbol,amount:this.state.sendTokenAmount,network:(null==(i=ChainController.state.activeCaipNetwork)?void 0:i.caipNetworkId)||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async sendNativeToken(e){var t,r,n,i;RouterController.pushTransactionStack({view:"Account",goBack:!1});const o=e.receiverAddress,s=AccountController.state.address,a=ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{await ConnectionController.sendTransaction({to:o,address:s,data:"0x",value:a,gasPrice:e.gasPrice}),SnackController.showSuccess("Transaction started"),EventsController.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:(null==(t=this.state.token)?void 0:t.symbol)||"",amount:e.sendTokenAmount,network:(null==(r=ChainController.state.activeCaipNetwork)?void 0:r.caipNetworkId)||""}}),this.resetSend()}catch(c){EventsController.sendEvent({type:"track",event:"SEND_ERROR",properties:{isSmartAccount:AccountController.state.preferredAccountType===W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,token:(null==(n=this.state.token)?void 0:n.symbol)||"",amount:e.sendTokenAmount,network:(null==(i=ChainController.state.activeCaipNetwork)?void 0:i.caipNetworkId)||""}}),SnackController.showError("Something went wrong")}},async sendERC20Token(e){RouterController.pushTransactionStack({view:"Account",goBack:!1});const t=ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{if(AccountController.state.address&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){const r=CoreHelperUtil.getPlainAddress(e.tokenAddress);await ConnectionController.writeContract({fromAddress:AccountController.state.address,tokenAddress:r,receiverAddress:e.receiverAddress,tokenAmount:t,method:"transfer",abi:ContractUtil.getERC20Abi(r)}),SnackController.showSuccess("Transaction started"),this.resetSend()}}catch(r){SnackController.showError("Something went wrong")}},sendSolanaToken(){this.state.sendTokenAmount&&this.state.receiverAddress?(RouterController.pushTransactionStack({view:"Account",goBack:!1}),ConnectionController.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then((()=>{this.resetSend(),AccountController.fetchTokenBalance()})).catch((e=>{SnackController.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",e)}))):SnackController.showError("Please enter a valid amount and receiver address")},resetSend(){state$7.token=void 0,state$7.sendTokenAmount=void 0,state$7.receiverAddress=void 0,state$7.receiverProfileImageUrl=void 0,state$7.receiverProfileName=void 0,state$7.loading=!1}},state$6=proxy$1({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),TooltipController={state:state$6,subscribe:e=>subscribe$1(state$6,(()=>e(state$6))),subscribeKey:(e,t)=>subscribeKey$1(state$6,e,t),showTooltip({message:e,triggerRect:t,variant:r}){state$6.open=!0,state$6.message=e,state$6.triggerRect=t,state$6.variant=r},hide(){state$6.open=!1,state$6.message="",state$6.triggerRect={width:0,height:0,top:0,left:0}}},SLIP44_MSB=2147483648,EnsUtil={convertEVMChainIdToCoinType(e){if(e>=SLIP44_MSB)throw new Error("Invalid chainId");return(SLIP44_MSB|e)>>>0}},state$5=proxy$1({suggestions:[],loading:!1}),EnsController={state:state$5,subscribe:e=>subscribe$1(state$5,(()=>e(state$5))),subscribeKey:(e,t)=>subscribeKey$1(state$5,e,t),async resolveName(e){var t,r;try{return await BlockchainApiController.lookupEnsName(e)}catch(e2){throw new Error((null==(r=null==(t=null==e2?void 0:e2.reasons)?void 0:t[0])?void 0:r.description)||"Error resolving name")}},async isNameRegistered(e){try{return await BlockchainApiController.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{state$5.loading=!0,state$5.suggestions=[];const t=await BlockchainApiController.getEnsNameSuggestions(e);return state$5.suggestions=t.suggestions.map((e=>({...e,name:e.name})))||[],state$5.suggestions}catch(e2){const t=this.parseEnsApiError(e2,"Error fetching name suggestions");throw new Error(t)}finally{state$5.loading=!1}},async getNamesForAddress(e){try{if(!ChainController.state.activeCaipNetwork)return[];return await BlockchainApiController.reverseLookupEnsName({address:e})}catch(e2){const t=this.parseEnsApiError(e2,"Error fetching names for address");throw new Error(t)}},async registerName(e){const t=ChainController.state.activeCaipNetwork;if(!t)throw new Error("Network not found");const r=AccountController.state.address,n=ConnectorController.getAuthConnector();if(!r||!n)throw new Error("Address or auth connector not found");state$5.loading=!0;try{const n=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now()/1e3)});RouterController.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){state$5.loading=!1}});const i=await ConnectionController.signMessage(n),o=t.id;if(!o)throw new Error("Network not found");const s=EnsUtil.convertEVMChainIdToCoinType(Number(o));await BlockchainApiController.registerEnsName({coinType:s,address:r,signature:i,message:n}),AccountController.setProfileName(e,t.chainNamespace),RouterController.replace("RegisterAccountNameSuccess")}catch(e2){const r=this.parseEnsApiError(e2,`Error registering name ${e}`);throw RouterController.replace("RegisterAccountName"),new Error(r)}finally{state$5.loading=!1}},validateName:e=>/^[a-zA-Z0-9-]{4,}$/u.test(e),parseEnsApiError(e,t){var r,n;return(null==(n=null==(r=null==e?void 0:e.reasons)?void 0:r[0])?void 0:n.description)||t}},state$4=proxy$1({message:"",variant:"info",open:!1}),AlertController={state:state$4,subscribeKey:(e,t)=>subscribeKey$1(state$4,e,t),open(e,t){const{debug:r}=OptionsController.state,{shortMessage:n,longMessage:i}=e;r&&(state$4.message=n,state$4.variant=t,state$4.open=!0),i&&console.error("function"==typeof i?i():i)},close(){state$4.open=!1,state$4.message="",state$4.variant="info"}},namespaceImageIds={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:""},AssetUtil={async fetchWalletImage(e){if(e)return await ApiController._fetchWalletImage(e),this.getWalletImageById(e)},getWalletImageById(e){if(e)return AssetController.state.walletImages[e]},getWalletImage:e=>(null==e?void 0:e.image_url)?null==e?void 0:e.image_url:(null==e?void 0:e.image_id)?AssetController.state.walletImages[e.image_id]:void 0,getNetworkImage(e){var t,r,n;return(null==(t=null==e?void 0:e.assets)?void 0:t.imageUrl)?null==(r=null==e?void 0:e.assets)?void 0:r.imageUrl:(null==(n=null==e?void 0:e.assets)?void 0:n.imageId)?AssetController.state.networkImages[e.assets.imageId]:void 0},getNetworkImageById(e){if(e)return AssetController.state.networkImages[e]},getConnectorImage:e=>(null==e?void 0:e.imageUrl)?e.imageUrl:(null==e?void 0:e.imageId)?AssetController.state.connectorImages[e.imageId]:void 0,getChainImage:e=>AssetController.state.networkImages[namespaceImageIds[e]]},t$5=globalThis,e$5=t$5.ShadowRoot&&(void 0===t$5.ShadyCSS||t$5.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$4=Symbol(),o$6=new WeakMap;let n$7=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==s$4)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(e$5&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=o$6.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&o$6.set(t,e))}return e}toString(){return this.cssText}};const r$9=e=>new n$7("string"==typeof e?e:e+"",void 0,s$4),i$7=(e,...t)=>{const r=1===e.length?e[0]:t.reduce(((t,r,n)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[n+1]),e[0]);return new n$7(r,e,s$4)},S$4=(e,t)=>{if(e$5)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const r of t){const t=document.createElement("style"),n=t$5.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}},c$6=e$5?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return r$9(t)})(e):e
11
11
  /**
12
12
  * @license
13
13
  * Copyright 2017 Google LLC
@@ -6094,7 +6094,7 @@ const rt$2=e=>void 0===e.strings
6094
6094
  * Released under MIT license <https://lodash.com/license>
6095
6095
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
6096
6096
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
6097
- */P2=qi,s2=qi.exports,function(){var e,t="Expected a function",r="__lodash_hash_undefined__",n="__lodash_placeholder__",i=16,o=32,s=64,a=128,c=256,l=1/0,u=9007199254740991,d=NaN,h=4294967295,p=h-1,f=h>>>1,m=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",i],["flip",512],["partial",o],["partialRight",s],["rearg",c]],g="[object Arguments]",b="[object Array]",y="[object Boolean]",w="[object Date]",v="[object Error]",_="[object Function]",$="[object GeneratorFunction]",C="[object Map]",E="[object Number]",S="[object Object]",x="[object Promise]",A="[object RegExp]",k="[object Set]",T="[object String]",I="[object Symbol]",R="[object WeakMap]",P="[object ArrayBuffer]",N="[object DataView]",M="[object Float32Array]",B="[object Float64Array]",O="[object Int8Array]",L="[object Int16Array]",U="[object Int32Array]",D="[object Uint8Array]",W="[object Uint8ClampedArray]",j="[object Uint16Array]",F="[object Uint32Array]",z=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),Z=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ee=/^\w*$/,te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,re=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(re.source),ie=/^\s+/,oe=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,de=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,be=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,$e="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ee="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",ke="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Te="['’]",Ie="["+$e+"]",Re="["+ke+"]",Pe="["+Ce+"]",Ne="\\d+",Me="["+Ee+"]",Be="["+Se+"]",Oe="[^"+$e+ke+Ne+Ee+Se+xe+"]",Le="\\ud83c[\\udffb-\\udfff]",Ue="[^"+$e+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",We="[\\ud800-\\udbff][\\udc00-\\udfff]",je="["+xe+"]",Fe="\\u200d",ze="(?:"+Be+"|"+Oe+")",qe="(?:"+je+"|"+Oe+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ke="(?:"+Pe+"|"+Le+")?",Ge="["+Ae+"]?",Ze=Ge+Ke+"(?:"+Fe+"(?:"+[Ue,De,We].join("|")+")"+Ge+Ke+")*",Je="(?:"+[Me,De,We].join("|")+")"+Ze,Qe="(?:"+[Ue+Pe+"?",Pe,De,We,Ie].join("|")+")",Ye=RegExp(Te,"g"),Xe=RegExp(Pe,"g"),et=RegExp(Le+"(?="+Le+")|"+Qe+Ze,"g"),tt=RegExp([je+"?"+Be+"+"+He+"(?="+[Re,je,"$"].join("|")+")",qe+"+"+Ve+"(?="+[Re,je+ze,"$"].join("|")+")",je+"?"+ze+"+"+He,je+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Je].join("|"),"g"),rt=RegExp("["+Fe+$e+Ce+Ae+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[M]=st[B]=st[O]=st[L]=st[U]=st[D]=st[W]=st[j]=st[F]=!0,st[g]=st[b]=st[P]=st[y]=st[N]=st[w]=st[v]=st[_]=st[C]=st[E]=st[S]=st[A]=st[k]=st[T]=st[R]=!1;var at={};at[g]=at[b]=at[P]=at[N]=at[y]=at[w]=at[M]=at[B]=at[O]=at[L]=at[U]=at[C]=at[E]=at[S]=at[A]=at[k]=at[T]=at[I]=at[D]=at[W]=at[j]=at[F]=!0,at[v]=at[_]=at[R]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,dt="object"==typeof _n&&_n&&_n.Object===Object&&_n,ht="object"==typeof self&&self&&self.Object===Object&&self,pt=dt||ht||Function("return this")(),ft=s2&&!s2.nodeType&&s2,mt=ft&&P2&&!P2.nodeType&&P2,gt=mt&&mt.exports===ft,bt=gt&&dt.process,yt=function(){try{return mt&&mt.require&&mt.require("util").types||bt&&bt.binding&&bt.binding("util")}catch{}}(),wt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,_t=yt&&yt.isMap,$t=yt&&yt.isRegExp,Ct=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function xt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(n,s,r(s),e)}return n}function At(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function kt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Tt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function It(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function Rt(e,t){return!(null==e||!e.length)&&jt(e,t,0)>-1}function Pt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Nt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Mt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Bt(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Ot(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Lt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Ut=Ht("length");function Dt(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function Wt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function jt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Wt(e,zt,r)}function Ft(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function zt(e){return e!=e}function qt(e,t){var r=null==e?0:e.length;return r?Gt(e,t)/r:d}function Ht(t){return function(r){return null==r?e:r[t]}}function Vt(t){return function(r){return null==t?e:t[r]}}function Kt(e,t,r,n,i){return i(e,(function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)})),r}function Gt(t,r){for(var n,i=-1,o=t.length;++i<o;){var s=r(t[i]);s!==e&&(n=n===e?s:n+s)}return n}function Zt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Jt(e){return e&&e.slice(0,hr(e)+1).replace(ie,"")}function Qt(e){return function(t){return e(t)}}function Yt(e,t){return Nt(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function er(e,t){for(var r=-1,n=e.length;++r<n&&jt(t,e[r],0)>-1;);return r}function tr(e,t){for(var r=e.length;r--&&jt(t,e[r],0)>-1;);return r}var rr=Vt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nr=Vt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function ir(e){return"\\"+ct[e]}function or(e){return rt.test(e)}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function ar(e,t){return function(r){return e(t(r))}}function cr(e,t){for(var r=-1,i=e.length,o=0,s=[];++r<i;){var a=e[r];(a===t||a===n)&&(e[r]=n,s[o++]=r)}return s}function lr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function ur(e){return or(e)?function(e){for(var t=et.lastIndex=0;et.test(e);)++t;return t}(e):Ut(e)}function dr(e){return or(e)?function(e){return e.match(et)||[]}(e):function(e){return e.split("")}(e)}function hr(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var pr=Vt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function oe($e){var Ce,Ee=($e=null==$e?pt:fr.defaults(pt.Object(),$e,fr.pick(pt,it))).Array,Se=$e.Date,xe=$e.Error,Ae=$e.Function,ke=$e.Math,Te=$e.Object,Ie=$e.RegExp,Re=$e.String,Pe=$e.TypeError,Ne=Ee.prototype,Me=Ae.prototype,Be=Te.prototype,Oe=$e["__core-js_shared__"],Le=Me.toString,Ue=Be.hasOwnProperty,De=0,We=(Ce=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+Ce:"",je=Be.toString,Fe=Le.call(Te),ze=pt._,qe=Ie("^"+Le.call(Ue).replace(re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=gt?$e.Buffer:e,Ve=$e.Symbol,Ke=$e.Uint8Array,Ge=He?He.allocUnsafe:e,Ze=ar(Te.getPrototypeOf,Te),Je=Te.create,Qe=Be.propertyIsEnumerable,et=Ne.splice,rt=Ve?Ve.isConcatSpreadable:e,ct=Ve?Ve.iterator:e,dt=Ve?Ve.toStringTag:e,ht=function(){try{var e=fo(Te,"defineProperty");return e({},"",{}),e}catch{}}(),ft=$e.clearTimeout!==pt.clearTimeout&&$e.clearTimeout,mt=Se&&Se.now!==pt.Date.now&&Se.now,bt=$e.setTimeout!==pt.setTimeout&&$e.setTimeout,yt=ke.ceil,Ut=ke.floor,Vt=Te.getOwnPropertySymbols,mr=He?He.isBuffer:e,gr=$e.isFinite,br=Ne.join,yr=ar(Te.keys,Te),wr=ke.max,vr=ke.min,_r=Se.now,$r=$e.parseInt,Cr=ke.random,Er=Ne.reverse,Sr=fo($e,"DataView"),xr=fo($e,"Map"),Ar=fo($e,"Promise"),kr=fo($e,"Set"),Tr=fo($e,"WeakMap"),Ir=fo(Te,"create"),Rr=Tr&&new Tr,Pr={},Nr=Wo(Sr),Mr=Wo(xr),Br=Wo(Ar),Or=Wo(kr),Lr=Wo(Tr),Ur=Ve?Ve.prototype:e,Dr=Ur?Ur.valueOf:e,Wr=Ur?Ur.toString:e;function jr(e){if(na(e)&&!Vs(e)&&!(e instanceof Hr)){if(e instanceof qr)return e;if(Ue.call(e,"__wrapped__"))return jo(e)}return new qr(e)}var Fr=function(){function t(){}return function(r){if(!ra(r))return{};if(Je)return Je(r);t.prototype=r;var n=new t;return t.prototype=e,n}}();function zr(){}function qr(t,r){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=e}function Hr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Kr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Zr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Gr;++t<r;)this.add(e[t])}function Jr(e){var t=this.__data__=new Kr(e);this.size=t.size}function Qr(e,t){var r=Vs(e),n=!r&&Hs(e),i=!r&&!n&&Js(e),o=!r&&!n&&!i&&da(e),s=r||n||i||o,a=s?Zt(e.length,Re):[],c=a.length;for(var l in e)(t||Ue.call(e,l))&&(!s||!("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||_o(l,c)))&&a.push(l);return a}function Yr(t){var r=t.length;return r?t[Jn(0,r-1)]:e}function Xr(e,t){return Lo(Ri(e),ln(t,0,e.length))}function en(e){return Lo(Ri(e))}function tn(t,r,n){(n!==e&&!Fs(t[r],n)||n===e&&!(r in t))&&an(t,r,n)}function rn(t,r,n){var i=t[r];(!Ue.call(t,r)||!Fs(i,n)||n===e&&!(r in t))&&an(t,r,n)}function nn(e,t){for(var r=e.length;r--;)if(Fs(e[r][0],t))return r;return-1}function on(e,t,r,n){return fn(e,(function(e,i,o){t(n,e,r(e),o)})),n}function sn(e,t){return e&&Pi(t,Na(t),e)}function an(e,t,r){"__proto__"==t&&ht?ht(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function cn(t,r){for(var n=-1,i=r.length,o=Ee(i),s=null==t;++n<i;)o[n]=s?e:ka(t,r[n]);return o}function ln(t,r,n){return t==t&&(n!==e&&(t=t<=n?t:n),r!==e&&(t=t>=r?t:r)),t}function un(t,r,n,i,o,s){var a,c=1&r,l=2&r,u=4&r;if(n&&(a=o?n(t,i,o,s):n(t)),a!==e)return a;if(!ra(t))return t;var d=Vs(t);if(d){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ue.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(t),!c)return Ri(t,a)}else{var h=bo(t),p=h==_||h==$;if(Js(t))return Si(t,c);if(h==S||h==g||p&&!o){if(a=l||p?{}:wo(t),!c)return l?function(e,t){return Pi(e,go(e),t)}(t,function(e,t){return e&&Pi(t,Ma(t),e)}(a,t)):function(e,t){return Pi(e,mo(e),t)}(t,sn(a,t))}else{if(!at[h])return o?t:{};a=function(e,t,r){var n=e.constructor;switch(t){case P:return xi(e);case y:case w:return new n(+e);case N:return function(e,t){var r=t?xi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case M:case B:case O:case L:case U:case D:case W:case j:case F:return Ai(e,r);case C:return new n;case E:case T:return new n(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new n;case I:return function(e){return Dr?Te(Dr.call(e)):{}}(e)}}(t,h,c)}}s||(s=new Jr);var f=s.get(t);if(f)return f;s.set(t,a),ca(t)?t.forEach((function(e){a.add(un(e,r,n,e,t,s))})):ia(t)&&t.forEach((function(e,i){a.set(i,un(e,r,n,i,t,s))}));var m=d?e:(u?l?so:oo:l?Ma:Na)(t);return At(m||t,(function(e,i){m&&(e=t[i=e]),rn(a,i,un(e,r,n,i,t,s))})),a}function dn(t,r,n){var i=n.length;if(null==t)return!i;for(t=Te(t);i--;){var o=n[i],s=r[o],a=t[o];if(a===e&&!(o in t)||!s(a))return!1}return!0}function hn(r,n,i){if("function"!=typeof r)throw new Pe(t);return No((function(){r.apply(e,i)}),n)}function pn(e,t,r,n){var i=-1,o=Rt,s=!0,a=e.length,c=[],l=t.length;if(!a)return c;r&&(t=Nt(t,Qt(r))),n?(o=Pt,s=!1):t.length>=200&&(o=Xt,s=!1,t=new Zr(t));e:for(;++i<a;){var u=e[i],d=null==r?u:r(u);if(u=n||0!==u?u:0,s&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;c.push(u)}else o(t,d,n)||c.push(u)}return c}jr.templateSettings={escape:J,evaluate:Q,interpolate:Y,variable:"",imports:{_:jr}},jr.prototype=zr.prototype,jr.prototype.constructor=jr,qr.prototype=Fr(zr.prototype),qr.prototype.constructor=qr,Hr.prototype=Fr(zr.prototype),Hr.prototype.constructor=Hr,Vr.prototype.clear=function(){this.__data__=Ir?Ir(null):{},this.size=0},Vr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Vr.prototype.get=function(t){var n=this.__data__;if(Ir){var i=n[t];return i===r?e:i}return Ue.call(n,t)?n[t]:e},Vr.prototype.has=function(t){var r=this.__data__;return Ir?r[t]!==e:Ue.call(r,t)},Vr.prototype.set=function(t,n){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Ir&&n===e?r:n,this},Kr.prototype.clear=function(){this.__data__=[],this.size=0},Kr.prototype.delete=function(e){var t=this.__data__,r=nn(t,e);return!(r<0||(r==t.length-1?t.pop():et.call(t,r,1),--this.size,0))},Kr.prototype.get=function(t){var r=this.__data__,n=nn(r,t);return n<0?e:r[n][1]},Kr.prototype.has=function(e){return nn(this.__data__,e)>-1},Kr.prototype.set=function(e,t){var r=this.__data__,n=nn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Gr.prototype.clear=function(){this.size=0,this.__data__={hash:new Vr,map:new(xr||Kr),string:new Vr}},Gr.prototype.delete=function(e){var t=ho(this,e).delete(e);return this.size-=t?1:0,t},Gr.prototype.get=function(e){return ho(this,e).get(e)},Gr.prototype.has=function(e){return ho(this,e).has(e)},Gr.prototype.set=function(e,t){var r=ho(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Zr.prototype.add=Zr.prototype.push=function(e){return this.__data__.set(e,r),this},Zr.prototype.has=function(e){return this.__data__.has(e)},Jr.prototype.clear=function(){this.__data__=new Kr,this.size=0},Jr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Jr.prototype.get=function(e){return this.__data__.get(e)},Jr.prototype.has=function(e){return this.__data__.has(e)},Jr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Kr){var n=r.__data__;if(!xr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Gr(n)}return r.set(e,t),this.size=r.size,this};var fn=Bi($n),mn=Bi(Cn,!0);function gn(e,t){var r=!0;return fn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function bn(t,r,n){for(var i=-1,o=t.length;++i<o;){var s=t[i],a=r(s);if(null!=a&&(c===e?a==a&&!ua(a):n(a,c)))var c=a,l=s}return l}function yn(e,t){var r=[];return fn(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function wn(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=vo),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?wn(a,t-1,r,n,i):Mt(i,a):n||(i[i.length]=a)}return i}var vn=Oi(),_n=Oi(!0);function $n(e,t){return e&&vn(e,t,Na)}function Cn(e,t){return e&&_n(e,t,Na)}function En(e,t){return It(t,(function(t){return Xs(e[t])}))}function Sn(t,r){for(var n=0,i=(r=_i(r,t)).length;null!=t&&n<i;)t=t[Do(r[n++])];return n&&n==i?t:e}function xn(e,t,r){var n=t(e);return Vs(e)?n:Mt(n,r(e))}function An(t){return null==t?t===e?"[object Undefined]":"[object Null]":dt&&dt in Te(t)?function(t){var r=Ue.call(t,dt),n=t[dt];try{t[dt]=e;var i=!0}catch{}var o=je.call(t);return i&&(r?t[dt]=n:delete t[dt]),o}(t):function(e){return je.call(e)}(t)}function kn(e,t){return e>t}function Tn(e,t){return null!=e&&Ue.call(e,t)}function In(e,t){return null!=e&&t in Te(e)}function Rn(t,r,n){for(var i=n?Pt:Rt,o=t[0].length,s=t.length,a=s,c=Ee(s),l=1/0,u=[];a--;){var d=t[a];a&&r&&(d=Nt(d,Qt(r))),l=vr(d.length,l),c[a]=!n&&(r||o>=120&&d.length>=120)?new Zr(a&&d):e}d=t[0];var h=-1,p=c[0];e:for(;++h<o&&u.length<l;){var f=d[h],m=r?r(f):f;if(f=n||0!==f?f:0,!(p?Xt(p,m):i(u,m,n))){for(a=s;--a;){var g=c[a];if(!(g?Xt(g,m):i(t[a],m,n)))continue e}p&&p.push(m),u.push(f)}}return u}function Pn(t,r,n){var i=null==(t=Io(t,r=_i(r,t)))?t:t[Do(Yo(r))];return null==i?e:St(i,t,n)}function Nn(e){return na(e)&&An(e)==g}function Mn(t,r,n,i,o){return t===r||(null==t||null==r||!na(t)&&!na(r)?t!=t&&r!=r:function(t,r,n,i,o,s){var a=Vs(t),c=Vs(r),l=a?b:bo(t),u=c?b:bo(r),d=(l=l==g?S:l)==S,h=(u=u==g?S:u)==S,p=l==u;if(p&&Js(t)){if(!Js(r))return!1;a=!0,d=!1}if(p&&!d)return s||(s=new Jr),a||da(t)?no(t,r,n,i,o,s):function(e,t,r,n,i,o,s){switch(r){case N:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case P:return!(e.byteLength!=t.byteLength||!o(new Ke(e),new Ke(t)));case y:case w:case E:return Fs(+e,+t);case v:return e.name==t.name&&e.message==t.message;case A:case T:return e==t+"";case C:var a=sr;case k:var c=1&n;if(a||(a=lr),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;n|=2,s.set(e,t);var u=no(a(e),a(t),n,i,o,s);return s.delete(e),u;case I:if(Dr)return Dr.call(e)==Dr.call(t)}return!1}(t,r,l,n,i,o,s);if(!(1&n)){var f=d&&Ue.call(t,"__wrapped__"),m=h&&Ue.call(r,"__wrapped__");if(f||m){var _=f?t.value():t,$=m?r.value():r;return s||(s=new Jr),o(_,$,n,i,s)}}return!!p&&(s||(s=new Jr),function(t,r,n,i,o,s){var a=1&n,c=oo(t),l=c.length,u=oo(r),d=u.length;if(l!=d&&!a)return!1;for(var h=l;h--;){var p=c[h];if(!(a?p in r:Ue.call(r,p)))return!1}var f=s.get(t),m=s.get(r);if(f&&m)return f==r&&m==t;var g=!0;s.set(t,r),s.set(r,t);for(var b=a;++h<l;){var y=t[p=c[h]],w=r[p];if(i)var v=a?i(w,y,p,r,t,s):i(y,w,p,t,r,s);if(!(v===e?y===w||o(y,w,n,i,s):v)){g=!1;break}b||(b="constructor"==p)}if(g&&!b){var _=t.constructor,$=r.constructor;_!=$&&"constructor"in t&&"constructor"in r&&!("function"==typeof _&&_ instanceof _&&"function"==typeof $&&$ instanceof $)&&(g=!1)}return s.delete(t),s.delete(r),g}(t,r,n,i,o,s))}(t,r,n,i,Mn,o))}function Bn(t,r,n,i){var o=n.length,s=o,a=!i;if(null==t)return!s;for(t=Te(t);o--;){var c=n[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){var l=(c=n[o])[0],u=t[l],d=c[1];if(a&&c[2]){if(u===e&&!(l in t))return!1}else{var h=new Jr;if(i)var p=i(u,d,l,t,r,h);if(!(p===e?Mn(d,u,3,i,h):p))return!1}}return!0}function On(e){return!(!ra(e)||function(e){return!!We&&We in e}(e))&&(Xs(e)?qe:ge).test(Wo(e))}function Ln(e){return"function"==typeof e?e:null==e?oc:"object"==typeof e?Vs(e)?zn(e[0],e[1]):Fn(e):fc(e)}function Un(e){if(!xo(e))return yr(e);var t=[];for(var r in Te(e))Ue.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Dn(e){if(!ra(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=xo(e),r=[];for(var n in e)"constructor"==n&&(t||!Ue.call(e,n))||r.push(n);return r}function Wn(e,t){return e<t}function jn(e,t){var r=-1,n=Gs(e)?Ee(e.length):[];return fn(e,(function(e,i,o){n[++r]=t(e,i,o)})),n}function Fn(e){var t=po(e);return 1==t.length&&t[0][2]?ko(t[0][0],t[0][1]):function(r){return r===e||Bn(r,e,t)}}function zn(t,r){return Co(t)&&Ao(r)?ko(Do(t),r):function(n){var i=ka(n,t);return i===e&&i===r?Ta(n,t):Mn(r,i,3)}}function qn(t,r,n,i,o){t!==r&&vn(r,(function(s,a){if(o||(o=new Jr),ra(s))!function(t,r,n,i,o,s,a){var c=Ro(t,n),l=Ro(r,n),u=a.get(l);if(u)tn(t,n,u);else{var d=s?s(c,l,n+"",t,r,a):e,h=d===e;if(h){var p=Vs(l),f=!p&&Js(l),m=!p&&!f&&da(l);d=l,p||f||m?Vs(c)?d=c:Zs(c)?d=Ri(c):f?(h=!1,d=Si(l,!0)):m?(h=!1,d=Ai(l,!0)):d=[]:sa(l)||Hs(l)?(d=c,Hs(c)?d=wa(c):(!ra(c)||Xs(c))&&(d=wo(l))):h=!1}h&&(a.set(l,d),o(d,l,i,s,a),a.delete(l)),tn(t,n,d)}}(t,r,a,n,qn,i,o);else{var c=i?i(Ro(t,a),s,a+"",t,r,o):e;c===e&&(c=s),tn(t,a,c)}}),Ma)}function Hn(t,r){var n=t.length;if(n)return _o(r+=r<0?n:0,n)?t[r]:e}function Vn(e,t,r){t=t.length?Nt(t,(function(e){return Vs(e)?function(t){return Sn(t,1===e.length?e[0]:e)}:e})):[oc];var n=-1;return t=Nt(t,Qt(uo())),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(jn(e,(function(e,r,i){return{criteria:Nt(t,(function(t){return t(e)})),index:++n,value:e}})),(function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=ki(i[n],o[n]);if(c)return n>=a?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function Kn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=Sn(e,s);r(a,s)&&ti(o,_i(s,e),a)}return o}function Gn(e,t,r,n){var i=n?Ft:jt,o=-1,s=t.length,a=e;for(e===t&&(t=Ri(t)),r&&(a=Nt(e,Qt(r)));++o<s;)for(var c=0,l=t[o],u=r?r(l):l;(c=i(a,u,c,n))>-1;)a!==e&&et.call(a,c,1),et.call(e,c,1);return e}function Zn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;_o(i)?et.call(e,i,1):pi(e,i)}}return e}function Jn(e,t){return e+Ut(Cr()*(t-e+1))}function Qn(e,t){var r="";if(!e||t<1||t>u)return r;do{t%2&&(r+=e),(t=Ut(t/2))&&(e+=e)}while(t);return r}function Yn(e,t){return Mo(To(e,t,oc),e+"")}function Xn(e){return Yr(Fa(e))}function ei(e,t){var r=Fa(e);return Lo(r,ln(t,0,r.length))}function ti(t,r,n,i){if(!ra(t))return t;for(var o=-1,s=(r=_i(r,t)).length,a=s-1,c=t;null!=c&&++o<s;){var l=Do(r[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(o!=a){var d=c[l];(u=i?i(d,l,c):e)===e&&(u=ra(d)?d:_o(r[o+1])?[]:{})}rn(c,l,u),c=c[l]}return t}var ri=Rr?function(e,t){return Rr.set(e,t),e}:oc,ni=ht?function(e,t){return ht(e,"toString",{configurable:!0,enumerable:!1,value:rc(t),writable:!0})}:oc;function ii(e){return Lo(Fa(e))}function oi(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Ee(i);++n<i;)o[n]=e[n+t];return o}function si(e,t){var r;return fn(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function ai(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=f){for(;n<i;){var o=n+i>>>1,s=e[o];null!==s&&!ua(s)&&(r?s<=t:s<t)?n=o+1:i=o}return i}return ci(e,t,oc,r)}function ci(t,r,n,i){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(r=n(r))!=r,c=null===r,l=ua(r),u=r===e;o<s;){var d=Ut((o+s)/2),h=n(t[d]),f=h!==e,m=null===h,g=h==h,b=ua(h);if(a)var y=i||g;else y=u?g&&(i||f):c?g&&f&&(i||!m):l?g&&f&&!m&&(i||!b):!m&&!b&&(i?h<=r:h<r);y?o=d+1:s=d}return vr(s,p)}function li(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r],a=t?t(s):s;if(!r||!Fs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function ui(e){return"number"==typeof e?e:ua(e)?d:+e}function di(e){if("string"==typeof e)return e;if(Vs(e))return Nt(e,di)+"";if(ua(e))return Wr?Wr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function hi(e,t,r){var n=-1,i=Rt,o=e.length,s=!0,a=[],c=a;if(r)s=!1,i=Pt;else if(o>=200){var l=t?null:Qi(e);if(l)return lr(l);s=!1,i=Xt,c=new Zr}else c=t?[]:a;e:for(;++n<o;){var u=e[n],d=t?t(u):u;if(u=r||0!==u?u:0,s&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),a.push(u)}else i(c,d,r)||(c!==a&&c.push(d),a.push(u))}return a}function pi(e,t){return null==(e=Io(e,t=_i(t,e)))||delete e[Do(Yo(t))]}function fi(e,t,r,n){return ti(e,t,r(Sn(e,t)),n)}function mi(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?oi(e,n?0:o,n?o+1:i):oi(e,n?o+1:0,n?i:o)}function gi(e,t){var r=e;return r instanceof Hr&&(r=r.value()),Bt(t,(function(e,t){return t.func.apply(t.thisArg,Mt([e],t.args))}),r)}function bi(e,t,r){var n=e.length;if(n<2)return n?hi(e[0]):[];for(var i=-1,o=Ee(n);++i<n;)for(var s=e[i],a=-1;++a<n;)a!=i&&(o[i]=pn(o[i]||s,e[a],t,r));return hi(wn(o,1),t,r)}function yi(t,r,n){for(var i=-1,o=t.length,s=r.length,a={};++i<o;){var c=i<s?r[i]:e;n(a,t[i],c)}return a}function wi(e){return Zs(e)?e:[]}function vi(e){return"function"==typeof e?e:oc}function _i(e,t){return Vs(e)?e:Co(e,t)?[e]:Uo(va(e))}var $i=Yn;function Ci(t,r,n){var i=t.length;return n=n===e?i:n,!r&&n>=i?t:oi(t,r,n)}var Ei=ft||function(e){return pt.clearTimeout(e)};function Si(e,t){if(t)return e.slice();var r=e.length,n=Ge?Ge(r):new e.constructor(r);return e.copy(n),n}function xi(e){var t=new e.constructor(e.byteLength);return new Ke(t).set(new Ke(e)),t}function Ai(e,t){var r=t?xi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ki(t,r){if(t!==r){var n=t!==e,i=null===t,o=t==t,s=ua(t),a=r!==e,c=null===r,l=r==r,u=ua(r);if(!c&&!u&&!s&&t>r||s&&a&&l&&!c&&!u||i&&a&&l||!n&&l||!o)return 1;if(!i&&!s&&!u&&t<r||u&&n&&o&&!i&&!s||c&&n&&o||!a&&o||!l)return-1}return 0}function Ti(e,t,r,n){for(var i=-1,o=e.length,s=r.length,a=-1,c=t.length,l=wr(o-s,0),u=Ee(c+l),d=!n;++a<c;)u[a]=t[a];for(;++i<s;)(d||i<o)&&(u[r[i]]=e[i]);for(;l--;)u[a++]=e[i++];return u}function Ii(e,t,r,n){for(var i=-1,o=e.length,s=-1,a=r.length,c=-1,l=t.length,u=wr(o-a,0),d=Ee(u+l),h=!n;++i<u;)d[i]=e[i];for(var p=i;++c<l;)d[p+c]=t[c];for(;++s<a;)(h||i<o)&&(d[p+r[s]]=e[i++]);return d}function Ri(e,t){var r=-1,n=e.length;for(t||(t=Ee(n));++r<n;)t[r]=e[r];return t}function Pi(t,r,n,i){var o=!n;n||(n={});for(var s=-1,a=r.length;++s<a;){var c=r[s],l=i?i(n[c],t[c],c,n,t):e;l===e&&(l=t[c]),o?an(n,c,l):rn(n,c,l)}return n}function Ni(e,t){return function(r,n){var i=Vs(r)?xt:on,o=t?t():{};return i(r,e,uo(n,2),o)}}function Mi(t){return Yn((function(r,n){var i=-1,o=n.length,s=o>1?n[o-1]:e,a=o>2?n[2]:e;for(s=t.length>3&&"function"==typeof s?(o--,s):e,a&&$o(n[0],n[1],a)&&(s=o<3?e:s,o=1),r=Te(r);++i<o;){var c=n[i];c&&t(r,c,i,s)}return r}))}function Bi(e,t){return function(r,n){if(null==r)return r;if(!Gs(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Te(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function Oi(e){return function(t,r,n){for(var i=-1,o=Te(t),s=n(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===r(o[c],c,o))break}return t}}function Li(t){return function(r){var n=or(r=va(r))?dr(r):e,i=n?n[0]:r.charAt(0),o=n?Ci(n,1).join(""):r.slice(1);return i[t]()+o}}function Ui(e){return function(t){return Bt(Xa(Ha(t).replace(Ye,"")),e,"")}}function Di(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Fr(e.prototype),n=e.apply(r,t);return ra(n)?n:r}}function Wi(t){return function(r,n,i){var o=Te(r);if(!Gs(r)){var s=uo(n,3);r=Na(r),n=function(e){return s(o[e],e,o)}}var a=t(r,n,i);return a>-1?o[s?r[a]:a]:e}}function ji(r){return io((function(n){var i=n.length,o=i,s=qr.prototype.thru;for(r&&n.reverse();o--;){var a=n[o];if("function"!=typeof a)throw new Pe(t);if(s&&!c&&"wrapper"==co(a))var c=new qr([],!0)}for(o=c?o:i;++o<i;){var l=co(a=n[o]),u="wrapper"==l?ao(a):e;c=u&&Eo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[co(u[0])].apply(c,u[3]):1==a.length&&Eo(a)?c[l]():c.thru(a)}return function(){var e=arguments,t=e[0];if(c&&1==e.length&&Vs(t))return c.plant(t).value();for(var r=0,o=i?n[r].apply(this,e):t;++r<i;)o=n[r].call(this,o);return o}}))}function Fi(t,r,n,i,o,s,c,l,u,d){var h=r&a,p=1&r,f=2&r,m=24&r,g=512&r,b=f?e:Di(t);return function a(){for(var y=arguments.length,w=Ee(y),v=y;v--;)w[v]=arguments[v];if(m)var _=lo(a),$=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(w,_);if(i&&(w=Ti(w,i,o,m)),s&&(w=Ii(w,s,c,m)),y-=$,m&&y<d){var C=cr(w,_);return Zi(t,r,Fi,a.placeholder,n,w,C,l,u,d-y)}var E=p?n:this,S=f?E[t]:t;return y=w.length,l?w=function(t,r){for(var n=t.length,i=vr(r.length,n),o=Ri(t);i--;){var s=r[i];t[i]=_o(s,n)?o[s]:e}return t}(w,l):g&&y>1&&w.reverse(),h&&u<y&&(w.length=u),this&&this!==pt&&this instanceof a&&(S=b||Di(S)),S.apply(E,w)}}function zi(e,t){return function(r,n){return function(e,t,r,n){return $n(e,(function(e,i,o){t(n,r(e),i,o)})),n}(r,e,t(n),{})}}function qi(t,r){return function(n,i){var o;if(n===e&&i===e)return r;if(n!==e&&(o=n),i!==e){if(o===e)return i;"string"==typeof n||"string"==typeof i?(n=di(n),i=di(i)):(n=ui(n),i=ui(i)),o=t(n,i)}return o}}function Hi(e){return io((function(t){return t=Nt(t,Qt(uo())),Yn((function(r){var n=this;return e(t,(function(e){return St(e,n,r)}))}))}))}function Vi(t,r){var n=(r=r===e?" ":di(r)).length;if(n<2)return n?Qn(r,t):r;var i=Qn(r,yt(t/ur(r)));return or(r)?Ci(dr(i),0,t).join(""):i.slice(0,t)}function Ki(t){return function(r,n,i){return i&&"number"!=typeof i&&$o(r,n,i)&&(n=i=e),r=ma(r),n===e?(n=r,r=0):n=ma(n),function(e,t,r,n){for(var i=-1,o=wr(yt((t-e)/(r||1)),0),s=Ee(o);o--;)s[n?o:++i]=e,e+=r;return s}(r,n,i=i===e?r<n?1:-1:ma(i),t)}}function Gi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ya(t),r=ya(r)),e(t,r)}}function Zi(t,r,n,i,a,c,l,u,d,h){var p=8&r;r|=p?o:s,4&(r&=~(p?s:o))||(r&=-4);var f=[t,r,a,p?c:e,p?l:e,p?e:c,p?e:l,u,d,h],m=n.apply(e,f);return Eo(t)&&Po(m,f),m.placeholder=i,Bo(m,t,r)}function Ji(e){var t=ke[e];return function(e,r){if(e=ya(e),(r=null==r?0:vr(ga(r),292))&&gr(e)){var n=(va(e)+"e").split("e");return+((n=(va(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Qi=kr&&1/lr(new kr([,-0]))[1]==l?function(e){return new kr(e)}:uc;function Yi(e){return function(t){var r=bo(t);return r==C?sr(t):r==k?function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}(t):function(e,t){return Nt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xi(r,l,u,d,h,p,f,m){var g=2&l;if(!g&&"function"!=typeof r)throw new Pe(t);var b=d?d.length:0;if(b||(l&=-97,d=h=e),f=f===e?f:wr(ga(f),0),m=m===e?m:ga(m),b-=h?h.length:0,l&s){var y=d,w=h;d=h=e}var v=g?e:ao(r),_=[r,l,u,d,h,y,w,p,f,m];if(v&&function(e,t){var r=e[1],i=t[1],o=r|i,s=o<131,l=i==a&&8==r||i==a&&r==c&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==r;if(!s&&!l)return e;1&i&&(e[2]=t[2],o|=1&r?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Ti(d,u,t[4]):u,e[4]=d?cr(e[3],n):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ii(d,u,t[6]):u,e[6]=d?cr(e[5],n):t[6]),(u=t[7])&&(e[7]=u),i&a&&(e[8]=null==e[8]?t[8]:vr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(_,v),r=_[0],l=_[1],u=_[2],d=_[3],h=_[4],!(m=_[9]=_[9]===e?g?0:r.length:wr(_[9]-b,0))&&24&l&&(l&=-25),l&&1!=l)$=8==l||l==i?function(t,r,n){var i=Di(t);return function o(){for(var s=arguments.length,a=Ee(s),c=s,l=lo(o);c--;)a[c]=arguments[c];var u=s<3&&a[0]!==l&&a[s-1]!==l?[]:cr(a,l);return(s-=u.length)<n?Zi(t,r,Fi,o.placeholder,e,a,u,e,e,n-s):St(this&&this!==pt&&this instanceof o?i:t,this,a)}}(r,l,m):l!=o&&33!=l||h.length?Fi.apply(e,_):function(e,t,r,n){var i=1&t,o=Di(e);return function t(){for(var s=-1,a=arguments.length,c=-1,l=n.length,u=Ee(l+a),d=this&&this!==pt&&this instanceof t?o:e;++c<l;)u[c]=n[c];for(;a--;)u[c++]=arguments[++s];return St(d,i?r:this,u)}}(r,l,u,d);else var $=function(e,t,r){var n=1&t,i=Di(e);return function t(){return(this&&this!==pt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(r,l,u);return Bo((v?ri:Po)($,_),r,l)}function eo(t,r,n,i){return t===e||Fs(t,Be[n])&&!Ue.call(i,n)?r:t}function to(t,r,n,i,o,s){return ra(t)&&ra(r)&&(s.set(r,t),qn(t,r,e,to,s),s.delete(r)),t}function ro(t){return sa(t)?e:t}function no(t,r,n,i,o,s){var a=1&n,c=t.length,l=r.length;if(c!=l&&!(a&&l>c))return!1;var u=s.get(t),d=s.get(r);if(u&&d)return u==r&&d==t;var h=-1,p=!0,f=2&n?new Zr:e;for(s.set(t,r),s.set(r,t);++h<c;){var m=t[h],g=r[h];if(i)var b=a?i(g,m,h,r,t,s):i(m,g,h,t,r,s);if(b!==e){if(b)continue;p=!1;break}if(f){if(!Lt(r,(function(e,t){if(!Xt(f,t)&&(m===e||o(m,e,n,i,s)))return f.push(t)}))){p=!1;break}}else if(m!==g&&!o(m,g,n,i,s)){p=!1;break}}return s.delete(t),s.delete(r),p}function io(t){return Mo(To(t,e,Ko),t+"")}function oo(e){return xn(e,Na,mo)}function so(e){return xn(e,Ma,go)}var ao=Rr?function(e){return Rr.get(e)}:uc;function co(e){for(var t=e.name+"",r=Pr[t],n=Ue.call(Pr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function lo(e){return(Ue.call(jr,"placeholder")?jr:e).placeholder}function uo(){var e=jr.iteratee||sc;return e=e===sc?Ln:e,arguments.length?e(arguments[0],arguments[1]):e}function ho(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function po(e){for(var t=Na(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ao(i)]}return t}function fo(t,r){var n=function(t,r){return null==t?e:t[r]}(t,r);return On(n)?n:e}var mo=Vt?function(e){return null==e?[]:(e=Te(e),It(Vt(e),(function(t){return Qe.call(e,t)})))}:bc,go=Vt?function(e){for(var t=[];e;)Mt(t,mo(e)),e=Ze(e);return t}:bc,bo=An;function yo(e,t,r){for(var n=-1,i=(t=_i(t,e)).length,o=!1;++n<i;){var s=Do(t[n]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&ta(i)&&_o(s,i)&&(Vs(e)||Hs(e))}function wo(e){return"function"!=typeof e.constructor||xo(e)?{}:Fr(Ze(e))}function vo(e){return Vs(e)||Hs(e)||!!(rt&&e&&e[rt])}function _o(e,t){var r=typeof e;return!!(t=t??u)&&("number"==r||"symbol"!=r&&ye.test(e))&&e>-1&&e%1==0&&e<t}function $o(e,t,r){if(!ra(r))return!1;var n=typeof t;return!!("number"==n?Gs(r)&&_o(t,r.length):"string"==n&&t in r)&&Fs(r[t],e)}function Co(e,t){if(Vs(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ua(e))||ee.test(e)||!X.test(e)||null!=t&&e in Te(t)}function Eo(e){var t=co(e),r=jr[t];if("function"!=typeof r||!(t in Hr.prototype))return!1;if(e===r)return!0;var n=ao(r);return!!n&&e===n[0]}(Sr&&bo(new Sr(new ArrayBuffer(1)))!=N||xr&&bo(new xr)!=C||Ar&&bo(Ar.resolve())!=x||kr&&bo(new kr)!=k||Tr&&bo(new Tr)!=R)&&(bo=function(t){var r=An(t),n=r==S?t.constructor:e,i=n?Wo(n):"";if(i)switch(i){case Nr:return N;case Mr:return C;case Br:return x;case Or:return k;case Lr:return R}return r});var So=Oe?Xs:yc;function xo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Be)}function Ao(e){return e==e&&!ra(e)}function ko(t,r){return function(n){return null!=n&&n[t]===r&&(r!==e||t in Te(n))}}function To(t,r,n){return r=wr(r===e?t.length-1:r,0),function(){for(var e=arguments,i=-1,o=wr(e.length-r,0),s=Ee(o);++i<o;)s[i]=e[r+i];i=-1;for(var a=Ee(r+1);++i<r;)a[i]=e[i];return a[r]=n(s),St(t,this,a)}}function Io(e,t){return t.length<2?e:Sn(e,oi(t,0,-1))}function Ro(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Po=Oo(ri),No=bt||function(e,t){return pt.setTimeout(e,t)},Mo=Oo(ni);function Bo(e,t,r){var n=t+"";return Mo(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return At(m,(function(r){var n="_."+r[0];t&r[1]&&!Rt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ce):[]}(n),r)))}function Oo(t){var r=0,n=0;return function(){var i=_r(),o=16-(i-n);if(n=i,o>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(e,arguments)}}function Lo(t,r){var n=-1,i=t.length,o=i-1;for(r=r===e?i:r;++n<r;){var s=Jn(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=r,t}var Uo=function(e){var t=Os(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(te,(function(e,r,n,i){t.push(n?i.replace(de,"$1"):r||e)})),t}));function Do(e){if("string"==typeof e||ua(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Wo(e){if(null!=e){try{return Le.call(e)}catch{}try{return e+""}catch{}}return""}function jo(e){if(e instanceof Hr)return e.clone();var t=new qr(e.__wrapped__,e.__chain__);return t.__actions__=Ri(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fo=Yn((function(e,t){return Zs(e)?pn(e,wn(t,1,Zs,!0)):[]})),zo=Yn((function(t,r){var n=Yo(r);return Zs(n)&&(n=e),Zs(t)?pn(t,wn(r,1,Zs,!0),uo(n,2)):[]})),qo=Yn((function(t,r){var n=Yo(r);return Zs(n)&&(n=e),Zs(t)?pn(t,wn(r,1,Zs,!0),e,n):[]}));function Ho(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ga(r);return i<0&&(i=wr(n+i,0)),Wt(e,uo(t,3),i)}function Vo(t,r,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==e&&(o=ga(n),o=n<0?wr(i+o,0):vr(o,i-1)),Wt(t,uo(r,3),o,!0)}function Ko(e){return null!=e&&e.length?wn(e,1):[]}function Go(t){return t&&t.length?t[0]:e}var Zo=Yn((function(e){var t=Nt(e,wi);return t.length&&t[0]===e[0]?Rn(t):[]})),Jo=Yn((function(t){var r=Yo(t),n=Nt(t,wi);return r===Yo(n)?r=e:n.pop(),n.length&&n[0]===t[0]?Rn(n,uo(r,2)):[]})),Qo=Yn((function(t){var r=Yo(t),n=Nt(t,wi);return(r="function"==typeof r?r:e)&&n.pop(),n.length&&n[0]===t[0]?Rn(n,e,r):[]}));function Yo(t){var r=null==t?0:t.length;return r?t[r-1]:e}var Xo=Yn(es);function es(e,t){return e&&e.length&&t&&t.length?Gn(e,t):e}var ts=io((function(e,t){var r=null==e?0:e.length,n=cn(e,t);return Zn(e,Nt(t,(function(e){return _o(e,r)?+e:e})).sort(ki)),n}));function rs(e){return null==e?e:Er.call(e)}var ns=Yn((function(e){return hi(wn(e,1,Zs,!0))})),is=Yn((function(t){var r=Yo(t);return Zs(r)&&(r=e),hi(wn(t,1,Zs,!0),uo(r,2))})),os=Yn((function(t){var r=Yo(t);return r="function"==typeof r?r:e,hi(wn(t,1,Zs,!0),e,r)}));function ss(e){if(!e||!e.length)return[];var t=0;return e=It(e,(function(e){if(Zs(e))return t=wr(e.length,t),!0})),Zt(t,(function(t){return Nt(e,Ht(t))}))}function as(t,r){if(!t||!t.length)return[];var n=ss(t);return null==r?n:Nt(n,(function(t){return St(r,e,t)}))}var cs=Yn((function(e,t){return Zs(e)?pn(e,t):[]})),ls=Yn((function(e){return bi(It(e,Zs))})),us=Yn((function(t){var r=Yo(t);return Zs(r)&&(r=e),bi(It(t,Zs),uo(r,2))})),ds=Yn((function(t){var r=Yo(t);return r="function"==typeof r?r:e,bi(It(t,Zs),e,r)})),hs=Yn(ss),ps=Yn((function(t){var r=t.length,n=r>1?t[r-1]:e;return n="function"==typeof n?(t.pop(),n):e,as(t,n)}));function fs(e){var t=jr(e);return t.__chain__=!0,t}function ms(e,t){return t(e)}var gs=io((function(t){var r=t.length,n=r?t[0]:0,i=this.__wrapped__,o=function(e){return cn(e,t)};return!(r>1||this.__actions__.length)&&i instanceof Hr&&_o(n)?((i=i.slice(n,+n+(r?1:0))).__actions__.push({func:ms,args:[o],thisArg:e}),new qr(i,this.__chain__).thru((function(t){return r&&!t.length&&t.push(e),t}))):this.thru(o)})),bs=Ni((function(e,t,r){Ue.call(e,r)?++e[r]:an(e,r,1)})),ys=Wi(Ho),ws=Wi(Vo);function vs(e,t){return(Vs(e)?At:fn)(e,uo(t,3))}function _s(e,t){return(Vs(e)?kt:mn)(e,uo(t,3))}var $s=Ni((function(e,t,r){Ue.call(e,r)?e[r].push(t):an(e,r,[t])})),Cs=Yn((function(e,t,r){var n=-1,i="function"==typeof t,o=Gs(e)?Ee(e.length):[];return fn(e,(function(e){o[++n]=i?St(t,e,r):Pn(e,t,r)})),o})),Es=Ni((function(e,t,r){an(e,r,t)}));function Ss(e,t){return(Vs(e)?Nt:jn)(e,uo(t,3))}var xs=Ni((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),As=Yn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&$o(e,t[0],t[1])?t=[]:r>2&&$o(t[0],t[1],t[2])&&(t=[t[0]]),Vn(e,wn(t,1),[])})),ks=mt||function(){return pt.Date.now()};function Ts(t,r,n){return r=n?e:r,r=t&&null==r?t.length:r,Xi(t,a,e,e,e,e,r)}function Is(r,n){var i;if("function"!=typeof n)throw new Pe(t);return r=ga(r),function(){return--r>0&&(i=n.apply(this,arguments)),r<=1&&(n=e),i}}var Rs=Yn((function(e,t,r){var n=1;if(r.length){var i=cr(r,lo(Rs));n|=o}return Xi(e,n,t,r,i)})),Ps=Yn((function(e,t,r){var n=3;if(r.length){var i=cr(r,lo(Ps));n|=o}return Xi(t,n,e,r,i)}));function Ns(r,n,i){var o,s,a,c,l,u,d=0,h=!1,p=!1,f=!0;if("function"!=typeof r)throw new Pe(t);function m(t){var n=o,i=s;return o=s=e,d=t,c=r.apply(i,n)}function g(t){var r=t-u;return u===e||r>=n||r<0||p&&t-d>=a}function b(){var e=ks();if(g(e))return y(e);l=No(b,function(e){var t=n-(e-u);return p?vr(t,a-(e-d)):t}(e))}function y(t){return l=e,f&&o?m(t):(o=s=e,c)}function w(){var t=ks(),r=g(t);if(o=arguments,s=this,u=t,r){if(l===e)return function(e){return d=e,l=No(b,n),h?m(e):c}(u);if(p)return Ei(l),l=No(b,n),m(u)}return l===e&&(l=No(b,n)),c}return n=ya(n)||0,ra(i)&&(h=!!i.leading,a=(p="maxWait"in i)?wr(ya(i.maxWait)||0,n):a,f="trailing"in i?!!i.trailing:f),w.cancel=function(){l!==e&&Ei(l),d=0,o=u=s=l=e},w.flush=function(){return l===e?c:y(ks())},w}var Ms=Yn((function(e,t){return hn(e,1,t)})),Bs=Yn((function(e,t,r){return hn(e,ya(t)||0,r)}));function Os(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new Pe(t);var n=function(){var t=arguments,i=r?r.apply(this,t):t[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,t);return n.cache=o.set(i,s)||o,s};return n.cache=new(Os.Cache||Gr),n}function Ls(e){if("function"!=typeof e)throw new Pe(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Os.Cache=Gr;var Us=$i((function(e,t){var r=(t=1==t.length&&Vs(t[0])?Nt(t[0],Qt(uo())):Nt(wn(t,1),Qt(uo()))).length;return Yn((function(n){for(var i=-1,o=vr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),Ds=Yn((function(t,r){var n=cr(r,lo(Ds));return Xi(t,o,e,r,n)})),Ws=Yn((function(t,r){var n=cr(r,lo(Ws));return Xi(t,s,e,r,n)})),js=io((function(t,r){return Xi(t,c,e,e,e,r)}));function Fs(e,t){return e===t||e!=e&&t!=t}var zs=Gi(kn),qs=Gi((function(e,t){return e>=t})),Hs=Nn(function(){return arguments}())?Nn:function(e){return na(e)&&Ue.call(e,"callee")&&!Qe.call(e,"callee")},Vs=Ee.isArray,Ks=wt?Qt(wt):function(e){return na(e)&&An(e)==P};function Gs(e){return null!=e&&ta(e.length)&&!Xs(e)}function Zs(e){return na(e)&&Gs(e)}var Js=mr||yc,Qs=vt?Qt(vt):function(e){return na(e)&&An(e)==w};function Ys(e){if(!na(e))return!1;var t=An(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sa(e)}function Xs(e){if(!ra(e))return!1;var t=An(e);return t==_||t==$||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ea(e){return"number"==typeof e&&e==ga(e)}function ta(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function ra(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function na(e){return null!=e&&"object"==typeof e}var ia=_t?Qt(_t):function(e){return na(e)&&bo(e)==C};function oa(e){return"number"==typeof e||na(e)&&An(e)==E}function sa(e){if(!na(e)||An(e)!=S)return!1;var t=Ze(e);if(null===t)return!0;var r=Ue.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Le.call(r)==Fe}var aa=$t?Qt($t):function(e){return na(e)&&An(e)==A},ca=Ct?Qt(Ct):function(e){return na(e)&&bo(e)==k};function la(e){return"string"==typeof e||!Vs(e)&&na(e)&&An(e)==T}function ua(e){return"symbol"==typeof e||na(e)&&An(e)==I}var da=Et?Qt(Et):function(e){return na(e)&&ta(e.length)&&!!st[An(e)]},ha=Gi(Wn),pa=Gi((function(e,t){return e<=t}));function fa(e){if(!e)return[];if(Gs(e))return la(e)?dr(e):Ri(e);if(ct&&e[ct])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[ct]());var t=bo(e);return(t==C?sr:t==k?lr:Fa)(e)}function ma(e){return e?(e=ya(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ga(e){var t=ma(e),r=t%1;return t==t?r?t-r:t:0}function ba(e){return e?ln(ga(e),0,h):0}function ya(e){if("number"==typeof e)return e;if(ua(e))return d;if(ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Jt(e);var r=me.test(e);return r||be.test(e)?ut(e.slice(2),r?2:8):fe.test(e)?d:+e}function wa(e){return Pi(e,Ma(e))}function va(e){return null==e?"":di(e)}var _a=Mi((function(e,t){if(xo(t)||Gs(t))Pi(t,Na(t),e);else for(var r in t)Ue.call(t,r)&&rn(e,r,t[r])})),$a=Mi((function(e,t){Pi(t,Ma(t),e)})),Ca=Mi((function(e,t,r,n){Pi(t,Ma(t),e,n)})),Ea=Mi((function(e,t,r,n){Pi(t,Na(t),e,n)})),Sa=io(cn),xa=Yn((function(t,r){t=Te(t);var n=-1,i=r.length,o=i>2?r[2]:e;for(o&&$o(r[0],r[1],o)&&(i=1);++n<i;)for(var s=r[n],a=Ma(s),c=-1,l=a.length;++c<l;){var u=a[c],d=t[u];(d===e||Fs(d,Be[u])&&!Ue.call(t,u))&&(t[u]=s[u])}return t})),Aa=Yn((function(t){return t.push(e,to),St(Oa,e,t)}));function ka(t,r,n){var i=null==t?e:Sn(t,r);return i===e?n:i}function Ta(e,t){return null!=e&&yo(e,t,In)}var Ia=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=r}),rc(oc)),Ra=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),Ue.call(e,t)?e[t].push(r):e[t]=[r]}),uo),Pa=Yn(Pn);function Na(e){return Gs(e)?Qr(e):Un(e)}function Ma(e){return Gs(e)?Qr(e,!0):Dn(e)}var Ba=Mi((function(e,t,r){qn(e,t,r)})),Oa=Mi((function(e,t,r,n){qn(e,t,r,n)})),La=io((function(e,t){var r={};if(null==e)return r;var n=!1;t=Nt(t,(function(t){return t=_i(t,e),n||(n=t.length>1),t})),Pi(e,so(e),r),n&&(r=un(r,7,ro));for(var i=t.length;i--;)pi(r,t[i]);return r})),Ua=io((function(e,t){return null==e?{}:function(e,t){return Kn(e,t,(function(t,r){return Ta(e,r)}))}(e,t)}));function Da(e,t){if(null==e)return{};var r=Nt(so(e),(function(e){return[e]}));return t=uo(t),Kn(e,r,(function(e,r){return t(e,r[0])}))}var Wa=Yi(Na),ja=Yi(Ma);function Fa(e){return null==e?[]:Yt(e,Na(e))}var za=Ui((function(e,t,r){return t=t.toLowerCase(),e+(r?qa(t):t)}));function qa(e){return Ya(va(e).toLowerCase())}function Ha(e){return(e=va(e))&&e.replace(we,rr).replace(Xe,"")}var Va=Ui((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Ka=Ui((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ga=Li("toLowerCase"),Za=Ui((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Ja=Ui((function(e,t,r){return e+(r?" ":"")+Ya(t)})),Qa=Ui((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ya=Li("toUpperCase");function Xa(t,r,n){return t=va(t),(r=n?e:r)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(tt)||[]}(t):function(e){return e.match(le)||[]}(t):t.match(r)||[]}var ec=Yn((function(t,r){try{return St(t,e,r)}catch(n){return Ys(n)?n:new xe(n)}})),tc=io((function(e,t){return At(t,(function(t){t=Do(t),an(e,t,Rs(e[t],e))})),e}));function rc(e){return function(){return e}}var nc=ji(),ic=ji(!0);function oc(e){return e}function sc(e){return Ln("function"==typeof e?e:un(e,1))}var ac=Yn((function(e,t){return function(r){return Pn(r,e,t)}})),cc=Yn((function(e,t){return function(r){return Pn(e,r,t)}}));function lc(e,t,r){var n=Na(t),i=En(t,n);null==r&&(!ra(t)||!i.length&&n.length)&&(r=t,t=e,e=this,i=En(t,Na(t)));var o=!(ra(r)&&"chain"in r&&!r.chain),s=Xs(e);return At(i,(function(r){var n=t[r];e[r]=n,s&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ri(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Mt([this.value()],arguments))})})),e}function uc(){}var dc=Hi(Nt),hc=Hi(Tt),pc=Hi(Lt);function fc(e){return Co(e)?Ht(Do(e)):function(e){return function(t){return Sn(t,e)}}(e)}var mc=Ki(),gc=Ki(!0);function bc(){return[]}function yc(){return!1}var wc=qi((function(e,t){return e+t}),0),vc=Ji("ceil"),_c=qi((function(e,t){return e/t}),1),$c=Ji("floor"),Cc=qi((function(e,t){return e*t}),1),Ec=Ji("round"),Sc=qi((function(e,t){return e-t}),0);return jr.after=function(e,r){if("function"!=typeof r)throw new Pe(t);return e=ga(e),function(){if(--e<1)return r.apply(this,arguments)}},jr.ary=Ts,jr.assign=_a,jr.assignIn=$a,jr.assignInWith=Ca,jr.assignWith=Ea,jr.at=Sa,jr.before=Is,jr.bind=Rs,jr.bindAll=tc,jr.bindKey=Ps,jr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Vs(e)?e:[e]},jr.chain=fs,jr.chunk=function(t,r,n){r=(n?$o(t,r,n):r===e)?1:wr(ga(r),0);var i=null==t?0:t.length;if(!i||r<1)return[];for(var o=0,s=0,a=Ee(yt(i/r));o<i;)a[s++]=oi(t,o,o+=r);return a},jr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},jr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Ee(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Mt(Vs(r)?Ri(r):[r],wn(t,1))},jr.cond=function(e){var r=null==e?0:e.length,n=uo();return e=r?Nt(e,(function(e){if("function"!=typeof e[1])throw new Pe(t);return[n(e[0]),e[1]]})):[],Yn((function(t){for(var n=-1;++n<r;){var i=e[n];if(St(i[0],this,t))return St(i[1],this,t)}}))},jr.conforms=function(e){return function(e){var t=Na(e);return function(r){return dn(r,e,t)}}(un(e,1))},jr.constant=rc,jr.countBy=bs,jr.create=function(e,t){var r=Fr(e);return null==t?r:sn(r,t)},jr.curry=function t(r,n,i){var o=Xi(r,8,e,e,e,e,e,n=i?e:n);return o.placeholder=t.placeholder,o},jr.curryRight=function t(r,n,o){var s=Xi(r,i,e,e,e,e,e,n=o?e:n);return s.placeholder=t.placeholder,s},jr.debounce=Ns,jr.defaults=xa,jr.defaultsDeep=Aa,jr.defer=Ms,jr.delay=Bs,jr.difference=Fo,jr.differenceBy=zo,jr.differenceWith=qo,jr.drop=function(t,r,n){var i=null==t?0:t.length;return i?oi(t,(r=n||r===e?1:ga(r))<0?0:r,i):[]},jr.dropRight=function(t,r,n){var i=null==t?0:t.length;return i?oi(t,0,(r=i-(r=n||r===e?1:ga(r)))<0?0:r):[]},jr.dropRightWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!0,!0):[]},jr.dropWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!0):[]},jr.fill=function(t,r,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&$o(t,r,n)&&(n=0,i=o),function(t,r,n,i){var o=t.length;for((n=ga(n))<0&&(n=-n>o?0:o+n),(i=i===e||i>o?o:ga(i))<0&&(i+=o),i=n>i?0:ba(i);n<i;)t[n++]=r;return t}(t,r,n,i)):[]},jr.filter=function(e,t){return(Vs(e)?It:yn)(e,uo(t,3))},jr.flatMap=function(e,t){return wn(Ss(e,t),1)},jr.flatMapDeep=function(e,t){return wn(Ss(e,t),l)},jr.flatMapDepth=function(t,r,n){return n=n===e?1:ga(n),wn(Ss(t,r),n)},jr.flatten=Ko,jr.flattenDeep=function(e){return null!=e&&e.length?wn(e,l):[]},jr.flattenDepth=function(t,r){return null!=t&&t.length?wn(t,r=r===e?1:ga(r)):[]},jr.flip=function(e){return Xi(e,512)},jr.flow=nc,jr.flowRight=ic,jr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},jr.functions=function(e){return null==e?[]:En(e,Na(e))},jr.functionsIn=function(e){return null==e?[]:En(e,Ma(e))},jr.groupBy=$s,jr.initial=function(e){return null!=e&&e.length?oi(e,0,-1):[]},jr.intersection=Zo,jr.intersectionBy=Jo,jr.intersectionWith=Qo,jr.invert=Ia,jr.invertBy=Ra,jr.invokeMap=Cs,jr.iteratee=sc,jr.keyBy=Es,jr.keys=Na,jr.keysIn=Ma,jr.map=Ss,jr.mapKeys=function(e,t){var r={};return t=uo(t,3),$n(e,(function(e,n,i){an(r,t(e,n,i),e)})),r},jr.mapValues=function(e,t){var r={};return t=uo(t,3),$n(e,(function(e,n,i){an(r,n,t(e,n,i))})),r},jr.matches=function(e){return Fn(un(e,1))},jr.matchesProperty=function(e,t){return zn(e,un(t,1))},jr.memoize=Os,jr.merge=Ba,jr.mergeWith=Oa,jr.method=ac,jr.methodOf=cc,jr.mixin=lc,jr.negate=Ls,jr.nthArg=function(e){return e=ga(e),Yn((function(t){return Hn(t,e)}))},jr.omit=La,jr.omitBy=function(e,t){return Da(e,Ls(uo(t)))},jr.once=function(e){return Is(2,e)},jr.orderBy=function(t,r,n,i){return null==t?[]:(Vs(r)||(r=null==r?[]:[r]),Vs(n=i?e:n)||(n=null==n?[]:[n]),Vn(t,r,n))},jr.over=dc,jr.overArgs=Us,jr.overEvery=hc,jr.overSome=pc,jr.partial=Ds,jr.partialRight=Ws,jr.partition=xs,jr.pick=Ua,jr.pickBy=Da,jr.property=fc,jr.propertyOf=function(t){return function(r){return null==t?e:Sn(t,r)}},jr.pull=Xo,jr.pullAll=es,jr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,uo(r,2)):e},jr.pullAllWith=function(t,r,n){return t&&t.length&&r&&r.length?Gn(t,r,e,n):t},jr.pullAt=ts,jr.range=mc,jr.rangeRight=gc,jr.rearg=js,jr.reject=function(e,t){return(Vs(e)?It:yn)(e,Ls(uo(t,3)))},jr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=uo(t,3);++n<o;){var s=e[n];t(s,n,e)&&(r.push(s),i.push(n))}return Zn(e,i),r},jr.rest=function(r,n){if("function"!=typeof r)throw new Pe(t);return Yn(r,n=n===e?n:ga(n))},jr.reverse=rs,jr.sampleSize=function(t,r,n){return r=(n?$o(t,r,n):r===e)?1:ga(r),(Vs(t)?Xr:ei)(t,r)},jr.set=function(e,t,r){return null==e?e:ti(e,t,r)},jr.setWith=function(t,r,n,i){return i="function"==typeof i?i:e,null==t?t:ti(t,r,n,i)},jr.shuffle=function(e){return(Vs(e)?en:ii)(e)},jr.slice=function(t,r,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&$o(t,r,n)?(r=0,n=i):(r=null==r?0:ga(r),n=n===e?i:ga(n)),oi(t,r,n)):[]},jr.sortBy=As,jr.sortedUniq=function(e){return e&&e.length?li(e):[]},jr.sortedUniqBy=function(e,t){return e&&e.length?li(e,uo(t,2)):[]},jr.split=function(t,r,n){return n&&"number"!=typeof n&&$o(t,r,n)&&(r=n=e),(n=n===e?h:n>>>0)?(t=va(t))&&("string"==typeof r||null!=r&&!aa(r))&&!(r=di(r))&&or(t)?Ci(dr(t),0,n):t.split(r,n):[]},jr.spread=function(e,r){if("function"!=typeof e)throw new Pe(t);return r=null==r?0:wr(ga(r),0),Yn((function(t){var n=t[r],i=Ci(t,0,r);return n&&Mt(i,n),St(e,this,i)}))},jr.tail=function(e){var t=null==e?0:e.length;return t?oi(e,1,t):[]},jr.take=function(t,r,n){return t&&t.length?oi(t,0,(r=n||r===e?1:ga(r))<0?0:r):[]},jr.takeRight=function(t,r,n){var i=null==t?0:t.length;return i?oi(t,(r=i-(r=n||r===e?1:ga(r)))<0?0:r,i):[]},jr.takeRightWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!1,!0):[]},jr.takeWhile=function(e,t){return e&&e.length?mi(e,uo(t,3)):[]},jr.tap=function(e,t){return t(e),e},jr.throttle=function(e,r,n){var i=!0,o=!0;if("function"!=typeof e)throw new Pe(t);return ra(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Ns(e,r,{leading:i,maxWait:r,trailing:o})},jr.thru=ms,jr.toArray=fa,jr.toPairs=Wa,jr.toPairsIn=ja,jr.toPath=function(e){return Vs(e)?Nt(e,Do):ua(e)?[e]:Ri(Uo(va(e)))},jr.toPlainObject=wa,jr.transform=function(e,t,r){var n=Vs(e),i=n||Js(e)||da(e);if(t=uo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:ra(e)&&Xs(o)?Fr(Ze(e)):{}}return(i?At:$n)(e,(function(e,n,i){return t(r,e,n,i)})),r},jr.unary=function(e){return Ts(e,1)},jr.union=ns,jr.unionBy=is,jr.unionWith=os,jr.uniq=function(e){return e&&e.length?hi(e):[]},jr.uniqBy=function(e,t){return e&&e.length?hi(e,uo(t,2)):[]},jr.uniqWith=function(t,r){return r="function"==typeof r?r:e,t&&t.length?hi(t,e,r):[]},jr.unset=function(e,t){return null==e||pi(e,t)},jr.unzip=ss,jr.unzipWith=as,jr.update=function(e,t,r){return null==e?e:fi(e,t,vi(r))},jr.updateWith=function(t,r,n,i){return i="function"==typeof i?i:e,null==t?t:fi(t,r,vi(n),i)},jr.values=Fa,jr.valuesIn=function(e){return null==e?[]:Yt(e,Ma(e))},jr.without=cs,jr.words=Xa,jr.wrap=function(e,t){return Ds(vi(t),e)},jr.xor=ls,jr.xorBy=us,jr.xorWith=ds,jr.zip=hs,jr.zipObject=function(e,t){return yi(e||[],t||[],rn)},jr.zipObjectDeep=function(e,t){return yi(e||[],t||[],ti)},jr.zipWith=ps,jr.entries=Wa,jr.entriesIn=ja,jr.extend=$a,jr.extendWith=Ca,lc(jr,jr),jr.add=wc,jr.attempt=ec,jr.camelCase=za,jr.capitalize=qa,jr.ceil=vc,jr.clamp=function(t,r,n){return n===e&&(n=r,r=e),n!==e&&(n=(n=ya(n))==n?n:0),r!==e&&(r=(r=ya(r))==r?r:0),ln(ya(t),r,n)},jr.clone=function(e){return un(e,4)},jr.cloneDeep=function(e){return un(e,5)},jr.cloneDeepWith=function(t,r){return un(t,5,r="function"==typeof r?r:e)},jr.cloneWith=function(t,r){return un(t,4,r="function"==typeof r?r:e)},jr.conformsTo=function(e,t){return null==t||dn(e,t,Na(t))},jr.deburr=Ha,jr.defaultTo=function(e,t){return null==e||e!=e?t:e},jr.divide=_c,jr.endsWith=function(t,r,n){t=va(t),r=di(r);var i=t.length,o=n=n===e?i:ln(ga(n),0,i);return(n-=r.length)>=0&&t.slice(n,o)==r},jr.eq=Fs,jr.escape=function(e){return(e=va(e))&&Z.test(e)?e.replace(K,nr):e},jr.escapeRegExp=function(e){return(e=va(e))&&ne.test(e)?e.replace(re,"\\$&"):e},jr.every=function(t,r,n){var i=Vs(t)?Tt:gn;return n&&$o(t,r,n)&&(r=e),i(t,uo(r,3))},jr.find=ys,jr.findIndex=Ho,jr.findKey=function(e,t){return Dt(e,uo(t,3),$n)},jr.findLast=ws,jr.findLastIndex=Vo,jr.findLastKey=function(e,t){return Dt(e,uo(t,3),Cn)},jr.floor=$c,jr.forEach=vs,jr.forEachRight=_s,jr.forIn=function(e,t){return null==e?e:vn(e,uo(t,3),Ma)},jr.forInRight=function(e,t){return null==e?e:_n(e,uo(t,3),Ma)},jr.forOwn=function(e,t){return e&&$n(e,uo(t,3))},jr.forOwnRight=function(e,t){return e&&Cn(e,uo(t,3))},jr.get=ka,jr.gt=zs,jr.gte=qs,jr.has=function(e,t){return null!=e&&yo(e,t,Tn)},jr.hasIn=Ta,jr.head=Go,jr.identity=oc,jr.includes=function(e,t,r,n){e=Gs(e)?e:Fa(e),r=r&&!n?ga(r):0;var i=e.length;return r<0&&(r=wr(i+r,0)),la(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&jt(e,t,r)>-1},jr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ga(r);return i<0&&(i=wr(n+i,0)),jt(e,t,i)},jr.inRange=function(t,r,n){return r=ma(r),n===e?(n=r,r=0):n=ma(n),function(e,t,r){return e>=vr(t,r)&&e<wr(t,r)}(t=ya(t),r,n)},jr.invoke=Pa,jr.isArguments=Hs,jr.isArray=Vs,jr.isArrayBuffer=Ks,jr.isArrayLike=Gs,jr.isArrayLikeObject=Zs,jr.isBoolean=function(e){return!0===e||!1===e||na(e)&&An(e)==y},jr.isBuffer=Js,jr.isDate=Qs,jr.isElement=function(e){return na(e)&&1===e.nodeType&&!sa(e)},jr.isEmpty=function(e){if(null==e)return!0;if(Gs(e)&&(Vs(e)||"string"==typeof e||"function"==typeof e.splice||Js(e)||da(e)||Hs(e)))return!e.length;var t=bo(e);if(t==C||t==k)return!e.size;if(xo(e))return!Un(e).length;for(var r in e)if(Ue.call(e,r))return!1;return!0},jr.isEqual=function(e,t){return Mn(e,t)},jr.isEqualWith=function(t,r,n){var i=(n="function"==typeof n?n:e)?n(t,r):e;return i===e?Mn(t,r,e,n):!!i},jr.isError=Ys,jr.isFinite=function(e){return"number"==typeof e&&gr(e)},jr.isFunction=Xs,jr.isInteger=ea,jr.isLength=ta,jr.isMap=ia,jr.isMatch=function(e,t){return e===t||Bn(e,t,po(t))},jr.isMatchWith=function(t,r,n){return n="function"==typeof n?n:e,Bn(t,r,po(r),n)},jr.isNaN=function(e){return oa(e)&&e!=+e},jr.isNative=function(e){if(So(e))throw new xe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return On(e)},jr.isNil=function(e){return null==e},jr.isNull=function(e){return null===e},jr.isNumber=oa,jr.isObject=ra,jr.isObjectLike=na,jr.isPlainObject=sa,jr.isRegExp=aa,jr.isSafeInteger=function(e){return ea(e)&&e>=-u&&e<=u},jr.isSet=ca,jr.isString=la,jr.isSymbol=ua,jr.isTypedArray=da,jr.isUndefined=function(t){return t===e},jr.isWeakMap=function(e){return na(e)&&bo(e)==R},jr.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==An(e)},jr.join=function(e,t){return null==e?"":br.call(e,t)},jr.kebabCase=Va,jr.last=Yo,jr.lastIndexOf=function(t,r,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==e&&(o=(o=ga(n))<0?wr(i+o,0):vr(o,i-1)),r==r?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(t,r,o):Wt(t,zt,o,!0)},jr.lowerCase=Ka,jr.lowerFirst=Ga,jr.lt=ha,jr.lte=pa,jr.max=function(t){return t&&t.length?bn(t,oc,kn):e},jr.maxBy=function(t,r){return t&&t.length?bn(t,uo(r,2),kn):e},jr.mean=function(e){return qt(e,oc)},jr.meanBy=function(e,t){return qt(e,uo(t,2))},jr.min=function(t){return t&&t.length?bn(t,oc,Wn):e},jr.minBy=function(t,r){return t&&t.length?bn(t,uo(r,2),Wn):e},jr.stubArray=bc,jr.stubFalse=yc,jr.stubObject=function(){return{}},jr.stubString=function(){return""},jr.stubTrue=function(){return!0},jr.multiply=Cc,jr.nth=function(t,r){return t&&t.length?Hn(t,ga(r)):e},jr.noConflict=function(){return pt._===this&&(pt._=ze),this},jr.noop=uc,jr.now=ks,jr.pad=function(e,t,r){e=va(e);var n=(t=ga(t))?ur(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Vi(Ut(i),r)+e+Vi(yt(i),r)},jr.padEnd=function(e,t,r){e=va(e);var n=(t=ga(t))?ur(e):0;return t&&n<t?e+Vi(t-n,r):e},jr.padStart=function(e,t,r){e=va(e);var n=(t=ga(t))?ur(e):0;return t&&n<t?Vi(t-n,r)+e:e},jr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),$r(va(e).replace(ie,""),t||0)},jr.random=function(t,r,n){if(n&&"boolean"!=typeof n&&$o(t,r,n)&&(r=n=e),n===e&&("boolean"==typeof r?(n=r,r=e):"boolean"==typeof t&&(n=t,t=e)),t===e&&r===e?(t=0,r=1):(t=ma(t),r===e?(r=t,t=0):r=ma(r)),t>r){var i=t;t=r,r=i}if(n||t%1||r%1){var o=Cr();return vr(t+o*(r-t+lt("1e-"+((o+"").length-1))),r)}return Jn(t,r)},jr.reduce=function(e,t,r){var n=Vs(e)?Bt:Kt,i=arguments.length<3;return n(e,uo(t,4),r,i,fn)},jr.reduceRight=function(e,t,r){var n=Vs(e)?Ot:Kt,i=arguments.length<3;return n(e,uo(t,4),r,i,mn)},jr.repeat=function(t,r,n){return r=(n?$o(t,r,n):r===e)?1:ga(r),Qn(va(t),r)},jr.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},jr.result=function(t,r,n){var i=-1,o=(r=_i(r,t)).length;for(o||(o=1,t=e);++i<o;){var s=null==t?e:t[Do(r[i])];s===e&&(i=o,s=n),t=Xs(s)?s.call(t):s}return t},jr.round=Ec,jr.runInContext=oe,jr.sample=function(e){return(Vs(e)?Yr:Xn)(e)},jr.size=function(e){if(null==e)return 0;if(Gs(e))return la(e)?ur(e):e.length;var t=bo(e);return t==C||t==k?e.size:Un(e).length},jr.snakeCase=Za,jr.some=function(t,r,n){var i=Vs(t)?Lt:si;return n&&$o(t,r,n)&&(r=e),i(t,uo(r,3))},jr.sortedIndex=function(e,t){return ai(e,t)},jr.sortedIndexBy=function(e,t,r){return ci(e,t,uo(r,2))},jr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ai(e,t);if(n<r&&Fs(e[n],t))return n}return-1},jr.sortedLastIndex=function(e,t){return ai(e,t,!0)},jr.sortedLastIndexBy=function(e,t,r){return ci(e,t,uo(r,2),!0)},jr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ai(e,t,!0)-1;if(Fs(e[r],t))return r}return-1},jr.startCase=Ja,jr.startsWith=function(e,t,r){return e=va(e),r=null==r?0:ln(ga(r),0,e.length),t=di(t),e.slice(r,r+t.length)==t},jr.subtract=Sc,jr.sum=function(e){return e&&e.length?Gt(e,oc):0},jr.sumBy=function(e,t){return e&&e.length?Gt(e,uo(t,2)):0},jr.template=function(t,r,n){var i=jr.templateSettings;n&&$o(t,r,n)&&(r=e),t=va(t),r=Ca({},r,i,eo);var o,s,a=Ca({},r.imports,i.imports,eo),c=Na(a),l=Yt(a,c),u=0,d=r.interpolate||ve,h="__p += '",p=Ie((r.escape||ve).source+"|"+d.source+"|"+(d===Y?he:ve).source+"|"+(r.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(Ue.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";t.replace(p,(function(e,r,n,i,a,c){return n||(n=i),h+=t.slice(u,c).replace(_e,ir),r&&(o=!0,h+="' +\n__e("+r+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),h+="';\n";var m=Ue.call(r,"variable")&&r.variable;if(m){if(ue.test(m))throw new xe("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(z,""):h).replace(q,"$1").replace(H,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=ec((function(){return Ae(c,f+"return "+h).apply(e,l)}));if(g.source=h,Ys(g))throw g;return g},jr.times=function(e,t){if((e=ga(e))<1||e>u)return[];var r=h,n=vr(e,h);t=uo(t),e-=h;for(var i=Zt(n,t);++r<e;)t(r);return i},jr.toFinite=ma,jr.toInteger=ga,jr.toLength=ba,jr.toLower=function(e){return va(e).toLowerCase()},jr.toNumber=ya,jr.toSafeInteger=function(e){return e?ln(ga(e),-u,u):0===e?e:0},jr.toString=va,jr.toUpper=function(e){return va(e).toUpperCase()},jr.trim=function(t,r,n){if((t=va(t))&&(n||r===e))return Jt(t);if(!t||!(r=di(r)))return t;var i=dr(t),o=dr(r);return Ci(i,er(i,o),tr(i,o)+1).join("")},jr.trimEnd=function(t,r,n){if((t=va(t))&&(n||r===e))return t.slice(0,hr(t)+1);if(!t||!(r=di(r)))return t;var i=dr(t);return Ci(i,0,tr(i,dr(r))+1).join("")},jr.trimStart=function(t,r,n){if((t=va(t))&&(n||r===e))return t.replace(ie,"");if(!t||!(r=di(r)))return t;var i=dr(t);return Ci(i,er(i,dr(r))).join("")},jr.truncate=function(t,r){var n=30,i="...";if(ra(r)){var o="separator"in r?r.separator:o;n="length"in r?ga(r.length):n,i="omission"in r?di(r.omission):i}var s=(t=va(t)).length;if(or(t)){var a=dr(t);s=a.length}if(n>=s)return t;var c=n-ur(i);if(c<1)return i;var l=a?Ci(a,0,c).join(""):t.slice(0,c);if(o===e)return l+i;if(a&&(c+=l.length-c),aa(o)){if(t.slice(c).search(o)){var u,d=l;for(o.global||(o=Ie(o.source,va(pe.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;l=l.slice(0,h===e?c:h)}}else if(t.indexOf(di(o),c)!=c){var p=l.lastIndexOf(o);p>-1&&(l=l.slice(0,p))}return l+i},jr.unescape=function(e){return(e=va(e))&&G.test(e)?e.replace(V,pr):e},jr.uniqueId=function(e){var t=++De;return va(e)+t},jr.upperCase=Qa,jr.upperFirst=Ya,jr.each=vs,jr.eachRight=_s,jr.first=Go,lc(jr,function(){var e={};return $n(jr,(function(t,r){Ue.call(jr.prototype,r)||(e[r]=t)})),e}(),{chain:!1}),jr.VERSION="4.17.21",At(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){jr[e].placeholder=jr})),At(["drop","take"],(function(t,r){Hr.prototype[t]=function(n){n=n===e?1:wr(ga(n),0);var i=this.__filtered__&&!r?new Hr(this):this.clone();return i.__filtered__?i.__takeCount__=vr(n,i.__takeCount__):i.__views__.push({size:vr(n,h),type:t+(i.__dir__<0?"Right":"")}),i},Hr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),At(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Hr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),At(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Hr.prototype[e]=function(){return this[r](1).value()[0]}})),At(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Hr.prototype[e]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(oc)},Hr.prototype.find=function(e){return this.filter(e).head()},Hr.prototype.findLast=function(e){return this.reverse().find(e)},Hr.prototype.invokeMap=Yn((function(e,t){return"function"==typeof e?new Hr(this):this.map((function(r){return Pn(r,e,t)}))})),Hr.prototype.reject=function(e){return this.filter(Ls(uo(e)))},Hr.prototype.slice=function(t,r){t=ga(t);var n=this;return n.__filtered__&&(t>0||r<0)?new Hr(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),r!==e&&(n=(r=ga(r))<0?n.dropRight(-r):n.take(r-t)),n)},Hr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hr.prototype.toArray=function(){return this.take(h)},$n(Hr.prototype,(function(t,r){var n=/^(?:filter|find|map|reject)|While$/.test(r),i=/^(?:head|last)$/.test(r),o=jr[i?"take"+("last"==r?"Right":""):r],s=i||/^find/.test(r);o&&(jr.prototype[r]=function(){var r=this.__wrapped__,a=i?[1]:arguments,c=r instanceof Hr,l=a[0],u=c||Vs(r),d=function(e){var t=o.apply(jr,Mt([e],a));return i&&h?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(c=u=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,m=c&&!p;if(!s&&u){r=m?r:new Hr(this);var g=t.apply(r,a);return g.__actions__.push({func:ms,args:[d],thisArg:e}),new qr(g,h)}return f&&m?t.apply(this,a):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})})),At(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ne[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);jr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Vs(i)?i:[],e)}return this[r]((function(r){return t.apply(Vs(r)?r:[],e)}))}})),$n(Hr.prototype,(function(e,t){var r=jr[t];if(r){var n=r.name+"";Ue.call(Pr,n)||(Pr[n]=[]),Pr[n].push({name:t,func:r})}})),Pr[Fi(e,2).name]=[{name:"wrapper",func:e}],Hr.prototype.clone=function(){var e=new Hr(this.__wrapped__);return e.__actions__=Ri(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ri(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ri(this.__views__),e},Hr.prototype.reverse=function(){if(this.__filtered__){var e=new Hr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Vs(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=vr(t,e+s);break;case"takeRight":e=wr(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,l=n?a:s-1,u=this.__iteratees__,d=u.length,h=0,p=vr(c,this.__takeCount__);if(!r||!n&&i==c&&p==c)return gi(e,this.__actions__);var f=[];e:for(;c--&&h<p;){for(var m=-1,g=e[l+=t];++m<d;){var b=u[m],y=b.iteratee,w=b.type,v=y(g);if(2==w)g=v;else if(!v){if(1==w)continue e;break e}}f[h++]=g}return f},jr.prototype.at=gs,jr.prototype.chain=function(){return fs(this)},jr.prototype.commit=function(){return new qr(this.value(),this.__chain__)},jr.prototype.next=function(){this.__values__===e&&(this.__values__=fa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},jr.prototype.plant=function(t){for(var r,n=this;n instanceof zr;){var i=jo(n);i.__index__=0,i.__values__=e,r?o.__wrapped__=i:r=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,r},jr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hr){var r=t;return this.__actions__.length&&(r=new Hr(this)),(r=r.reverse()).__actions__.push({func:ms,args:[rs],thisArg:e}),new qr(r,this.__chain__)}return this.thru(rs)},jr.prototype.toJSON=jr.prototype.valueOf=jr.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},jr.prototype.first=jr.prototype.head,ct&&(jr.prototype[ct]=function(){return this}),jr}();mt?((mt.exports=fr)._=fr,ft._=fr):pt._=fr}.call(_n);var Vg=Object.defineProperty,kg=Object.defineProperties,jg=Object.getOwnPropertyDescriptors,Ra=Object.getOwnPropertySymbols,tv=Object.prototype.hasOwnProperty,ev=Object.prototype.propertyIsEnumerable,ba=(e,t,r)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lr=(e,t)=>{for(var r in t||(t={}))tv.call(t,r)&&ba(e,r,t[r]);if(Ra)for(var r of Ra(t))ev.call(t,r)&&ba(e,r,t[r]);return e},nv=(e,t)=>kg(e,jg(t));function Lt(e,t,r){var n;const i=An(e);return(null==(n=t.rpcMap)?void 0:n[i.reference])||`${Oa}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Ae(e){return e.includes(":")?e.split(":")[1]:e}function Ta(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function rv(e,t){const r=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!r.length)return[];const n=[];return r.forEach((e=>{const r=t.namespaces[e].accounts;n.push(...r)})),n}function Fi(e={},t={}){const r=La(e),n=La(t);return qi.exports.merge(r,n)}function La(e){var t,r,n,i;const o={};if(!Xr$1(e))return o;for(const[s,a]of Object.entries(e)){const e=on$3(s)?[s]:a.chains,c=a.methods||[],l=a.events||[],u=a.rpcMap||{},d=xo(s);o[d]=nv(lr(lr({},o[d]),a),{chains:me$1(e,null==(t=o[d])?void 0:t.chains),methods:me$1(c,null==(r=o[d])?void 0:r.methods),events:me$1(l,null==(n=o[d])?void 0:n.events),rpcMap:lr(lr({},u),null==(i=o[d])?void 0:i.rpcMap)})}return o}function iv(e){return e.includes(":")?e.split(":")[2]:e}function Ha(e){const t={};for(const[r,n]of Object.entries(e)){const e=n.methods||[],i=n.events||[],o=n.accounts||[],s=on$3(r)?[r]:n.chains?n.chains:Ta(n.accounts);t[r]={chains:s,methods:e,events:i,accounts:o}}return t}function Wi(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const Da={},F$2=e=>Da[e],Mi=(e,t)=>{Da[e]=t};class sv{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Na=Object.getOwnPropertySymbols,cv=Object.prototype.hasOwnProperty,fv=Object.prototype.propertyIsEnumerable,$a=(e,t,r)=>t in e?uv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ua=(e,t)=>{for(var r in t||(t={}))cv.call(t,r)&&$a(e,r,t[r]);if(Na)for(var r of Na(t))fv.call(t,r)&&$a(e,r,t[r]);return e},qa=(e,t)=>av(e,ov(t));class hv{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const r=t||Lt(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=parseInt(Ae(t));e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let n=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const i=parseInt(n,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,n;const i=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!i)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),s=(null==(n=null==o?void 0:o.sessionProperties)?void 0:n.capabilities)||{};if(null!=s&&s[i])return null==s?void 0:s[i];const a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:qa(Ua({},o.sessionProperties||{}),{capabilities:qa(Ua({},s||{}),{[i]:a})})})}catch(c){console.warn("Failed to update session with capabilities",c)}return a}async getCallStatus(e){var t,r;const n=this.client.session.get(e.topic),i=null==(t=n.sessionProperties)?void 0:t.bundler_name;if(i){const t=this.getBundlerUrl(e.chainId,i);try{return await this.getUserOperationReceipt(t,e)}catch(s){console.warn("Failed to fetch call status from bundler",s,t)}}const o=null==(r=n.sessionProperties)?void 0:r.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var r;const n=new URL(e),i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(formatJsonRpcRequest("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(e,t){return`${Qg}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class lv{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class pv{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class dv{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const r=t||Lt(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new o$3(new f$3(r,F$2("disableProviderPing")))}}class gv{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const r=this.getCardanoRPCUrl(t),n=Ae(t);e[n]=this.createHttpProvider(n,r)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||this.getCardanoRPCUrl(e);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class vv{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class _v{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class mv{constructor(e){this.name="near",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const r=t||Lt(`${this.name}:${e}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace);return typeof r>"u"?void 0:new o$3(new f$3(r,F$2("disableProviderPing")))}}class wv{constructor(e){this.name=ze,this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){var e,t;const r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach((e=>{const t=An(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)})),r}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}var Pv=Object.defineProperty,Cv=Object.defineProperties,Av=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertySymbols,Iv=Object.prototype.hasOwnProperty,xv=Object.prototype.propertyIsEnumerable,Wa=(e,t,r)=>t in e?Pv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pr=(e,t)=>{for(var r in t||(t={}))Iv.call(t,r)&&Wa(e,r,t[r]);if(Fa)for(var r of Fa(t))xv.call(t,r)&&Wa(e,r,t[r]);return e},Bi=(e,t)=>Cv(e,Av(t));class dr{constructor(e){this.events=new Jg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:Mg(k$4({level:(null==e?void 0:e.logger)||ya})),this.disableProviderPing=(null==e?void 0:e.disableProviderPing)||!1}static async init(e){const t=new dr(e);return await t.initialize(),t}async request(e,t,r){const[n,i]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:pr({},e),chainId:`${n}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,n){const i=(new Date).getTime();this.request(e,r,n).then((e=>t(null,formatJsonRpcResult(i,e)))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:er$1("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:r,response:n}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();if(this.session=i.session,this.session){const e=Ha(this.session.namespaces);this.namespaces=Fi(this.namespaces,e),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:r,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});r&&(this.uri=r,this.events.emit("display_uri",r)),await n().then((e=>{this.session=e;const t=Ha(e.namespaces);this.namespaces=Fi(this.namespaces,t),this.persist("namespaces",this.namespaces)})).catch((e=>{if(e.message!==it)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[r,n]=this.validateChain(e),i=this.getProvider(r);i.name===ze?i.setDefaultChain(`${r}:${n}`,t):i.setDefaultChain(n,t)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Nr$1(t)){for(const r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await _e.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ya,relayUrl:this.providerOpts.relayUrl||Yg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>xo(e))))];Mi("client",this.client),Mi("events",this.events),Mi("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=rv(e,this.session),r=Ta(t),n=Fi(this.namespaces,this.optionalNamespaces),i=Bi(pr({},n[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new hv({namespace:i});break;case"algorand":this.rpcProviders[e]=new dv({namespace:i});break;case"solana":this.rpcProviders[e]=new lv({namespace:i});break;case"cosmos":this.rpcProviders[e]=new pv({namespace:i});break;case"polkadot":this.rpcProviders[e]=new sv({namespace:i});break;case"cip34":this.rpcProviders[e]=new gv({namespace:i});break;case"elrond":this.rpcProviders[e]=new vv({namespace:i});break;case"multiversx":this.rpcProviders[e]=new _v({namespace:i});break;case"near":this.rpcProviders[e]=new mv({namespace:i});break;default:this.rpcProviders[ze]?this.rpcProviders[ze].updateNamespace(i):this.rpcProviders[ze]=new wv({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:r}=t;if("accountsChanged"===r.name){const e=r.data;e&&Nr$1(e)&&this.events.emit("accountsChanged",e.map(iv))}else if("chainChanged"===r.name){const e=t.chainId,r=t.event.data,n=xo(e),i=Wi(e)!==Wi(r)?`${n}:${Wi(r)}`:e;this.onChainChanged(i)}else this.events.emit(r.name,r.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var r;const{namespaces:n}=t,i=null==(r=this.client)?void 0:r.session.get(e);this.session=Bi(pr({},i),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Bi(pr({},er$1("USER_DISCONNECTED")),{data:e.topic}))})),this.on(Tt.DEFAULT_CHAIN_CHANGED,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[ze]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:r,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",r)}validateChain(e){const[t,r]=(null==e?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map((e=>xo(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];const n=xo(Object.keys(this.namespaces)[0]);return[n,this.rpcProviders[n].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[r,n]=this.validateChain(e);n&&(t||this.getProvider(r).setDefaultChain(n),this.namespaces[r]?this.namespaces[r].defaultChain=n:this.namespaces[`${r}:${n}`]?this.namespaces[`${r}:${n}`].defaultChain=n:this.namespaces[`${r}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${Sa}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${Sa}/${e}`)}}const WcHelpersUtil={getMethodsByChainNamespace(e){switch(e){case"solana":return["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"];case"eip155":return["personal_sign","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendRawTransaction","eth_sendTransaction","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus","wallet_getCallsStatus","wallet_grantPermissions","wallet_switchEthereumChain"];default:return[]}},createNamespaces(e){return e.reduce(((e,t)=>{const{id:r,chainNamespace:n,rpcUrls:i}=t,o=i.default.http[0],s=this.getMethodsByChainNamespace(n);e[n]||(e[n]={methods:s,events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}});const a=`${n}:${r}`,c=e[n];return c.chains.push(a),(null==c?void 0:c.rpcMap)&&o&&(c.rpcMap[r]=o),e}),{})},getChainsFromNamespaces:(e={})=>Object.values(e).flatMap((e=>{const t=e.chains||[],r=e.accounts.map((e=>{const[t,r]=e.split(":");return`${t}:${r}`}));return Array.from(new Set([...t,...r]))}))};var define_import_meta_env_default$2={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const isObject$2=e=>"object"==typeof e&&null!==e,proxyStateMap=new WeakMap,refSet=new WeakSet,buildProxyFunction=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject$2(e)&&!refSet.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},i=new WeakMap,o=(e,t,r=n)=>{const s=i.get(e);if((null==s?void 0:s[0])===t)return s[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$8(a,!0),i.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const n=Reflect.get(e,t),i={value:n,enumerable:!0,configurable:!0};if(refSet.has(n))h$8(n,!1);else if(n instanceof Promise)delete i.value,i.get=()=>r(n);else if(proxyStateMap.has(n)){const[e,t]=proxyStateMap.get(n);i.value=o(e,t(),r)}Object.defineProperty(a,t,i)})),Object.preventExtensions(a)},s=new WeakMap,a=[1,1],c=n=>{if(!isObject$2(n))throw new Error("object required");const i=s.get(n);if(i)return i;let l=a[0];const u=new Set,d=(e,t=++a[0])=>{l!==t&&(l=t,u.forEach((r=>r(e,t))))};let h=a[1];const p=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},f=new Map,m=e=>{var t;const r=f.get(e);r&&(f.delete(e),null==(t=r[1])||t.call(r))},g=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),b={deleteProperty(e,t){const r=Reflect.get(e,t);m(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,i,o){const a=Reflect.has(t,n),l=Reflect.get(t,n,o);if(a&&(e(l,i)||s.has(i)&&e(l,s.get(i))))return!0;m(n),isObject$2(i)&&(i=y$7(i)||i);let h=i;if(i instanceof Promise)i.then((e=>{i.status="fulfilled",i.value=e,d(["resolve",[n],e])})).catch((e=>{i.status="rejected",i.reason=e,d(["reject",[n],e])}));else{!proxyStateMap.has(i)&&r(i)&&(h=c(i));const e=!refSet.has(h)&&proxyStateMap.get(h);e&&((e,t)=>{if("production"!==(define_import_meta_env_default$2?"production":void 0)&&f.has(e))throw new Error("prop listener already exists");if(u.size){const r=t[3](p(e));f.set(e,[t,r])}else f.set(e,[t])})(n,e)}return Reflect.set(t,n,h,o),d(["set",[n],i,l]),!0}},y=t(g,b);s.set(n,y);const w=[g,(e=++a[1])=>(h===e||u.size||(h=e,f.forEach((([t])=>{const r=t[1](e);r>l&&(l=r)}))),l),o,e=>{u.add(e),1===u.size&&f.forEach((([e,t],r)=>{if("production"!==(define_import_meta_env_default$2?"production":void 0)&&t)throw new Error("remove already exists");const n=e[3](p(r));f.set(r,[e,n])}));return()=>{u.delete(e),0===u.size&&f.forEach((([e,t],r)=>{t&&(t(),f.set(r,[e]))}))}}];return proxyStateMap.set(y,w),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(y[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(g,e,t)})),y})=>[c,proxyStateMap,refSet,e,t,r,n,i,o,s,a],[defaultProxyFunction]=buildProxyFunction();function proxy(e={}){return defaultProxyFunction(e)}function subscribe(e,t,r){const n=proxyStateMap.get(e);let i;"production"===(define_import_meta_env_default$2?"production":void 0)||n||console.warn("Please use proxy object");const o=[],s=n[3];let a=!1;const c=s((e=>{o.push(e),i||(i=Promise.resolve().then((()=>{i=void 0,a&&t(o.splice(0))})))}));return a=!0,()=>{a=!1,c()}}function ref(e){return refSet.add(e),e}function subscribeKey(e,t,r,n){let i=e[t];return subscribe(e,(()=>{const n=e[t];Object.is(i,n)||r(i=n)}))}const state$2=proxy({providers:{eip155:void 0,solana:void 0,polkadot:void 0},providerIds:{eip155:void 0,solana:void 0,polkadot:void 0}}),ProviderUtil={state:state$2,subscribeKey:(e,t)=>subscribeKey(state$2,e,t),subscribeProviders:e=>subscribe(state$2.providers,(()=>e(state$2.providers))),setProvider(e,t){t&&(state$2.providers[e]=ref(t))},getProvider:e=>state$2.providers[e],setProviderId(e,t){t&&(state$2.providerIds[e]=t)},getProviderId:e=>state$2.providerIds[e],reset(){state$2.providers={eip155:void 0,solana:void 0,polkadot:void 0},state$2.providerIds={eip155:void 0,solana:void 0,polkadot:void 0}},resetChain(e){state$2.providers[e]=void 0,state$2.providerIds[e]=void 0}},OPTIONAL_METHODS$1=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions"];class UniversalAdapterClient{constructor(e){this.appKit=void 0,this.isUniversalAdapterClient=!0,this.options=void 0,this.adapterType="universal",this.reportErrors=!0;const{siweConfig:t,metadata:r}=e;this.caipNetworks=e.networks,this.chainNamespace=ConstantsUtil$3.CHAIN.EVM,this.metadata=r,this.networkControllerClient={switchCaipNetwork:e=>{e&&this.switchNetwork(e)},getApprovedCaipNetworksData:async()=>{var e;const t=await this.getWalletConnectProvider();if(!t)return Promise.resolve({supportsAllNetworks:!1,approvedCaipNetworkIds:[]});const r=WcHelpersUtil.getChainsFromNamespaces(null==(e=t.session)?void 0:e.namespaces);return Promise.resolve({supportsAllNetworks:!1,approvedCaipNetworkIds:r})}},this.connectionControllerClient={connectWalletConnect:async e=>{var r,n,i,o,s,a,c,l,u,d,h;const p=await this.getWalletConnectProvider();if(!p)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");if(p.on("display_uri",(t=>{e(t)})),ChainController.state.activeChain&&"wagmi"===(null==(i=null==(n=null==(r=ChainController.state)?void 0:r.chains)?void 0:n.get(ChainController.state.activeChain))?void 0:i.adapterType)){const t=ChainController.state.chains.get(ChainController.state.activeChain);await(null==(s=null==(o=null==t?void 0:t.connectionControllerClient)?void 0:o.connectWalletConnect)?void 0:s.call(o,e)),this.setWalletConnectProvider()}else{const e=await(null==(a=null==t?void 0:t.getMessageParams)?void 0:a.call(t)),r=null==(c=null==t?void 0:t.options)?void 0:c.enabled,n="function"==typeof(null==p?void 0:p.authenticate),i=e&&Object.keys(e||{}).length>0;if(t&&r&&e&&n&&i&&ChainController.state.activeChain===ConstantsUtil$3.CHAIN.EVM){const{SIWEController:r,getDidChainId:n,getDidAddress:i}=await Promise.resolve().then((()=>index$4)),o=null==(l=this.caipNetworks)?void 0:l.filter((e=>e.chainNamespace===ConstantsUtil$3.CHAIN.EVM)).map((e=>e.caipNetworkId));e.chains=null==(u=this.caipNetworks)?void 0:u.filter((e=>e.chainNamespace===ConstantsUtil$3.CHAIN.EVM)).map((e=>e.id));const s=await p.authenticate({nonce:await(null==(d=null==t?void 0:t.getNonce)?void 0:d.call(t)),methods:[...OPTIONAL_METHODS$1],...e,chains:o}),a=null==(h=null==s?void 0:s.auths)?void 0:h[0];if(a){const{p:e,s:t}=a,o=n(e.iss),s=i(e.iss);s&&o&&r.setSession({address:s,chainId:parseInt(o,10)});try{const n=p.client.formatAuthMessage({request:e,iss:e.iss});await r.verifyMessage({message:n,signature:t.s,cacao:a})}catch(f){throw console.error("Error verifying message",f),await p.disconnect().catch(console.error),await r.signOut().catch(console.error),f}}}else{const e=WcHelpersUtil.createNamespaces(this.caipNetworks);await p.connect({optionalNamespaces:e})}this.setWalletConnectProvider()}},disconnect:async()=>{var e,r,n,i;if(SafeLocalStorage.removeItem(SafeLocalStorageKeys.WALLET_ID),null==(e=null==t?void 0:t.options)?void 0:e.signOutOnDisconnect){const{SIWEController:e}=await Promise.resolve().then((()=>index$4));await e.signOut()}await(null==(r=this.walletConnectProvider)?void 0:r.disconnect()),null==(n=this.appKit)||n.resetAccount(ConstantsUtil$3.CHAIN.EVM),null==(i=this.appKit)||i.resetAccount(ConstantsUtil$3.CHAIN.SOLANA)},signMessage:async e=>{const t=await this.getWalletConnectProvider(),r=ChainController.state.activeCaipAddress,n=CoreHelperUtil.getPlainAddress(r);if(!t)throw new Error("connectionControllerClient:signMessage - provider is undefined");return await t.request({method:"personal_sign",params:[e,n]})},estimateGas:async()=>await Promise.resolve(BigInt(0)),getEnsAvatar:async e=>await Promise.resolve(e),getEnsAddress:async e=>await Promise.resolve(e),writeContract:async()=>await Promise.resolve("0x"),getCapabilities:async e=>{var t,r;const n=await this.getWalletConnectProvider();if(!n)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");const i=null==(r=null==(t=n.session)?void 0:t.sessionProperties)?void 0:r.capabilities;if(i){const t=this.parseWalletCapabilities(i)[e];if(t)return t}return await n.request({method:"wallet_getCapabilities",params:[e]})},grantPermissions:async e=>{const t=await this.getWalletConnectProvider();if(!t)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return t.request({method:"wallet_grantPermissions",params:e})},sendTransaction:async()=>await Promise.resolve("0x"),parseUnits:()=>BigInt(0),formatUnits:()=>""}}construct(e,t){this.appKit=e,this.options=t,this.createProvider(),this.syncRequestedNetworks(this.caipNetworks),this.syncConnectors()}switchNetwork(e){e&&this.walletConnectProvider&&this.walletConnectProvider.setDefaultChain(e.caipNetworkId)}async disconnect(){var e,t;this.walletConnectProvider&&(await this.walletConnectProvider.disconnect(),null==(e=this.appKit)||e.resetAccount(ConstantsUtil$3.CHAIN.EVM),null==(t=this.appKit)||t.resetAccount(ConstantsUtil$3.CHAIN.SOLANA))}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{await this.createProvider()}catch(e){throw new Error("EthereumAdapter:getWalletConnectProvider - Cannot create provider")}return this.walletConnectProvider}createProvider(){var e,t;return!this.walletConnectProviderInitPromise&&"undefined"!=typeof window&&(null==(e=this.options)?void 0:e.projectId)&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider(null==(t=this.options)?void 0:t.projectId)),this.walletConnectProviderInitPromise}async initWalletConnectProvider(e){const t=LoggerUtil.createLogger(((e,...t)=>{e.message.includes(ErrorUtil.UniversalProviderErrors.UNAUTHORIZED_DOMAIN_NOT_ALLOWED)?this.reportErrors&&(AlertController.open(ErrorUtil.ALERT_ERRORS.INVALID_APP_CONFIGURATION,"error"),this.reportErrors=!1):console.error(...t)})),r={projectId:e,metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]},logger:t};this.walletConnectProvider=await dr.init(r),await this.checkActiveWalletConnectProvider()}syncRequestedNetworks(e){[...new Set(e.map((e=>e.chainNamespace)))].filter((e=>Boolean(e))).forEach((t=>{var r;null==(r=this.appKit)||r.setRequestedCaipNetworks(e.filter((e=>e.chainNamespace===t)),t)}))}async checkActiveWalletConnectProvider(){const e=await this.getWalletConnectProvider(),t=SafeLocalStorage.getItem(SafeLocalStorageKeys.WALLET_ID);e&&t===ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID&&this.setWalletConnectProvider()}setWalletConnectProvider(){var e,t;SafeLocalStorage.setItem(SafeLocalStorageKeys.WALLET_ID,ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID);const r=null==(t=null==(e=this.walletConnectProvider)?void 0:e.session)?void 0:t.namespaces;if(r){Object.keys(r).reverse().forEach((e=>{var t,n,i;const o=null==(t=null==r?void 0:r[e])?void 0:t.accounts[0];ProviderUtil.setProvider(e,this.walletConnectProvider),ProviderUtil.setProviderId(e,"walletConnect"),null==(n=this.appKit)||n.setApprovedCaipNetworksData(e),o&&(null==(i=this.appKit)||i.setCaipAddress(o,e))}));const e=StorageUtil.getStoredActiveCaipNetwork(),t=ChainController.state.activeCaipNetwork;try{e?ChainController.setActiveCaipNetwork(e):t&&ChainController.getAllApprovedCaipNetworkIds().includes(t.caipNetworkId)||this.setDefaultNetwork(r)}catch(n){console.warn(">>> Error setting active caip network",n)}}this.syncAccount(),this.watchWalletConnect()}setDefaultNetwork(e){var t;const r=null==(t=this.caipNetworks[0])?void 0:t.chainNamespace;if(r){const t=null==e?void 0:e[r];if(null==t?void 0:t.chains){const e=t.chains[0];if(e){const t=ChainController.getRequestedCaipNetworks(r);if(t){const r=t.find((t=>t.caipNetworkId===e));r&&ChainController.setActiveCaipNetwork(r)}}}}}async watchWalletConnect(){var e;const t=await this.getWalletConnectProvider(),r=(null==(e=null==t?void 0:t.session)?void 0:e.namespaces)||{};const n=e=>{e.length>0&&this.syncAccount()},i=e=>{var t,r,n;const i=this.caipNetworks.find((t=>t.id==e)),o=null==(t=this.appKit)?void 0:t.getCaipNetwork();if(i)o&&(null==o?void 0:o.id)===(null==i?void 0:i.id)||null==(n=this.appKit)||n.setCaipNetwork(i);else{const t=(null==(r=this.appKit)?void 0:r.getActiveChainNamespace())||ConstantsUtil$3.CHAIN.EVM;ChainController.setActiveCaipNetwork({id:e,caipNetworkId:`${t}:${e}`,name:"Unknown Network",chainNamespace:t,nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}})}};t&&(t.on("disconnect",(function e(){Object.keys(r).forEach((e=>{AccountController.resetAccount(e)})),ConnectionController.resetWcConnection(),SafeLocalStorage.removeItem(SafeLocalStorageKeys.WALLET_ID),null==t||t.removeListener("disconnect",e),null==t||t.removeListener("accountsChanged",n)})),t.on("accountsChanged",n),t.on("chainChanged",i))}getProviderData(){var e,t,r,n;const i=(null==(t=null==(e=this.walletConnectProvider)?void 0:e.session)?void 0:t.namespaces)||{},o=(null==(r=this.appKit)?void 0:r.getIsConnectedState())||!1,s=(null==(n=this.appKit)?void 0:n.getPreferredAccountType())||"";return{provider:this.walletConnectProvider,namespaces:i,namespaceKeys:i?Object.keys(i):[],isConnected:o,preferredAccountType:s}}syncAccount(){var e,t,r,n;const{namespaceKeys:i,namespaces:o}=this.getProviderData(),s=null==(e=this.appKit)?void 0:e.getPreferredAccountType();(null==(t=this.appKit)?void 0:t.getIsConnectedState())||!1?i.forEach((async e=>{var t,r,n,i,a;const c=e,l=null==(t=null==o?void 0:o[e])?void 0:t.accounts[0];(null==(r=this.appKit)?void 0:r.getCaipAddress(c))||(null==(n=this.appKit)||n.setPreferredAccountType(s,c),null==(i=this.appKit)||i.setCaipAddress(l,c),this.syncConnectedWalletInfo(),await Promise.all([null==(a=this.appKit)?void 0:a.setApprovedCaipNetworksData(c)])),this.syncAccounts()})):(null==(r=this.appKit)||r.resetWcConnection(),null==(n=this.appKit)||n.resetNetwork(this.chainNamespace),this.syncAccounts(!0))}syncAccounts(e=!1){const{namespaces:t}=this.getProviderData();Object.keys(t).forEach((r=>{var n,i,o,s;const a=null==(i=null==(n=null==t?void 0:t[r])?void 0:n.accounts)?void 0:i.map((e=>{const[,,t]=e.split(":");return t})).filter(((e,t,r)=>r.indexOf(e)===t));e&&(null==(o=this.appKit)||o.setAllAccounts([],r)),a&&(null==(s=this.appKit)||s.setAllAccounts(a.map((e=>({address:e,type:"eoa"}))),r))}))}syncConnectedWalletInfo(){var e,t;const r=SafeLocalStorage.getItem(SafeLocalStorageKeys.WALLET_ID),n=(null==(t=null==(e=this.walletConnectProvider)?void 0:e.session)?void 0:t.namespaces)||{};Object.keys(n).forEach((e=>{var t,n,i,o,s;(null==(t=this.walletConnectProvider)?void 0:t.session)?null==(i=this.appKit)||i.setConnectedWalletInfo({...this.walletConnectProvider.session.peer.metadata,name:this.walletConnectProvider.session.peer.metadata.name,icon:null==(n=this.walletConnectProvider.session.peer.metadata.icons)?void 0:n[0]},e):r&&(null==(o=this.appKit)||o.setConnectedWalletInfo({name:r},ConstantsUtil$3.CHAIN.EVM),null==(s=this.appKit)||s.setConnectedWalletInfo({name:r},ConstantsUtil$3.CHAIN.SOLANA))}))}syncConnectors(){var e;const t=[];t.push({id:ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID,explorerId:PresetsUtil.ConnectorExplorerIds[ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID],imageId:PresetsUtil.ConnectorImageIds[ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID],name:PresetsUtil.ConnectorNamesMap[ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID],type:"WALLET_CONNECT",chain:this.chainNamespace}),null==(e=this.appKit)||e.setConnectors(t)}parseWalletCapabilities(e){try{return JSON.parse(e)}catch(t){throw new Error("Error parsing wallet capabilities")}}}let isInitialized=!1;class AppKit{constructor(e){var t;this.initPromise=void 0,this.setStatus=(e,t)=>{AccountController.setStatus(e,t)},this.getIsConnectedState=()=>Boolean(ChainController.state.activeCaipAddress),this.setAllAccounts=(e,t)=>{AccountController.setAllAccounts(e,t),OptionsController.setHasMultipleAddresses((null==e?void 0:e.length)>1)},this.addAddressLabel=(e,t,r)=>{AccountController.addAddressLabel(e,t,r)},this.removeAddressLabel=(e,t)=>{AccountController.removeAddressLabel(e,t)},this.getCaipAddress=e=>ChainController.state.activeChain!==e&&e?ChainController.getAccountProp("caipAddress",e):ChainController.state.activeCaipAddress,this.getAddress=e=>ChainController.state.activeChain!==e&&e?ChainController.getAccountProp("address",e):AccountController.state.address,this.getProvider=()=>AccountController.state.provider,this.getPreferredAccountType=()=>AccountController.state.preferredAccountType,this.setCaipAddress=(e,t)=>{AccountController.setCaipAddress(e,t)},this.setProvider=(e,t)=>{AccountController.setProvider(e,t)},this.setBalance=(e,t,r)=>{AccountController.setBalance(e,t,r)},this.setProfileName=(e,t)=>{AccountController.setProfileName(e,t)},this.setProfileImage=(e,t)=>{AccountController.setProfileImage(e,t)},this.resetAccount=e=>{AccountController.resetAccount(e)},this.setCaipNetwork=e=>{ChainController.setActiveCaipNetwork(e)},this.getCaipNetwork=e=>{var t;return e?null==(t=ChainController.getRequestedCaipNetworks(e).filter((t=>t.chainNamespace===e)))?void 0:t[0]:ChainController.state.activeCaipNetwork},this.getCaipNetworkId=()=>{const e=this.getCaipNetwork();if(e)return e.id},this.getCaipNetworks=e=>ChainController.getRequestedCaipNetworks(e),this.getActiveChainNamespace=()=>ChainController.state.activeChain,this.setRequestedCaipNetworks=(e,t)=>{ChainController.setRequestedCaipNetworks(e,t)},this.getApprovedCaipNetworkIds=()=>ChainController.getAllApprovedCaipNetworkIds(),this.setApprovedCaipNetworksData=e=>ChainController.setApprovedCaipNetworksData(e),this.resetNetwork=e=>{ChainController.resetNetwork(e)},this.setConnectors=e=>{const t=[...ConnectorController.getConnectors(),...e];ConnectorController.setConnectors(t)},this.addConnector=e=>{ConnectorController.addConnector(e)},this.getConnectors=()=>ConnectorController.getConnectors(),this.resetWcConnection=()=>{ConnectionController.resetWcConnection()},this.fetchIdentity=e=>BlockchainApiController.fetchIdentity(e),this.setAddressExplorerUrl=(e,t)=>{AccountController.setAddressExplorerUrl(e,t)},this.setSmartAccountDeployed=(e,t)=>{AccountController.setSmartAccountDeployed(e,t)},this.setConnectedWalletInfo=(e,t)=>{AccountController.setConnectedWalletInfo(e,t)},this.setSmartAccountEnabledNetworks=(e,t)=>{ChainController.setSmartAccountEnabledNetworks(e,t)},this.setPreferredAccountType=(e,t)=>{AccountController.setPreferredAccountType(e,t)},this.getReownName=e=>EnsController.getNamesForAddress(e),this.resolveReownName=async e=>{var t;const r=await EnsController.resolveName(e);return(null==(t=(Object.values(null==r?void 0:r.addresses)||[])[0])?void 0:t.address)||!1},this.setEIP6963Enabled=e=>{OptionsController.setEIP6963Enabled(e)},this.setClientId=e=>{BlockchainApiController.setClientId(e)},this.getConnectorImage=e=>AssetUtil.getConnectorImage(e),this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.adapter=null==(t=e.adapters)?void 0:t[0],this.caipNetworks=this.extendCaipNetworks(e),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.initControllers(e),this.initOrContinue(),this.version=e.sdkVersion}static getInstance(){return this.instance}async open(e){await this.initOrContinue(),ModalController.open(e)}async close(){await this.initOrContinue(),ModalController.close()}setLoading(e){ModalController.setLoading(e)}getError(){return""}getChainId(){var e;return null==(e=ChainController.state.activeCaipNetwork)?void 0:e.id}switchNetwork(e){return ChainController.switchActiveNetwork(e)}getWalletProvider(){return ChainController.state.activeChain?ProviderUtil.state.providers[ChainController.state.activeChain]:null}getWalletProviderType(){return ChainController.state.activeChain?ProviderUtil.state.providerIds[ChainController.state.activeChain]:null}subscribeProvider(){return null}getThemeMode(){return ThemeController.state.themeMode}getThemeVariables(){return ThemeController.state.themeVariables}setThemeMode(e){ThemeController.setThemeMode(e),setColorTheme(ThemeController.state.themeMode)}setThemeVariables(e){ThemeController.setThemeVariables(e),setThemeVariables(ThemeController.state.themeVariables)}subscribeTheme(e){return ThemeController.subscribe(e)}getWalletInfo(){return AccountController.state.connectedWalletInfo}subscribeWalletInfo(e){return AccountController.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){AccountController.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){ChainController.subscribeKey("activeCaipNetwork",e)}getState(){return PublicStateController.state}subscribeState(e){return PublicStateController.subscribe(e)}showErrorMessage(e){SnackController.showError(e)}showSuccessMessage(e){SnackController.showSuccess(e)}getEvent(){return{...EventsController.state}}subscribeEvents(e){return EventsController.subscribe(e)}replace(e){RouterController.replace(e)}redirect(e){RouterController.push(e)}popTransactionStack(e){RouterController.popTransactionStack(e)}isOpen(){return ModalController.state.open}isTransactionStackEmpty(){return 0===RouterController.state.transactionStack.length}isTransactionShouldReplaceView(){var e;return null==(e=RouterController.state.transactionStack[RouterController.state.transactionStack.length-1])?void 0:e.replace}async initControllers(e){var t;if(OptionsController.setDebug(e.debug),OptionsController.setProjectId(e.projectId),OptionsController.setSdkVersion(e.sdkVersion),!e.projectId)return void AlertController.open(ErrorUtil.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");this.adapters=e.adapters,this.setMetadata(e),this.initializeUniversalAdapter(e),this.initializeAdapters(e),this.setDefaultNetwork(),OptionsController.setAllWallets(e.allWallets),OptionsController.setIncludeWalletIds(e.includeWalletIds),OptionsController.setExcludeWalletIds(e.excludeWalletIds),e.excludeWalletIds&&ApiController.searchWalletByIds({ids:e.excludeWalletIds}),OptionsController.setFeaturedWalletIds(e.featuredWalletIds),OptionsController.setTokens(e.tokens),OptionsController.setTermsConditionsUrl(e.termsConditionsUrl),OptionsController.setPrivacyPolicyUrl(e.privacyPolicyUrl),OptionsController.setCustomWallets(e.customWallets),OptionsController.setFeatures(e.features),OptionsController.setEnableWalletConnect(!1!==e.enableWalletConnect),OptionsController.setEnableWallets(!1!==e.enableWallets),e.metadata&&OptionsController.setMetadata(e.metadata),e.themeMode&&ThemeController.setThemeMode(e.themeMode),e.themeVariables&&ThemeController.setThemeVariables(e.themeVariables),e.disableAppend&&OptionsController.setDisableAppend(Boolean(e.disableAppend));if((null==(t=e.adapters)?void 0:t.find((e=>e.chainNamespace===ConstantsUtil$3.CHAIN.EVM)))&&e.siweConfig){const{SIWEController:t}=await Promise.resolve().then((()=>index$4));t.setSIWEClient(e.siweConfig)}}setMetadata(e){var t,r,n;"undefined"!=typeof window&&"undefined"!=typeof document&&(e.metadata={name:(null==(t=document.getElementsByTagName("title")[0])?void 0:t.textContent)||"",description:(null==(r=document.querySelector('meta[property="og:description"]'))?void 0:r.content)||"",url:window.location.origin,icons:[(null==(n=document.querySelector('link[rel~="icon"]'))?void 0:n.href)||""]})}extendCaipNetworks(e){return CaipNetworksUtil.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,projectId:e.projectId})}extendDefaultCaipNetwork(e){const t=e.networks.find((t=>{var r;return t.id===(null==(r=e.defaultNetwork)?void 0:r.id)}));return t?CaipNetworksUtil.extendCaipNetwork(t,{customNetworkImageUrls:e.chainImages,projectId:e.projectId}):void 0}initializeUniversalAdapter(e){var t,r;const n={...e,networks:this.caipNetworks,defaultNetwork:this.defaultCaipNetwork};this.universalAdapter=new UniversalAdapterClient(n),ChainController.initializeUniversalAdapter(this.universalAdapter,e.adapters||[]),null==(r=(t=this.universalAdapter).construct)||r.call(t,this,n)}initializeAdapters(e){var t;const r={...e,networks:this.caipNetworks,defaultNetwork:this.defaultCaipNetwork};ChainController.initialize(e.adapters||[]),null==(t=e.adapters)||t.forEach((e=>{var t;null==(t=e.construct)||t.call(e,this,r)}))}setDefaultNetwork(){const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID),t=(e?this.caipNetworks.find((t=>t.caipNetworkId===e)):void 0)||this.defaultCaipNetwork||this.caipNetworks[0];ChainController.setActiveCaipNetwork(t)}async initOrContinue(){return this.initPromise||isInitialized||!CoreHelperUtil.isClient()||(isInitialized=!0,this.initPromise=new Promise((async e=>{await Promise.all([Promise.resolve().then((()=>index$7)),Promise.resolve().then((()=>w3mModal))]);const t=document.createElement("w3m-modal");OptionsController.state.disableAppend||document.body.insertAdjacentElement("beforeend",t),e()}))),this.initPromise}}const PACKAGE_VERSION="1.1.4";var __decorate$1L=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};let W3mAccountButton=class extends h$5{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.balance="show",this.charsStart=4,this.charsEnd=6,this.caipAddress=ChainController.state.activeCaipAddress,this.balanceVal=AccountController.state.balance,this.balanceSymbol=AccountController.state.balanceSymbol,this.profileName=AccountController.state.profileName,this.profileImage=AccountController.state.profileImage,this.network=ChainController.state.activeCaipNetwork,this.networkImage=this.network?AssetUtil.getNetworkImage(this.network):void 0,this.isSupported=!0,this.unsubscribe.push(AssetController.subscribeNetworkImages((()=>{var e,t;this.networkImage=(null==(t=null==(e=this.network)?void 0:e.assets)?void 0:t.imageId)?AssetUtil.getNetworkImage(this.network):void 0})),ChainController.subscribeKey("activeCaipAddress",(e=>this.caipAddress=e)),AccountController.subscribeKey("balance",(e=>this.balanceVal=e)),AccountController.subscribeKey("balanceSymbol",(e=>this.balanceSymbol=e)),AccountController.subscribeKey("profileName",(e=>this.profileName=e)),AccountController.subscribeKey("profileImage",(e=>this.profileImage=e)),ChainController.subscribeKey("activeCaipNetwork",(e=>{var t;this.network=e,this.networkImage=(null==(t=null==e?void 0:e.assets)?void 0:t.imageId)?AssetUtil.getNetworkImage(e):void 0,this.isSupported=!(null==e?void 0:e.chainNamespace)||ChainController.checkIfSupportedNetwork(null==e?void 0:e.chainNamespace)})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){if(!ChainController.state.activeChain)return null;const e="show"===this.balance;return ke`
6097
+ */P2=qi,s2=qi.exports,function(){var e,t="Expected a function",r="__lodash_hash_undefined__",n="__lodash_placeholder__",i=16,o=32,s=64,a=128,c=256,l=1/0,u=9007199254740991,d=NaN,h=4294967295,p=h-1,f=h>>>1,m=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",i],["flip",512],["partial",o],["partialRight",s],["rearg",c]],g="[object Arguments]",b="[object Array]",y="[object Boolean]",w="[object Date]",v="[object Error]",_="[object Function]",$="[object GeneratorFunction]",C="[object Map]",E="[object Number]",S="[object Object]",x="[object Promise]",A="[object RegExp]",k="[object Set]",T="[object String]",I="[object Symbol]",R="[object WeakMap]",P="[object ArrayBuffer]",N="[object DataView]",M="[object Float32Array]",B="[object Float64Array]",O="[object Int8Array]",L="[object Int16Array]",U="[object Int32Array]",D="[object Uint8Array]",W="[object Uint8ClampedArray]",j="[object Uint16Array]",F="[object Uint32Array]",z=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,G=RegExp(V.source),Z=RegExp(K.source),J=/<%-([\s\S]+?)%>/g,Q=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ee=/^\w*$/,te=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,re=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(re.source),ie=/^\s+/,oe=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ce=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,de=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,fe=/^[-+]0x[0-9a-f]+$/i,me=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,be=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,$e="\\ud800-\\udfff",Ce="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ee="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",xe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",ke="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Te="['’]",Ie="["+$e+"]",Re="["+ke+"]",Pe="["+Ce+"]",Ne="\\d+",Me="["+Ee+"]",Be="["+Se+"]",Oe="[^"+$e+ke+Ne+Ee+Se+xe+"]",Le="\\ud83c[\\udffb-\\udfff]",Ue="[^"+$e+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",We="[\\ud800-\\udbff][\\udc00-\\udfff]",je="["+xe+"]",Fe="\\u200d",ze="(?:"+Be+"|"+Oe+")",qe="(?:"+je+"|"+Oe+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ke="(?:"+Pe+"|"+Le+")?",Ge="["+Ae+"]?",Ze=Ge+Ke+"(?:"+Fe+"(?:"+[Ue,De,We].join("|")+")"+Ge+Ke+")*",Je="(?:"+[Me,De,We].join("|")+")"+Ze,Qe="(?:"+[Ue+Pe+"?",Pe,De,We,Ie].join("|")+")",Ye=RegExp(Te,"g"),Xe=RegExp(Pe,"g"),et=RegExp(Le+"(?="+Le+")|"+Qe+Ze,"g"),tt=RegExp([je+"?"+Be+"+"+He+"(?="+[Re,je,"$"].join("|")+")",qe+"+"+Ve+"(?="+[Re,je+ze,"$"].join("|")+")",je+"?"+ze+"+"+He,je+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Je].join("|"),"g"),rt=RegExp("["+Fe+$e+Ce+Ae+"]"),nt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,it=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ot=-1,st={};st[M]=st[B]=st[O]=st[L]=st[U]=st[D]=st[W]=st[j]=st[F]=!0,st[g]=st[b]=st[P]=st[y]=st[N]=st[w]=st[v]=st[_]=st[C]=st[E]=st[S]=st[A]=st[k]=st[T]=st[R]=!1;var at={};at[g]=at[b]=at[P]=at[N]=at[y]=at[w]=at[M]=at[B]=at[O]=at[L]=at[U]=at[C]=at[E]=at[S]=at[A]=at[k]=at[T]=at[I]=at[D]=at[W]=at[j]=at[F]=!0,at[v]=at[_]=at[R]=!1;var ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,dt="object"==typeof _n&&_n&&_n.Object===Object&&_n,ht="object"==typeof self&&self&&self.Object===Object&&self,pt=dt||ht||Function("return this")(),ft=s2&&!s2.nodeType&&s2,mt=ft&&P2&&!P2.nodeType&&P2,gt=mt&&mt.exports===ft,bt=gt&&dt.process,yt=function(){try{return mt&&mt.require&&mt.require("util").types||bt&&bt.binding&&bt.binding("util")}catch{}}(),wt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,_t=yt&&yt.isMap,$t=yt&&yt.isRegExp,Ct=yt&&yt.isSet,Et=yt&&yt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function xt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var s=e[i];t(n,s,r(s),e)}return n}function At(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function kt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Tt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function It(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}function Rt(e,t){return!(null==e||!e.length)&&jt(e,t,0)>-1}function Pt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Nt(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Mt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Bt(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Ot(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Lt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Ut=Ht("length");function Dt(e,t,r){var n;return r(e,(function(e,r,i){if(t(e,r,i))return n=r,!1})),n}function Wt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function jt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Wt(e,zt,r)}function Ft(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function zt(e){return e!=e}function qt(e,t){var r=null==e?0:e.length;return r?Gt(e,t)/r:d}function Ht(t){return function(r){return null==r?e:r[t]}}function Vt(t){return function(r){return null==t?e:t[r]}}function Kt(e,t,r,n,i){return i(e,(function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)})),r}function Gt(t,r){for(var n,i=-1,o=t.length;++i<o;){var s=r(t[i]);s!==e&&(n=n===e?s:n+s)}return n}function Zt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Jt(e){return e&&e.slice(0,hr(e)+1).replace(ie,"")}function Qt(e){return function(t){return e(t)}}function Yt(e,t){return Nt(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function er(e,t){for(var r=-1,n=e.length;++r<n&&jt(t,e[r],0)>-1;);return r}function tr(e,t){for(var r=e.length;r--&&jt(t,e[r],0)>-1;);return r}var rr=Vt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),nr=Vt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function ir(e){return"\\"+ct[e]}function or(e){return rt.test(e)}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function ar(e,t){return function(r){return e(t(r))}}function cr(e,t){for(var r=-1,i=e.length,o=0,s=[];++r<i;){var a=e[r];(a===t||a===n)&&(e[r]=n,s[o++]=r)}return s}function lr(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}function ur(e){return or(e)?function(e){for(var t=et.lastIndex=0;et.test(e);)++t;return t}(e):Ut(e)}function dr(e){return or(e)?function(e){return e.match(et)||[]}(e):function(e){return e.split("")}(e)}function hr(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var pr=Vt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function oe($e){var Ce,Ee=($e=null==$e?pt:fr.defaults(pt.Object(),$e,fr.pick(pt,it))).Array,Se=$e.Date,xe=$e.Error,Ae=$e.Function,ke=$e.Math,Te=$e.Object,Ie=$e.RegExp,Re=$e.String,Pe=$e.TypeError,Ne=Ee.prototype,Me=Ae.prototype,Be=Te.prototype,Oe=$e["__core-js_shared__"],Le=Me.toString,Ue=Be.hasOwnProperty,De=0,We=(Ce=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+Ce:"",je=Be.toString,Fe=Le.call(Te),ze=pt._,qe=Ie("^"+Le.call(Ue).replace(re,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=gt?$e.Buffer:e,Ve=$e.Symbol,Ke=$e.Uint8Array,Ge=He?He.allocUnsafe:e,Ze=ar(Te.getPrototypeOf,Te),Je=Te.create,Qe=Be.propertyIsEnumerable,et=Ne.splice,rt=Ve?Ve.isConcatSpreadable:e,ct=Ve?Ve.iterator:e,dt=Ve?Ve.toStringTag:e,ht=function(){try{var e=fo(Te,"defineProperty");return e({},"",{}),e}catch{}}(),ft=$e.clearTimeout!==pt.clearTimeout&&$e.clearTimeout,mt=Se&&Se.now!==pt.Date.now&&Se.now,bt=$e.setTimeout!==pt.setTimeout&&$e.setTimeout,yt=ke.ceil,Ut=ke.floor,Vt=Te.getOwnPropertySymbols,mr=He?He.isBuffer:e,gr=$e.isFinite,br=Ne.join,yr=ar(Te.keys,Te),wr=ke.max,vr=ke.min,_r=Se.now,$r=$e.parseInt,Cr=ke.random,Er=Ne.reverse,Sr=fo($e,"DataView"),xr=fo($e,"Map"),Ar=fo($e,"Promise"),kr=fo($e,"Set"),Tr=fo($e,"WeakMap"),Ir=fo(Te,"create"),Rr=Tr&&new Tr,Pr={},Nr=Wo(Sr),Mr=Wo(xr),Br=Wo(Ar),Or=Wo(kr),Lr=Wo(Tr),Ur=Ve?Ve.prototype:e,Dr=Ur?Ur.valueOf:e,Wr=Ur?Ur.toString:e;function jr(e){if(na(e)&&!Vs(e)&&!(e instanceof Hr)){if(e instanceof qr)return e;if(Ue.call(e,"__wrapped__"))return jo(e)}return new qr(e)}var Fr=function(){function t(){}return function(r){if(!ra(r))return{};if(Je)return Je(r);t.prototype=r;var n=new t;return t.prototype=e,n}}();function zr(){}function qr(t,r){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=e}function Hr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Kr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Zr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Gr;++t<r;)this.add(e[t])}function Jr(e){var t=this.__data__=new Kr(e);this.size=t.size}function Qr(e,t){var r=Vs(e),n=!r&&Hs(e),i=!r&&!n&&Js(e),o=!r&&!n&&!i&&da(e),s=r||n||i||o,a=s?Zt(e.length,Re):[],c=a.length;for(var l in e)(t||Ue.call(e,l))&&(!s||!("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||_o(l,c)))&&a.push(l);return a}function Yr(t){var r=t.length;return r?t[Jn(0,r-1)]:e}function Xr(e,t){return Lo(Ri(e),ln(t,0,e.length))}function en(e){return Lo(Ri(e))}function tn(t,r,n){(n!==e&&!Fs(t[r],n)||n===e&&!(r in t))&&an(t,r,n)}function rn(t,r,n){var i=t[r];(!Ue.call(t,r)||!Fs(i,n)||n===e&&!(r in t))&&an(t,r,n)}function nn(e,t){for(var r=e.length;r--;)if(Fs(e[r][0],t))return r;return-1}function on(e,t,r,n){return fn(e,(function(e,i,o){t(n,e,r(e),o)})),n}function sn(e,t){return e&&Pi(t,Na(t),e)}function an(e,t,r){"__proto__"==t&&ht?ht(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function cn(t,r){for(var n=-1,i=r.length,o=Ee(i),s=null==t;++n<i;)o[n]=s?e:ka(t,r[n]);return o}function ln(t,r,n){return t==t&&(n!==e&&(t=t<=n?t:n),r!==e&&(t=t>=r?t:r)),t}function un(t,r,n,i,o,s){var a,c=1&r,l=2&r,u=4&r;if(n&&(a=o?n(t,i,o,s):n(t)),a!==e)return a;if(!ra(t))return t;var d=Vs(t);if(d){if(a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ue.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(t),!c)return Ri(t,a)}else{var h=bo(t),p=h==_||h==$;if(Js(t))return Si(t,c);if(h==S||h==g||p&&!o){if(a=l||p?{}:wo(t),!c)return l?function(e,t){return Pi(e,go(e),t)}(t,function(e,t){return e&&Pi(t,Ma(t),e)}(a,t)):function(e,t){return Pi(e,mo(e),t)}(t,sn(a,t))}else{if(!at[h])return o?t:{};a=function(e,t,r){var n=e.constructor;switch(t){case P:return xi(e);case y:case w:return new n(+e);case N:return function(e,t){var r=t?xi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case M:case B:case O:case L:case U:case D:case W:case j:case F:return Ai(e,r);case C:return new n;case E:case T:return new n(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new n;case I:return function(e){return Dr?Te(Dr.call(e)):{}}(e)}}(t,h,c)}}s||(s=new Jr);var f=s.get(t);if(f)return f;s.set(t,a),ca(t)?t.forEach((function(e){a.add(un(e,r,n,e,t,s))})):ia(t)&&t.forEach((function(e,i){a.set(i,un(e,r,n,i,t,s))}));var m=d?e:(u?l?so:oo:l?Ma:Na)(t);return At(m||t,(function(e,i){m&&(e=t[i=e]),rn(a,i,un(e,r,n,i,t,s))})),a}function dn(t,r,n){var i=n.length;if(null==t)return!i;for(t=Te(t);i--;){var o=n[i],s=r[o],a=t[o];if(a===e&&!(o in t)||!s(a))return!1}return!0}function hn(r,n,i){if("function"!=typeof r)throw new Pe(t);return No((function(){r.apply(e,i)}),n)}function pn(e,t,r,n){var i=-1,o=Rt,s=!0,a=e.length,c=[],l=t.length;if(!a)return c;r&&(t=Nt(t,Qt(r))),n?(o=Pt,s=!1):t.length>=200&&(o=Xt,s=!1,t=new Zr(t));e:for(;++i<a;){var u=e[i],d=null==r?u:r(u);if(u=n||0!==u?u:0,s&&d==d){for(var h=l;h--;)if(t[h]===d)continue e;c.push(u)}else o(t,d,n)||c.push(u)}return c}jr.templateSettings={escape:J,evaluate:Q,interpolate:Y,variable:"",imports:{_:jr}},jr.prototype=zr.prototype,jr.prototype.constructor=jr,qr.prototype=Fr(zr.prototype),qr.prototype.constructor=qr,Hr.prototype=Fr(zr.prototype),Hr.prototype.constructor=Hr,Vr.prototype.clear=function(){this.__data__=Ir?Ir(null):{},this.size=0},Vr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Vr.prototype.get=function(t){var n=this.__data__;if(Ir){var i=n[t];return i===r?e:i}return Ue.call(n,t)?n[t]:e},Vr.prototype.has=function(t){var r=this.__data__;return Ir?r[t]!==e:Ue.call(r,t)},Vr.prototype.set=function(t,n){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=Ir&&n===e?r:n,this},Kr.prototype.clear=function(){this.__data__=[],this.size=0},Kr.prototype.delete=function(e){var t=this.__data__,r=nn(t,e);return!(r<0||(r==t.length-1?t.pop():et.call(t,r,1),--this.size,0))},Kr.prototype.get=function(t){var r=this.__data__,n=nn(r,t);return n<0?e:r[n][1]},Kr.prototype.has=function(e){return nn(this.__data__,e)>-1},Kr.prototype.set=function(e,t){var r=this.__data__,n=nn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Gr.prototype.clear=function(){this.size=0,this.__data__={hash:new Vr,map:new(xr||Kr),string:new Vr}},Gr.prototype.delete=function(e){var t=ho(this,e).delete(e);return this.size-=t?1:0,t},Gr.prototype.get=function(e){return ho(this,e).get(e)},Gr.prototype.has=function(e){return ho(this,e).has(e)},Gr.prototype.set=function(e,t){var r=ho(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Zr.prototype.add=Zr.prototype.push=function(e){return this.__data__.set(e,r),this},Zr.prototype.has=function(e){return this.__data__.has(e)},Jr.prototype.clear=function(){this.__data__=new Kr,this.size=0},Jr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Jr.prototype.get=function(e){return this.__data__.get(e)},Jr.prototype.has=function(e){return this.__data__.has(e)},Jr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Kr){var n=r.__data__;if(!xr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Gr(n)}return r.set(e,t),this.size=r.size,this};var fn=Bi($n),mn=Bi(Cn,!0);function gn(e,t){var r=!0;return fn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function bn(t,r,n){for(var i=-1,o=t.length;++i<o;){var s=t[i],a=r(s);if(null!=a&&(c===e?a==a&&!ua(a):n(a,c)))var c=a,l=s}return l}function yn(e,t){var r=[];return fn(e,(function(e,n,i){t(e,n,i)&&r.push(e)})),r}function wn(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=vo),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?wn(a,t-1,r,n,i):Mt(i,a):n||(i[i.length]=a)}return i}var vn=Oi(),_n=Oi(!0);function $n(e,t){return e&&vn(e,t,Na)}function Cn(e,t){return e&&_n(e,t,Na)}function En(e,t){return It(t,(function(t){return Xs(e[t])}))}function Sn(t,r){for(var n=0,i=(r=_i(r,t)).length;null!=t&&n<i;)t=t[Do(r[n++])];return n&&n==i?t:e}function xn(e,t,r){var n=t(e);return Vs(e)?n:Mt(n,r(e))}function An(t){return null==t?t===e?"[object Undefined]":"[object Null]":dt&&dt in Te(t)?function(t){var r=Ue.call(t,dt),n=t[dt];try{t[dt]=e;var i=!0}catch{}var o=je.call(t);return i&&(r?t[dt]=n:delete t[dt]),o}(t):function(e){return je.call(e)}(t)}function kn(e,t){return e>t}function Tn(e,t){return null!=e&&Ue.call(e,t)}function In(e,t){return null!=e&&t in Te(e)}function Rn(t,r,n){for(var i=n?Pt:Rt,o=t[0].length,s=t.length,a=s,c=Ee(s),l=1/0,u=[];a--;){var d=t[a];a&&r&&(d=Nt(d,Qt(r))),l=vr(d.length,l),c[a]=!n&&(r||o>=120&&d.length>=120)?new Zr(a&&d):e}d=t[0];var h=-1,p=c[0];e:for(;++h<o&&u.length<l;){var f=d[h],m=r?r(f):f;if(f=n||0!==f?f:0,!(p?Xt(p,m):i(u,m,n))){for(a=s;--a;){var g=c[a];if(!(g?Xt(g,m):i(t[a],m,n)))continue e}p&&p.push(m),u.push(f)}}return u}function Pn(t,r,n){var i=null==(t=Io(t,r=_i(r,t)))?t:t[Do(Yo(r))];return null==i?e:St(i,t,n)}function Nn(e){return na(e)&&An(e)==g}function Mn(t,r,n,i,o){return t===r||(null==t||null==r||!na(t)&&!na(r)?t!=t&&r!=r:function(t,r,n,i,o,s){var a=Vs(t),c=Vs(r),l=a?b:bo(t),u=c?b:bo(r),d=(l=l==g?S:l)==S,h=(u=u==g?S:u)==S,p=l==u;if(p&&Js(t)){if(!Js(r))return!1;a=!0,d=!1}if(p&&!d)return s||(s=new Jr),a||da(t)?no(t,r,n,i,o,s):function(e,t,r,n,i,o,s){switch(r){case N:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case P:return!(e.byteLength!=t.byteLength||!o(new Ke(e),new Ke(t)));case y:case w:case E:return Fs(+e,+t);case v:return e.name==t.name&&e.message==t.message;case A:case T:return e==t+"";case C:var a=sr;case k:var c=1&n;if(a||(a=lr),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;n|=2,s.set(e,t);var u=no(a(e),a(t),n,i,o,s);return s.delete(e),u;case I:if(Dr)return Dr.call(e)==Dr.call(t)}return!1}(t,r,l,n,i,o,s);if(!(1&n)){var f=d&&Ue.call(t,"__wrapped__"),m=h&&Ue.call(r,"__wrapped__");if(f||m){var _=f?t.value():t,$=m?r.value():r;return s||(s=new Jr),o(_,$,n,i,s)}}return!!p&&(s||(s=new Jr),function(t,r,n,i,o,s){var a=1&n,c=oo(t),l=c.length,u=oo(r),d=u.length;if(l!=d&&!a)return!1;for(var h=l;h--;){var p=c[h];if(!(a?p in r:Ue.call(r,p)))return!1}var f=s.get(t),m=s.get(r);if(f&&m)return f==r&&m==t;var g=!0;s.set(t,r),s.set(r,t);for(var b=a;++h<l;){var y=t[p=c[h]],w=r[p];if(i)var v=a?i(w,y,p,r,t,s):i(y,w,p,t,r,s);if(!(v===e?y===w||o(y,w,n,i,s):v)){g=!1;break}b||(b="constructor"==p)}if(g&&!b){var _=t.constructor,$=r.constructor;_!=$&&"constructor"in t&&"constructor"in r&&!("function"==typeof _&&_ instanceof _&&"function"==typeof $&&$ instanceof $)&&(g=!1)}return s.delete(t),s.delete(r),g}(t,r,n,i,o,s))}(t,r,n,i,Mn,o))}function Bn(t,r,n,i){var o=n.length,s=o,a=!i;if(null==t)return!s;for(t=Te(t);o--;){var c=n[o];if(a&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<s;){var l=(c=n[o])[0],u=t[l],d=c[1];if(a&&c[2]){if(u===e&&!(l in t))return!1}else{var h=new Jr;if(i)var p=i(u,d,l,t,r,h);if(!(p===e?Mn(d,u,3,i,h):p))return!1}}return!0}function On(e){return!(!ra(e)||function(e){return!!We&&We in e}(e))&&(Xs(e)?qe:ge).test(Wo(e))}function Ln(e){return"function"==typeof e?e:null==e?oc:"object"==typeof e?Vs(e)?zn(e[0],e[1]):Fn(e):fc(e)}function Un(e){if(!xo(e))return yr(e);var t=[];for(var r in Te(e))Ue.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Dn(e){if(!ra(e))return function(e){var t=[];if(null!=e)for(var r in Te(e))t.push(r);return t}(e);var t=xo(e),r=[];for(var n in e)"constructor"==n&&(t||!Ue.call(e,n))||r.push(n);return r}function Wn(e,t){return e<t}function jn(e,t){var r=-1,n=Gs(e)?Ee(e.length):[];return fn(e,(function(e,i,o){n[++r]=t(e,i,o)})),n}function Fn(e){var t=po(e);return 1==t.length&&t[0][2]?ko(t[0][0],t[0][1]):function(r){return r===e||Bn(r,e,t)}}function zn(t,r){return Co(t)&&Ao(r)?ko(Do(t),r):function(n){var i=ka(n,t);return i===e&&i===r?Ta(n,t):Mn(r,i,3)}}function qn(t,r,n,i,o){t!==r&&vn(r,(function(s,a){if(o||(o=new Jr),ra(s))!function(t,r,n,i,o,s,a){var c=Ro(t,n),l=Ro(r,n),u=a.get(l);if(u)tn(t,n,u);else{var d=s?s(c,l,n+"",t,r,a):e,h=d===e;if(h){var p=Vs(l),f=!p&&Js(l),m=!p&&!f&&da(l);d=l,p||f||m?Vs(c)?d=c:Zs(c)?d=Ri(c):f?(h=!1,d=Si(l,!0)):m?(h=!1,d=Ai(l,!0)):d=[]:sa(l)||Hs(l)?(d=c,Hs(c)?d=wa(c):(!ra(c)||Xs(c))&&(d=wo(l))):h=!1}h&&(a.set(l,d),o(d,l,i,s,a),a.delete(l)),tn(t,n,d)}}(t,r,a,n,qn,i,o);else{var c=i?i(Ro(t,a),s,a+"",t,r,o):e;c===e&&(c=s),tn(t,a,c)}}),Ma)}function Hn(t,r){var n=t.length;if(n)return _o(r+=r<0?n:0,n)?t[r]:e}function Vn(e,t,r){t=t.length?Nt(t,(function(e){return Vs(e)?function(t){return Sn(t,1===e.length?e[0]:e)}:e})):[oc];var n=-1;return t=Nt(t,Qt(uo())),function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(jn(e,(function(e,r,i){return{criteria:Nt(t,(function(t){return t(e)})),index:++n,value:e}})),(function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,s=i.length,a=r.length;++n<s;){var c=ki(i[n],o[n]);if(c)return n>=a?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function Kn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=Sn(e,s);r(a,s)&&ti(o,_i(s,e),a)}return o}function Gn(e,t,r,n){var i=n?Ft:jt,o=-1,s=t.length,a=e;for(e===t&&(t=Ri(t)),r&&(a=Nt(e,Qt(r)));++o<s;)for(var c=0,l=t[o],u=r?r(l):l;(c=i(a,u,c,n))>-1;)a!==e&&et.call(a,c,1),et.call(e,c,1);return e}function Zn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;_o(i)?et.call(e,i,1):pi(e,i)}}return e}function Jn(e,t){return e+Ut(Cr()*(t-e+1))}function Qn(e,t){var r="";if(!e||t<1||t>u)return r;do{t%2&&(r+=e),(t=Ut(t/2))&&(e+=e)}while(t);return r}function Yn(e,t){return Mo(To(e,t,oc),e+"")}function Xn(e){return Yr(Fa(e))}function ei(e,t){var r=Fa(e);return Lo(r,ln(t,0,r.length))}function ti(t,r,n,i){if(!ra(t))return t;for(var o=-1,s=(r=_i(r,t)).length,a=s-1,c=t;null!=c&&++o<s;){var l=Do(r[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(o!=a){var d=c[l];(u=i?i(d,l,c):e)===e&&(u=ra(d)?d:_o(r[o+1])?[]:{})}rn(c,l,u),c=c[l]}return t}var ri=Rr?function(e,t){return Rr.set(e,t),e}:oc,ni=ht?function(e,t){return ht(e,"toString",{configurable:!0,enumerable:!1,value:rc(t),writable:!0})}:oc;function ii(e){return Lo(Fa(e))}function oi(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Ee(i);++n<i;)o[n]=e[n+t];return o}function si(e,t){var r;return fn(e,(function(e,n,i){return!(r=t(e,n,i))})),!!r}function ai(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=f){for(;n<i;){var o=n+i>>>1,s=e[o];null!==s&&!ua(s)&&(r?s<=t:s<t)?n=o+1:i=o}return i}return ci(e,t,oc,r)}function ci(t,r,n,i){var o=0,s=null==t?0:t.length;if(0===s)return 0;for(var a=(r=n(r))!=r,c=null===r,l=ua(r),u=r===e;o<s;){var d=Ut((o+s)/2),h=n(t[d]),f=h!==e,m=null===h,g=h==h,b=ua(h);if(a)var y=i||g;else y=u?g&&(i||f):c?g&&f&&(i||!m):l?g&&f&&!m&&(i||!b):!m&&!b&&(i?h<=r:h<r);y?o=d+1:s=d}return vr(s,p)}function li(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r],a=t?t(s):s;if(!r||!Fs(a,c)){var c=a;o[i++]=0===s?0:s}}return o}function ui(e){return"number"==typeof e?e:ua(e)?d:+e}function di(e){if("string"==typeof e)return e;if(Vs(e))return Nt(e,di)+"";if(ua(e))return Wr?Wr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function hi(e,t,r){var n=-1,i=Rt,o=e.length,s=!0,a=[],c=a;if(r)s=!1,i=Pt;else if(o>=200){var l=t?null:Qi(e);if(l)return lr(l);s=!1,i=Xt,c=new Zr}else c=t?[]:a;e:for(;++n<o;){var u=e[n],d=t?t(u):u;if(u=r||0!==u?u:0,s&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),a.push(u)}else i(c,d,r)||(c!==a&&c.push(d),a.push(u))}return a}function pi(e,t){return null==(e=Io(e,t=_i(t,e)))||delete e[Do(Yo(t))]}function fi(e,t,r,n){return ti(e,t,r(Sn(e,t)),n)}function mi(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?oi(e,n?0:o,n?o+1:i):oi(e,n?o+1:0,n?i:o)}function gi(e,t){var r=e;return r instanceof Hr&&(r=r.value()),Bt(t,(function(e,t){return t.func.apply(t.thisArg,Mt([e],t.args))}),r)}function bi(e,t,r){var n=e.length;if(n<2)return n?hi(e[0]):[];for(var i=-1,o=Ee(n);++i<n;)for(var s=e[i],a=-1;++a<n;)a!=i&&(o[i]=pn(o[i]||s,e[a],t,r));return hi(wn(o,1),t,r)}function yi(t,r,n){for(var i=-1,o=t.length,s=r.length,a={};++i<o;){var c=i<s?r[i]:e;n(a,t[i],c)}return a}function wi(e){return Zs(e)?e:[]}function vi(e){return"function"==typeof e?e:oc}function _i(e,t){return Vs(e)?e:Co(e,t)?[e]:Uo(va(e))}var $i=Yn;function Ci(t,r,n){var i=t.length;return n=n===e?i:n,!r&&n>=i?t:oi(t,r,n)}var Ei=ft||function(e){return pt.clearTimeout(e)};function Si(e,t){if(t)return e.slice();var r=e.length,n=Ge?Ge(r):new e.constructor(r);return e.copy(n),n}function xi(e){var t=new e.constructor(e.byteLength);return new Ke(t).set(new Ke(e)),t}function Ai(e,t){var r=t?xi(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function ki(t,r){if(t!==r){var n=t!==e,i=null===t,o=t==t,s=ua(t),a=r!==e,c=null===r,l=r==r,u=ua(r);if(!c&&!u&&!s&&t>r||s&&a&&l&&!c&&!u||i&&a&&l||!n&&l||!o)return 1;if(!i&&!s&&!u&&t<r||u&&n&&o&&!i&&!s||c&&n&&o||!a&&o||!l)return-1}return 0}function Ti(e,t,r,n){for(var i=-1,o=e.length,s=r.length,a=-1,c=t.length,l=wr(o-s,0),u=Ee(c+l),d=!n;++a<c;)u[a]=t[a];for(;++i<s;)(d||i<o)&&(u[r[i]]=e[i]);for(;l--;)u[a++]=e[i++];return u}function Ii(e,t,r,n){for(var i=-1,o=e.length,s=-1,a=r.length,c=-1,l=t.length,u=wr(o-a,0),d=Ee(u+l),h=!n;++i<u;)d[i]=e[i];for(var p=i;++c<l;)d[p+c]=t[c];for(;++s<a;)(h||i<o)&&(d[p+r[s]]=e[i++]);return d}function Ri(e,t){var r=-1,n=e.length;for(t||(t=Ee(n));++r<n;)t[r]=e[r];return t}function Pi(t,r,n,i){var o=!n;n||(n={});for(var s=-1,a=r.length;++s<a;){var c=r[s],l=i?i(n[c],t[c],c,n,t):e;l===e&&(l=t[c]),o?an(n,c,l):rn(n,c,l)}return n}function Ni(e,t){return function(r,n){var i=Vs(r)?xt:on,o=t?t():{};return i(r,e,uo(n,2),o)}}function Mi(t){return Yn((function(r,n){var i=-1,o=n.length,s=o>1?n[o-1]:e,a=o>2?n[2]:e;for(s=t.length>3&&"function"==typeof s?(o--,s):e,a&&$o(n[0],n[1],a)&&(s=o<3?e:s,o=1),r=Te(r);++i<o;){var c=n[i];c&&t(r,c,i,s)}return r}))}function Bi(e,t){return function(r,n){if(null==r)return r;if(!Gs(r))return e(r,n);for(var i=r.length,o=t?i:-1,s=Te(r);(t?o--:++o<i)&&!1!==n(s[o],o,s););return r}}function Oi(e){return function(t,r,n){for(var i=-1,o=Te(t),s=n(t),a=s.length;a--;){var c=s[e?a:++i];if(!1===r(o[c],c,o))break}return t}}function Li(t){return function(r){var n=or(r=va(r))?dr(r):e,i=n?n[0]:r.charAt(0),o=n?Ci(n,1).join(""):r.slice(1);return i[t]()+o}}function Ui(e){return function(t){return Bt(Xa(Ha(t).replace(Ye,"")),e,"")}}function Di(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=Fr(e.prototype),n=e.apply(r,t);return ra(n)?n:r}}function Wi(t){return function(r,n,i){var o=Te(r);if(!Gs(r)){var s=uo(n,3);r=Na(r),n=function(e){return s(o[e],e,o)}}var a=t(r,n,i);return a>-1?o[s?r[a]:a]:e}}function ji(r){return io((function(n){var i=n.length,o=i,s=qr.prototype.thru;for(r&&n.reverse();o--;){var a=n[o];if("function"!=typeof a)throw new Pe(t);if(s&&!c&&"wrapper"==co(a))var c=new qr([],!0)}for(o=c?o:i;++o<i;){var l=co(a=n[o]),u="wrapper"==l?ao(a):e;c=u&&Eo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[co(u[0])].apply(c,u[3]):1==a.length&&Eo(a)?c[l]():c.thru(a)}return function(){var e=arguments,t=e[0];if(c&&1==e.length&&Vs(t))return c.plant(t).value();for(var r=0,o=i?n[r].apply(this,e):t;++r<i;)o=n[r].call(this,o);return o}}))}function Fi(t,r,n,i,o,s,c,l,u,d){var h=r&a,p=1&r,f=2&r,m=24&r,g=512&r,b=f?e:Di(t);return function a(){for(var y=arguments.length,w=Ee(y),v=y;v--;)w[v]=arguments[v];if(m)var _=lo(a),$=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(w,_);if(i&&(w=Ti(w,i,o,m)),s&&(w=Ii(w,s,c,m)),y-=$,m&&y<d){var C=cr(w,_);return Zi(t,r,Fi,a.placeholder,n,w,C,l,u,d-y)}var E=p?n:this,S=f?E[t]:t;return y=w.length,l?w=function(t,r){for(var n=t.length,i=vr(r.length,n),o=Ri(t);i--;){var s=r[i];t[i]=_o(s,n)?o[s]:e}return t}(w,l):g&&y>1&&w.reverse(),h&&u<y&&(w.length=u),this&&this!==pt&&this instanceof a&&(S=b||Di(S)),S.apply(E,w)}}function zi(e,t){return function(r,n){return function(e,t,r,n){return $n(e,(function(e,i,o){t(n,r(e),i,o)})),n}(r,e,t(n),{})}}function qi(t,r){return function(n,i){var o;if(n===e&&i===e)return r;if(n!==e&&(o=n),i!==e){if(o===e)return i;"string"==typeof n||"string"==typeof i?(n=di(n),i=di(i)):(n=ui(n),i=ui(i)),o=t(n,i)}return o}}function Hi(e){return io((function(t){return t=Nt(t,Qt(uo())),Yn((function(r){var n=this;return e(t,(function(e){return St(e,n,r)}))}))}))}function Vi(t,r){var n=(r=r===e?" ":di(r)).length;if(n<2)return n?Qn(r,t):r;var i=Qn(r,yt(t/ur(r)));return or(r)?Ci(dr(i),0,t).join(""):i.slice(0,t)}function Ki(t){return function(r,n,i){return i&&"number"!=typeof i&&$o(r,n,i)&&(n=i=e),r=ma(r),n===e?(n=r,r=0):n=ma(n),function(e,t,r,n){for(var i=-1,o=wr(yt((t-e)/(r||1)),0),s=Ee(o);o--;)s[n?o:++i]=e,e+=r;return s}(r,n,i=i===e?r<n?1:-1:ma(i),t)}}function Gi(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=ya(t),r=ya(r)),e(t,r)}}function Zi(t,r,n,i,a,c,l,u,d,h){var p=8&r;r|=p?o:s,4&(r&=~(p?s:o))||(r&=-4);var f=[t,r,a,p?c:e,p?l:e,p?e:c,p?e:l,u,d,h],m=n.apply(e,f);return Eo(t)&&Po(m,f),m.placeholder=i,Bo(m,t,r)}function Ji(e){var t=ke[e];return function(e,r){if(e=ya(e),(r=null==r?0:vr(ga(r),292))&&gr(e)){var n=(va(e)+"e").split("e");return+((n=(va(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Qi=kr&&1/lr(new kr([,-0]))[1]==l?function(e){return new kr(e)}:uc;function Yi(e){return function(t){var r=bo(t);return r==C?sr(t):r==k?function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=[e,e]})),r}(t):function(e,t){return Nt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xi(r,l,u,d,h,p,f,m){var g=2&l;if(!g&&"function"!=typeof r)throw new Pe(t);var b=d?d.length:0;if(b||(l&=-97,d=h=e),f=f===e?f:wr(ga(f),0),m=m===e?m:ga(m),b-=h?h.length:0,l&s){var y=d,w=h;d=h=e}var v=g?e:ao(r),_=[r,l,u,d,h,y,w,p,f,m];if(v&&function(e,t){var r=e[1],i=t[1],o=r|i,s=o<131,l=i==a&&8==r||i==a&&r==c&&e[7].length<=t[8]||384==i&&t[7].length<=t[8]&&8==r;if(!s&&!l)return e;1&i&&(e[2]=t[2],o|=1&r?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?Ti(d,u,t[4]):u,e[4]=d?cr(e[3],n):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ii(d,u,t[6]):u,e[6]=d?cr(e[5],n):t[6]),(u=t[7])&&(e[7]=u),i&a&&(e[8]=null==e[8]?t[8]:vr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(_,v),r=_[0],l=_[1],u=_[2],d=_[3],h=_[4],!(m=_[9]=_[9]===e?g?0:r.length:wr(_[9]-b,0))&&24&l&&(l&=-25),l&&1!=l)$=8==l||l==i?function(t,r,n){var i=Di(t);return function o(){for(var s=arguments.length,a=Ee(s),c=s,l=lo(o);c--;)a[c]=arguments[c];var u=s<3&&a[0]!==l&&a[s-1]!==l?[]:cr(a,l);return(s-=u.length)<n?Zi(t,r,Fi,o.placeholder,e,a,u,e,e,n-s):St(this&&this!==pt&&this instanceof o?i:t,this,a)}}(r,l,m):l!=o&&33!=l||h.length?Fi.apply(e,_):function(e,t,r,n){var i=1&t,o=Di(e);return function t(){for(var s=-1,a=arguments.length,c=-1,l=n.length,u=Ee(l+a),d=this&&this!==pt&&this instanceof t?o:e;++c<l;)u[c]=n[c];for(;a--;)u[c++]=arguments[++s];return St(d,i?r:this,u)}}(r,l,u,d);else var $=function(e,t,r){var n=1&t,i=Di(e);return function t(){return(this&&this!==pt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(r,l,u);return Bo((v?ri:Po)($,_),r,l)}function eo(t,r,n,i){return t===e||Fs(t,Be[n])&&!Ue.call(i,n)?r:t}function to(t,r,n,i,o,s){return ra(t)&&ra(r)&&(s.set(r,t),qn(t,r,e,to,s),s.delete(r)),t}function ro(t){return sa(t)?e:t}function no(t,r,n,i,o,s){var a=1&n,c=t.length,l=r.length;if(c!=l&&!(a&&l>c))return!1;var u=s.get(t),d=s.get(r);if(u&&d)return u==r&&d==t;var h=-1,p=!0,f=2&n?new Zr:e;for(s.set(t,r),s.set(r,t);++h<c;){var m=t[h],g=r[h];if(i)var b=a?i(g,m,h,r,t,s):i(m,g,h,t,r,s);if(b!==e){if(b)continue;p=!1;break}if(f){if(!Lt(r,(function(e,t){if(!Xt(f,t)&&(m===e||o(m,e,n,i,s)))return f.push(t)}))){p=!1;break}}else if(m!==g&&!o(m,g,n,i,s)){p=!1;break}}return s.delete(t),s.delete(r),p}function io(t){return Mo(To(t,e,Ko),t+"")}function oo(e){return xn(e,Na,mo)}function so(e){return xn(e,Ma,go)}var ao=Rr?function(e){return Rr.get(e)}:uc;function co(e){for(var t=e.name+"",r=Pr[t],n=Ue.call(Pr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function lo(e){return(Ue.call(jr,"placeholder")?jr:e).placeholder}function uo(){var e=jr.iteratee||sc;return e=e===sc?Ln:e,arguments.length?e(arguments[0],arguments[1]):e}function ho(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function po(e){for(var t=Na(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ao(i)]}return t}function fo(t,r){var n=function(t,r){return null==t?e:t[r]}(t,r);return On(n)?n:e}var mo=Vt?function(e){return null==e?[]:(e=Te(e),It(Vt(e),(function(t){return Qe.call(e,t)})))}:bc,go=Vt?function(e){for(var t=[];e;)Mt(t,mo(e)),e=Ze(e);return t}:bc,bo=An;function yo(e,t,r){for(var n=-1,i=(t=_i(t,e)).length,o=!1;++n<i;){var s=Do(t[n]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&ta(i)&&_o(s,i)&&(Vs(e)||Hs(e))}function wo(e){return"function"!=typeof e.constructor||xo(e)?{}:Fr(Ze(e))}function vo(e){return Vs(e)||Hs(e)||!!(rt&&e&&e[rt])}function _o(e,t){var r=typeof e;return!!(t=t??u)&&("number"==r||"symbol"!=r&&ye.test(e))&&e>-1&&e%1==0&&e<t}function $o(e,t,r){if(!ra(r))return!1;var n=typeof t;return!!("number"==n?Gs(r)&&_o(t,r.length):"string"==n&&t in r)&&Fs(r[t],e)}function Co(e,t){if(Vs(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ua(e))||ee.test(e)||!X.test(e)||null!=t&&e in Te(t)}function Eo(e){var t=co(e),r=jr[t];if("function"!=typeof r||!(t in Hr.prototype))return!1;if(e===r)return!0;var n=ao(r);return!!n&&e===n[0]}(Sr&&bo(new Sr(new ArrayBuffer(1)))!=N||xr&&bo(new xr)!=C||Ar&&bo(Ar.resolve())!=x||kr&&bo(new kr)!=k||Tr&&bo(new Tr)!=R)&&(bo=function(t){var r=An(t),n=r==S?t.constructor:e,i=n?Wo(n):"";if(i)switch(i){case Nr:return N;case Mr:return C;case Br:return x;case Or:return k;case Lr:return R}return r});var So=Oe?Xs:yc;function xo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Be)}function Ao(e){return e==e&&!ra(e)}function ko(t,r){return function(n){return null!=n&&n[t]===r&&(r!==e||t in Te(n))}}function To(t,r,n){return r=wr(r===e?t.length-1:r,0),function(){for(var e=arguments,i=-1,o=wr(e.length-r,0),s=Ee(o);++i<o;)s[i]=e[r+i];i=-1;for(var a=Ee(r+1);++i<r;)a[i]=e[i];return a[r]=n(s),St(t,this,a)}}function Io(e,t){return t.length<2?e:Sn(e,oi(t,0,-1))}function Ro(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Po=Oo(ri),No=bt||function(e,t){return pt.setTimeout(e,t)},Mo=Oo(ni);function Bo(e,t,r){var n=t+"";return Mo(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return At(m,(function(r){var n="_."+r[0];t&r[1]&&!Rt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ce):[]}(n),r)))}function Oo(t){var r=0,n=0;return function(){var i=_r(),o=16-(i-n);if(n=i,o>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(e,arguments)}}function Lo(t,r){var n=-1,i=t.length,o=i-1;for(r=r===e?i:r;++n<r;){var s=Jn(n,o),a=t[s];t[s]=t[n],t[n]=a}return t.length=r,t}var Uo=function(e){var t=Os(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(te,(function(e,r,n,i){t.push(n?i.replace(de,"$1"):r||e)})),t}));function Do(e){if("string"==typeof e||ua(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Wo(e){if(null!=e){try{return Le.call(e)}catch{}try{return e+""}catch{}}return""}function jo(e){if(e instanceof Hr)return e.clone();var t=new qr(e.__wrapped__,e.__chain__);return t.__actions__=Ri(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fo=Yn((function(e,t){return Zs(e)?pn(e,wn(t,1,Zs,!0)):[]})),zo=Yn((function(t,r){var n=Yo(r);return Zs(n)&&(n=e),Zs(t)?pn(t,wn(r,1,Zs,!0),uo(n,2)):[]})),qo=Yn((function(t,r){var n=Yo(r);return Zs(n)&&(n=e),Zs(t)?pn(t,wn(r,1,Zs,!0),e,n):[]}));function Ho(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ga(r);return i<0&&(i=wr(n+i,0)),Wt(e,uo(t,3),i)}function Vo(t,r,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==e&&(o=ga(n),o=n<0?wr(i+o,0):vr(o,i-1)),Wt(t,uo(r,3),o,!0)}function Ko(e){return null!=e&&e.length?wn(e,1):[]}function Go(t){return t&&t.length?t[0]:e}var Zo=Yn((function(e){var t=Nt(e,wi);return t.length&&t[0]===e[0]?Rn(t):[]})),Jo=Yn((function(t){var r=Yo(t),n=Nt(t,wi);return r===Yo(n)?r=e:n.pop(),n.length&&n[0]===t[0]?Rn(n,uo(r,2)):[]})),Qo=Yn((function(t){var r=Yo(t),n=Nt(t,wi);return(r="function"==typeof r?r:e)&&n.pop(),n.length&&n[0]===t[0]?Rn(n,e,r):[]}));function Yo(t){var r=null==t?0:t.length;return r?t[r-1]:e}var Xo=Yn(es);function es(e,t){return e&&e.length&&t&&t.length?Gn(e,t):e}var ts=io((function(e,t){var r=null==e?0:e.length,n=cn(e,t);return Zn(e,Nt(t,(function(e){return _o(e,r)?+e:e})).sort(ki)),n}));function rs(e){return null==e?e:Er.call(e)}var ns=Yn((function(e){return hi(wn(e,1,Zs,!0))})),is=Yn((function(t){var r=Yo(t);return Zs(r)&&(r=e),hi(wn(t,1,Zs,!0),uo(r,2))})),os=Yn((function(t){var r=Yo(t);return r="function"==typeof r?r:e,hi(wn(t,1,Zs,!0),e,r)}));function ss(e){if(!e||!e.length)return[];var t=0;return e=It(e,(function(e){if(Zs(e))return t=wr(e.length,t),!0})),Zt(t,(function(t){return Nt(e,Ht(t))}))}function as(t,r){if(!t||!t.length)return[];var n=ss(t);return null==r?n:Nt(n,(function(t){return St(r,e,t)}))}var cs=Yn((function(e,t){return Zs(e)?pn(e,t):[]})),ls=Yn((function(e){return bi(It(e,Zs))})),us=Yn((function(t){var r=Yo(t);return Zs(r)&&(r=e),bi(It(t,Zs),uo(r,2))})),ds=Yn((function(t){var r=Yo(t);return r="function"==typeof r?r:e,bi(It(t,Zs),e,r)})),hs=Yn(ss),ps=Yn((function(t){var r=t.length,n=r>1?t[r-1]:e;return n="function"==typeof n?(t.pop(),n):e,as(t,n)}));function fs(e){var t=jr(e);return t.__chain__=!0,t}function ms(e,t){return t(e)}var gs=io((function(t){var r=t.length,n=r?t[0]:0,i=this.__wrapped__,o=function(e){return cn(e,t)};return!(r>1||this.__actions__.length)&&i instanceof Hr&&_o(n)?((i=i.slice(n,+n+(r?1:0))).__actions__.push({func:ms,args:[o],thisArg:e}),new qr(i,this.__chain__).thru((function(t){return r&&!t.length&&t.push(e),t}))):this.thru(o)})),bs=Ni((function(e,t,r){Ue.call(e,r)?++e[r]:an(e,r,1)})),ys=Wi(Ho),ws=Wi(Vo);function vs(e,t){return(Vs(e)?At:fn)(e,uo(t,3))}function _s(e,t){return(Vs(e)?kt:mn)(e,uo(t,3))}var $s=Ni((function(e,t,r){Ue.call(e,r)?e[r].push(t):an(e,r,[t])})),Cs=Yn((function(e,t,r){var n=-1,i="function"==typeof t,o=Gs(e)?Ee(e.length):[];return fn(e,(function(e){o[++n]=i?St(t,e,r):Pn(e,t,r)})),o})),Es=Ni((function(e,t,r){an(e,r,t)}));function Ss(e,t){return(Vs(e)?Nt:jn)(e,uo(t,3))}var xs=Ni((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),As=Yn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&$o(e,t[0],t[1])?t=[]:r>2&&$o(t[0],t[1],t[2])&&(t=[t[0]]),Vn(e,wn(t,1),[])})),ks=mt||function(){return pt.Date.now()};function Ts(t,r,n){return r=n?e:r,r=t&&null==r?t.length:r,Xi(t,a,e,e,e,e,r)}function Is(r,n){var i;if("function"!=typeof n)throw new Pe(t);return r=ga(r),function(){return--r>0&&(i=n.apply(this,arguments)),r<=1&&(n=e),i}}var Rs=Yn((function(e,t,r){var n=1;if(r.length){var i=cr(r,lo(Rs));n|=o}return Xi(e,n,t,r,i)})),Ps=Yn((function(e,t,r){var n=3;if(r.length){var i=cr(r,lo(Ps));n|=o}return Xi(t,n,e,r,i)}));function Ns(r,n,i){var o,s,a,c,l,u,d=0,h=!1,p=!1,f=!0;if("function"!=typeof r)throw new Pe(t);function m(t){var n=o,i=s;return o=s=e,d=t,c=r.apply(i,n)}function g(t){var r=t-u;return u===e||r>=n||r<0||p&&t-d>=a}function b(){var e=ks();if(g(e))return y(e);l=No(b,function(e){var t=n-(e-u);return p?vr(t,a-(e-d)):t}(e))}function y(t){return l=e,f&&o?m(t):(o=s=e,c)}function w(){var t=ks(),r=g(t);if(o=arguments,s=this,u=t,r){if(l===e)return function(e){return d=e,l=No(b,n),h?m(e):c}(u);if(p)return Ei(l),l=No(b,n),m(u)}return l===e&&(l=No(b,n)),c}return n=ya(n)||0,ra(i)&&(h=!!i.leading,a=(p="maxWait"in i)?wr(ya(i.maxWait)||0,n):a,f="trailing"in i?!!i.trailing:f),w.cancel=function(){l!==e&&Ei(l),d=0,o=u=s=l=e},w.flush=function(){return l===e?c:y(ks())},w}var Ms=Yn((function(e,t){return hn(e,1,t)})),Bs=Yn((function(e,t,r){return hn(e,ya(t)||0,r)}));function Os(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new Pe(t);var n=function(){var t=arguments,i=r?r.apply(this,t):t[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,t);return n.cache=o.set(i,s)||o,s};return n.cache=new(Os.Cache||Gr),n}function Ls(e){if("function"!=typeof e)throw new Pe(t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Os.Cache=Gr;var Us=$i((function(e,t){var r=(t=1==t.length&&Vs(t[0])?Nt(t[0],Qt(uo())):Nt(wn(t,1),Qt(uo()))).length;return Yn((function(n){for(var i=-1,o=vr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),Ds=Yn((function(t,r){var n=cr(r,lo(Ds));return Xi(t,o,e,r,n)})),Ws=Yn((function(t,r){var n=cr(r,lo(Ws));return Xi(t,s,e,r,n)})),js=io((function(t,r){return Xi(t,c,e,e,e,r)}));function Fs(e,t){return e===t||e!=e&&t!=t}var zs=Gi(kn),qs=Gi((function(e,t){return e>=t})),Hs=Nn(function(){return arguments}())?Nn:function(e){return na(e)&&Ue.call(e,"callee")&&!Qe.call(e,"callee")},Vs=Ee.isArray,Ks=wt?Qt(wt):function(e){return na(e)&&An(e)==P};function Gs(e){return null!=e&&ta(e.length)&&!Xs(e)}function Zs(e){return na(e)&&Gs(e)}var Js=mr||yc,Qs=vt?Qt(vt):function(e){return na(e)&&An(e)==w};function Ys(e){if(!na(e))return!1;var t=An(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sa(e)}function Xs(e){if(!ra(e))return!1;var t=An(e);return t==_||t==$||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ea(e){return"number"==typeof e&&e==ga(e)}function ta(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function ra(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function na(e){return null!=e&&"object"==typeof e}var ia=_t?Qt(_t):function(e){return na(e)&&bo(e)==C};function oa(e){return"number"==typeof e||na(e)&&An(e)==E}function sa(e){if(!na(e)||An(e)!=S)return!1;var t=Ze(e);if(null===t)return!0;var r=Ue.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Le.call(r)==Fe}var aa=$t?Qt($t):function(e){return na(e)&&An(e)==A},ca=Ct?Qt(Ct):function(e){return na(e)&&bo(e)==k};function la(e){return"string"==typeof e||!Vs(e)&&na(e)&&An(e)==T}function ua(e){return"symbol"==typeof e||na(e)&&An(e)==I}var da=Et?Qt(Et):function(e){return na(e)&&ta(e.length)&&!!st[An(e)]},ha=Gi(Wn),pa=Gi((function(e,t){return e<=t}));function fa(e){if(!e)return[];if(Gs(e))return la(e)?dr(e):Ri(e);if(ct&&e[ct])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[ct]());var t=bo(e);return(t==C?sr:t==k?lr:Fa)(e)}function ma(e){return e?(e=ya(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ga(e){var t=ma(e),r=t%1;return t==t?r?t-r:t:0}function ba(e){return e?ln(ga(e),0,h):0}function ya(e){if("number"==typeof e)return e;if(ua(e))return d;if(ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Jt(e);var r=me.test(e);return r||be.test(e)?ut(e.slice(2),r?2:8):fe.test(e)?d:+e}function wa(e){return Pi(e,Ma(e))}function va(e){return null==e?"":di(e)}var _a=Mi((function(e,t){if(xo(t)||Gs(t))Pi(t,Na(t),e);else for(var r in t)Ue.call(t,r)&&rn(e,r,t[r])})),$a=Mi((function(e,t){Pi(t,Ma(t),e)})),Ca=Mi((function(e,t,r,n){Pi(t,Ma(t),e,n)})),Ea=Mi((function(e,t,r,n){Pi(t,Na(t),e,n)})),Sa=io(cn),xa=Yn((function(t,r){t=Te(t);var n=-1,i=r.length,o=i>2?r[2]:e;for(o&&$o(r[0],r[1],o)&&(i=1);++n<i;)for(var s=r[n],a=Ma(s),c=-1,l=a.length;++c<l;){var u=a[c],d=t[u];(d===e||Fs(d,Be[u])&&!Ue.call(t,u))&&(t[u]=s[u])}return t})),Aa=Yn((function(t){return t.push(e,to),St(Oa,e,t)}));function ka(t,r,n){var i=null==t?e:Sn(t,r);return i===e?n:i}function Ta(e,t){return null!=e&&yo(e,t,In)}var Ia=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=r}),rc(oc)),Ra=zi((function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),Ue.call(e,t)?e[t].push(r):e[t]=[r]}),uo),Pa=Yn(Pn);function Na(e){return Gs(e)?Qr(e):Un(e)}function Ma(e){return Gs(e)?Qr(e,!0):Dn(e)}var Ba=Mi((function(e,t,r){qn(e,t,r)})),Oa=Mi((function(e,t,r,n){qn(e,t,r,n)})),La=io((function(e,t){var r={};if(null==e)return r;var n=!1;t=Nt(t,(function(t){return t=_i(t,e),n||(n=t.length>1),t})),Pi(e,so(e),r),n&&(r=un(r,7,ro));for(var i=t.length;i--;)pi(r,t[i]);return r})),Ua=io((function(e,t){return null==e?{}:function(e,t){return Kn(e,t,(function(t,r){return Ta(e,r)}))}(e,t)}));function Da(e,t){if(null==e)return{};var r=Nt(so(e),(function(e){return[e]}));return t=uo(t),Kn(e,r,(function(e,r){return t(e,r[0])}))}var Wa=Yi(Na),ja=Yi(Ma);function Fa(e){return null==e?[]:Yt(e,Na(e))}var za=Ui((function(e,t,r){return t=t.toLowerCase(),e+(r?qa(t):t)}));function qa(e){return Ya(va(e).toLowerCase())}function Ha(e){return(e=va(e))&&e.replace(we,rr).replace(Xe,"")}var Va=Ui((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Ka=Ui((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ga=Li("toLowerCase"),Za=Ui((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Ja=Ui((function(e,t,r){return e+(r?" ":"")+Ya(t)})),Qa=Ui((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Ya=Li("toUpperCase");function Xa(t,r,n){return t=va(t),(r=n?e:r)===e?function(e){return nt.test(e)}(t)?function(e){return e.match(tt)||[]}(t):function(e){return e.match(le)||[]}(t):t.match(r)||[]}var ec=Yn((function(t,r){try{return St(t,e,r)}catch(n){return Ys(n)?n:new xe(n)}})),tc=io((function(e,t){return At(t,(function(t){t=Do(t),an(e,t,Rs(e[t],e))})),e}));function rc(e){return function(){return e}}var nc=ji(),ic=ji(!0);function oc(e){return e}function sc(e){return Ln("function"==typeof e?e:un(e,1))}var ac=Yn((function(e,t){return function(r){return Pn(r,e,t)}})),cc=Yn((function(e,t){return function(r){return Pn(e,r,t)}}));function lc(e,t,r){var n=Na(t),i=En(t,n);null==r&&(!ra(t)||!i.length&&n.length)&&(r=t,t=e,e=this,i=En(t,Na(t)));var o=!(ra(r)&&"chain"in r&&!r.chain),s=Xs(e);return At(i,(function(r){var n=t[r];e[r]=n,s&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ri(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Mt([this.value()],arguments))})})),e}function uc(){}var dc=Hi(Nt),hc=Hi(Tt),pc=Hi(Lt);function fc(e){return Co(e)?Ht(Do(e)):function(e){return function(t){return Sn(t,e)}}(e)}var mc=Ki(),gc=Ki(!0);function bc(){return[]}function yc(){return!1}var wc=qi((function(e,t){return e+t}),0),vc=Ji("ceil"),_c=qi((function(e,t){return e/t}),1),$c=Ji("floor"),Cc=qi((function(e,t){return e*t}),1),Ec=Ji("round"),Sc=qi((function(e,t){return e-t}),0);return jr.after=function(e,r){if("function"!=typeof r)throw new Pe(t);return e=ga(e),function(){if(--e<1)return r.apply(this,arguments)}},jr.ary=Ts,jr.assign=_a,jr.assignIn=$a,jr.assignInWith=Ca,jr.assignWith=Ea,jr.at=Sa,jr.before=Is,jr.bind=Rs,jr.bindAll=tc,jr.bindKey=Ps,jr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Vs(e)?e:[e]},jr.chain=fs,jr.chunk=function(t,r,n){r=(n?$o(t,r,n):r===e)?1:wr(ga(r),0);var i=null==t?0:t.length;if(!i||r<1)return[];for(var o=0,s=0,a=Ee(yt(i/r));o<i;)a[s++]=oi(t,o,o+=r);return a},jr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},jr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Ee(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Mt(Vs(r)?Ri(r):[r],wn(t,1))},jr.cond=function(e){var r=null==e?0:e.length,n=uo();return e=r?Nt(e,(function(e){if("function"!=typeof e[1])throw new Pe(t);return[n(e[0]),e[1]]})):[],Yn((function(t){for(var n=-1;++n<r;){var i=e[n];if(St(i[0],this,t))return St(i[1],this,t)}}))},jr.conforms=function(e){return function(e){var t=Na(e);return function(r){return dn(r,e,t)}}(un(e,1))},jr.constant=rc,jr.countBy=bs,jr.create=function(e,t){var r=Fr(e);return null==t?r:sn(r,t)},jr.curry=function t(r,n,i){var o=Xi(r,8,e,e,e,e,e,n=i?e:n);return o.placeholder=t.placeholder,o},jr.curryRight=function t(r,n,o){var s=Xi(r,i,e,e,e,e,e,n=o?e:n);return s.placeholder=t.placeholder,s},jr.debounce=Ns,jr.defaults=xa,jr.defaultsDeep=Aa,jr.defer=Ms,jr.delay=Bs,jr.difference=Fo,jr.differenceBy=zo,jr.differenceWith=qo,jr.drop=function(t,r,n){var i=null==t?0:t.length;return i?oi(t,(r=n||r===e?1:ga(r))<0?0:r,i):[]},jr.dropRight=function(t,r,n){var i=null==t?0:t.length;return i?oi(t,0,(r=i-(r=n||r===e?1:ga(r)))<0?0:r):[]},jr.dropRightWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!0,!0):[]},jr.dropWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!0):[]},jr.fill=function(t,r,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&$o(t,r,n)&&(n=0,i=o),function(t,r,n,i){var o=t.length;for((n=ga(n))<0&&(n=-n>o?0:o+n),(i=i===e||i>o?o:ga(i))<0&&(i+=o),i=n>i?0:ba(i);n<i;)t[n++]=r;return t}(t,r,n,i)):[]},jr.filter=function(e,t){return(Vs(e)?It:yn)(e,uo(t,3))},jr.flatMap=function(e,t){return wn(Ss(e,t),1)},jr.flatMapDeep=function(e,t){return wn(Ss(e,t),l)},jr.flatMapDepth=function(t,r,n){return n=n===e?1:ga(n),wn(Ss(t,r),n)},jr.flatten=Ko,jr.flattenDeep=function(e){return null!=e&&e.length?wn(e,l):[]},jr.flattenDepth=function(t,r){return null!=t&&t.length?wn(t,r=r===e?1:ga(r)):[]},jr.flip=function(e){return Xi(e,512)},jr.flow=nc,jr.flowRight=ic,jr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},jr.functions=function(e){return null==e?[]:En(e,Na(e))},jr.functionsIn=function(e){return null==e?[]:En(e,Ma(e))},jr.groupBy=$s,jr.initial=function(e){return null!=e&&e.length?oi(e,0,-1):[]},jr.intersection=Zo,jr.intersectionBy=Jo,jr.intersectionWith=Qo,jr.invert=Ia,jr.invertBy=Ra,jr.invokeMap=Cs,jr.iteratee=sc,jr.keyBy=Es,jr.keys=Na,jr.keysIn=Ma,jr.map=Ss,jr.mapKeys=function(e,t){var r={};return t=uo(t,3),$n(e,(function(e,n,i){an(r,t(e,n,i),e)})),r},jr.mapValues=function(e,t){var r={};return t=uo(t,3),$n(e,(function(e,n,i){an(r,n,t(e,n,i))})),r},jr.matches=function(e){return Fn(un(e,1))},jr.matchesProperty=function(e,t){return zn(e,un(t,1))},jr.memoize=Os,jr.merge=Ba,jr.mergeWith=Oa,jr.method=ac,jr.methodOf=cc,jr.mixin=lc,jr.negate=Ls,jr.nthArg=function(e){return e=ga(e),Yn((function(t){return Hn(t,e)}))},jr.omit=La,jr.omitBy=function(e,t){return Da(e,Ls(uo(t)))},jr.once=function(e){return Is(2,e)},jr.orderBy=function(t,r,n,i){return null==t?[]:(Vs(r)||(r=null==r?[]:[r]),Vs(n=i?e:n)||(n=null==n?[]:[n]),Vn(t,r,n))},jr.over=dc,jr.overArgs=Us,jr.overEvery=hc,jr.overSome=pc,jr.partial=Ds,jr.partialRight=Ws,jr.partition=xs,jr.pick=Ua,jr.pickBy=Da,jr.property=fc,jr.propertyOf=function(t){return function(r){return null==t?e:Sn(t,r)}},jr.pull=Xo,jr.pullAll=es,jr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?Gn(e,t,uo(r,2)):e},jr.pullAllWith=function(t,r,n){return t&&t.length&&r&&r.length?Gn(t,r,e,n):t},jr.pullAt=ts,jr.range=mc,jr.rangeRight=gc,jr.rearg=js,jr.reject=function(e,t){return(Vs(e)?It:yn)(e,Ls(uo(t,3)))},jr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=uo(t,3);++n<o;){var s=e[n];t(s,n,e)&&(r.push(s),i.push(n))}return Zn(e,i),r},jr.rest=function(r,n){if("function"!=typeof r)throw new Pe(t);return Yn(r,n=n===e?n:ga(n))},jr.reverse=rs,jr.sampleSize=function(t,r,n){return r=(n?$o(t,r,n):r===e)?1:ga(r),(Vs(t)?Xr:ei)(t,r)},jr.set=function(e,t,r){return null==e?e:ti(e,t,r)},jr.setWith=function(t,r,n,i){return i="function"==typeof i?i:e,null==t?t:ti(t,r,n,i)},jr.shuffle=function(e){return(Vs(e)?en:ii)(e)},jr.slice=function(t,r,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&$o(t,r,n)?(r=0,n=i):(r=null==r?0:ga(r),n=n===e?i:ga(n)),oi(t,r,n)):[]},jr.sortBy=As,jr.sortedUniq=function(e){return e&&e.length?li(e):[]},jr.sortedUniqBy=function(e,t){return e&&e.length?li(e,uo(t,2)):[]},jr.split=function(t,r,n){return n&&"number"!=typeof n&&$o(t,r,n)&&(r=n=e),(n=n===e?h:n>>>0)?(t=va(t))&&("string"==typeof r||null!=r&&!aa(r))&&!(r=di(r))&&or(t)?Ci(dr(t),0,n):t.split(r,n):[]},jr.spread=function(e,r){if("function"!=typeof e)throw new Pe(t);return r=null==r?0:wr(ga(r),0),Yn((function(t){var n=t[r],i=Ci(t,0,r);return n&&Mt(i,n),St(e,this,i)}))},jr.tail=function(e){var t=null==e?0:e.length;return t?oi(e,1,t):[]},jr.take=function(t,r,n){return t&&t.length?oi(t,0,(r=n||r===e?1:ga(r))<0?0:r):[]},jr.takeRight=function(t,r,n){var i=null==t?0:t.length;return i?oi(t,(r=i-(r=n||r===e?1:ga(r)))<0?0:r,i):[]},jr.takeRightWhile=function(e,t){return e&&e.length?mi(e,uo(t,3),!1,!0):[]},jr.takeWhile=function(e,t){return e&&e.length?mi(e,uo(t,3)):[]},jr.tap=function(e,t){return t(e),e},jr.throttle=function(e,r,n){var i=!0,o=!0;if("function"!=typeof e)throw new Pe(t);return ra(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),Ns(e,r,{leading:i,maxWait:r,trailing:o})},jr.thru=ms,jr.toArray=fa,jr.toPairs=Wa,jr.toPairsIn=ja,jr.toPath=function(e){return Vs(e)?Nt(e,Do):ua(e)?[e]:Ri(Uo(va(e)))},jr.toPlainObject=wa,jr.transform=function(e,t,r){var n=Vs(e),i=n||Js(e)||da(e);if(t=uo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:ra(e)&&Xs(o)?Fr(Ze(e)):{}}return(i?At:$n)(e,(function(e,n,i){return t(r,e,n,i)})),r},jr.unary=function(e){return Ts(e,1)},jr.union=ns,jr.unionBy=is,jr.unionWith=os,jr.uniq=function(e){return e&&e.length?hi(e):[]},jr.uniqBy=function(e,t){return e&&e.length?hi(e,uo(t,2)):[]},jr.uniqWith=function(t,r){return r="function"==typeof r?r:e,t&&t.length?hi(t,e,r):[]},jr.unset=function(e,t){return null==e||pi(e,t)},jr.unzip=ss,jr.unzipWith=as,jr.update=function(e,t,r){return null==e?e:fi(e,t,vi(r))},jr.updateWith=function(t,r,n,i){return i="function"==typeof i?i:e,null==t?t:fi(t,r,vi(n),i)},jr.values=Fa,jr.valuesIn=function(e){return null==e?[]:Yt(e,Ma(e))},jr.without=cs,jr.words=Xa,jr.wrap=function(e,t){return Ds(vi(t),e)},jr.xor=ls,jr.xorBy=us,jr.xorWith=ds,jr.zip=hs,jr.zipObject=function(e,t){return yi(e||[],t||[],rn)},jr.zipObjectDeep=function(e,t){return yi(e||[],t||[],ti)},jr.zipWith=ps,jr.entries=Wa,jr.entriesIn=ja,jr.extend=$a,jr.extendWith=Ca,lc(jr,jr),jr.add=wc,jr.attempt=ec,jr.camelCase=za,jr.capitalize=qa,jr.ceil=vc,jr.clamp=function(t,r,n){return n===e&&(n=r,r=e),n!==e&&(n=(n=ya(n))==n?n:0),r!==e&&(r=(r=ya(r))==r?r:0),ln(ya(t),r,n)},jr.clone=function(e){return un(e,4)},jr.cloneDeep=function(e){return un(e,5)},jr.cloneDeepWith=function(t,r){return un(t,5,r="function"==typeof r?r:e)},jr.cloneWith=function(t,r){return un(t,4,r="function"==typeof r?r:e)},jr.conformsTo=function(e,t){return null==t||dn(e,t,Na(t))},jr.deburr=Ha,jr.defaultTo=function(e,t){return null==e||e!=e?t:e},jr.divide=_c,jr.endsWith=function(t,r,n){t=va(t),r=di(r);var i=t.length,o=n=n===e?i:ln(ga(n),0,i);return(n-=r.length)>=0&&t.slice(n,o)==r},jr.eq=Fs,jr.escape=function(e){return(e=va(e))&&Z.test(e)?e.replace(K,nr):e},jr.escapeRegExp=function(e){return(e=va(e))&&ne.test(e)?e.replace(re,"\\$&"):e},jr.every=function(t,r,n){var i=Vs(t)?Tt:gn;return n&&$o(t,r,n)&&(r=e),i(t,uo(r,3))},jr.find=ys,jr.findIndex=Ho,jr.findKey=function(e,t){return Dt(e,uo(t,3),$n)},jr.findLast=ws,jr.findLastIndex=Vo,jr.findLastKey=function(e,t){return Dt(e,uo(t,3),Cn)},jr.floor=$c,jr.forEach=vs,jr.forEachRight=_s,jr.forIn=function(e,t){return null==e?e:vn(e,uo(t,3),Ma)},jr.forInRight=function(e,t){return null==e?e:_n(e,uo(t,3),Ma)},jr.forOwn=function(e,t){return e&&$n(e,uo(t,3))},jr.forOwnRight=function(e,t){return e&&Cn(e,uo(t,3))},jr.get=ka,jr.gt=zs,jr.gte=qs,jr.has=function(e,t){return null!=e&&yo(e,t,Tn)},jr.hasIn=Ta,jr.head=Go,jr.identity=oc,jr.includes=function(e,t,r,n){e=Gs(e)?e:Fa(e),r=r&&!n?ga(r):0;var i=e.length;return r<0&&(r=wr(i+r,0)),la(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&jt(e,t,r)>-1},jr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ga(r);return i<0&&(i=wr(n+i,0)),jt(e,t,i)},jr.inRange=function(t,r,n){return r=ma(r),n===e?(n=r,r=0):n=ma(n),function(e,t,r){return e>=vr(t,r)&&e<wr(t,r)}(t=ya(t),r,n)},jr.invoke=Pa,jr.isArguments=Hs,jr.isArray=Vs,jr.isArrayBuffer=Ks,jr.isArrayLike=Gs,jr.isArrayLikeObject=Zs,jr.isBoolean=function(e){return!0===e||!1===e||na(e)&&An(e)==y},jr.isBuffer=Js,jr.isDate=Qs,jr.isElement=function(e){return na(e)&&1===e.nodeType&&!sa(e)},jr.isEmpty=function(e){if(null==e)return!0;if(Gs(e)&&(Vs(e)||"string"==typeof e||"function"==typeof e.splice||Js(e)||da(e)||Hs(e)))return!e.length;var t=bo(e);if(t==C||t==k)return!e.size;if(xo(e))return!Un(e).length;for(var r in e)if(Ue.call(e,r))return!1;return!0},jr.isEqual=function(e,t){return Mn(e,t)},jr.isEqualWith=function(t,r,n){var i=(n="function"==typeof n?n:e)?n(t,r):e;return i===e?Mn(t,r,e,n):!!i},jr.isError=Ys,jr.isFinite=function(e){return"number"==typeof e&&gr(e)},jr.isFunction=Xs,jr.isInteger=ea,jr.isLength=ta,jr.isMap=ia,jr.isMatch=function(e,t){return e===t||Bn(e,t,po(t))},jr.isMatchWith=function(t,r,n){return n="function"==typeof n?n:e,Bn(t,r,po(r),n)},jr.isNaN=function(e){return oa(e)&&e!=+e},jr.isNative=function(e){if(So(e))throw new xe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return On(e)},jr.isNil=function(e){return null==e},jr.isNull=function(e){return null===e},jr.isNumber=oa,jr.isObject=ra,jr.isObjectLike=na,jr.isPlainObject=sa,jr.isRegExp=aa,jr.isSafeInteger=function(e){return ea(e)&&e>=-u&&e<=u},jr.isSet=ca,jr.isString=la,jr.isSymbol=ua,jr.isTypedArray=da,jr.isUndefined=function(t){return t===e},jr.isWeakMap=function(e){return na(e)&&bo(e)==R},jr.isWeakSet=function(e){return na(e)&&"[object WeakSet]"==An(e)},jr.join=function(e,t){return null==e?"":br.call(e,t)},jr.kebabCase=Va,jr.last=Yo,jr.lastIndexOf=function(t,r,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==e&&(o=(o=ga(n))<0?wr(i+o,0):vr(o,i-1)),r==r?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(t,r,o):Wt(t,zt,o,!0)},jr.lowerCase=Ka,jr.lowerFirst=Ga,jr.lt=ha,jr.lte=pa,jr.max=function(t){return t&&t.length?bn(t,oc,kn):e},jr.maxBy=function(t,r){return t&&t.length?bn(t,uo(r,2),kn):e},jr.mean=function(e){return qt(e,oc)},jr.meanBy=function(e,t){return qt(e,uo(t,2))},jr.min=function(t){return t&&t.length?bn(t,oc,Wn):e},jr.minBy=function(t,r){return t&&t.length?bn(t,uo(r,2),Wn):e},jr.stubArray=bc,jr.stubFalse=yc,jr.stubObject=function(){return{}},jr.stubString=function(){return""},jr.stubTrue=function(){return!0},jr.multiply=Cc,jr.nth=function(t,r){return t&&t.length?Hn(t,ga(r)):e},jr.noConflict=function(){return pt._===this&&(pt._=ze),this},jr.noop=uc,jr.now=ks,jr.pad=function(e,t,r){e=va(e);var n=(t=ga(t))?ur(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Vi(Ut(i),r)+e+Vi(yt(i),r)},jr.padEnd=function(e,t,r){e=va(e);var n=(t=ga(t))?ur(e):0;return t&&n<t?e+Vi(t-n,r):e},jr.padStart=function(e,t,r){e=va(e);var n=(t=ga(t))?ur(e):0;return t&&n<t?Vi(t-n,r)+e:e},jr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),$r(va(e).replace(ie,""),t||0)},jr.random=function(t,r,n){if(n&&"boolean"!=typeof n&&$o(t,r,n)&&(r=n=e),n===e&&("boolean"==typeof r?(n=r,r=e):"boolean"==typeof t&&(n=t,t=e)),t===e&&r===e?(t=0,r=1):(t=ma(t),r===e?(r=t,t=0):r=ma(r)),t>r){var i=t;t=r,r=i}if(n||t%1||r%1){var o=Cr();return vr(t+o*(r-t+lt("1e-"+((o+"").length-1))),r)}return Jn(t,r)},jr.reduce=function(e,t,r){var n=Vs(e)?Bt:Kt,i=arguments.length<3;return n(e,uo(t,4),r,i,fn)},jr.reduceRight=function(e,t,r){var n=Vs(e)?Ot:Kt,i=arguments.length<3;return n(e,uo(t,4),r,i,mn)},jr.repeat=function(t,r,n){return r=(n?$o(t,r,n):r===e)?1:ga(r),Qn(va(t),r)},jr.replace=function(){var e=arguments,t=va(e[0]);return e.length<3?t:t.replace(e[1],e[2])},jr.result=function(t,r,n){var i=-1,o=(r=_i(r,t)).length;for(o||(o=1,t=e);++i<o;){var s=null==t?e:t[Do(r[i])];s===e&&(i=o,s=n),t=Xs(s)?s.call(t):s}return t},jr.round=Ec,jr.runInContext=oe,jr.sample=function(e){return(Vs(e)?Yr:Xn)(e)},jr.size=function(e){if(null==e)return 0;if(Gs(e))return la(e)?ur(e):e.length;var t=bo(e);return t==C||t==k?e.size:Un(e).length},jr.snakeCase=Za,jr.some=function(t,r,n){var i=Vs(t)?Lt:si;return n&&$o(t,r,n)&&(r=e),i(t,uo(r,3))},jr.sortedIndex=function(e,t){return ai(e,t)},jr.sortedIndexBy=function(e,t,r){return ci(e,t,uo(r,2))},jr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ai(e,t);if(n<r&&Fs(e[n],t))return n}return-1},jr.sortedLastIndex=function(e,t){return ai(e,t,!0)},jr.sortedLastIndexBy=function(e,t,r){return ci(e,t,uo(r,2),!0)},jr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ai(e,t,!0)-1;if(Fs(e[r],t))return r}return-1},jr.startCase=Ja,jr.startsWith=function(e,t,r){return e=va(e),r=null==r?0:ln(ga(r),0,e.length),t=di(t),e.slice(r,r+t.length)==t},jr.subtract=Sc,jr.sum=function(e){return e&&e.length?Gt(e,oc):0},jr.sumBy=function(e,t){return e&&e.length?Gt(e,uo(t,2)):0},jr.template=function(t,r,n){var i=jr.templateSettings;n&&$o(t,r,n)&&(r=e),t=va(t),r=Ca({},r,i,eo);var o,s,a=Ca({},r.imports,i.imports,eo),c=Na(a),l=Yt(a,c),u=0,d=r.interpolate||ve,h="__p += '",p=Ie((r.escape||ve).source+"|"+d.source+"|"+(d===Y?he:ve).source+"|"+(r.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(Ue.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ot+"]")+"\n";t.replace(p,(function(e,r,n,i,a,c){return n||(n=i),h+=t.slice(u,c).replace(_e,ir),r&&(o=!0,h+="' +\n__e("+r+") +\n'"),a&&(s=!0,h+="';\n"+a+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=c+e.length,e})),h+="';\n";var m=Ue.call(r,"variable")&&r.variable;if(m){if(ue.test(m))throw new xe("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(s?h.replace(z,""):h).replace(q,"$1").replace(H,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=ec((function(){return Ae(c,f+"return "+h).apply(e,l)}));if(g.source=h,Ys(g))throw g;return g},jr.times=function(e,t){if((e=ga(e))<1||e>u)return[];var r=h,n=vr(e,h);t=uo(t),e-=h;for(var i=Zt(n,t);++r<e;)t(r);return i},jr.toFinite=ma,jr.toInteger=ga,jr.toLength=ba,jr.toLower=function(e){return va(e).toLowerCase()},jr.toNumber=ya,jr.toSafeInteger=function(e){return e?ln(ga(e),-u,u):0===e?e:0},jr.toString=va,jr.toUpper=function(e){return va(e).toUpperCase()},jr.trim=function(t,r,n){if((t=va(t))&&(n||r===e))return Jt(t);if(!t||!(r=di(r)))return t;var i=dr(t),o=dr(r);return Ci(i,er(i,o),tr(i,o)+1).join("")},jr.trimEnd=function(t,r,n){if((t=va(t))&&(n||r===e))return t.slice(0,hr(t)+1);if(!t||!(r=di(r)))return t;var i=dr(t);return Ci(i,0,tr(i,dr(r))+1).join("")},jr.trimStart=function(t,r,n){if((t=va(t))&&(n||r===e))return t.replace(ie,"");if(!t||!(r=di(r)))return t;var i=dr(t);return Ci(i,er(i,dr(r))).join("")},jr.truncate=function(t,r){var n=30,i="...";if(ra(r)){var o="separator"in r?r.separator:o;n="length"in r?ga(r.length):n,i="omission"in r?di(r.omission):i}var s=(t=va(t)).length;if(or(t)){var a=dr(t);s=a.length}if(n>=s)return t;var c=n-ur(i);if(c<1)return i;var l=a?Ci(a,0,c).join(""):t.slice(0,c);if(o===e)return l+i;if(a&&(c+=l.length-c),aa(o)){if(t.slice(c).search(o)){var u,d=l;for(o.global||(o=Ie(o.source,va(pe.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;l=l.slice(0,h===e?c:h)}}else if(t.indexOf(di(o),c)!=c){var p=l.lastIndexOf(o);p>-1&&(l=l.slice(0,p))}return l+i},jr.unescape=function(e){return(e=va(e))&&G.test(e)?e.replace(V,pr):e},jr.uniqueId=function(e){var t=++De;return va(e)+t},jr.upperCase=Qa,jr.upperFirst=Ya,jr.each=vs,jr.eachRight=_s,jr.first=Go,lc(jr,function(){var e={};return $n(jr,(function(t,r){Ue.call(jr.prototype,r)||(e[r]=t)})),e}(),{chain:!1}),jr.VERSION="4.17.21",At(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){jr[e].placeholder=jr})),At(["drop","take"],(function(t,r){Hr.prototype[t]=function(n){n=n===e?1:wr(ga(n),0);var i=this.__filtered__&&!r?new Hr(this):this.clone();return i.__filtered__?i.__takeCount__=vr(n,i.__takeCount__):i.__views__.push({size:vr(n,h),type:t+(i.__dir__<0?"Right":"")}),i},Hr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),At(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Hr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:uo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),At(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Hr.prototype[e]=function(){return this[r](1).value()[0]}})),At(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Hr.prototype[e]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(oc)},Hr.prototype.find=function(e){return this.filter(e).head()},Hr.prototype.findLast=function(e){return this.reverse().find(e)},Hr.prototype.invokeMap=Yn((function(e,t){return"function"==typeof e?new Hr(this):this.map((function(r){return Pn(r,e,t)}))})),Hr.prototype.reject=function(e){return this.filter(Ls(uo(e)))},Hr.prototype.slice=function(t,r){t=ga(t);var n=this;return n.__filtered__&&(t>0||r<0)?new Hr(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),r!==e&&(n=(r=ga(r))<0?n.dropRight(-r):n.take(r-t)),n)},Hr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hr.prototype.toArray=function(){return this.take(h)},$n(Hr.prototype,(function(t,r){var n=/^(?:filter|find|map|reject)|While$/.test(r),i=/^(?:head|last)$/.test(r),o=jr[i?"take"+("last"==r?"Right":""):r],s=i||/^find/.test(r);o&&(jr.prototype[r]=function(){var r=this.__wrapped__,a=i?[1]:arguments,c=r instanceof Hr,l=a[0],u=c||Vs(r),d=function(e){var t=o.apply(jr,Mt([e],a));return i&&h?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(c=u=!1);var h=this.__chain__,p=!!this.__actions__.length,f=s&&!h,m=c&&!p;if(!s&&u){r=m?r:new Hr(this);var g=t.apply(r,a);return g.__actions__.push({func:ms,args:[d],thisArg:e}),new qr(g,h)}return f&&m?t.apply(this,a):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})})),At(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ne[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);jr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Vs(i)?i:[],e)}return this[r]((function(r){return t.apply(Vs(r)?r:[],e)}))}})),$n(Hr.prototype,(function(e,t){var r=jr[t];if(r){var n=r.name+"";Ue.call(Pr,n)||(Pr[n]=[]),Pr[n].push({name:t,func:r})}})),Pr[Fi(e,2).name]=[{name:"wrapper",func:e}],Hr.prototype.clone=function(){var e=new Hr(this.__wrapped__);return e.__actions__=Ri(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ri(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ri(this.__views__),e},Hr.prototype.reverse=function(){if(this.__filtered__){var e=new Hr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Vs(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],s=o.size;switch(o.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=vr(t,e+s);break;case"takeRight":e=wr(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=o.start,a=o.end,c=a-s,l=n?a:s-1,u=this.__iteratees__,d=u.length,h=0,p=vr(c,this.__takeCount__);if(!r||!n&&i==c&&p==c)return gi(e,this.__actions__);var f=[];e:for(;c--&&h<p;){for(var m=-1,g=e[l+=t];++m<d;){var b=u[m],y=b.iteratee,w=b.type,v=y(g);if(2==w)g=v;else if(!v){if(1==w)continue e;break e}}f[h++]=g}return f},jr.prototype.at=gs,jr.prototype.chain=function(){return fs(this)},jr.prototype.commit=function(){return new qr(this.value(),this.__chain__)},jr.prototype.next=function(){this.__values__===e&&(this.__values__=fa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?e:this.__values__[this.__index__++]}},jr.prototype.plant=function(t){for(var r,n=this;n instanceof zr;){var i=jo(n);i.__index__=0,i.__values__=e,r?o.__wrapped__=i:r=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,r},jr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hr){var r=t;return this.__actions__.length&&(r=new Hr(this)),(r=r.reverse()).__actions__.push({func:ms,args:[rs],thisArg:e}),new qr(r,this.__chain__)}return this.thru(rs)},jr.prototype.toJSON=jr.prototype.valueOf=jr.prototype.value=function(){return gi(this.__wrapped__,this.__actions__)},jr.prototype.first=jr.prototype.head,ct&&(jr.prototype[ct]=function(){return this}),jr}();mt?((mt.exports=fr)._=fr,ft._=fr):pt._=fr}.call(_n);var Vg=Object.defineProperty,kg=Object.defineProperties,jg=Object.getOwnPropertyDescriptors,Ra=Object.getOwnPropertySymbols,tv=Object.prototype.hasOwnProperty,ev=Object.prototype.propertyIsEnumerable,ba=(e,t,r)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lr=(e,t)=>{for(var r in t||(t={}))tv.call(t,r)&&ba(e,r,t[r]);if(Ra)for(var r of Ra(t))ev.call(t,r)&&ba(e,r,t[r]);return e},nv=(e,t)=>kg(e,jg(t));function Lt(e,t,r){var n;const i=An(e);return(null==(n=t.rpcMap)?void 0:n[i.reference])||`${Oa}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function Ae(e){return e.includes(":")?e.split(":")[1]:e}function Ta(e){return e.map((e=>`${e.split(":")[0]}:${e.split(":")[1]}`))}function rv(e,t){const r=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!r.length)return[];const n=[];return r.forEach((e=>{const r=t.namespaces[e].accounts;n.push(...r)})),n}function Fi(e={},t={}){const r=La(e),n=La(t);return qi.exports.merge(r,n)}function La(e){var t,r,n,i;const o={};if(!Xr$1(e))return o;for(const[s,a]of Object.entries(e)){const e=on$3(s)?[s]:a.chains,c=a.methods||[],l=a.events||[],u=a.rpcMap||{},d=xo(s);o[d]=nv(lr(lr({},o[d]),a),{chains:me$1(e,null==(t=o[d])?void 0:t.chains),methods:me$1(c,null==(r=o[d])?void 0:r.methods),events:me$1(l,null==(n=o[d])?void 0:n.events),rpcMap:lr(lr({},u),null==(i=o[d])?void 0:i.rpcMap)})}return o}function iv(e){return e.includes(":")?e.split(":")[2]:e}function Ha(e){const t={};for(const[r,n]of Object.entries(e)){const e=n.methods||[],i=n.events||[],o=n.accounts||[],s=on$3(r)?[r]:n.chains?n.chains:Ta(n.accounts);t[r]={chains:s,methods:e,events:i,accounts:o}}return t}function Wi(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const Da={},F$2=e=>Da[e],Mi=(e,t)=>{Da[e]=t};class sv{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Na=Object.getOwnPropertySymbols,cv=Object.prototype.hasOwnProperty,fv=Object.prototype.propertyIsEnumerable,$a=(e,t,r)=>t in e?uv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ua=(e,t)=>{for(var r in t||(t={}))cv.call(t,r)&&$a(e,r,t[r]);if(Na)for(var r of Na(t))fv.call(t,r)&&$a(e,r,t[r]);return e},qa=(e,t)=>av(e,ov(t));class hv{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const r=t||Lt(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=parseInt(Ae(t));e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let n=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const i=parseInt(n,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${i}`)}return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,n;const i=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!i)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),s=(null==(n=null==o?void 0:o.sessionProperties)?void 0:n.capabilities)||{};if(null!=s&&s[i])return null==s?void 0:s[i];const a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:qa(Ua({},o.sessionProperties||{}),{capabilities:qa(Ua({},s||{}),{[i]:a})})})}catch(c){console.warn("Failed to update session with capabilities",c)}return a}async getCallStatus(e){var t,r;const n=this.client.session.get(e.topic),i=null==(t=n.sessionProperties)?void 0:t.bundler_name;if(i){const t=this.getBundlerUrl(e.chainId,i);try{return await this.getUserOperationReceipt(t,e)}catch(s){console.warn("Failed to fetch call status from bundler",s,t)}}const o=null==(r=n.sessionProperties)?void 0:r.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var r;const n=new URL(e),i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(formatJsonRpcRequest("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(e,t){return`${Qg}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class lv{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class pv{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class dv{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const r=t||Lt(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new o$3(new f$3(r,F$2("disableProviderPing")))}}class gv{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{const r=this.getCardanoRPCUrl(t),n=Ae(t);e[n]=this.createHttpProvider(n,r)})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||this.getCardanoRPCUrl(e);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class vv{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class _v{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;const n=Ae(t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}class mv{constructor(e){this.name="near",this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const r=t||Lt(`${this.name}:${e}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e&&e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2]))||[]}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])})),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace);return typeof r>"u"?void 0:new o$3(new f$3(r,F$2("disableProviderPing")))}}class wv{constructor(e){this.name=ze,this.namespace=e.namespace,this.events=F$2("events"),this.client=F$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Tt.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){var e,t;const r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach((e=>{const t=An(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)})),r}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){const r=t||Lt(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$3(new f$3(r,F$2("disableProviderPing")))}}var Pv=Object.defineProperty,Cv=Object.defineProperties,Av=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertySymbols,Iv=Object.prototype.hasOwnProperty,xv=Object.prototype.propertyIsEnumerable,Wa=(e,t,r)=>t in e?Pv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pr=(e,t)=>{for(var r in t||(t={}))Iv.call(t,r)&&Wa(e,r,t[r]);if(Fa)for(var r of Fa(t))xv.call(t,r)&&Wa(e,r,t[r]);return e},Bi=(e,t)=>Cv(e,Av(t));class dr{constructor(e){this.events=new Jg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:Mg(k$4({level:(null==e?void 0:e.logger)||ya})),this.disableProviderPing=(null==e?void 0:e.disableProviderPing)||!1}static async init(e){const t=new dr(e);return await t.initialize(),t}async request(e,t,r){const[n,i]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:pr({},e),chainId:`${n}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,n){const i=(new Date).getTime();this.request(e,r,n).then((e=>t(null,formatJsonRpcResult(i,e)))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:er$1("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:r,response:n}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();if(this.session=i.session,this.session){const e=Ha(this.session.namespaces);this.namespaces=Fi(this.namespaces,e),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:r,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});r&&(this.uri=r,this.events.emit("display_uri",r)),await n().then((e=>{this.session=e;const t=Ha(e.namespaces);this.namespaces=Fi(this.namespaces,t),this.persist("namespaces",this.namespaces)})).catch((e=>{if(e.message!==it)throw e;t++}))}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[r,n]=this.validateChain(e),i=this.getProvider(r);i.name===ze?i.setDefaultChain(`${r}:${n}`,t):i.setDefaultChain(n,t)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Nr$1(t)){for(const r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await _e.init({core:this.providerOpts.core,logger:this.providerOpts.logger||ya,relayUrl:this.providerOpts.relayUrl||Yg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>xo(e))))];Mi("client",this.client),Mi("events",this.events),Mi("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=rv(e,this.session),r=Ta(t),n=Fi(this.namespaces,this.optionalNamespaces),i=Bi(pr({},n[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new hv({namespace:i});break;case"algorand":this.rpcProviders[e]=new dv({namespace:i});break;case"solana":this.rpcProviders[e]=new lv({namespace:i});break;case"cosmos":this.rpcProviders[e]=new pv({namespace:i});break;case"polkadot":this.rpcProviders[e]=new sv({namespace:i});break;case"cip34":this.rpcProviders[e]=new gv({namespace:i});break;case"elrond":this.rpcProviders[e]=new vv({namespace:i});break;case"multiversx":this.rpcProviders[e]=new _v({namespace:i});break;case"near":this.rpcProviders[e]=new mv({namespace:i});break;default:this.rpcProviders[ze]?this.rpcProviders[ze].updateNamespace(i):this.rpcProviders[ze]=new wv({namespace:i})}}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{const{params:t}=e,{event:r}=t;if("accountsChanged"===r.name){const e=r.data;e&&Nr$1(e)&&this.events.emit("accountsChanged",e.map(iv))}else if("chainChanged"===r.name){const e=t.chainId,r=t.event.data,n=xo(e),i=Wi(e)!==Wi(r)?`${n}:${Wi(r)}`:e;this.onChainChanged(i)}else this.events.emit(r.name,r.data);this.events.emit("session_event",e)})),this.client.on("session_update",(({topic:e,params:t})=>{var r;const{namespaces:n}=t,i=null==(r=this.client)?void 0:r.session.get(e);this.session=Bi(pr({},i),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})})),this.client.on("session_delete",(async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Bi(pr({},er$1("USER_DISCONNECTED")),{data:e.topic}))})),this.on(Tt.DEFAULT_CHAIN_CHANGED,(e=>{this.onChainChanged(e,!0)}))}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[ze]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t,optionalNamespaces:r,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",r)}validateChain(e){const[t,r]=(null==e?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map((e=>xo(e))).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];const n=xo(Object.keys(this.namespaces)[0]);return[n,this.rpcProviders[n].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[r,n]=this.validateChain(e);n&&(t||this.getProvider(r).setDefaultChain(n),this.namespaces[r]?this.namespaces[r].defaultChain=n:this.namespaces[`${r}:${n}`]?this.namespaces[`${r}:${n}`].defaultChain=n:this.namespaces[`${r}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${Sa}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${Sa}/${e}`)}}const WcHelpersUtil={getMethodsByChainNamespace(e){switch(e){case"solana":return["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"];case"eip155":return["personal_sign","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendRawTransaction","eth_sendTransaction","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus","wallet_getCallsStatus","wallet_grantPermissions","wallet_switchEthereumChain"];default:return[]}},createNamespaces(e){return e.reduce(((e,t)=>{const{id:r,chainNamespace:n,rpcUrls:i}=t,o=i.default.http[0],s=this.getMethodsByChainNamespace(n);e[n]||(e[n]={methods:s,events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}});const a=`${n}:${r}`,c=e[n];return c.chains.push(a),(null==c?void 0:c.rpcMap)&&o&&(c.rpcMap[r]=o),e}),{})},getChainsFromNamespaces:(e={})=>Object.values(e).flatMap((e=>{const t=e.chains||[],r=e.accounts.map((e=>{const[t,r]=e.split(":");return`${t}:${r}`}));return Array.from(new Set([...t,...r]))}))};var define_import_meta_env_default$2={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const isObject$2=e=>"object"==typeof e&&null!==e,proxyStateMap=new WeakMap,refSet=new WeakSet,buildProxyFunction=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject$2(e)&&!refSet.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},i=new WeakMap,o=(e,t,r=n)=>{const s=i.get(e);if((null==s?void 0:s[0])===t)return s[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$8(a,!0),i.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const n=Reflect.get(e,t),i={value:n,enumerable:!0,configurable:!0};if(refSet.has(n))h$8(n,!1);else if(n instanceof Promise)delete i.value,i.get=()=>r(n);else if(proxyStateMap.has(n)){const[e,t]=proxyStateMap.get(n);i.value=o(e,t(),r)}Object.defineProperty(a,t,i)})),Object.preventExtensions(a)},s=new WeakMap,a=[1,1],c=n=>{if(!isObject$2(n))throw new Error("object required");const i=s.get(n);if(i)return i;let l=a[0];const u=new Set,d=(e,t=++a[0])=>{l!==t&&(l=t,u.forEach((r=>r(e,t))))};let h=a[1];const p=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},f=new Map,m=e=>{var t;const r=f.get(e);r&&(f.delete(e),null==(t=r[1])||t.call(r))},g=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),b={deleteProperty(e,t){const r=Reflect.get(e,t);m(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,i,o){const a=Reflect.has(t,n),l=Reflect.get(t,n,o);if(a&&(e(l,i)||s.has(i)&&e(l,s.get(i))))return!0;m(n),isObject$2(i)&&(i=y$7(i)||i);let h=i;if(i instanceof Promise)i.then((e=>{i.status="fulfilled",i.value=e,d(["resolve",[n],e])})).catch((e=>{i.status="rejected",i.reason=e,d(["reject",[n],e])}));else{!proxyStateMap.has(i)&&r(i)&&(h=c(i));const e=!refSet.has(h)&&proxyStateMap.get(h);e&&((e,t)=>{if("production"!==(define_import_meta_env_default$2?"production":void 0)&&f.has(e))throw new Error("prop listener already exists");if(u.size){const r=t[3](p(e));f.set(e,[t,r])}else f.set(e,[t])})(n,e)}return Reflect.set(t,n,h,o),d(["set",[n],i,l]),!0}},y=t(g,b);s.set(n,y);const w=[g,(e=++a[1])=>(h===e||u.size||(h=e,f.forEach((([t])=>{const r=t[1](e);r>l&&(l=r)}))),l),o,e=>{u.add(e),1===u.size&&f.forEach((([e,t],r)=>{if("production"!==(define_import_meta_env_default$2?"production":void 0)&&t)throw new Error("remove already exists");const n=e[3](p(r));f.set(r,[e,n])}));return()=>{u.delete(e),0===u.size&&f.forEach((([e,t],r)=>{t&&(t(),f.set(r,[e]))}))}}];return proxyStateMap.set(y,w),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(y[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(g,e,t)})),y})=>[c,proxyStateMap,refSet,e,t,r,n,i,o,s,a],[defaultProxyFunction]=buildProxyFunction();function proxy(e={}){return defaultProxyFunction(e)}function subscribe(e,t,r){const n=proxyStateMap.get(e);let i;"production"===(define_import_meta_env_default$2?"production":void 0)||n||console.warn("Please use proxy object");const o=[],s=n[3];let a=!1;const c=s((e=>{o.push(e),i||(i=Promise.resolve().then((()=>{i=void 0,a&&t(o.splice(0))})))}));return a=!0,()=>{a=!1,c()}}function ref(e){return refSet.add(e),e}function subscribeKey(e,t,r,n){let i=e[t];return subscribe(e,(()=>{const n=e[t];Object.is(i,n)||r(i=n)}))}const state$2=proxy({providers:{eip155:void 0,solana:void 0,polkadot:void 0},providerIds:{eip155:void 0,solana:void 0,polkadot:void 0}}),ProviderUtil={state:state$2,subscribeKey:(e,t)=>subscribeKey(state$2,e,t),subscribeProviders:e=>subscribe(state$2.providers,(()=>e(state$2.providers))),setProvider(e,t){t&&(state$2.providers[e]=ref(t))},getProvider:e=>state$2.providers[e],setProviderId(e,t){t&&(state$2.providerIds[e]=t)},getProviderId:e=>state$2.providerIds[e],reset(){state$2.providers={eip155:void 0,solana:void 0,polkadot:void 0},state$2.providerIds={eip155:void 0,solana:void 0,polkadot:void 0}},resetChain(e){state$2.providers[e]=void 0,state$2.providerIds[e]=void 0}},OPTIONAL_METHODS$1=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions"];class UniversalAdapterClient{constructor(e){this.appKit=void 0,this.isUniversalAdapterClient=!0,this.options=void 0,this.adapterType="universal",this.reportErrors=!0;const{siweConfig:t,metadata:r}=e;this.caipNetworks=e.networks,this.chainNamespace=ConstantsUtil$3.CHAIN.EVM,this.metadata=r,this.networkControllerClient={switchCaipNetwork:e=>{e&&this.switchNetwork(e)},getApprovedCaipNetworksData:async()=>{var e;const t=await this.getWalletConnectProvider();if(!t)return Promise.resolve({supportsAllNetworks:!1,approvedCaipNetworkIds:[]});const r=WcHelpersUtil.getChainsFromNamespaces(null==(e=t.session)?void 0:e.namespaces);return Promise.resolve({supportsAllNetworks:!1,approvedCaipNetworkIds:r})}},this.connectionControllerClient={connectWalletConnect:async e=>{var r,n,i,o,s,a,c,l,u,d,h;const p=await this.getWalletConnectProvider();if(!p)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");if(p.on("display_uri",(t=>{e(t)})),ChainController.state.activeChain&&"wagmi"===(null==(i=null==(n=null==(r=ChainController.state)?void 0:r.chains)?void 0:n.get(ChainController.state.activeChain))?void 0:i.adapterType)){const t=ChainController.state.chains.get(ChainController.state.activeChain);await(null==(s=null==(o=null==t?void 0:t.connectionControllerClient)?void 0:o.connectWalletConnect)?void 0:s.call(o,e)),this.setWalletConnectProvider()}else{const e=await(null==(a=null==t?void 0:t.getMessageParams)?void 0:a.call(t)),r=null==(c=null==t?void 0:t.options)?void 0:c.enabled,n="function"==typeof(null==p?void 0:p.authenticate),i=e&&Object.keys(e||{}).length>0;if(t&&r&&e&&n&&i&&ChainController.state.activeChain===ConstantsUtil$3.CHAIN.EVM){const{SIWEController:r,getDidChainId:n,getDidAddress:i}=await Promise.resolve().then((()=>index$4)),o=null==(l=this.caipNetworks)?void 0:l.filter((e=>e.chainNamespace===ConstantsUtil$3.CHAIN.EVM)).map((e=>e.caipNetworkId));e.chains=null==(u=this.caipNetworks)?void 0:u.filter((e=>e.chainNamespace===ConstantsUtil$3.CHAIN.EVM)).map((e=>e.id));const s=await p.authenticate({nonce:await(null==(d=null==t?void 0:t.getNonce)?void 0:d.call(t)),methods:[...OPTIONAL_METHODS$1],...e,chains:o}),a=null==(h=null==s?void 0:s.auths)?void 0:h[0];if(a){const{p:e,s:t}=a,o=n(e.iss),s=i(e.iss);s&&o&&r.setSession({address:s,chainId:parseInt(o,10)});try{const n=p.client.formatAuthMessage({request:e,iss:e.iss});await r.verifyMessage({message:n,signature:t.s,cacao:a})}catch(f){throw console.error("Error verifying message",f),await p.disconnect().catch(console.error),await r.signOut().catch(console.error),f}}}else{const e=WcHelpersUtil.createNamespaces(this.caipNetworks);await p.connect({optionalNamespaces:e})}this.setWalletConnectProvider()}},disconnect:async()=>{var e,r,n,i;if(SafeLocalStorage.removeItem(SafeLocalStorageKeys.WALLET_ID),null==(e=null==t?void 0:t.options)?void 0:e.signOutOnDisconnect){const{SIWEController:e}=await Promise.resolve().then((()=>index$4));await e.signOut()}await(null==(r=this.walletConnectProvider)?void 0:r.disconnect()),null==(n=this.appKit)||n.resetAccount(ConstantsUtil$3.CHAIN.EVM),null==(i=this.appKit)||i.resetAccount(ConstantsUtil$3.CHAIN.SOLANA)},signMessage:async e=>{const t=await this.getWalletConnectProvider(),r=ChainController.state.activeCaipAddress,n=CoreHelperUtil.getPlainAddress(r);if(!t)throw new Error("connectionControllerClient:signMessage - provider is undefined");return await t.request({method:"personal_sign",params:[e,n]})},estimateGas:async()=>await Promise.resolve(BigInt(0)),getEnsAvatar:async e=>await Promise.resolve(e),getEnsAddress:async e=>await Promise.resolve(e),writeContract:async()=>await Promise.resolve("0x"),getCapabilities:async e=>{var t,r;const n=await this.getWalletConnectProvider();if(!n)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");const i=null==(r=null==(t=n.session)?void 0:t.sessionProperties)?void 0:r.capabilities;if(i){const t=this.parseWalletCapabilities(i)[e];if(t)return t}return await n.request({method:"wallet_getCapabilities",params:[e]})},grantPermissions:async e=>{const t=await this.getWalletConnectProvider();if(!t)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return t.request({method:"wallet_grantPermissions",params:e})},sendTransaction:async()=>await Promise.resolve("0x"),parseUnits:()=>BigInt(0),formatUnits:()=>""}}construct(e,t){this.appKit=e,this.options=t,this.createProvider(),this.syncRequestedNetworks(this.caipNetworks),this.syncConnectors()}switchNetwork(e){e&&this.walletConnectProvider&&this.walletConnectProvider.setDefaultChain(e.caipNetworkId)}async disconnect(){var e,t;this.walletConnectProvider&&(await this.walletConnectProvider.disconnect(),null==(e=this.appKit)||e.resetAccount(ConstantsUtil$3.CHAIN.EVM),null==(t=this.appKit)||t.resetAccount(ConstantsUtil$3.CHAIN.SOLANA))}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{await this.createProvider()}catch(e){throw new Error("EthereumAdapter:getWalletConnectProvider - Cannot create provider")}return this.walletConnectProvider}createProvider(){var e,t;return!this.walletConnectProviderInitPromise&&"undefined"!=typeof window&&(null==(e=this.options)?void 0:e.projectId)&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider(null==(t=this.options)?void 0:t.projectId)),this.walletConnectProviderInitPromise}async initWalletConnectProvider(e){const t=LoggerUtil.createLogger(((e,...t)=>{e.message.includes(ErrorUtil.UniversalProviderErrors.UNAUTHORIZED_DOMAIN_NOT_ALLOWED)?this.reportErrors&&(AlertController.open(ErrorUtil.ALERT_ERRORS.INVALID_APP_CONFIGURATION,"error"),this.reportErrors=!1):console.error(...t)})),r={projectId:e,metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]},logger:t};this.walletConnectProvider=await dr.init(r),await this.checkActiveWalletConnectProvider()}syncRequestedNetworks(e){[...new Set(e.map((e=>e.chainNamespace)))].filter((e=>Boolean(e))).forEach((t=>{var r;null==(r=this.appKit)||r.setRequestedCaipNetworks(e.filter((e=>e.chainNamespace===t)),t)}))}async checkActiveWalletConnectProvider(){const e=await this.getWalletConnectProvider(),t=SafeLocalStorage.getItem(SafeLocalStorageKeys.WALLET_ID);e&&t===ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID&&this.setWalletConnectProvider()}setWalletConnectProvider(){var e,t;SafeLocalStorage.setItem(SafeLocalStorageKeys.WALLET_ID,ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID);const r=null==(t=null==(e=this.walletConnectProvider)?void 0:e.session)?void 0:t.namespaces;if(r){Object.keys(r).reverse().forEach((e=>{var t,n,i;const o=null==(t=null==r?void 0:r[e])?void 0:t.accounts[0];ProviderUtil.setProvider(e,this.walletConnectProvider),ProviderUtil.setProviderId(e,"walletConnect"),null==(n=this.appKit)||n.setApprovedCaipNetworksData(e),o&&(null==(i=this.appKit)||i.setCaipAddress(o,e))}));const e=StorageUtil.getStoredActiveCaipNetwork(),t=ChainController.state.activeCaipNetwork;try{e?ChainController.setActiveCaipNetwork(e):t&&ChainController.getAllApprovedCaipNetworkIds().includes(t.caipNetworkId)||this.setDefaultNetwork(r)}catch(n){console.warn(">>> Error setting active caip network",n)}}this.syncAccount(),this.watchWalletConnect()}setDefaultNetwork(e){var t;const r=null==(t=this.caipNetworks[0])?void 0:t.chainNamespace;if(r){const t=null==e?void 0:e[r];if(null==t?void 0:t.chains){const e=t.chains[0];if(e){const t=ChainController.getRequestedCaipNetworks(r);if(t){const r=t.find((t=>t.caipNetworkId===e));r&&ChainController.setActiveCaipNetwork(r)}}}}}async watchWalletConnect(){var e;const t=await this.getWalletConnectProvider(),r=(null==(e=null==t?void 0:t.session)?void 0:e.namespaces)||{};const n=e=>{e.length>0&&this.syncAccount()},i=e=>{var t,r,n;const i=this.caipNetworks.find((t=>t.id==e)),o=null==(t=this.appKit)?void 0:t.getCaipNetwork();if(i)o&&(null==o?void 0:o.id)===(null==i?void 0:i.id)||null==(n=this.appKit)||n.setCaipNetwork(i);else{const t=(null==(r=this.appKit)?void 0:r.getActiveChainNamespace())||ConstantsUtil$3.CHAIN.EVM;ChainController.setActiveCaipNetwork({id:e,caipNetworkId:`${t}:${e}`,name:"Unknown Network",chainNamespace:t,nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}})}};t&&(t.on("disconnect",(function e(){Object.keys(r).forEach((e=>{AccountController.resetAccount(e)})),ConnectionController.resetWcConnection(),SafeLocalStorage.removeItem(SafeLocalStorageKeys.WALLET_ID),null==t||t.removeListener("disconnect",e),null==t||t.removeListener("accountsChanged",n)})),t.on("accountsChanged",n),t.on("chainChanged",i))}getProviderData(){var e,t,r,n;const i=(null==(t=null==(e=this.walletConnectProvider)?void 0:e.session)?void 0:t.namespaces)||{},o=(null==(r=this.appKit)?void 0:r.getIsConnectedState())||!1,s=(null==(n=this.appKit)?void 0:n.getPreferredAccountType())||"";return{provider:this.walletConnectProvider,namespaces:i,namespaceKeys:i?Object.keys(i):[],isConnected:o,preferredAccountType:s}}syncAccount(){var e,t,r,n;const{namespaceKeys:i,namespaces:o}=this.getProviderData(),s=null==(e=this.appKit)?void 0:e.getPreferredAccountType();(null==(t=this.appKit)?void 0:t.getIsConnectedState())||!1?i.forEach((async e=>{var t,r,n,i,a;const c=e,l=null==(t=null==o?void 0:o[e])?void 0:t.accounts[0];(null==(r=this.appKit)?void 0:r.getCaipAddress(c))||(null==(n=this.appKit)||n.setPreferredAccountType(s,c),null==(i=this.appKit)||i.setCaipAddress(l,c),this.syncConnectedWalletInfo(),await Promise.all([null==(a=this.appKit)?void 0:a.setApprovedCaipNetworksData(c)])),this.syncAccounts()})):(null==(r=this.appKit)||r.resetWcConnection(),null==(n=this.appKit)||n.resetNetwork(this.chainNamespace),this.syncAccounts(!0))}syncAccounts(e=!1){const{namespaces:t}=this.getProviderData();Object.keys(t).forEach((r=>{var n,i,o,s;const a=null==(i=null==(n=null==t?void 0:t[r])?void 0:n.accounts)?void 0:i.map((e=>{const[,,t]=e.split(":");return t})).filter(((e,t,r)=>r.indexOf(e)===t));e&&(null==(o=this.appKit)||o.setAllAccounts([],r)),a&&(null==(s=this.appKit)||s.setAllAccounts(a.map((e=>({address:e,type:"eoa"}))),r))}))}syncConnectedWalletInfo(){var e,t;const r=SafeLocalStorage.getItem(SafeLocalStorageKeys.WALLET_ID),n=(null==(t=null==(e=this.walletConnectProvider)?void 0:e.session)?void 0:t.namespaces)||{};Object.keys(n).forEach((e=>{var t,n,i,o,s;(null==(t=this.walletConnectProvider)?void 0:t.session)?null==(i=this.appKit)||i.setConnectedWalletInfo({...this.walletConnectProvider.session.peer.metadata,name:this.walletConnectProvider.session.peer.metadata.name,icon:null==(n=this.walletConnectProvider.session.peer.metadata.icons)?void 0:n[0]},e):r&&(null==(o=this.appKit)||o.setConnectedWalletInfo({name:r},ConstantsUtil$3.CHAIN.EVM),null==(s=this.appKit)||s.setConnectedWalletInfo({name:r},ConstantsUtil$3.CHAIN.SOLANA))}))}syncConnectors(){var e;const t=[];t.push({id:ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID,explorerId:PresetsUtil.ConnectorExplorerIds[ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID],imageId:PresetsUtil.ConnectorImageIds[ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID],name:PresetsUtil.ConnectorNamesMap[ConstantsUtil$1.WALLET_CONNECT_CONNECTOR_ID],type:"WALLET_CONNECT",chain:this.chainNamespace}),null==(e=this.appKit)||e.setConnectors(t)}parseWalletCapabilities(e){try{return JSON.parse(e)}catch(t){throw new Error("Error parsing wallet capabilities")}}}let isInitialized=!1;class AppKit{constructor(e){var t;this.initPromise=void 0,this.setStatus=(e,t)=>{AccountController.setStatus(e,t)},this.getIsConnectedState=()=>Boolean(ChainController.state.activeCaipAddress),this.setAllAccounts=(e,t)=>{AccountController.setAllAccounts(e,t),OptionsController.setHasMultipleAddresses((null==e?void 0:e.length)>1)},this.addAddressLabel=(e,t,r)=>{AccountController.addAddressLabel(e,t,r)},this.removeAddressLabel=(e,t)=>{AccountController.removeAddressLabel(e,t)},this.getCaipAddress=e=>ChainController.state.activeChain!==e&&e?ChainController.getAccountProp("caipAddress",e):ChainController.state.activeCaipAddress,this.getAddress=e=>ChainController.state.activeChain!==e&&e?ChainController.getAccountProp("address",e):AccountController.state.address,this.getProvider=()=>AccountController.state.provider,this.getPreferredAccountType=()=>AccountController.state.preferredAccountType,this.setCaipAddress=(e,t)=>{AccountController.setCaipAddress(e,t)},this.setProvider=(e,t)=>{AccountController.setProvider(e,t)},this.setBalance=(e,t,r)=>{AccountController.setBalance(e,t,r)},this.setProfileName=(e,t)=>{AccountController.setProfileName(e,t)},this.setProfileImage=(e,t)=>{AccountController.setProfileImage(e,t)},this.resetAccount=e=>{AccountController.resetAccount(e)},this.setCaipNetwork=e=>{ChainController.setActiveCaipNetwork(e)},this.getCaipNetwork=e=>{var t;return e?null==(t=ChainController.getRequestedCaipNetworks(e).filter((t=>t.chainNamespace===e)))?void 0:t[0]:ChainController.state.activeCaipNetwork},this.getCaipNetworkId=()=>{const e=this.getCaipNetwork();if(e)return e.id},this.getCaipNetworks=e=>ChainController.getRequestedCaipNetworks(e),this.getActiveChainNamespace=()=>ChainController.state.activeChain,this.setRequestedCaipNetworks=(e,t)=>{ChainController.setRequestedCaipNetworks(e,t)},this.getApprovedCaipNetworkIds=()=>ChainController.getAllApprovedCaipNetworkIds(),this.setApprovedCaipNetworksData=e=>ChainController.setApprovedCaipNetworksData(e),this.resetNetwork=e=>{ChainController.resetNetwork(e)},this.setConnectors=e=>{const t=[...ConnectorController.getConnectors(),...e];ConnectorController.setConnectors(t)},this.addConnector=e=>{ConnectorController.addConnector(e)},this.getConnectors=()=>ConnectorController.getConnectors(),this.resetWcConnection=()=>{ConnectionController.resetWcConnection()},this.fetchIdentity=e=>BlockchainApiController.fetchIdentity(e),this.setAddressExplorerUrl=(e,t)=>{AccountController.setAddressExplorerUrl(e,t)},this.setSmartAccountDeployed=(e,t)=>{AccountController.setSmartAccountDeployed(e,t)},this.setConnectedWalletInfo=(e,t)=>{AccountController.setConnectedWalletInfo(e,t)},this.setSmartAccountEnabledNetworks=(e,t)=>{ChainController.setSmartAccountEnabledNetworks(e,t)},this.setPreferredAccountType=(e,t)=>{AccountController.setPreferredAccountType(e,t)},this.getReownName=e=>EnsController.getNamesForAddress(e),this.resolveReownName=async e=>{var t;const r=await EnsController.resolveName(e);return(null==(t=(Object.values(null==r?void 0:r.addresses)||[])[0])?void 0:t.address)||!1},this.setEIP6963Enabled=e=>{OptionsController.setEIP6963Enabled(e)},this.setClientId=e=>{BlockchainApiController.setClientId(e)},this.getConnectorImage=e=>AssetUtil.getConnectorImage(e),this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.adapter=null==(t=e.adapters)?void 0:t[0],this.caipNetworks=this.extendCaipNetworks(e),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.initControllers(e),this.initOrContinue(),this.version=e.sdkVersion}static getInstance(){return this.instance}async open(e){await this.initOrContinue(),ModalController.open(e)}async close(){await this.initOrContinue(),ModalController.close()}setLoading(e){ModalController.setLoading(e)}getError(){return""}getChainId(){var e;return null==(e=ChainController.state.activeCaipNetwork)?void 0:e.id}switchNetwork(e){return ChainController.switchActiveNetwork(e)}getWalletProvider(){return ChainController.state.activeChain?ProviderUtil.state.providers[ChainController.state.activeChain]:null}getWalletProviderType(){return ChainController.state.activeChain?ProviderUtil.state.providerIds[ChainController.state.activeChain]:null}subscribeProvider(){return null}getThemeMode(){return ThemeController.state.themeMode}getThemeVariables(){return ThemeController.state.themeVariables}setThemeMode(e){ThemeController.setThemeMode(e),setColorTheme(ThemeController.state.themeMode)}setThemeVariables(e){ThemeController.setThemeVariables(e),setThemeVariables(ThemeController.state.themeVariables)}subscribeTheme(e){return ThemeController.subscribe(e)}getWalletInfo(){return AccountController.state.connectedWalletInfo}subscribeWalletInfo(e){return AccountController.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){AccountController.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){ChainController.subscribeKey("activeCaipNetwork",e)}getState(){return PublicStateController.state}subscribeState(e){return PublicStateController.subscribe(e)}showErrorMessage(e){SnackController.showError(e)}showSuccessMessage(e){SnackController.showSuccess(e)}getEvent(){return{...EventsController.state}}subscribeEvents(e){return EventsController.subscribe(e)}replace(e){RouterController.replace(e)}redirect(e){RouterController.push(e)}popTransactionStack(e){RouterController.popTransactionStack(e)}isOpen(){return ModalController.state.open}isTransactionStackEmpty(){return 0===RouterController.state.transactionStack.length}isTransactionShouldReplaceView(){var e;return null==(e=RouterController.state.transactionStack[RouterController.state.transactionStack.length-1])?void 0:e.replace}async initControllers(e){var t;if(OptionsController.setDebug(e.debug),OptionsController.setProjectId(e.projectId),OptionsController.setSdkVersion(e.sdkVersion),!e.projectId)return void AlertController.open(ErrorUtil.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");this.adapters=e.adapters,this.setMetadata(e),this.initializeUniversalAdapter(e),this.initializeAdapters(e),this.setDefaultNetwork(),OptionsController.setAllWallets(e.allWallets),OptionsController.setIncludeWalletIds(e.includeWalletIds),OptionsController.setExcludeWalletIds(e.excludeWalletIds),e.excludeWalletIds&&ApiController.searchWalletByIds({ids:e.excludeWalletIds}),OptionsController.setFeaturedWalletIds(e.featuredWalletIds),OptionsController.setTokens(e.tokens),OptionsController.setTermsConditionsUrl(e.termsConditionsUrl),OptionsController.setPrivacyPolicyUrl(e.privacyPolicyUrl),OptionsController.setCustomWallets(e.customWallets),OptionsController.setFeatures(e.features),OptionsController.setEnableWalletConnect(!1!==e.enableWalletConnect),OptionsController.setEnableWallets(!1!==e.enableWallets),e.metadata&&OptionsController.setMetadata(e.metadata),e.themeMode&&ThemeController.setThemeMode(e.themeMode),e.themeVariables&&ThemeController.setThemeVariables(e.themeVariables),e.disableAppend&&OptionsController.setDisableAppend(Boolean(e.disableAppend));if((null==(t=e.adapters)?void 0:t.find((e=>e.chainNamespace===ConstantsUtil$3.CHAIN.EVM)))&&e.siweConfig){const{SIWEController:t}=await Promise.resolve().then((()=>index$4));t.setSIWEClient(e.siweConfig)}}setMetadata(e){var t,r,n;"undefined"!=typeof window&&"undefined"!=typeof document&&(e.metadata={name:(null==(t=document.getElementsByTagName("title")[0])?void 0:t.textContent)||"",description:(null==(r=document.querySelector('meta[property="og:description"]'))?void 0:r.content)||"",url:window.location.origin,icons:[(null==(n=document.querySelector('link[rel~="icon"]'))?void 0:n.href)||""]})}extendCaipNetworks(e){return CaipNetworksUtil.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,projectId:e.projectId})}extendDefaultCaipNetwork(e){const t=e.networks.find((t=>{var r;return t.id===(null==(r=e.defaultNetwork)?void 0:r.id)}));return t?CaipNetworksUtil.extendCaipNetwork(t,{customNetworkImageUrls:e.chainImages,projectId:e.projectId}):void 0}initializeUniversalAdapter(e){var t,r;const n={...e,networks:this.caipNetworks,defaultNetwork:this.defaultCaipNetwork};this.universalAdapter=new UniversalAdapterClient(n),ChainController.initializeUniversalAdapter(this.universalAdapter,e.adapters||[]),null==(r=(t=this.universalAdapter).construct)||r.call(t,this,n)}initializeAdapters(e){var t;const r={...e,networks:this.caipNetworks,defaultNetwork:this.defaultCaipNetwork};ChainController.initialize(e.adapters||[]),null==(t=e.adapters)||t.forEach((e=>{var t;null==(t=e.construct)||t.call(e,this,r)}))}setDefaultNetwork(){const e=SafeLocalStorage.getItem(SafeLocalStorageKeys.ACTIVE_CAIP_NETWORK_ID),t=(e?this.caipNetworks.find((t=>t.caipNetworkId===e)):void 0)||this.defaultCaipNetwork||this.caipNetworks[0];ChainController.setActiveCaipNetwork(t)}async initOrContinue(){return this.initPromise||isInitialized||!CoreHelperUtil.isClient()||(isInitialized=!0,this.initPromise=new Promise((async e=>{await Promise.all([Promise.resolve().then((()=>index$7)),Promise.resolve().then((()=>w3mModal))]);const t=document.createElement("w3m-modal");OptionsController.state.disableAppend||document.body.insertAdjacentElement("beforeend",t),e()}))),this.initPromise}}const PACKAGE_VERSION="1.1.5";var __decorate$1L=function(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s};let W3mAccountButton=class extends h$5{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.balance="show",this.charsStart=4,this.charsEnd=6,this.caipAddress=ChainController.state.activeCaipAddress,this.balanceVal=AccountController.state.balance,this.balanceSymbol=AccountController.state.balanceSymbol,this.profileName=AccountController.state.profileName,this.profileImage=AccountController.state.profileImage,this.network=ChainController.state.activeCaipNetwork,this.networkImage=this.network?AssetUtil.getNetworkImage(this.network):void 0,this.isSupported=!0,this.unsubscribe.push(AssetController.subscribeNetworkImages((()=>{var e,t;this.networkImage=(null==(t=null==(e=this.network)?void 0:e.assets)?void 0:t.imageId)?AssetUtil.getNetworkImage(this.network):void 0})),ChainController.subscribeKey("activeCaipAddress",(e=>this.caipAddress=e)),AccountController.subscribeKey("balance",(e=>this.balanceVal=e)),AccountController.subscribeKey("balanceSymbol",(e=>this.balanceSymbol=e)),AccountController.subscribeKey("profileName",(e=>this.profileName=e)),AccountController.subscribeKey("profileImage",(e=>this.profileImage=e)),ChainController.subscribeKey("activeCaipNetwork",(e=>{var t;this.network=e,this.networkImage=(null==(t=null==e?void 0:e.assets)?void 0:t.imageId)?AssetUtil.getNetworkImage(e):void 0,this.isSupported=!(null==e?void 0:e.chainNamespace)||ChainController.checkIfSupportedNetwork(null==e?void 0:e.chainNamespace)})))}disconnectedCallback(){this.unsubscribe.forEach((e=>e()))}render(){if(!ChainController.state.activeChain)return null;const e="show"===this.balance;return ke`
6098
6098
  <wui-account-button
6099
6099
  .disabled=${Boolean(this.disabled)}
6100
6100
  .isUnsupportedChain=${!this.isSupported}
@@ -10023,7 +10023,7 @@ const rt$2=e=>void 0===e.strings
10023
10023
  icon=${null==r?void 0:r.icon}
10024
10024
  .loading=${"loading"===t}
10025
10025
  ></wui-snackbar>
10026
- `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout=setTimeout((()=>SnackController.hide()),2500)):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};W3mSnackBar.styles=styles$j,__decorate$y([r$6()],W3mSnackBar.prototype,"open",void 0),W3mSnackBar=__decorate$y([customElement("w3m-snackbar")],W3mSnackBar);const styles$i=i$7`
10026
+ `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout((()=>SnackController.hide()),2500)):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};W3mSnackBar.styles=styles$j,__decorate$y([r$6()],W3mSnackBar.prototype,"open",void 0),W3mSnackBar=__decorate$y([customElement("w3m-snackbar")],W3mSnackBar);const styles$i=i$7`
10027
10027
  :host {
10028
10028
  display: block;
10029
10029
  position: absolute;