PageSourceSearch

https://elyxnet.vercel.app/_next/static/chunks/0cap10oy-zk0s.js

js elyxnet.vercel.app collected 2026-10-03 06:53:02 UTC 872,303 bytes, 5,044 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,219298,(e,t,r)=>{"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(e,t){return new Promise(function(r,i){var n,s,o;function a(r){e.removeListener(t,l),i(r)}function l(){"function"==typeof e.removeListener&&e.removeListener("error",a),r([].slice.call(arguments))}w(e,t,l,{once:!0}),"error"!==t&&(n=e,s=a,o={once:!0},"function"==typeof n.on&&w(n,"error",s,o))})},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function c(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,r,i){if(c(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=u(e))>0&&o.length>n&&!o.warned){o.warned=!0;var n,s,o,a=Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,console&&console.warn&&console.warn(a)}return e}function d(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=d.bind(i);return n.listener=r,i.wrapFn=n,n}function f(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):m(n,n.length)}function g(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function m(e,t){for(var r=Array(t),i=0;i<t;++i)r[i]=e[i];return r}function w(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function n(s){i.once&&e.removeEventListener(t,n),r(s)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||o(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");l=e}}),a.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var o,a=Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)s(l,this,t);else for(var c=l.length,u=m(l,c),r=0;r<c;++r)s(u[r],this,t);return!0},a.prototype.addListener=function(e,t){return h(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return h(this,e,t,!0)},a.prototype.once=function(e,t){return c(t),this.on(e,p(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,p(this,e,t)),this},a.prototype.removeListener=function(e,t){var r,i,n,s,o;if(c(t),void 0===(i=this._events)||void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit
1("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},952439,e=>{"use strict";var t=function(e,r){return(t=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,r)},r=function(){return(r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function i(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function s(e){return this instanceof s?(this.v=e,this):new s(e)}e.s(["__assign",()=>r,"__asyncDelegator",0,function(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:s(e[i](t)),done:"return"===i}:n?n(t):t}:n}},"__asyncGenerator",0,function(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),o=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(e){n[e]&&(i[e]=function(t){return new Promise(function(r,i){o.push([e,t,r,i])>1||l(e,t)})})}function l(e,t){try{var r;(r=n[e](t)).value instanceof s?Promise.resolve(r.value.v).then(c,u):h(o[0][2],r)}catch(e){h(o[0][3],e)}}function c(e){l("next",e)}function u(e){l("throw",e)}function h(e,t){e(t),o.shift(),o.length&&l(o[0][0],o[0][1])}},"__asyncValues",0,function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=i(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){var s,o,a;s=i,o=n,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:a})},o)})}}},"__await",0,s,"__awaiter",0,function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})},"__classPrivateFieldGet",0,function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)},"__classPrivateFieldSet",0,function(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r},"__createBinding",0,function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]},"__decorate",0,function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
1);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__exportStar",0,function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])},"__extends",0,function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)},"__generator",0,function(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){var l=[s,a];if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&l[0]?i.return:l[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,l[1])).done)return n;switch(i=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,i=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],i=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}},"__importDefault",0,function(e){return e&&e.__esModule?e:{default:e}},"__importStar",0,function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}
1,"__makeTemplateObject",0,function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},"__metadata",0,function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},"__param",0,function(e,t){return function(r,i){t(r,i,e)}},"__read",0,n,"__rest",0,function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r},"__spread",0,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e},"__spreadArrays",0,function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},"__values",0,i])},493599,(e,t,r)=>{"use strict";function i(){return(null===e.g||void 0===e.g?void 0:e.g.crypto)||(null===e.g||void 0===e.g?void 0:e.g.msCrypto)||{}}function n(){let e=i();return e.subtle||e.webkitSubtle}Object.defineProperty(r,"__esModule",{value:!0}),r.isBrowserCryptoAvailable=r.getSubtleCrypto=r.getBrowerCrypto=void 0,r.getBrowerCrypto=i,r.getSubtleCrypto=n,r.isBrowserCryptoAvailable=function(){return!!i()&&!!n()}},431443,(e,t,r)=>{"use strict";var i=e.i(247167);function n(){return"u"<typeof document&&"u">typeof navigator&&"ReactNative"===navigator.product}function s(){return void 0!==i.default&&void 0!==i.default.versions&&void 0!==i.default.versions.node}Object.defineProperty(r,"__esModule",{value:!0}),r.isBrowser=r.isNode=r.isReactNative=void 0,r.isReactNative=n,r.isNode=s,r.isBrowser=function(){return!n()&&!s()}},438005,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});let i=e.r(952439);i.__exportStar(e.r(493599),r),i.__exportStar(e.r(431443),r)},756823,(e,t,r)=>{"use strict";t.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},338066,(e,t,r)=>{var i,n,s,o="__lodash_hash_undefined__",a="[object Arguments]",l="[object Array]",c="[object Boolean]",u="[object Date]",h="[object Error]",d="[object Function]",p="[object Map]",f="[object Number]",g="[object Object]",m="[object Promise]",w="[object RegExp]",y="[object Set]",v="[object String]",b="[object WeakMap]",C="[object ArrayBuffer]",x="[object DataView]",_=/^\[object .+?Constructor\]$/,E=/^(?:0|[1-9]\d*)$/,k={};k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k[a]=k[l]=k[C]=k[c]=k[x]=k[u]=k[h]=k[d]=k[p]=k[f]=k[g]=k[w]=k[y]=k[v]=k[b]=!1;var S=e.g&&e.g.Object===Object&&e.g,I="object"==typeof self&&self&&self.Object===Object&&self,A=S||I||Function("return this")(),T=r&&!r.nodeType&&r,P=T&&t&&!t.nodeType&&t,R=P&&P.exports===T,O=R&&S.process,N=function(){try{return O&&O.binding&&O.binding("util")}catch(e){}}(),$=N&&N.isTypedArray;function D(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function L(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var j=Array.prototype,U=Function.prototype,M=Object.prototype,q=A["__core-js_shared__"],W=U.toString,B=M.hasOwnProperty,z=(i=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",H=M.toString,K=RegExp("^"+W.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=R?A.Buffer:void 0,F=A.Symbol,G=A.Uint8Array,Y=M.propertyIsEnumerable,J=j.splice,Z=F?F.toStringTag:void 0,Q=Object.getOwnPropertySymbols,X=V?V.isBuffer:void 0,ee=(n=Object.keys,s=Object,function(e){return n(s(e))}),et=ek(A,"DataView"),er=ek(A,"Map"),ei=ek(A,"Promise"),en=ek(A,"Set"),es=ek(A,"WeakMap"),eo=ek(Object,"create"),ea=eA(et),el=eA(er),ec=eA(ei),eu=eA(en),eh=eA(es),ed=F?F.prototype:void 0,ep=ed?ed.valueOf
1:void 0;function ef(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function eg(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function em(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function ew(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new em;++t<r;)this.add(e[t])}function ey(e){var t=this.__data__=new eg(e);this.size=t.size}function ev(e,t){for(var r=e.length;r--;)if(eT(e[r][0],t))return r;return -1}function eb(e){var t;return null==e?void 0===e?"[object Undefined]":"[object Null]":Z&&Z in Object(e)?function(e){var t=B.call(e,Z),r=e[Z];try{e[Z]=void 0;var i=!0}catch(e){}var n=H.call(e);return i&&(t?e[Z]=r:delete e[Z]),n}(e):(t=e,H.call(t))}function eC(e){return eL(e)&&eb(e)==a}function ex(e,t,r,i,n,s){var o=1&r,a=e.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var u=-1,h=!0,d=2&r?new ew:void 0;for(s.set(e,t),s.set(t,e);++u<a;){var p=e[u],f=t[u];if(i)var g=o?i(f,p,u,t,e,s):i(p,f,u,e,t,s);if(void 0!==g){if(g)continue;h=!1;break}if(d){if(!function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}(t,function(e,t){if(!d.has(t)&&(p===e||n(p,e,r,i,s)))return d.push(t)})){h=!1;break}}else if(!(p===f||n(p,f,r,i,s))){h=!1;break}}return s.delete(e),s.delete(t),h}function e_(e){var t;return t=eU(e),eR(e)?t:function(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}(t,eS(e))}function eE(e,t){var r,i,n=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function ek(e,t){var r,i=null==e?void 0:e[t];return!(!eD(i)||(r=i,z&&z in r))&&(eN(i)?K:_).test(eA(i))?i:void 0}ef.prototype.clear=function(){this.__data__=eo?eo(null):{},this.size=0},ef.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},ef.prototype.get=function(e){var t=this.__data__;if(eo){var r=t[e];return r===o?void 0:r}return B.call(t,e)?t[e]:void 0},ef.prototype.has=function(e){var t=this.__data__;return eo?void 0!==t[e]:B.call(t,e)},ef.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=eo&&void 0===t?o:t,this},eg.prototype.clear=function(){this.__data__=[],this.size=0},eg.prototype.delete=function(e){var t=this.__data__,r=ev(t,e);return!(r<0)&&(r==t.length-1?t.pop():J.call(t,r,1),--this.size,!0)},eg.prototype.get=function(e){var t=this.__data__,r=ev(t,e);return r<0?void 0:t[r][1]},eg.prototype.has=function(e){return ev(this.__data__,e)>-1},eg.prototype.set=function(e,t){var r=this.__data__,i=ev(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},em.prototype.clear=function(){this.size=0,this.__data__={hash:new ef,map:new(er||eg),string:new ef}},em.prototype.delete=function(e){var t=eE(this,e).delete(e);return this.size-=!!t,t},em.prototype.get=function(e){return eE(this,e).get(e)},em.prototype.has=function(e){return eE(this,e).has(e)},em.prototype.set=function(e,t){var r=eE(this,e),i=r.size;return r.set(e,t),this.size+=+(r.size!=i),this},ew.prototype.add=ew.prototype.push=function(e){return this.__data__.set(e,o),this},ew.prototype.has=function(e){return this.__data__.has(e)},ey.prototype.clear=function(){this.__data__=new eg,this.size=0},ey.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ey.prototype.get=function(e){return this.__data__.get(e)},ey.prototype.has=function(e){return this.__data__.has(e)},ey.prototype.set=function(e,t){var r=this.__data__;if(r instanceof eg){var i=r.__data__;if(!er||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new em(i)}return r.set(e,t),this.size=r.size,this};var eS=Q?function(e){return null==e?[]:function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s}(Q(e=Object(e)),function(t){return Y.call(e,t)})}:function(){return[]},eI=eb;function eA(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eT(e,t){return e===t||e!=e&&t!=t}(et&&eI(new et(new ArrayBuffer(1)))!=x||er&&eI(new er)!=p||ei&&eI(ei.resolve())!=m||en&&eI(new en)!=y||es&&eI(new es)!=b)&&(eI=function(e){var t=eb(e),r=t==g?e.constructor:void 0,i=r?eA(r):"";if(i)switch(i){case ea:return x;case el:return p;case ec:return m;case eu:return y;case eh:return b}return t});var eP=eC(function(){return arguments}())?eC:function(e){return eL(e)&&B.call(e,"callee")&&!Y.call(e,"callee")},eR=Array.isArray,eO=X||function(){return!1};function eN(e){if(!eD(e))return!1;var t=eb(e);return t==d||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function e$(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff}function eD(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eL(e){return null!=e&&"object"==typeof e}var ej=$?function(e){return $(e)}:function(e){return eL(e)&&e$(e.length)&&!!k[eb(e)]};function eU(e){return null!=e&&e$(e.length)&&!eN(e)?function(e){var t,r,i=eR(e),n=!i&&eP(e),s=!i&&!n&&eO(e),o=!i&&!n&&!s&&ej(e),a=i||n||s||o,l=a?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],c=l.length;for(var u in e){B.call(e,u)&&!(a&&("length"==u||s&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||(t=u,(r=null==(r=c)?0x1fffffffffffff:r)&&("number"==typeof t||E.test(t))&&t>-1&&t%1==0&&t<r)))&&l.push(u)}return l}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||M))return ee(e);var t,r,i=[];for(var n in Object(e))B.call(e,n)&&"constructor"!=n&&i.push(n);return i}(e)}t.exports=function(e,t){return function e(t,r,i,n,s){return t===r||(null!=t&&null!=r&&(eL(t)||eL(r))?function(e,t,r,i,n,s){var o=eR(e),d=eR(t),m=o?l:eI(e),b=d?l:eI(t);m=m==a?g:m,b=b==a?g:b;var _=m==g,E=b==g,k=m==b;if(k&&eO(e)){if(!eO(t))return!1;o=!0,_=!1}if(k&&!_)return s||(s=new ey),o||ej(e)?ex(e,t,r,i,n,s):function(e,t,r,i,n,s,o){switch(r){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case C:if(e.byteLength!=t.byteLength||!s(new G(e),new G(t)))break;return!0;case c:case u:case f:return eT(+e,+t);case h:return e.name==t.name&&e.message==t.message;case w:case v:return e==t+"";case p:var a=D;case y:var l=1&i;if(a||(a=L),e.size!=t.size&&!l)break;var d=o.get(e);if(d)return d==t;i|=2,o.set(e,t);var g=ex(a(e),a(t),i,n,s,o);return o.delete(e),g;case"[object Symbol]":if(ep)return ep.call(e)==ep.call(t)}return!1}(e,t,m,r,i,n,s);if(!(1&r)){var S=_&&B.call(e,"__wrapped__"),I=E&&B.call(t,"__wrapped__");
1if(S||I){var A=S?e.value():e,T=I?t.value():t;return s||(s=new ey),n(A,T,r,i,s)}}return!!k&&(s||(s=new ey),function(e,t,r,i,n,s){var o=1&r,a=e_(e),l=a.length;if(l!=e_(t).length&&!o)return!1;for(var c=l;c--;){var u=a[c];if(!(o?u in t:B.call(t,u)))return!1}var h=s.get(e);if(h&&s.get(t))return h==t;var d=!0;s.set(e,t),s.set(t,e);for(var p=o;++c<l;){var f=e[u=a[c]],g=t[u];if(i)var m=o?i(g,f,u,t,e,s):i(f,g,u,e,t,s);if(!(void 0===m?f===g||n(f,g,r,i,s):m)){d=!1;break}p||(p="constructor"==u)}if(d&&!p){var w=e.constructor,y=t.constructor;w!=y&&"constructor"in e&&"constructor"in t&&!("function"==typeof w&&w instanceof w&&"function"==typeof y&&y instanceof y)&&(d=!1)}return s.delete(e),s.delete(t),d}(e,t,r,i,n,s))}(t,r,i,n,e,s):t!=t&&r!=r)}(e,t)}},320502,(e,t,r)=>{var i="u">typeof globalThis&&globalThis||"u">typeof self&&self||e.g,n=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();(function(t){var r=void 0!==n&&n||"u">typeof self&&self||e.g||{},i={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};if(i.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function a(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){if(2!=e.length)throw TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function h(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function d(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function p(e){var t=new FileReader,r=d(t);return t.readAsArrayBuffer(e),r}function f(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){if(this.bodyUsed=this.bodyUsed,this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(i.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(i.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var t;i.arrayBuffer&&i.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=f(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=f(e):this._bodyText=e=Object.prototype.toString.call(e)}else this._noBody=!0,this._bodyText="";!this.headers.get("content-type")&&("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=h(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(i.blob)return this.blob().then(p);throw Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,n,s=h(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=d(t=new FileReader),n=(i=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?i[1]:"utf-8",t.readAsText(e,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},i.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=a(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[a(e)]},u.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},u.prototype.set=function(e,t){this.map[a(e)]=l(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),c(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),c(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),c(e)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object c
1onstructor cannot be called as a function.');var i,n,s=(t=t||{}).body;if(e instanceof w){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new u(t.headers)),this.method=(n=(i=t.method||this.method||"GET").toUpperCase(),m.indexOf(n)>-1?n:i),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in r)return new AbortController().signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),("GET"===this.method||"HEAD"===this.method)&&("no-store"===t.cache||"no-cache"===t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function y(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}}),t}function v(e,t){if(!(this instanceof v))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},g.call(w.prototype),g.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var b=[301,302,303,307,308];v.redirect=function(e,t){if(-1===b.indexOf(t))throw RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function C(e,n){return new Promise(function(s,o){var c=new w(e,n);if(c.signal&&c.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function d(){h.abort()}if(h.onload=function(){var e,t,r={statusText:h.statusText,headers:(e=h.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{t.append(i,n)}catch(e){console.warn("Response "+e.message)}}}),t)};0===c.url.indexOf("file://")&&(h.status<200||h.status>599)?r.status=200:r.status=h.status,r.url="responseURL"in h?h.responseURL:r.headers.get("X-Request-URL");var i="response"in h?h.response:h.responseText;setTimeout(function(){s(new v(i,r))},0)},h.onerror=function(){setTimeout(function(){o(TypeError("Network request failed"))},0)},h.ontimeout=function(){setTimeout(function(){o(TypeError("Network request timed out"))},0)},h.onabort=function(){setTimeout(function(){o(new t.DOMException("Aborted","AbortError"))},0)},h.open(c.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?h.withCredentials=!0:"omit"===c.credentials&&(h.withCredentials=!1),"responseType"in h&&(i.blob?h.responseType="blob":i.arrayBuffer&&(h.responseType="arraybuffer")),n&&"object"==typeof n.headers&&!(n.headers instanceof u||r.Headers&&n.headers instanceof r.Headers)){var p=[];
1Object.getOwnPropertyNames(n.headers).forEach(function(e){p.push(a(e)),h.setRequestHeader(e,l(n.headers[e]))}),c.headers.forEach(function(e,t){-1===p.indexOf(t)&&h.setRequestHeader(t,e)})}else c.headers.forEach(function(e,t){h.setRequestHeader(t,e)});c.signal&&(c.signal.addEventListener("abort",d),h.onreadystatechange=function(){4===h.readyState&&c.signal.removeEventListener("abort",d)}),h.send(void 0===c._bodyInit?null:c._bodyInit)})}C.polyfill=!0,r.fetch||(r.fetch=C,r.Headers=u,r.Request=w,r.Response=v),t.Headers=u,t.Request=w,t.Response=v,t.fetch=C,Object.defineProperty(t,"__esModule",{value:!0})})({}),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=i.fetch?i:n;(r=s.fetch).default=s.fetch,r.fetch=s.fetch,r.Headers=s.Headers,r.Request=s.Request,r.Response=s.Response,t.exports=r},875489,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.walletLogo=void 0,r.walletLogo=(e,t)=>{let r;switch(e){case"standard":default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3
1V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7
1h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`}}},449689,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.errorValues=r.standardErrorCodes=void 0,r.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},r.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}}},865088,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.serialize=r.getErrorCode=r.isValidCode=r.getMessageFromCode=r.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;let i=e.r(449689),n="Unspecified error message.";function s(e,t=n){if(e&&Number.isInteger(e)){var o;let t=e.toString();if(l(i.errorValues,t))return i.errorValues[t].message;if((o=e)>=-32099&&o<=-32e3)return r.JSON_RPC_SERVER_ERROR_MESSAGE}return t}function o(e){var t;if(!Number.isInteger(e))return!1;let r=e.toString();return!!(i.errorValues[r]||(t=e)>=-32099&&t<=-32e3)}r.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",r.getMessageFromCode=s,r.isValidCode=o,r.getErrorCode=function(e){var t,r;return"number"==typeof e?e:"object"==typeof(r=e)&&null!==r&&("number"==typeof r.code||"number"==typeof r.errorCode)?null!=(t=e.code)?t:e.errorCode:void 0};function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}r.serialize=function(e,{shouldIncludeStack:t=!1}={}){let r={};return e&&"object"==typeof e&&!Array.isArray(e)&&l(e,"code")&&o(e.code)?(r.code=e.code,e.message&&"string"==typeof e.message?(r.message=e.message,l(e,"data")&&(r.data=e.data)):(r.message=s(r.code),r.data={originalError:a(e)})):(r.code=i.standardErrorCodes.rpc.internal,r.message=c(e,"message")?e.message:n,r.data={originalError:a(e)}),t&&(r.stack=c(e,"stack")?e.stack:void 0),r}},625622,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.standardErrors=void 0;let i=e.r(449689),n=e.r(865088);function s(e,t){let[r,i]=a(t);return new l(e,r||(0,n.getMessageFromCode)(e),i)}function o(e,t){let[r,i]=a(t);return new c(e,r||(0,n.getMessageFromCode)(e),i)}function a(e){if(e){if("string"==typeof e)return[e];else if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:r}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,r]}}return[]}r.standardErrors={rpc:{parse:e=>s(i.standardErrorCodes.rpc.parse,e),invalidRequest:e=>s(i.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>s(i.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>s(i.standardErrorCodes.rpc.methodNotFound,e),internal:e=>s(i.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code 
1<= -32005');return s(t,e)},invalidInput:e=>s(i.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>s(i.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>s(i.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>s(i.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>s(i.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>s(i.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>o(i.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>o(i.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>o(i.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>o(i.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>o(i.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>o(i.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:r,data:i}=e;if(!r||"string"!=typeof r)throw Error('"message" must be a nonempty string');return new c(t,r,i)}}};class l extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}}class c extends l{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}},464357,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.standardErrors=r.standardErrorCodes=void 0;var i=e.r(449689);Object.defineProperty(r,"standardErrorCodes",{enumerable:!0,get:function(){return i.standardErrorCodes}});var n=e.r(625622);Object.defineProperty(r,"standardErrors",{enumerable:!0,get:function(){return n.standardErrors}})},963612,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isErrorResponse=void 0,r.isErrorResponse=function(e){return void 0!==e.errorMessage}},961977,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.LIB_VERSION=void 0,r.LIB_VERSION="4.0.3"},359683,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.serializeError=void 0;let i=e.r(963612),n=e.r(961977),s=e.r(449689),o=e.r(865088);r.serializeError=function(e,t){var r;
1let a=(0,o.serialize)("string"==typeof(r=e)?{message:r,code:s.standardErrorCodes.rpc.internal}:(0,i.isErrorResponse)(r)?Object.assign(Object.assign({},r),{message:r.errorMessage,code:r.errorCode,data:{method:r.method}}):r,{shouldIncludeStack:!0}),l=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");l.searchParams.set("version",n.LIB_VERSION),l.searchParams.set("code",a.code.toString());let c=function(e,t){let r=null==e?void 0:e.method;if(r)return r;if(void 0===t);else if("string"==typeof t)return t;else if(!Array.isArray(t))return t.method;else if(t.length>0)return t[0].method}(a.data,t);return c&&l.searchParams.set("method",c),l.searchParams.set("message",a.message),Object.assign(Object.assign({},a),{docUrl:l.href})}},550906,(e,t,r)=>{"use strict";function i(){return e=>e}Object.defineProperty(r,"__esModule",{value:!0}),r.RegExpString=r.IntNumber=r.BigIntString=r.AddressString=r.HexString=r.OpaqueType=void 0,r.OpaqueType=i,r.HexString=i(),r.AddressString=i(),r.BigIntString=i(),r.IntNumber=function(e){return Math.floor(e)},r.RegExpString=i()},243403,(e,t,r)=>{"use strict";var i=e.i(467034);Object.defineProperty(r,"__esModule",{value:!0}),r.areAddressArraysEqual=r.getFavicon=r.range=r.isBigNumber=r.ensureParsedJSONObject=r.ensureBigInt=r.ensureRegExpString=r.ensureIntNumber=r.ensureBuffer=r.ensureAddressString=r.ensureEvenLengthHexString=r.ensureHexString=r.isHexString=r.prepend0x=r.strip0x=r.has0xPrefix=r.hexStringFromIntNumber=r.intNumberFromHexString=r.bigIntStringFromBigInt=r.hexStringFromBuffer=r.hexStringToUint8Array=r.uint8ArrayToHex=r.randomBytesHex=void 0;let n=e.r(464357),s=e.r(550906),o=/^[0-9]*$/,a=/^[a-f0-9]*$/;function l(e){return[...e].map(e=>e.toString(16).padStart(2,"0")).join("")}function c(e){return e.startsWith("0x")||e.startsWith("0X")}function u(e){return c(e)?e.slice(2):e}function h(e){return c(e)?`0x${e.slice(2)}`:`0x${e}`}function d(e){if("string"!=typeof e)return!1;let t=u(e).toLowerCase();return a.test(t)}function p(e,t=!1){if("string"==typeof e){let r=u(e).toLowerCase();if(a.test(r))return(0,s.HexString)(t?`0x${r}`:r)}throw n.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function f(e,t=!1){let r=p(e,!1);return r.length%2==1&&(r=(0,s.HexString)(`0${r}`)),t?(0,s.HexString)(`0x${r}`):r}function g(e){if("number"==typeof e&&Number.isInteger(e))return(0,s.IntNumber)(e);if("string"==typeof e){if(o.test(e))return(0,s.IntNumber)(Number(e));if(d(e))return(0,s.IntNumber)(Number(BigInt(f(e,!0))))}throw n.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function m(e){if(null==e||"function"!=typeof e.constructor)return!1;let{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}r.randomBytesHex=function(e){return l(crypto.getRandomValues(new Uint8Array(e)))},r.uint8ArrayToHex=l,r.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map(e=>parseInt(e,16)))},r.hexStringFromBuffer=function(e,t=!1){let r=e.toString("hex");return(0,s.HexString)(t?`0x${r}`:r)},r.bigIntStringFromBigInt=function(e){return(0,s.BigIntString)(e.toString(10))},r.intNumberFromHexString=function(e){return(0,s.IntNumber)(Number(BigInt(f(e,!0))))},r.hexStringFromIntNumber=function(e){return(0,s.HexString)(`0x${BigInt(e).toString(16)}`)},r.has0xPrefix=c,r.strip0x=u,r.prepend0x=h,r.isHexString=d,r.ensureHexString=p,r.ensureEvenLengthHexString=f,r.ensureAddressString=function(e){if("string"==typeof e){let t=u(e).toLowerCase();if(d(t)&&40===t.length)return(0,s.AddressString)(h(t))}throw n.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},r.ensureBuffer=function(e){if(i.Buffer.isBuffer(e))return e;if("string"==typeof e){if(d(e)){let t=f(e,!1);return i.Buffer.from(t,"hex")}return i.Buffer.from(e,"utf8")}throw n.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},r.ensureIntNumber=g,r.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,s.RegExpString)(e.toString());throw n.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},r.ensureBigInt=function(e){if(null!==e&&("bigint"==typeof e||m(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(g(e));if("string"==typeof e){if(o.test(e))return BigInt(e);if(d(e))return BigInt(f(e,!0))}throw n.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},r.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw n.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},r.isBigNumber=m,r.range=function(e,t){return Array.from({length:t-e},(t,r)=>e+r)},r.getFavicon=function(){let e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,i=e?e.getAttribute("href"):null;return!i||i.startsWith("javascript:")||i.startsWith("vbscript:")?null:i.startsWith("http://")||i.startsWith("https://")||i.startsWith("data:")?i:i.startsWith("//")?t+i:`${t}//${r}${i}`},r.areAddressArraysEqual=function(e,t){return e.length===t.length&&e.every((e,r)=>e===t[r])}},487182,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.decryptContent=r.encryptContent=r.importKeyFromHexString=r.exportKeyToHexString=r.decrypt=r.encrypt=r.deriveSharedSecret=r.generateKeyPair=void 0;let i=e.r(243403);async function n(e,t){let r=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e,new TextEncoder().encode(t));return{iv:r,cipherText:i}}async function s(e,{iv:t,cipherText:r}){let i=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,r);return new TextDecoder().decode(i)}function o(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}r.generateKeyPair=async function(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])},r.deriveSharedSecret=async function(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},r.encrypt=n,r.decrypt=s,r.exportKeyToHexString=async function(e,t){let r=o(e),n=await crypto.subtle.exportKey(r,t);return(0,i.uint8ArrayToHex)(new Uint8Array(n))},r.importKeyFromHexString=async function(e,t){let r=o(e),n=(0,i.hexStringToUint8Array)(t).buffer;return await crypto.subtle.importKey(r,n,{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])},r.encryptContent=async function(e,t){return n(t,JSON.stringify(e,(e,t)=>t instanceof Error?Object.assign(Object.assign({},t.code?{code:t.code}:{}),{message:t.message}):t))},r.decryptContent=async function(e,t){return JSON.parse(await s(t,e))}},123614,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.ScopedLocalStorage=void 0;class i{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){let e=this.scopedKey(""),t=[];for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);"string"==typeof i&&i.startsWith(e)&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new i("CBWSDK").clear(),new i("walletlink").clear()}}r.ScopedLocalStorage=i},813722,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SCWKeyManager=void 0;let i=e.r(487182),n=e.r(123614),s={storageKey:"ownPrivateKey",keyType:"private"},o={storageKey:"ownPublicKey",keyType:"public"},a={storageKey:"peerPublicKey",keyType:"public"};r.SCWKeyManager=class{constructor(){this.storage=new n.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(a,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(o.storageKey),this.storage.removeItem(s.storageKey),this.storage.removeItem(a.storageKey)}async generateKeyPair(){let e=await (0,i.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(s,e.privateKey),await this.storeKey(o,e.publicKey)}async loadKeysIfNeeded(){null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(s)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey(o)),(null===this.ownPrivateKey||null===this.ownPublicKey)&&await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(a)),null===this.sharedSecret&&null!==this.ownPrivateKey&&null!==this.peerPublicKey&&(this.sharedSecret=await (0,i.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey))}async loadKey(e){let t=this.storage.getItem(e.storageKey);return t?(0,i.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){let r=await (0,i.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}}},936463,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.SCWStateManager=void 0;let i=e.r(123614),n="accounts",s="activeChain",o="availableChains",a="walletCapabilities";r.SCWStateManager=class{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,r;this.storage=new i.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(o),this._walletCapabilities=this.loadItemFromStorage(a);const l=this.loadItemFromStorage(n),c=this.loadItemFromStorage(s);l&&this.updateListener.onAccountsUpdate({accounts:l,source:"storage"}),c&&this.updateListener.onChainUpdate({chain:c,source:"storage"}),this._accounts=l||[],this._activeChain=c||{id:null!=(r=null==(t=e.appChainIds)?void 0:t[0])?r:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(n,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;let r=null==(t=this.availableChains)?void 0:t.find(t=>t.id===e);return!!r&&(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(s,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"}),!0))}updateAvailableChains(e){if(!e||0===Object.keys(e).length)return;let t=Object.entries(e).map(([e,t])=>({id:Number(e),rpcUrl:t}));this.availableChains=t,this.storeItemToStorage(o,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(a,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){let t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}}},948260,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SCWSigner=void 0;let i=e.r(813722),n=e.r(936463),s=e.r(464357),o=e.r(243403),a=e.r(487182);r.SCWSigner=class{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new i.SCWKeyManager,this.stateManager=new n.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){let e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;let r=await (0,a.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);let i=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},i);let n=i.result;if("error"in n)throw n.error;return this.stateManager.accounts}async request(e){let t=this.tryLocalHandling(e);if(void 0!==t){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();let r=await this.sendEncryptedRequest(e),i=await this.decryptResponseMessage(r);this.updateInternalState(e,i);let n=i.result;if("error"in n)throw n.error;return n.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{let r=e.params;if(!r||!(null==(t=r[0])?void 0:t.chainId))throw s.standardErrors.rpc.invalidParams();let i=(0,o.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(i)?null:void 0}case"wallet_getCapabilities":{let e=this.stateManager.walletCapabilities;if(!e)throw s.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return e}default:return}}async sendEncryptedRequest(e){let t=await this.keyManager.getSharedSecret();if(!t)throw s.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");let r=await (0,a.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),i=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){let t=await (0,a.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){let t=e.content;if("failure"in t)throw t.failure;let r=await this.keyManager.getSharedSecret();if(!r)throw s.standardErrors.provider.unauthorized("Invalid session");return(0,a.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r,i;let n=null==(r=t.data)?void 0:r.chains;n&&this.stateManager.updateAvailableChains(n);let s=null==(i=t.data)?void 0:i.capabilities;s&&this.stateManager.updateWalletCapabilities(s);let a=t.result;if(!("error"in a))switch(e.method){case"eth_requestAccounts":{let e=a.value;this.stateManager.updateAccounts(e);break}case"wallet_switchEthereumChain":{if(null!==a.value)return;let t=e.params,r=(0,o.ensureIntNumber)(t[0].chainId);this.stateManager.switchChain(r)}}}}},468526,(e,t,r)=>{t.exports=e.r(219298).EventEmitter},317562,(e,t,r)=>{"use strict";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function n(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};
1t%2?i(Object(r),!0).forEach(function(t){var i,n,o;i=e,n=t,o=r[t],(n=s(n))in i?Object.defineProperty(i,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[n]=o}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}var o=e.r(843943).Buffer,a=void 0,l=a&&a.custom||"inspect";t.exports=function(){var e;function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");this.head=null,this.tail=null,this.length=0}return e=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,i=o.allocUnsafe(e>>>0),n=this.head,s=0;n;)t=n.data,r=s,o.prototype.copy.call(t,i,r),s+=n.data.length,n=n.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,s=e>n.length?n.length:e;if(s===n.length?i+=n:i+=n.slice(0,e),0==(e-=s)){s===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(s));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,s=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,s),0==(e-=s)){s===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(s));break}++i}return this.length-=i,t}},{key:l,value:function(e,t){return a(this,n(n({},t),{},{depth:0,customInspect:!1}))}}],function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,s(i.key),i)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}()},872555,(e,t,r)=>{"use strict";var i=e.i(247167);function n(e,t){o(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||(!e._readableState||e._readableState.emitClose)&&e.emit("close")}function o(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return a||l?t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.default.nextTick(o,this,e)):i.default.nextTick(o,this,e)):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?r._writableState?r._writableState.errorEmitted?i.default.nextTick(s,r):(r._writableState.errorEmitted=!0,i.default.nextTick(n,r,e)):i.default.nextTick(n,r,e):t?(i.default.nextTick(s,r),t(e)):i.default.nextTick(s,r)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}},461141,(e,t,r)=>{"use strict";var i={};function n(e,t,r){r||(r=Error);var n=function(e){function r(r,i,n){return e.call(this,"string"==typeof t?t:t(r,i,n))||this}return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.__proto__=e,r}(r);n.prototype.name=r.name,n.prototype.code=e,i[e]=n}function s(e,t){if(!Array.isArray(e))return"of ".concat(t," ").concat(String(e));var r=e.length;return(e=e.map(function(e){return String(e)}),r>2)?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}n("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invali
1d for option "'+e+'"'},TypeError),n("ERR_INVALID_ARG_TYPE",function(e,t,r){if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(l="must not be",t=t.replace(/^not /,"")):l="must be",n=" argument",(void 0===o||o>e.length)&&(o=e.length),e.substring(o-n.length,o)===n)c="The ".concat(e," ").concat(l," ").concat(s(t,"type"));else{var i,n,o,a,l,c,u=("number"!=typeof a&&(a=0),a+1>e.length||-1===e.indexOf(".",a))?"argument":"property";c='The "'.concat(e,'" ').concat(u," ").concat(l," ").concat(s(t,"type"))}return c+". Received type ".concat(typeof r)},TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},254472,(e,t,r)=>{"use strict";var i=e.r(461141).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,n){var s=null!=t.highWaterMark?t.highWaterMark:n?t[r]:null;if(null!=s){if(!(isFinite(s)&&Math.floor(s)===s)||s<0)throw new i(n?r:"highWaterMark",s);return Math.floor(s)}return e.objectMode?16:16384}}},405874,(e,t,r)=>{t.exports=function(e,t){if(i("noDeprecation"))return e;var r=!1;return function(){if(!r){if(i("throwDeprecation"))throw Error(t);i("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}};function i(t){try{if(!e.g.localStorage)return!1}catch(e){return!1}var r=e.g.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}},325724,(e,t,r)=>{"use strict";var i,n,s=e.i(247167);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){var r=t,i=e,n=r.entry;for(r.entry=null;n;){var s=n.callback;i.pendingcb--,s(void 0),n=n.next}i.corkedRequestsFree.next=r}}t.exports=k,k.WritableState=E;var a={deprecate:e.r(405874)},l=e.r(468526),c=e.r(843943).Buffer,u=e.g.Uint8Array||function(){},h=e.r(872555),d=e.r(254472).getHighWaterMark,p=e.r(461141).codes,f=p.ERR_INVALID_ARG_TYPE,g=p.ERR_METHOD_NOT_IMPLEMENTED,m=p.ERR_MULTIPLE_CALLBACK,w=p.ERR_STREAM_CANNOT_PIPE,y=p.ERR_STREAM_DESTROYED,v=p.ERR_STREAM_NULL_VALUES,b=p.ERR_STREAM_WRITE_AFTER_END,C=p.ERR_UNKNOWN_ENCODING,x=h.errorOrDestroy;function _(){}function E(t,r,n){i=i||e.r(509806),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=d(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new m;if(r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t)--r.pendingcb,i?(s.default.nextTick(n,t),s.default.nextTick(R,e,r),e._writableState.errorEmitted=!0,x(e,t)):(n(t),e._writableState.errorEmitted=!0,x(e,t),R(e,r));else{var o=T(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||A(e,r),i?s.default.nextTick(I,e,r,o,n):I(e,r,o,n)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}e.r(988935)(k,l),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t};try{Object.defineProperty(E.prototype,"buffer",{get:a.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}function k(t){var r=this instanceof(i=i||e.r(509806));if(!r&&!n.call(k,this))return new k(t);this._writableState=new E(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function S(e,t,r,i,n,s,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y("write")):r?e._writev(n,t.onwrite):e._write(n,s,t.onwrite),t.sync=!1}function I(e,t,r,i){var n,s;r||(n=e,0===(s=t).length&&s.needDrain&&(s.needDrain=!1,n.emit("drain"))),t.pendingcb--,i(),R(e,t)}function A(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=Array(t.bufferedRequestCount),n=t.corkedRequestsFree;n.entry=r;for(var s=0,a=!0;r;)i[s]=r,r.isBuf||(a=!1),r=r.next,s+=1;i.allBuffers=a,S(e,t,!0,t.length,i,"",n.finish),t.pendingcb++,t.lastBufferedRequest=null,n.next?(t.corkedRequestsFree=n.next,n.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,u=r.callback,h=t.objectMode?1:l.length;if(S(e,t,!1,h,l,c,u),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function T(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function P(e,t){e._final(function(r){t.pendingcb--,r&&x(e,r),t.prefinished=!0,e.emit("prefinish"),R(e,t)})}function R(e,t){var r=T(t);if(r&&(t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,s.default.nextTick(P,e,t))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===k&&e&&e._writableState instanceof E}})):n=function(e){return e instanceof this},k.prototype.pipe=function(){x(this,new w)},k.prototype.write=function(e,t,r){var i,n,o,a,l,h,d,p=this._writableState,g=!1,m=!p.objectMode&&(i=e,c.isBuffer(i)||i instanceof u);return(m&&!c.isBuffer(e)&&(n=e,e=c.from(n)),"function"==typeof t&&(r=t,t=null),m?t="buffer":t||(t=p.defaultEncoding),"function"!=typeof r&&(r=_),p.ending)?(o=r,x(this,a=new b),s.default.nextTick(o,a)):(m||(l=e,h=r,null===l?d=new v:"string"==typeof l||p.objectMode||(d=new f("chunk",["string","Buffer"],l)),!d||(x(this,d),s.default.nextTick(h,d),0)))&&(p.pendingcb++,g=function(e,t,r,i,n,s){if(!r){var o,a,l=(o=i,a=n,t.objectMode||!1===t.decodeStrings||"string"!=typeof o||(o=c.from(o,a)),o);i!==l&&(r=!0,n="buffer",i=l)}var u=t.objectMode?1:i.length;t.length+=u;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else S(e,t,!1,u,i,n,s);return h}(this,p,m,e,t,r)),g},k.prototype.cork=function(){this._writableState.corked++},k.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||A(this,e))},k.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new C(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(k.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),k.prototype._write=function(e,t,r){r(new g("_write()"))},k.prototype._writev=null,k.prototype.end=function(e,t,r){var i,n,o,a=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||(i=this,n=a,o=r,n.ending=!0,R(i,n),o&&(n.finished?s.default.nextTick(o):i.once("finish",o)),n.ended=!0,i.writable=!1),this},Object.defineProperty(k.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),k.prototype.destroy=h.destroy,k.prototype._undestroy=h.undestroy,k.prototype._destroy=function(e,t){t(e)}},509806,(e,t,r)=>{"use strict";var i=e.i(247167),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=u;var s=e.r(409104),o=e.r(325724);e.r(988935)(u,s);for(var a=n(o.prototype),l=0;l<a.length;l++){var c=a[l];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(e){if(!(this instanceof u))return new u(e);s.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||i.default.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},242524,(e,t,r)=>{var i=e.r(843943),n=i.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,r),r.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i.SlowBuffer(e)}},619049,(e,t,r)=>{"use strict";var i=e.r(242524).Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){var t;if(!e)return"utf8";for(;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";
1case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=h,t=3;break;default:this.write=d,this.end=p;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if((192&t[0])!=128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((192&t[1])!=128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&(192&t[2])!=128)return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length)}function l(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}r.StringDecoder=s,s.prototype.write=function(e){var t,r;if(0===e.length)return"";if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var n=o(t[i]);return n>=0?(n>0&&(e.lastNeed=n-1),n):--i<r||-2===n?0:(n=o(t[i]))>=0?(n>0&&(e.lastNeed=n-2),n):--i<r||-2===n?0:(n=o(t[i]))>=0?(n>0&&(2===n?n=0:e.lastNeed=n-3),n):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},580843,(e,t,r)=>{"use strict";var i=e.r(461141).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function e(t,r,s){if("function"==typeof r)return e(t,null,r);r||(r={}),o=s||n,a=!1,s=function(){if(!a){a=!0;for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];o.apply(this,t)}};var o,a,l=r.readable||!1!==r.readable&&t.readable,c=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||d()},h=t._writableState&&t._writableState.finished,d=function(){c=!1,h=!0,l||s.call(t)},p=t._readableState&&t._readableState.endEmitted,f=function(){l=!1,p=!0,c||s.call(t)},g=function(e){s.call(t,e)},m=function(){var e;return l&&!p?(t._readableState&&t._readableState.ended||(e=new i),s.call(t,e)):c&&!h?(t._writableState&&t._writableState.ended||(e=new i),s.call(t,e)):void 0},w=function(){t.req.on("finish",d)};return t.setHeader&&"function"==typeof t.abort?(t.on("complete",d),t.on("abort",m),t.req?w():t.on("request",w)):c&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",f),t.on("finish",d),!1!==r.error&&t.on("error",g),t.on("close",m),function(){t.removeListener("complete",d),t.removeListener("abort",m),t.removeListener("request",w),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",f),t.removeListener("error",g),t.removeListener("close",m)}}},177989,(e,t,r)=>{"use strict";var i,n=e.i(247167);function s(e,t,r){var i;return(t="symbol"==typeof(i=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e.r(580843),a=Symbol("lastResolve"),l=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),h=Symbol("lastPromise"),d=Symbol("handlePromise"),p=Symbol("stream");function f(e,t){return{value:e,done:t}}function g(e){var t=e[a];if(null!==t){var r=e[p].read();null!==r&&(e[h]=null,e[a]=null,e[l]=null,t(f(r,!1)))}}function m(e){n.default.nextTick(g,e)}var w=Object.getPrototypeOf(function(){}
1),y=Object.setPrototypeOf((s(i={get stream(){return this[p]},next:function(){var e,t,r=this,i=this[c];if(null!==i)return Promise.reject(i);if(this[u])return Promise.resolve(f(void 0,!0));if(this[p].destroyed)return new Promise(function(e,t){n.default.nextTick(function(){r[c]?t(r[c]):e(f(void 0,!0))})});var s=this[h];if(s)t=new Promise((e=this,function(t,r){s.then(function(){e[u]?t(f(void 0,!0)):e[d](t,r)},r)}));else{var o=this[p].read();if(null!==o)return Promise.resolve(f(o,!1));t=new Promise(this[d])}return this[h]=t,t}},Symbol.asyncIterator,function(){return this}),s(i,"return",function(){var e=this;return new Promise(function(t,r){e[p].destroy(null,function(e){e?r(e):t(f(void 0,!0))})})}),i),w);t.exports=function(e){var t,r=Object.create(y,(s(t={},p,{value:e,writable:!0}),s(t,a,{value:null,writable:!0}),s(t,l,{value:null,writable:!0}),s(t,c,{value:null,writable:!0}),s(t,u,{value:e._readableState.endEmitted,writable:!0}),s(t,d,{value:function(e,t){var i=r[p].read();i?(r[h]=null,r[a]=null,r[l]=null,e(f(i,!1))):(r[a]=e,r[l]=t)},writable:!0}),t));return r[h]=null,o(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[l];null!==t&&(r[h]=null,r[a]=null,r[l]=null,t(e)),r[c]=e;return}var i=r[a];null!==i&&(r[h]=null,r[a]=null,r[l]=null,i(f(void 0,!0))),r[u]=!0}),e.on("readable",m.bind(null,r)),r}},350429,(e,t,r)=>{t.exports=function(){throw Error("Readable.from is not available in the browser")}},409104,(e,t,r)=>{"use strict";var i,n,s,o,a,l=e.i(247167);t.exports=k,k.ReadableState=E,e.r(219298).EventEmitter;var c=function(e,t){return e.listeners(t).length},u=e.r(468526),h=e.r(843943).Buffer,d=e.g.Uint8Array||function(){},p={};n=p&&p.debuglog?p.debuglog("stream"):function(){};var f=e.r(317562),g=e.r(872555),m=e.r(254472).getHighWaterMark,w=e.r(461141).codes,y=w.ERR_INVALID_ARG_TYPE,v=w.ERR_STREAM_PUSH_AFTER_EOF,b=w.ERR_METHOD_NOT_IMPLEMENTED,C=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e.r(988935)(k,u);var x=g.errorOrDestroy,_=["error","close","destroy","pause","resume"];function E(t,r,n){i=i||e.r(509806),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(s||(s=e.f({string_decoder:{id:()=>619049,module:()=>e.r(619049)},"string_decoder/":{id:()=>619049,module:()=>e.r(619049)}})("string_decoder/").StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function k(t){if(i=i||e.r(509806),!(this instanceof k))return new k(t);var r=this instanceof i;this._readableState=new E(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function S(e,t,r,i,s){n("readableAddChunk",t);var o,a,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(n("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?T(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,P(e)))}}(e,l);else if(s||(a=function(e,t){var r;return h.isBuffer(t)||t instanceof d||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t)),r}(l,t)),a)x(e,a);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===h.prototype||(o=t,t=h.from(o)),i)l.endEmitted?x(e,new C):I(e,l,t,!0);else if(l.ended)x(e,new v);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!r?(t=l.decoder.write(t),l.objectMode||0!==t.length?I(e,l,t,!1):R(e,l)):I(e,l,t,!1)}else i||(l.reading=!1,R(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function I(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&T(e)),R(e,t)}function A(e,t){var r;if(e<=0||0===t.length&&t.ended)return 0;if(t.objectMode)return 1;if(e!=e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;return(e>t.highWaterMark&&((r=e)>=0x40000000?r=0x40000000:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),t.highWaterMark=r),e<=t.length)?e:t.ended?t.length:(t.needReadable=!0,0)}function T(e){var t=e._readableState;n("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(n("emitReadable",t.flowing),t.emittedReadable=!0,l.default.nextTick(P,e))}function P(e){var t=e._readableState;n("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function R(e,t){t.readingMore||(t.readingMore=!0,l.default.nextTick(O,e,t))}function O(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(n("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function $(e){n("readable nexttick read 0"),e.read(0)}function D(e,t){n("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(n("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){var r;return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r)}function U(e){var t=e._readableState;n("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,l.default.nextTick(M,t,e))}function M(e,t){if(n("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function q(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return -1}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),k.prototype.destroy=g.destroy,k.prototype._undestroy=g.undestroy,k.prototype._destroy=function(e,t){t(e)},k.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=h.from(e,t),t=""),r=!0),S(this,e,t,!1,r)},k.prototype.unshift=function(e){return S(this,e,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(t){s||(s=e.f({string_decoder:{id:()=>619049,module:()=>e.r(619049)},"string_decoder/":{id:()=>619049,module:()=>e.r(619049)}}
1)("string_decoder/").StringDecoder);var r=new s(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,n="";null!==i;)n+=r.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this},k.prototype.read=function(e){n("read",e),e=parseInt(e,10);var t,r=this._readableState,i=e;if(0!==e&&(r.emittedReadable=!1),0===e&&r.needReadable&&((0!==r.highWaterMark?r.length>=r.highWaterMark:r.length>0)||r.ended))return n("read: emitReadable",r.length,r.ended),0===r.length&&r.ended?U(this):T(this),null;if(0===(e=A(e,r))&&r.ended)return 0===r.length&&U(this),null;var s=r.needReadable;return n("need readable",s),(0===r.length||r.length-e<r.highWaterMark)&&n("length less than watermark",s=!0),r.ended||r.reading?n("reading or ended",s=!1):s&&(n("do read"),r.reading=!0,r.sync=!0,0===r.length&&(r.needReadable=!0),this._read(r.highWaterMark),r.sync=!1,r.reading||(e=A(i,r))),null===(t=e>0?j(e,r):null)?(r.needReadable=r.length<=r.highWaterMark,e=0):(r.length-=e,r.awaitDrain=0),0===r.length&&(r.ended||(r.needReadable=!0),i!==e&&r.ended&&U(this)),null!==t&&this.emit("data",t),t},k.prototype._read=function(e){x(this,new b("_read()"))},k.prototype.pipe=function(e,t){var r,i=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,n("pipe count=%d opts=%j",s.pipesCount,t);var o=t&&!1===t.end||e===l.default.stdout||e===l.default.stderr?m:a;function a(){n("onend"),e.end()}s.endEmitted?l.default.nextTick(o):i.once("end",o),e.on("unpipe",function t(r,o){n("onunpipe"),r===i&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,n("cleanup"),e.removeListener("close",f),e.removeListener("finish",g),e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",t),i.removeListener("end",a),i.removeListener("end",m),i.removeListener("data",d),h=!0,s.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u())});var u=(r=i,function(){var e=r._readableState;n("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&c(r,"data")&&(e.flowing=!0,L(r))});e.on("drain",u);var h=!1;function d(t){n("ondata");var r=e.write(t);n("dest.write",r),!1===r&&((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==q(s.pipes,e))&&!h&&(n("false write response, pause",s.awaitDrain),s.awaitDrain++),i.pause())}function p(t){n("onerror",t),m(),e.removeListener("error",p),0===c(e,"error")&&x(e,t)}function f(){e.removeListener("finish",g),m()}function g(){n("onfinish"),e.removeListener("close",f),m()}function m(){n("unpipe"),i.unpipe(e)}return i.on("data",d),!function(e,t,r){if("function"==typeof e.prependListener)return e.prepe
1ndListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",p),e.once("close",f),e.once("finish",g),e.emit("pipe",i),s.flowing||(n("pipe resume"),i.resume()),e},k.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=q(t.pipes,e);return -1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},k.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"!==e||i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,n("on readable",i.length,i.reading),i.length?T(this):i.reading||l.default.nextTick($,this)),r},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(e,t){var r=u.prototype.removeListener.call(this,e,t);return"readable"===e&&l.default.nextTick(N,this),r},k.prototype.removeAllListeners=function(e){var t=u.prototype.removeAllListeners.apply(this,arguments);return("readable"===e||void 0===e)&&l.default.nextTick(N,this),t},k.prototype.resume=function(){var e,t,r=this._readableState;return r.flowing||(n("resume"),r.flowing=!r.readableListening,e=this,(t=r).resumeScheduled||(t.resumeScheduled=!0,l.default.nextTick(D,e,t))),r.paused=!1,this},k.prototype.pause=function(){return n("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(n("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var s in e.on("end",function(){if(n("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(s){n("wrapped data"),r.decoder&&(s=r.decoder.write(s)),r.objectMode&&null==s||(r.objectMode||s&&s.length)&&(t.push(s)||(i=!0,e.pause()))}),e)void 0===this[s]&&"function"==typeof e[s]&&(this[s]=function(t){return function(){return e[t].apply(e,arguments)}}(s));for(var o=0;o<_.length;o++)e.on(_[o],this.emit.bind(this,_[o]));return this._read=function(t){n("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===o&&(o=e.r(177989)),o(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),k._fromList=j,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(t,r){return void 0===a&&(a=e.r(350429)),a(k,t,r)})},403805,(e,t,r)=>{"use strict";t.exports=u;var i=e.r(461141).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,s=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,l=e.r(509806);function c(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",h)}function h(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush(function(t,r){d(e,t,r)})}function d(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}e.r(988935)(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,r){r(new n("_transform()"))},u.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,function(e){t(e)})}},886160,(e,t,r)=>{"use strict";
1t.exports=n;var i=e.r(403805);function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}e.r(988935)(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},299082,(e,t,r)=>{"use strict";var i,n=e.r(461141).codes,s=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e){e()}function c(e,t){return e.pipe(t)}t.exports=function(){for(var t,r,n=arguments.length,u=Array(n),h=0;h<n;h++)u[h]=arguments[h];var d=(t=u).length&&"function"==typeof t[t.length-1]?t.pop():a;if(Array.isArray(u[0])&&(u=u[0]),u.length<2)throw new s("streams");var p=u.map(function(t,n){var s,a,c,h,f,g,m=n<u.length-1;return s=n>0,c=a=function(e){r||(r=e),e&&p.forEach(l),m||(p.forEach(l),d(r))},h=!1,a=function(){h||(h=!0,c.apply(void 0,arguments))},f=!1,t.on("close",function(){f=!0}),void 0===i&&(i=e.r(580843)),i(t,{readable:m,writable:s},function(e){if(e)return a(e);f=!0,a()}),g=!1,function(e){if(!f&&!g){if(g=!0,t.setHeader&&"function"==typeof t.abort)return t.abort();if("function"==typeof t.destroy)return t.destroy();a(e||new o("pipe"))}}});return u.reduce(c)}},136745,(e,t,r)=>{(r=t.exports=e.r(409104)).Stream=r,r.Readable=r,r.Writable=e.r(325724),r.Duplex=e.r(509806),r.Transform=e.r(403805),r.PassThrough=e.r(886160),r.finished=e.r(580843),r.pipeline=e.r(299082)},606782,(e,t,r)=>{var i=e.i(467034);let{Transform:n}=e.r(136745);t.exports=e=>class t extends n{constructor(t,r,i,n,s){super(s),this._rate=t,this._capacity=r,this._delimitedSuffix=i,this._hashBitLength=n,this._options=s,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let i=null;try{this.update(e,t)}catch(e){i=e}r(i)}_flush(e){let t=null;try{this.push(this.digest())}catch(e){t=e}e(t)}update(e,t){if(!i.Buffer.isBuffer(e)&&"string"!=typeof e)throw TypeError("Data must be a string or a buffer");if(this._finalized)throw Error("Digest already called");return i.Buffer.isBuffer(e)||(e=i.Buffer.from(e,t)),this._state.absorb(e),this}digest(e){if(this._finalized)throw Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let t=this._state.squeeze(this._hashBitLength/8);return void 0!==e&&(t=t.toString(e)),this._resetState(),t}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let e=new t(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}},756534,(e,t,r)=>{var i=e.i(467034);let{Transform:n}=e.r(136745);t.exports=e=>class t extends n{constructor(t,r,i,n){super(n),this._rate=t,this._capacity=r,this._delimitedSuffix=i,this._options=n,this._state=new e,this._state.initialize(t,r),this._finalized=!1}_transform(e,t,r){let i=null;try{this.update(e,t)}catch(e){i=e}r(i)}_flush(){}_read(e){this.push(this.squeeze(e))}update(e,t){if(!i.Buffer.isBuffer(e)&&"string"!=typeof e)throw TypeError("Data must be a string or a buffer");if(this._finalized)throw Error("Squeeze already called");return i.Buffer.isBuffer(e)||(e=i.Buffer.from(e,t)),this._state.absorb(e),this}squeeze(e,t){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(e);return void 0!==t&&(r=r.toString(t)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let e=new t(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(e._state),e._finalized=this._finalized,e}}},230573,(e,t,r)=>{let i=e.r(606782),n=e.r(756534);t.exports=function(e){let t=i(e),r=n(e);return function(e,i){switch("string"==typeof e?e.toLowerCase():e){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw Error("Invald algorithm: "+e)}}}},86054,(e,t,r)=>{let i=[1,0,32898,0,32906,0x80000000,0x80008000,0x80000000,32907,0,0x80000001,0,0x80008081,0x80000000,32777,0x80000000,138,0,136,0,0x80008009,0,0x8000000a,0,0x8000808b,0,139,0x80000000,32905,0x80000000,32771,0x80000000,32770,0x80000000,128,0x80000000,32778,0,0x8000000a,0x80000000,0x80008081,0x80000000,32896,0x80000000,0x80000001,0,0x80008008,0x80000000];r.p1600=function(e){for(let t=0;t<24;++t){let r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],o=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],h=e[8]^e[18]^e[28]^e[38]^e[48],d=e[9]^e[19]^e[29]^e[39]^e[49],p=h^(s<<1|o>>>31),f=d^(o<<1|s>>>31),g=e[0]^p,m=e[1]^f,w=e[10]^p,y=e[11]^f,v=e[20]^p,b=e[21]^f,C=e[30]^p,x=e[31]^f,_=e[40]^p,E=e[41]^f;p=r^(a<<1|l>>>31),f=n^(l<<1|a>>>31);let k=e[2]^p,S=e[3]^f,I=e[12]^p,A=e[13]^f,T=e[22]^p,P=e[23]^f,R=e[32]^p,O=e[33]^f,N=e[42]^p,$=e[43]^f;p=s^(c<<1|u>>>31),f=o^(u<<1|c>>>31);let D=e[4]^p,L=e[5]^f,j=e[14]^p,U=e[15]^f,M=e[24]^p,q=e[25]^f,W=e[34]^p,B=e[35]^f,z=e[44]^p,H=e[45]^f;p=a^(h<<1|d>>>31),f=l^(d<<1|h>>>31);let K=e[6]^p,V=e[7]^f,F=e[16]^p,G=e[17]^f,Y=e[26]^p,J=e[27]^f,Z=e[36]^p,Q=e[37]^f,X=e[46]^p,ee=e[47]^f;p=c^(r<<1|n>>>31),f=u^(n<<1|r>>>31);let et=e[8]^p,er=e[9]^f,ei=e[18]^p,en=e[19]^f,es=e[28]^p,eo=e[29]^f,ea=e[38]^p,el=e[39]^f,ec=e[48]^p,eu=e[49]^f,eh=y<<4|w>>>28,ed=w<<4|y>>>28,ep=v<<3|b>>>29,ef=b<<3|v>>>29,eg=x<<9|C>>>23,em=C<<9|x>>>23,ew=_<<18|E>>>14,ey=E<<18|_>>>14,ev=k<<1|S>>>31,eb=S<<1|k>>>31,eC=A<<12|I>>>20,ex=I<<12|A>>>20,e_=T<<10|P>>>22,eE=P<<10|T>>>22,ek=O<<13|R>>>19,eS=R<<13|O>>>19,eI=N<<2|$>>>30,eA=$<<2|N>>>30,eT=L<<30|D>>>2,eP=D<<30|L>>>2,eR=j<<6|U>>>26,eO=U<<6|j>>>26,eN=q<<11|M>>>21,e$=M<<11|q>>>21,eD=W<<15|B>>>17,eL=B<<15|W>>>17,ej=H<<29|z>>>3,eU=z<<29|H>>>3,eM=K<<28|V>>>4,eq=V<<28|K>>>4,eW=G<<23|F>>>9,eB=F<<23|G>>>9,ez=Y<<25|J>>>7,eH=J<<25|Y>>>7,eK=Z<<21|Q>>>11,eV=Q<<21|Z>>>11,eF=ee<<24|X>>>8,eG=X<<24|ee>>>8,eY=et<<27|er>>>5,eJ=er<<27|et>>>5,eZ=ei<<20|en>>>12,eQ=en<<20|ei>>>12,eX=eo<<7|es>>>25,e0=es<<7|eo>>>25,e1=ea<<8|el>>>24,e3=el<<8|ea>>>24,e2=ec<<14|eu>>>18,e5=eu<<14|ec>>>18;e[0]=g^~eC&eN,e[1]=m^~ex&e$,e[10]=eM^~eZ&ep,e[11]=eq^~eQ&ef,e[20]=ev^~eR&ez,e[21]=eb^~eO&eH,e[30]=eY^~eh&e_,e[31]=eJ^~ed&eE,e[40]=eT^~eW&eX,e[41]=eP^~eB&e0,e[2]=eC^~eN&eK,e[3]=ex^~e$&eV,e[12]=eZ^~ep&ek,e[13]=eQ^~ef&eS,e[22]=eR^~ez&e1,e[23]=eO^~eH&e3,e[32]=eh^~e_&eD,e[33]=ed^~eE&eL,e[42]=eW^~eX&eg,e[43]=eB^~e0&em,e[4]=eN^~eK&e2,e[5]=e$^~eV&e5,e[14]=ep^~ek&ej,e[15]=ef^~eS&eU,e[24]=ez^~e1&ew,e[25]=eH^~e3&ey,e[34]=e_^~eD&eF,e[35]=eE^~eL&eG,e[44]=eX^~eg&eI,e[45]=e0^~em&eA,e[6]=eK^~e2&g,e[7]=eV^~e5&m,e[16]=ek^~ej&eM,e[17]=eS^~eU&eq,e[26]=e1^~ew&ev,e[27]=e3^~ey&eb,e[36]=eD^~eF&eY,e[37]=eL^~eG&eJ,e[46]=eg^~eI&eT,e[47]=em^~eA&eP,e[8]=e2^~g&eC,e[9]=e5^~m&ex,e[18]=ej^~eM&eZ,e[19]=eU^~eq&eQ,e[28]=ew^~ev&eR,e[29]=ey^~eb&eO,e[38]=eF^~eY&eh,e[39]=eG^~eJ&ed,e[48]=eI^~eT&eW,e[49]=eA^~eP&eB,e[0]^=i[2*t],e[1]^=i[2*t+1]}}},692109,(e,t,r)=>{var i=e.i(467034);let n=e.r(86054);function s(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}s.prototype.initialize=function(e,t){for(let e=0;e<50;++e)this.state[e]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1},s.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<8*(this.count%4),this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0)},s.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<8*(this.count%4),(128&e)!=0&&this.count===this.blockSize-1&&n.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<8*((this.blockSize-1)%4),n.p1600(this.state),this.count=0,this.squeezing=!0},s.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);let t=i.Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(n.p1600(this.state),this.count=0);return t},s.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing},t.exports=s},452089,(e,t,r)=>{t.exports=e.r(230573)(e.r(692109))},684088,(e,t,r)=>{var i=e.i(467034);let n=e.r(452089);function s(e){return i.Buffer.allocUnsafe(e).fill(0)}function o(e,t){let r=e.toString(16);r.length%2!=0&&(r="0"+r);let n=r.match(/.{1,2}/g).map(e=>parseInt(e,16));for(;n.length<t;)n.unshift(0);return i.Buffer.from(n)}function a(e,t,r){let i=s(t);return(e=l(e),r)?e.length<t?(e.copy(i),i):e.slice(0,t):e.length<t?(e.copy(i,t-e.length),i):e.slice(-t)}function l(e){if(!i.Buffer.isBuffer(e))if(Array.isArray(e))e=i.Buffer.from(e);else if("string"==typeof e){var t;e=c(e)?i.Buffer.from((t=u(e)).length%2?"0"+t:t,"hex"):i.Buffer.from(e)}else if("number"==typeof e)e=intToBuffer(e);else if(null==e)e=i.Buffer.allocUnsafe(0);else if("bigint"==typeof e)e=o(e);else if(e.toArray)e=i.Buffer.from(e.toArray());else throw Error("invalid type");return e}function c(e){return"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)}function u(e){return"string"==typeof e&&e.startsWith("0x")?e.slice(2):e}t.exports={zeros:s,setLength:a,setLengthRight:function(e,t){return a(e,t,!0)},isHexString:c,stripHexPrefix:u,toBuffer:l,bufferToHex:function(e){return"0x"+(e=l(e)).toString("hex")},keccak:function(e,t){return e=l(e),t||(t=256),n("keccak"+t).update(e).digest()},bitLengthFromBigInt:function(e){return e.toString(2).length},bufferBEFromBigInt:o,twosFromBigInt:function(e,t){return(e<0n?(~e&(1n<<BigInt(t))-1n)+1n:e)&(1n<<BigInt(t))-1n}}},110797,(e,t,r)=>{var i=e.i(467034);let n=e.r(684088);function s(e){if(e.startsWith("int["))return"int256"+e.slice(3);if("int"===e)return"int256";if(e.startsWith("uint["))return"uint256"+e.slice(4);if("uint"===e)return"uint256";if(e.startsWith("fixed["))return"fixed128x128"+e.slice(5);else if("fixed"===e)return"fixed128x128";else if(e.startsWith("ufixed["))return"ufixed128x128"+e.slice(6);else if("ufixed"===e)return"ufixed128x128";return e}function o(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function a(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function l(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":parseInt(t[2],10):null}function c(e){var t=typeof e;if("string"===t||"number"===t)return BigInt(e);if("bigint"===t)return e;throw Error("Argument is not a number")}function u(e,t){if("address"===e)return u("uint160",c(t));if("bool"===e)return u("uint8",+!!t);if("string"===e)return u("bytes",new i.Buffer(t,"utf8"));if((p=e).lastIndexOf("]")===p.length-1){if(void 0===t.length)throw Error("Not an array?");if("dynamic"!==(r=l(e))&&0!==r&&t.length>r)throw Error("Elements exceed array size: "+r);for(d in h=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)h.push(u(e,t[d]));if("dynamic"===r){var r,s,h,d,p,f=u("uint256",t.length);h.unshift(f)}return i.Buffer.concat(h)}else if("bytes"===e)return t=new i.Buffer(t),h=i.Buffer.concat([u("uint256",t.length),t]),t.length%32!=0&&(h=i.Buffer.concat([h,n.zeros(32-t.length%32)])),h;else if(e.startsWith("bytes")){if((r=o(e))<1||r>32)throw Error("Invalid bytes<N> width: "+r);return n.setLengthRight(t,32)}else if(e.startsWith("uint")){if((r=o(e))%8||r<8||r>256)throw Error("Invalid uint<N> width: "+r);s=c(t);let i=n.bitLengthFromBigInt(s);if(i>r)throw Error("Supplied uint exceeds width: "+r+" vs "+i);if(s<0)throw Error("Supplied uint is negative");return n.bufferBEFromBigInt(s,32)}else if(e.startsWith("int")){if((r=o(e))%8||r<8||r>256)throw Error("Invalid int<N> width: "+r);s=c(t);let i=n.bitLengthFromBigInt(s);if(i>r)throw Error("Supplied int exceeds width: "+r+" vs "+i);let a=n.twosFromBigInt(s,256);return n.bufferBEFromBigInt(a,32)}else if(e.startsWith("ufixed")){if(r=a(e),(s=c(t))<0)throw Error("Supplied ufixed is negative");return u("uint256",s*BigInt(2)**BigInt(r[1]))}else if(e.startsWith("fixed"))return r=a(e),u("int256",c(t)*BigInt(2)**BigInt(r[1]));throw Error("Unsupported or invalid type: "+e)}function h(e,t){if(e.length!==t.length)throw Error("Number of types are not matching the values");for(var r,a,l=[],u=0;u<e.length;u++){var h=s(e[u]),d=t[u];
vendor: 4,397 bytes, line 1
1if("bytes"===h)l.push(d);else if("string"===h)l.push(new i.Buffer(d,"utf8"));else if("bool"===h)l.push(new i.Buffer(d?"01":"00","hex"));else if("address"===h)l.push(n.setLength(d,20));else if(h.startsWith("bytes")){if((r=o(h))<1||r>32)throw Error("Invalid bytes<N> width: "+r);l.push(n.setLengthRight(d,r))}else if(h.startsWith("uint")){if((r=o(h))%8||r<8||r>256)throw Error("Invalid uint<N> width: "+r);a=c(d);let e=n.bitLengthFromBigInt(a);if(e>r)throw Error("Supplied uint exceeds width: "+r+" vs "+e);l.push(n.bufferBEFromBigInt(a,r/8))}else if(h.startsWith("int")){if((r=o(h))%8||r<8||r>256)throw Error("Invalid int<N> width: "+r);a=c(d);let e=n.bitLengthFromBigInt(a);if(e>r)throw Error("Supplied int exceeds width: "+r+" vs "+e);let t=n.twosFromBigInt(a,r);l.push(n.bufferBEFromBigInt(t,r/8))}else throw Error("Unsupported or invalid type: "+h)}return i.Buffer.concat(l)}t.exports={rawEncode:function(e,t){var r=[],n=[],o=32*e.length;for(var a in e){var c=s(e[a]),h=u(c,t[a]);"string"===c||"bytes"===c||"dynamic"===l(c)?(r.push(u("uint256",o)),n.push(h),o+=h.length):r.push(h)}return i.Buffer.concat(r.concat(n))},solidityPack:h,soliditySHA3:function(e,t){return n.keccak(h(e,t))}}},541809,(e,t,r)=>{var i=e.i(467034);let n=e.r(684088),s=e.r(110797),o={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},a={encodeData(e,t,r,o=!0){let a=["bytes32"],l=[this.hashType(e,r)];if(o){let c=(e,t,a)=>{if(void 0!==r[t])return["bytes32",null==a?"0x0000000000000000000000000000000000000000000000000000000000000000":n.keccak(this.encodeData(t,a,r,o))];if(void 0===a)throw Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",n.keccak(a)];if("string"===t)return"string"==typeof a&&(a=i.Buffer.from(a,"utf8")),["bytes32",n.keccak(a)];if(t.lastIndexOf("]")===t.length-1){let r=t.slice(0,t.lastIndexOf("[")),i=a.map(t=>c(e,r,t));return["bytes32",n.keccak(s.rawEncode(i.map(([e])=>e),i.map(([,e])=>e)))]}return[t,a]};for(let i of r[e]){let[e,r]=c(i.name,i.type,t[i.name]);a.push(e),l.push(r)}}else for(let s of r[e]){let e=t[s.name];if(void 0!==e)if("bytes"===s.type)a.push("bytes32"),e=n.keccak(e),l.push(e);else if("string"===s.type)a.push("bytes32"),"string"==typeof e&&(e=i.Buffer.from(e,"utf8")),e=n.keccak(e),l.push(e);else if(void 0!==r[s.type])a.push("bytes32"),e=n.keccak(this.encodeData(s.type,e,r,o)),l.push(e);else if(s.type.lastIndexOf("]")===s.type.length-1)throw Error("Arrays currently unimplemented in encodeData");else a.push(s.type),l.push(e)}return s.rawEncode(a,l)},encodeType(e,t){let r="",i=this.findTypeDependencies(e,t).filter(t=>t!==e);for(let n of i=[e].concat(i.sort())){if(!t[n])throw Error("No type definition specified: "+n);r+=n+"("+t[n].map(({name:e,type:t})=>t+" "+e).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||void 0===t[e])return r;for(let i of(r.push(e),t[e]))for(let e of this.findTypeDependencies(i.type,t,r))r.includes(e)||r.push(e);return r},hashStruct(e,t,r,i=!0){return n.keccak(this.encodeData(e,t,r,i))},hashType(e,t){return n.keccak(this.encodeType(e,t))},sanitizeData(e){let t={};for(let r in o.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){let r=this.sanitizeData(e),s=[i.Buffer.from("1901","hex")];return s.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),"EIP712Domain"!==r.primaryType&&s.push(this.hashStruct(r.primaryType,r.message,r.types,t)),n.keccak(i.Buffer.concat(s))}};t.exports={TYPED_MESSAGE_SCHEMA:o,TypedDataUtils:a,hashForSignTypedDataLegacy:function(e){return function(e){let t=Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;let r=e.map(function(e){return"bytes"===e.type?n.toBuffer(e.value):e.value}),i=e.map(function(e){return e.type}),o=e.map(function(e){if(!e.name)throw t;return e.type+" "+e.name});return s.soliditySHA3(["bytes32","bytes32"],[s.soliditySHA3(Array(e.length).fill("string"),o),s.soliditySHA3(i,r)])}(e.data)},hashForSignTypedData_v3:function(e){return a.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return a.hash(e.data)}}},627845,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.APP_VERSION_KEY=r.LOCAL_STORAGE_ADDRESSES_KEY=r.WALLET_USER_NAME_KEY=void 0,r.WALLET_USER_NAME_KEY="walletUsername",r.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",r.APP_VERSION_KEY="AppVersion"},895678,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.RelayEventManager=void 0;let i=e.r(243403);r.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%0x7fffffff;let e=this._nextRequestId,t=(0,i.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}},698841,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkCipher=void 0;let i=e.r(243403);r.WalletLinkCipher=class{constructor(e){this.secret=e}async encrypt(e){let t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");let r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.importKey("raw",(0,i.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},n,s.encode(e)),a=o.slice(o.byteLength-16),l=o.slice(0,o.byteLength-16),c=new Uint8Array(a),u=new Uint8Array(l),h=new Uint8Array([...r,...c,...u]);return(0,i.uint8ArrayToHex)(h)}async decrypt(e){let t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise((r,n)=>{!async function(){let s=await crypto.subtle.importKey("raw",(0,i.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=(0,i.hexStringToUint8Array)(e),a=o.slice(0,12),l=o.slice(12,28),c=new Uint8Array([...o.slice(28),...l]),u={name:"AES-GCM",iv:new Uint8Array(a)};try{let e=await window.crypto.subtle.decrypt(u,s,c),t=new TextDecoder;r(t.decode(e))}catch(e){n(e)}}()})}}},217082,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkHTTP=void 0,r.WalletLinkHTTP=class{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const i=`${t}:${r}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(e=>console.error("Unabled to mark event as failed:",e))}async fetchUnseenEvents(){var e;let t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){let{events:r,error:i}=await t.json();if(i)throw Error(`Check unseen events failed: ${i}`);let n=null!=(e=null==r?void 0:r.filter(e=>"Web3Response"===e.event).map(e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data})))?e:[];return this.markUnseenEventsAsSeen(n),n}throw Error(`Check unseen events failed: ${t.status}`)}}},78090,(e,t,r)=>{"use strict";var i,n;Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkWebSocket=r.ConnectionState=void 0,(n=i||(r.ConnectionState=i={}))[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED",r.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw Error("webSocket object is not null");return new Promise((e,t)=>{var r;let n;try{this.webSocket=n=new this.WebSocketClass(this.url)}catch(e){t(e);return}null==(r=this.connectionStateListener)||r.call(this,i.CONNECTING),n.onclose
1=e=>{var r;this.clearWebSocket(),t(Error(`websocket error ${e.code}: ${e.reason}`)),null==(r=this.connectionStateListener)||r.call(this,i.DISCONNECTED)},n.onopen=t=>{var r;e(),null==(r=this.connectionStateListener)||r.call(this,i.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(e=>this.sendData(e)),this.pendingData=[])},n.onmessage=e=>{var t,r;if("h"===e.data)null==(t=this.incomingDataListener)||t.call(this,{type:"Heartbeat"});else try{let t=JSON.parse(e.data);null==(r=this.incomingDataListener)||r.call(this,t)}catch(e){}}})}disconnect(){var e;let{webSocket:t}=this;if(t){this.clearWebSocket(),null==(e=this.connectionStateListener)||e.call(this,i.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(e){}}}sendData(e){let{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){let{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}},673822,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkConnection=void 0;let i=e.r(627845),n=e.r(698841),s=e.r(217082),o=e.r(78090),a=e.r(550906);r.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:r,WebSocketClass:l=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,a.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{e&&new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]).forEach((t,r)=>{let i=e[r];void 0!==i&&t(i)})},this.handleDestroyed=e=>{var t;"1"===e&&(null==(t=this.listener)||t.resetAndReload())},this.handleAccountUpdated=async e=>{var t;{let r=await this.cipher.decrypt(e);null==(t=this.listener)||t.accountUpdated(r)}},this.handleMetadataUpdated=async(e,t)=>{var r;{let i=await this.cipher.decrypt(t);null==(r=this.listener)||r.metadataUpdated(e,i)}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(i.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(i.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var r;{let i=await this.cipher.decrypt(e),n=await this.cipher.decrypt(t);null==(r=this.listener)||r.chainUpdated(i,n)}},this.session=e,this.cipher=new n.WalletLinkCipher(e.secret),this.listener=r;const c=new o.WalletLinkWebSocket(`${t}/rpc`,l);c.setConnectionStateListener(async e=>{let t=!1;switch(e){case o.ConnectionState.DISCONNECTED:if(!this.destroyed){let e=async()=>{await new Promise(e=>setTimeout(e,5e3)),this.destroyed||c.connect().catch(()=>{e()})};e()}break;case o.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),t=!0}catch(e){}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case o.ConnectionState.CONNECTING:}this.connected!==t&&(this.connected=t)}),c.setIncomingDataListener(e=>{var t;switch(e.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{let t="IsLinkedOK"===e.type?e.linked:void 0;this.linked=t||e.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":this.handleSessionMetadataUpdated(e.metadata);break;case"Event":this.handleIncomingEvent(e)}void 0!==e.id&&(null==(t=this.requestResolutions.get(e.id))||t(e))}),this.ws=c,this.http=new s.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&(null==(t=this.onceConnected)||t.call(this))}setOnceConnected(e){return new Promise(t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&(null==(t=this.onceLinked)||t.call(this)),null==(r=this.listener)||r.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if("Event"===e.type&&"Web3Response"===e.event){let r=JSON.parse(await this.cipher.decrypt(e.data));if("WEB3_RESPONSE"!==r.type)return;null==(t=this.listener)||t.handleWeb3ResponseMessage(r)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEac
1h(e=>this.handleIncomingEvent(e))}async setSessionMetadata(e,t){let r={type:"SetSessionConfig",id:(0,a.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{let e=await this.makeRequest(r);if("Fail"===e.type)throw Error(e.error||"failed to set session metadata")})}async publishEvent(e,t,r=!1){let i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),n={type:"PublishEvent",id:(0,a.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:r};return this.setOnceLinked(async()=>{let e=await this.makeRequest(n);if("Fail"===e.type)throw Error(e.error||"failed to publish event");return e.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)return void this.ws.disconnect();try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){let r,i=e.id;return this.sendData(e),Promise.race([new Promise((e,n)=>{r=window.setTimeout(()=>{n(Error(`request ${i} timed out`))},t)}),new Promise(e=>{this.requestResolutions.set(i,t=>{clearTimeout(r),e(t),this.requestResolutions.delete(i)})})])}async authenticate(){let e={type:"HostSession",id:(0,a.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw Error(t.error||"failed to authenticate")}sendIsLinked(){let e={type:"IsLinked",id:(0,a.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){let e={type:"GetSessionConfig",id:(0,a.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}},649947,(e,t,r)=>{var i={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},8224,(e,t,r)=>{"use strict";t.exports=TypeError},608435,(e,t,r)=>{"use strict";t.exports=Object},639857,(e,t,r)=>{"use strict";t.exports=Error},974660,(e,t,r)=>{"use strict";t.exports=EvalError},930575,(e,t,r)=>{"use strict";t.exports=RangeError},265756,(e,t,r)=>{"use strict";t.exports=ReferenceError},143e3,(e,t,r)=>{"use strict";t.exports=SyntaxError},420570,(e,t,r)=>{"use strict";t.exports=URIError},860410,(e,t,r)=>{"use strict";t.exports=Math.abs},692069,(e,t,r)=>{"use strict";t.exports=Math.floor},400315,(e,t,r)=>{"use strict";t.exports=Math.max},869897,(e,t,r)=>{"use strict";t.exports=Math.min},755752,(e,t,r)=>{"use strict";t.exports=Math.pow}
1,156056,(e,t,r)=>{"use strict";t.exports=Math.round},280407,(e,t,r)=>{"use strict";t.exports=Number.isNaN||function(e){return e!=e}},159532,(e,t,r)=>{"use strict";var i=e.r(280407);t.exports=function(e){return i(e)||0===e?e:e<0?-1:1}},267359,(e,t,r)=>{"use strict";t.exports=Object.getOwnPropertyDescriptor},593892,(e,t,r)=>{"use strict";var i=e.r(267359);if(i)try{i([],"length")}catch(e){i=null}t.exports=i},123775,(e,t,r)=>{"use strict";var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}t.exports=i},651739,(e,t,r)=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t||"[object Symbol]"!==Object.prototype.toString.call(t)||"[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(var i in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length||"function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var s=Object.getOwnPropertyDescriptor(e,t);if(42!==s.value||!0!==s.enumerable)return!1}return!0}},130949,(e,t,r)=>{"use strict";var i="u">typeof Symbol&&Symbol,n=e.r(651739);t.exports=function(){return"function"==typeof i&&"function"==typeof Symbol&&"symbol"==typeof i("foo")&&"symbol"==typeof Symbol("bar")&&n()}},675672,(e,t,r)=>{"use strict";t.exports="u">typeof Reflect&&Reflect.getPrototypeOf||null},343264,(e,t,r)=>{"use strict";t.exports=e.r(608435).getPrototypeOf||null},277018,(e,t,r)=>{"use strict";var i=Object.prototype.toString,n=Math.max,s=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var n=0;n<t.length;n+=1)r[n+e.length]=t[n];return r},o=function(e,t){for(var r=[],i=t||0,n=0;i<e.length;i+=1,n+=1)r[n]=e[i];return r},a=function(e,t){for(var r="",i=0;i<e.length;i+=1)r+=e[i],i+1<e.length&&(r+=t);return r};t.exports=function(e){var t,r=this;if("function"!=typeof r||"[object Function]"!==i.apply(r))throw TypeError("Function.prototype.bind called on incompatible "+r);for(var l=o(arguments,1),c=n(0,r.length-l.length),u=[],h=0;h<c;h++)u[h]="$"+h;if(t=Function("binder","return function ("+a(u,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof t){var i=r.apply(this,s(l,arguments));return Object(i)===i?i:this}return r.apply(e,s(l,arguments))}),r.prototype){var d=function(){};d.prototype=r.prototype,t.prototype=new d,d.prototype=null}return t}},932672,(e,t,r)=>{"use strict";var i=e.r(277018);t.exports=Function.prototype.bind||i},600358,(e,t,r)=>{"use strict";t.exports=Function.prototype.call},102215,(e,t,r)=>{"use strict";t.exports=Function.prototype.apply},130637,(e,t,r)=>{"use strict";t.exports="u">typeof Reflect&&Reflect&&Reflect.apply},256450,(e,t,r)=>{"use strict";var i=e.r(932672),n=e.r(102215),s=e.r(600358);t.exports=e.r(130637)||i.call(s,n)},943569,(e,t,r)=>{"use strict";var i=e.r(932672),n=e.r(8224),s=e.r(600358),o=e.r(256450);t.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new n("a function is required");return o(i,s,e)}},190482,(e,t,r)=>{"use strict";var i,n=e.r(943569),s=e.r(593892);try{i=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var o=!!i&&s&&s(Object.prototype,"__proto__"),a=Object,l=a.getPrototypeOf;t.exports=o&&"function"==typeof o.get?n([o.get]):"function"==typeof l&&function(e){return l(null==e?e:a(e))}},942527,(e,t,r)=>{"use strict";var i=e.r(675672),n=e.r(343264),s=e.r(190482);t.exports=i?function(e){return i(e)}:n?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw TypeError("getProto: not an object");return n(e)}:s?function(e){return s(e)}:null},705843,(e,t,r)=>{"use strict";var i=Function.prototype.call,n=Object.prototype.hasOwnProperty;t.exports=e.r(932672).call(i,n)},578586,(e,t,r)=>{"use strict";var i=e.r(608435),n=e.r(639857),s=e.r(974660),o=e.r(930575),a=e.r(265756),l=e.r(143e3),c=e.r(8224),u=e.r(420570),h=e.r(860410),d=e.r(692069),p=e.r(400315),f=e.r(869897),g=e.r(755752),m=e.r(156056),w=e.r(159532),y=Function,v=function(e){try{return y('"use strict"; return ('+e+").constructor;")()}catch(e){}},b=e.r(593892),C=e.r(123775),x=function(){throw new c},_=b?function(){try{return arguments.callee,x}catch(e){try{return b(arguments,"callee").get}catch(e){return x}}}():x,E=e.r(130949)(),k=e.r(942527),S=e.r(343264),I=e.r(675672),A=e.r(102215),T=e.r(600358),P={},R="u">typeof Uint8Array&&k?k(Uint8Array):void 0,O={__proto__:null,"%AggregateError%":"u"<typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"u"<typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":E&&k?k([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":"u"<typeof Atomics?void 0:Atomics,"%BigInt%":"u"<typeof BigInt?void 0:BigInt,"%BigInt64Array%":"u"<typeof BigInt64Array?void 0:BigInt64Array,"%BigUint64Array%":"u"<typeof BigUint64Array?void 0:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"u"<typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":n,"%eval%":eval,"%EvalError%":s,"%Float16Array%":"u"<typeof Float16Array?void 0:Float16Array,"%Float32Array%":"u"<typeof Float32Array?void 0:Float32Array,"%Float64Array%":"u"<typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"u"<typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":P,"%Int8Array%":"u"<typeof Int8Array?void 0:Int8Array,"%Int16Array%":"u"<typeof Int16Array?void 0:Int16Array,"%Int32Array%":"u"<typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%
1IteratorPrototype%":E&&k?k(k([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"u"<typeof Map?void 0:Map,"%MapIteratorPrototype%":"u">typeof Map&&E&&k?k(new Map()[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"u"<typeof Promise?void 0:Promise,"%Proxy%":"u"<typeof Proxy?void 0:Proxy,"%RangeError%":o,"%ReferenceError%":a,"%Reflect%":"u"<typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"u"<typeof Set?void 0:Set,"%SetIteratorPrototype%":"u">typeof Set&&E&&k?k(new Set()[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"u"<typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":E&&k?k(""[Symbol.iterator]()):void 0,"%Symbol%":E?Symbol:void 0,"%SyntaxError%":l,"%ThrowTypeError%":_,"%TypedArray%":R,"%TypeError%":c,"%Uint8Array%":"u"<typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"u"<typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"u"<typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"u"<typeof Uint32Array?void 0:Uint32Array,"%URIError%":u,"%WeakMap%":"u"<typeof WeakMap?void 0:WeakMap,"%WeakRef%":"u"<typeof WeakRef?void 0:WeakRef,"%WeakSet%":"u"<typeof WeakSet?void 0:WeakSet,"%Function.prototype.call%":T,"%Function.prototype.apply%":A,"%Object.defineProperty%":C,"%Object.getPrototypeOf%":S,"%Math.abs%":h,"%Math.floor%":d,"%Math.max%":p,"%Math.min%":f,"%Math.pow%":g,"%Math.round%":m,"%Math.sign%":w,"%Reflect.getPrototypeOf%":I};if(k)try{null.error}catch(e){var N=k(k(e));O["%Error.prototype%"]=N}var $=function e(t){var r;if("%AsyncFunction%"===t)r=v("async function () {}");else if("%GeneratorFunction%"===t)r=v("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=v("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var n=e("%AsyncGenerator%");n&&k&&(r=k(n.prototype))}return O[t]=r,r},D={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},L=e.r(932672),j=e.r(705843),U=L.call(T,Array.prototype.concat),M=L.call(A,Array.prototype.splice),q=L.call(T,String.prototype.replace),W=L.call(T,String.prototype.slice),B=L.call(T,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,H=/\\(\\)?/g,K=function(e){var t=W(e,0,1),r=W(e,-1);if("%"===t&&"%"!==r)throw new l("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new l("invalid intrinsic syntax, expected opening `%`");var i=[];return q(e,z,function(e,t,r,n){i[i.length]=r?q(n,H,"$1"):t||e}),i},V=function(e,t){var r,i=e;if(j(D,i)&&(i="%"+(r=D[i])[0]+"%"),j(O,i)){var n=O[i];if(n===P&&(n=$(i)),void 0===n&&!t)throw new c("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:i,value:n}}throw new l("intrinsic "+e+" does not exist!")};t.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new c('"allowMissing" argument must be a boolean');if(null===B(/^%?[^%]*%?$/,e))throw new l("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=K(e),i=r.length>0?r[0]:"",n=V("%"+i+"%",t),s=n.name,o=n.value,a=!1,u=n.alias;u&&(i=u[0],M(r,U([0,1],u)));for(var h=1,d=!0;h<r.length;h+=1){var p=r[h],f=W(p,0,1),g=W(p,-1);if(('"'===f||"'"===f||"`"===f||'"'===g||"'"===g||"`"===g)&&f!==g)throw new l("property names with quotes must have matching quotes");if("constructor"!==p&&d||(a=!0),i+="."+p,j(O,s="%"+i+"%"))o=O[s];
1else if(null!=o){if(!(p in o)){if(!t)throw new c("base intrinsic for "+e+" exists, but the property is not available.");return}if(b&&h+1>=r.length){var m=b(o,p);o=(d=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:o[p]}else d=j(o,p),o=o[p];d&&!a&&(O[s]=o)}}return o}},325887,(e,t,r)=>{"use strict";var i=e.r(578586),n=e.r(943569),s=n([i("%String.prototype.indexOf%")]);t.exports=function(e,t){var r=i(e,!!t);return"function"==typeof r&&s(e,".prototype.")>-1?n([r]):r}},719972,(e,t,r)=>{"use strict";var i,n,s=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{i=Object.defineProperty({},"length",{get:function(){throw n}}),n={},o(function(){throw 42},null,i)}catch(e){e!==n&&(o=null)}else o=null;var a=/^\s*class\b/,l=function(e){try{var t=s.call(e);return a.test(t)}catch(e){return!1}},c=function(e){try{if(l(e))return!1;return s.call(e),!0}catch(e){return!1}},u=Object.prototype.toString,h="function"==typeof Symbol&&!!Symbol.toStringTag,d=!(0 in[,]),p=function(){return!1};if("object"==typeof document){var f=document.all;u.call(f)===u.call(document.all)&&(p=function(e){if((d||!e)&&(void 0===e||"object"==typeof e))try{var t=u.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}t.exports=o?function(e){if(p(e))return!0;if(!e||"function"!=typeof e&&"object"!=typeof e)return!1;try{o(e,null,i)}catch(e){if(e!==n)return!1}return!l(e)&&c(e)}:function(e){if(p(e))return!0;if(!e||"function"!=typeof e&&"object"!=typeof e)return!1;if(h)return c(e);if(l(e))return!1;var t=u.call(e);return("[object Function]"===t||"[object GeneratorFunction]"===t||!!/^\[object HTML/.test(t))&&c(e)}},58871,(e,t,r)=>{"use strict";var i=e.r(719972),n=Object.prototype.toString,s=Object.prototype.hasOwnProperty,o=function(e,t,r){for(var i=0,n=e.length;i<n;i++)s.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))},a=function(e,t,r){for(var i=0,n=e.length;i<n;i++)null==r?t(e.charAt(i),i,e):t.call(r,e.charAt(i),i,e)},l=function(e,t,r){for(var i in e)s.call(e,i)&&(null==r?t(e[i],i,e):t.call(r,e[i],i,e))};t.exports=function(e,t,r){var s;if(!i(t))throw TypeError("iterator must be a function");(arguments.length>=3&&(s=r),"[object Array]"===n.call(e))?o(e,t,s):"string"==typeof e?a(e,t,s):l(e,t,s)}},482913,(e,t,r)=>{"use strict";t.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},229989,(e,t,r)=>{"use strict";var i=e.r(482913),n="u"<typeof globalThis?e.g:globalThis;t.exports=function(){for(var e=[],t=0;t<i.length;t++)"function"==typeof n[i[t]]&&(e[e.length]=i[t]);return e}},900077,(e,t,r)=>{"use strict";var i=e.r(123775),n=e.r(143e3),s=e.r(8224),o=e.r(593892);t.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new s("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new s("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],h=!!o&&o(e,t);if(i)i(e,t,{configurable:null===c&&h?h.configurable:!c,enumerable:null===a&&h?h.enumerable:!a,value:r,writable:null===l&&h?h.writable:!l});else if(!u&&(a||l||c))throw new n("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");else e[t]=r}},982703,(e,t,r)=>{"use strict";var i=e.r(123775),n=function(){return!!i};n.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},t.exports=n},229211,(e,t,r)=>{"use strict";var i=e.r(578586),n=e.r(900077),s=e.r(982703)(),o=e.r(593892),a=e.r(8224),l=i("%Math.floor%");t.exports=function(e,t){if("function"!=typeof e)throw new a("`fn` is not a function");if("number"!=typeof t||t<0||t>0xffffffff||l(t)!==t)throw new a("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,c=!0;if("length"in e&&o){var u=o(e,"length");u&&!u.configurable&&(i=!1),u&&!u.writable&&(c=!1)}return(i||c||!r)&&(s?n(e,"length",t,!0,!0):n(e,"length",t)),e}},557735,(e,t,r)=>{"use strict";var i=e.r(932672),n=e.r(102215),s=e.r(256450);t.exports=function(){return s(i,n,arguments)}},647967,(e,t,r)=>{"use strict";var i=e.r(229211),n=e.r(123775),s=e.r(943569),o=e.r(557735);t.exports=function(e){var t=s(arguments),r=1+e.length-(arguments.length-1);return i(t,r>0?r:0,!0)},n?n(t.exports,"apply",{value:o}):t.exports.apply=o},619655,(e,t,r)=>{"use strict";var i=e.r(651739);t.exports=function(){return i()&&!!Symbol.toStringTag}},554952,(e,t,r)=>{"use strict";var i=e.r(58871),n=e.r(229989),s=e.r(647967),o=e.r(325887),a=e.r(593892),l=e.r(942527),c=o("Ob
1ject.prototype.toString"),u=e.r(619655)(),h="u"<typeof globalThis?e.g:globalThis,d=n(),p=o("String.prototype.slice"),f=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return -1},g={__proto__:null};u&&a&&l?i(d,function(e){var t=new h[e];if(Symbol.toStringTag in t&&l){var r=l(t),i=a(r,Symbol.toStringTag);if(!i&&r&&(i=a(l(r),Symbol.toStringTag)),i&&i.get){var n=s(i.get);g["$"+e]=n}}}):i(d,function(e){var t=new h[e],r=t.slice||t.set;if(r){var i=s(r);g["$"+e]=i}}),t.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!u){var t,r,n=p(c(e),8,-1);return f(d,n)>-1?n:"Object"===n&&(r=!1,i(g,function(t,i){if(!r)try{t(e),r=p(i,1)}catch(e){}}),r)}return a?(t=!1,i(g,function(r,i){if(!t)try{"$"+r(e)===i&&(t=p(i,1))}catch(e){}}),t):null}},74425,(e,t,r)=>{"use strict";var i=e.r(554952);t.exports=function(e){return!!i(e)}},426197,(e,t,r)=>{"use strict";var i=e.r(8224),n=e.r(325887)("TypedArray.prototype.buffer",!0),s=e.r(74425);t.exports=n||function(e){if(!s(e))throw new i("Not a Typed Array");return e.buffer}},801448,(e,t,r)=>{"use strict";var i=e.r(242524).Buffer,n=e.r(649947),s=e.r(426197),o=ArrayBuffer.isView||function(e){try{return s(e),!0}catch(e){return!1}},a="u">typeof Uint8Array,l="u">typeof ArrayBuffer&&"u">typeof Uint8Array,c=l&&(i.prototype instanceof Uint8Array||i.TYPED_ARRAY_SUPPORT);t.exports=function(e,t){if(i.isBuffer(e))return!e.constructor||"isBuffer"in e?e:i.from(e);if("string"==typeof e)return i.from(e,t);if(l&&o(e)){if(0===e.byteLength)return i.alloc(0);if(c){var r=i.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}var s=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u=i.from(s);if(u.length===e.byteLength)return u}if(a&&e instanceof Uint8Array)return i.from(e);var h=n(e);if(h)for(var d=0;d<e.length;d+=1){var p=e[d];if("number"!=typeof p||p<0||p>255||~~p!==p)throw RangeError("Array items must be numbers in the range 0-255.")}if(h||i.isBuffer(e)&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e))return i.from(e);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}},199953,(e,t,r)=>{"use strict";var i=e.r(242524).Buffer,n=e.r(801448);function s(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}s.prototype.update=function(e,t){e=n(e,t||"utf8");for(var r=this._block,i=this._blockSize,s=e.length,o=this._len,a=0;a<s;){for(var l=o%i,c=Math.min(s-a,i-l),u=0;u<c;u++)r[l+u]=e[a+u];o+=c,a+=c,o%i==0&&this._update(r)}return this._len+=s,this},s.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=0xffffffff)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=r>>>0;this._block.writeUInt32BE((r-i)/0x100000000,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var n=this._hash();return e?n.toString(e):n},s.prototype._update=function(){throw Error("_update must be implemented by subclass")},t.exports=s},89570,(e,t,r)=>{"use strict";var i=e.r(988935),n=e.r(199953),s=e.r(242524).Buffer,o=[0x5a827999,0x6ed9eba1,-0x70e44324,-0x359d3e2a],a=Array(80);function l(){this.init(),this._w=a,n.call(this,64,56)}i(l,n),l.prototype.init=function(){return this._a=0x67452301,this._b=0xefcdab89,this._c=0x98badcfe,this._d=0x10325476,this._e=0xc3d2e1f0,this},l.prototype._update=function(e){for(var t=this._w,r=0|this._a,i=0|this._b,n=0|this._c,s=0|this._d,a=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var c=0;c<80;++c){var u,h,d,p,f,g=~~(c/20),m=((u=r)<<5|u>>>27)+(h=i,d=n,p=s,0===g?h&d|~h&p:2===g?h&d|h&p|d&p:h^d^p)+a+t[c]+o[g]|0;a=s,s=n,n=(f=i)<<30|f>>>2,i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},l.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=l},198725,(e,t,r)=>{"use strict";var i=e.r(988935),n=e.r(199953),s=e.r(242524).Buffer,o=[0x5a827999,0x6ed9eba1,-0x70e44324,-0x359d3e2a],a=Array(80);function l(){this.init(),this._w=a,n.call(this,64,56)}i(l,n),l.prototype.init=function(){return this._a=0x67452301,this._b=0xefcdab89,this._c=0x98badcfe,this._d=0x10325476,this._e=0xc3d2e1f0,this},l.prototype._update=function(e){for(var t=this._w,r=0|this._a,i=0|this._b,n=0|this._c,s=0|this._d,a=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=(u=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|u>>>31;for(var c=0;c<80;++c){var u,h,d,p,f,g,m=~~(c/20),w=((h=r)<<5|h>>>27)+(d=i,p=n,f=s,0===m?d&p|~d&f:2===m?d&p|d&f|p&f:d^p^f)+a+t[c]+o[m]|0;a=s,s=n,n=(g=i)<<30|g>>>2,i=r,r=w}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},l.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=l},437005,(e,t,r)=>{"use strict";var i=e.r(988935),n=e.r(199953),s=e.r(242524).Buffer,o=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc
176c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2],a=Array(64);function l(){this.init(),this._w=a,n.call(this,64,56)}i(l,n),l.prototype.init=function(){return this._a=0x6a09e667,this._b=0xbb67ae85,this._c=0x3c6ef372,this._d=0xa54ff53a,this._e=0x510e527f,this._f=0x9b05688c,this._g=0x1f83d9ab,this._h=0x5be0cd19,this},l.prototype._update=function(e){for(var t=this._w,r=0|this._a,i=0|this._b,n=0|this._c,s=0|this._d,a=0|this._e,l=0|this._f,c=0|this._g,u=0|this._h,h=0;h<16;++h)t[h]=e.readInt32BE(4*h);for(;h<64;++h)t[h]=(((p=t[h-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10)+t[h-7]+(((f=t[h-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3)+t[h-16]|0;for(var d=0;d<64;++d){var p,f,g,m,w,y,v,b,C,x=u+(((g=a)>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(m=a,w=l,(y=c)^m&(w^y))+o[d]+t[d]|0,_=(((v=r)>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+((b=r)&(C=i)|n&(b|C))|0;u=c,c=l,l=a,a=s+x|0,s=n,n=i,i=r,r=x+_|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=c+this._g|0,this._h=u+this._h|0},l.prototype._hash=function(){var e=s.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=l},999256,(e,t,r)=>{"use strict";var i=e.r(988935),n=e.r(437005),s=e.r(199953),o=e.r(242524).Buffer,a=Array(64);function l(){this.init(),this._w=a,s.call(this,64,56)}i(l,n),l.prototype.init=function(){return this._a=0xc1059ed8,this._b=0x367cd507,this._c=0x3070dd17,this._d=0xf70e5939,this._e=0xffc00b31,this._f=0x68581511,this._g=0x64f98fa7,this._h=0xbefa4fa4,this},l.prototype._hash=function(){var e=o.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=l},951144,(e,t,r)=>{"use strict";var i=e.r(988935),n=e.r(199953),s=e.r(242524).Buffer,o=[0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd,0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc,0x3956c25b,0xf348b538,0x59f111f1,0xb605d019,0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118,0xd807aa98,0xa3030242,0x12835b01,0x45706fbe,0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2,0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1,0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694,0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3,0xfc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65,0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483,0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5,0x983e5152,0xee66dfab,0xa831c66d,0x2db43210,0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4,0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725,0x6ca6351,0xe003826f,0x14292967,0xa0e6e70,0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926,0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df,0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8,0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b,0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001,0xc24b8b70,0xd0f89791,0xc76c51a3,0x654be30,0xd192e819,0xd6ef5218,0xd6990624,0x5565a910,0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8,0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53,0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8,0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb,0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3,0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60,0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec,0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9,0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b,0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207,0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178,0x6f067aa,0x72176fba,0xa637dc5,0xa2c898a6,0x113f9804,0xbef90dae,0x1b710b35,0x131c471b,0x28db77f5,0x23047d84,0x32caab7b,0x40c72493,0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c,0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a,0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817],a=Array(160);function l(){this.init(),this._w=a,n.call(this,128,112)}function c(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function u(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function h(e,t){return+(e>>>0<t>>>0)}
1i(l,n),l.prototype.init=function(){return this._ah=0x6a09e667,this._bh=0xbb67ae85,this._ch=0x3c6ef372,this._dh=0xa54ff53a,this._eh=0x510e527f,this._fh=0x9b05688c,this._gh=0x1f83d9ab,this._hh=0x5be0cd19,this._al=0xf3bcc908,this._bl=0x84caa73b,this._cl=0xfe94f82b,this._dl=0x5f1d36f1,this._el=0xade682d1,this._fl=0x2b3e6c1f,this._gl=0xfb41bd6b,this._hl=0x137e2179,this},l.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,s=0|this._dh,a=0|this._eh,l=0|this._fh,d=0|this._gh,p=0|this._hh,f=0|this._al,g=0|this._bl,m=0|this._cl,w=0|this._dl,y=0|this._el,v=0|this._fl,b=0|this._gl,C=0|this._hl,x=0;x<32;x+=2)t[x]=e.readInt32BE(4*x),t[x+1]=e.readInt32BE(4*x+4);for(;x<160;x+=2){var _,E,k,S,I,A,T,P,R=t[x-30],O=t[x-30+1],N=((_=R)>>>1|(E=O)<<31)^(_>>>8|E<<24)^_>>>7,$=((k=O)>>>1|(S=R)<<31)^(k>>>8|S<<24)^(k>>>7|S<<25);R=t[x-4],O=t[x-4+1];var D=((I=R)>>>19|(A=O)<<13)^(A>>>29|I<<3)^I>>>6,L=((T=O)>>>19|(P=R)<<13)^(P>>>29|T<<3)^(T>>>6|P<<26),j=t[x-14],U=t[x-14+1],M=t[x-32],q=t[x-32+1],W=$+U|0,B=N+j+h(W,$)|0;B=(B=B+D+h(W=W+L|0,L)|0)+M+h(W=W+q|0,q)|0,t[x]=B,t[x+1]=W}for(var z=0;z<160;z+=2){B=t[z],W=t[z+1];var H,K,V,F,G,Y,J,Z,Q,X,ee=(H=r)&(K=i)|n&(H|K),et=(V=f)&(F=g)|m&(V|F),er=c(r,f),ei=c(f,r),en=u(a,y),es=u(y,a),eo=o[z],ea=o[z+1],el=(G=a,Y=l,(J=d)^G&(Y^J)),ec=(Z=y,Q=v,(X=b)^Z&(Q^X)),eu=C+es|0,eh=p+en+h(eu,C)|0;eh=(eh=(eh=eh+el+h(eu=eu+ec|0,ec)|0)+eo+h(eu=eu+ea|0,ea)|0)+B+h(eu=eu+W|0,W)|0;var ed=ei+et|0,ep=er+ee+h(ed,ei)|0;p=d,C=b,d=l,b=v,l=a,v=y,a=s+eh+h(y=w+eu|0,w)|0,s=n,w=m,n=i,m=g,i=r,g=f,r=eh+ep+h(f=eu+ed|0,eu)|0}this._al=this._al+f|0,this._bl=this._bl+g|0,this._cl=this._cl+m|0,this._dl=this._dl+w|0,this._el=this._el+y|0,this._fl=this._fl+v|0,this._gl=this._gl+b|0,this._hl=this._hl+C|0,this._ah=this._ah+r+h(this._al,f)|0,this._bh=this._bh+i+h(this._bl,g)|0,this._ch=this._ch+n+h(this._cl,m)|0,this._dh=this._dh+s+h(this._dl,w)|0,this._eh=this._eh+a+h(this._el,y)|0,this._fh=this._fh+l+h(this._fl,v)|0,this._gh=this._gh+d+h(this._gl,b)|0,this._hh=this._hh+p+h(this._hl,C)|0},l.prototype._hash=function(){var e=s.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},t.exports=l},713935,(e,t,r)=>{"use strict";var i=e.r(988935),n=e.r(951144),s=e.r(199953),o=e.r(242524).Buffer,a=Array(160);function l(){this.init(),this._w=a,s.call(this,128,112)}i(l,n),l.prototype.init=function(){return this._ah=0xcbbb9d5d,this._bh=0x629a292a,this._ch=0x9159015a,this._dh=0x152fecd8,this._eh=0x67332667,this._fh=0x8eb44a87,this._gh=0xdb0c2e0d,this._hh=0x47b5481d,this._al=0xc1059ed8,this._bl=0x367cd507,this._cl=0x3070dd17,this._dl=0xf70e5939,this._el=0xffc00b31,this._fl=0x68581511,this._gl=0x64f98fa7,this._hl=0xbefa4fa4,this},l.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},t.exports=l},109744,(e,t,r)=>{"use strict";t.exports=function(e){var r=e.toLowerCase(),i=t.exports[r];if(!i)throw Error(r+" is not supported (we accept pull requests)");return new i},t.exports.sha=e.r(89570),t.exports.sha1=e.r(198725),t.exports.sha224=e.r(999256),t.exports.sha256=e.r(437005),t.exports.sha384=e.r(713935),t.exports.sha512=e.r(951144)},46695,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkSession=void 0;let i=e.r(109744),n=e.r(243403),s="session:id",o="session:secret",a="session:linked";class l{constructor(e,t,r,s){this._storage=e,this._id=t||(0,n.randomBytesHex)(16),this._secret=r||(0,n.randomBytesHex)(32),this._key=new i.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){let t=e.getItem(s),r=e.getItem(a),i=e.getItem(o);return t&&i?new l(e,t,i,"1"===r):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(s,this._id),this._storage.setItem(o,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(a,this._linked?"1":"0")}}r.WalletLinkSession=l},824294,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.isDarkMode=r.isMobileWeb=r.getLocation=r.createQrUrl=void 0,r.createQrUrl=function(e,t,r,i,n,s){let o=new URLSearchParams({[i?"parent-id":"id"]:e,secret:t,server:r,v:n,chainId:s.toString()}).toString();return`${r}/#/link?${o}`},r.getLocation=function(){try{if(function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top)return window.top.location;return window.location}catch(e){return window.location}},r.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null==(e=null==window?void 0:window.navigator)?void 0:e.userAgent)},r.isDarkMode=function(){var e,t;return null!=(t=null==(e=null==window?void 0:window.matchMedia)?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&t}},204678,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}'},547904,(e,t,r)=>{"use strict";
1var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.injectCssReset=void 0;let n=i(e.r(204678));r.injectCssReset=function(){let e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(n.default)),document.documentElement.appendChild(e)}},158577,e=>{"use strict";function t(){for(var e,t,r=0,i="";r<arguments.length;)(e=arguments[r++])&&(t=function e(t){var r,i,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t))for(r=0;r<t.length;r++)t[r]&&(i=e(t[r]))&&(n&&(n+=" "),n+=i);else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}(e))&&(i&&(i+=" "),i+=t);return i}e.s(["clsx",0,t,"default",0,t])},928020,e=>{"use strict";var t,r,i,n,s,o,a,l,c,u,h,d,p,f,g,m={},w=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function b(e,t){for(var r in t)e[r]=t[r];return e}function C(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,r,i){var n,s,o,a={};for(o in r)"key"==o?n=r[o]:"ref"==o?s=r[o]:a[o]=r[o];if(arguments.length>2&&(a.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===a[o]&&(a[o]=e.defaultProps[o]);return _(e,a,n,s,null)}function _(e,t,n,s,o){var a={type:e,props:t,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++i:o,__i:-1,__u:0};return null==o&&null!=r.vnode&&r.vnode(a),a}function E(e){return e.children}function k(e,t){this.props=e,this.context=t}function S(e,t){if(null==t)return e.__?S(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?S(e):null}function I(e){(!e.__d&&(e.__d=!0)&&n.push(e)&&!A.__r++||s!=r.debounceRendering)&&((s=r.debounceRendering)||o)(A)}function A(){try{for(var e,t=1;n.length;)n.length>t&&n.sort(a),e=n.shift(),t=n.length,function(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,n=[],s=[],o=b({},t);o.__v=t.__v+1,r.vnode&&r.vnode(o),N(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,n,null==i?S(t):i,!!(32&t.__u),s),o.__v=t.__v,o.__.__k[o.__i]=o,D(n,o,s),t.__e=t.__=null,o.__e!=i&&function e(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),e(t)}(o)}}(e)}finally{n.length=A.__r=0}}function T(e,t,i,n,s,o,a,l,c,u,h){var d,p,f,g,y,b,x,k=n&&n.__k||w,I=t.length;for(c=function(e,t,i,n,s){var o,a,l,c,u,h=i.length,d=h,p=0;for(e.__k=Array(s),o=0;o<s;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[o]=_(null,a,null,null,null):v(a)?a=e.__k[o]=_(E,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?a=e.__k[o]=_(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,l=null,-1!=(u=a.__i=function(e,t,r,i){var n,s,o,a=e.key,l=e.type,c=t[r],u=null!=c&&0==(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return r;if(i>+!!u){for(n=r-1,s=r+1;n>=0||s<t.length;)if(null!=(c=t[o=n>=0?n--:s++])&&0==(2&c.__u)&&a==c.key&&l==c.type)return o}return -1}(a,i,c,d))&&(d--,(l=i[u])&&(l.__u|=2)),null==l||null==l.__v?(-1==u&&(s>h?p--:s<h&&p++),"function"!=typeof a.type&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<h;o++)null!=(l=i[o])&&0==(2&l.__u)&&(l.__e==n&&(n=S(l)),function e(t,i,n){var s,o;if(r.unmount&&r.unmount(t),(s=t.ref)&&(s.current&&s.current!=t.__e||L(s,null,i)),null!=(s=t.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){r.__e(e,i)}s.base=s.__P=null}if(s=t.__k)for(o=0;o<s.length;o++)s[o]&&e(s[o],i,n||"function"!=typeof t.type);n||C(t.__e),t.__c=t.__=t.__e=void 0}(l,l));return n}(i,t,k,c,I),d=0;d<I;d++)null!=(f=i.__k[d])&&(p=-1!=f.__i&&k[f.__i]||m,f.__i=d,b=N(e,f,p,s,o,a,l,c,u,h),g=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&L(p.ref,null,f),h.push(f.ref,f.__c||g,f)),null==y&&null!=g&&(y=g),(x=!!(4&f.__u))||p.__k===f.__k?(c=function e(t,r,i,n){var s,o;if("function"==typeof t.type){for(s=t.__k,o=0;s&&o<s.length;o++)s[o]&&(s[o].__=t,r=e(s[o],r,i,n));return r}t.__e!=r&&(n&&(r&&t.type&&!r.parentNode&&(r=S(t)),i.insertBefore(t.__e,r||null)),r=t.__e);do r=r&&r.nextSibling;while(null!=r&&8==r.nodeType)return r}(f,c,e,x),x&&p.__e&&(p.__e=null)):"function"==typeof f.type&&void 0!==b?c=b:g&&(c=g.nextSibling),f.__u&=-7);return i.__e=y,c}function P(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||y.test(t)?r:r+"px"}function R(e,t,r,i,n){var s,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||P(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||P(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(h,"$1")),t=(o=t.toLowerCase())in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?i?r[u]=i[u]:(r[u]=d,e.addEventListener(t,s?f:p,s)):e.removeEventListener(t,s?f:p,s);else{if("http://www.w3.org/2000/svg"==n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function O(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[c])t[c]=d++;else if(t[c]<i[u])return;
vendor: 5,352 bytes, line 1
1return i(r.event?r.event(t):t)}}}function N(e,i,n,s,o,a,l,c,u,h){var d,p,f,g,y,x,_,I,A,P,O,N,D,L,U,M=i.type;if(void 0!==i.constructor)return null;128&n.__u&&(u=!!(32&n.__u),a=[c=i.__e=n.__e]),(d=r.__b)&&d(i);e:if("function"==typeof M)try{if(I=i.props,A=M.prototype&&M.prototype.render,P=(d=M.contextType)&&s[d.__c],O=d?P?P.props.value:d.__:s,n.__c?_=(p=i.__c=n.__c).__=p.__E:(A?i.__c=p=new M(I,O):(i.__c=p=new k(I,O),p.constructor=M,p.render=j),P&&P.sub(p),p.state||(p.state={}),p.__n=s,f=p.__d=!0,p.__h=[],p._sb=[]),A&&null==p.__s&&(p.__s=p.state),A&&null!=M.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=b({},p.__s)),b(p.__s,M.getDerivedStateFromProps(I,p.__s))),g=p.props,y=p.state,p.__v=i,f)A&&null==M.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),A&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(A&&null==M.getDerivedStateFromProps&&I!==g&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(I,O),i.__v==n.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(I,p.__s,O)){i.__v!=n.__v&&(p.props=I,p.state=p.__s,p.__d=!1),i.__e=n.__e,i.__k=n.__k,i.__k.some(function(e){e&&(e.__=i)}),w.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&l.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(I,p.__s,O),A&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(g,y,x)})}if(p.context=O,p.props=I,p.__P=e,p.__e=!1,N=r.__r,D=0,A)p.state=p.__s,p.__d=!1,N&&N(i),d=p.render(p.props,p.state,p.context),w.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,N&&N(i),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++D<25)p.state=p.__s,null!=p.getChildContext&&(s=b(b({},s),p.getChildContext())),A&&!f&&null!=p.getSnapshotBeforeUpdate&&(x=p.getSnapshotBeforeUpdate(g,y)),L=null!=d&&d.type===E&&null==d.key?function e(t){return"object"!=typeof t||null==t||t.__b>0?t:v(t)?t.map(e):void 0!==t.constructor?null:b({},t)}(d.props.children):d,c=T(e,v(L)?L:[L],i,n,s,o,a,l,c,u,h),p.base=i.__e,i.__u&=-161,p.__h.length&&l.push(p),_&&(p.__E=p.__=null)}catch(e){if(i.__v=null,u||null!=a)if(e.then){for(i.__u|=u?160:128;c&&8==c.nodeType&&c.nextSibling;)c=c.nextSibling;a[a.indexOf(c)]=null,i.__e=c}else{for(U=a.length;U--;)C(a[U]);$(i)}else i.__e=n.__e,i.__k=n.__k,e.then||$(i);r.__e(e,i,n)}else null==a&&i.__v==n.__v?(i.__k=n.__k,i.__e=n.__e):c=i.__e=function(e,i,n,s,o,a,l,c,u){var h,d,p,f,g,w,y,b=n.props||m,x=i.props,_=i.type;if("svg"==_?o="http://www.w3.org/2000/svg":"math"==_?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=a){for(h=0;h<a.length;h++)if((g=a[h])&&"setAttribute"in g==!!_&&(_?g.localName==_:3==g.nodeType)){e=g,a[h]=null;break}}if(null==e){if(null==_)return document.createTextNode(x);e=document.createElementNS(o,_,x.is&&x),c&&(r.__m&&r.__m(i,a),c=!1),a=null}if(null==_)b===x||c&&e.data==x||(e.data=x);else{if(a="textarea"==_&&null!=x.defaultValue?null:a&&t.call(e.childNodes),!c&&null!=a)for(b={},h=0;h<e.attributes.length;h++)b[(g=e.attributes[h]).name]=g.value;for(h in b)g=b[h],"dangerouslySetInnerHTML"==h?p=g:"children"==h||h in x||"value"==h&&"defaultValue"in x||"checked"==h&&"defaultChecked"in x||R(e,h,null,g,o);for(h in x)g=x[h],"children"==h?f=g:"dangerouslySetInnerHTML"==h?d=g:"value"==h?w=g:"checked"==h?y=g:c&&"function"!=typeof g||b[h]===g||R(e,h,g,b[h],o);if(d)c||p&&(d.__html==p.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),i.__k=[];else if(p&&(e.innerHTML=""),T("template"==i.type?e.content:e,v(f)?f:[f],i,n,s,"foreignObject"==_?"http://www.w3.org/1999/xhtml":o,a,l,a?a[0]:n.__k&&S(n,0),c,u),null!=a)for(h=a.length;h--;)C(a[h]);c&&"textarea"!=_||(h="value","progress"==_&&null==w?e.removeAttribute("value"):null==w||w===e[h]&&("progress"!=_||w)&&("option"!=_||w==b[h])||R(e,h,w,b[h],o),h="checked",null!=y&&y!=e[h]&&R(e,h,y,b[h],o))}return e}(n.__e,i,n,s,o,a,l,u,h);return(d=r.diffed)&&d(i),128&i.__u?void 0:c}function $(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some($))}function D(e,t,i){for(var n=0;n<i.length;n++)L(i[n],i[++n],i[++n]);r.__c&&r.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){r.__e(e,t.__v)}})}function L(e,t,i){try{if("function"==typeof e){var n="function"==typeof e.__u;n&&e.__u(),n&&null==t||(e.__u=e(t))}else e.current=t}catch(e){r.__e(e,i)}}function j(e,t,r){return this.constructor(e,r)}function U(e,i,n){var s,o,a,l;i==document&&(i=document.documentElement),r.__&&r.__(e,i),o=(s="function"==typeof n)?null:n&&n.__k||i.__k,a=[],l=[],N(i,e=(!s&&n||i).__k=x(E,null,[e]),o||m,m,i.namespaceURI,!s&&n?[n]:o?null:i.firstChild?t.call(i.childNodes):null,a,!s&&n?n:o?o.__e:i.firstChild,s,l),D(a,e,l)}t=w.slice,r={__e:function(e,t,r,i){for(var n,s,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&null!=s.getDerivedStateFromError&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,i||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},i=0,k.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=b({},this.state),"function"==typeof e&&(e=e(b({},r),this.props)),e&&b(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),I(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),I(this))},k.prototype.render=E,n=[],o="function"==typeof Promise?Promise.prototype.then.bind(Prom
1ise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},A.__r=0,c="__d"+(l=Math.random().toString(8)),u="__a"+l,h=/(PointerCapture)$|Capture$/i,d=0,p=O(!1),f=O(!0),g=0,e.s(["Component",0,k,"Fragment",0,E,"cloneElement",0,function(e,r,i){var n,s,o,a,l=b({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),r)"key"==o?n=r[o]:"ref"==o?s=r[o]:l[o]=void 0===r[o]&&null!=a?a[o]:r[o];return arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):i),_(e.type,l,n||e.key,s||e.ref,null)},"createContext",0,function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach(function(e){e.__e=!0,I(e)})},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+g++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t},"createElement",0,x,"createRef",0,function(){return{current:null}},"h",0,x,"hydrate",0,function e(t,r){U(t,r,e)},"isValidElement",0,function(e){return null!=e&&void 0===e.constructor},"options",0,r,"render",0,U,"toChildArray",0,function e(t,r){return r=r||[],null==t||"boolean"==typeof t||(v(t)?t.some(function(t){e(t,r)}):r.push(t)),r}])},698920,e=>{"use strict";var t,r,i,n,s=e.i(928020),o=0,a=[],l=s.options,c=l.__b,u=l.__r,h=l.diffed,d=l.__c,p=l.unmount,f=l.__;function g(e,t){l.__h&&l.__h(r,e,o||t),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function m(e){return o=1,w(k,e)}function w(e,i,n){var s=g(t++,2);if(s.t=e,!s.__c&&(s.__=[n?n(i):k(void 0,i),function(e){var t=s.__N?s.__N[0]:s.__[0],r=s.t(t,e);t!==r&&(s.__N=[r,s.__[1]],s.__c.setState({}))}],s.__c=r,!r.__f)){var o=function(e,t,r){if(!s.__c.__H)return!0;var i=s.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,r);var n=s.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(n=!0)}}),a&&a.call(this,e,t,r)||n};r.__f=!0;var a=r.shouldComponentUpdate,l=r.componentWillUpdate;r.componentWillUpdate=function(e,t,r){if(this.__e){var i=a;a=void 0,o(e,t,r),a=i}l&&l.call(this,e,t,r)},r.shouldComponentUpdate=o}return s.__N||s.__}function y(e,i){var n=g(t++,4);!l.__s&&E(n.__H,i)&&(n.__=e,n.u=i,r.__h.push(n))}function v(e,r){var i=g(t++,7);return E(i.__H,r)&&(i.__=e(),i.__H=r,i.__h=e),i.__}function b(){for(var e;e=a.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(x),t.__h.some(_),t.__h=[]}catch(r){t.__h=[],l.__e(r,e.__v)}}}l.__b=function(e){r=null,c&&c(e)},l.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),f&&f(e,t)},l.__r=function(e){u&&u(e),t=0;var n=(r=e.__c).__H;n&&(i===r?(n.__h=[],r.__h=[],n.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(n.__h.some(x),n.__h.some(_),n.__h=[],t=0)),i=r},l.diffed=function(e){h&&h(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==a.push(t)&&n===l.requestAnimationFrame||((n=l.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(i),C&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);C&&(t=requestAnimationFrame(r))})(b)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),i=r=null},l.__c=function(e,t){t.some(function(e){try{e.__h.some(x),e.__h=e.__h.filter(function(e){return!e.__||_(e)}
1)}catch(r){t.some(function(e){e.__h&&(e.__h=[])}),t=[],l.__e(r,e.__v)}}),d&&d(e,t)},l.unmount=function(e){p&&p(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(e){try{x(e)}catch(e){t=e}}),r.__H=void 0,t&&l.__e(t,r.__v))};var C="function"==typeof requestAnimationFrame;function x(e){var t=r,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),r=t}function _(e){var t=r;e.__c=e.__(),r=t}function E(e,t){return!e||e.length!==t.length||t.some(function(t,r){return t!==e[r]})}function k(e,t){return"function"==typeof t?t(e):t}e.s(["useCallback",0,function(e,t){return o=8,v(function(){return e},t)},"useContext",0,function(e){var i=r.context[e.__c],n=g(t++,9);return n.c=e,i?(null==n.__&&(n.__=!0,i.sub(r)),i.props.value):e.__},"useDebugValue",0,function(e,t){l.useDebugValue&&l.useDebugValue(t?t(e):e)},"useEffect",0,function(e,i){var n=g(t++,3);!l.__s&&E(n.__H,i)&&(n.__=e,n.u=i,r.__H.__h.push(n))},"useErrorBoundary",0,function(e){var i=g(t++,10),n=m();return i.__=e,r.componentDidCatch||(r.componentDidCatch=function(e,t){i.__&&i.__(e,t),n[1](e)}),[n[0],function(){n[1](void 0)}]},"useId",0,function(){var e=g(t++,11);if(!e.__){for(var i=r.__v;null!==i&&!i.__m&&null!==i.__;)i=i.__;var n=i.__m||(i.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__},"useImperativeHandle",0,function(e,t,r){o=6,y(function(){if("function"==typeof e){var r=e(t());return function(){e(null),r&&"function"==typeof r&&r()}}if(e)return e.current=t(),function(){return e.current=null}},null==r?r:r.concat(e))},"useLayoutEffect",0,y,"useMemo",0,v,"useReducer",0,w,"useRef",0,function(e){return o=5,v(function(){return{current:e}},[])},"useState",0,m])},755500,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}
1.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}"},811571,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.SnackbarInstance=r.SnackbarContainer=r.Snackbar=void 0;let n=i(e.r(158577)),s=e.r(928020),o=e.r(698920),a=e.r(824294),l=i(e.r(755500));r.Snackbar=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,a.isDarkMode)()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){let t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,s.render)((0,s.h)("div",null,(0,s.h)(r.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,t])=>(0,s.h)(r.SnackbarInstance,Object.assign({},t,{key:e}))))),this.root)}},r.SnackbarContainer=e=>(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-container")},(0,s.h)("style",null,l.default),(0,s.h)("div",{class:"-cbwsdk-snackbar"},e.children)),r.SnackbarInstance=({autoExpand:e,message:t,menuItems:r})=>{let[i,a]=(0,o.useState)(!0),[l,c]=(0,o.useState)(null!=e&&e);return(0,o.useEffect)(()=>{let e=[window.setTimeout(()=>{a(!1)},1),window.setTimeout(()=>{c(!0)},1e4)];return()=>{e.forEach(window.clearTimeout)}}),(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance",i&&"-cbwsdk-snackbar-instance-hidden",l&&"-cbwsdk-snackbar-instance-expanded")},(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{c(!l)}},(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,s.h)("div",{class:"-gear-container"},!l&&(0,s.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwu
1NTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((e,t)=>(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,s.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,s.h)("span",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info)))))}},576514,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkRelayUI=void 0;let i=e.r(547904),n=e.r(811571);r.WalletLinkRelayUI=class{constructor(){this.attached=!1,this.snackbar=new n.Snackbar}attach(){if(this.attached)throw Error("Coinbase Wallet SDK UI is already attached");let e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,i.injectCssReset)()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}}},478069,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}
1.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"},106872,(e,t,r)=>{"use strict";var i=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.RedirectDialog=void 0;let n=i(e.r(158577)),s=e.r(928020),o=e.r(547904),a=e.r(811571),l=e.r(824294),c=i(e.r(478069));r.RedirectDialog=class{constructor(){this.root=null,this.darkMode=(0,l.isDarkMode)()}attach(){let e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,o.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){!this.root||((0,s.render)(null,this.root),e&&(0,s.render)((0,s.h)(u,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};let u=({title:e,buttonText:t,darkMode:r,onButtonClick:i,onDismiss:o})=>(0,s.h)(a.SnackbarContainer,{darkMode:r},(0,s.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,s.h)("style",null,c.default),(0,s.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:o}),(0,s.h)("div",{class:(0,n.default)("-cbwsdk-redirect-dialog-box",r?"dark":"light")},(0,s.h)("p",null,e),(0,s.h)("button",{onClick:i},t))))},127816,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CBW_MOBILE_DEEPLINK_URL=r.WALLETLINK_URL=r.CB_KEYS_URL=void 0,r.CB_KEYS_URL="https://keys.coinbase.com/connect",r.WALLETLINK_URL="https://www.walletlink.org",r.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink"},164136,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WLMobileRelayUI=void 0;let i=e.r(106872),n=e.r(824294),s=e.r(127816);r.WLMobileRelayUI=class{constructor(){this.attached=!1,this.redirectDialog=new i.RedirectDialog}attach(){if(this.attached)throw Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){let t=new URL(s.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,n.getLocation)().href),e&&t.searchParams.append("wl_url",e);let r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}},52666,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkRelay=void 0;let i=e.r(673822),n=e.r(627845),s=e.r(895678),o=e.r(46695),a=e.r(963612),l=e.r(824294),c=e.r(576514),u=e.r(164136),h=e.r(464357),d=e.r(243403),p=e.r(123614);class f{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,l.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{this.isLinked=e;let t=this.storage.getItem(n.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,t){let r=t.split(" "),i="true"===this.storage.getItem("IsStandaloneSigning");""===r[0]||e||!this._session.linked||i||(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{(this.chainCallbackParams.chainId!==e||this.chainCallbackParams.jsonRpcUrl!==t)&&(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),f.accountRequestCallbackIds.size>
10&&(Array.from(f.accountRequestCallbackIds.values()).forEach(t=>{this.invokeCallback(Object.assign(Object.assign({},{type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}}),{id:t}))}),f.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:r,connection:i}=this.subscribe();this._session=t,this.connection=i,this.relayEventManager=new s.RelayEventManager,this.ui=r}subscribe(){let e=o.WalletLinkSession.load(this.storage)||new o.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,r=new i.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),n=this.isMobileWeb?new u.WLMobileRelayUI:new c.WalletLinkRelayUI;return r.connect(),{session:e,ui:n,connection:r}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{this.connection.destroy();let e=o.WalletLinkSession.load(this.storage);(null==e?void 0:e.id)===this._session.id&&p.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(e=>{})}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,d.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,d.hexStringFromBuffer)(e,!0),signature:(0,d.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,d.bigIntStringFromBigInt)(e.weiValue),data:(0,d.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,d.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,d.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,d.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,d.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,d.bigIntStringFromBigInt)(e.weiValue),data:(0,d.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,d.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,d.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,d.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,d.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,d.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null,r=(0,d.randomBytesHex)(8),i=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i),null==t||t()};return new Promise((n,s)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,e=>{if(null==t||t(),(0,a.isErrorResponse)(e))return s(Error(e.errorMessage));n(e)}),this.publishWeb3RequestEvent(r,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){let r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(e=>{}).catch(e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r.id,response:{method:t.method,errorMessage:e.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof u.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink()}}publishWeb3RequestCanceledEvent(e){this.publishEvent("Web3RequestCanceled",{type:"WEB3_REQUEST_CANCELED",id:e},!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){let{response:t}=e;if("requestEthereumAccounts"===t.method){f.accountRequestCallbackIds.forEach(t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t}))),f.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,r){var i;let n=null!=(i=null==r?void 0:r.message)?i:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:n}})}invokeCallback(e){let t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){let e={method:"requestEthereumAccounts",params:{appName:this.appName,a
1ppLogoUrl:this.appLogoUrl||null}},t=(0,d.randomBytesHex)(8);return new Promise((r,i)=>{this.relayEventManager.callbacks.set(t,e=>{if((0,a.isErrorResponse)(e))return i(Error(e.errorMessage));r(e)}),f.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,r,i,n,s){let o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:i,image:n},chainId:s}},l=null,c=(0,d.randomBytesHex)(8),u=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==l||l()};return l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}),new Promise((e,t)=>{this.relayEventManager.callbacks.set(c,r=>{if(null==l||l(),(0,a.isErrorResponse)(r))return t(Error(r.errorMessage));e(r)}),this.publishWeb3RequestEvent(c,o)})}addEthereumChain(e,t,r,i,n,s){let o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:i,chainName:n,iconUrls:r,nativeCurrency:s}},l=null,c=(0,d.randomBytesHex)(8),u=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==l||l()};return l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}),new Promise((e,t)=>{this.relayEventManager.callbacks.set(c,r=>{if(null==l||l(),(0,a.isErrorResponse)(r))return t(Error(r.errorMessage));e(r)}),this.publishWeb3RequestEvent(c,o)})}switchEthereumChain(e,t){let r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},i=(0,d.randomBytesHex)(8);return new Promise((e,t)=>{this.relayEventManager.callbacks.set(i,r=>(0,a.isErrorResponse)(r)&&r.errorCode?t(h.standardErrors.provider.custom({code:r.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,a.isErrorResponse)(r)?t(Error(r.errorMessage)):void e(r)),this.publishWeb3RequestEvent(i,r)})}}r.WalletLinkRelay=f,f.accountRequestCallbackIds=new Set},726700,(e,t,r)=>{"use strict";var i=e.i(467034),n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.WalletLinkSigner=void 0;let s=n(e.r(541809)),o=e.r(627845),a=e.r(895678),l=e.r(963612),c=e.r(52666),u=e.r(127816),h=e.r(464357),d=e.r(243403),p=e.r(123614),f="DefaultChainId",g="DefaultJsonRpcUrl";r.WalletLinkSigner=class{constructor(e){var t,r;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:i,appLogoUrl:n}=e.metadata;this._appName=i,this._appLogoUrl=n,this._storage=new p.ScopedLocalStorage("walletlink",u.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new a.RelayEventManager,this._jsonRpcUrlFromOpts="";const s=this._storage.getItem(o.LOCAL_STORAGE_ADDRESSES_KEY);if(s){const e=s.split(" ");""!==e[0]&&(this._addresses=e.map(e=>(0,d.ensureAddressString)(e)),null==(t=this.updateListener)||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(f)&&(null==(r=this.updateListener)||r.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){let{id:e,secret:t}=this.initializeRelay().getWalletLinkSession();return{id:e,secret:t}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!=(e=this._storage.getItem(g))?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(g,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;let i=this.getChainId();this._storage.setItem(f,t.toString(10)),(0,d.ensureIntNumber)(t)===i&&this.hasMadeFirstChainChangedEmission||(null==(r=this.updateListener)||r.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,i,n,s){let o=this.initializeRelay(),a=await o.watchAsset(e,t,r,i,n,null==s?void 0:s.toString());return!(0,l.isErrorResponse)(a)&&!!a.result}async addEthereumChain(e,t,r,i,n,s){var o,a;if((0,d.ensureIntNumber)(e)===this.getChainId())return!1;let c=this.initializeRelay();this._isAuthorized()||await c.requestEthereumAccounts();let u=await c.addEthereumChain(e.toString(),t,n,r,i,s);return!(0,l.isErrorResponse)(u)&&((null==(o=u.result)?void 0:o.isApproved)===!0&&this.updateProviderInfo(t[0],e),(null==(a=u.result)?void 0:a.isApproved)===!0)}async switchEthereumChain(e){let t=this.initializeRelay(),r=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,l.isErrorResponse)(r)){if(!r.errorCode)return;if(r.errorCode===h.standardErrorCodes.provider.unsupportedChain)throw h.standardErrors.provider.unsupportedChain();throw h.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}let i=r.result;i.isApproved&&i.rpcUrl.length>0&&this.updateProviderInfo(i.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch(e=>{throw e})}catch(e){return Promise.reject(e)}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw h.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});let{method:t,params:r}=e;if("string"!=typeof t||0===t.length)throw h.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==r&&!Array.isArray(r)&&("object"!=typeof r||null===r))throw h.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});let i=void 0===r?[]:r,n=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:i,jsonrpc:"2.0",id:n})).result}_setAddresses(e,t){var r;if(!Array.isArray(e))throw Error("addresses is not an array");let i=e.map(e=>(0,d.ensureAddressString)(e));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,null==(r=this.updateListener)||r.onAccountsUpdate({accounts:i,source:"wallet"}),this._storage.setItem(o.LOCAL_STORAGE_ADDRESSES_KEY,i.join(" ")))}_sendRequestAsync(e){return new Promise((t,r)=>{try{let r=this._handleSynchronousMethods(e);if(void 0!==r)return t({jsonrpc:"2.0",id:e.id,result:r})}catch(e){return r(e)}this._handleAsynchronousMethods(e).then(r=>r&&t(Object.assign(Object.assign({},r),{id:e.id}))).catch(e=>r(e))})}_handleSynchronousMethods(e){let{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){let{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":default:return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r)}}_isKnownAddress(e){try{let t=(0,d.ensureAddressString)(e);return this._addresses.map(e=>(0,d.ensureAddressString)(e)).includes(t)}catch(e){}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw Error("Unknown Ethereum address")}_prepareTransactionParams(e){let t=e.from?(0,d.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw Error("Ethereum address is unavailable");this._ensureKnownAddress(t);let r=e.to?(0,d.ensureAddressString)(e.to):null,n=null!=e.value?(0,d.ensureBigInt)(e.value):BigInt(0),s=e.data?(0,d.ensureBuffer)(e.data):i.Buffer.alloc(0),o=null!=e.nonce?(0,d.ensureIntNumber)(e.nonce):null,a=null!=e.gasPrice?(0,d.ensureBigInt)(e.gasPrice):null,l=null!=e.maxFeePerGas?(0,d.ensureBigInt)(e.maxFeePerGas):null,c=null!=e.maxPriorityFeePerGas?(0,d.ensureBigInt)(e.maxPriorityFeePerGas):null;return{fromAddress:t,toAddress:r,weiValue:n,data:s,nonce:o,gasPriceInWei:a,maxFeePerGas:l,maxPriorityFeePerGas:c,gasLimit:null!=e.gas?(0,d.ensureBigInt)(e.gas):null,chainId:e.chainId?(0,d.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw h.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw h.standardErrors.provider.unsupportedMethod({})}
1async _signEthereumMessage(e,t,r,i){this._ensureKnownAddress(t);try{let n=this.initializeRelay(),s=await n.signEthereumMessage(e,t,r,i);if((0,l.isErrorResponse)(s))throw Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw h.standardErrors.provider.userRejectedRequest("User denied message signature");throw e}}async _ethereumAddressFromSignedMessage(e,t,r){let i=this.initializeRelay(),n=await i.ethereumAddressFromSignedMessage(e,t,r);if((0,l.isErrorResponse)(n))throw Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,d.hexStringFromIntNumber)(this.getChainId())}getChainId(){let e=this._storage.getItem(f);if(!e)return(0,d.ensureIntNumber)(1);let t=parseInt(e,10);return(0,d.ensureIntNumber)(t)}async _eth_requestAccounts(){let e;if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});try{let t=this.initializeRelay();if(e=await t.requestEthereumAccounts(),(0,l.isErrorResponse)(e))throw Error(e.errorMessage)}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw h.standardErrors.provider.userRejectedRequest("User denied account authorization");throw e}if(!e.result)throw Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();let t=(0,d.ensureAddressString)(e[0]),r=(0,d.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){let t=(0,d.ensureBuffer)(e[0]),r=(0,d.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();let t=(0,d.ensureBuffer)(e[0]),r=(0,d.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){let t=(0,d.ensureBuffer)(e[0]),r=(0,d.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();let t=this._prepareTransactionParams(e[0]||{});try{let e=this.initializeRelay(),r=await e.signEthereumTransaction(t);if((0,l.isErrorResponse)(r))throw Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw h.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_sendRawTransaction(e){let t=(0,d.ensureBuffer)(e[0]),r=this.initializeRelay(),i=await r.submitEthereumTransaction(t,this.getChainId());if((0,l.isErrorResponse)(i))throw Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}async _eth_sendTransaction(e){this._requireAuthorization();let t=this._prepareTransactionParams(e[0]||{});try{let e=this.initializeRelay(),r=await e.signAndSubmitEthereumTransaction(t);if((0,l.isErrorResponse)(r))throw Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(e){if("string"==typeof e.message&&e.message.match(/(denied|rejected)/i))throw h.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw e}}async _eth_signTypedData_v1(e){this._requireAuthorization();let t=(0,d.ensureParsedJSONObject)(e[0]),r=(0,d.ensureAddressString)(e[1]);this._ensureKnownAddress(r);let i=s.default.hashForSignTypedDataLegacy({data:t}),n=JSON.stringify(t,null,2);return this._signEthereumMessage(i,r,!1,n)}async _eth_signTypedData_v3(e){this._requireAuthorization();let t=(0,d.ensureAddressString)(e[0]),r=(0,d.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);let i=s.default.hashForSignTypedData_v3({data:r}),n=JSON.stringify(r,null,2);return this._signEthereumMessage(i,t,!1,n)}async _eth_signTypedData_v4(e){this._requireAuthorization();let t=(0,d.ensureAddressString)(e[0]),r=(0,d.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);let i=s.default.hashForSignTypedData_v4({data:r}),n=JSON.stringify(r,null,2);return this._signEthereumMessage(i,t,!1,n)}async _wallet_addEthereumChain(e){var t,r,i,n;let s=e[0];if((null==(t=s.rpcUrls)?void 0:t.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!s.chainName||""===s.chainName.trim())throw h.standardErrors.rpc.invalidParams("chainName is a required field");if(!s.nativeCurrency)throw h.standardErrors.rpc.invalidParams("nativeCurrency is a required field");let o=parseInt(s.chainId,16);return await this.addEthereumChain(o,null!=(r=s.rpcUrls)?r:[],null!=(i=s.blockExplorerUrls)?i:[],s.chainName,null!=(n=s.iconUrls)?n:[],s.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){let t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){let t=Array.isArray(e)?e[0]:e;if(!t.type)throw h.standardErrors.rpc.invalidParams("Type is required");if((null==t?void 0:t.type)!=="ERC20")throw h.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw h.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw h.standardErrors.rpc.invalidParams("Address is required");let r=this.getChainId(),{address:i,symbol:n,image:s,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,i,n,o,s,r)}}initializeRelay(){if(!this._relay){let e=new c.WalletLinkRelay({linkAPIUrl:u.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((e,t)=>this._setAddresses(e,t)),e.setChainCallback((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))}),this._relay=e}return this._relay}}},953605,(e,t,r)=>{"use strict";
1Object.defineProperty(r,"__esModule",{value:!0}),r.checkErrorForInvalidRequestArgs=r.getCoinbaseInjectedProvider=r.getCoinbaseInjectedSigner=r.fetchRPCRequest=void 0;let i=e.r(961977),n=e.r(464357);function s(){return globalThis.coinbaseWalletSigner}r.fetchRPCRequest=async function(e,t){if(!t.rpcUrl)throw n.standardErrors.rpc.internal("No RPC URL set for chain");let r=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),s=await window.fetch(t.rpcUrl,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":i.LIB_VERSION}});return(await s.json()).result},r.getCoinbaseInjectedSigner=s,r.getCoinbaseInjectedProvider=function({metadata:e,preference:t}){var r,i,n;let o=globalThis;if("smartWalletOnly"!==t.options){if(s())return;let t=o.coinbaseWalletExtension;if(t){let{appName:i,appLogoUrl:n,appChainIds:s}=e;return null==(r=t.setAppInfo)||r.call(t,i,n,s),t}}let a=null!=(i=o.ethereum)?i:null==(n=o.top)?void 0:n.ethereum;if(null==a?void 0:a.isCoinbaseBrowser)return a},r.checkErrorForInvalidRequestArgs=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return n.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});let{method:t,params:r}=e;return"string"!=typeof t||0===t.length?n.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e}):void 0===r||Array.isArray(r)||"object"==typeof r&&null!==r?void 0:n.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e})}},514785,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createSigner=r.fetchSignerType=r.storeSignerType=r.loadSignerType=void 0;let i=e.r(948260),n=e.r(726700),s=e.r(464357),o=e.r(953605),a=e.r(123614),l="SignerType",c=new a.ScopedLocalStorage("CBWSDK","SignerConfigurator");async function u(e,t){await e.onMessage(({event:e})=>"WalletLinkSessionRequest"===e);let r=new n.WalletLinkSigner({metadata:t});e.postMessage({event:"WalletLinkUpdate",data:{session:r.getSession()}}),await r.handshake(),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}r.loadSignerType=function(){return c.getItem(l)},r.storeSignerType=function(e){c.setItem(l,e)},r.fetchSignerType=async function(e){let{communicator:t,metadata:r}=e;u(t,r).catch(()=>{});let i={id:crypto.randomUUID(),event:"selectSignerType",data:e.preference},{data:n}=await t.postRequestAndWaitForResponse(i);return n},r.createSigner=function(e){let{signerType:t,metadata:r,communicator:a,updateListener:l}=e;switch(t){case"scw":return new i.SCWSigner({metadata:r,updateListener:l,communicator:a});case"walletlink":return new n.WalletLinkSigner({metadata:r,updateListener:l});case"extension":{let e=(0,o.getCoinbaseInjectedSigner)();if(!e)throw s.standardErrors.rpc.internal("injected signer not found");return e}}}},866144,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.closePopup=r.openPopup=void 0;let i=e.r(464357);r.openPopup=function(e){let t=(window.innerWidth-420)/2+window.screenX,r=(window.innerHeight-540)/2+window.screenY,n=window.open(e,"Smart Wallet",`width=420, height=540, left=${t}, top=${r}`);if(null==n||n.focus(),!n)throw i.standardErrors.rpc.internal("Pop up window failed to open");return n},r.closePopup=function(e){e&&!e.closed&&e.close()}},357792,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Communicator=void 0;let i=e.r(961977),n=e.r(866144),s=e.r(127816),o=e.r(464357);r.Communicator=class{constructor(e=s.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async e=>{(await this.waitForPopupLoaded()).postMessage(e,this.url.origin)},this.postRequestAndWaitForResponse=async e=>{let t=this.onMessage(({requestId:t})=>t===e.id);return this.postMessage(e),await t},this.onMessage=async e=>new Promise((t,r)=>{let i=r=>{if(r.origin!==this.url.origin)return;let n=r.data;e(n)&&(t(n),window.removeEventListener("message",i),this.listeners.delete(i))};window.addEventListener("message",i),this.listeners.set(i,{reject:r})}),this.disconnect=()=>{(0,n.closePopup)(this.popup),this.popup=null,this.listeners.forEac
1h(({reject:e},t)=>{e(o.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",t)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?this.popup:(this.popup=(0,n.openPopup)(this.url),this.onMessage(({event:e})=>"PopupUnload"===e).then(this.disconnect).catch(()=>{}),this.onMessage(({event:e})=>"PopupLoaded"===e).then(e=>{this.postMessage({requestId:e.id,data:{version:i.LIB_VERSION}})}).then(()=>{if(!this.popup)throw o.standardErrors.rpc.internal();return this.popup})),this.url=new URL(e)}}},690668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.determineMethodCategory=void 0;let i={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};r.determineMethodCategory=function(e){for(let t in i)if(i[t].includes(e))return t}},481098,(e,t,r)=>{"use strict";var i=e.e&&e.e.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r},n=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoinbaseWalletProvider=void 0;let s=n(e.r(478492)),o=e.r(464357),a=e.r(359683),l=e.r(550906),c=e.r(243403),u=e.r(514785),h=e.r(953605),d=e.r(357792),p=e.r(690668),f=e.r(123614);class g extends s.default{constructor(e){var t,r,{metadata:n}=e,s=e.preference,{keysUrl:a}=s,p=i(s,["keysUrl"]);super(),this.accounts=[],this.handlers={handshake:async e=>{try{if(this.connected)return this.emit("connect",{chainId:(0,c.hexStringFromIntNumber)((0,l.IntNumber)(this.chain.id))}),this.accounts;let e=await this.requestSignerSelection(),t=this.initSigner(e),r=await t.handshake();return this.signer=t,(0,u.storeSignerType)(e),this.emit("connect",{chainId:(0,c.hexStringFromIntNumber)((0,l.IntNumber)(this.chain.id))}),r}catch(e){throw this.handleUnauthorizedError(e),e}},sign:async e=>{if(!this.connected||!this.signer)throw o.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(e)}catch(e){throw this.handleUnauthorizedError(e),e}},fetch:e=>(0,h.fetchRPCRequest)(e,this.chain),state:e=>{let t=()=>{if(this.connected)return this.accounts;throw o.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(e.method){case"eth_chainId":return(0,c.hexStringFromIntNumber)((0,l.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return t();case"eth_coinbase":return t()[0];default:return this.handlers.unsupported(e)}},deprecated:({method:e})=>{throw o.standardErrors.rpc.methodNotSupported(`Method ${e} is deprecated.`)},unsupported:({method:e})=>{throw o.standardErrors.rpc.methodNotSupported(`Method ${e} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:e,source:t})=>{(0,c.areAddressArraysEqual)(this.accounts,e)||(this.accounts=e,"storage"!==t&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:e,source:t})=>{e.id===this.chain.id&&e.rpcUrl===this.chain.rpcUrl||(this.chain=e,"storage"!==t&&this.emit("chainChanged",(0,c.hexStringFromIntNumber)((0,l.IntNumber)(e.id))))}},this.metadata=n,this.preference=p,this.communicator=new d.Communicator(a),this.chain={id:null!=(r=null==(t=n.appChainIds)?void 0:t[0])?r:1};const f=(0,u.loadSignerType)();this.signer=f?this.initSigner(f):null}get connected(){return this.accounts.length>0}async request(e){var t;try{let r=(0,h.checkErrorForInvalidRequestArgs)(e);if(r)throw r;let i=null!=(t=(0,p.determineMethodCategory)(e.method))?t:"fetch";return this.handlers[i](e)}
1catch(t){return Promise.reject((0,a.serializeError)(t,e.method))}}handleUnauthorizedError(e){e.code===o.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},f.ScopedLocalStorage.clearAll(),this.emit("disconnect",o.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,u.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,u.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}r.CoinbaseWalletProvider=g},402539,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CoinbaseWalletSDK=void 0;let i=e.r(875489),n=e.r(481098),s=e.r(123614),o=e.r(961977),a=e.r(243403),l=e.r(953605);r.CoinbaseWalletSDK=class{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,a.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;let r={metadata:this.metadata,preference:e};return null!=(t=(0,l.getCoinbaseInjectedProvider)(r))?t:new n.CoinbaseWalletProvider(r)}getCoinbaseWalletLogo(e,t=240){return(0,i.walletLogo)(e,t)}storeLatestVersion(){new s.ScopedLocalStorage("CBWSDK").setItem("VERSION",o.LIB_VERSION)}}},471554,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CoinbaseWalletSDK=void 0,r.default=e.r(402539).CoinbaseWalletSDK;var i=e.r(402539);Object.defineProperty(r,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return i.CoinbaseWalletSDK}})},240734,(e,t,r)=>{"use strict";var i=e.r(271645),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=i.useState,o=i.useEffect,a=i.useLayoutEffect,l=i.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}var u="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),i=s({inst:{value:r,getSnapshot:t}}),n=i[0].inst,u=i[1];return a(function(){n.value=r,n.getSnapshot=t,c(n)&&u({inst:n})},[e,r,t]),o(function(){return c(n)&&u({inst:n}),e(function(){c(n)&&u({inst:n})})},[e]),l(r),r};r.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},536496,(e,t,r)=>{"use strict";t.exports=e.r(240734)},747319,186251,909014,e=>{"use strict";let t,r,i,n,s;(a=l||(l={})).Google="google",a.Github="github",a.Apple="apple",a.Facebook="facebook",a.X="x",a.Discord="discord",a.Farcaster="farcaster",e.i(503681);var o,a,l,c=e.i(322213),u=e.i(751357),h=e.i(323633),d=e.i(275749),p=e.i(451160),f=e.i(338585),g=e.i(240392),m=e.i(549531),w=e.i(552818),y=e.i(915592),v=e.i(21719),b=e.i(892522),C=e.i(854001),x=e.i(597445),_=e.i(710267),E=e.i(774213);e.i(128347);var k=e.i(72817);e.i(430453);var S=e.i(79220);let I=!1;class A{constructor(e){this.initPromise=void 0,this.setIsConnected=(e,t)=>{c.AccountController.setIsConnected(e,t)},this.getIsConnectedState=()=>c.AccountController.state.isConnected,this.setAllAccounts=(e,t)=>{c.AccountController.setAllAccounts(e,t),x.OptionsController.setHasMultipleAddresses(e?.length>1)},this.addAddressLabel=(e,t,r)=>{c.AccountController.addAddressLabel(e,t,r)},this.removeAddressLabel=(e,t)=>
1{c.AccountController.removeAddressLabel(e,t)},this.getCaipAddress=()=>c.AccountController.state.caipAddress,this.setCaipAddress=(e,t)=>{c.AccountController.setCaipAddress(e,t)},this.setBalance=(e,t,r)=>{c.AccountController.setBalance(e,t,r)},this.setProfileName=(e,t)=>{c.AccountController.setProfileName(e,t)},this.setProfileImage=(e,t)=>{c.AccountController.setProfileImage(e,t)},this.resetAccount=e=>{c.AccountController.resetAccount(e)},this.setCaipNetwork=e=>{_.NetworkController.setCaipNetwork(e)},this.getCaipNetwork=()=>_.NetworkController.state.caipNetwork,this.setRequestedCaipNetworks=(e,t)=>{_.NetworkController.setRequestedCaipNetworks(e,t)},this.getApprovedCaipNetworkIds=()=>_.NetworkController.getApprovedCaipNetworkIds(),this.setApprovedCaipNetworksData=e=>_.NetworkController.setApprovedCaipNetworksData(e),this.resetNetwork=()=>{_.NetworkController.resetNetwork()},this.setConnectors=e=>{d.ConnectorController.setConnectors(e)},this.addConnector=e=>{d.ConnectorController.addConnector(e)},this.getConnectors=()=>d.ConnectorController.getConnectors(),this.resetWcConnection=()=>{h.ConnectionController.resetWcConnection()},this.fetchIdentity=e=>u.BlockchainApiController.fetchIdentity(e),this.setAddressExplorerUrl=(e,t)=>{c.AccountController.setAddressExplorerUrl(e,t)},this.setSmartAccountDeployed=(e,t)=>{c.AccountController.setSmartAccountDeployed(e,t)},this.setConnectedWalletInfo=(e,t)=>{c.AccountController.setConnectedWalletInfo(e,t)},this.setSmartAccountEnabledNetworks=(e,t)=>{_.NetworkController.setSmartAccountEnabledNetworks(e,t)},this.setPreferredAccountType=(e,t)=>{c.AccountController.setPreferredAccountType(e,t)},this.getWalletConnectName=e=>C.EnsController.getNamesForAddress(e),this.resolveWalletConnectName=async e=>{let t=e.replace(S.ConstantsUtil.WC_NAME_SUFFIX,""),r=await C.EnsController.resolveName(t),i=Object.values(r?.addresses)||[];return i[0]?.address||!1},this.setEIP6963Enabled=e=>{x.OptionsController.setEIP6963Enabled(e)},this.setClientId=e=>{u.BlockchainApiController.setClientId(e)},this.getConnectorImage=e=>E.AssetUtil.getConnectorImage(e),this.handleUnsafeRPCRequest=()=>{this.isOpen()?this.isTransactionStackEmpty()||(this.isTransactionShouldReplaceView()?this.replace("ApproveTransaction"):this.redirect("ApproveTransaction")):this.open({view:"ApproveTransaction"})},this.adapter=e.adapters?.[0],this.initControllers(e),this.initOrContinue()}static getInstance(){return this.instance}async open(e){await this.initOrContinue(),g.ModalController.open(e)}async close(){await this.initOrContinue(),g.ModalController.close()}setLoading(e){g.ModalController.setLoading(e)}getError(){return this.adapter?.getError?.()}getChainId(){return this.adapter?.getChainId?.()}getAddress(){return this.adapter?.getAddress?.()}switchNetwork(e){return this.adapter?.switchNetwork?.(e)}getIsConnected(){return this.adapter?.getIsConnected?.()}getWalletProvider(){return this.adapter?.getWalletProvider?.()}getWalletProviderType(){return this.adapter?.getWalletProviderType?.()}subscribeProvider(e){return this.adapter?.subscribeProvider?.(e)}getThemeMode(){return y.ThemeController.state.themeMode}getThemeVariables(){return y.ThemeController.state.themeVariables}setThemeMode(e){y.ThemeController.setThemeMode(e),(0,k.setColorTheme)(y.ThemeController.state.themeMode)}setThemeVariables(e){y.ThemeController.setThemeVariables(e),(0,k.setThemeVariables)(y.ThemeController.state.themeVariables)}subscribeTheme(e){return y.ThemeController.subscribe(e)}getWalletInfo(){return c.AccountController.state.connectedWalletInfo}subscribeWalletInfo(e){return c.AccountController.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){c.AccountController.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){_.NetworkController.subscribeKey("caipNetwork",e)}getState(){return w.PublicStateController.state}subscribeState(e){return w.PublicStateController.subscribe(e)}showErrorMessage(e){v.SnackController.showError(e)}showSuccessMessage(e){v.SnackController.showSuccess(e)}getEvent(){return{...f.EventsController.state}}subscribeEvents(e){return f.EventsController.subscribe(e)}replace(e){b.RouterController.replace(e)}redirect(e){b.RouterController.push(e)}popTransactionStack(e){b.RouterController.popTransactionStack(e)}isOpen(){return g.ModalController.state.open}isTransactionStackEmpty(){return 0===b.RouterController.state.transactionStack.length}isTransactionShouldReplaceView(){return b.RouterController.state.transactionStack[b.RouterController.state.transactionStack.length-1]?.replace}async initControllers(t){if(x.OptionsController.setProjectId(t.projectId),x.OptionsController.setSdkVersion(t.sdkVersion),m.ChainController.initialize(t.adapters||[]),t.adapters?.forEach(e
1=>{e.construct?.(this,t),_.NetworkController.setAllowUnsupportedChain(t.allowUnsupportedChain,e.chain),_.NetworkController.setDefaultCaipNetwork(t.defaultChain)}),x.OptionsController.setAllWallets(t.allWallets),x.OptionsController.setIncludeWalletIds(t.includeWalletIds),x.OptionsController.setExcludeWalletIds(t.excludeWalletIds),x.OptionsController.setFeaturedWalletIds(t.featuredWalletIds),x.OptionsController.setTokens(t.tokens),x.OptionsController.setTermsConditionsUrl(t.termsConditionsUrl),x.OptionsController.setPrivacyPolicyUrl(t.privacyPolicyUrl),x.OptionsController.setCustomWallets(t.customWallets),x.OptionsController.setEnableAnalytics(t.enableAnalytics),x.OptionsController.setOnrampEnabled(t.enableOnramp),x.OptionsController.setEnableSwaps(t.enableSwaps),t.metadata&&x.OptionsController.setMetadata(t.metadata),t.themeMode&&y.ThemeController.setThemeMode(t.themeMode),t.themeVariables&&y.ThemeController.setThemeVariables(t.themeVariables),t.disableAppend&&x.OptionsController.setDisableAppend(!!t.disableAppend),t.adapters?.find(e=>e.chain===S.ConstantsUtil.CHAIN.EVM)&&t.siweConfig){let{SIWEController:r}=await e.A(430361);r.setSIWEClient(t.siweConfig)}}async initOrContinue(){return!this.initPromise&&!I&&p.CoreHelperUtil.isClient()&&(I=!0,this.initPromise=new Promise(async t=>{await Promise.all([e.A(929070),e.A(896740)]);let r=document.createElement("w3m-modal");x.OptionsController.state.disableAppend||document.body.insertAdjacentElement("beforeend",r),t()})),this.initPromise}}var T=e.i(929960),P=e.i(332520);e.i(716408);var R=e.i(19876),O=e.i(782442);e.i(994833);var N=e.i(642963),$=e.i(106179),D=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let L=class extends R.LitElement{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.balance="show",this.charsStart=4,this.charsEnd=6,this.address=c.AccountController.state.address,this.balanceVal=c.AccountController.state.balance,this.balanceSymbol=c.AccountController.state.balanceSymbol,this.profileName=c.AccountController.state.profileName,this.profileImage=c.AccountController.state.profileImage,this.network=_.NetworkController.state.caipNetwork,this.networkImage=this.network?E.AssetUtil.getNetworkImage(this.network):void 0,this.isUnsupportedChain=_.NetworkController.state.isUnsupportedChain,this.unsubscribe.push(T.AssetController.subscribeNetworkImages(()=>{this.networkImage=this.network?.imageId?E.AssetUtil.getNetworkImage(this.network):void 0}),c.AccountController.subscribe(e=>{e.isConnected?(this.address=e.address,this.balanceVal=e.balance,this.profileName=e.profileName,this.profileImage=e.profileImage,this.balanceSymbol=e.balanceSymbol):(this.address="",this.balanceVal="",this.profileName="",this.profileImage="",this.balanceSymbol="")}),_.NetworkController.subscribeKey("caipNetwork",e=>{this.network=e,this.networkImage=e?.imageId?E.AssetUtil.getNetworkImage(e):void 0}),_.NetworkController.subscribeKey("isUnsupportedChain",e=>{this.isUnsupportedChain=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e="show"===this.balance;return O.html`
2      <wui-account-button
3        .disabled=${!!this.disabled}
4        .isUnsupportedChain=${this.isUnsupportedChain}
5        address=${this.address??O.nothing}
6        profileName=${this.profileName??O.nothing}
7        networkSrc=${this.networkImage??O.nothing}
8        avatarSrc=${this.profileImage??O.nothing}
9        balance=${e?p.CoreHelperUtil.formatBalance(this.balanceVal,this.balanceSymbol):""}
10        @click=${this.onClick.bind(this)}
11        data-testid="account-button"
12        .charsStart=${this.charsStart}
13        .charsEnd=${this.charsEnd}
14      >
15      </wui-account-button>
16    `}onClick(){this.isUnsupportedChain?g.ModalController.open({view:"UnsupportedChain"}):g.ModalController.open()}};D([(0,N.property)({type:Boolean})],L.prototype,"disabled",void 0),D([(0,N.property)()],L.prototype,"balance",void 0),D([(0,N.property)()],L.prototype,"charsStart",void 0),D([(0,N.property)()],L.prototype,"charsEnd",void 0),D([(0,$.state)()],L.prototype,"address",void 0),D([(0,$.state)()],L.prototype,"balanceVal",void 0),D([(0,$.state)()],L.prototype,"balanceSymbol",void 0),D([(0,$.state)()],L.prototype,"profileName",void 0),D([(0,$.state)()],L.prototype,"profileImage",void 0),D([(0,$.state)()],L.prototype,"network",void 0),D([(0,$.state)()],L.prototype,"networkImage",void 0),D([(0,$.state)()],L.prototype,"isUnsupportedChain",void 0),L=D([(0,P.customElement)("w3m-account-button")],L);var j=R,U=e.i(38939);let M=U.css`
17  :host {
18    display: block;
19    width: max-content;
20  }
21`;var q=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
21);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let W=class extends j.LitElement{constructor(){super(...arguments),this.unsubscribe=[],this.disabled=!1,this.balance=void 0,this.size=void 0,this.label=void 0,this.loadingLabel=void 0,this.charsStart=4,this.charsEnd=6,this.isAccount=c.AccountController.state.isConnected,this.isLoading=g.ModalController.state.loading}firstUpdated(){this.unsubscribe.push(c.AccountController.subscribe(e=>{this.isAccount=e.isConnected}),g.ModalController.subscribeKey("loading",e=>{this.isLoading=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.isAccount&&!this.isLoading?O.html`
22          <w3m-account-button
23            .disabled=${!!this.disabled}
24            balance=${this.balance??O.nothing}
25            .charsStart=${this.charsStart??O.nothing}
26            .charsEnd=${this.charsEnd??O.nothing}
27          >
28          </w3m-account-button>
29        `:O.html`
30          <w3m-connect-button
31            size=${this.size??O.nothing}
32            label=${this.label??O.nothing}
33            loadingLabel=${this.loadingLabel??O.nothing}
34          ></w3m-connect-button>
35        `}};W.styles=M,q([(0,N.property)({type:Boolean})],W.prototype,"disabled",void 0),q([(0,N.property)()],W.prototype,"balance",void 0),q([(0,N.property)()],W.prototype,"size",void 0),q([(0,N.property)()],W.prototype,"label",void 0),q([(0,N.property)()],W.prototype,"loadingLabel",void 0),q([(0,N.property)()],W.prototype,"charsStart",void 0),q([(0,N.property)()],W.prototype,"charsEnd",void 0),q([(0,$.state)()],W.prototype,"isAccount",void 0),q([(0,$.state)()],W.prototype,"isLoading",void 0),W=q([(0,P.customElement)("w3m-button")],W);var B=R,z=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let H=class extends B.LitElement{constructor(){super(),this.unsubscribe=[],this.size="md",this.label="Connect Wallet",this.loadingLabel="Connecting...",this.open=g.ModalController.state.open,this.loading=g.ModalController.state.loading,this.unsubscribe.push(g.ModalController.subscribe(e=>{this.open=e.open,this.loading=e.loading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.loading||this.open;return O.html`
36      <wui-connect-button
37        size=${this.size??O.nothing}
38        .loading=${e}
39        @click=${this.onClick.bind(this)}
40        data-testid="connect-button"
41      >
42        ${e?this.loadingLabel:this.label}
43      </wui-connect-button>
44    `}onClick(){this.open?g.ModalController.close():this.loading||g.ModalController.open()}};z([(0,N.property)()],H.prototype,"size",void 0),z([(0,N.property)()],H.prototype,"label",void 0),z([(0,N.property)()],H.prototype,"loadingLabel",void 0),z([(0,$.state)()],H.prototype,"open",void 0),z([(0,$.state)()],H.prototype,"loading",void 0),H=z([(0,P.customElement)("w3m-connect-button")],H);var K=R;let V=U.css`
45  :host {
46    display: block;
47    width: max-content;
48  }
49`;var F=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let G=class extends K.LitElement{constructor(){super(...arguments),this.unsubscribe=[],this.disabled=!1,this.network=_.NetworkController.state.caipNetwork,this.networkImage=this.network?E.AssetUtil.getNetworkImage(this.network):void 0,this.connected=c.AccountController.state.isConnected,this.loading=g.ModalController.state.loading,this.isUnsupportedChain=_.NetworkController.state.isUnsupportedChain}firstUpdated(){this.unsubscribe.push(T.AssetController.subscribeNetworkImages(()=>{this.networkImage=this.network?.imageId?E.AssetUtil.getNetworkImage(this.network):void 0}),_.NetworkController.subscribeKey("caipNetwork",e=>{this.network=e,this.networkImage=e?.imageId?E.AssetUtil.getNetworkImage(e):void 0}),c.AccountController.subscribeKey("isConnected",e=>this.connected=e),g.ModalController.subscribeKey("loading",e=>this.loading=e),_.NetworkController.subscribeKey("isUnsupportedChain",e=>this.isUnsupportedChain=e))}
49disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
50      <wui-network-button
51        data-testid="wui-network-button"
52        .disabled=${!!(this.disabled||this.loading)}
53        .isUnsupportedChain=${this.isUnsupportedChain}
54        imageSrc=${this.networkImage??O.nothing}
55        @click=${this.onClick.bind(this)}
56      >
57        ${this.getLabel()}
58        <slot></slot>
59      </wui-network-button>
60    `}getLabel(){return this.label?this.label:this.isUnsupportedChain?"Switch Network":this.network?this.network.name:this.connected?"Unknown Network":"Select Network"}onClick(){this.loading||(f.EventsController.sendEvent({type:"track",event:"CLICK_NETWORKS"}),g.ModalController.open({view:"Networks"}))}};G.styles=V,F([(0,N.property)({type:Boolean})],G.prototype,"disabled",void 0),F([(0,N.property)({type:String})],G.prototype,"label",void 0),F([(0,$.state)()],G.prototype,"network",void 0),F([(0,$.state)()],G.prototype,"networkImage",void 0),F([(0,$.state)()],G.prototype,"connected",void 0),F([(0,$.state)()],G.prototype,"loading",void 0),F([(0,$.state)()],G.prototype,"isUnsupportedChain",void 0),G=F([(0,P.customElement)("w3m-network-button")],G);var Y=e.i(768038),J=R;let Z=U.css`
61  :host {
62    --prev-height: 0px;
63    --new-height: 0px;
64    display: block;
65  }
66
67  div.w3m-router-container {
68    transform: translateY(0);
69    opacity: 1;
70  }
71
72  div.w3m-router-container[view-direction='prev'] {
73    animation:
74      slide-left-out 150ms forwards ease,
75      slide-left-in 150ms forwards ease;
76    animation-delay: 0ms, 200ms;
77  }
78
79  div.w3m-router-container[view-direction='next'] {
80    animation:
81      slide-right-out 150ms forwards ease,
82      slide-right-in 150ms forwards ease;
83    animation-delay: 0ms, 200ms;
84  }
85
86  @keyframes slide-left-out {
87    from {
88      transform: translateX(0px);
89      opacity: 1;
90    }
91    to {
92      transform: translateX(10px);
93      opacity: 0;
94    }
95  }
96
97  @keyframes slide-left-in {
98    from {
99      transform: translateX(-10px);
100      opacity: 0;
101    }
102    to {
103      transform: translateX(0);
104      opacity: 1;
105    }
106  }
107
108  @keyframes slide-right-out {
109    from {
110      transform: translateX(0px);
111      opacity: 1;
112    }
113    to {
114      transform: translateX(-10px);
115      opacity: 0;
116    }
117  }
118
119  @keyframes slide-right-in {
120    from {
121      transform: translateX(10px);
122      opacity: 0;
123    }
124    to {
125      transform: translateX(0);
126      opacity: 1;
127    }
128  }
129`;var Q=e.i(247167);let X={ACCOUNT_TABS:[{label:"Tokens"},{label:"NFTs"},{label:"Activity"}],SECURE_SITE_ORIGIN:Q.default.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150}};var ee=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let et=class extends J.LitElement{constructor(){super(),this.resizeObserver=void 0,this.prevHeight="0px",this.prevHistoryLength=1,this.unsubscribe=[],this.view=b.RouterController.state.view,this.viewDirection="",this.unsubscribe.push(b.RouterController.subscribeKey("view",e=>this.onViewChange(e)))}firstUpdated(){this.resizeObserver=new ResizeObserver(([e])=>{let t=`${e?.contentRect.height}px`;"0px"!==this.prevHeight&&(this.style.setProperty("--prev-height",this.prevHeight),this.style.setProperty("--new-height",t),this.style.animation="w3m-view-height 150ms forwards ease",this.style.height="auto"),setTimeout(()=>{this.prevHeight=t,this.style.animation="unset"},X.ANIMATION_DURATIONS.ModalHeight)}),this.resizeObserver.observe(this.getWrapper())}disconnectedCallback(){this.resizeObserver?.unobserve(this.getWrapper()),this.unsubscribe.forEach(e=>e())}render(){return O.html`<div class="w3m-router-container" view-direction="${this.viewDirection}">
130      ${this.viewTemplate()}
131    </div>`}viewTemplate(){switch(this.view){case"AccountSettings":return O.html`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return O.html`<w3m-account-view></w3m-account-view>`;case"AllWallets":return O.html`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return O.html`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return O.html`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return O.html`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":default:return O.html`<w3m-connect-view></w3m-connect-view>`;case"ConnectingWalletConnect":return O.html`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;
131case"ConnectingExternal":return O.html`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return O.html`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return O.html`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return O.html`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return O.html`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"Downloads":return O.html`<w3m-downloads-view></w3m-downloads-view>`;case"EmailVerifyOtp":return O.html`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return O.html`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return O.html`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return O.html`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return O.html`<w3m-network-switch-view></w3m-network-switch-view>`;case"Profile":return O.html`<w3m-profile-view></w3m-profile-view>`;case"SelectAddresses":return O.html`<w3m-select-addresses-view></w3m-select-addresses-view>`;case"SwitchAddress":return O.html`<w3m-switch-address-view></w3m-switch-address-view>`;case"Transactions":return O.html`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return O.html`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampActivity":return O.html`<w3m-onramp-activity-view></w3m-onramp-activity-view>`;case"OnRampTokenSelect":return O.html`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return O.html`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return O.html`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpgradeToSmartAccount":return O.html`<w3m-upgrade-to-smart-account-view></w3m-upgrade-to-smart-account-view>`;case"UpdateEmailWallet":return O.html`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return O.html`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return O.html`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return O.html`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return O.html`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return O.html`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return O.html`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return O.html`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return O.html`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return O.html`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WhatIsABuy":return O.html`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return O.html`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return O.html`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return O.html`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return O.html`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return O.html`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return O.html`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return O.html`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return O.html`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return O.html`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`}}onViewChange(e){Y.TooltipController.hide();let t=X.VIEW_DIRECTION.Next,{history:r}=b.RouterController.state;r.length<this.prevHistoryLength&&(t=X.VIEW_DIRECTION.Prev),this.prevHistoryLength=r.length,this.viewDirection=t,setTimeout(()=>{this.view=e},X.ANIMATION_DURATIONS.ViewTransition)}getWrapper(){return this.shadowRoot?.querySelector("div")}};et.styles=Z,ee([(0,$.state)()],et.prototype,"view",void 0),ee([(0,$.state)()],et.prototype,"viewDirection",void 0),et=ee([(0,P.customElement)("w3m-router")],et);var er=e.i(980565),ei=R;let en=U.css`
132  :host > wui-flex {
133    width: 100%;
134    max-width: 360px;
135  }
136
137  :host > wui-flex > wui-flex {
138    border-radius: var(--wui-border-radius-l);
139    width: 100%;
140  }
141
142  .amounts-container {
143    width: 100%;
144  }
145`;var es=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
145);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let eo={USD:"$",EUR:"€",GBP:"£"},ea=[100,250,500,1e3],el=class extends ei.LitElement{constructor(){super(),this.unsubscribe=[],this.disabled=!1,this.connected=c.AccountController.state.isConnected,this.loading=g.ModalController.state.loading,this.paymentCurrency=er.OnRampController.state.paymentCurrency,this.paymentAmount=er.OnRampController.state.paymentAmount,this.purchaseAmount=er.OnRampController.state.purchaseAmount,this.quoteLoading=er.OnRampController.state.quotesLoading,this.unsubscribe.push(c.AccountController.subscribeKey("isConnected",e=>{this.connected=e}),g.ModalController.subscribeKey("loading",e=>{this.loading=e}),er.OnRampController.subscribe(e=>{this.paymentCurrency=e.paymentCurrency,this.paymentAmount=e.paymentAmount,this.purchaseAmount=e.purchaseAmount,this.quoteLoading=e.quotesLoading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
146      <wui-flex flexDirection="column" justifyContent="center" alignItems="center">
147        <wui-flex flexDirection="column" alignItems="center" gap="xs">
148          <w3m-onramp-input
149            type="Fiat"
150            @inputChange=${this.onPaymentAmountChange.bind(this)}
151            .value=${this.paymentAmount||0}
152          ></w3m-onramp-input>
153          <w3m-onramp-input
154            type="Token"
155            .value=${this.purchaseAmount||0}
156            .loading=${this.quoteLoading}
157          ></w3m-onramp-input>
158          <wui-flex justifyContent="space-evenly" class="amounts-container" gap="xs">
159            ${ea.map(e=>O.html`<wui-button
160                  variant=${this.paymentAmount===e?"accent":"neutral"}
161                  size="md"
162                  textVariant="paragraph-600"
163                  fullWidth
164                  @click=${()=>this.selectPresetAmount(e)}
165                  >${`${eo[this.paymentCurrency?.id||"USD"]} ${e}`}</wui-button
166                >`)}
167          </wui-flex>
168          ${this.templateButton()}
169        </wui-flex>
170      </wui-flex>
171    `}templateButton(){return this.connected?O.html`<wui-button
172          @click=${this.getQuotes.bind(this)}
173          variant="main"
174          fullWidth
175          size="lg"
176          borderRadius="xs"
177        >
178          Get quotes
179        </wui-button>`:O.html`<wui-button
180          @click=${this.openModal.bind(this)}
181          variant="accent"
182          fullWidth
183          size="lg"
184          borderRadius="xs"
185        >
186          Connect wallet
187        </wui-button>`}getQuotes(){this.loading||g.ModalController.open({view:"OnRampProviders"})}openModal(){g.ModalController.open({view:"Connect"})}async onPaymentAmountChange(e){er.OnRampController.setPaymentAmount(Number(e.detail)),await er.OnRampController.getQuote()}async selectPresetAmount(e){er.OnRampController.setPaymentAmount(e),await er.OnRampController.getQuote()}};el.styles=en,es([(0,N.property)({type:Boolean})],el.prototype,"disabled",void 0),es([(0,$.state)()],el.prototype,"connected",void 0),es([(0,$.state)()],el.prototype,"loading",void 0),es([(0,$.state)()],el.prototype,"paymentCurrency",void 0),es([(0,$.state)()],el.prototype,"paymentAmount",void 0),es([(0,$.state)()],el.prototype,"purchaseAmount",void 0),es([(0,$.state)()],el.prototype,"quoteLoading",void 0),el=es([(0,P.customElement)("w3m-onramp-widget")],el);var ec=e.i(983452),eu=e.i(549760),eh=e.i(773238),ed=e.i(758362),ep=R;e.i(404849);var ef=e.i(785643),eg=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let em=class extends ep.LitElement{constructor(){super(),this.usubscribe=[],this.networkImages=T.AssetController.state.networkImages,this.address=c.AccountController.state.address,this.profileImage=c.AccountController.state.profileImage,this.profileName=c.AccountController.state.profileName,this.network=_.NetworkController.state.caipNetwork,this.preferredAccountType=c.AccountController.state.preferredAccountType,this.disconnecting=!1,this.loading=!1,this.switched=!1,this.text="",this.usubscribe.push(c.AccountController.subscribe(e=>{e.address?(this.address=e.address,this.profileImage=e.profileImage,this.profileName=e.profileName,this.preferredAccountType=e.preferredAccountType):g.ModalController.close()}),c.AccountController.subscribeKey("preferredAccountType",e=>this.preferredAccountType=e),_.NetworkController.subscribeKey("caipNetwork",e=>{e?.id&&(this.network=e)}))}
187disconnectedCallback(){this.usubscribe.forEach(e=>e())}render(){if(!this.address)throw Error("w3m-account-settings-view: No account provided");let e=this.networkImages[this.network?.imageId??""],t=this.profileName?.split(".")[0];return O.html`
188      <wui-flex
189        flexDirection="column"
190        alignItems="center"
191        gap="l"
192        .padding=${["0","xl","m","xl"]}
193      >
194        <wui-avatar
195          alt=${this.address}
196          address=${this.address}
197          imageSrc=${this.profileImage??O.nothing}
198          size="2lg"
199        ></wui-avatar>
200        <wui-flex flexDirection="column" alignItems="center">
201          <wui-flex gap="3xs" alignItems="center" justifyContent="center">
202            <wui-text variant="title-6-600" color="fg-100" data-testid="account-settings-address">
203              ${t?ed.UiHelperUtil.getTruncateString({string:t,charsStart:20,charsEnd:0,truncate:"end"}):ed.UiHelperUtil.getTruncateString({string:this.address,charsStart:4,charsEnd:6,truncate:"middle"})}
204            </wui-text>
205            <wui-icon-link
206              size="md"
207              icon="copy"
208              iconColor="fg-200"
209              @click=${this.onCopyAddress}
210            ></wui-icon-link>
211          </wui-flex>
212        </wui-flex>
213      </wui-flex>
214      <wui-flex flexDirection="column" gap="m">
215        <wui-flex flexDirection="column" gap="xs" .padding=${["0","l","m","l"]}>
216          ${this.authCardTemplate()}
217          <w3m-account-auth-button></w3m-account-auth-button>
218          <wui-list-item
219            .variant=${e?"image":"icon"}
220            iconVariant="overlay"
221            icon="networkPlaceholder"
222            imageSrc=${e??O.nothing}
223            ?chevron=${this.isAllowedNetworkSwitch()}
224            @click=${this.onNetworks.bind(this)}
225            data-testid="account-switch-network-button"
226          >
227            <wui-text variant="paragraph-500" color="fg-100">
228              ${this.network?.name??"Unknown"}
229            </wui-text>
230          </wui-list-item>
231          ${this.togglePreferredAccountBtnTemplate()} ${this.chooseNameButtonTemplate()}
232          <wui-list-item
233            variant="icon"
234            iconVariant="overlay"
235            icon="disconnect"
236            ?chevron=${!1}
237            .loading=${this.disconnecting}
238            @click=${this.onDisconnect.bind(this)}
239            data-testid="disconnect-button"
240          >
241            <wui-text variant="paragraph-500" color="fg-200">Disconnect</wui-text>
242          </wui-list-item>
243        </wui-flex>
244      </wui-flex>
245    `}chooseNameButtonTemplate(){let e=ec.StorageUtil.getConnectedConnector(),t=d.ConnectorController.getAuthConnector();return _.NetworkController.checkIfNamesSupported()&&t&&"AUTH"===e&&!this.profileName?O.html`
246      <wui-list-item
247        variant="icon"
248        iconVariant="overlay"
249        icon="id"
250        iconSize="sm"
251        ?chevron=${!0}
252        @click=${this.onChooseName.bind(this)}
253        data-testid="account-choose-name-button"
254      >
255        <wui-text variant="paragraph-500" color="fg-100">Choose account name </wui-text>
256      </wui-list-item>
257    `:null}authCardTemplate(){let e=ec.StorageUtil.getConnectedConnector(),t=d.ConnectorController.getAuthConnector(),{origin:r}=location;return!t||"AUTH"!==e||r.includes(eh.ConstantsUtil.SECURE_SITE)?null:O.html`
258      <wui-notice-card
259        @click=${this.onGoToUpgradeView.bind(this)}
260        label="Upgrade your wallet"
261        description="Transition to a self-custodial wallet"
262        icon="wallet"
263        data-testid="w3m-wallet-upgrade-card"
264      ></wui-notice-card>
265    `}isAllowedNetworkSwitch(){let e=_.NetworkController.getRequestedCaipNetworks(),t=!!e&&e.length>1,r=e?.find(({id:e})=>e===this.network?.id);return t||!r}onCopyAddress(){try{this.profileName?(p.CoreHelperUtil.copyToClopboard(this.profileName),v.SnackController.showSuccess("Name copied")):this.address&&(p.CoreHelperUtil.copyToClopboard(this.address),v.SnackController.showSuccess("Address copied"))}catch{v.SnackController.showError("Failed to copy")}}togglePreferredAccountBtnTemplate(){let e=_.NetworkController.checkIfSmartAccountEnabled(),t=ec.StorageUtil.getConnectedConnector();return d.ConnectorController.getAuthConnector()&&"AUTH"===t&&e?(this.switched||(this.text=this.preferredAccountType===ef.W3mFrameRpcConstants.A
265CCOUNT_TYPES.SMART_ACCOUNT?"Switch to your EOA":"Switch to your smart account"),O.html`
266      <wui-list-item
267        variant="icon"
268        iconVariant="overlay"
269        icon="swapHorizontalBold"
270        iconSize="sm"
271        ?chevron=${!0}
272        ?loading=${this.loading}
273        @click=${this.changePreferredAccountType.bind(this)}
274        data-testid="account-toggle-preferred-account-type"
275      >
276        <wui-text variant="paragraph-500" color="fg-100">${this.text}</wui-text>
277      </wui-list-item>
278    `):null}onChooseName(){b.RouterController.push("ChooseAccountName")}async changePreferredAccountType(){let e=_.NetworkController.checkIfSmartAccountEnabled(),t=this.preferredAccountType!==ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT&&e?ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT:ef.W3mFrameRpcConstants.ACCOUNT_TYPES.EOA;d.ConnectorController.getAuthConnector()&&(this.loading=!0,await h.ConnectionController.setPreferredAccountType(t),this.text=t===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT?"Switch to your EOA":"Switch to your smart account",this.switched=!0,eu.SendController.resetSend(),this.loading=!1,this.requestUpdate())}onNetworks(){this.isAllowedNetworkSwitch()&&b.RouterController.push("Networks")}async onDisconnect(){try{this.disconnecting=!0,await h.ConnectionController.disconnect(),f.EventsController.sendEvent({type:"track",event:"DISCONNECT_SUCCESS"}),g.ModalController.close()}catch{f.EventsController.sendEvent({type:"track",event:"DISCONNECT_ERROR"}),v.SnackController.showError("Failed to disconnect")}finally{this.disconnecting=!1}}onGoToUpgradeView(){f.EventsController.sendEvent({type:"track",event:"EMAIL_UPGRADE_FROM_MODAL"}),b.RouterController.push("UpgradeEmailWallet")}};eg([(0,$.state)()],em.prototype,"address",void 0),eg([(0,$.state)()],em.prototype,"profileImage",void 0),eg([(0,$.state)()],em.prototype,"profileName",void 0),eg([(0,$.state)()],em.prototype,"network",void 0),eg([(0,$.state)()],em.prototype,"preferredAccountType",void 0),eg([(0,$.state)()],em.prototype,"disconnecting",void 0),eg([(0,$.state)()],em.prototype,"loading",void 0),eg([(0,$.state)()],em.prototype,"switched",void 0),eg([(0,$.state)()],em.prototype,"text",void 0),em=eg([(0,P.customElement)("w3m-account-settings-view")],em);var ew=R;let ey=class extends ew.LitElement{render(){let e=ec.StorageUtil.getConnectedConnector(),t=d.ConnectorController.getAuthConnector();return O.html`
279      ${t?.walletFeatures&&"AUTH"===e?this.walletFeaturesTemplate():this.defaultTemplate()}
280    `}walletFeaturesTemplate(){return O.html`<w3m-account-wallet-features-widget></w3m-account-wallet-features-widget>`}defaultTemplate(){return O.html`<w3m-account-default-widget></w3m-account-default-widget>`}};ey=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-account-view")],ey);var ev=R,eb=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let eC=class extends ev.LitElement{constructor(){super(...arguments),this.search="",this.onDebouncedSearch=p.CoreHelperUtil.debounce(e=>{this.search=e})}render(){let e=this.search.length>=2;return O.html`
281      <wui-flex .padding=${["0","s","s","s"]} gap="s">
282        <wui-search-bar @inputChange=${this.onInputChange.bind(this)}></wui-search-bar>
283        ${this.qrButtonTemplate()}
284      </wui-flex>
285      ${e?O.html`<w3m-all-wallets-search query=${this.search}></w3m-all-wallets-search>`:O.html`<w3m-all-wallets-list></w3m-all-wallets-list>`}
286    `}onInputChange(e){this.onDebouncedSearch(e.detail)}qrButtonTemplate(){return p.CoreHelperUtil.isMobile()?O.html`
287        <wui-icon-box
288          size="lg"
289          iconSize="xl"
290          iconColor="accent-100"
291          backgroundColor="accent-100"
292          icon="qrCode"
293          background="transparent"
294          border
295          borderColor="wui-accent-glass-010"
296          @click=${this.onWalletConnectQr.bind(this)}
297        ></wui-icon-box>
298      `:null}onWalletConnectQr(){b.RouterController.push("ConnectingWalletConnect")}};eb([(0,$.state)()],eC.prototype,"search",void 0),eC=eb([(0,P.customElement)("w3m-all-wallets-view")],eC);var ex=R;let e_=U.css`
299  @keyframes shake {
300    0% {
301      transform: translateX(0);
302    }
303    25% {
304      transform: translateX(3px);
305    }
306    50% {
307      transform: translateX(-3px);
308    }
309    75% {
310      transform: translateX(3px);
311    }
312    100% {
313      transform: translateX(0);
314    }
315  }
316
317  wui-flex:first-child:not(:only-child) {
318    position: relative;
319  }
320
321  wui-loading-thumbnail {
322    position: absolute;
323  }
324
325  wui-visual {
326    width: var(--wui-wallet-image-size-lg);
327    height: var(--wui-wallet-image-size-lg);
328    border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
329    position: relative;
330    overflow: hidden;
331  }
332
333  wui-visual::after {
334    content: '';
335    display: block;
336    width: 100%;
337    height: 100%;
338    position: absolute;
339    inset: 0;
340    border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
341    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
342  }
343
344  wui-icon-box {
345    position: absolute;
346    right: calc(var(--wui-spacing-3xs) * -1);
347    bottom: calc(var(--wui-spacing-3xs) * -1);
348    opacity: 0;
349    transform: scale(0.5);
350    transition:
351      opacity var(--wui-ease-out-power-2) var(--wui-duration-lg),
352      transform var(--wui-ease-out-power-2) var(--wui-duration-lg);
353    will-change: opacity, transform;
354  }
355
356  wui-text[align='center'] {
357    width: 100%;
358    padding: 0px var(--wui-spacing-l);
359  }
360
361  [data-error='true'] wui-icon-box {
362    opacity: 1;
363    transform: scale(1);
364  }
365
366  [data-error='true'] > wui-flex:first-child {
367    animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
368  }
369
370  [data-retry='false'] wui-link {
371    display: none;
372  }
373
374  [data-retry='true'] wui-link {
375    display: block;
376    opacity: 1;
377  }
378
379  wui-link {
380    padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs);
381  }
382`;var eE=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let ek=class extends ex.LitElement{constructor(){super(),this.unsubscribe=[],this.selectedOnRampProvider=er.OnRampController.state.selectedProvider,this.uri=h.ConnectionController.state.wcUri,this.ready=!1,this.showRetry=!1,this.buffering=!1,this.error=!1,this.startTime=null,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(er.OnRampController.subscribeKey("selectedProvider",e=>{this.selectedOnRampProvider=e})),this.watchTransactions()}disconnectedCallback(){this.intervalId&&clearInterval(this.intervalId)}render(){let e="Continue in external window";this.error?e="Buy failed":this.selectedOnRampProvider&&(e=`Buy in ${this.selectedOnRampProvider?.label}`);let t=this.error?"Buy can be declined from your side or due to and error on the provider app":"We’ll notify you once your Buy is processed";return O.html`
383      <wui-flex
384        data-error=${this.error??O.nothing}
385        data-retry=${this.showRetry}
386        flexDirection="column"
387        alignItems="center"
388        .padding=${["3xl","xl","xl","xl"]}
389        gap="xl"
390      >
391        <wui-flex justifyContent="center" alignItems="center">
392          <wui-visual
393            name=${this.selectedOnRampProvider?.name??O.nothing}
394            size="lg"
395            class="provider-image"
396          >
397          </wui-visual>
398
399          ${this.error?null:this.loaderTemplate()}
400
401          <wui-icon-box
402            backgroundColor="error-100"
403            background="opaque"
404            iconColor="error-100"
405            icon="close"
406            size="sm"
407            border
408            borderColor="wui-color-bg-125"
409          ></wui-icon-box>
410        </wui-flex>
411
412        <wui-flex flexDirection="column" alignItems="center" gap="xs">
413          <wui-text variant="paragraph-500" color=${this.error?"error-100":"fg-100"}>
414            ${e}
415          </wui-text>
416          <wui-text align="center" variant="small-500" color="fg-200">${t}</wui-text>
417        </wui-flex>
418
419        ${this.error?this.tryAgainTemplate():null}
420      </wui-flex>
421
422      <wui-flex .padding=${["0","xl","xl","xl"]} justifyContent="center">
423        <wui-link @click=${this.onCopyUri} color="fg-200">
424          <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
425          Copy link
426        </wui-link>
427      </wui-flex>
428    `}watchTransactions(){this.selectedOnRampProvider&&"coinbase"===this.selectedOnRampProvider.name&&(this.startTime=Date.now(),this.initializeCoinbaseTransactions())}async initializeCoinbaseTransactions(){await this.watchCoinbaseTransactions(),this.intervalId=setInterval(()=>this.watchCoinbaseTransactions(),4e3)}async watchCoinbaseTransactions(){try{let e=c.AccountController.state.address,t=x.OptionsController.state.projectId;if(!e)throw Error("No address found");(await u.BlockchainApiController.fetchTransactions({account:e,onramp:"coinbase",projectId:t})).data.filter(e=>new Date(e.metadata.minedAt)>new Date(this.startTime)||"ONRAMP_TRANSACTION_STATUS_IN_PROGRESS"===e.metadata.status).length?(clearInterval(this.intervalId),b.RouterController.replace("OnRampActivity")):this.startTime&&Date.now()-this.startTime>=18e4&&(clearInterval(this.intervalId),this.error=!0)}catch(e){v.SnackController.showError(e)}}onTryAgain(){this.selectedOnRampProvider&&(this.error=!1,p.CoreHelperUtil.openHref(this.selectedOnRampProvider.url,"popupWindow","width=600,height=800,scrollbars=yes"))}tryAgainTemplate(){return this.selectedOnRampProvider?.url?O.html`<wui-button size="md" variant="accent" @click=${this.onTryAgain.bind(this)}>
429      <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
430      Try again
431    </wui-button>
431`:null}loaderTemplate(){let e=y.ThemeController.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return O.html`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}onCopyUri(){if(!this.selectedOnRampProvider?.url){v.SnackController.showError("No link found"),b.RouterController.goBack();return}try{p.CoreHelperUtil.copyToClopboard(this.selectedOnRampProvider.url),v.SnackController.showSuccess("Link copied")}catch{v.SnackController.showError("Failed to copy")}}};ek.styles=e_,eE([(0,$.state)()],ek.prototype,"intervalId",void 0),eE([(0,$.state)()],ek.prototype,"selectedOnRampProvider",void 0),eE([(0,$.state)()],ek.prototype,"uri",void 0),eE([(0,$.state)()],ek.prototype,"ready",void 0),eE([(0,$.state)()],ek.prototype,"showRetry",void 0),eE([(0,$.state)()],ek.prototype,"buffering",void 0),eE([(0,$.state)()],ek.prototype,"error",void 0),eE([(0,$.state)()],ek.prototype,"startTime",void 0),eE([(0,N.property)({type:Boolean})],ek.prototype,"isMobile",void 0),eE([(0,N.property)()],ek.prototype,"onRetry",void 0),ek=eE([(0,P.customElement)("w3m-buy-in-progress-view")],ek);var eS=R;let eI=U.css`
432  :host > wui-flex {
433    max-height: clamp(360px, 540px, 80vh);
434    scrollbar-width: none;
435    overflow-y: scroll;
436    overflow-x: hidden;
437  }
438
439  :host > wui-flex::-webkit-scrollbar {
440    display: none;
441  }
442
443  .all-wallets {
444    flex-flow: column;
445  }
446`;var eA=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let eT=class extends eS.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
447      <wui-flex flexDirection="column" .padding=${["3xs","s","s","s"]}>
448        <w3m-email-login-widget></w3m-email-login-widget>
449        <w3m-social-login-widget></w3m-social-login-widget>
450        ${this.walletListTemplate()}
451      </wui-flex>
452      <w3m-legal-footer></w3m-legal-footer>
453    `}walletListTemplate(){let e=this.connectors.find(e=>"AUTH"===e.type);return e?.socials?e?.showWallets?O.html`
454          <wui-flex flexDirection="column" gap="xs" .margin=${["xs","0","0","0"]}>
455            <w3m-connector-list></w3m-connector-list>
456            <wui-flex class="all-wallets">
457              <w3m-all-wallets-widget></w3m-all-wallets-widget>
458            </wui-flex>
459          </wui-flex>
460        `:O.html`<wui-list-button
461        @click=${this.onContinueWalletClick.bind(this)}
462        text="Continue with a wallet"
463      ></wui-list-button>`:O.html`<w3m-wallet-login-list></w3m-wallet-login-list>`}onContinueWalletClick(){b.RouterController.push("ConnectWallets")}};eT.styles=eI,eA([(0,$.state)()],eT.prototype,"connectors",void 0),eT=eA([(0,P.customElement)("w3m-connect-view")],eT);let eP="walletConnect",eR="injected",eO="coinbaseWallet",eN="coinbaseWalletSDK",e$="safe",eD="ledger",eL="eip6963",ej="w3mAuth",eU="eip155";var eM=R;let eq=U.css`
464  @keyframes shake {
465    0% {
466      transform: translateX(0);
467    }
468    25% {
469      transform: translateX(3px);
470    }
471    50% {
472      transform: translateX(-3px);
473    }
474    75% {
475      transform: translateX(3px);
476    }
477    100% {
478      transform: translateX(0);
479    }
480  }
481
482  wui-flex:first-child:not(:only-child) {
483    position: relative;
484  }
485
486  wui-loading-thumbnail {
487    position: absolute;
488  }
489
490  wui-icon-box {
491    position: absolute;
492    right: calc(var(--wui-spacing-3xs) * -1);
493    bottom: calc(var(--wui-spacing-3xs) * -1);
494    opacity: 0;
495    transform: scale(0.5);
496    transition-property: opacity, transform;
497    transition-duration: var(--wui-duration-lg);
498    transition-timing-function: var(--wui-ease-out-power-2);
499    will-change: opacity, transform;
500  }
501
502  wui-text[align='center'] {
503    width: 100%;
504    padding: 0px var(--wui-spacing-l);
505  }
506
507  [data-error='true'] wui-icon-box {
508    opacity: 1;
509    transform: scale(1);
510  }
511
512  [data-error='true'] > wui-flex:first-child {
513    animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
514  }
515
516  [data-retry='false'] wui-link {
517    display: none;
518  }
519
520  [data-retry='true'] wui-link {
521    display: block;
522    opacity: 1;
523  }
524`;var eW=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};class eB extends eM.LitElement{constructor(){super(),this.wallet=b.RouterController.state.data?.wallet,this.connector=b.RouterController.state.data?.connector,this.timeout=void 0,this.secondaryBtnLabel="Try again",this.secondaryBtnIcon="refresh",this.secondaryLabel="Accept connection request in the wallet",this.onConnect=void 0,this.onRender=void 0,this.onAutoConnect=void 0,this.isWalletConnect=!0,this.unsubscribe=[],this.imageSrc=E.AssetUtil.getWalletImage(this.wallet)??E.AssetUtil.getConnectorImage(this.connector),this.name=this.wallet?.name??this.connector?.name??"Wallet",this.isRetrying=!1,this.uri=h.ConnectionController.state.wcUri,this.error=h.ConnectionController.state.wcError,this.ready=!1,this.showRetry=!1,this.buffering=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(h.ConnectionController.subscribeKey("wcUri",e=>{this.uri=e,this.isRetrying&&this.onRetry&&(this.isRetrying=!1,this.onConnect?.())}),h.ConnectionController.subscribeKey("wcError",e=>this.error=e),h.ConnectionController.subscribeKey("buffering",e=>this.buffering=e))}firstUpdated(){this.onAutoConnect?.(),this.showRetry=!this.onAutoConnect}
524disconnectedCallback(){this.unsubscribe.forEach(e=>e()),clearTimeout(this.timeout)}render(){this.onRender?.(),this.onShowRetry();let e=this.error?"Connection can be declined if a previous request is still active":this.secondaryLabel,t=`Continue in ${this.name}`;return this.buffering&&(t="Connecting..."),this.error&&(t="Connection declined"),O.html`
525      <wui-flex
526        data-error=${this.error??O.nothing}
527        data-retry=${this.showRetry}
528        flexDirection="column"
529        alignItems="center"
530        .padding=${["3xl","xl","xl","xl"]}
531        gap="xl"
532      >
533        <wui-flex justifyContent="center" alignItems="center">
534          <wui-wallet-image size="lg" imageSrc=${this.imageSrc??O.nothing}></wui-wallet-image>
535
536          ${this.error?null:this.loaderTemplate()}
537
538          <wui-icon-box
539            backgroundColor="error-100"
540            background="opaque"
541            iconColor="error-100"
542            icon="close"
543            size="sm"
544            border
545            borderColor="wui-color-bg-125"
546          ></wui-icon-box>
547        </wui-flex>
548
549        <wui-flex flexDirection="column" alignItems="center" gap="xs">
550          <wui-text variant="paragraph-500" color=${this.error?"error-100":"fg-100"}>
551            ${t}
552          </wui-text>
553          <wui-text align="center" variant="small-500" color="fg-200">${e}</wui-text>
554        </wui-flex>
555
556        <wui-button
557          variant="accent"
558          size="md"
559          ?disabled=${!this.error&&this.buffering}
560          @click=${this.onTryAgain.bind(this)}
561        >
562          <wui-icon color="inherit" slot="iconLeft" name=${this.secondaryBtnIcon}></wui-icon>
563          ${this.secondaryBtnLabel}
564        </wui-button>
565      </wui-flex>
566
567      ${this.isWalletConnect?O.html`
568            <wui-flex .padding=${["0","xl","xl","xl"]} justifyContent="center">
569              <wui-link @click=${this.onCopyUri} color="fg-200">
570                <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
571                Copy link
572              </wui-link>
573            </wui-flex>
574          `:null}
575
576      <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
577    `}onShowRetry(){if(this.error&&!this.showRetry){this.showRetry=!0;let e=this.shadowRoot?.querySelector("wui-button");e?.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}onTryAgain(){this.buffering||(h.ConnectionController.setWcError(!1),this.onRetry?(this.isRetrying=!0,this.onRetry?.()):this.onConnect?.())}loaderTemplate(){let e=y.ThemeController.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return O.html`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}onCopyUri(){try{this.uri&&(p.CoreHelperUtil.copyToClopboard(this.uri),v.SnackController.showSuccess("Link copied"))}catch{v.SnackController.showError("Failed to copy")}}}eB.styles=eq,eW([(0,$.state)()],eB.prototype,"uri",void 0),eW([(0,$.state)()],eB.prototype,"error",void 0),eW([(0,$.state)()],eB.prototype,"ready",void 0),eW([(0,$.state)()],eB.prototype,"showRetry",void 0),eW([(0,$.state)()],eB.prototype,"buffering",void 0),eW([(0,N.property)({type:Boolean})],eB.prototype,"isMobile",void 0),eW([(0,N.property)()],eB.prototype,"onRetry",void 0);let ez=class extends eB{constructor(){if(super(),!this.connector)throw Error("w3m-connecting-view: No connector provided");f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.connector.name??"Unknown",platform:"browser"}}),this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),this.isWalletConnect=!1}async onConnectProxy(){try{this.error=!1,this.connector&&(this.connector.id!==eN||!this.error)&&(await h.ConnectionController.connectExternal(this.connector,this.connector.chain),x.OptionsController.state.isSiweEnabled?b.RouterController.push("ConnectingSiwe"):g.ModalController.close(),f.EventsController.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"browser",name:this.connector.name||"Unknown"}}))}catch(e){f.EventsController.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:e?.message??"Unknown"}}),this.error=!0}}};ez=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
577);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-external-view")],ez);var eH=R;let eK=U.css`
578  wui-flex,
579  wui-list-wallet {
580    width: 100%;
581  }
582`;var eV=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let eF=class extends eH.LitElement{constructor(){super(),this.unsubscribe=[],this.activeConnector=m.ChainController.state.activeConnector,this.unsubscribe.push(m.ChainController.subscribeKey("activeConnector",e=>this.activeConnector=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
583      <wui-flex
584        flexDirection="column"
585        alignItems="center"
586        .padding=${["m","xl","xl","xl"]}
587        gap="xl"
588      >
589        <wui-flex justifyContent="center" alignItems="center">
590          <wui-wallet-image
591            size="lg"
592            imageSrc=${E.AssetUtil.getConnectorImage(this.activeConnector)??O.nothing}
593          ></wui-wallet-image>
594        </wui-flex>
595        <wui-flex
596          flexDirection="column"
597          alignItems="center"
598          gap="xs"
599          .padding=${["0","s","0","s"]}
600        >
601          <wui-text variant="paragraph-500" color="fg-100">
602            Select Chain for ${this.activeConnector?.name}
603          </wui-text>
604          <wui-text align="center" variant="small-500" color="fg-200"
605            >Select which chain to connect to your multi chain wallet</wui-text
606          >
607        </wui-flex>
608        <wui-flex
609          flexGrow="1"
610          flexDirection="column"
611          alignItems="center"
612          gap="xs"
613          .padding=${["xs","0","xs","0"]}
614        >
615          ${this.networksTemplate()}
616        </wui-flex>
617      </wui-flex>
618    `}networksTemplate(){return this.activeConnector?.providers?.map(e=>O.html`
619        <wui-list-wallet
620          imageSrc=${E.AssetUtil.getChainImage(e.chain)??O.nothing}
621          name=${e.name}
622          @click=${()=>this.onConnector(e)}
623        ></wui-list-wallet>
624      `)}onConnector(e){m.ChainController.setActiveChain(e.chain);let t=this.activeConnector?.providers?.find(t=>t.chain===e.chain);t?"WALLET_CONNECT"===t.type?p.CoreHelperUtil.isMobile()?b.RouterController.push("AllWallets"):b.RouterController.push("ConnectingWalletConnect"):b.RouterController.push("ConnectingExternal",{connector:t}):v.SnackController.showError("Failed to find connector")}};eF.styles=eK,eV([(0,$.state)()],eF.prototype,"activeConnector",void 0),eF=eV([(0,P.customElement)("w3m-connecting-multi-chain-view")],eF);var eG=R,eY=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let eJ=class extends eG.LitElement{constructor(){super(),this.interval=void 0,this.lastRetry=Date.now(),this.wallet=b.RouterController.state.data?.wallet,this.platform=void 0,this.platforms=[],this.determinePlatforms(),this.initializeConnection(),this.interval=setInterval(this.initializeConnection.bind(this),eh.ConstantsUtil.TEN_SEC_MS)}disconnectedCallback(){clearTimeout(this.interval)}render(){return this.wallet?O.html`
625      ${this.headerTemplate()}
626      <div>${this.platformTemplate()}</div>
627    `:O.html`<w3m-connecting-wc-qrcode></w3m-connecting-wc-qrcode>`}async initializeConnection(t=!1){try{if("browser"===this.platform)return;let{wcPairingExpiry:r}=h.ConnectionController.state;if(t||p.CoreHelperUtil.isPairingExpired(r))if(await h.ConnectionController.connectWalletConnect(),this.finalizeConnection(),"AUTH"===ec.StorageUtil.getConnectedConnector()&&x.OptionsController.state.hasMultipleAddresses)b.RouterController.push("SelectAddresses");else if(x.OptionsController.state.isSiweEnabled){let{SIWEController:t}=await e.A(430361);"success"===t.state.status?g.ModalController.close():b.RouterController.push("ConnectingSiwe")}else g.ModalController.close()}catch(e){f.EventsController.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:e?.message??"Unknown"}}),h.ConnectionController.setWcError(!0),p.CoreHelperUtil.isAllowedRetry(this.lastRetry)&&(v.SnackController.showError("Declined"),this.lastRetry=Date.now(),this.initializeConnection(!0))}}finalizeConnection(){let{wcLinking:e,recentWallet:t}=h.ConnectionController.state;e&&ec.StorageUtil.setWalletConnectDeepLink(e),t&&ec.StorageUtil.setWeb3ModalRecent(t),f.EventsController.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:this.wallet?.name||"Unknown"}})}determinePlatforms(){if(!this.wallet){this.platforms.push("qrcode"),this.platform="qrcode";return}if(this.platform)return;let{mobile_link:e,desktop_link:t,webapp_link:r,injected:i,rdns:n,name:s}=this.wallet,o=i?.map(({injected_id:e})=>
627e).filter(Boolean),a=[...n?[n]:o??[],s],l=!x.OptionsController.state.isUniversalProvider&&a.length,c=h.ConnectionController.checkInstalled(a),u=l&&c,d=t&&!p.CoreHelperUtil.isMobile();u&&this.platforms.push("browser"),e&&this.platforms.push(p.CoreHelperUtil.isMobile()?"mobile":"qrcode"),r&&this.platforms.push("web"),d&&this.platforms.push("desktop"),!u&&l&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return O.html`<w3m-connecting-wc-browser></w3m-connecting-wc-browser>`;case"desktop":return O.html`
628          <w3m-connecting-wc-desktop .onRetry=${()=>this.initializeConnection(!0)}>
629          </w3m-connecting-wc-desktop>
630        `;case"web":return O.html`
631          <w3m-connecting-wc-web .onRetry=${()=>this.initializeConnection(!0)}>
632          </w3m-connecting-wc-web>
633        `;case"mobile":return O.html`
634          <w3m-connecting-wc-mobile isMobile .onRetry=${()=>this.initializeConnection(!0)}>
635          </w3m-connecting-wc-mobile>
636        `;case"qrcode":return O.html`<w3m-connecting-wc-qrcode></w3m-connecting-wc-qrcode>`;default:return O.html`<w3m-connecting-wc-unsupported></w3m-connecting-wc-unsupported>`}}headerTemplate(){return this.platforms.length>1?O.html`
637      <w3m-connecting-header
638        .platforms=${this.platforms}
639        .onSelectPlatfrom=${this.onSelectPlatform.bind(this)}
640      >
641      </w3m-connecting-header>
642    `:null}async onSelectPlatform(e){let t=this.shadowRoot?.querySelector("div");t&&(await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.platform=e,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}};eY([(0,$.state)()],eJ.prototype,"platform",void 0),eY([(0,$.state)()],eJ.prototype,"platforms",void 0),eJ=eY([(0,P.customElement)("w3m-connecting-wc-view")],eJ);var eZ=R;let eQ=U.css`
643  .continue-button-container {
644    width: 100%;
645  }
646`,eX="https://walletconnect.com/faq";var e0=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let e1=class extends eZ.LitElement{constructor(){super(...arguments),this.loading=!1}render(){return O.html`
647      <wui-flex
648        flexDirection="column"
649        alignItems="center"
650        gap="xxl"
651        .padding=${["0","0","l","0"]}
652      >
653        ${this.onboardingTemplate()} ${this.buttonsTemplate()}
654        <wui-link
655          @click=${()=>{p.CoreHelperUtil.openHref(eX,"_blank")}}
656        >
657          Learn more about names
658          <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
659        </wui-link>
660      </wui-flex>
661    `}onboardingTemplate(){return O.html` <wui-flex
662      flexDirection="column"
663      gap="xxl"
664      alignItems="center"
665      .padding=${["0","xxl","0","xxl"]}
666    >
667      <wui-flex gap="s" alignItems="center" justifyContent="center">
668        <wui-icon-box
669          icon="id"
670          size="xl"
671          iconSize="xxl"
672          iconColor="fg-200"
673          backgroundColor="fg-200"
674        ></wui-icon-box>
675      </wui-flex>
676      <wui-flex flexDirection="column" alignItems="center" gap="s">
677        <wui-text align="center" variant="medium-600" color="fg-100">
678          Choose your account name
679        </wui-text>
680        <wui-text align="center" variant="paragraph-400" color="fg-100">
681          Finally say goodbye to 0x addresses, name your account to make it easier to exchange
682          assets
683        </wui-text>
684      </wui-flex>
685    </wui-flex>`}buttonsTemplate(){return O.html`<wui-flex
686      .padding=${["0","2l","0","2l"]}
687      gap="s"
688      class="continue-button-container"
689    >
690      <wui-button
691        fullWidth
692        .loading=${this.loading}
693        size="lg"
694        borderRadius="xs"
695        @click=${this.handleContinue.bind(this)}
696        >Choose name
697      </wui-button>
698    </wui-flex>`}handleContinue(){b.RouterController.push("RegisterAccountName"),f.EventsController.sendEvent({type:"track",event:"OPEN_ENS_FLOW",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.A
698CCOUNT_TYPES.SMART_ACCOUNT}})}};e1.styles=eQ,e0([(0,$.state)()],e1.prototype,"loading",void 0),e1=e0([(0,P.customElement)("w3m-choose-account-name-view")],e1);var e3=R;let e2=class extends e3.LitElement{constructor(){super(...arguments),this.wallet=b.RouterController.state.data?.wallet}render(){if(!this.wallet)throw Error("w3m-downloads-view");return O.html`
699      <wui-flex gap="xs" flexDirection="column" .padding=${["s","s","l","s"]}>
700        ${this.chromeTemplate()} ${this.iosTemplate()} ${this.androidTemplate()}
701        ${this.homepageTemplate()}
702      </wui-flex>
703    `}chromeTemplate(){return this.wallet?.chrome_store?O.html`<wui-list-item
704      variant="icon"
705      icon="chromeStore"
706      iconVariant="square"
707      @click=${this.onChromeStore.bind(this)}
708      chevron
709    >
710      <wui-text variant="paragraph-500" color="fg-100">Chrome Extension</wui-text>
711    </wui-list-item>`:null}iosTemplate(){return this.wallet?.app_store?O.html`<wui-list-item
712      variant="icon"
713      icon="appStore"
714      iconVariant="square"
715      @click=${this.onAppStore.bind(this)}
716      chevron
717    >
718      <wui-text variant="paragraph-500" color="fg-100">iOS App</wui-text>
719    </wui-list-item>`:null}androidTemplate(){return this.wallet?.play_store?O.html`<wui-list-item
720      variant="icon"
721      icon="playStore"
722      iconVariant="square"
723      @click=${this.onPlayStore.bind(this)}
724      chevron
725    >
726      <wui-text variant="paragraph-500" color="fg-100">Android App</wui-text>
727    </wui-list-item>`:null}homepageTemplate(){return this.wallet?.homepage?O.html`
728      <wui-list-item
729        variant="icon"
730        icon="browser"
731        iconVariant="square-blue"
732        @click=${this.onHomePage.bind(this)}
733        chevron
734      >
735        <wui-text variant="paragraph-500" color="fg-100">Website</wui-text>
736      </wui-list-item>
737    `:null}onChromeStore(){this.wallet?.chrome_store&&p.CoreHelperUtil.openHref(this.wallet.chrome_store,"_blank")}onAppStore(){this.wallet?.app_store&&p.CoreHelperUtil.openHref(this.wallet.app_store,"_blank")}onPlayStore(){this.wallet?.play_store&&p.CoreHelperUtil.openHref(this.wallet.play_store,"_blank")}onHomePage(){this.wallet?.homepage&&p.CoreHelperUtil.openHref(this.wallet.homepage,"_blank")}};e2=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-downloads-view")],e2);var e5=e.i(58826),e4=R;let e6=class extends e4.LitElement{render(){return O.html`
738      <wui-flex flexDirection="column" .padding=${["0","s","s","s"]} gap="xs">
739        ${this.recommendedWalletsTemplate()}
740        <wui-list-wallet
741          name="Explore all"
742          showAllWallets
743          walletIcon="allWallets"
744          icon="externalLink"
745          @click=${()=>{p.CoreHelperUtil.openHref("https://walletconnect.com/explorer?type=wallet","_blank")}}
746        ></wui-list-wallet>
747      </wui-flex>
748    `}recommendedWalletsTemplate(){let{recommended:e,featured:t}=e5.ApiController.state,{customWallets:r}=x.OptionsController.state;return[...t,...r??[],...e].slice(0,4).map(e=>O.html`
749        <wui-list-wallet
750          name=${e.name??"Unknown"}
751          tagVariant="main"
752          imageSrc=${E.AssetUtil.getWalletImage(e)??O.nothing}
753          @click=${()=>{p.CoreHelperUtil.openHref(e.homepage??"https://walletconnect.com/explorer","_blank")}}
754        ></wui-list-wallet>
755      `)}};e6=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-get-wallet-view")],e6);var e8=R;let e9=U.css`
756  wui-flex {
757    width: 100%;
758  }
759
760  .suggestion {
761    background: var(--wui-color-gray-glass-002);
762    border-radius: var(--wui-border-radius-xs);
763  }
764
765  .suggestion:hover {
766    background-color: var(--wui-color-gray-glass-005);
767    cursor: pointer;
768  }
769
770  .suggested-name {
771    max-width: 75%;
772    overflow: hidden;
773    text-overflow: ellipsis;
774    white-space: nowrap;
775  }
776
777  form {
778    width: 100%;
779  }
780
781  wui-icon-link {
782    position: absolute;
783    right: 20px;
784    transform: translateY(11px);
785  }
786`,{I:e7}=O._$LH;class te{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}let tt=(e,t)=>{let r=e._$AN;if(void 0===r)return!1;for(let e of r)e._$AO?.(t,!1),tt(e,t);return!0},tr=e=>{let t,r;do{if(void 0===(t=e._$AM))break;(r=t._$AN).delete(e),e=t}while(0===r?.size)},ti=e=>{for(let t;t=e._$AM;e=t){let r=t._$AN;if(void 0===r)t._$AN=r=new Set;else if(r.has(e))break;r.add(e),to(t)}};function tn(e){void 0!==this._$AN?(tr(this),this._$AM=e,ti(this)):this._$AM=e}function ts(e,t=!1,r=0){let i=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(t)if(Array.isArray(i))for(let e=r;e<i.length;e++)tt(i[e],!1),tr(i[e]);else null!=i&&(tt(i,!1),tr(i));else tt(this,e)}let to=e=>{2==e.type&&(e._$AP??=ts,e._$AQ??=tn)};class ta extends te{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),ti(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(tt(this,e),tr(this))}setValue(e){if(void 0===this._$Ct.strings)this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}let tl=()=>new tc;class tc{}let tu=new WeakMap,th=(r=class extends ta{render(e){return O.nothing}update(e,[t]){let r=t!==this.G;return r&&this.rt(void 0),(r||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),O.nothing}rt(e){if(void 0!==this.G)if(this.isConnected||(e=void 0),"function"==typeof this.G){let t=this.ht??globalThis,r=tu.get(t);
786void 0===r&&(r=new WeakMap,tu.set(t,r)),void 0!==r.get(this.G)&&this.G.call(this.ht,void 0),r.set(this.G,e),void 0!==e&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return"function"==typeof this.G?tu.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}},(...e)=>({_$litDirective$:r,values:e}));var td=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tp=class extends e8.LitElement{constructor(){super(),this.formRef=tl(),this.usubscribe=[],this.name="",this.error="",this.loading=C.EnsController.state.loading,this.suggestions=C.EnsController.state.suggestions,this.registered=!1,this.profileName=c.AccountController.state.profileName,this.onDebouncedNameInputChange=p.CoreHelperUtil.debounce(e=>{C.EnsController.validateName(e)?(this.error="",this.name=e,C.EnsController.getSuggestions(e),C.EnsController.isNameRegistered(e).then(e=>{this.registered=e})):e.length<4?this.error="Name must be at least 4 characters long":this.error="Can only contain letters, numbers and - characters"}),this.usubscribe.push(C.EnsController.subscribe(e=>{this.suggestions=e.suggestions,this.loading=e.loading}),c.AccountController.subscribeKey("profileName",e=>{this.profileName=e,e&&(this.error="You already own a name")}))}firstUpdated(){this.formRef.value?.addEventListener("keydown",this.onEnterKey.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.usubscribe.forEach(e=>e()),this.formRef.value?.removeEventListener("keydown",this.onEnterKey.bind(this))}render(){return O.html`
787      <wui-flex
788        flexDirection="column"
789        alignItems="center"
790        gap="m"
791        .padding=${["0","s","m","s"]}
792      >
793        <form ${th(this.formRef)} @submit=${this.onSubmitName.bind(this)}>
794          <wui-ens-input
795            @inputChange=${this.onNameInputChange.bind(this)}
796            .errorMessage=${this.error}
797            .value=${this.name}
798          >
799          </wui-ens-input>
800          ${this.submitButtonTemplate()}
801          <input type="submit" hidden />
802        </form>
803        ${this.templateSuggestions()}
804      </wui-flex>
805    `}submitButtonTemplate(){return this.isAllowedToSubmit()?O.html`
806          <wui-icon-link
807            size="sm"
808            icon="chevronRight"
809            iconcolor="accent-100"
810            @click=${this.onSubmitName.bind(this)}
811          >
812          </wui-icon-link>
813        `:null}onSelectSuggestion(e){return()=>{this.name=e,this.registered=!1,this.requestUpdate()}}onNameInputChange(e){this.onDebouncedNameInputChange(e.detail)}nameSuggestionTagTemplate(){return this.loading?O.html`<wui-loading-spinner size="lg" color="fg-100"></wui-loading-spinner>`:this.registered?O.html`<wui-tag variant="shade" size="lg">Registered</wui-tag>`:O.html`<wui-tag variant="success" size="lg">Available</wui-tag>`}templateSuggestions(){if(!this.name||this.name.length<4||this.error)return null;let e=this.registered?this.suggestions.filter(e=>e.name!==this.name):[];return O.html`<wui-flex flexDirection="column" gap="xxs" alignItems="center">
814      <wui-flex
815        data-testid="account-name-suggestion"
816        .padding=${["m","m","m","m"]}
817        justifyContent="space-between"
818        class="suggestion"
819      >
820        <wui-text color="fg-100" variant="paragraph-400" class="suggested-name">
821          ${this.name}</wui-text
822        >${this.nameSuggestionTagTemplate()}
823      </wui-flex>
824      ${e.map(e=>this.availableNameTemplate(e.name))}
825    </wui-flex>`}availableNameTemplate(e){return O.html` <wui-flex
826      data-testid="account-name-suggestion"
827      .padding=${["m","m","m","m"]}
828      justifyContent="space-between"
829      class="suggestion"
830      @click=${this.onSelectSuggestion(e)}
831    >
832      <wui-text color="fg-100" variant="paragraph-400" class="suggested-name">
833        ${e}
834      </wui-text>
835      <wui-tag variant="success" size="lg">Available</wui-tag>
836    </wui-flex>`}isAllowedToSubmit(){return!this.loading&&!this.registered&&!this.error&&!this.profileName&&C.EnsController.validateName(this.name)}async onSubmitName(){try{if(!this.isAllowedToSubmit())return;f.EventsController.sendEvent({type:"track",event:"REGISTER_NAME_INITIATED",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.A
836CCOUNT_TYPES.SMART_ACCOUNT,ensName:this.name}}),await C.EnsController.registerName(this.name),f.EventsController.sendEvent({type:"track",event:"REGISTER_NAME_SUCCESS",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:this.name}})}catch(e){v.SnackController.showError(e.message),f.EventsController.sendEvent({type:"track",event:"REGISTER_NAME_ERROR",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,ensName:this.name,error:e?.message||"Unknown error"}})}}onEnterKey(e){"Enter"===e.key&&this.isAllowedToSubmit()&&this.onSubmitName()}};tp.styles=e9,td([(0,N.property)()],tp.prototype,"errorMessage",void 0),td([(0,$.state)()],tp.prototype,"name",void 0),td([(0,$.state)()],tp.prototype,"error",void 0),td([(0,$.state)()],tp.prototype,"loading",void 0),td([(0,$.state)()],tp.prototype,"suggestions",void 0),td([(0,$.state)()],tp.prototype,"registered",void 0),td([(0,$.state)()],tp.prototype,"profileName",void 0),tp=td([(0,P.customElement)("w3m-register-account-name-view")],tp);var tf=R;let tg=U.css`
837  .continue-button-container {
838    width: 100%;
839  }
840`,tm=class extends tf.LitElement{render(){return O.html`
841      <wui-flex
842        flexDirection="column"
843        alignItems="center"
844        gap="xxl"
845        .padding=${["0","0","l","0"]}
846      >
847        ${this.onboardingTemplate()} ${this.buttonsTemplate()}
848        <wui-link
849          @click=${()=>{p.CoreHelperUtil.openHref(eX,"_blank")}}
850        >
851          Learn more
852          <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
853        </wui-link>
854      </wui-flex>
855    `}onboardingTemplate(){return O.html` <wui-flex
856      flexDirection="column"
857      gap="xxl"
858      alignItems="center"
859      .padding=${["0","xxl","0","xxl"]}
860    >
861      <wui-flex gap="s" alignItems="center" justifyContent="center">
862        <wui-icon-box
863          size="xl"
864          iconcolor="success-100"
865          backgroundcolor="success-100"
866          icon="checkmark"
867          background="opaque"
868        ></wui-icon-box>
869      </wui-flex>
870      <wui-flex flexDirection="column" alignItems="center" gap="s">
871        <wui-text align="center" variant="medium-600" color="fg-100">
872          Account name chosen successfully
873        </wui-text>
874        <wui-text align="center" variant="paragraph-400" color="fg-100">
875          You can now fund your account and trade crypto
876        </wui-text>
877      </wui-flex>
878    </wui-flex>`}buttonsTemplate(){return O.html`<wui-flex
879      .padding=${["0","2l","0","2l"]}
880      gap="s"
881      class="continue-button-container"
882    >
883      <wui-button fullWidth size="lg" borderRadius="xs" @click=${this.redirectToAccount.bind(this)}
884        >Let's Go!
885      </wui-button>
886    </wui-flex>`}redirectToAccount(){b.RouterController.replace("Account")}};tm.styles=tg,tm=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-register-account-name-success-view")],tm);var tw=R;let ty=U.css`
887  @keyframes shake {
888    0% {
889      transform: translateX(0);
890    }
891    25% {
892      transform: translateX(3px);
893    }
894    50% {
895      transform: translateX(-3px);
896    }
897    75% {
898      transform: translateX(3px);
899    }
900    100% {
901      transform: translateX(0);
902    }
903  }
904
905  wui-flex:first-child:not(:only-child) {
906    position: relative;
907  }
908
909  wui-loading-hexagon {
910    position: absolute;
911  }
912
913  wui-icon-box {
914    position: absolute;
915    right: 4px;
916    bottom: 0;
917    opacity: 0;
918    transform: scale(0.5);
919    z-index: 1;
920  }
921
922  wui-button {
923    display: none;
924  }
925
926  [data-error='true'] wui-icon-box {
927    opacity: 1;
928    transform: scale(1);
929  }
930
931  [data-error='true'] > wui-flex:first-child {
932    animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
933  }
934
935  wui-button[data-retry='true'] {
936    display: block;
937    opacity: 1;
938  }
939`;var tv=e.i(597670);let tb=async()=>
939{if(x.OptionsController.state.isSiweEnabled){let{SIWEController:t}=await e.A(430361);t.state._client?.options?.signOutOnNetworkChange?await t.signOut():tv.RouterUtil.navigateAfterNetworkSwitch()}else tv.RouterUtil.navigateAfterNetworkSwitch()};var tC=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tx=class extends tw.LitElement{constructor(){super(),this.network=b.RouterController.state.data?.network,this.unsubscribe=[],this.showRetry=!1,this.error=!1}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){this.onSwitchNetwork()}render(){if(!this.network)throw Error("w3m-network-switch-view: No network provided");this.onShowRetry();let e=this.getLabel(),t=this.getSubLabel();return O.html`
940      <wui-flex
941        data-error=${this.error}
942        flexDirection="column"
943        alignItems="center"
944        .padding=${["3xl","xl","3xl","xl"]}
945        gap="xl"
946      >
947        <wui-flex justifyContent="center" alignItems="center">
948          <wui-network-image
949            size="lg"
950            imageSrc=${E.AssetUtil.getNetworkImage(this.network)??O.nothing}
951          ></wui-network-image>
952
953          ${this.error?null:O.html`<wui-loading-hexagon></wui-loading-hexagon>`}
954
955          <wui-icon-box
956            backgroundColor="error-100"
957            background="opaque"
958            iconColor="error-100"
959            icon="close"
960            size="sm"
961            ?border=${!0}
962            borderColor="wui-color-bg-125"
963          ></wui-icon-box>
964        </wui-flex>
965
966        <wui-flex flexDirection="column" alignItems="center" gap="xs">
967          <wui-text align="center" variant="paragraph-500" color="fg-100">${e}</wui-text>
968          <wui-text align="center" variant="small-500" color="fg-200">${t}</wui-text>
969        </wui-flex>
970
971        <wui-button
972          data-retry=${this.showRetry}
973          variant="accent"
974          size="md"
975          .disabled=${!this.error}
976          @click=${this.onSwitchNetwork.bind(this)}
977        >
978          <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon>
979          Try again
980        </wui-button>
981      </wui-flex>
982    `}getSubLabel(){let e=ec.StorageUtil.getConnectedConnector();return d.ConnectorController.getAuthConnector()&&"AUTH"===e?"":this.error?"Switch can be declined if chain is not supported by a wallet or previous request is still active":"Accept connection request in your wallet"}getLabel(){let e=ec.StorageUtil.getConnectedConnector();return d.ConnectorController.getAuthConnector()&&"AUTH"===e?`Switching to ${this.network?.name??"Unknown"} network...`:this.error?"Switch declined":"Approve in wallet"}onShowRetry(){if(this.error&&!this.showRetry){this.showRetry=!0;let e=this.shadowRoot?.querySelector("wui-button");e?.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}async onSwitchNetwork(){try{this.error=!1,this.network&&(await _.NetworkController.switchActiveNetwork(this.network),await tb())}catch{this.error=!0}}};tx.styles=ty,tC([(0,$.state)()],tx.prototype,"showRetry",void 0),tC([(0,$.state)()],tx.prototype,"error",void 0),tx=tC([(0,P.customElement)("w3m-network-switch-view")],tx);var t_=R;let tE=U.css`
983  .container {
984    max-height: 360px;
985    overflow: auto;
986  }
987
988  .container::-webkit-scrollbar {
989    display: none;
990  }
991`;var tk=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tS=class extends t_.LitElement{constructor(){super(),this.unsubscribe=[],this.network=_.NetworkController.state.caipNetwork,this.requestedCaipNetworks=_.NetworkController.getRequestedCaipNetworks(),this.search="",this.onDebouncedSearch=p.CoreHelperUtil.debounce(e=>{this.search=e},100),this.unsubscribe.push(_.NetworkController.subscribeKey("caipNetwork",e=>this.network=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
992      ${this.templateSearchInput()}
993      <wui-flex
994        class="container"
995        .padding=${["0","s","s","s"]}
996        flexDirection="column"
997        gap="xs"
998      >
999        ${this.networksTemplate()}
1000      </wui-flex>
1001
1002      <wui-separator></wui-separator>
1003
1004      <wui-flex padding="s" flexDirection="column" gap="m" alignItems="center">
1005        <wui-text variant="small-400" color="fg-300" align="center">
1006          Your connected wallet may not support some of the networks available for this dApp
1007        </wui-text>
1008        <wui-link @click=${this.onNetworkHelp.bind(this)}>
1009          <wui-icon size="xs" color="accent-100" slot="iconLeft" name="helpCircle"></wui-icon>
1010          What is a network
1011        </wui-link>
1012      </wui-flex>
1013    `}templateSearchInput(){return O.html`
1014      <wui-flex gap="xs" .padding=${["0","s","s","s"]}>
1015        <wui-input-text
1016          @inputChange=${this.onInputChange.bind(this)}
1017          class="network-search-input"
1018          size="md"
1019          placeholder="Search network"
1020          icon="search"
1021        ></wui-input-text>
1022      </wui-flex>
1023    `}onInputChange(e){this.onDebouncedSearch(e.detail)}onNetworkHelp(){f.EventsController.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),b.RouterController.push("WhatIsANetwork")}networksTemplate(){let e=_.NetworkController.getRequestedCaipNetworks(),t=_.NetworkController.state.approvedCaipNetworkIds,r=_.NetworkController.state.supportsAllNetworks,i=p.CoreHelperUtil.sortRequestedNetworks(t,e);return this.search?this.filteredNetworks=i?.filter(e=>e?.name?.toLowerCase().includes(this.search.toLowerCase())):this.filteredNetworks=i,this.filteredNetworks?.map(e=>O.html`
1024        <wui-list-network
1025          .selected=${this.network?.id===e.id}
1026          imageSrc=${E.AssetUtil.getNetworkImage(e)??O.nothing}
1027          type="network"
1028          name=${e.name??e.id}
1029          @click=${()=>this.onSwitchNetwork(e)}
1030          .disabled=${!r&&!t?.includes(e.id)&&e.chain===m.ChainController.state.activeChain}
1031          data-testid=${`w3m-network-switch-${e.name??e.id}`}
1032        ></wui-list-network>
1033      `)}async onSwitchNetwork(e){let t=c.AccountController.state.isConnected,r=c.AccountController.getChainIsConnected(e.chain),i=_.NetworkController.state.approvedCaipNetworkIds,n=_.NetworkController.state.supportsAllNetworks,s=_.NetworkController.state.caipNetwork,o=b.RouterController.state.data;if(t&&s?.id!==e.id){if(!r)return void b.RouterController.push("SwitchActiveChain",{switchToChain:e.chain,navigateTo:"Connect",navigateWithReplace:!0});i?.includes(e.id)?(await _.NetworkController.switchActiveNetwork(e),await tb()):n&&b.RouterController.push("SwitchNetwork",{...o,network:e})}else!t&&(_.NetworkController.setActiveCaipNetwork(e),r||b.RouterController.push("Connect"))}};tS.styles=tE,tk([(0,$.state)()],tS.prototype,"network",void 0),tk([(0,$.state)()],tS.prototype,"requestedCaipNetworks",void 0),tk([(0,$.state)()],tS.prototype,"filteredNetworks",void 0),tk([(0,$.state)()],tS.prototype,"search",void 0),tS=tk([(0,P.customElement)("w3m-networks-view")],tS);var tI=e.i(398996),tA=e.i(458006),tT=e.i(671336),tP=R;let tR=U.css`
1034  :host > wui-flex {
1035    height: 500px;
1036    overflow-y: auto;
1037    overflow-x: hidden;
1038    scrollbar-width: none;
1039    padding: var(--wui-spacing-m);
1040    box-sizing: border-box;
1041    display: flex;
1042    align-items: center;
1043    justify-content: flex-start;
1044  }
1045
1046  :host > wui-flex::-webkit-scrollbar {
1047    display: none;
1048  }
1049
1050  :host > wui-flex > wui-flex {
1051    width: 100%;
1052  }
1053
1054  wui-transaction-list-item-loader {
1055    width: 100%;
1056  }
1057`;var tO=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tN=class extends tP.LitElement{constructor(){super(),this.unsubscribe=[],this.selectedOnRampProvider=er.OnRampController.state.selectedProvider,this.loading=!1,this.coinbaseTransactions=tA.TransactionsController.state.coinbaseTransactions,this.tokenImages=T.AssetController.state.tokenImages,this.unsubscribe.push(er.OnRampController.subscribeKey("selectedProvider",e=>{this.selectedOnRampProvider=e}),T.AssetController.subscribeKey("tokenImages",e=>this.tokenImages=e),()=>{clearTimeout(this.refetchTimeout)},tA.TransactionsController.subscribe(e=>{this.coinbaseTransactions={...e.coinbaseTransactions}})),tA.TransactionsController.clearCursor(),this.fetchTransactions()}render(){return O.html`
1058      <wui-flex flexDirection="column" .padding=${["0","s","s","s"]} gap="xs">
1059        ${this.loading?this.templateLoading():this.templateTransactionsByYear()}
1060      </wui-flex>
1061    `}templateTransactions(e){return e?.map(e=>{let t=tI.DateUtil.formatDate(e?.metadata?.minedAt),r=e.transfers[0],i=r?.fungible_info;if(!i)return null;let n=i?.icon?.url||this.tokenImages?.[i.symbol||""];return O.html`
1062        <w3m-onramp-activity-item
1063          label="Bought"
1064          .completed=${"ONRAMP_TRANSACTION_STATUS_SUCCESS"===e.metadata.status}
1065          .inProgress=${"ONRAMP_TRANSACTION_STATUS_IN_PROGRESS"===e.metadata.status}
1066          .failed=${"ONRAMP_TRANSACTION_STATUS_FAILED"===e.metadata.status}
1067          purchaseCurrency=${i.symbol??O.nothing}
1068          purchaseValue=${r.quantity.numeric}
1069          date=${t}
1070          icon=${n??O.nothing}
1071          symbol=${i.symbol??O.nothing}
1072        ></w3m-onramp-activity-item>
1073      `})}templateTransactionsByYear(){return Object.keys(this.coinbaseTransactions).sort().reverse().map(e=>{let t=parseInt(e,10);return Array(12).fill(null).map((e,t)=>t).reverse().map(e=>{let r=tT.TransactionUtil.getTransactionGroupTitle(t,e),i=this.coinbaseTransactions[t]?.[e];return i?O.html`
1074          <wui-flex flexDirection="column">
1075            <wui-flex
1076              alignItems="center"
1077              flexDirection="row"
1078              .padding=${["xs","s","s","s"]}
1079            >
1080              <wui-text variant="paragraph-500" color="fg-200">${r}</wui-text>
1081            </wui-flex>
1082            <wui-flex flexDirection="column" gap="xs">
1083              ${this.templateTransactions(i)}
1084            </wui-flex>
1085          </wui-flex>
1086        `:null})})}async fetchTransactions(){await this.fetchCoinbaseTransactions()}async fetchCoinbaseTransactions(){let e=c.AccountController.state.address,t=x.OptionsController.state.projectId;if(!e)throw Error("No address found");if(!t)throw Error("No projectId found");this.loading=!0,await tA.TransactionsController.fetchTransactions(e,"coinbase"),this.loading=!1,this.refetchLoadingTransactions()}refetchLoadingTransactions(){let e=new Date;0===(this.coinbaseTransactions[e.getFullYear()]?.[e.getMonth()]||[]).filter(e=>"ONRAMP_TRANSACTION_STATUS_IN_PROGRESS"===e.metadata.status).length?clearTimeout(this.refetchTimeout):this.refetchTimeout=setTimeout(async()=>{let e=c.AccountController.state.address;await tA.TransactionsController.fetchTransactions(e,"coinbase"),this.refetchLoadingTransactions()},3e3)}templateLoading(){return Array(7).fill(O.html` <wui-transaction-list-item-loader></wui-transaction-list-item-loader> `).map(e=>e)}};tN.styles=tR,tO([(0,$.state)()],tN.prototype,"selectedOnRampProvider",void 0),tO([(0,$.state)()],tN.prototype,"loading",void 0),tO([(0,$.state)()],tN.prototype,"coinbaseTransactions",void 0),tO([(0,$.state)()],tN.prototype,"tokenImages",void 0),tN=tO([(0,P.customElement)("w3m-onramp-activity-view")],tN);var t$=R;let tD=U.css`
1087  :host > wui-grid {
1088    max-height: 360px;
1089    overflow: auto;
1090  }
1091
1092  wui-grid::-webkit-scrollbar {
1093    display: none;
1094  }
1095`;var tL=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tj=class extends t$.LitElement{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=er.OnRampController.state.paymentCurrency,this.currencies=er.OnRampController.state.paymentCurrencies,this.currencyImages=T.AssetController.state.currencyImages,this.unsubscribe.push(er.OnRampController.subscribe(e=>{this.selectedCurrency=e.paymentCurrency,this.currencies=e.paymentCurrencies}),T.AssetController.subscribeKey("currencyImages",e=>this.currencyImages=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
1096      <wui-flex flexDirection="column" .padding=${["0","s","s","s"]} gap="xs">
1097        ${this.currenciesTemplate()}
1098      </wui-flex>
1099      <w3m-legal-footer></w3m-legal-footer>
1100    `}currenciesTemplate(){return this.currencies.map(e=>O.html`
1101        <wui-list-item
1102          imageSrc=${this.currencyImages?.[e.id]??O.nothing}
1103          @click=${()=>this.selectCurrency(e)}
1104          variant="image"
1105        >
1106          <wui-text variant="paragraph-500" color="fg-100">${e.id}</wui-text>
1107        </wui-list-item>
1108      `)}selectCurrency(e){e&&(er.OnRampController.setPaymentCurrency(e),g.ModalController.close())}};tj.styles=tD,tL([(0,$.state)()],tj.prototype,"selectedCurrency",void 0),tL([(0,$.state)()],tj.prototype,"currencies",void 0),tL([(0,$.state)()],tj.prototype,"currencyImages",void 0),tj=tL([(0,P.customElement)("w3m-onramp-fiat-select-view")],tj
1108);var tU=R,tM=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tq=class extends tU.LitElement{constructor(){super(),this.unsubscribe=[],this.providers=er.OnRampController.state.providers,this.unsubscribe.push(er.OnRampController.subscribeKey("providers",e=>{this.providers=e}))}firstUpdated(){Promise.all(this.providers.map(async e=>"coinbase"===e.name?await this.getCoinbaseOnRampURL():Promise.resolve(e?.url))).then(e=>{this.providers=this.providers.map((t,r)=>({...t,url:e[r]||""}))})}render(){return O.html`
1109      <wui-flex flexDirection="column" .padding=${["0","s","s","s"]} gap="xs">
1110        ${this.onRampProvidersTemplate()}
1111      </wui-flex>
1112      <w3m-onramp-providers-footer></w3m-onramp-providers-footer>
1113    `}onRampProvidersTemplate(){return this.providers.filter(e=>e.supportedChains.includes(m.ChainController.state.activeChain??"evm")).map(e=>O.html`
1114          <w3m-onramp-provider-item
1115            label=${e.label}
1116            name=${e.name}
1117            feeRange=${e.feeRange}
1118            @click=${()=>{this.onClickProvider(e)}}
1119            ?disabled=${!e.url}
1120          ></w3m-onramp-provider-item>
1121        `)}onClickProvider(e){er.OnRampController.setSelectedProvider(e),b.RouterController.push("BuyInProgress"),p.CoreHelperUtil.openHref(e.url,"popupWindow","width=600,height=800,scrollbars=yes"),f.EventsController.sendEvent({type:"track",event:"SELECT_BUY_PROVIDER",properties:{provider:e.name,isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}})}async getCoinbaseOnRampURL(){let e=c.AccountController.state.address,t=_.NetworkController.state.caipNetwork;if(!e)throw Error("No address found");if(!t?.name)throw Error("No network found");let r=eh.ConstantsUtil.WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP[t.name]??eh.ConstantsUtil.WC_COINBASE_PAY_SDK_FALLBACK_CHAIN,i=er.OnRampController.state.purchaseCurrency,n=i?[i.symbol]:er.OnRampController.state.purchaseCurrencies.map(e=>e.symbol);return await u.BlockchainApiController.generateOnRampURL({defaultNetwork:r,destinationWallets:[{address:e,blockchains:eh.ConstantsUtil.WC_COINBASE_PAY_SDK_CHAINS,assets:n}],partnerUserId:e,purchaseAmount:er.OnRampController.state.purchaseAmount})}};tM([(0,$.state)()],tq.prototype,"providers",void 0),tq=tM([(0,P.customElement)("w3m-onramp-providers-view")],tq);var tW=R;let tB=U.css`
1122  :host > wui-grid {
1123    max-height: 360px;
1124    overflow: auto;
1125  }
1126
1127  wui-grid::-webkit-scrollbar {
1128    display: none;
1129  }
1130`;var tz=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tH=class extends tW.LitElement{constructor(){super(),this.unsubscribe=[],this.selectedCurrency=er.OnRampController.state.purchaseCurrencies,this.tokens=er.OnRampController.state.purchaseCurrencies,this.tokenImages=T.AssetController.state.tokenImages,this.unsubscribe.push(er.OnRampController.subscribe(e=>{this.selectedCurrency=e.purchaseCurrencies,this.tokens=e.purchaseCurrencies}),T.AssetController.subscribeKey("tokenImages",e=>this.tokenImages=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
1131      <wui-flex flexDirection="column" .padding=${["0","s","s","s"]} gap="xs">
1132        ${this.currenciesTemplate()}
1133      </wui-flex>
1134      <w3m-legal-footer></w3m-legal-footer>
1135    `}currenciesTemplate(){return this.tokens.map(e=>O.html`
1136        <wui-list-item
1137          imageSrc=${this.tokenImages?.[e.symbol]??O.nothing}
1138          @click=${()=>this.selectToken(e)}
1139          variant="image"
1140        >
1141          <wui-flex gap="3xs" alignItems="center">
1142            <wui-text variant="paragraph-500" color="fg-100">${e.name}</wui-text>
1143            <wui-text variant="small-400" color="fg-200">${e.symbol}</wui-text>
1144          </wui-flex>
1145        </wui-list-item>
1146      `)}selectToken(e){e&&(er.OnRampController.setPurchaseCurrency(e),g.ModalController.close())}};tH.styles=tB,tz([(0,$.state)()],tH.prototype,"selectedCurrency",void 0),tz([(0,$.state)()],tH.prototype,"tokens",void 0),tz([(0,$.state)()],tH.prototype,"tokenImages",void 0),tH=tz([(0,P.customElement)("w3m-onramp-token-select-view")],tH);var tK=R;let tV=U.css`
1147  :host > wui-flex:first-child {
1148    overflow-y: auto;
1149    overflow-x: hidden;
1150    scrollbar-width: none;
1151  }
1152
1153  :host > wui-flex:first-child::-webkit-scrollbar {
1154    display: none;
1155  }
1156
1157  wui-loading-hexagon {
1158    position: absolute;
1159  }
1160
1161  .action-button {
1162    width: 100%;
1163    border-radius: var(--wui-border-radius-xs);
1164  }
1165
1166  .action-button:disabled {
1167    border-color: 1px solid var(--wui-color-gray-glass-005);
1168  }
1169
1170  .swap-inputs-container {
1171    position: relative;
1172  }
1173
1174  .replace-tokens-button-container {
1175    display: flex;
1176    justify-content: center;
1177    align-items: center;
1178    position: absolute;
1179    top: 50%;
1180    left: 50%;
1181    transform: translate(-50%, -50%);
1182    gap: var(--wui-spacing-1xs);
1183    border-radius: var(--wui-border-radius-xs);
1184    background-color: var(--wui-color-modal-bg-base);
1185    padding: var(--wui-spacing-xxs);
1186  }
1187
1188  .replace-tokens-button-container > button {
1189    display: flex;
1190    justify-content: center;
1191    align-items: center;
1192    height: 40px;
1193    width: 40px;
1194    padding: var(--wui-spacing-xs);
1195    border: none;
1196    border-radius: var(--wui-border-radius-xxs);
1197    background: var(--wui-color-gray-glass-002);
1198    transition: background-color var(--wui-duration-md) var(--wui-ease-out-power-1);
1199    will-change: background-color;
1200    z-index: 20;
1201  }
1202
1203  .replace-tokens-button-container > button:hover {
1204    background: var(--wui-color-gray-glass-005);
1205  }
1206
1207  .details-container > wui-flex {
1208    background: var(--wui-color-gray-glass-002);
1209    border-radius: var(--wui-border-radius-xxs);
1210    width: 100%;
1211  }
1212
1213  .details-container > wui-flex > button {
1214    border: none;
1215    background: none;
1216    padding: var(--wui-spacing-s);
1217    border-radius: var(--wui-border-radius-xxs);
1218    transition: background 0.2s linear;
1219  }
1220
1221  .details-container > wui-flex > button:hover {
1222    background: var(--wui-color-gray-glass-002);
1223  }
1224
1225  .details-content-container {
1226    padding: var(--wui-spacing-1xs);
1227    display: flex;
1228    align-items: center;
1229    justify-content: center;
1230  }
1231
1232  .details-content-container > wui-flex {
1233    width: 100%;
1234  }
1235
1236  .details-row {
1237    width: 100%;
1238    padding: var(--wui-spacing-s) var(--wui-spacing-xl);
1239    border-radius: var(--wui-border-radius-xxs);
1240    background: var(--wui-color-gray-glass-002);
1241  }
1242`;var tF=e.i(239841),tG=e.i(565598),tY=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let tJ=class extends tK.LitElement{constructor(){super(),this.unsubscribe=[],this.detailsOpen=!1,this.caipNetworkId=_.NetworkController.state.caipNetwork?.id,this.initialized=tF.SwapController.state.initialized,this.loadingQuote=tF.SwapController.state.loadingQuote,this.loadingPrices=tF.SwapController.state.loadingPrices,this.loadingTransaction=tF.SwapController.state.loadingTransaction,this.sourceToken=tF.SwapController.state.sourceToken,this.sourceTokenAmount=tF.SwapController.state.sourceTokenAmount,this.sourceTokenPriceInUSD=tF.SwapController.state.sourceTokenPriceInUSD,this.toToken=tF.SwapController.state.toToken,this.toTokenAmount=tF.SwapController.state.toTokenAmount,this.toTokenPriceInUSD=tF.SwapController.state.toTokenPriceInUSD,this.inputError=tF.SwapController.state.inputError,this.gasPriceInUSD=tF.SwapController.state.gasPriceInUSD,this.fetchError=tF.SwapController.state.fetchError,this.onDebouncedGetSwapCalldata=p.CoreHelperUtil.debounce(async()=>{await tF.SwapController.swapTokens()},200),_.NetworkController.subscribeKey("caipNetwork",e=>{this.caipNetworkId!==e?.id&&(this.caipNetworkId=e?.id,tF.SwapController.resetState(),tF.SwapController.initializeState())}),this.unsubscribe.push(g.ModalController.subscribeKey("open",e=>{e||tF.SwapController.resetState()}),b.RouterController.subscribeKey("view",e=>{e.includes("Swap")||tF.SwapController.resetValues()}),tF.SwapController.subscribe(e=>{this.initialized=e.initialized,this.loadingQuote=e.loadingQuote,this.loadingPrices=e.loadingPrices,this.loadingTransaction=e.loadingTransaction,this.sourceToken=e.sourceToken,this.sourceTokenAmount=e.sourceTokenAmount,this.sourceTokenPriceInUSD=e.sourceTokenPriceInUSD,this.toToken=e.toToken,this.toTokenAmount=e.toTokenAmount,this.toTokenPriceInUSD=e.toTokenPriceInUSD,this.inputError=e.inputError,this.gasPriceInUSD=e.gasPriceInUSD,this.fetchError=e.fetchError}))}firstUpdated(){tF.SwapController.initializeState(),this.watchTokensAndValues()}
1242disconnectedCallback(){this.unsubscribe.forEach(e=>e?.()),clearInterval(this.interval)}render(){return O.html`
1243      <wui-flex flexDirection="column" .padding=${["0","l","l","l"]} gap="s">
1244        ${this.initialized?this.templateSwap():this.templateLoading()}
1245      </wui-flex>
1246    `}watchTokensAndValues(){this.interval=setInterval(()=>{tF.SwapController.getNetworkTokenPrice(),tF.SwapController.getMyTokensWithBalance(),tF.SwapController.swapTokens()},1e4)}templateSwap(){return O.html`
1247      <wui-flex flexDirection="column" gap="s">
1248        <wui-flex flexDirection="column" alignItems="center" gap="xs" class="swap-inputs-container">
1249          ${this.templateTokenInput("sourceToken",this.sourceToken)}
1250          ${this.templateTokenInput("toToken",this.toToken)} ${this.templateReplaceTokensButton()}
1251        </wui-flex>
1252        ${this.templateDetails()} ${this.templateActionButton()}
1253      </wui-flex>
1254    `}actionButtonLabel(){return this.fetchError?"Swap":this.sourceToken&&this.toToken?this.sourceTokenAmount?this.inputError?this.inputError:"Review swap":"Enter amount":"Select token"}templateReplaceTokensButton(){return O.html`
1255      <wui-flex class="replace-tokens-button-container">
1256        <button @click=${this.onSwitchTokens.bind(this)}>
1257          <wui-icon name="recycleHorizontal" color="fg-250" size="lg"></wui-icon>
1258        </button>
1259      </wui-flex>
1260    `}templateLoading(){return O.html`
1261      <wui-flex flexDirection="column" gap="l">
1262        <wui-flex flexDirection="column" alignItems="center" gap="xs" class="swap-inputs-container">
1263          <w3m-swap-input-skeleton target="sourceToken"></w3m-swap-input-skeleton>
1264          <w3m-swap-input-skeleton target="toToken"></w3m-swap-input-skeleton>
1265          ${this.templateReplaceTokensButton()}
1266        </wui-flex>
1267        ${this.templateActionButton()}
1268      </wui-flex>
1269    `}templateTokenInput(e,t){let r=tF.SwapController.state.myTokensWithBalance?.find(e=>e?.address===t?.address),i="toToken"===e?this.toTokenAmount:this.sourceTokenAmount,n="toToken"===e?this.toTokenPriceInUSD:this.sourceTokenPriceInUSD,s=parseFloat(i)*n;return"toToken"===e&&(s-=this.gasPriceInUSD||0),O.html`<w3m-swap-input
1270      .value=${"toToken"===e?this.toTokenAmount:this.sourceTokenAmount}
1271      ?disabled=${this.loadingQuote&&"toToken"===e}
1272      .onSetAmount=${this.handleChangeAmount.bind(this)}
1273      target=${e}
1274      .token=${t}
1275      .balance=${r?.quantity?.numeric}
1276      .price=${r?.price}
1277      .marketValue=${s}
1278      .onSetMaxValue=${this.onSetMaxValue.bind(this)}
1279    ></w3m-swap-input>`}onSetMaxValue(e,t){let r="sourceToken"===e?this.sourceToken:this.toToken,i=r?.address===_.NetworkController.getActiveNetworkTokenAddress(),n="0";if(!t){n="0",this.handleChangeAmount(e,n);return}if(!this.gasPriceInUSD){n=t,this.handleChangeAmount(e,n);return}let s=tG.NumberUtil.bigNumber(this.gasPriceInUSD.toFixed(5)).dividedBy(this.sourceTokenPriceInUSD),o=i?tG.NumberUtil.bigNumber(t).minus(s):tG.NumberUtil.bigNumber(t);this.handleChangeAmount(e,o.isGreaterThan(0)?o.toFixed(20):"0")}templateDetails(){return this.sourceToken&&this.toToken&&!this.inputError?O.html`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`:null}handleChangeAmount(e,t){tF.SwapController.clearError(),"sourceToken"===e?tF.SwapController.setSourceTokenAmount(t):tF.SwapController.setToTokenAmount(t),this.onDebouncedGetSwapCalldata()}templateActionButton(){let e=!this.toToken||!this.sourceToken,t=!this.sourceTokenAmount,r=this.loadingQuote||this.loadingPrices||this.loadingTransaction,i=r||e||t||this.inputError;return O.html` <wui-flex gap="xs">
1280      <wui-button
1281        data-testid="swap-action-button"
1282        class="action-button"
1283        fullWidth
1284        size="lg"
1285        borderRadius="xs"
1286        variant=${e?"neutral":"main"}
1287        .loading=${r}
1288        .disabled=${i}
1289        @click=${this.onSwapPreview.bind(this)}
1290      >
1291        ${this.actionButtonLabel()}
1292      </wui-button>
1293    </wui-flex>`}onSwitchTokens(){tF.SwapController.switchTokens()}onSwapPreview(){this.fetchError?tF.SwapController.swapTokens():(f.EventsController.sendEvent({type:"track",event:"INITIATE_SWAP",properties:{network:this.caipNetworkId||"",swapFromToken:this.sourceToken?.symbol||"",swapToToken:this.toToken?.symbol||"",swapFromAmount:this.sourceTokenAmount||"",swapToAmount:this.toTokenAmount||"",isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.A
1293CCOUNT_TYPES.SMART_ACCOUNT}}),b.RouterController.push("SwapPreview"))}};tJ.styles=tV,tY([(0,$.state)()],tJ.prototype,"interval",void 0),tY([(0,$.state)()],tJ.prototype,"detailsOpen",void 0),tY([(0,$.state)()],tJ.prototype,"caipNetworkId",void 0),tY([(0,$.state)()],tJ.prototype,"initialized",void 0),tY([(0,$.state)()],tJ.prototype,"loadingQuote",void 0),tY([(0,$.state)()],tJ.prototype,"loadingPrices",void 0),tY([(0,$.state)()],tJ.prototype,"loadingTransaction",void 0),tY([(0,$.state)()],tJ.prototype,"sourceToken",void 0),tY([(0,$.state)()],tJ.prototype,"sourceTokenAmount",void 0),tY([(0,$.state)()],tJ.prototype,"sourceTokenPriceInUSD",void 0),tY([(0,$.state)()],tJ.prototype,"toToken",void 0),tY([(0,$.state)()],tJ.prototype,"toTokenAmount",void 0),tY([(0,$.state)()],tJ.prototype,"toTokenPriceInUSD",void 0),tY([(0,$.state)()],tJ.prototype,"inputError",void 0),tY([(0,$.state)()],tJ.prototype,"gasPriceInUSD",void 0),tY([(0,$.state)()],tJ.prototype,"fetchError",void 0),tJ=tY([(0,P.customElement)("w3m-swap-view")],tJ);var tZ=R;let tQ=U.css`
1294  @keyframes shake {
1295    0% {
1296      transform: translateX(0);
1297    }
1298    25% {
1299      transform: translateX(3px);
1300    }
1301    50% {
1302      transform: translateX(-3px);
1303    }
1304    75% {
1305      transform: translateX(3px);
1306    }
1307    100% {
1308      transform: translateX(0);
1309    }
1310  }
1311
1312  wui-flex:first-child:not(:only-child) {
1313    position: relative;
1314  }
1315
1316  wui-loading-thumbnail {
1317    position: absolute;
1318  }
1319
1320  wui-visual {
1321    width: var(--wui-wallet-image-size-lg);
1322    height: var(--wui-wallet-image-size-lg);
1323    border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
1324    position: relative;
1325    overflow: hidden;
1326  }
1327
1328  wui-visual::after {
1329    content: '';
1330    display: block;
1331    width: 100%;
1332    height: 100%;
1333    position: absolute;
1334    inset: 0;
1335    border-radius: calc(var(--wui-border-radius-5xs) * 9 - var(--wui-border-radius-xxs));
1336    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
1337  }
1338
1339  wui-icon-box {
1340    position: absolute;
1341    right: calc(var(--wui-spacing-3xs) * -1);
1342    bottom: calc(var(--wui-spacing-3xs) * -1);
1343    opacity: 0;
1344    transform: scale(0.5);
1345    transition:
1346      opacity var(--wui-ease-out-power-2) var(--wui-duration-lg),
1347      transform var(--wui-ease-out-power-2) var(--wui-duration-lg);
1348    will-change: opacity, transform;
1349  }
1350
1351  wui-text[align='center'] {
1352    width: 100%;
1353    padding: 0px var(--wui-spacing-l);
1354  }
1355
1356  [data-error='true'] wui-icon-box {
1357    opacity: 1;
1358    transform: scale(1);
1359  }
1360
1361  [data-error='true'] > wui-flex:first-child {
1362    animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
1363  }
1364
1365  [data-retry='false'] wui-link {
1366    display: none;
1367  }
1368
1369  [data-retry='true'] wui-link {
1370    display: block;
1371    opacity: 1;
1372  }
1373
1374  wui-link {
1375    padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs);
1376  }
1377`;var tX=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let t0=class extends tZ.LitElement{constructor(){super(...arguments),this.unsubscribe=[],this.switchToChain=b.RouterController.state.data?.switchToChain,this.navigateTo=b.RouterController.state.data?.navigateTo,this.navigateWithReplace=b.RouterController.state.data?.navigateWithReplace,this.activeChain=m.ChainController.state.activeChain}firstUpdated(){this.unsubscribe.push(m.ChainController.subscribeKey("activeChain",e=>this.activeChain=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.activeChain?S.ConstantsUtil.CHAIN_NAME_MAP[this.activeChain]:"current",t=this.switchToChain?S.ConstantsUtil.CHAIN_NAME_MAP[this.switchToChain]:"supported";return O.html`
1378      <wui-flex
1379        flexDirection="column"
1380        alignItems="center"
1381        .padding=${["3xl","xl","xl","xl"]}
1382        gap="xl"
1383      >
1384        <wui-flex justifyContent="center" flexDirection="column" alignItems="center" gap="xl">
1385          <wui-visual name="eth"></wui-visual>
1386          <wui-text variant="paragraph-500" color="fg-100" align="center">Switch to EVM</wui-text>
1387          <wui-text variant="small-400" color="fg-200" align="center">
1388            This feature is not supported on the ${e} chain. Switch to
1389            ${t} chain to proceed using it.
1390          </wui-text>
1391          <wui-button size="md" @click=${this.switchActiveChain.bind(this)}>Switch</wui-button>
1391
1392        </wui-flex>
1393      </wui-flex>
1394    `}switchActiveChain(){this.switchToChain&&(m.ChainController.setActiveChain(this.switchToChain),this.navigateTo?this.navigateWithReplace?b.RouterController.replace(this.navigateTo):b.RouterController.push(this.navigateTo):b.RouterController.goBack())}};t0.styles=tQ,tX([(0,N.property)()],t0.prototype,"activeChain",void 0),t0=tX([(0,P.customElement)("w3m-switch-active-chain-view")],t0);var t1=R;let t3=U.css`
1395  :host > wui-flex:first-child {
1396    overflow-y: auto;
1397    overflow-x: hidden;
1398    scrollbar-width: none;
1399  }
1400
1401  :host > wui-flex:first-child::-webkit-scrollbar {
1402    display: none;
1403  }
1404
1405  .preview-container,
1406  .details-container {
1407    width: 100%;
1408  }
1409
1410  .token-image {
1411    width: 24px;
1412    height: 24px;
1413    box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005);
1414    border-radius: 12px;
1415  }
1416
1417  wui-loading-hexagon {
1418    position: absolute;
1419  }
1420
1421  .token-item {
1422    display: flex;
1423    align-items: center;
1424    justify-content: center;
1425    gap: var(--wui-spacing-xxs);
1426    padding: var(--wui-spacing-xs);
1427    height: 40px;
1428    border: none;
1429    border-radius: 80px;
1430    background: var(--wui-color-gray-glass-002);
1431    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002);
1432    cursor: pointer;
1433    transition: background 0.2s linear;
1434  }
1435
1436  .token-item:hover {
1437    background: var(--wui-color-gray-glass-005);
1438  }
1439
1440  .preview-token-details-container {
1441    width: 100%;
1442  }
1443
1444  .details-row {
1445    width: 100%;
1446    padding: var(--wui-spacing-s) var(--wui-spacing-xl);
1447    border-radius: var(--wui-border-radius-xxs);
1448    background: var(--wui-color-gray-glass-002);
1449  }
1450
1451  .action-buttons-container {
1452    width: 100%;
1453    gap: var(--wui-spacing-xs);
1454  }
1455
1456  .action-buttons-container > button {
1457    display: flex;
1458    align-items: center;
1459    justify-content: center;
1460    background: transparent;
1461    height: 48px;
1462    border-radius: var(--wui-border-radius-xs);
1463    border: none;
1464    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010);
1465  }
1466
1467  .action-buttons-container > button:disabled {
1468    opacity: 0.8;
1469    cursor: not-allowed;
1470  }
1471
1472  .action-button > wui-loading-spinner {
1473    display: inline-block;
1474  }
1475
1476  .cancel-button:hover,
1477  .action-button:hover {
1478    cursor: pointer;
1479  }
1480
1481  .action-buttons-container > wui-button.cancel-button {
1482    flex: 2;
1483  }
1484
1485  .action-buttons-container > wui-button.action-button {
1486    flex: 4;
1487  }
1488
1489  .action-buttons-container > button.action-button > wui-text {
1490    color: white;
1491  }
1492
1493  .details-container > wui-flex {
1494    background: var(--wui-color-gray-glass-002);
1495    border-radius: var(--wui-border-radius-xxs);
1496    width: 100%;
1497  }
1498
1499  .details-container > wui-flex > button {
1500    border: none;
1501    background: none;
1502    padding: var(--wui-spacing-s);
1503    border-radius: var(--wui-border-radius-xxs);
1504    transition: background 0.2s linear;
1505  }
1506
1507  .details-container > wui-flex > button:hover {
1508    background: var(--wui-color-gray-glass-002);
1509  }
1510
1511  .details-content-container {
1512    padding: var(--wui-spacing-1xs);
1513    display: flex;
1514    align-items: center;
1515    justify-content: center;
1516  }
1517
1518  .details-content-container > wui-flex {
1519    width: 100%;
1520  }
1521
1522  .details-row {
1523    width: 100%;
1524    padding: var(--wui-spacing-s) var(--wui-spacing-xl);
1525    border-radius: var(--wui-border-radius-xxs);
1526    background: var(--wui-color-gray-glass-002);
1527  }
1528`;var t2=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let t5=class extends t1.LitElement{constructor(){super(),this.unsubscribe=[],this.detailsOpen=!0,this.approvalTransaction=tF.SwapController.state.approvalTransaction,this.swapTransaction=tF.SwapController.state.swapTransaction,this.sourceToken=tF.SwapController.state.sourceToken,this.sourceTokenAmount=tF.SwapController.state.sourceTokenAmount??"",this.sourceTokenPriceInUSD=tF.SwapController.state.sourceTokenPriceInUSD,this.toToken=tF.SwapController.state.toToken,this.toTokenAmount=tF.SwapController.state.toTokenAmount??"",this.toTokenPriceInUSD=tF.SwapController.state.toTokenPriceInUSD,this.caipNetwork=_.NetworkController.state.caipNetwork,this.balanceSymbol=c.AccountController.state.balanceSymbol,this.gasPriceInUSD=tF.SwapController.state.gasPriceInUSD,this.inputError=tF.SwapController.state.inputError,this.loadingQuote=tF.SwapController.state.loadingQuote,this.loadingApprovalTransaction=tF.SwapController.state.loadingApprovalTransaction,this.loadingBuildTransaction=tF.SwapController.state.loadingBuildTransaction,this.loadingTransaction=tF.SwapController.state.loadingTransaction,this.unsubscribe.push(c.AccountController.subscribeKey("balanceSymbol",e=>{this.balanceSymbol!==e&&b.RouterController.goBack()}),_.NetworkController.subscribeKey("caipNetwork",e=>{this.caipNetwork!==e&&(this.caipNetwork=e)}),tF.SwapController.subscribe(e=>{this.approvalTransaction=e.approvalTransaction,this.swapTransaction=e.swapTransaction,this.sourceToken=e.sourceToken,this.gasPriceInUSD=e.gasPriceInUSD,this.toToken=e.toToken,this.gasPriceInUSD=e.gasPriceInUSD,this.toTokenPriceInUSD=e.toTokenPriceInUSD,this.sourceTokenAmount=e.sourceTokenAmount??"",this.toTokenAmount=e.toTokenAmount??"",this.inputError=e.inputError,e.inputError&&b.RouterController.goBack(),this.loadingQuote=e.loadingQuote,this.loadingApprovalTransaction=e.loadingApprovalTransaction,this.loadingBuildTransaction=e.loadingBuildTransaction,this.loadingTransaction=e.loadingTransaction}))}firstUpdated(){tF.SwapController.getTransaction(),this.refreshTransaction()}
1528disconnectedCallback(){this.unsubscribe.forEach(e=>e?.()),clearInterval(this.interval)}render(){return O.html`
1529      <wui-flex flexDirection="column" .padding=${["0","l","l","l"]} gap="s">
1530        ${this.templateSwap()}
1531      </wui-flex>
1532    `}refreshTransaction(){this.interval=setInterval(()=>{tF.SwapController.getApprovalLoadingState()||tF.SwapController.getTransaction()},1e4)}templateSwap(){let e=`${ed.UiHelperUtil.formatNumberToLocalString(parseFloat(this.sourceTokenAmount))} ${this.sourceToken?.symbol}`,t=`${ed.UiHelperUtil.formatNumberToLocalString(parseFloat(this.toTokenAmount))} ${this.toToken?.symbol}`,r=parseFloat(this.sourceTokenAmount)*this.sourceTokenPriceInUSD,i=parseFloat(this.toTokenAmount)*this.toTokenPriceInUSD-(this.gasPriceInUSD||0),n=ed.UiHelperUtil.formatNumberToLocalString(r),s=ed.UiHelperUtil.formatNumberToLocalString(i),o=this.loadingQuote||this.loadingBuildTransaction||this.loadingTransaction||this.loadingApprovalTransaction;return O.html`
1533      <wui-flex flexDirection="column" alignItems="center" gap="l">
1534        <wui-flex class="preview-container" flexDirection="column" alignItems="flex-start" gap="l">
1535          <wui-flex
1536            class="preview-token-details-container"
1537            alignItems="center"
1538            justifyContent="space-between"
1539            gap="l"
1540          >
1541            <wui-flex flexDirection="column" alignItems="flex-start" gap="4xs">
1542              <wui-text variant="small-400" color="fg-150">Send</wui-text>
1543              <wui-text variant="paragraph-400" color="fg-100">$${n}</wui-text>
1544            </wui-flex>
1545            <wui-token-button
1546              flexDirection="row-reverse"
1547              text=${e}
1548              imageSrc=${this.sourceToken?.logoUri}
1549            >
1550            </wui-token-button>
1551          </wui-flex>
1552          <wui-icon name="recycleHorizontal" color="fg-200" size="md"></wui-icon>
1553          <wui-flex
1554            class="preview-token-details-container"
1555            alignItems="center"
1556            justifyContent="space-between"
1557            gap="l"
1558          >
1559            <wui-flex flexDirection="column" alignItems="flex-start" gap="4xs">
1560              <wui-text variant="small-400" color="fg-150">Receive</wui-text>
1561              <wui-text variant="paragraph-400" color="fg-100">$${s}</wui-text>
1562            </wui-flex>
1563            <wui-token-button
1564              flexDirection="row-reverse"
1565              text=${t}
1566              imageSrc=${this.toToken?.logoUri}
1567            >
1568            </wui-token-button>
1569          </wui-flex>
1570        </wui-flex>
1571
1572        ${this.templateDetails()}
1573
1574        <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="xs">
1575          <wui-icon size="sm" color="fg-200" name="infoCircle"></wui-icon>
1576          <wui-text variant="small-400" color="fg-200">Review transaction carefully</wui-text>
1577        </wui-flex>
1578
1579        <wui-flex
1580          class="action-buttons-container"
1581          flexDirection="row"
1582          alignItems="center"
1583          justifyContent="space-between"
1584          gap="xs"
1585        >
1586          <wui-button
1587            class="cancel-button"
1588            fullWidth
1589            size="lg"
1590            borderRadius="xs"
1591            variant="neutral"
1592            @click=${this.onCancelTransaction.bind(this)}
1593          >
1594            <wui-text variant="paragraph-600" color="fg-200">Cancel</wui-text>
1595          </wui-button>
1596          <wui-button
1597            class="action-button"
1598            fullWidth
1599            size="lg"
1600            borderRadius="xs"
1601            variant="main"
1602            ?loading=${o}
1603            ?disabled=${o}
1604            @click=${this.onSendTransaction.bind(this)}
1605          >
1606            <wui-text variant="paragraph-600" color="inverse-100">
1607              ${this.actionButtonLabel()}
1608            </wui-text>
1609          </wui-button>
1610        </wui-flex>
1611      </wui-flex>
1612    `}templateDetails(){return this.sourceToken&&this.toToken&&!this.inputError?O.html`<w3m-swap-details .detailsOpen=${this.detailsOpen}></w3m-swap-details>`:null}actionButtonLabel(){return this.loadingApprovalTransaction?"Approving...":this.approvalTransaction?"Approve":"Swap"}onCancelTransaction(){b.RouterController.goBack()}onSendTransaction(){this.approvalTransaction?tF.SwapController.sendTransactionForApproval(this.approvalTransaction):tF.SwapController.sendTransactionForSwap(this.swapTransaction)}};t5.styles=t3,t2([(0,$.state)()],t5.prototype,"interval",void 0),t2([(0,$.state)()],t5.prototype,"detailsOpen",void 0),t2([(0,$.state)()],t5.prototype,"approvalTransaction",void 0),t2([(0,$.state)()],t5.prototype,"swapTransaction",void 0),t2([(0,$.state)()],t5.prototype,"sourceToken",void 0),t2([(0,$.state)()],t5.prototype,"sourceTokenAmount",void 0),t2([(0,$.state)()],t5.prototype,"sourceTokenPriceInUSD",void 0),t2([(0,$.state)()],t5.prototype,"toToken",void 0),t2([(0,$.state)()],t5.prototype,"toTokenAmount",void 0),t2([(0,$.state)()],t5.prototype,"toTokenPriceInUSD",void 0),t2([(0,$.state)()],t5.prototype,"caipNetwork",void 0),t2([(0,$.state)()],t5.prototype,"balanceSymbol",void 0),t2([(0,$.state)()],t5.prototype,"gasPriceInUSD",void 0),t2([(0,$.state)()],t5.prototype,"inputError",void 0),t2([(0,$.state)()],t5.prototype,"loadingQuote",void 0),t2([(0,$.state)()],t5.prototype,"loadingApprovalTransaction",void 0),t2([(0,$.state)()],t5.prototype,"loadingBuildTransaction",void 0),t2([(0,$.state)()],t5.prototype,"loadingTransaction",void 0),t5=t2([(0,P.customElement)("w3m-swap-preview-view")],t5);var t4=e.i(976679),t6=R;let t8=U.css`
1613  :host {
1614    --tokens-scroll--top-opacity: 0;
1615    --tokens-scroll--bottom-opacity: 1;
1616    --suggested-tokens-scroll--left-opacity: 0;
1617    --suggested-tokens-scroll--right-opacity: 1;
1618  }
1619
1620  :host > wui-flex:first-child {
1621    overflow-y: hidden;
1622    overflow-x: hidden;
1623    scrollbar-width: none;
1624    scrollbar-height: none;
1625  }
1626
1627  :host > wui-flex:first-child::-webkit-scrollbar {
1628    display: none;
1629  }
1630
1631  wui-loading-hexagon {
1632    position: absolute;
1633  }
1634
1635  .suggested-tokens-container {
1636    overflow-x: auto;
1637    mask-image: linear-gradient(
1638      to right,
1639      rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 0px,
1640      rgba(200, 200, 200, calc(1 - var(--suggested-tokens-scroll--left-opacity))) 1px,
1641      black 50px,
1642      black 90px,
1643      black calc(100% - 90px),
1644      black calc(100% - 50px),
1645      rgba(155, 155, 155, calc(1 - var(--suggested-tokens-scroll--right-opacity))) calc(100% - 1px),
1646      rgba(0, 0, 0, calc(1 - var(--suggested-tokens-scroll--right-opacity))) 100%
1647    );
1648  }
1649
1650  .suggested-tokens-container::-webkit-scrollbar {
1651    display: none;
1652  }
1653
1654  .tokens-container {
1655    border-top: 1px solid var(--wui-color-gray-glass-005);
1656    height: 100%;
1657    max-height: 390px;
1658  }
1659
1660  .tokens {
1661    width: 100%;
1662    overflow-y: auto;
1663    mask-image: linear-gradient(
1664      to bottom,
1665      rgba(0, 0, 0, calc(1 - var(--tokens-scroll--top-opacity))) 0px,
1666      rgba(200, 200, 200, calc(1 - var(--tokens-scroll--top-opacity))) 1px,
1667      black 50px,
1668      black 90px,
1669      black calc(100% - 90px),
1670      black calc(100% - 50px),
1671      rgba(155, 155, 155, calc(1 - var(--tokens-scroll--bottom-opacity))) calc(100% - 1px),
1672      rgba(0, 0, 0, calc(1 - var(--tokens-scroll--bottom-opacity))) 100%
1673    );
1674  }
1675
1676  .network-search-input,
1677  .select-network-button {
1678    height: 40px;
1679  }
1680
1681  .select-network-button {
1682    border: none;
1683    display: flex;
1684    flex-direction: row;
1685    align-items: center;
1686    justify-content: center;
1687    gap: var(--wui-spacing-xs);
1688    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
1689    background-color: transparent;
1690    border-radius: var(--wui-border-radius-xxs);
1691    padding: var(--wui-spacing-xs);
1692    align-items: center;
1693    transition: background-color 0.2s linear;
1694  }
1695
1696  .select-network-button:hover {
1697    background-color: var(--wui-color-gray-glass-002);
1698  }
1699
1700  .select-network-button > wui-image {
1701    width: 26px;
1702    height: 26px;
1703    border-radius: var(--wui-border-radius-xs);
1704    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010);
1705  }
1706`;var t9=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let t7=class extends t6.LitElement{constructor(){super(),this.unsubscribe=[],this.targetToken=b.RouterController.state.data?.target,this.sourceToken=tF.SwapController.state.sourceToken,this.sourceTokenAmount=tF.SwapController.state.sourceTokenAmount,this.toToken=tF.SwapController.state.toToken,this.myTokensWithBalance=tF.SwapController.state.myTokensWithBalance,this.popularTokens=tF.SwapController.state.popularTokens,this.searchValue="",this.unsubscribe.push(tF.SwapController.subscribe(e=>{this.sourceToken=e.sourceToken,this.toToken=e.toToken,this.myTokensWithBalance=e.myTokensWithBalance}))}updated(){let e=this.renderRoot?.querySelector(".suggested-tokens-container");e?.addEventListener("scroll",this.handleSuggestedTokensScroll.bind(this));let t=this.renderRoot?.querySelector(".tokens");t?.addEventListener("scroll",this.handleTokenListScroll.bind(this))}disconnectedCallback(){super.disconnectedCallback();let e=this.renderRoot?.querySelector(".suggested-tokens-container"),t=this.renderRoot?.querySelector(".tokens");e?.removeEventListener("scroll",this.handleSuggestedTokensScroll.bind(this)),t?.removeEventListener("scroll",this.handleTokenListScroll.bind(this)),clearInterval(this.interval)}render(){return O.html`
1707      <wui-flex flexDirection="column" gap="s">
1708        ${this.templateSearchInput()} ${this.templateSuggestedTokens()} ${this.templateTokens()}
1709      </wui-flex>
1710    `}onSelectToken(e){"sourceToken"===this.targetToken?tF.SwapController.setSourceToken(e):(tF.SwapController.setToToken(e),this.sourceToken&&this.sourceTokenAmount&&tF.SwapController.swapTokens()),b.RouterController.goBack()}templateSearchInput(){return O.html`
1711      <wui-flex .padding=${["3xs","s","0","s"]} gap="xs">
1712        <wui-input-text
1713          data-testid="swap-select-token-search-input"
1714          class="network-search-input"
1715          size="sm"
1716          placeholder="Search token"
1717          icon="search"
1718          .value=${this.searchValue}
1719          @inputChange=${this.onSearchInputChange.bind(this)}
1720        ></wui-input-text>
1721      </wui-flex>
1722    `}templateTokens(){let e=this.myTokensWithBalance?Object.values(this.myTokensWithBalance):[],t=this.popularTokens?this.popularTokens:[],r=this.filterTokensWithText(e,this.searchValue),i=this.filterTokensWithText(t,this.searchValue);return O.html`
1723      <wui-flex class="tokens-container">
1724        <wui-flex class="tokens" .padding=${["0","s","s","s"]} flexDirection="column">
1725          ${r?.length>0?O.html`
1726                <wui-flex justifyContent="flex-start" padding="s">
1727                  <wui-text variant="paragraph-500" color="fg-200">Your tokens</wui-text>
1728                </wui-flex>
1729                ${r.map(e=>{let t=e.symbol===this.sourceToken?.symbol||e.symbol===this.toToken?.symbol;return O.html`
1730                    <wui-token-list-item
1731                      data-testid="swap-select-token-item-${e.symbol}"
1732                      name=${e.name}
1733                      ?disabled=${t}
1734                      symbol=${e.symbol}
1735                      price=${e?.price}
1736                      amount=${e?.quantity?.numeric}
1737                      imageSrc=${e.logoUri}
1738                      @click=${()=>{t||this.onSelectToken(e)}}
1739                    >
1740                    </wui-token-list-item>
1741                  `})}
1742              `:null}
1743
1744          <wui-flex justifyContent="flex-start" padding="s">
1745            <wui-text variant="paragraph-500" color="fg-200">Tokens</wui-text>
1746          </wui-flex>
1747          ${i?.length>0?i.map(e=>O.html`
1748                  <wui-token-list-item
1749                    data-testid="swap-select-token-item-${e.symbol}"
1750                    name=${e.name}
1751                    symbol=${e.symbol}
1752                    imageSrc=${e.logoUri}
1753                    @click=${()=>this.onSelectToken(e)}
1754                  >
1755                  </wui-token-list-item>
1756                `):null}
1757        </wui-flex>
1758      </wui-flex>
1759    `}templateSuggestedTokens(){let e=tF.SwapController.state.suggestedTokens?tF.SwapController.state.suggestedTokens.slice(0,8):null;return e?O.html`
1760      <wui-flex class="suggested-tokens-container" .padding=${["0","s","0","s"]} gap="xs">
1761        ${e.map(e=>O.html`
1762            <wui-token-button
1763              text=${e.symbol}
1764              imageSrc=${e.logoUri}
1765              @click=${()=>this.onSelectToken(e)}
1766            >
1767            </wui-token-button>
1767
1768          `)}
1769      </wui-flex>
1770    `:null}onSearchInputChange(e){this.searchValue=e.detail}handleSuggestedTokensScroll(){let e=this.renderRoot?.querySelector(".suggested-tokens-container");e&&(e.style.setProperty("--suggested-tokens-scroll--left-opacity",t4.MathUtil.interpolate([0,100],[0,1],e.scrollLeft).toString()),e.style.setProperty("--suggested-tokens-scroll--right-opacity",t4.MathUtil.interpolate([0,100],[0,1],e.scrollWidth-e.scrollLeft-e.offsetWidth).toString()))}handleTokenListScroll(){let e=this.renderRoot?.querySelector(".tokens");e&&(e.style.setProperty("--tokens-scroll--top-opacity",t4.MathUtil.interpolate([0,100],[0,1],e.scrollTop).toString()),e.style.setProperty("--tokens-scroll--bottom-opacity",t4.MathUtil.interpolate([0,100],[0,1],e.scrollHeight-e.scrollTop-e.offsetHeight).toString()))}filterTokensWithText(e,t){return e.filter(e=>`${e.symbol} ${e.name} ${e.address}`.toLowerCase().includes(t.toLowerCase()))}};t7.styles=t8,t9([(0,$.state)()],t7.prototype,"interval",void 0),t9([(0,$.state)()],t7.prototype,"targetToken",void 0),t9([(0,$.state)()],t7.prototype,"sourceToken",void 0),t9([(0,$.state)()],t7.prototype,"sourceTokenAmount",void 0),t9([(0,$.state)()],t7.prototype,"toToken",void 0),t9([(0,$.state)()],t7.prototype,"myTokensWithBalance",void 0),t9([(0,$.state)()],t7.prototype,"popularTokens",void 0),t9([(0,$.state)()],t7.prototype,"searchValue",void 0),t7=t9([(0,P.customElement)("w3m-swap-select-token-view")],t7);var re=R;let rt=U.css`
1771  :host > wui-flex:first-child {
1772    height: 500px;
1773    overflow-y: auto;
1774    overflow-x: hidden;
1775    scrollbar-width: none;
1776  }
1777
1778  :host > wui-flex:first-child::-webkit-scrollbar {
1779    display: none;
1780  }
1781`,rr=class extends re.LitElement{render(){return O.html`
1782      <wui-flex flexDirection="column" .padding=${["0","m","m","m"]} gap="s">
1783        <w3m-activity-list page="activity"></w3m-activity-list>
1784      </wui-flex>
1785    `}};rr.styles=rt,rr=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-transactions-view")],rr);var ri=R;let rn=[{images:["network","layers","system"],title:"The system’s nuts and bolts",text:"A network is what brings the blockchain to life, as this technical infrastructure allows apps to access the ledger and smart contract services."},{images:["noun","defiAlt","dao"],title:"Designed for different uses",text:"Each network is designed differently, and may therefore suit certain apps and experiences."}],rs=class extends ri.LitElement{render(){return O.html`
1786      <wui-flex
1787        flexDirection="column"
1788        .padding=${["xxl","xl","xl","xl"]}
1789        alignItems="center"
1790        gap="xl"
1791      >
1792        <w3m-help-widget .data=${rn}></w3m-help-widget>
1793        <wui-button
1794          variant="main"
1795          size="md"
1796          @click=${()=>{p.CoreHelperUtil.openHref("https://ethereum.org/en/developers/docs/networks/","_blank")}}
1797        >
1798          Learn more
1799          <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
1800        </wui-button>
1801      </wui-flex>
1802    `}};rs=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-what-is-a-network-view")],rs);var ro=R;let ra=[{images:["login","profile","lock"],title:"One login for all of web3",text:"Log in to any app by connecting your wallet. Say goodbye to countless passwords!"},{images:["defi","nft","eth"],title:"A home for your digital assets",text:"A wallet lets you store, send and receive digital assets like cryptocurrencies and NFTs."},{images:["browser","noun","dao"],title:"Your gateway to a new web",text:"With your wallet, you can explore and interact with DeFi, NFTs, DAOs, and much more."}],rl=class extends ro.LitElement{render(){return O.html`
1803      <wui-flex
1804        flexDirection="column"
1805        .padding=${["xxl","xl","xl","xl"]}
1806        alignItems="center"
1807        gap="xl"
1808      >
1809        <w3m-help-widget .data=${ra}></w3m-help-widget>
1810        <wui-button variant="main" size="md" @click=${this.onGetWallet.bind(this)}>
1811          <wui-icon color="inherit" slot="iconLeft" name="wallet"></wui-icon>
1812          Get a wallet
1813        </wui-button>
1814      </wui-flex>
1815    `}onGetWallet(){f.EventsController.sendEvent({type:"track",event:"CLICK_GET_WALLET"}),b.RouterController.push("GetWallet")}};rl=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-what-is-a-wallet-view")],rl);var rc=R;let ru=class extends rc.LitElement{render(){return O.html`
1816      <wui-flex
1817        flexDirection="column"
1818        .padding=${["xxl","3xl","xl","3xl"]}
1819        alignItems="center"
1820        gap="xl"
1821      >
1822        <wui-visual name="onrampCard"></wui-visual>
1823        <wui-flex flexDirection="column" gap="xs" alignItems="center">
1824          <wui-text align="center" variant="paragraph-500" color="fg-100">
1825            Quickly and easily buy digital assets!
1826          </wui-text>
1827          <wui-text align="center" variant="small-400" color="fg-200">
1828            Simply select your preferred onramp provider and add digital assets to your account
1829            using your credit card or bank transfer
1830          </wui-text>
1831        </wui-flex>
1832        <wui-button @click=${b.RouterController.goBack}>
1833          <wui-icon size="sm" color="inherit" name="add" slot="iconLeft"></wui-icon>
1834          Buy
1835        </wui-button>
1835
1836      </wui-flex>
1837    `}};ru=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-what-is-a-buy-view")],ru);var rh=R;let rd=U.css`
1838  wui-loading-spinner {
1839    margin: 9px auto;
1840  }
1841
1842  .email-display,
1843  .email-display wui-text {
1844    max-width: 100%;
1845  }
1846`;var rp=e.i(909171),rf=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rg=class extends rh.LitElement{firstUpdated(){this.startOTPTimeout()}disconnectedCallback(){clearTimeout(this.OTPTimeout)}constructor(){super(),this.loading=!1,this.timeoutTimeLeft=rp.W3mFrameHelpers.getTimeToNextEmailLogin(),this.error="",this.otp="",this.email=b.RouterController.state.data?.email,this.authConnector=d.ConnectorController.getAuthConnector()}render(){if(!this.email)throw Error("w3m-email-otp-widget: No email provided");let e=!!this.timeoutTimeLeft,t=this.getFooterLabels(e);return O.html`
1847      <wui-flex
1848        flexDirection="column"
1849        alignItems="center"
1850        .padding=${["l","0","l","0"]}
1851        gap="l"
1852      >
1853        <wui-flex
1854          class="email-display"
1855          flexDirection="column"
1856          alignItems="center"
1857          .padding=${["0","xl","0","xl"]}
1858        >
1859          <wui-text variant="paragraph-400" color="fg-100" align="center">
1860            Enter the code we sent to
1861          </wui-text>
1862          <wui-text variant="paragraph-500" color="fg-100" lineClamp="1" align="center">
1863            ${this.email}
1864          </wui-text>
1865        </wui-flex>
1866
1867        <wui-text variant="small-400" color="fg-200">The code expires in 20 minutes</wui-text>
1868
1869        ${this.loading?O.html`<wui-loading-spinner size="xl" color="accent-100"></wui-loading-spinner>`:O.html` <wui-flex flexDirection="column" alignItems="center" gap="xs">
1870              <wui-otp
1871                dissabled
1872                length="6"
1873                @inputChange=${this.onOtpInputChange.bind(this)}
1874                .otp=${this.otp}
1875              ></wui-otp>
1876              ${this.error?O.html`
1877                    <wui-text variant="small-400" align="center" color="error-100">
1878                      ${this.error}. Try Again
1879                    </wui-text>
1880                  `:null}
1881            </wui-flex>`}
1882
1883        <wui-flex alignItems="center" gap="xs">
1884          <wui-text variant="small-400" color="fg-200">${t.title}</wui-text>
1885          <wui-link @click=${this.onResendCode.bind(this)} .disabled=${e}>
1886            ${t.action}
1887          </wui-link>
1888        </wui-flex>
1889      </wui-flex>
1890    `}startOTPTimeout(){this.timeoutTimeLeft=rp.W3mFrameHelpers.getTimeToNextEmailLogin(),this.OTPTimeout=setInterval(()=>{this.timeoutTimeLeft>0?this.timeoutTimeLeft=rp.W3mFrameHelpers.getTimeToNextEmailLogin():clearInterval(this.OTPTimeout)},1e3)}async onOtpInputChange(e){try{!this.loading&&(this.otp=e.detail,this.authConnector&&6===this.otp.length&&(this.loading=!0,await this.onOtpSubmit?.(this.otp)))}catch(e){this.error=p.CoreHelperUtil.parseError(e),this.loading=!1}}async onResendCode(){try{if(this.onOtpResend){if(!this.loading&&!this.timeoutTimeLeft){if(this.error="",this.otp="",!d.ConnectorController.getAuthConnector()||!this.email)throw Error("w3m-email-otp-widget: Unable to resend email");this.loading=!0,await this.onOtpResend(this.email),this.startOTPTimeout(),v.SnackController.showSuccess("Code email resent")}}else this.onStartOver&&this.onStartOver()}catch(e){v.SnackController.showError(e)}finally{this.loading=!1}}getFooterLabels(e){return this.onStartOver?{title:"Something wrong?",action:`Try again ${e?`in ${this.timeoutTimeLeft}s`:""}`}:{title:"Didn't receive it?",action:`Resend ${e?`in ${this.timeoutTimeLeft}s`:"Code"}`}}};rg.styles=rd,rf([(0,$.state)()],rg.prototype,"loading",void 0),rf([(0,$.state)()],rg.prototype,"timeoutTimeLeft",void 0),rf([(0,$.state)()],rg.prototype,"error",void 0),rg=rf([(0,P.customElement)("w3m-email-otp-widget")],rg);var rm=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
1890);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rw=class extends rg{constructor(){super(),this.unsubscribe=[],this.smartAccountDeployed=c.AccountController.state.smartAccountDeployed,this.onOtpSubmit=async e=>{try{if(this.authConnector){let t=_.NetworkController.checkIfSmartAccountEnabled();await this.authConnector.provider.connectOtp({otp:e}),f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),await h.ConnectionController.connectExternal(this.authConnector,this.authConnector.chain),f.EventsController.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"email",name:this.authConnector.name||"Unknown"}}),c.AccountController.state.allAccounts.length>1?b.RouterController.push("SelectAddresses"):t&&!this.smartAccountDeployed?b.RouterController.push("UpgradeToSmartAccount"):g.ModalController.close()}}catch(e){throw f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL"}),e}},this.onOtpResend=async e=>{this.authConnector&&(await this.authConnector.provider.connectEmail({email:e}),f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}))},this.unsubscribe.push(c.AccountController.subscribeKey("smartAccountDeployed",e=>{this.smartAccountDeployed=e}))}};rm([(0,$.state)()],rw.prototype,"smartAccountDeployed",void 0),rw=rm([(0,P.customElement)("w3m-email-verify-otp-view")],rw);var ry=R;let rv=U.css`
1891  wui-icon-box {
1892    height: var(--wui-icon-box-size-xl);
1893    width: var(--wui-icon-box-size-xl);
1894  }
1895`;var rb=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rC=class extends ry.LitElement{constructor(){super(),this.email=b.RouterController.state.data?.email,this.authConnector=d.ConnectorController.getAuthConnector(),this.loading=!1,this.listenForDeviceApproval()}render(){if(!this.email)throw Error("w3m-email-verify-device-view: No email provided");if(!this.authConnector)throw Error("w3m-email-verify-device-view: No auth connector provided");return O.html`
1896      <wui-flex
1897        flexDirection="column"
1898        alignItems="center"
1899        .padding=${["xxl","s","xxl","s"]}
1900        gap="l"
1901      >
1902        <wui-icon-box
1903          size="xl"
1904          iconcolor="accent-100"
1905          backgroundcolor="accent-100"
1906          icon="verify"
1907          background="opaque"
1908        ></wui-icon-box>
1909
1910        <wui-flex flexDirection="column" alignItems="center" gap="s">
1911          <wui-flex flexDirection="column" alignItems="center">
1912            <wui-text variant="paragraph-400" color="fg-100">
1913              Approve the login link we sent to
1914            </wui-text>
1915            <wui-text variant="paragraph-400" color="fg-100"><b>${this.email}</b></wui-text>
1916          </wui-flex>
1917
1918          <wui-text variant="small-400" color="fg-200" align="center">
1919            The code expires in 20 minutes
1920          </wui-text>
1921
1922          <wui-flex alignItems="center" id="w3m-resend-section" gap="xs">
1923            <wui-text variant="small-400" color="fg-100" align="center">
1924              Didn't receive it?
1925            </wui-text>
1926            <wui-link @click=${this.onResendCode.bind(this)} .disabled=${this.loading}>
1927              Resend email
1928            </wui-link>
1929          </wui-flex>
1930        </wui-flex>
1931      </wui-flex>
1932    `}async listenForDeviceApproval(){if(this.authConnector)try{await this.authConnector.provider.connectDevice(),f.EventsController.sendEvent({type:"track",event:"DEVICE_REGISTERED_FOR_EMAIL"}),f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}),b.RouterController.replace("EmailVerifyOtp",{email:this.email})}catch(e){b.RouterController.goBack()}}async onResendCode(){try{if(!this.loading){if(!this.authConnector||!this.email)throw Error("w3m-email-login-widget: Unable to resend email");this.loading=!0,await this.authConnector.provider.connectEmail({email:this.email}),this.listenForDeviceApproval(),v.SnackController.showSuccess("Code email resent")}}catch(e){v.SnackController.showError(e)}finally{this.loading=!1}}};rC.styles=rv,rb([(0,$.state)()],rC.prototype,"loading",void 0),rC=rb([(0,P.customElement)("w3m-email-verify-device-view")],rC);var rx=R;let r_=U.css`
1933  div {
1934    width: 100%;
1935    height: 400px;
1936  }
1937
1938  [data-ready='false'] {
1939    transform: scale(1.05);
1940  }
1941
1942  @media (max-width: 430px) {
1943    [data-ready='false'] {
1944      transform: translateY(-50px);
1945    }
1946  }
1947`;var rE=e.i(591995),rk=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
1947);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rS=class extends rx.LitElement{constructor(){super(),this.bodyObserver=void 0,this.unsubscribe=[],this.iframe=document.getElementById("w3m-iframe"),this.ready=!1,this.unsubscribe.push(g.ModalController.subscribeKey("open",e=>{e||(this.onHideIframe(),b.RouterController.popTransactionStack())}),g.ModalController.subscribeKey("shake",e=>{e?this.iframe.style.animation="w3m-shake 500ms var(--wui-ease-out-power-2)":this.iframe.style.animation="none"}))}disconnectedCallback(){this.onHideIframe(),this.unsubscribe.forEach(e=>e()),this.bodyObserver?.unobserve(window.document.body)}async firstUpdated(){await this.syncTheme(),this.iframe.style.display="block",this.bodyObserver=new ResizeObserver(e=>{let t=e?.[0]?.contentBoxSize,r=t?.[0]?.inlineSize;this.iframe.style.height="400px",r&&r<=430?(this.iframe.style.width="100%",this.iframe.style.left="0px",this.iframe.style.bottom="0px",this.iframe.style.top="unset"):(this.iframe.style.width="360px",this.iframe.style.left="calc(50% - 180px)",this.iframe.style.top="calc(50% - 200px + 32px)",this.iframe.style.bottom="unset"),this.ready=!0,this.onShowIframe()}),this.bodyObserver.observe(window.document.body)}render(){return O.html`<div data-ready=${this.ready}></div>`}onShowIframe(){let e=window.innerWidth<=430;this.iframe.style.animation=e?"w3m-iframe-zoom-in-mobile 200ms var(--wui-ease-out-power-2)":"w3m-iframe-zoom-in 200ms var(--wui-ease-out-power-2)"}onHideIframe(){this.iframe.style.display="none",this.iframe.style.animation="w3m-iframe-fade-out 200ms var(--wui-ease-out-power-2)"}async syncTheme(){let e=d.ConnectorController.getAuthConnector();if(e){let t=y.ThemeController.getSnapshot().themeMode,r=y.ThemeController.getSnapshot().themeVariables;await e.provider.syncTheme({themeVariables:r,w3mThemeVariables:(0,rE.getW3mThemeVariables)(r,t)})}}};rS.styles=r_,rk([(0,$.state)()],rS.prototype,"ready",void 0),rS=rk([(0,P.customElement)("w3m-approve-transaction-view")],rS);var rI=R;let rA=class extends rI.LitElement{render(){return O.html`
1948      <wui-flex flexDirection="column" alignItems="center" gap="xl" padding="xl">
1949        <wui-text variant="paragraph-400" color="fg-100">Follow the instructions on</wui-text>
1950        <wui-chip
1951          icon="externalLink"
1952          variant="fill"
1953          href=${eh.ConstantsUtil.SECURE_SITE_DASHBOARD}
1954          imageSrc=${eh.ConstantsUtil.SECURE_SITE_FAVICON}
1955          data-testid="w3m-secure-website-button"
1956        >
1957        </wui-chip>
1958        <wui-text variant="small-400" color="fg-200">
1959          You will have to reconnect for security reasons
1960        </wui-text>
1961      </wui-flex>
1962    `}};rA=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-upgrade-wallet-view")],rA);var rT=R,rP=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rR=class extends rT.LitElement{constructor(){super(...arguments),this.authConnector=d.ConnectorController.getAuthConnector(),this.loading=!1,this.setPreferSmartAccount=async()=>{if(this.authConnector)try{this.loading=!0,await h.ConnectionController.setPreferredAccountType(ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT),this.loading=!1,tv.RouterUtil.navigateAfterPreferredAccountTypeSelect()}catch(e){v.SnackController.showError("Error upgrading to smart account")}}}render(){return O.html`
1963      <wui-flex
1964        flexDirection="column"
1965        alignItems="center"
1966        gap="xxl"
1967        .padding=${["0","0","l","0"]}
1968      >
1969        ${this.onboardingTemplate()} ${this.buttonsTemplate()}
1970        <wui-link
1971          @click=${()=>{p.CoreHelperUtil.openHref(eX,"_blank")}}
1972        >
1973          Learn more
1974          <wui-icon color="inherit" slot="iconRight" name="externalLink"></wui-icon>
1975        </wui-link>
1976      </wui-flex>
1977    `}onboardingTemplate(){return O.html` <wui-flex
1978      flexDirection="column"
1979      gap="xxl"
1980      alignItems="center"
1981      .padding=${["0","xxl","0","xxl"]}
1982    >
1983      <wui-flex gap="s" alignItems="center" justifyContent="center">
1984        <wui-visual name="google"></wui-visual>
1985        <wui-visual name="pencil"></wui-visual>
1986        <wui-visual name="lightbulb"></wui-visual>
1987      </wui-flex>
1988      <wui-flex flexDirection="column" alignItems="center" gap="s">
1989        <wui-text align="center" variant="medium-600" color="fg-100">
1990          Discover Smart Accounts
1991        </wui-text>
1992        <wui-text align="center" variant="paragraph-400" color="fg-100">
1993          Access advanced features such as username, social login, improved security and a smoother
1994          user experience!
1995        </wui-text>
1996      </wui-flex>
1997    </wui-flex>`}buttonsTemplate(){return O.html`<wui-flex .padding=${["0","2l","0","2l"]} gap="s">
1998      <wui-button
1999        variant="accent"
2000        @click=${this.redirectToAccount.bind(this)}
2001        size="lg"
2002        borderRadius="xs"
2003      >
2004        Do it later
2005      </wui-button>
2005
2006      <wui-button
2007        .loading=${this.loading}
2008        size="lg"
2009        borderRadius="xs"
2010        @click=${this.setPreferSmartAccount.bind(this)}
2011        >Continue
2012      </wui-button>
2013    </wui-flex>`}redirectToAccount(){b.RouterController.push("Account")}};rP([(0,$.state)()],rR.prototype,"authConnector",void 0),rP([(0,$.state)()],rR.prototype,"loading",void 0),rR=rP([(0,P.customElement)("w3m-upgrade-to-smart-account-view")],rR);var rO=R;let rN=U.css`
2014  wui-email-input {
2015    width: 100%;
2016  }
2017
2018  form {
2019    width: 100%;
2020    display: block;
2021    position: relative;
2022  }
2023`;var r$=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rD=class extends rO.LitElement{constructor(){super(...arguments),this.formRef=tl(),this.initialEmail=b.RouterController.state.data?.email??"",this.email="",this.loading=!1}firstUpdated(){this.formRef.value?.addEventListener("keydown",e=>{"Enter"===e.key&&this.onSubmitEmail(e)})}render(){let e=!this.loading&&this.email.length>3&&this.email!==this.initialEmail;return O.html`
2024      <wui-flex flexDirection="column" padding="m" gap="m">
2025        <form ${th(this.formRef)} @submit=${this.onSubmitEmail.bind(this)}>
2026          <wui-email-input
2027            value=${this.initialEmail}
2028            .disabled=${this.loading}
2029            @inputChange=${this.onEmailInputChange.bind(this)}
2030          >
2031          </wui-email-input>
2032          <input type="submit" hidden />
2033        </form>
2034
2035        <wui-flex gap="s">
2036          <wui-button size="md" variant="neutral" fullWidth @click=${b.RouterController.goBack}>
2037            Cancel
2038          </wui-button>
2039
2040          <wui-button
2041            size="md"
2042            variant="main"
2043            fullWidth
2044            @click=${this.onSubmitEmail.bind(this)}
2045            .disabled=${!e}
2046            .loading=${this.loading}
2047          >
2048            Save
2049          </wui-button>
2050        </wui-flex>
2051      </wui-flex>
2052    `}onEmailInputChange(e){this.email=e.detail}async onSubmitEmail(e){try{if(this.loading)return;this.loading=!0,e.preventDefault();let t=d.ConnectorController.getAuthConnector();if(!t)throw Error("w3m-update-email-wallet: Auth connector not found");let r=await t.provider.updateEmail({email:this.email});f.EventsController.sendEvent({type:"track",event:"EMAIL_EDIT"}),"VERIFY_SECONDARY_OTP"===r.action?b.RouterController.push("UpdateEmailSecondaryOtp",{email:this.initialEmail,newEmail:this.email}):b.RouterController.push("UpdateEmailPrimaryOtp",{email:this.initialEmail,newEmail:this.email})}catch(e){v.SnackController.showError(e),this.loading=!1}}};rD.styles=rN,r$([(0,$.state)()],rD.prototype,"email",void 0),r$([(0,$.state)()],rD.prototype,"loading",void 0),rD=r$([(0,P.customElement)("w3m-update-email-wallet-view")],rD);let rL=class extends rg{constructor(){super(),this.email=b.RouterController.state.data?.email,this.onOtpSubmit=async e=>{try{this.authConnector&&(await this.authConnector.provider.updateEmailPrimaryOtp({otp:e}),f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),b.RouterController.replace("UpdateEmailSecondaryOtp",b.RouterController.state.data))}catch(e){throw f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL"}),e}},this.onStartOver=()=>{b.RouterController.replace("UpdateEmailWallet",b.RouterController.state.data)}}};rL=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-update-email-primary-otp-view")],rL);let rj=class extends rg{constructor(){super(),this.email=b.RouterController.state.data?.newEmail,this.onOtpSubmit=async e=>{try{this.authConnector&&(await this.authConnector.provider.updateEmailSecondaryOtp({otp:e}),f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_PASS"}),b.RouterController.reset("Account"))}catch(e){throw f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_FAIL"}),e}},this.onStartOver=()=>{b.RouterController.replace("UpdateEmailWallet",b.RouterController.state.data)}}};rj=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
2052);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-update-email-secondary-otp-view")],rj);var rU=R;let rM=U.css`
2053  :host > wui-flex {
2054    max-height: clamp(360px, 540px, 80vh);
2055    overflow: scroll;
2056    scrollbar-width: none;
2057  }
2058
2059  :host > wui-flex::-webkit-scrollbar {
2060    display: none;
2061  }
2062`;var rq=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rW=class extends rU.LitElement{constructor(){super(...arguments),this.swapUnsupportedChain=b.RouterController.state.data?.swapUnsupportedChain,this.disconecting=!1}render(){return O.html`
2063      <wui-flex class="container" flexDirection="column" gap="0">
2064        <wui-flex
2065          class="container"
2066          flexDirection="column"
2067          .padding=${["m","xl","xs","xl"]}
2068          alignItems="center"
2069          gap="xl"
2070        >
2071          ${this.descriptionTemplate()}
2072        </wui-flex>
2073
2074        <wui-flex flexDirection="column" padding="s" gap="xs">
2075          ${this.networksTemplate()}
2076        </wui-flex>
2077
2078        <wui-separator text="or"></wui-separator>
2079        <wui-flex flexDirection="column" padding="s" gap="xs">
2080          <wui-list-item
2081            variant="icon"
2082            iconVariant="overlay"
2083            icon="disconnect"
2084            ?chevron=${!1}
2085            .loading=${this.disconecting}
2086            @click=${this.onDisconnect.bind(this)}
2087            data-testid="disconnect-button"
2088          >
2089            <wui-text variant="paragraph-500" color="fg-200">Disconnect</wui-text>
2090          </wui-list-item>
2091        </wui-flex>
2092      </wui-flex>
2093    `}descriptionTemplate(){return this.swapUnsupportedChain?O.html`
2094        <wui-text variant="small-400" color="fg-200" align="center">
2095          The swap feature doesn’t support your current network. Switch to an available option to
2096          continue.
2097        </wui-text>
2098      `:O.html`
2099      <wui-text variant="small-400" color="fg-200" align="center">
2100        This app doesn’t support your current network. Switch to an available option to continue.
2101      </wui-text>
2102    `}networksTemplate(){let e=_.NetworkController.getRequestedCaipNetworks(),t=_.NetworkController.state.approvedCaipNetworkIds,r=p.CoreHelperUtil.sortRequestedNetworks(t,e);return(this.swapUnsupportedChain?r.filter(e=>eh.ConstantsUtil.SWAP_SUPPORTED_NETWORKS.includes(e.id)):r).map(e=>O.html`
2103        <wui-list-network
2104          imageSrc=${E.AssetUtil.getNetworkImage(e)??O.nothing}
2105          name=${e.name??"Unknown"}
2106          @click=${()=>this.onSwitchNetwork(e)}
2107        >
2108        </wui-list-network>
2109      `)}async onDisconnect(){try{this.disconecting=!0,await h.ConnectionController.disconnect(),f.EventsController.sendEvent({type:"track",event:"DISCONNECT_SUCCESS"}),g.ModalController.close()}catch{f.EventsController.sendEvent({type:"track",event:"DISCONNECT_ERROR"}),v.SnackController.showError("Failed to disconnect")}finally{this.disconecting=!1}}async onSwitchNetwork(e){let t=c.AccountController.state.isConnected,r=_.NetworkController.state.approvedCaipNetworkIds,i=_.NetworkController.state.supportsAllNetworks,n=_.NetworkController.state.caipNetwork,s=b.RouterController.state.data;t&&n?.id!==e.id?r?.includes(e.id)?(await _.NetworkController.switchActiveNetwork(e),await tb()):i&&b.RouterController.push("SwitchNetwork",{...s,network:e}):t||(_.NetworkController.setActiveCaipNetwork(e),b.RouterController.push("Connect"))}};rW.styles=rM,rq([(0,$.state)()],rW.prototype,"disconecting",void 0),rW=rq([(0,P.customElement)("w3m-unsupported-chain-view")],rW);var rB=R;let rz=U.css`
2110  wui-compatible-network {
2111    margin-top: var(--wui-spacing-l);
2112  }
2113`;var rH=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
2113);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rK=class extends rB.LitElement{constructor(){super(),this.unsubscribe=[],this.address=c.AccountController.state.address,this.profileName=c.AccountController.state.profileName,this.network=_.NetworkController.state.caipNetwork,this.preferredAccountType=c.AccountController.state.preferredAccountType,this.unsubscribe.push(c.AccountController.subscribe(e=>{e.address?(this.address=e.address,this.profileName=e.profileName,this.preferredAccountType=e.preferredAccountType):v.SnackController.showError("Account not found")}),_.NetworkController.subscribeKey("caipNetwork",e=>{e?.id&&(this.network=e)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!this.address)throw Error("w3m-wallet-receive-view: No account provided");let e=E.AssetUtil.getNetworkImage(this.network);return O.html` <wui-flex
2114      flexDirection="column"
2115      .padding=${["0","l","l","l"]}
2116      alignItems="center"
2117    >
2118      <wui-chip-button
2119        data-testid="receive-address-copy-button"
2120        @click=${this.onCopyClick.bind(this)}
2121        text=${ed.UiHelperUtil.getTruncateString({string:this.profileName||this.address||"",charsStart:this.profileName?18:4,charsEnd:4*!this.profileName,truncate:this.profileName?"end":"middle"})}
2122        icon="copy"
2123        size="sm"
2124        imageSrc=${e||""}
2125        variant="gray"
2126      ></wui-chip-button>
2127      <wui-flex
2128        flexDirection="column"
2129        .padding=${["l","0","0","0"]}
2130        alignItems="center"
2131        gap="s"
2132      >
2133        <wui-qr-code
2134          size=${232}
2135          theme=${y.ThemeController.state.themeMode}
2136          uri=${this.address}
2137          ?arenaClear=${!0}
2138          data-testid="wui-qr-code"
2139        ></wui-qr-code>
2140        <wui-text variant="paragraph-500" color="fg-100" align="center">
2141          Copy your address or scan this QR code
2142        </wui-text>
2143      </wui-flex>
2144      ${this.networkTemplate()}
2145    </wui-flex>`}networkTemplate(){let e=_.NetworkController.getRequestedCaipNetworks(),t=_.NetworkController.checkIfSmartAccountEnabled(),r=_.NetworkController.state.caipNetwork;if(this.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT&&t)return r?O.html`<wui-compatible-network
2146        @click=${this.onReceiveClick.bind(this)}
2147        text="Only receive assets on this network"
2148        .networkImages=${[E.AssetUtil.getNetworkImage(r)??""]}
2149      ></wui-compatible-network>`:null;let i=(e?.filter(e=>e?.imageId)?.slice(0,5)).map(E.AssetUtil.getNetworkImage).filter(Boolean);return O.html`<wui-compatible-network
2150      @click=${this.onReceiveClick.bind(this)}
2151      text="Only receive assets on these networks"
2152      .networkImages=${i}
2153    ></wui-compatible-network>`}onReceiveClick(){b.RouterController.push("WalletCompatibleNetworks")}onCopyClick(){try{this.address&&(p.CoreHelperUtil.copyToClopboard(this.address),v.SnackController.showSuccess("Address copied"))}catch{v.SnackController.showError("Failed to copy")}}};rK.styles=rz,rH([(0,$.state)()],rK.prototype,"address",void 0),rH([(0,$.state)()],rK.prototype,"profileName",void 0),rH([(0,$.state)()],rK.prototype,"network",void 0),rH([(0,$.state)()],rK.prototype,"preferredAccountType",void 0),rK=rH([(0,P.customElement)("w3m-wallet-receive-view")],rK);var rV=R;let rF=U.css`
2154  :host > wui-flex {
2155    max-height: clamp(360px, 540px, 80vh);
2156    overflow: scroll;
2157    scrollbar-width: none;
2158  }
2159
2160  :host > wui-flex::-webkit-scrollbar {
2161    display: none;
2162  }
2163`;var rG=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rY=class extends rV.LitElement{constructor(){super(),this.unsubscribe=[],this.preferredAccountType=c.AccountController.state.preferredAccountType,this.unsubscribe.push(c.AccountController.subscribeKey("preferredAccountType",e=>{this.preferredAccountType=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html` <wui-flex
2164      flexDirection="column"
2165      .padding=${["xs","s","m","s"]}
2166      gap="xs"
2167    >
2168      <wui-banner
2169        icon="warningCircle"
2170        text="You can only receive assets on these networks"
2171      ></wui-banner>
2172      ${this.networkTemplate()}
2173    </wui-flex>`}networkTemplate(){let e=_.NetworkController.getRequestedCaipNetworks(),t=_.NetworkController.state.approvedCaipNetworkIds,r=_.NetworkController.state.caipNetwork,i=_.NetworkController.checkIfSmartAccountEnabled(),n=p.CoreHelperUtil.sortRequestedNetworks(t,e);if(i&&this.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT){if(!r)return null;n=[r]}return n.map(e=>O.html`
2174        <wui-list-network
2175          imageSrc=${E.AssetUtil.getNetworkImage(e)??O.nothing}
2176          name=${e.name??"Unknown"}
2177          ?transparent=${!0}
2178        >
2179        </wui-list-network>
2180      `)}};rY.styles=rF,rG([(0,$.state)()],rY.prototype,"preferredAccountType",void 0),rY=rG([(0,P.customElement)("w3m-wallet-compatible-networks-view")],rY);var rJ=R;let rZ=U.css`
2181  :host {
2182    display: block;
2183  }
2184
2185  wui-flex {
2186    position: relative;
2187  }
2188
2189  wui-icon-box {
2190    width: 40px;
2191    height: 40px;
2192    border-radius: var(--wui-border-radius-xs) !important;
2193    border: 5px solid var(--wui-color-bg-125);
2194    background: var(--wui-color-bg-175);
2195    position: absolute;
2196    top: 50%;
2197    left: 50%;
2198    transform: translate(-50%, -50%);
2199    z-index: 3;
2200  }
2201
2202  wui-button {
2203    --local-border-radius: var(--wui-border-radius-xs) !important;
2204  }
2205
2206  .inputContainer {
2207    height: fit-content;
2208  }
2209`;var rQ=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let rX=class extends rJ.LitElement{constructor(){super(),this.unsubscribe=[],this.token=eu.SendController.state.token,this.sendTokenAmount=eu.SendController.state.sendTokenAmount,this.receiverAddress=eu.SendController.state.receiverAddress,this.receiverProfileName=eu.SendController.state.receiverProfileName,this.loading=eu.SendController.state.loading,this.gasPriceInUSD=eu.SendController.state.gasPriceInUSD,this.gasPrice=eu.SendController.state.gasPrice,this.message="Preview Send",this.fetchNetworkPrice(),this.unsubscribe.push(eu.SendController.subscribe(e=>{this.token=e.token,this.sendTokenAmount=e.sendTokenAmount,this.receiverAddress=e.receiverAddress,this.gasPriceInUSD=e.gasPriceInUSD,this.receiverProfileName=e.receiverProfileName,this.loading=e.loading}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.getMessage(),O.html` <wui-flex flexDirection="column" .padding=${["0","l","l","l"]}>
2210      <wui-flex class="inputContainer" gap="xs" flexDirection="column">
2211        <w3m-input-token
2212          .token=${this.token}
2213          .sendTokenAmount=${this.sendTokenAmount}
2214          .gasPriceInUSD=${this.gasPriceInUSD}
2215          .gasPrice=${this.gasPrice}
2216        ></w3m-input-token>
2217        <wui-icon-box
2218          size="inherit"
2219          backgroundColor="fg-300"
2220          iconSize="lg"
2221          iconColor="fg-250"
2222          background="opaque"
2223          icon="arrowBottom"
2224        ></wui-icon-box>
2225        <w3m-input-address
2226          .value=${this.receiverProfileName?this.receiverProfileName:this.receiverAddress}
2227        ></w3m-input-address>
2228      </wui-flex>
2229      <wui-flex .margin=${["l","0","0","0"]}>
2230        <wui-button
2231          @click=${this.onButtonClick.bind(this)}
2232          ?disabled=${!this.message.startsWith("Preview Send")}
2233          size="lg"
2234          variant="main"
2235          ?loading=${this.loading}
2236          fullWidth
2237        >
2238          ${this.message}
2239        </wui-button>
2239
2240      </wui-flex>
2241    </wui-flex>`}async fetchNetworkPrice(){await tF.SwapController.getNetworkTokenPrice();let e=await tF.SwapController.getInitialGasPrice();e?.gasPrice&&e?.gasPriceInUSD&&(eu.SendController.setGasPrice(e.gasPrice),eu.SendController.setGasPriceInUsd(e.gasPriceInUSD))}onButtonClick(){b.RouterController.push("WalletSendPreview")}getMessage(){this.message="Preview Send",this.receiverAddress&&!p.CoreHelperUtil.isAddress(this.receiverAddress,m.ChainController.state.activeChain)&&(this.message="Invalid Address"),this.receiverAddress||(this.message="Add Address"),this.sendTokenAmount&&this.token&&this.sendTokenAmount>Number(this.token.quantity.numeric)&&(this.message="Insufficient Funds"),this.sendTokenAmount||(this.message="Add Amount"),this.sendTokenAmount&&this.token?.price&&(this.sendTokenAmount*this.token.price||(this.message="Incorrect Value")),this.token||(this.message="Select Token")}};rX.styles=rZ,rQ([(0,$.state)()],rX.prototype,"token",void 0),rQ([(0,$.state)()],rX.prototype,"sendTokenAmount",void 0),rQ([(0,$.state)()],rX.prototype,"receiverAddress",void 0),rQ([(0,$.state)()],rX.prototype,"receiverProfileName",void 0),rQ([(0,$.state)()],rX.prototype,"loading",void 0),rQ([(0,$.state)()],rX.prototype,"gasPriceInUSD",void 0),rQ([(0,$.state)()],rX.prototype,"gasPrice",void 0),rQ([(0,$.state)()],rX.prototype,"message",void 0),rX=rQ([(0,P.customElement)("w3m-wallet-send-view")],rX);var r0=R;let r1=U.css`
2242  .contentContainer {
2243    height: 440px;
2244    overflow: scroll;
2245    scrollbar-width: none;
2246  }
2247
2248  .contentContainer::-webkit-scrollbar {
2249    display: none;
2250  }
2251
2252  wui-icon-box {
2253    width: 40px;
2254    height: 40px;
2255    border-radius: var(--wui-border-radius-xxs);
2256  }
2257`;var r3=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let r2=class extends r0.LitElement{constructor(){super(),this.unsubscribe=[],this.tokenBalance=c.AccountController.state.tokenBalance,this.search="",this.onDebouncedSearch=p.CoreHelperUtil.debounce(e=>{this.search=e}),this.unsubscribe.push(c.AccountController.subscribe(e=>{this.tokenBalance=e.tokenBalance}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
2258      <wui-flex flexDirection="column">
2259        ${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
2260      </wui-flex>
2261    `}templateSearchInput(){return O.html`
2262      <wui-flex gap="xs" padding="s">
2263        <wui-input-text
2264          @inputChange=${this.onInputChange.bind(this)}
2265          class="network-search-input"
2266          size="sm"
2267          placeholder="Search token"
2268          icon="search"
2269        ></wui-input-text>
2270      </wui-flex>
2271    `}templateTokens(){return this.tokens=this.tokenBalance?.filter(e=>e.chainId===_.NetworkController.state.caipNetwork?.id),this.search?this.filteredTokens=this.tokenBalance?.filter(e=>e.name.toLowerCase().includes(this.search.toLowerCase())):this.filteredTokens=this.tokens,O.html`
2272      <wui-flex
2273        class="contentContainer"
2274        flexDirection="column"
2275        .padding=${["0","s","0","s"]}
2276      >
2277        <wui-flex justifyContent="flex-start" .padding=${["m","s","s","s"]}>
2278          <wui-text variant="paragraph-500" color="fg-200">Your tokens</wui-text>
2279        </wui-flex>
2280        <wui-flex flexDirection="column" gap="xs">
2281          ${this.filteredTokens&&this.filteredTokens.length>0?this.filteredTokens.map(e=>O.html`<wui-list-token
2282                    @click=${this.handleTokenClick.bind(this,e)}
2283                    ?clickable=${!0}
2284                    tokenName=${e.name}
2285                    tokenImageUrl=${e.iconUrl}
2286                    tokenAmount=${e.quantity.numeric}
2287                    tokenValue=${e.value}
2288                    tokenCurrency=${e.symbol}
2289                  ></wui-list-token>`):O.html`<wui-flex
2290                .padding=${["4xl","0","0","0"]}
2291                alignItems="center"
2292                flexDirection="column"
2293                gap="l"
2294              >
2295                <wui-icon-box
2296                  icon="coinPlaceholder"
2297                  size="inherit"
2298                  iconColor="fg-200"
2299                  backgroundColor="fg-200"
2300                  iconSize="lg"
2301                ></wui-icon-box>
2302                <wui-flex
2303                  class="textContent"
2304                  gap="xs"
2305                  flexDirection="column"
2306                  justifyContent="center"
2307                  flexDirection="column"
2308                >
2309                  <wui-text variant="paragraph-500" align="center" color="fg-100"
2310                    >No tokens found</wui-text
2311                  >
2312                  <wui-text variant="small-400" align="center" color="fg-200"
2313                    >Your tokens will appear here</wui-text
2314                  >
2315                </wui-flex>
2316                <wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
2317              </wui-flex>`}
2318        </wui-flex>
2319      </wui-flex>
2320    `}onBuyClick(){b.RouterController.push("OnRampProviders")}onInputChange(e){this.onDebouncedSearch(e.detail)}handleTokenClick(e){eu.SendController.setToken(e),eu.SendController.setTokenAmount(void 0),b.RouterController.goBack()}};r2.styles=r1,r3([(0,$.state)()],r2.prototype,"tokenBalance",void 0),r3([(0,$.state)()],r2.prototype,"tokens",void 0),r3([(0,$.state)()],r2.prototype,"filteredTokens",void 0),r3([(0,$.state)()],r2.prototype,"search",void 0),r2=r3([(0,P.customElement)("w3m-wallet-send-select-token-view")],r2);var r5=R;let r4=U.css`
2321  wui-avatar,
2322  wui-image {
2323    display: ruby;
2324    width: 32px;
2325    height: 32px;
2326    border-radius: var(--wui-border-radius-3xl);
2327  }
2328
2329  .sendButton {
2330    width: 70%;
2331    --local-width: 100% !important;
2332    --local-border-radius: var(--wui-border-radius-xs) !important;
2333  }
2334
2335  .cancelButton {
2336    width: 30%;
2337    --local-width: 100% !important;
2338    --local-border-radius: var(--wui-border-radius-xs) !important;
2339  }
2340`;var r6=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
2340);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let r8=class extends r5.LitElement{constructor(){super(),this.unsubscribe=[],this.token=eu.SendController.state.token,this.sendTokenAmount=eu.SendController.state.sendTokenAmount,this.receiverAddress=eu.SendController.state.receiverAddress,this.receiverProfileName=eu.SendController.state.receiverProfileName,this.receiverProfileImageUrl=eu.SendController.state.receiverProfileImageUrl,this.gasPriceInUSD=eu.SendController.state.gasPriceInUSD,this.caipNetwork=_.NetworkController.state.caipNetwork,this.unsubscribe.push(eu.SendController.subscribe(e=>{this.token=e.token,this.sendTokenAmount=e.sendTokenAmount,this.receiverAddress=e.receiverAddress,this.gasPriceInUSD=e.gasPriceInUSD,this.receiverProfileName=e.receiverProfileName,this.receiverProfileImageUrl=e.receiverProfileImageUrl}),_.NetworkController.subscribeKey("caipNetwork",e=>this.caipNetwork=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html` <wui-flex flexDirection="column" .padding=${["0","l","l","l"]}>
2341      <wui-flex gap="xs" flexDirection="column" .padding=${["0","xs","0","xs"]}>
2342        <wui-flex alignItems="center" justifyContent="space-between">
2343          <wui-flex flexDirection="column" gap="4xs">
2344            <wui-text variant="small-400" color="fg-150">Send</wui-text>
2345            ${this.sendValueTemplate()}
2346          </wui-flex>
2347          <wui-preview-item
2348            text="${this.sendTokenAmount?ed.UiHelperUtil.roundNumber(this.sendTokenAmount,6,5):"unknown"} ${this.token?.symbol}"
2349            .imageSrc=${this.token?.iconUrl}
2350          ></wui-preview-item>
2351        </wui-flex>
2352        <wui-flex>
2353          <wui-icon color="fg-200" size="md" name="arrowBottom"></wui-icon>
2354        </wui-flex>
2355        <wui-flex alignItems="center" justifyContent="space-between">
2356          <wui-text variant="small-400" color="fg-150">To</wui-text>
2357          <wui-preview-item
2358            text="${this.receiverProfileName?ed.UiHelperUtil.getTruncateString({string:this.receiverProfileName,charsStart:20,charsEnd:0,truncate:"end"}):ed.UiHelperUtil.getTruncateString({string:this.receiverAddress?this.receiverAddress:"",charsStart:4,charsEnd:4,truncate:"middle"})}"
2359            address=${this.receiverAddress??""}
2360            .imageSrc=${this.receiverProfileImageUrl??void 0}
2361            .isAddress=${!0}
2362          ></wui-preview-item>
2363        </wui-flex>
2364      </wui-flex>
2365      <wui-flex flexDirection="column" .padding=${["xxl","0","0","0"]}>
2366        <w3m-wallet-send-details
2367          .caipNetwork=${this.caipNetwork}
2368          .receiverAddress=${this.receiverAddress}
2369          .networkFee=${this.gasPriceInUSD}
2370        ></w3m-wallet-send-details>
2371        <wui-flex justifyContent="center" gap="xxs" .padding=${["s","0","0","0"]}>
2372          <wui-icon size="sm" color="fg-200" name="warningCircle"></wui-icon>
2373          <wui-text variant="small-400" color="fg-200">Review transaction carefully</wui-text>
2374        </wui-flex>
2375        <wui-flex justifyContent="center" gap="s" .padding=${["l","0","0","0"]}>
2376          <wui-button
2377            class="cancelButton"
2378            @click=${this.onCancelClick.bind(this)}
2379            size="lg"
2380            variant="neutral"
2381          >
2382            Cancel
2383          </wui-button>
2384          <wui-button
2385            class="sendButton"
2386            @click=${this.onSendClick.bind(this)}
2387            size="lg"
2388            variant="main"
2389          >
2390            Send
2391          </wui-button>
2392        </wui-flex>
2393      </wui-flex></wui-flex
2394    >`}sendValueTemplate(){if(this.token&&this.sendTokenAmount){let e=this.token.price*this.sendTokenAmount;return O.html`<wui-text variant="paragraph-400" color="fg-100"
2395        >$${e.toFixed(2)}</wui-text
2396      >`}return null}onSendClick(){eu.SendController.sendToken()}onCancelClick(){b.RouterController.goBack()}};r8.styles=r4,r6([(0,$.state)()],r8.prototype,"token",void 0),r6([(0,$.state)()],r8.prototype,"sendTokenAmount",void 0),r6([(0,$.state)()],r8.prototype,"receiverAddress",void 0),r6([(0,$.state)()],r8.prototype,"receiverProfileName",void 0),r6([(0,$.state)()],r8.prototype,"receiverProfileImageUrl",void 0),r6([(0,$.state)()],r8.prototype,"gasPriceInUSD",void 0),r6([(0,$.state)()],r8.prototype,"caipNetwork",void 0),r8=r6([(0,P.customElement)("w3m-wallet-send-preview-view")],r8);var r9=R;let r7=U.css`
2397  wui-flex {
2398    max-height: clamp(360px, 540px, 80vh);
2399    overflow: scroll;
2400    scrollbar-width: none;
2401  }
2402  wui-flex::-webkit-scrollbar {
2403    display: none;
2404  }
2405`,ie=class extends r9.LitElement{render(){return O.html`
2406      <wui-flex flexDirection="column" padding="s" gap="xs">
2407        <w3m-wallet-login-list></w3m-wallet-login-list>
2408      </wui-flex>
2409      <w3m-legal-footer></w3m-legal-footer>
2410    `}};ie.styles=r7,ie=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connect-wallets-view")],ie);var it=R;let ir=U.css`
2411  wui-flex {
2412    max-height: clamp(360px, 540px, 80vh);
2413    overflow: scroll;
2414    scrollbar-width: none;
2415  }
2416  wui-flex::-webkit-scrollbar {
2417    display: none;
2418  }
2419`,ii=class extends it.LitElement{render(){return O.html`
2420      <wui-flex flexDirection="column" padding="s" gap="xs">
2421        <w3m-social-login-list></w3m-social-login-list>
2422      </wui-flex>
2423      <w3m-legal-footer></w3m-legal-footer>
2424    `}};ii.styles=ir,ii=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connect-socials-view")],ii);var is=R;let io=U.css`
2425  wui-logo {
2426    width: 80px;
2427    height: 80px;
2428    border-radius: var(--wui-border-radius-m);
2429  }
2430  @keyframes shake {
2431    0% {
2432      transform: translateX(0);
2433    }
2434    25% {
2435      transform: translateX(3px);
2436    }
2437    50% {
2438      transform: translateX(-3px);
2439    }
2440    75% {
2441      transform: translateX(3px);
2442    }
2443    100% {
2444      transform: translateX(0);
2445    }
2446  }
2447  wui-flex:first-child:not(:only-child) {
2448    position: relative;
2449  }
2450  wui-loading-thumbnail {
2451    position: absolute;
2452  }
2453  wui-icon-box {
2454    position: absolute;
2455    right: calc(var(--wui-spacing-3xs) * -1);
2456    bottom: calc(var(--wui-spacing-3xs) * -1);
2457    opacity: 0;
2458    transform: scale(0.5);
2459    transition: all var(--wui-ease-out-power-2) var(--wui-duration-lg);
2460  }
2461  wui-text[align='center'] {
2462    width: 100%;
2463    padding: 0px var(--wui-spacing-l);
2464  }
2465  [data-error='true'] wui-icon-box {
2466    opacity: 1;
2467    transform: scale(1);
2468  }
2469  [data-error='true'] > wui-flex:first-child {
2470    animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
2471  }
2472  .capitalize {
2473    text-transform: capitalize;
2474  }
2475`;var ia=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let il=class extends is.LitElement{constructor(){super(),this.unsubscribe=[],this.socialProvider=c.AccountController.state.socialProvider,this.socialWindow=c.AccountController.state.socialWindow,this.error=!1,this.connecting=!1,this.message="Connect in the provider window",this.authConnector=d.ConnectorController.getAuthConnector(),this.handleSocialConnection=async e=>{if(e.data?.resultUri)if(e.origin===X.SECURE_SITE_ORIGIN){window.removeEventListener("message",this.handleSocialConnection,!1);try{if(this.authConnector&&!this.connecting){this.socialWindow&&(this.socialWindow.close(),c.AccountController.setSocialWindow(void 0,m.ChainController.state.activeChain)),this.connecting=!0,this.updateMessage();let t=e.data.resultUri;await this.authConnector.provider.connectSocial(t),this.socialProvider&&(ec.StorageUtil.setConnectedSocialProvider(this.socialProvider),await h.ConnectionController.connectExternal(this.authConnector,this.authConnector.chain),f.EventsController.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}))}}catch(e){this.error=!0,this.updateMessage(),this.socialProvider&&f.EventsController.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}})}}else b.RouterController.goBack(),v.SnackController.showError("Untrusted Origin"),this.socialProvider&&f.EventsController.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider}})},this.unsubscribe.push(c.AccountController.subscribe(e=>{e.socialProvider&&(this.socialProvider=e.socialProvider),e.socialWindow&&(this.socialWindow=e.socialWindow),e.address&&g.ModalController.state.open&&g.ModalController.close()})),this.authConnector&&this.connectSocial()}
2475disconnectedCallback(){this.unsubscribe.forEach(e=>e()),window.removeEventListener("message",this.handleSocialConnection,!1)}render(){return O.html`
2476      <wui-flex
2477        data-error=${this.error??O.nothing}
2478        flexDirection="column"
2479        alignItems="center"
2480        .padding=${["3xl","xl","xl","xl"]}
2481        gap="xl"
2482      >
2483        <wui-flex justifyContent="center" alignItems="center">
2484          <wui-logo logo=${this.socialProvider??O.nothing}></wui-logo>
2485          ${this.error?null:this.loaderTemplate()}
2486          <wui-icon-box
2487            backgroundColor="error-100"
2488            background="opaque"
2489            iconColor="error-100"
2490            icon="close"
2491            size="sm"
2492            border
2493            borderColor="wui-color-bg-125"
2494          ></wui-icon-box>
2495        </wui-flex>
2496        <wui-flex flexDirection="column" alignItems="center" gap="xs">
2497          <wui-text align="center" variant="paragraph-500" color="fg-100"
2498            >Log in with
2499            <span class="capitalize">${this.socialProvider??"Social"}</span></wui-text
2500          >
2501          <wui-text align="center" variant="small-400" color=${this.error?"error-100":"fg-200"}
2502            >${this.message}</wui-text
2503          ></wui-flex
2504        >
2505      </wui-flex>
2506    `}loaderTemplate(){let e=y.ThemeController.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return O.html`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}connectSocial(){let e=setInterval(()=>{this.socialWindow?.closed&&(this.connecting||"ConnectingSocial"!==b.RouterController.state.view||b.RouterController.goBack(),clearInterval(e))},1e3);window.addEventListener("message",this.handleSocialConnection,!1)}updateMessage(){this.error?this.message="Something went wrong":this.connecting?this.message="Retrieving user data":this.message="Connect in the provider window"}};il.styles=io,ia([(0,$.state)()],il.prototype,"socialProvider",void 0),ia([(0,$.state)()],il.prototype,"socialWindow",void 0),ia([(0,$.state)()],il.prototype,"error",void 0),ia([(0,$.state)()],il.prototype,"connecting",void 0),ia([(0,$.state)()],il.prototype,"message",void 0),il=ia([(0,P.customElement)("w3m-connecting-social-view")],il);var ic=R;let iu=U.css`
2507  wui-flex {
2508    width: 100%;
2509  }
2510
2511  wui-icon-link {
2512    margin-right: calc(var(--wui-icon-box-size-md) * -1);
2513  }
2514
2515  .account-links {
2516    display: flex;
2517    justify-content: space-between;
2518    align-items: center;
2519  }
2520
2521  .account-links wui-flex {
2522    cursor: pointer;
2523    display: flex;
2524    align-items: center;
2525    justify-content: center;
2526    flex: 1;
2527    background: red;
2528    align-items: center;
2529    justify-content: center;
2530    height: 48px;
2531    padding: 10px;
2532    flex: 1 0 0;
2533
2534    border-radius: var(--XS, 16px);
2535    border: 1px solid var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1));
2536    background: var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1));
2537    transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md);
2538    will-change: background-color;
2539  }
2540
2541  .account-links wui-flex:hover {
2542    background: var(--dark-accent-glass-015, rgba(71, 161, 255, 0.15));
2543  }
2544
2545  .account-links wui-flex wui-icon {
2546    width: var(--S, 20px);
2547    height: var(--S, 20px);
2548  }
2549
2550  .account-links wui-flex wui-icon svg path {
2551    stroke: #47a1ff;
2552  }
2553
2554  .account-settings-button {
2555    padding: calc(var(--wui-spacing-m) - 1px) var(--wui-spacing-2l);
2556    height: 40px;
2557    border-radius: var(--wui-border-radius-xxs);
2558    border: 1px solid var(--wui-color-gray-glass-002);
2559    background: var(--wui-color-gray-glass-002);
2560    cursor: pointer;
2561  }
2562
2563  .account-settings-button:hover {
2564    background: var(--wui-color-gray-glass-005);
2565  }
2566`;var ih=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let id=class extends ic.LitElement{constructor(){super(),this.usubscribe=[],this.address=c.AccountController.state.address,this.profileImage=c.AccountController.state.profileImage,this.profileName=c.AccountController.state.profileName,this.accounts=c.AccountController.state.allAccounts,this.usubscribe.push(c.AccountController.subscribeKey("address",e=>{e?this.address=e:g.ModalController.close()})),this.usubscribe.push(c.AccountController.subscribeKey("profileImage",e=>{this.profileImage=e})),this.usubscribe.push(c.AccountController.subscribeKey("profileName",e=>{this.profileName=e}))}
2566disconnectedCallback(){this.usubscribe.forEach(e=>e())}render(){if(!this.address)throw Error("w3m-profile-view: No account provided");let e=this.profileName?.split(".")[0];return O.html`
2567      <wui-flex flexDirection="column" gap="l" .padding=${["0","xl","m","xl"]}>
2568        <wui-flex flexDirection="column" alignItems="center" gap="l">
2569          <wui-avatar
2570            alt=${this.address}
2571            address=${this.address}
2572            imageSrc=${this.profileImage??O.nothing}
2573            size="2lg"
2574          ></wui-avatar>
2575          <wui-flex flexDirection="column" alignItems="center">
2576            <wui-flex gap="3xs" alignItems="center" justifyContent="center">
2577              <wui-text variant="title-6-600" color="fg-100" data-testid="account-settings-address">
2578                ${e?ed.UiHelperUtil.getTruncateString({string:e,charsStart:20,charsEnd:0,truncate:"end"}):ed.UiHelperUtil.getTruncateString({string:this.address,charsStart:4,charsEnd:6,truncate:"middle"})}
2579              </wui-text>
2580              <wui-icon-link
2581                size="md"
2582                icon="copy"
2583                iconColor="fg-200"
2584                @click=${this.onCopyAddress}
2585              ></wui-icon-link>
2586            </wui-flex>
2587          </wui-flex>
2588        </wui-flex>
2589        <wui-flex
2590          data-testid="account-settings-button"
2591          justifyContent="center"
2592          alignItems="center"
2593          class="account-settings-button"
2594          @click=${()=>b.RouterController.push("AccountSettings")}
2595        >
2596          <wui-text variant="paragraph-500" color="fg-100">Account Settings</wui-text>
2597        </wui-flex>
2598        ${this.accountsTemplate()}
2599      </wui-flex>
2600    `}accountsTemplate(){return O.html`<wui-flex flexDirection="column">
2601      <wui-flex .padding=${["3xs","m","s","s"]}>
2602        <wui-text color="fg-200" variant="paragraph-400">Your accounts</wui-text>
2603      </wui-flex>
2604      <wui-flex flexDirection="column" gap="xxs">
2605        ${this.accounts.map(e=>this.accountTemplate(e))}
2606      </wui-flex>
2607    </wui-flex>`}async onSwitchAccount(e){c.AccountController.setShouldUpdateToAddress(e.address,m.ChainController.state.activeChain);let t=d.ConnectorController.getAuthConnector();t&&(await t.provider.setPreferredAccount(e.type),await t.provider.connect())}accountTemplate(e){return O.html`<wui-list-account accountAddress=${e.address} accountType=${e.type}>
2608      ${e.address===this.address?"":O.html`<wui-button
2609            slot="action"
2610            textVariant="small-600"
2611            size="sm"
2612            variant="accent"
2613            @click=${()=>this.onSwitchAccount(e)}
2614            >Switch</wui-button
2615          >`}
2616    </wui-list-account>`}onCopyAddress(){try{this.profileName?(p.CoreHelperUtil.copyToClopboard(this.profileName),v.SnackController.showSuccess("Name copied")):this.address&&(p.CoreHelperUtil.copyToClopboard(this.address),v.SnackController.showSuccess("Address copied"))}catch{v.SnackController.showError("Failed to copy")}}};id.styles=iu,ih([(0,$.state)()],id.prototype,"address",void 0),ih([(0,$.state)()],id.prototype,"profileImage",void 0),ih([(0,$.state)()],id.prototype,"profileName",void 0),ih([(0,$.state)()],id.prototype,"accounts",void 0),id=ih([(0,P.customElement)("w3m-profile-view")],id);var ip=R;let ig=U.css`
2617  input[type='checkbox'] {
2618    all: revert;
2619    width: var(--wui-spacing-xl);
2620    height: var(--wui-spacing-xl);
2621    accent-color: var(--wui-color-accent-100);
2622  }
2623`;var im=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let iw=class extends ip.LitElement{constructor(){super(),this.metadata=x.OptionsController.state.metadata,this.allAccounts=c.AccountController.state.allAccounts,this.selectedAccounts=c.AccountController.state.allAccounts,this.selectAll=!0,this.approved=!1,this.isApproving=!1,this.getAddressTemplate=e=>{let t=this.selectedAccounts.some(t=>t.address===e.address);return O.html`<wui-list-account accountAddress="${e.address}" accountType="${e.type}">
2624      <input
2625        id="${e.address}"
2626        slot="action"
2627        type="checkbox"
2628        .checked="${t}"
2629        @change="${this.handleClick(e)}"
2630      />
2631    </wui-list-account>`},this.onSelectAll=e=>{let t=e.target.checked;this.selectAll=this.selectedAccounts.length===this.allAccounts.length,this.allAccounts.forEac
2631h(e=>{this.onSelect(e,t)})},this.onSelect=(e,t)=>{t?this.selectedAccounts.push(e):this.selectedAccounts=this.selectedAccounts.filter(t=>t.address!==e.address),this.selectedAccounts.length>0&&(this.selectAll=this.selectedAccounts.length===this.allAccounts.length)},c.AccountController.subscribeKey("allAccounts",e=>{this.allAccounts=e})}render(){return O.html`
2632    <wui-flex justifyContent="center" .padding=${["xl","0","xl","0"]}>
2633      <wui-banner-img imageSrc="${this.metadata?.icons[0]??O.nothing}" text="${this.metadata?.url??O.nothing}" size="sm"></wui-banner>
2634    </wui-flex>
2635    <wui-flex .padding=${["0","xl","0","xl"]} flexDirection="row" justifyContent="space-between">
2636        <wui-text variant="paragraph-400" color="fg-200">Select all</wui-text>
2637        <input type="checkbox" .checked=${this.selectAll}  @click=${this.onSelectAll.bind(this)} />
2638    </wui-flex>
2639      <wui-flex flexDirection="column" .padding=${["l","xl","xl","xl"]}>
2640        ${this.allAccounts.map(e=>this.getAddressTemplate(e))}
2641      </wui-flex>
2642      <wui-flex .padding=${["l","xl","xl","xl"]}
2642 gap="s" justifyContent="space-between">
2643        <wui-button
2644          size="md"
2645          ?fullwidth=${!0}
2646          variant="neutral"
2647          @click=${this.onCancel.bind(this)}
2648          data-testid="w3m-connecting-siwe-cancel"
2649        >
2650          Cancel
2651        </wui-button>
2652        <wui-button
2653          size="md"
2654          ?fullwidth=${!0}
2655          variant="main"
2656          .disabled=${0===this.selectedAccounts.length}
2657          @click=${this.onContinue.bind(this)}
2658          ?loading=${this.isApproving}
2659        >
2660          ${this.isApproving?"Signing...":"Continue"}
2661        </wui-button>
2662      </wui-flex>
2663    `}handleClick(e){return t=>{let r=t.target;this.onSelect?.({...e},r?.checked)}}onContinue(){this.selectedAccounts.length>0?(this.isApproving=!0,c.AccountController.setAllAccounts(this.selectedAccounts,m.ChainController.state.activeChain),c.AccountController.setShouldUpdateToAddress(this.selectedAccounts[0]?.address??"",m.ChainController.state.activeChain),this.approved=!0,this.isApproving=!1,g.ModalController.close()):this.onCancel()}async onCancel(){let{isConnected:e}=c.AccountController.state;e?(await h.ConnectionController.disconnect(),g.ModalController.close()):b.RouterController.push("Connect")}disconnectedCallback(){super.disconnectedCallback(),this.approved||this.onCancel()}};iw.styles=ig,im([(0,$.state)()],iw.prototype,"allAccounts",void 0),im([(0,$.state)()],iw.prototype,"selectedAccounts",void 0),im([(0,$.state)()],iw.prototype,"selectAll",void 0),im([(0,$.state)()],iw.prototype,"approved",void 0),im([(0,$.state)()],iw.prototype,"isApproving",void 0),iw=im([(0,P.customElement)("w3m-select-addresses-view")],iw);var iy=R;let iv=U.css`
2664  wui-avatar {
2665    width: var(--wui-spacing-3xl);
2666    height: var(--wui-spacing-3xl);
2667    box-shadow: 0 0 0 0;
2668  }
2669
2670  wui-icon-box {
2671    position: relative;
2672    right: 15px;
2673    top: 15px;
2674    border: 2px solid var(--wui-color-bg-150);
2675    background-color: var(--wui-color-bg-125);
2676  }
2677`;var ib=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let iC=class extends iy.LitElement{constructor(){super(),this.metadata=x.OptionsController.state.metadata,this.allAccounts=c.AccountController.state.allAccounts||[],this.balances={},this.labels=c.AccountController.state.addressLabels,this.currentAddress=c.AccountController.state.address||"",this.connectedConnector=ec.StorageUtil.getConnectedConnector(),this.shouldShowIcon="AUTH"===this.connectedConnector,this.caipNetwork=_.NetworkController.state.caipNetwork,c.AccountController.subscribeKey("allAccounts",e=>{this.allAccounts=e})}connectedCallback(){super.connectedCallback(),this.allAccounts.forEach(e=>{u.BlockchainApiController.getBalance(e.address,this.caipNetwork?.id).then(t=>{let r=this.balances[e.address]||0;t.balances.length>0&&(r=t.balances.reduce((e,t)=>e+(t?.value||0),0)),this.balances[e.address]=r,this.requestUpdate()})})}getAddressIcon(e){return"smartAccount"===e?"lightbulb":"mail"}render(){return O.html`
2678      <wui-flex justifyContent="center" .padding=${["xl","0","xl","0"]}>
2679        <wui-banner-img
2680          imageSrc=${this.metadata?.icons[0]??O.nothing}
2681          text=${this.metadata?.url??O.nothing}
2682          size="sm"
2683        ></wui-banner-img>
2684      </wui-flex>
2685      <wui-flex flexDirection="column" gap="xxl" .padding=${["l","xl","xl","xl"]}>
2686        ${this.allAccounts.map((e,t)=>this.getAddressTemplate(e,t))}
2687      </wui-flex>
2688    `}getAddressTemplate(e,t){let r=this.labels?.get(e.address);return O.html`
2689      <wui-flex
2690        flexDirection="row"
2691        justifyContent="space-between"
2692        data-testid="switch-address-item"
2693      >
2694        <wui-flex alignItems="center">
2695          <wui-avatar address=${e.address}></wui-avatar>
2696          ${this.shouldShowIcon?O.html`<wui-icon-box
2697                size="sm"
2698                iconcolor="fg-200"
2699                backgroundcolor="glass-002"
2700                background="gray"
2701                icon="${this.getAddressIcon(e.type)}"
2702                ?border=${!0}
2703              ></wui-icon-box>`:O.html`<wui-flex .padding="${["0","0","0","s"]}"></wui-flex>`}
2704          <wui-flex flexDirection="column">
2705            <wui-text class="address" variant="paragraph-500" color="fg-100"
2706              >${r||ed.UiHelperUtil.getTruncateString({string:e.address,charsStart:4,charsEnd:6,truncate:"middle"})}</wui-text
2707            >
2708            <wui-text class="address-description" variant="small-400">
2709              ${"number"==typeof this.balances[e.address]?`$${this.balances[e.address]?.toFixed(2)}`:O.html`<wui-loading-spinner size="sm" color="accent-100"></wui-loading-spinner>`}
2710            </wui-text>
2711          </wui-flex>
2712        </wui-flex>
2713        <wui-flex gap="s" alignItems="center">
2714          ${e.address?.toLowerCase()===this.currentAddress?.toLowerCase()?"":O.html`
2715                <wui-button
2716                  data-testid=${`w3m-switch-address-button-${t}`}
2717                  textVariant="small-600"
2718                  size="md"
2719                  variant="accent"
2720                  @click=${()=>this.onSwitchAddress(e.address)}
2721                  >Switch to</wui-button
2722                >
2723              `}
2724        </wui-flex>
2725      </wui-flex>
2726    `}onSwitchAddress(e){c.AccountController.setShouldUpdateToAddress(e,m.ChainController.state.activeChain),g.ModalController.close()}};iC.styles=iv,ib([(0,$.state)()],iC.prototype,"allAccounts",void 0),ib([(0,$.state)()],iC.prototype,"balances",void 0),iC=ib([(0,P.customElement)("w3m-switch-address-view")],iC);var ix=R;let i_=U.css`
2727  @keyframes fadein {
2728    from {
2729      opacity: 0;
2730    }
2731    to {
2732      opacity: 1;
2733    }
2734  }
2735
2736  wui-shimmer {
2737    width: 100%;
2738    aspect-ratio: 1 / 1;
2739    border-radius: clamp(0px, var(--wui-border-radius-l), 40px) !important;
2740  }
2741
2742  wui-qr-code {
2743    opacity: 0;
2744    animation-duration: 200ms;
2745    animation-timing-function: ease;
2746    animation-name: fadein;
2747    animation-fill-mode: forwards;
2748  }
2749
2750  wui-logo {
2751    width: 80px;
2752    height: 80px;
2753    border-radius: var(--wui-border-radius-m);
2754  }
2755
2756  wui-flex:first-child:not(:only-child) {
2757    position: relative;
2758  }
2759  wui-loading-thumbnail {
2760    position: absolute;
2761  }
2762  wui-icon-box {
2763    position: absolute;
2764    right: calc(var(--wui-spacing-3xs) * -1);
2765    bottom: calc(var(--wui-spacing-3xs) * -1);
2766    opacity: 0;
2767    transform: scale(0.5);
2768    transition: all var(--wui-ease-out-power-2) var(--wui-duration-lg);
2769  }
2770`;var iE=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
2770);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let ik=class extends ix.LitElement{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.socialProvider=c.AccountController.state.socialProvider,this.uri=c.AccountController.state.farcasterUrl,this.ready=!1,this.loading=!1,this.authConnector=d.ConnectorController.getAuthConnector(),this.forceUpdate=()=>{this.requestUpdate()},this.unsubscribe.push(c.AccountController.subscribeKey("farcasterUrl",e=>{e&&(this.uri=e,this.connectFarcaster())}),c.AccountController.subscribeKey("socialProvider",e=>{e&&(this.socialProvider=e)})),window.addEventListener("resize",this.forceUpdate)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.timeout),window.removeEventListener("resize",this.forceUpdate)}render(){return this.onRenderProxy(),O.html`${this.platformTemplate()}`}platformTemplate(){return p.CoreHelperUtil.isMobile()?O.html`${this.mobileTemplate()}`:O.html`${this.desktopTemplate()}`}desktopTemplate(){return this.loading?O.html`${this.loadingTemplate()}`:O.html`${this.qrTemplate()}`}qrTemplate(){return O.html` <wui-flex
2771      flexDirection="column"
2772      alignItems="center"
2773      .padding=${["0","xl","xl","xl"]}
2774      gap="xl"
2775    >
2776      <wui-shimmer borderRadius="l" width="100%"> ${this.qrCodeTemplate()} </wui-shimmer>
2777
2778      <wui-text variant="paragraph-500" color="fg-100">
2779        Scan this QR Code with your phone
2780      </wui-text>
2781      ${this.copyTemplate()}
2782    </wui-flex>`}loadingTemplate(){return O.html`
2783      <wui-flex
2784        flexDirection="column"
2785        alignItems="center"
2786        .padding=${["xl","xl","xl","xl"]}
2787        gap="xl"
2788      >
2789        <wui-flex justifyContent="center" alignItems="center">
2790          <wui-logo logo="farcaster"></wui-logo>
2791          ${this.loaderTemplate()}
2792          <wui-icon-box
2793            backgroundColor="error-100"
2794            background="opaque"
2795            iconColor="error-100"
2796            icon="close"
2797            size="sm"
2798            border
2799            borderColor="wui-color-bg-125"
2800          ></wui-icon-box>
2801        </wui-flex>
2802        <wui-flex flexDirection="column" alignItems="center" gap="xs">
2803          <wui-text align="center" variant="paragraph-500" color="fg-100">
2804            Loading user data
2805          </wui-text>
2806          <wui-text align="center" variant="small-400" color="fg-200">
2807            Please wait a moment while we load your data.
2808          </wui-text>
2809        </wui-flex>
2810      </wui-flex>
2811    `}mobileTemplate(){return O.html` <wui-flex
2812      flexDirection="column"
2813      alignItems="center"
2814      .padding=${["3xl","xl","xl","xl"]}
2815      gap="xl"
2816    >
2817      <wui-flex justifyContent="center" alignItems="center">
2818        <wui-logo logo="farcaster"></wui-logo>
2819        ${this.loaderTemplate()}
2820        <wui-icon-box
2821          backgroundColor="error-100"
2822          background="opaque"
2823          iconColor="error-100"
2824          icon="close"
2825          size="sm"
2826          border
2827          borderColor="wui-color-bg-125"
2828        ></wui-icon-box>
2829      </wui-flex>
2830      <wui-flex flexDirection="column" alignItems="center" gap="xs">
2831        <wui-text align="center" variant="paragraph-500" color="fg-100"
2832          >Continue in Farcaster</span></wui-text
2833        >
2834        <wui-text align="center" variant="small-400" color="fg-200"
2835          >Accept connection request in the app</wui-text
2836        ></wui-flex
2837      >
2838      ${this.mobileLinkTemplate()}
2839    </wui-flex>`}loaderTemplate(){let e=y.ThemeController.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return O.html`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}async connectFarcaster(){if(this.authConnector)try{await this.authConnector?.provider.connectFarcaster(),this.socialProvider&&ec.StorageUtil.setConnectedSocialProvider(this.socialProvider),this.loading=!0,await h.ConnectionController.connectExternal(this.authConnector,this.authConnector.chain),this.loading=!1,g.ModalController.close()}catch(e){b.RouterController.goBack(),v.SnackController.showError(e)}}mobileLinkTemplate(){return O.html`<wui-button
2840      size="md"
2841      ?loading=${this.loading}
2842      ?disabled=${!this.uri||this.loading}
2843      @click=${()=>{this.uri&&p.CoreHelperUtil.openHref(this.uri,"_blank")}}
2844    >
2845      Open farcaster</wui-button
2846    >`}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},0))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;let e=this.getBoundingClientRect().width-40;return O.html` <wui-qr-code
2847      size=${e}
2848      theme=${y.ThemeController.state.themeMode}
2849      uri=${this.uri}
2850      ?farcaster=${!0}
2851      data-testid="wui-qr-code"
2852    ></wui-qr-code>`}copyTemplate(){let e=!this.uri||!this.ready;return O.html`<wui-link
2853      .disabled=${e}
2854      @click=${this.onCopyUri}
2855      color="fg-200"
2856      data-testid="copy-wc2-uri"
2857    >
2858      <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
2859      Copy link
2860    </wui-link>`}onCopyUri(){try{this.uri&&(p.CoreHelperUtil.copyToClopboard(this.uri),v.SnackController.showSuccess("Link copied"))}catch{v.SnackController.showError("Failed to copy")}}};ik.styles=i_,iE([(0,$.state)()],ik.prototype,"socialProvider",void 0),iE([(0,$.state)()],ik.prototype,"uri",void 0),iE([(0,$.state)()],ik.prototype,"ready",void 0),iE([(0,$.state)()],ik.prototype,"loading",void 0),ik=iE([(0,P.customElement)("w3m-connecting-farcaster-view")],ik);var iS=R;let iI=U.css`
2861  wui-grid {
2862    max-height: clamp(360px, 400px, 80vh);
2863    overflow: scroll;
2864    scrollbar-width: none;
2865    grid-auto-rows: min-content;
2866    grid-template-columns: repeat(auto-fill, 76px);
2867  }
2868
2869  @media (max-width: 435px) {
2870    wui-grid {
2871      grid-template-columns: repeat(auto-fill, 77px);
2872    }
2873  }
2874
2875  wui-grid[data-scroll='false'] {
2876    overflow: hidden;
2877  }
2878
2879  wui-grid::-webkit-scrollbar {
2880    display: none;
2881  }
2882
2883  wui-loading-spinner {
2884    padding-top: var(--wui-spacing-l);
2885    padding-bottom: var(--wui-spacing-l);
2886    justify-content: center;
2887    grid-column: 1 / span 4;
2888  }
2889`;function iA(e){let{connectors:t}=d.ConnectorController.state,r=t.filter(e=>"ANNOUNCED"===e.type).reduce((e,t)=>(t.info?.rdns&&(e[t.info.rdns]=!0),e),{});return e.map(e=>({...e,installed:!!e.rdns&&!!r[e.rdns??""]})).sort((e,t)=>Number(t.installed)-Number(e.installed))}var iT=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let iP="local-paginator",iR=class extends iS.LitElement{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.initial=!e5.ApiController.state.wallets.length,this.wallets=e5.ApiController.state.wallets,this.recommended=e5.ApiController.state.recommended,this.featured=e5.ApiController.state.featured,this.unsubscribe.push(e5.ApiController.subscribeKey("wallets",e=>this.wallets=e),e5.ApiController.subscribeKey("recommended",e=>this.recommended=e),e5.ApiController.subscribeKey("featured",e=>this.featured=e))}firstUpdated(){this.initialFetch(),this.createPaginationObserver()}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),this.paginationObserver?.disconnect()}render(){return O.html`
2890      <wui-grid
2891        data-scroll=${!this.initial}
2892        .padding=${["0","s","s","s"]}
2893        columnGap="xxs"
2894        rowGap="l"
2895        justifyContent="space-between"
2896      >
2897        ${this.initial?this.shimmerTemplate(16):this.walletsTemplate()}
2898        ${this.paginationLoaderTemplate()}
2899      </wui-grid>
2900    `}async initialFetch(){let e=this.shadowRoot?.querySelector("wui-grid");this.initial&&e&&(await e5.ApiController.fetchWallets({page:1}),await e.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.initial=!1,e.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}shimmerTemplate(e,t){return[...Array(e)].map(()=>O.html`
2901        <wui-card-select-loader type="wallet" id=${t??O.nothing}></wui-card-select-loader>
2902      `)}walletsTemplate(){return iA([...this.featured,...this.recommended,...this.wallets]).map(e=>O.html`
2903        <w3m-all-wallets-list-item
2904          @click=${()=>this.onConnectWallet(e)}
2905          .wallet=${e}
2906        ></w3m-all-wallets-list-item>
2907      `)}paginationLoaderTemplate(){let{wallets:e,recommended:t,featured:r,count:i}=e5.ApiController.state,n=window.innerWidth<352?3:4,s=e.length+t.length,o=Math.ceil(s/n)*n-s+n;return(o-=e.length?r.length%n:0,0===i&&r.length>0)?null:0===i||[...r,...e,...t].length<i?this.shimmerTemplate(o,iP):null}createPaginationObserver(){let e=this.shadowRoot?.querySelector(`#${iP}`);e&&(this.paginationObserver=new IntersectionObserver(([e])=>{if(e?.isIntersecting&&!this.initial){let{page:e,count:t,wallets:r}=e5.ApiController.state;r.length<t&&e5.ApiController.fetchWallets({page:e+1})}}),this.paginationObserver.observe(e))}onConnectWallet(e){let t=d.ConnectorController.getConnector(e.id,e.rdns);t?b.RouterController.push("ConnectingExternal",{connector:t}):b.RouterController.push("ConnectingWalletConnect",{wallet:e})}};iR.styles=iI,iT([(0,$.state)()],iR.prototype,"initial",void 0),iT([(0,$.state)()],iR.prototype,"wallets",void 0),iT([(0,$.state)()],iR.prototype,"recommended",void 0),iT([(0,$.state)()],iR.prototype,"featured",void 0),iR=iT([(0,P.customElement)("w3m-all-wallets-list")],iR);var iO=R;let iN=U.css`
2908  button {
2909    display: flex;
2910    flex-direction: column;
2911    justify-content: center;
2912    align-items: center;
2913    width: 76px;
2914    row-gap: var(--wui-spacing-xs);
2915    padding: var(--wui-spacing-xs) var(--wui-spacing-0);
2916    background-color: var(--wui-color-gray-glass-002);
2917    border-radius: clamp(0px, var(--wui-border-radius-xs), 20px);
2918    will-change: background-color, color;
2919    outline: none;
2920    border: none;
2921  }
2922
2923  button > wui-text {
2924    color: var(--wui-color-fg-100);
2925    max-width: var(--wui-icon-box-size-xl);
2926    white-space: nowrap;
2927    overflow: hidden;
2928    text-overflow: ellipsis;
2929    justify-content: center;
2930  }
2931
2932  button:hover:enabled {
2933    background-color: var(--wui-color-gray-glass-005);
2934  }
2935
2936  button:disabled > wui-text {
2937    color: var(--wui-color-gray-glass-015);
2938  }
2939
2940  [data-selected='true'] {
2941    background-color: var(--wui-color-accent-glass-020);
2942  }
2943
2944  @media (hover: hover) and (pointer: fine) {
2945    [data-selected='true']:hover:enabled {
2946      background-color: var(--wui-color-accent-glass-015);
2947    }
2948  }
2949
2950  [data-selected='true']:active:enabled {
2951    background-color: var(--wui-color-accent-glass-010);
2952  }
2953`;var i$=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
2953);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let iD=class extends iO.LitElement{constructor(){super(),this.observer=new IntersectionObserver(()=>void 0),this.visible=!1,this.imageSrc=void 0,this.imageLoading=!1,this.wallet=void 0,this.observer=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?(this.visible=!0,this.fetchImageSrc()):this.visible=!1})},{threshold:.01})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){return O.html`
2954      <button ontouchstart>
2955        ${this.imageTemplate()}
2956        <wui-text variant="tiny-500" color="inherit">${this.wallet?.name}</wui-text>
2957      </button>
2958    `}imageTemplate(){return(this.visible||this.imageSrc)&&!this.imageLoading?O.html`
2959      <wui-wallet-image
2960        size="md"
2961        imageSrc=${this.imageSrc??O.nothing}
2962        name=${this.wallet?.name}
2963        .installed=${this.wallet?.installed}
2964        badgeSize="sm"
2965      >
2966      </wui-wallet-image>
2967    `:this.shimmerTemplate()}shimmerTemplate(){return O.html`<wui-shimmer width="56px" height="56px" borderRadius="xs"></wui-shimmer>`}async fetchImageSrc(){!this.wallet||(this.imageSrc=E.AssetUtil.getWalletImage(this.wallet),this.imageSrc||(this.imageLoading=!0,this.imageSrc=await E.AssetUtil.fetchWalletImage(this.wallet.image_id),this.imageLoading=!1))}};iD.styles=iN,i$([(0,$.state)()],iD.prototype,"visible",void 0),i$([(0,$.state)()],iD.prototype,"imageSrc",void 0),i$([(0,$.state)()],iD.prototype,"imageLoading",void 0),i$([(0,N.property)()],iD.prototype,"wallet",void 0),iD=i$([(0,P.customElement)("w3m-all-wallets-list-item")],iD);var iL=R;let ij=U.css`
2968  wui-grid,
2969  wui-loading-spinner,
2970  wui-flex {
2971    height: 360px;
2972  }
2973
2974  wui-grid {
2975    overflow: scroll;
2976    scrollbar-width: none;
2977    grid-auto-rows: min-content;
2978  }
2979
2980  wui-grid[data-scroll='false'] {
2981    overflow: hidden;
2982  }
2983
2984  wui-grid::-webkit-scrollbar {
2985    display: none;
2986  }
2987
2988  wui-loading-spinner {
2989    justify-content: center;
2990    align-items: center;
2991  }
2992`;var iU=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let iM=class extends iL.LitElement{constructor(){super(...arguments),this.prevQuery="",this.loading=!0,this.query=""}render(){return this.onSearch(),this.loading?O.html`<wui-loading-spinner color="accent-100"></wui-loading-spinner>`:this.walletsTemplate()}async onSearch(){this.query.trim()!==this.prevQuery.trim()&&(this.prevQuery=this.query,this.loading=!0,await e5.ApiController.searchWallet({search:this.query}),this.loading=!1)}walletsTemplate(){let{search:e}=e5.ApiController.state,t=iA(e);return e.length?O.html`
2993      <wui-grid
2994        .padding=${["0","s","s","s"]}
2995        gridTemplateColumns="repeat(4, 1fr)"
2996        rowGap="l"
2997        columnGap="xs"
2998      >
2999        ${t.map(e=>O.html`
3000            <w3m-all-wallets-list-item
3001              @click=${()=>this.onConnectWallet(e)}
3002              .wallet=${e}
3003            ></w3m-all-wallets-list-item>
3004          `)}
3005      </wui-grid>
3006    `:O.html`
3007        <wui-flex justifyContent="center" alignItems="center" gap="s" flexDirection="column">
3008          <wui-icon-box
3009            size="lg"
3010            iconColor="fg-200"
3011            backgroundColor="fg-300"
3012            icon="wallet"
3013            background="transparent"
3014          ></wui-icon-box>
3015          <wui-text color="fg-200" variant="paragraph-500">No Wallet found</wui-text>
3016        </wui-flex>
3017      `}onConnectWallet(e){let t=d.ConnectorController.getConnector(e.id,e.rdns);t?b.RouterController.push("ConnectingExternal",{connector:t}):b.RouterController.push("ConnectingWalletConnect",{wallet:e})}};iM.styles=ij,iU([(0,$.state)()],iM.prototype,"loading",void 0),iU([(0,N.property)()],iM.prototype,"query",void 0),iM=iU([(0,P.customElement)("w3m-all-wallets-search")],iM);var iq=R,iW=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let iB=class extends iq.LitElement{constructor(){super(),this.platformTabs=[],this.unsubscribe=[],this.platforms=[],this.onSelectPlatfrom=void 0,this.buffering=!1,this.unsubscribe.push(h.ConnectionController.subscribeKey("buffering",e=>this.buffering=e))}disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.generateTabs();return O.html`
3018      <wui-flex justifyContent="center" .padding=${["0","0","l","0"]}>
3019        <wui-tabs
3020          ?disabled=${this.buffering}
3021          .tabs=${e}
3022          .onTabChange=${this.onTabChange.bind(this)}
3023        ></wui-tabs>
3024      </wui-flex>
3025    `}generateTabs(){let e=this.platforms.map(e=>{if("browser"===e)return{label:"Browser",icon:"extension",platform:"browser"};if("mobile"===e)return{label:"Mobile",icon:"mobile",platform:"mobile"};if("qrcode"===e)return{label:"Mobile",icon:"mobile",platform:"qrcode"};if("web"===e)return{label:"Webapp",icon:"browser",platform:"web"};if("desktop"===e)return{label:"Desktop",icon:"desktop",platform:"desktop"};return{label:"Browser",icon:"extension",platform:"unsupported"}});return this.platformTabs=e.map(({platform:e})=>e),e}onTabChange(e){let t=this.platformTabs[e];t&&this.onSelectPlatfrom?.(t)}};iW([(0,N.property)({type:Array})],iB.prototype,"platforms",void 0),iW([(0,N.property)()],iB.prototype,"onSelectPlatfrom",void 0),iW([(0,$.state)()],iB.prototype,"buffering",void 0),iB=iW([(0,P.customElement)("w3m-connecting-header")],iB);let iz=class extends eB{constructor(){if(super(),!this.wallet)throw Error("w3m-connecting-wc-browser: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser"}})}async onConnectProxy(){try{this.error=!1;let{connectors:e}=d.ConnectorController.state,t=e.find(e=>
3025"ANNOUNCED"===e.type&&e.info?.rdns===this.wallet?.rdns||"INJECTED"===e.type||e.name===this.wallet?.name);if(t)await h.ConnectionController.connectExternal(t,t.chain);else throw Error("w3m-connecting-wc-browser: No connector found");g.ModalController.close(),f.EventsController.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"browser",name:this.wallet?.name||"Unknown"}})}catch(e){f.EventsController.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:e?.message??"Unknown"}}),this.error=!0}}};iz=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-wc-browser")],iz);let iH=class extends eB{constructor(){if(super(),!this.wallet)throw Error("w3m-connecting-wc-desktop: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onRender=this.onRenderProxy.bind(this),f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"desktop"}})}onRenderProxy(){!this.ready&&this.uri&&(this.ready=!0,this.onConnect?.())}onConnectProxy(){if(this.wallet?.desktop_link&&this.uri)try{this.error=!1;let{desktop_link:e,name:t}=this.wallet,{redirect:r,href:i}=p.CoreHelperUtil.formatNativeUrl(e,this.uri);
3025h.ConnectionController.setWcLinking({name:t,href:i}),h.ConnectionController.setRecentWallet(this.wallet),p.CoreHelperUtil.openHref(r,"_blank")}catch{this.error=!0}}};iH=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-wc-desktop")],iH);let iK=class extends eB{constructor(){if(super(),!this.wallet)throw Error("w3m-connecting-wc-mobile: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onRender=this.onRenderProxy.bind(this),document.addEventListener("visibilitychange",this.onBuffering.bind(this)),f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"mobile"}})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("visibilitychange",this.onBuffering.bind(this))}onRenderProxy(){!this.ready&&this.uri&&(this.ready=!0,this.onConnect?.())}onConnectProxy(){if(this.wallet?.mobile_link&&this.uri)try{this.error=!1;let{mobile_link:e,name:t}=this.wallet,{redirect:r,href:i}=p.CoreHelperUtil.formatNativeUrl(e,this.uri);
3025h.ConnectionController.setWcLinking({name:t,href:i}),h.ConnectionController.setRecentWallet(this.wallet),p.CoreHelperUtil.openHref(r,"_self")}catch{this.error=!0}}onBuffering(){let e=p.CoreHelperUtil.isIos();document?.visibilityState==="visible"&&!this.error&&e&&(h.ConnectionController.setBuffering(!0),setTimeout(()=>{h.ConnectionController.setBuffering(!1)},5e3))}};iK=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-wc-mobile")],iK);let iV=U.css`
3026  @keyframes fadein {
3027    from {
3028      opacity: 0;
3029    }
3030    to {
3031      opacity: 1;
3032    }
3033  }
3034
3035  wui-shimmer {
3036    width: 100%;
3037    aspect-ratio: 1 / 1;
3038    border-radius: clamp(0px, var(--wui-border-radius-l), 40px) !important;
3039  }
3040
3041  wui-qr-code {
3042    opacity: 0;
3043    animation-duration: 200ms;
3044    animation-timing-function: ease;
3045    animation-name: fadein;
3046    animation-fill-mode: forwards;
3047  }
3048`,iF=class extends eB{constructor(){super(),this.forceUpdate=()=>{this.requestUpdate()},window.addEventListener("resize",this.forceUpdate),f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet?.name??"WalletConnect",platform:"qrcode"}})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.forceUpdate)}render(){return this.onRenderProxy(),O.html`
3049      <wui-flex
3050        flexDirection="column"
3051        alignItems="center"
3052        .padding=${["0","xl","xl","xl"]}
3053        gap="xl"
3054      >
3055        <wui-shimmer borderRadius="l" width="100%"> ${this.qrCodeTemplate()} </wui-shimmer>
3056
3057        <wui-text variant="paragraph-500" color="fg-100">
3058          Scan this QR Code with your phone
3059        </wui-text>
3060        ${this.copyTemplate()}
3061      </wui-flex>
3062
3063      <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
3064    `}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},0))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;let e=this.getBoundingClientRect().width-40,t=this.wallet?this.wallet.name:void 0;return h.ConnectionController.setWcLinking(void 0),h.ConnectionController.setRecentWallet(this.wallet),O.html` <wui-qr-code
3065      size=${e}
3066      theme=${y.ThemeController.state.themeMode}
3067      uri=${this.uri}
3068      imageSrc=${E.AssetUtil.getWalletImage(this.wallet)??O.nothing}
3069      alt=${t??O.nothing}
3070      data-testid="wui-qr-code"
3071    ></wui-qr-code>`}copyTemplate(){let e=!this.uri||!this.ready;return O.html`<wui-link
3072      .disabled=${e}
3073      @click=${this.onCopyUri}
3074      color="fg-200"
3075      data-testid="copy-wc2-uri"
3076    >
3077      <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
3078      Copy link
3079    </wui-link>`}};iF.styles=iV,iF=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-wc-qrcode")],iF);var iG=R;let iY=class extends iG.LitElement{constructor(){if(super(),this.wallet=b.RouterController.state.data?.wallet,!this.wallet)throw Error("w3m-connecting-wc-unsupported: No wallet provided");f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser"}})}render(){return O.html`
3080      <wui-flex
3081        flexDirection="column"
3082        alignItems="center"
3083        .padding=${["3xl","xl","xl","xl"]}
3084        gap="xl"
3085      >
3086        <wui-wallet-image
3087          size="lg"
3088          imageSrc=${E.AssetUtil.getWalletImage(this.wallet)??O.nothing}
3089        ></wui-wallet-image>
3090
3091        <wui-text variant="paragraph-500" color="fg-100">Not Detected</wui-text>
3092      </wui-flex>
3093
3094      <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
3095    `}};iY=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-wc-unsupported")],iY);let iJ=class extends eB{constructor(){if(super(),!this.wallet)throw Error("w3m-connecting-wc-web: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.secondaryBtnLabel="Open",this.secondaryLabel="Open and continue in a new browser tab",this.secondaryBtnIcon="externalLink",f.EventsController.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"web"}})}onConnectProxy(){if(this.wallet?.webapp_link&&this.uri)try{this.error=!1;let{webapp_link:e,name:t}=this.wallet,{redirect:r,href:i}=p.CoreHelperUtil.formatUniversalUrl(e,this.uri);
3095h.ConnectionController.setWcLinking({name:t,href:i}),h.ConnectionController.setRecentWallet(this.wallet),p.CoreHelperUtil.openHref(r,"_blank")}catch{this.error=!0}}};iJ=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connecting-wc-web")],iJ);var iZ=R;let iQ=U.css`
3096  :host {
3097    width: 100%;
3098  }
3099
3100  .details-container > wui-flex {
3101    background: var(--wui-color-gray-glass-002);
3102    border-radius: var(--wui-border-radius-xxs);
3103    width: 100%;
3104  }
3105
3106  .details-container > wui-flex > button {
3107    border: none;
3108    background: none;
3109    padding: var(--wui-spacing-s);
3110    border-radius: var(--wui-border-radius-xxs);
3111    cursor: pointer;
3112  }
3113
3114  .details-content-container {
3115    padding: var(--wui-spacing-1xs);
3116    padding-top: 0px;
3117    display: flex;
3118    align-items: center;
3119    justify-content: center;
3120  }
3121
3122  .details-content-container > wui-flex {
3123    width: 100%;
3124  }
3125
3126  .details-row {
3127    width: 100%;
3128    padding: var(--wui-spacing-s);
3129    padding-left: var(--wui-spacing-s);
3130    padding-right: var(--wui-spacing-1xs);
3131    border-radius: calc(var(--wui-border-radius-5xs) + var(--wui-border-radius-4xs));
3132    background: var(--wui-color-gray-glass-002);
3133  }
3134
3135  .details-row-title {
3136    white-space: nowrap;
3137  }
3138
3139  .details-row.provider-free-row {
3140    padding-right: var(--wui-spacing-xs);
3141  }
3142`;var iX=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let i0=eh.ConstantsUtil.CONVERT_SLIPPAGE_TOLERANCE,i1=class extends iZ.LitElement{constructor(){super(),this.unsubscribe=[],this.networkName=_.NetworkController.state.caipNetwork?.name,this.detailsOpen=!1,this.sourceToken=tF.SwapController.state.sourceToken,this.toToken=tF.SwapController.state.toToken,this.toTokenAmount=tF.SwapController.state.toTokenAmount,this.sourceTokenPriceInUSD=tF.SwapController.state.sourceTokenPriceInUSD,this.toTokenPriceInUSD=tF.SwapController.state.toTokenPriceInUSD,this.gasPriceInUSD=tF.SwapController.state.gasPriceInUSD,this.priceImpact=tF.SwapController.state.priceImpact,this.maxSlippage=tF.SwapController.state.maxSlippage,this.networkTokenSymbol=tF.SwapController.state.networkTokenSymbol,this.inputError=tF.SwapController.state.inputError,this.unsubscribe.push(tF.SwapController.subscribe(e=>{this.sourceToken=e.sourceToken,this.toToken=e.toToken,this.toTokenAmount=e.toTokenAmount,this.gasPriceInUSD=e.gasPriceInUSD,this.priceImpact=e.priceImpact,this.maxSlippage=e.maxSlippage,this.sourceTokenPriceInUSD=e.sourceTokenPriceInUSD,this.toTokenPriceInUSD=e.toTokenPriceInUSD,this.inputError=e.inputError}))}render(){let e=this.toTokenAmount&&this.maxSlippage?tG.NumberUtil.bigNumber(this.toTokenAmount).minus(this.maxSlippage).toString():null;if(!this.sourceToken||!this.toToken||this.inputError)return null;let t=this.sourceTokenPriceInUSD&&this.toTokenPriceInUSD?1/this.toTokenPriceInUSD*this.sourceTokenPriceInUSD:0;return O.html`
3143      <wui-flex flexDirection="column" alignItems="center" gap="1xs" class="details-container">
3144        <wui-flex flexDirection="column">
3145          <button @click=${this.toggleDetails.bind(this)}>
3146            <wui-flex justifyContent="space-between" .padding=${["0","xs","0","xs"]}>
3147              <wui-flex justifyContent="flex-start" flexGrow="1" gap="xs">
3148                <wui-text variant="small-400" color="fg-100">
3149                  1 ${this.sourceToken.symbol} =
3150                  ${ed.UiHelperUtil.formatNumberToLocalString(t,3)}
3151                  ${this.toToken.symbol}
3152                </wui-text>
3153                <wui-text variant="small-400" color="fg-200">
3154                  $${ed.UiHelperUtil.formatNumberToLocalString(this.sourceTokenPriceInUSD)}
3155                </wui-text>
3156              </wui-flex>
3157              <wui-icon name="chevronBottom"></wui-icon>
3158            </wui-flex>
3159          </button>
3160          ${this.detailsOpen?O.html`
3161                <wui-flex flexDirection="column" gap="xs" class="details-content-container">
3162                  <wui-flex flexDirection="column" gap="xs">
3163                    <wui-flex
3164                      justifyContent="space-between"
3165                      alignItems="center"
3166                      class="details-row"
3167                    >
3168                      <wui-flex alignItems="center" gap="xs">
3169                        <wui-text class="details-row-title" variant="small-400" color="fg-150">
3170                          Network cost
3171                        </wui-text>
3172                        <w3m-tooltip-trigger
3173                          text=${`Network cost is paid in ${this.networkTokenSymbol} on the ${this.networkName} network in order to execute transaction.`}
3174                        >
3175                          <wui-icon size="xs" color="fg-250" name="infoCircle"></wui-icon>
3176                        </w3m-tooltip-trigger>
3177                      </wui-flex>
3178                      <wui-text variant="small-400" color="fg-100">
3179                        $${ed.UiHelperUtil.formatNumberToLocalString(this.gasPriceInUSD,3)}
3180                      </wui-text>
3181                    </wui-flex>
3182                  </wui-flex>
3183                  ${this.priceImpact?O.html` <wui-flex flexDirection="column" gap="xs">
3184                        <wui-flex
3185                          justifyContent="space-between"
3186                          alignItems="center"
3187                          class="details-row"
3188                        >
3189                          <wui-flex alignItems="center" gap="xs">
3190                            <wui-text class="details-row-title" variant="small-400" color="fg-150">
3191                              Price impact
3192                            </wui-text>
3193                            <w3m-tooltip-trigger
3194                              text="Price impact reflects the change in market price due to your trade"
3195                            >
3196                              <wui-icon size="xs" color="fg-250" name="infoCircle"></wui-icon>
3197                            </w3m-tooltip-trigger>
3198                          </wui-flex>
3199                          <wui-flex>
3200                            <wui-text variant="small-400" color="fg-200">
3201                              ${ed.UiHelperUtil.formatNumberToLocalString(this.priceImpact,3)}%
3202                            </wui-text>
3203                          </wui-flex>
3204                        </wui-flex>
3205                      </wui-flex>`:null}
3206                  ${this.maxSlippage&&this.sourceToken.symbol?O.html`<wui-flex flexDirection="column" gap="xs">
3207                        <wui-flex
3208                          justifyContent="space-between"
3209                          alignItems="center"
3210                          class="details-row"
3211                        >
3212                          <wui-flex alignItems="center" gap="xs">
3213                            <wui-text class="details-row-title" variant="small-400" color="fg-150">
3214                              Max. slippage
3215                            </wui-text>
3216                            <w3m-tooltip-trigger
3217                              text=${`Max slippage sets the minimum amount you must receive for the transaction to proceed. ${e?`Transaction will be reversed if you receive less than ${ed.UiHelperUtil.formatNumberToLocalString(e,6)} ${this.toToken.symbol} due to price changes.`:""}`}
3218                            >
3219                              <wui-icon size="xs" color="fg-250" name="infoCircle"></wui-icon>
3220                            </w3m-tooltip-trigger>
3221                          </wui-flex>
3222                          <wui-flex>
3223                            <wui-text variant="small-400" color="fg-200">
3224                              ${ed.UiHelperUtil.formatNumberToLocalString(this.maxSlippage,6)}
3225                              ${this.toToken.symbol} ${i0}%
3226                            </wui-text>
3227                          </wui-flex>
3228                        </wui-flex>
3229                      </wui-flex>`:null}
3230                  <wui-flex flexDirection="column" gap="xs">
3231                    <wui-flex
3232                      justifyContent="space-between"
3233                      alignItems="center"
3234                      class="details-row provider-free-row"
3235                    >
3236                      <wui-flex alignItems="center" gap="xs">
3237                        <wui-text class="details-row-title" variant="small-400" color="fg-150">
3238                          Provider fee
3239                        </wui-text>
3240                      </wui-flex>
3241                      <wui-flex>
3242                        <wui-text variant="small-400" color="fg-200">0.85%</wui-text>
3243                      </wui-flex>
3244                    </wui-flex>
3245                  </wui-flex>
3246                </wui-flex>
3247              `:null}
3248        </wui-flex>
3249      </wui-flex>
3250    `}toggleDetails(){this.detailsOpen=!this.detailsOpen}};i1.styles=[iQ],iX([(0,$.state)()],i1.prototype,"networkName",void 0),iX([(0,N.property)()],i1.prototype,"detailsOpen",void 0),iX([(0,$.state)()],i1.prototype,"sourceToken",void 0),iX([(0,$.state)()],i1.prototype,"toToken",void 0),iX([(0,$.state)()],i1.prototype,"toTokenAmount",void 0),iX([(0,$.state)()],i1.prototype,"sourceTokenPriceInUSD",void 0),iX([(0,$.state)()],i1.prototype,"toTokenPriceInUSD",void 0),iX([(0,$.state)()],i1.prototype,"gasPriceInUSD",void 0),iX([(0,$.state)()],i1.prototype,"priceImpact",void 0),iX([(0,$.state)()],i1.prototype,"maxSlippage",void 0),iX([(0,$.state)()],i1.prototype,"networkTokenSymbol",void 0),iX([(0,$.state)()],i1.prototype,"inputError",void 0),i1=iX([(0,P.customElement)("w3m-swap-details")],i1);var i3=R;let i2={numericInputKeyDown(e,t,r){let i=e.metaKey||e.ctrlKey,n=e.key,s=n.toLocaleLowerCase(),o=","===n,a="."===n,l=n>="0"&&n<="9";i||"a"!==s&&"c"!==s&&"v"!==s&&"x"!==s||e.preventDefault(),"0"!==t||o||a||"0"!==n||e.preventDefault(),"0"===t&&l&&(r(n),e.preventDefault()),(o||a)&&(t||(r("0."),e.preventDefault()),(t?.includes(".")||t?.includes(","))&&e.preventDefault()),l||["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"].includes(n)||a||o||e.preventDefault()}},i5=U.css`
3251  :host > wui-flex {
3252    display: flex;
3253    flex-direction: row;
3254    justify-content: space-between;
3255    align-items: center;
3256    border-radius: var(--wui-border-radius-s);
3257    background-color: var(--wui-color-gray-glass-002);
3258    padding: var(--wui-spacing-xl);
3259    padding-right: var(--wui-spacing-s);
3260    width: 100%;
3261    height: 100px;
3262    box-sizing: border-box;
3263    box-shadow: inset 0px 0px 0px 1px var(--wui-color-gray-glass-002);
3264    position: relative;
3265    transition: box-shadow var(--wui-ease-out-power-1) var(--wui-duration-lg);
3266    will-change: background-color;
3267  }
3268
3269  :host wui-flex.focus {
3270    box-shadow: inset 0px 0px 0px 1px var(--wui-color-gray-glass-005);
3271  }
3272
3273  :host > wui-flex .swap-input,
3274  :host > wui-flex .swap-token-button {
3275    z-index: 10;
3276  }
3277
3278  :host > wui-flex .swap-input {
3279    -webkit-mask-image: linear-gradient(
3280      270deg,
3281      transparent 0px,
3282      transparent 8px,
3283      black 24px,
3284      black 25px,
3285      black 32px,
3286      black 100%
3287    );
3288    mask-image: linear-gradient(
3289      270deg,
3290      transparent 0px,
3291      transparent 8px,
3292      black 24px,
3293      black 25px,
3294      black 32px,
3295      black 100%
3296    );
3297  }
3298
3299  :host > wui-flex .swap-input input {
3300    background: none;
3301    border: none;
3302    height: 42px;
3303    width: 100%;
3304    font-size: 32px;
3305    font-style: normal;
3306    font-weight: 400;
3307    line-height: 130%;
3308    letter-spacing: -1.28px;
3309    outline: none;
3310    caret-color: var(--wui-color-accent-100);
3311    color: var(--wui-color-fg-100);
3312    padding: 0px;
3313  }
3314
3315  :host > wui-flex .swap-input input:focus-visible {
3316    outline: none;
3317  }
3318
3319  :host > wui-flex .swap-input input::-webkit-outer-spin-button,
3320  :host > wui-flex .swap-input input::-webkit-inner-spin-button {
3321    -webkit-appearance: none;
3322    margin: 0;
3323  }
3324
3325  .max-value-button {
3326    background-color: transparent;
3327    border: none;
3328    cursor: pointer;
3329    color: var(--wui-color-gray-glass-020);
3330    padding-left: 0px;
3331  }
3332
3333  .market-value {
3334    min-height: 18px;
3335  }
3336`;var i4=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
3336);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let i6=class extends i3.LitElement{constructor(){super(...arguments),this.focused=!1,this.price=0,this.target="sourceToken",this.onSetAmount=null,this.onSetMaxValue=null}render(){let e=this.marketValue||"0",t=tG.NumberUtil.bigNumber(e).isGreaterThan("0");return O.html`
3337      <wui-flex class="${this.focused?"focus":""}" justifyContent="space-between">
3338        <wui-flex
3339          flex="1"
3340          flexDirection="column"
3341          alignItems="flex-start"
3342          justifyContent="center"
3343          class="swap-input"
3344        >
3345          <input
3346            data-testid="swap-input-${this.target}"
3347            @focusin=${()=>this.onFocusChange(!0)}
3348            @focusout=${()=>this.onFocusChange(!1)}
3349            ?disabled=${this.disabled}
3350            .value=${this.value}
3351            @input=${this.dispatchInputChangeEvent}
3352            @keydown=${this.handleKeydown}
3353            placeholder="0"
3354            type="text"
3355            inputmode="decimal"
3356          />
3357          <wui-text class="market-value" variant="small-400" color="fg-200">
3358            ${t?`$${ed.UiHelperUtil.formatNumberToLocalString(this.marketValue,3)}`:null}
3359          </wui-text>
3360        </wui-flex>
3361        ${this.templateTokenSelectButton()}
3362      </wui-flex>
3363    `}handleKeydown(e){return i2.numericInputKeyDown(e,this.value,e=>this.onSetAmount?.(this.target,e))}dispatchInputChangeEvent(e){if(!this.onSetAmount)return;let t=e.target.value.replace(/[^0-9.]/gu,"");","===t||"."===t?this.onSetAmount(this.target,"0."):t.endsWith(",")?this.onSetAmount(this.target,t.replace(",",".")):this.onSetAmount(this.target,t)}setMaxValueToInput(){this.onSetMaxValue?.(this.target,this.balance)}templateTokenSelectButton(){return this.token?O.html`
3364      <wui-flex
3365        class="swap-token-button"
3366        flexDirection="column"
3367        alignItems="flex-end"
3368        justifyContent="center"
3369        gap="xxs"
3370      >
3371        <wui-token-button
3372          data-testid="swap-input-token-${this.target}"
3373          text=${this.token.symbol}
3374          imageSrc=${this.token.logoUri}
3375          @click=${this.onSelectToken.bind(this)}
3376        >
3377        </wui-token-button>
3378        <wui-flex alignItems="center" gap="xxs"> ${this.tokenBalanceTemplate()} </wui-flex>
3379      </wui-flex>
3380    `:O.html` <wui-button
3381        data-testid="swap-select-token-button-${this.target}"
3382        class="swap-token-button"
3383        size="md"
3384        variant="accent"
3385        @click=${this.onSelectToken.bind(this)}
3386      >
3387        Select token
3388      </wui-button>`}tokenBalanceTemplate(){let e=tG.NumberUtil.multiply(this.balance,this.price),t=!!e&&e?.isGreaterThan(5e-5);return O.html`
3389      ${t?O.html`<wui-text variant="small-400" color="fg-200">
3390            ${ed.UiHelperUtil.formatNumberToLocalString(this.balance,3)}
3391          </wui-text>`:null}
3392      ${"sourceToken"===this.target?this.tokenActionButtonTemplate(t):null}
3393    `}tokenActionButtonTemplate(e){return e?O.html` <button class="max-value-button" @click=${this.setMaxValueToInput.bind(this)}>
3394        <wui-text color="accent-100" variant="small-600">Max</wui-text>
3395      </button>`:O.html` <button class="max-value-button" @click=${this.onBuyToken.bind(this)}>
3396      <wui-text color="accent-100" variant="small-600">Buy</wui-text>
3397    </button>`}onFocusChange(e){this.focused=e}onSelectToken(){f.EventsController.sendEvent({type:"track",event:"CLICK_SELECT_TOKEN_TO_SWAP"}),b.RouterController.push("SwapSelectToken",{target:this.target})}onBuyToken(){b.RouterController.push("OnRampProviders")}};i6.styles=[i5],i4([(0,N.property)()],i6.prototype,"focused",void 0),i4([(0,N.property)()],i6.prototype,"balance",void 0),i4([(0,N.property)()],i6.prototype,"value",void 0),i4([(0,N.property)()],i6.prototype,"price",void 0),i4([(0,N.property)()],i6.prototype,"marketValue",void 0),i4([(0,N.property)()],i6.prototype,"disabled",void 0),i4([(0,N.property)()],i6.prototype,"target",void 0),i4([(0,N.property)()],i6.prototype,"token",void 0),i4([(0,N.property)()],i6.prototype,"onSetAmount",void 0),i4([(0,N.property)()],i6.prototype,"onSetMaxValue",void 0),i6=i4([(0,P.customElement)("w3m-swap-input")],i6);var i8=R;let i9=U.css`
3398  :host {
3399    width: 100%;
3400  }
3401
3402  :host > wui-flex {
3403    display: flex;
3404    flex-direction: row;
3405    justify-content: space-between;
3406    align-items: center;
3407    border-radius: var(--wui-border-radius-s);
3408    padding: var(--wui-spacing-xl);
3409    padding-right: var(--wui-spacing-s);
3410    background-color: var(--wui-color-gray-glass-002);
3411    box-shadow: inset 0px 0px 0px 1px var(--wui-color-gray-glass-002);
3412    width: 100%;
3413    height: 100px;
3414    box-sizing: border-box;
3415    position: relative;
3416  }
3417
3418  wui-shimmer.market-value {
3419    opacity: 0;
3420  }
3421
3422  :host > wui-flex > svg.input_mask {
3423    position: absolute;
3424    inset: 0;
3425    z-index: 5;
3426  }
3427
3428  :host wui-flex .input_mask__border,
3429  :host wui-flex .input_mask__background {
3430    transition: fill var(--wui-duration-md) var(--wui-ease-out-power-1);
3431    will-change: fill;
3432  }
3433
3434  :host wui-flex .input_mask__border {
3435    fill: var(--wui-color-gray-glass-020);
3436  }
3437
3438  :host wui-flex .input_mask__background {
3439    fill: var(--wui-color-gray-glass-002);
3440  }
3441`;var i7=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
3441);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let ne=class extends i8.LitElement{constructor(){super(...arguments),this.target="sourceToken"}render(){return O.html`
3442      <wui-flex class justifyContent="space-between">
3443        <wui-flex
3444          flex="1"
3445          flexDirection="column"
3446          alignItems="flex-start"
3447          justifyContent="center"
3448          class="swap-input"
3449          gap="xxs"
3450        >
3451          <wui-shimmer width="80px" height="40px" borderRadius="xxs" variant="light"></wui-shimmer>
3452        </wui-flex>
3453        ${this.templateTokenSelectButton()}
3454      </wui-flex>
3455    `}templateTokenSelectButton(){return O.html`
3456      <wui-flex
3457        class="swap-token-button"
3458        flexDirection="column"
3459        alignItems="flex-end"
3460        justifyContent="center"
3461        gap="xxs"
3462      >
3463        <wui-shimmer width="80px" height="40px" borderRadius="3xl" variant="light"></wui-shimmer>
3464      </wui-flex>
3465    `}};ne.styles=[i9],i7([(0,N.property)()],ne.prototype,"target",void 0),ne=i7([(0,P.customElement)("w3m-swap-input-skeleton")],ne);var nt=R;let nr=U.css`
3466  :host {
3467    height: 64px;
3468  }
3469
3470  wui-text {
3471    text-transform: capitalize;
3472  }
3473
3474  wui-flex.w3m-header-title {
3475    transform: translateY(0);
3476    opacity: 1;
3477  }
3478
3479  wui-flex.w3m-header-title[view-direction='prev'] {
3480    animation:
3481      slide-down-out 120ms forwards var(--wui-ease-out-power-2),
3482      slide-down-in 120ms forwards var(--wui-ease-out-power-2);
3483    animation-delay: 0ms, 200ms;
3484  }
3485
3486  wui-flex.w3m-header-title[view-direction='next'] {
3487    animation:
3488      slide-up-out 120ms forwards var(--wui-ease-out-power-2),
3489      slide-up-in 120ms forwards var(--wui-ease-out-power-2);
3490    animation-delay: 0ms, 200ms;
3491  }
3492
3493  wui-icon-link[data-hidden='true'] {
3494    opacity: 0 !important;
3495    pointer-events: none;
3496  }
3497
3498  @keyframes slide-up-out {
3499    from {
3500      transform: translateY(0px);
3501      opacity: 1;
3502    }
3503    to {
3504      transform: translateY(3px);
3505      opacity: 0;
3506    }
3507  }
3508
3509  @keyframes slide-up-in {
3510    from {
3511      transform: translateY(-3px);
3512      opacity: 0;
3513    }
3514    to {
3515      transform: translateY(0);
3516      opacity: 1;
3517    }
3518  }
3519
3520  @keyframes slide-down-out {
3521    from {
3522      transform: translateY(0px);
3523      opacity: 1;
3524    }
3525    to {
3526      transform: translateY(-3px);
3527      opacity: 0;
3528    }
3529  }
3530
3531  @keyframes slide-down-in {
3532    from {
3533      transform: translateY(3px);
3534      opacity: 0;
3535    }
3536    to {
3537      transform: translateY(0);
3538      opacity: 1;
3539    }
3540  }
3541`;var ni=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nn=["Swap","SwapSelectToken","SwapPreview"];function ns(){let e=b.RouterController.state.data?.connector?.name,t=b.RouterController.state.data?.wallet?.name,r=b.RouterController.state.data?.network?.name,i=t??e,n=d.ConnectorController.getConnectors(),s=1===n.length&&n[0]?.id==="w3m-email";return{Connect:`Connect ${s?"Email":""} Wallet`,ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",ConnectingExternal:i??"Connect Wallet",ConnectingWalletConnect:i??"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview convert",Downloads:i?`Get ${i}`:"Downloads",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Profile:void 0,SelectAddresses:"Select accounts",SwitchNetwork:r??"Switch Network",SwitchAddress:"Switch Address",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade your Wallet",UpgradeToSmartAccount:void 0,UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select token",SwapPreview:"Preview swap",WalletSend:"Send",WalletSendPreview:"Review send",WalletSendSelectToken:"Select Token",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a wallet?",ConnectWallets:"Connect wallet",ConnectSocials:"All socials",ConnectingSocial:c.AccountController.state.socialProvider?c.AccountController.state.socialProvider:"Connect Social",ConnectingMultiChain:"Select chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch chain"}}let no=class extends nt.LitElement{constructor(){super(),this.unsubscribe=[],this.heading=ns()[b.RouterController.state.view],this.network=_.NetworkController.state.caipNetwork,this.buffering=!1,this.showBack=!1,this.isSiweEnabled=x.OptionsController.state.isSiweEnabled,this.prevHistoryLength=1,this.view=b.RouterController.state.view,this.viewDirection="",this.headerText=ns()[b.RouterController.state.view],this.unsubscribe.push(b.RouterController.subscribeKey("view",e=>{setTimeout(()=>{this.view=e,this.headerText=ns()[e]},X.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),h.ConnectionController.subscribeKey("buffering",e=>this.buffering=e),_.NetworkController.subscribeKey("caipNetwork",e=>this.network=e))}
3541disconnectCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`
3542      <wui-flex .padding=${this.getPadding()} justifyContent="space-between" alignItems="center">
3543        ${this.dynamicButtonTemplate()} ${this.titleTemplate()} ${this.closeButtonTemplate()}
3544      </wui-flex>
3545    `}onWalletHelp(){f.EventsController.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),b.RouterController.push("WhatIsAWallet")}async onClose(){if(this.isSiweEnabled){let{SIWEController:t}=await e.A(430361),r="ApproveTransaction"===b.RouterController.state.view;"success"!==t.state.status&&r?b.RouterController.popTransactionStack(!0):g.ModalController.close()}else g.ModalController.close()}closeButtonTemplate(){let e="ConnectingSiwe"===b.RouterController.state.view;return this.isSiweEnabled&&e?O.html`<div style="width:40px" />`:O.html`
3546      <wui-icon-link
3547        ?disabled=${this.buffering}
3548        icon="close"
3549        @click=${this.onClose.bind(this)}
3550        data-testid="w3m-header-close"
3551      ></wui-icon-link>
3552    `}titleTemplate(){let e=nn.includes(this.view);return O.html`
3553      <wui-flex
3554        view-direction="${this.viewDirection}"
3555        class="w3m-header-title"
3556        alignItems="center"
3557        gap="xs"
3558      >
3559        <wui-text variant="paragraph-700" color="fg-100">${this.headerText}</wui-text>
3560        ${e?O.html`<wui-tag variant="main">Beta</wui-tag>`:null}
3561      </wui-flex>
3562    `}dynamicButtonTemplate(){let{view:e}=b.RouterController.state;return"Account"===e?O.html`<wui-select
3563        id="dynamic"
3564        data-testid="w3m-account-select-network"
3565        active-network=${this.network?.name}
3566        @click=${this.onNetworks.bind(this)}
3567        imageSrc=${E.AssetUtil.getNetworkImage(this.network)??O.nothing}
3568      ></wui-select>`:this.showBack&&"ApproveTransaction"!==e&&"UpgradeToSmartAccount"!==e&&"ConnectingSiwe"!==e?O.html`<wui-icon-link
3569        id="dynamic"
3570        icon="chevronLeft"
3571        ?disabled=${this.buffering}
3572        @click=${this.onGoBack.bind(this)}
3573      ></wui-icon-link>`:O.html`<wui-icon-link
3574      data-hidden=${"Connect"!==e}
3575      id="dynamic"
3576      icon="helpCircle"
3577      @click=${this.onWalletHelp.bind(this)}
3578    ></wui-icon-link>`}onNetworks(){this.isAllowedNetworkSwitch()&&(f.EventsController.sendEvent({type:"track",event:"CLICK_NETWORKS"}),b.RouterController.push("Networks"))}isAllowedNetworkSwitch(){let e=_.NetworkController.getRequestedCaipNetworks(),t=!!e&&e.length>1,r=e?.find(({id:e})=>e===this.network?.id);return t||!r}getPadding(){return this.heading?["l","2l","l","2l"]:["0","2l","0","2l"]}onViewChange(){let{history:e}=b.RouterController.state,t=X.VIEW_DIRECTION.Next;e.length<this.prevHistoryLength&&(t=X.VIEW_DIRECTION.Prev),this.prevHistoryLength=e.length,this.viewDirection=t}async onHistoryChange(){let{history:e}=b.RouterController.state,t=this.shadowRoot?.querySelector("#dynamic");e.length>1&&!this.showBack&&t?(await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):e.length<=1&&this.showBack&&t&&(await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){b.RouterController.goBack()}};no.styles=nr,ni([(0,$.state)()],no.prototype,"heading",void 0),ni([(0,$.state)()],no.prototype,"network",void 0),ni([(0,$.state)()],no.prototype,"buffering",void 0),ni([(0,$.state)()],no.prototype,"showBack",void 0),ni([(0,$.state)()],no.prototype,"isSiweEnabled",void 0),ni([(0,$.state)()],no.prototype,"prevHistoryLength",void 0),ni([(0,$.state)()],no.prototype,"view",void 0),ni([(0,$.state)()],no.prototype,"viewDirection",void 0),ni([(0,$.state)()],no.prototype,"headerText",void 0),no=ni([(0,P.customElement)("w3m-header")],no);var na=R,nl=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
3578);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nc=class extends na.LitElement{constructor(){super(...arguments),this.data=[]}render(){return O.html`
3579      <wui-flex flexDirection="column" alignItems="center" gap="l">
3580        ${this.data.map(e=>O.html`
3581            <wui-flex flexDirection="column" alignItems="center" gap="xl">
3582              <wui-flex flexDirection="row" justifyContent="center" gap="1xs">
3583                ${e.images.map(e=>O.html`<wui-visual name=${e}></wui-visual>`)}
3584              </wui-flex>
3585            </wui-flex>
3586            <wui-flex flexDirection="column" alignItems="center" gap="xxs">
3587              <wui-text variant="paragraph-500" color="fg-100" align="center">
3588                ${e.title}
3589              </wui-text>
3590              <wui-text variant="small-500" color="fg-200" align="center">${e.text}</wui-text>
3591            </wui-flex>
3592          `)}
3593      </wui-flex>
3594    `}};nl([(0,N.property)({type:Array})],nc.prototype,"data",void 0),nc=nl([(0,P.customElement)("w3m-help-widget")],nc);var nu=R;let nh=U.css`
3595  :host {
3596    width: 100%;
3597  }
3598
3599  :host > wui-flex {
3600    width: 100%;
3601    padding: var(--wui-spacing-s);
3602    border-radius: var(--wui-border-radius-xs);
3603    width: 100%;
3604    display: flex;
3605    align-items: center;
3606    justify-content: flex-start;
3607    gap: var(--wui-spacing-s);
3608  }
3609
3610  :host > wui-flex:hover {
3611    background-color: var(--wui-color-gray-glass-002);
3612  }
3613
3614  .purchase-image-container {
3615    display: flex;
3616    justify-content: center;
3617    align-items: center;
3618    position: relative;
3619    width: var(--wui-icon-box-size-lg);
3620    height: var(--wui-icon-box-size-lg);
3621  }
3622
3623  .purchase-image-container wui-image {
3624    width: 100%;
3625    height: 100%;
3626    position: relative;
3627    border-radius: calc(var(--wui-icon-box-size-lg) / 2);
3628  }
3629
3630  .purchase-image-container wui-image::after {
3631    content: '';
3632    display: block;
3633    width: 100%;
3634    height: 100%;
3635    position: absolute;
3636    inset: 0;
3637    border-radius: calc(var(--wui-icon-box-size-lg) / 2);
3638    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
3639  }
3640
3641  .purchase-image-container wui-icon-box {
3642    position: absolute;
3643    right: 0;
3644    bottom: 0;
3645    transform: translate(20%, 20%);
3646  }
3647`;var nd=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let np=class extends nu.LitElement{constructor(){super(...arguments),this.disabled=!1,this.color="inherit",this.label="Bought",this.purchaseValue="",this.purchaseCurrency="",this.date="",this.completed=!1,this.inProgress=!1,this.failed=!1,this.onClick=null,this.symbol=""}firstUpdated(){this.icon||this.fetchTokenImage()}render(){return O.html`
3648      <wui-flex>
3649        ${this.imageTemplate()}
3650        <wui-flex flexDirection="column" gap="4xs" flexGrow="1">
3651          <wui-flex gap="xxs" alignItems="center" justifyContent="flex-start">
3652            ${this.statusIconTemplate()}
3653            <wui-text variant="paragraph-500" color="fg-100"> ${this.label}</wui-text>
3654          </wui-flex>
3655          <wui-text variant="small-400" color="fg-200">
3656            + ${this.purchaseValue} ${this.purchaseCurrency}
3657          </wui-text>
3658        </wui-flex>
3659        ${this.inProgress?O.html`<wui-loading-spinner color="fg-200" size="md"></wui-loading-spinner>`:O.html`<wui-text variant="micro-700" color="fg-300"><span>${this.date}</span></wui-text>`}
3660      </wui-flex>
3661    `}async fetchTokenImage(){await e5.ApiController._fetchTokenImage(this.purchaseCurrency)}statusIconTemplate(){return this.inProgress?null:this.completed?this.boughtIconTemplate():this.errorIconTemplate()}errorIconTemplate(){return O.html`<wui-icon-box
3662      size="xxs"
3663      iconColor="error-100"
3664      backgroundColor="error-100"
3665      background="opaque"
3666      icon="close"
3667      borderColor="wui-color-bg-125"
3668    ></wui-icon-box>`}imageTemplate(){let e=this.icon||`https://avatar.vercel.sh/andrew.svg?size=50&text=${this.symbol}`;return O.html`<wui-flex class="purchase-image-container">
3669      <wui-image src=${e}></wui-image>
3670    </wui-flex>`}boughtIconTemplate(){return O.html`<wui-icon-box
3671      size="xxs"
3672      iconColor="success-100"
3673      backgroundColor="success-100"
3674      background="opaque"
3675      icon="arrowBottom"
3676      borderColor="wui-color-bg-125"
3677    ></wui-icon-box>`}};np.styles=[nh],nd([(0,N.property)({type:Boolean})],np.prototype,"disabled",void 0),nd([(0,N.property)()],np.prototype,"color",void 0),nd([(0,N.property)()],np.prototype,"label",void 0),nd([(0,N.property)()],np.prototype,"purchaseValue",void 0),nd([(0,N.property)()],np.prototype,"purchaseCurrency",void 0),nd([(0,N.property)()],np.prototype,"date",void 0),nd([(0,N.property)({type:Boolean})],np.prototype,"completed",void 0),nd([(0,N.property)({type:Boolean})],np.prototype,"inProgress",void 0),nd([(0,N.property)({type:Boolean})],np.prototype,"failed",void 0),nd([(0,N.property)()],np.prototype,"onClick",void 0),nd([(0,N.property)()],np.prototype,"symbol",void 0),nd([(0,N.property)()],np.prototype,"icon",void 0),np=nd([(0,P.customElement)("w3m-onramp-activity-item")],np);var nf=R;let ng=U.css`
3678  :host {
3679    width: 100%;
3680  }
3681
3682  wui-loading-spinner {
3683    position: absolute;
3684    top: 50%;
3685    right: 20px;
3686    transform: translateY(-50%);
3687  }
3688
3689  .currency-container {
3690    position: absolute;
3691    top: 50%;
3692    transform: translateY(-50%);
3693    right: var(--wui-spacing-1xs);
3694    height: 40px;
3695    padding: var(--wui-spacing-xs) var(--wui-spacing-1xs) var(--wui-spacing-xs)
3696      var(--wui-spacing-xs);
3697    min-width: 95px;
3698    border-radius: var(--FULL, 1000px);
3699    border: 1px solid var(--wui-color-gray-glass-002);
3700    background: var(--wui-color-gray-glass-002);
3701    cursor: pointer;
3702  }
3703
3704  .currency-container > wui-image {
3705    height: 24px;
3706    width: 24px;
3707    border-radius: 50%;
3708  }
3709`;var nm=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
3709);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nw=class extends nf.LitElement{constructor(){super(),this.unsubscribe=[],this.type="Token",this.value=0,this.currencies=[],this.selectedCurrency=this.currencies?.[0],this.currencyImages=T.AssetController.state.currencyImages,this.tokenImages=T.AssetController.state.tokenImages,this.unsubscribe.push(er.OnRampController.subscribeKey("purchaseCurrency",e=>{e&&"Fiat"!==this.type&&(this.selectedCurrency=this.formatPurchaseCurrency(e))}),er.OnRampController.subscribeKey("paymentCurrency",e=>{e&&"Token"!==this.type&&(this.selectedCurrency=this.formatPaymentCurrency(e))}),er.OnRampController.subscribe(e=>{"Fiat"===this.type?this.currencies=e.purchaseCurrencies.map(this.formatPurchaseCurrency):this.currencies=e.paymentCurrencies.map(this.formatPaymentCurrency)}),T.AssetController.subscribe(e=>{this.currencyImages={...e.currencyImages},this.tokenImages={...e.tokenImages}}))}firstUpdated(){er.OnRampController.getAvailableCurrencies()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.selectedCurrency?.symbol||"",t=this.currencyImages[e]||this.tokenImages[e];return O.html`<wui-input-text type="number" size="lg" value=${this.value}>
3710      ${this.selectedCurrency?O.html` <wui-flex
3711            class="currency-container"
3712            justifyContent="space-between"
3713            alignItems="center"
3714            gap="xxs"
3715            @click=${()=>g.ModalController.open({view:`OnRamp${this.type}Select`})}
3716          >
3717            <wui-image src=${t??O.nothing}></wui-image>
3718            <wui-text color="fg-100">${this.selectedCurrency.symbol}</wui-text>
3719          </wui-flex>`:O.html`<wui-loading-spinner></wui-loading-spinner>`}
3720    </wui-input-text>`}formatPaymentCurrency(e){return{name:e.id,symbol:e.id}}formatPurchaseCurrency(e){return{name:e.name,symbol:e.symbol}}};nw.styles=ng,nm([(0,N.property)({type:String})],nw.prototype,"type",void 0),nm([(0,N.property)({type:Number})],nw.prototype,"value",void 0),nm([(0,$.state)()],nw.prototype,"currencies",void 0),nm([(0,$.state)()],nw.prototype,"selectedCurrency",void 0),nm([(0,$.state)()],nw.prototype,"currencyImages",void 0),nm([(0,$.state)()],nw.prototype,"tokenImages",void 0),nw=nm([(0,P.customElement)("w3m-onramp-input")],nw);var ny=R;let nv=U.css`
3721  button {
3722    padding: var(--wui-spacing-s);
3723    border-radius: var(--wui-border-radius-xs);
3724    border: none;
3725    outline: none;
3726    background-color: var(--wui-color-gray-glass-002);
3727    width: 100%;
3728    display: flex;
3729    align-items: center;
3730    justify-content: flex-start;
3731    gap: var(--wui-spacing-s);
3732    transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md);
3733    will-change: background-color;
3734  }
3735
3736  button:hover {
3737    background-color: var(--wui-color-gray-glass-005);
3738  }
3739
3740  .provider-image {
3741    width: var(--wui-spacing-3xl);
3742    min-width: var(--wui-spacing-3xl);
3743    height: var(--wui-spacing-3xl);
3744    border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2));
3745    position: relative;
3746    overflow: hidden;
3747  }
3748
3749  .provider-image::after {
3750    content: '';
3751    display: block;
3752    width: 100%;
3753    height: 100%;
3754    position: absolute;
3755    inset: 0;
3756    border-radius: calc(var(--wui-border-radius-xs) - calc(var(--wui-spacing-s) / 2));
3757    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005);
3758  }
3759
3760  .network-icon {
3761    width: var(--wui-spacing-m);
3762    height: var(--wui-spacing-m);
3763    border-radius: calc(var(--wui-spacing-m) / 2);
3764    overflow: hidden;
3765    box-shadow:
3766      0 0 0 3px var(--wui-color-gray-glass-002),
3767      0 0 0 3px var(--wui-color-modal-bg);
3768    transition: box-shadow var(--wui-ease-out-power-1) var(--wui-duration-md);
3769    will-change: box-shadow;
3770  }
3771
3772  button:hover .network-icon {
3773    box-shadow:
3774      0 0 0 3px var(--wui-color-gray-glass-005),
3775      0 0 0 3px var(--wui-color-modal-bg);
3776  }
3777`;var nb=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
3777);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nC=class extends ny.LitElement{constructor(){super(...arguments),this.disabled=!1,this.color="inherit",this.label="",this.feeRange="",this.loading=!1,this.onClick=null}render(){return O.html`
3778      <button ?disabled=${this.disabled} ontouchstart>
3779        <wui-visual name=${this.name??O.nothing} class="provider-image"></wui-visual>
3780        <wui-flex flexDirection="column" gap="4xs">
3781          <wui-text variant="paragraph-500" color="fg-100">${this.label}</wui-text>
3782          <wui-flex alignItems="center" justifyContent="flex-start" gap="l">
3783            <wui-text variant="tiny-500" color="fg-100">
3784              <wui-text variant="tiny-400" color="fg-200">Fees</wui-text>
3785              ${this.feeRange}
3786            </wui-text>
3787            <wui-flex gap="xxs">
3788              <wui-icon name="bank" size="xs" color="fg-150"></wui-icon>
3789              <wui-icon name="card" size="xs" color="fg-150"></wui-icon>
3790            </wui-flex>
3791            ${this.networksTemplate()}
3792          </wui-flex>
3793        </wui-flex>
3794        ${this.loading?O.html`<wui-loading-spinner color="fg-200" size="md"></wui-loading-spinner>`:O.html`<wui-icon name="chevronRight" color="fg-200" size="sm"></wui-icon>`}
3795      </button>
3796    `}networksTemplate(){let e=_.NetworkController.getRequestedCaipNetworks(),t=e?.filter(e=>e?.imageId)?.slice(0,5);return O.html`
3797      <wui-flex class="networks">
3798        ${t?.map(e=>O.html`
3799            <wui-flex class="network-icon">
3800              <wui-image src=${E.AssetUtil.getNetworkImage(e)??O.nothing}></wui-image>
3801            </wui-flex>
3802          `)}
3803      </wui-flex>
3804    `}};nC.styles=[nv],nb([(0,N.property)({type:Boolean})],nC.prototype,"disabled",void 0),nb([(0,N.property)()],nC.prototype,"color",void 0),nb([(0,N.property)()],nC.prototype,"name",void 0),nb([(0,N.property)()],nC.prototype,"label",void 0),nb([(0,N.property)()],nC.prototype,"feeRange",void 0),nb([(0,N.property)({type:Boolean})],nC.prototype,"loading",void 0),nb([(0,N.property)()],nC.prototype,"onClick",void 0),nC=nb([(0,P.customElement)("w3m-onramp-provider-item")],nC);var nx=R;let n_=U.css`
3805  wui-flex {
3806    background-color: var(--wui-color-gray-glass-005);
3807  }
3808
3809  a {
3810    text-decoration: none;
3811    color: var(--wui-color-fg-175);
3812    font-weight: 500;
3813  }
3814`,nE=class extends nx.LitElement{render(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=x.OptionsController.state;return e||t?O.html`
3815      <wui-flex .padding=${["m","s","s","s"]} justifyContent="center">
3816        <wui-text color="fg-250" variant="small-400" align="center">
3817          By connecting your wallet, you agree to our <br />
3818          ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()}
3819        </wui-text>
3820      </wui-flex>
3821    `:null}andTemplate(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=x.OptionsController.state;return e&&t?"and":""}termsTemplate(){let{termsConditionsUrl:e}=x.OptionsController.state;return e?O.html`<a href=${e}>Terms of Service</a>`:null}privacyTemplate(){let{privacyPolicyUrl:e}=x.OptionsController.state;return e?O.html`<a href=${e}>Privacy Policy</a>`:null}};nE.styles=[n_],nE=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-legal-footer")],nE);var nk=R;let nS=U.css`
3822  :host {
3823    display: block;
3824    padding: 0 var(--wui-spacing-xl) var(--wui-spacing-xl);
3825  }
3826`;var nI=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nA=class extends nk.LitElement{constructor(){super(...arguments),this.wallet=void 0}
3826render(){if(!this.wallet)return this.style.display="none",null;let{name:e,app_store:t,play_store:r,chrome_store:i,homepage:n}=this.wallet,s=p.CoreHelperUtil.isMobile(),o=p.CoreHelperUtil.isIos(),a=p.CoreHelperUtil.isAndroid(),l=[t,r,n,i].filter(Boolean).length>1,c=ed.UiHelperUtil.getTruncateString({string:e,charsStart:12,charsEnd:0,truncate:"end"});return l&&!s?O.html`
3827        <wui-cta-button
3828          label=${`Don't have ${c}?`}
3829          buttonLabel="Get"
3830          @click=${()=>b.RouterController.push("Downloads",{wallet:this.wallet})}
3831        ></wui-cta-button>
3832      `:!l&&n?O.html`
3833        <wui-cta-button
3834          label=${`Don't have ${c}?`}
3835          buttonLabel="Get"
3836          @click=${this.onHomePage.bind(this)}
3837        ></wui-cta-button>
3838      `:t&&o?O.html`
3839        <wui-cta-button
3840          label=${`Don't have ${c}?`}
3841          buttonLabel="Get"
3842          @click=${this.onAppStore.bind(this)}
3843        ></wui-cta-button>
3844      `:r&&a?O.html`
3845        <wui-cta-button
3846          label=${`Don't have ${c}?`}
3847          buttonLabel="Get"
3848          @click=${this.onPlayStore.bind(this)}
3849        ></wui-cta-button>
3850      `:(this.style.display="none",null)}onAppStore(){this.wallet?.app_store&&p.CoreHelperUtil.openHref(this.wallet.app_store,"_blank")}onPlayStore(){this.wallet?.play_store&&p.CoreHelperUtil.openHref(this.wallet.play_store,"_blank")}onHomePage(){this.wallet?.homepage&&p.CoreHelperUtil.openHref(this.wallet.homepage,"_blank")}};nA.styles=[nS],nI([(0,N.property)({type:Object})],nA.prototype,"wallet",void 0),nA=nI([(0,P.customElement)("w3m-mobile-download-links")],nA);var nT=R;let nP=U.css`
3851  wui-flex {
3852    border-top: 1px solid var(--wui-color-gray-glass-005);
3853  }
3854
3855  a {
3856    text-decoration: none;
3857    color: var(--wui-color-fg-175);
3858    font-weight: 500;
3859    display: flex;
3860    align-items: center;
3861    justify-content: center;
3862    gap: var(--wui-spacing-3xs);
3863  }
3864`,nR=class extends nT.LitElement{render(){let{termsConditionsUrl:e,privacyPolicyUrl:t}=x.OptionsController.state;return e||t?O.html`
3865      <wui-flex
3866        .padding=${["m","s","s","s"]}
3867        flexDirection="column"
3868        alignItems="center"
3869        justifyContent="center"
3870        gap="s"
3871      >
3872        <wui-text color="fg-250" variant="small-400" align="center">
3873          We work with the best providers to give you the lowest fees and best support. More options
3874          coming soon!
3875        </wui-text>
3876
3877        ${this.howDoesItWorkTemplate()}
3878      </wui-flex>
3879    `:null}howDoesItWorkTemplate(){return O.html` <wui-link @click=${this.onWhatIsBuy.bind(this)}>
3880      <wui-icon size="xs" color="accent-100" slot="iconLeft" name="helpCircle"></wui-icon>
3881      How does it work?
3882    </wui-link>`}onWhatIsBuy(){f.EventsController.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),b.RouterController.push("WhatIsABuy")}};nR.styles=[nP],nR=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-onramp-providers-footer")],nR);var nO=R;let nN=U.css`
3883  :host {
3884    display: block;
3885    position: absolute;
3886    opacity: 0;
3887    pointer-events: none;
3888    top: 11px;
3889    left: 50%;
3890    width: max-content;
3891  }
3892`;var n$=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nD={loading:void 0,success:{backgroundColor:"success-100",iconColor:"success-100",icon:"checkmark"},error:{backgroundColor:"error-100",iconColor:"error-100",icon:"close"}},nL=class extends nO.LitElement{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=v.SnackController.state.open,this.unsubscribe.push(v.SnackController.subscribeKey("open",e=>{this.open=e,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(e
3892=>e())}render(){let{message:e,variant:t}=v.SnackController.state,r=nD[t];return O.html`
3893      <wui-snackbar
3894        message=${e}
3895        backgroundColor=${r?.backgroundColor}
3896        iconColor=${r?.iconColor}
3897        icon=${r?.icon}
3898        .loading=${"loading"===t}
3899      ></wui-snackbar>
3900    `}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(()=>v.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"})}};nL.styles=nN,n$([(0,$.state)()],nL.prototype,"open",void 0),nL=n$([(0,P.customElement)("w3m-snackbar")],nL);var nj=R;let nU=U.css`
3901  wui-separator {
3902    margin: var(--wui-spacing-s) calc(var(--wui-spacing-s) * -1);
3903    width: calc(100% + var(--wui-spacing-s) * 2);
3904  }
3905
3906  wui-email-input {
3907    width: 100%;
3908  }
3909
3910  form {
3911    width: 100%;
3912    display: block;
3913    position: relative;
3914  }
3915
3916  wui-icon-link,
3917  wui-loading-spinner {
3918    position: absolute;
3919    top: 50%;
3920    transform: translateY(-50%);
3921  }
3922
3923  wui-icon-link {
3924    right: var(--wui-spacing-xs);
3925  }
3926
3927  wui-loading-spinner {
3928    right: var(--wui-spacing-m);
3929  }
3930`;var nM=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nq=class extends nj.LitElement{constructor(){super(),this.unsubscribe=[],this.formRef=tl(),this.connectors=d.ConnectorController.state.connectors,this.email="",this.loading=!1,this.error="",this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}firstUpdated(){this.formRef.value?.addEventListener("keydown",e=>{"Enter"===e.key&&this.onSubmitEmail(e)})}render(){let e=this.connectors.find(e=>"AUTH"===e.type),t=this.connectors.length>1;return e?.email?O.html`
3931      <form ${th(this.formRef)} @submit=${this.onSubmitEmail.bind(this)}>
3932        <wui-email-input
3933          @focus=${this.onFocusEvent.bind(this)}
3934          .disabled=${this.loading}
3935          @inputChange=${this.onEmailInputChange.bind(this)}
3936          .errorMessage=${this.error}
3937        >
3938        </wui-email-input>
3939
3940        ${this.submitButtonTemplate()}${this.loadingTemplate()}
3941        <input type="submit" hidden />
3942      </form>
3943
3944      ${e.socials||!t?null:O.html`<wui-flex .padding=${["xxs","0","0","0"]}>
3945            <wui-separator text="or"></wui-separator>
3946          </wui-flex>`}
3947    `:null}submitButtonTemplate(){return!this.loading&&this.email.length>3?O.html`
3948          <wui-icon-link
3949            size="sm"
3950            icon="chevronRight"
3951            iconcolor="accent-100"
3952            @click=${this.onSubmitEmail.bind(this)}
3953          >
3954          </wui-icon-link>
3955        `:null}loadingTemplate(){return this.loading?O.html`<wui-loading-spinner size="md" color="accent-100"></wui-loading-spinner>`:null}onEmailInputChange(e){this.email=e.detail.trim(),this.error=""}async onSubmitEmail(e){if(![S.ConstantsUtil.CHAIN.EVM,S.ConstantsUtil.CHAIN.SOLANA].find(e=>e===m.ChainController.state.activeChain))return void b.RouterController.push("SwitchActiveChain",{switchToChain:S.ConstantsUtil.CHAIN.EVM});try{if(this.loading)return;this.loading=!0,e.preventDefault();let t=d.ConnectorController.getAuthConnector();if(!t)throw Error("w3m-email-login-widget: Auth connector not found");let{action:r}=await t.provider.connectEmail({email:this.email});f.EventsController.sendEvent({type:"track",event:"EMAIL_SUBMITTED"}),"VERIFY_OTP"===r?(f.EventsController.sendEvent({type:"track",event:"EMAIL_VERIFICATION_CODE_SENT"}),b.RouterController.push("EmailVerifyOtp",{email:this.email})):"VERIFY_DEVICE"===r&&b.RouterController.push("EmailVerifyDevice",{email:this.email})}catch(t){let e=p.CoreHelperUtil.parseError(t);e?.includes("Invalid email")?this.error="Invalid email. Try again.":v.SnackController.showError(t)}finally{this.loading=!1}}onFocusEvent(){f.EventsController.sendEvent({type:"track",event:"EMAIL_LOGIN_SELECTED"})}};nq.styles=nU,nM([(0,$.state)()],nq.prototype,"connectors",void 0),nM([(0,$.state)()],nq.prototype,"email",void 0),nM([(0,$.state)()],nq.prototype,"loading",void 0),nM([(0,$.state)()],nq.prototype,"error",void 0),nq=nM([(0,P.customElement)("w3m-email-login-widget")],nq);var nW=R;let nB=U.css`
3956  wui-flex {
3957    width: 100%;
3958  }
3959
3960  :host > wui-flex:first-child {
3961    transform: translateY(calc(var(--wui-spacing-xxs) * -1));
3962  }
3963
3964  wui-icon-link {
3965    margin-right: calc(var(--wui-icon-box-size-md) * -1);
3966  }
3967
3968  wui-notice-card {
3969    margin-bottom: var(--wui-spacing-3xs);
3970  }
3971
3972  wui-list-item > wui-text {
3973    flex: 1;
3974  }
3975
3976  w3m-transactions-view {
3977    max-height: 200px;
3978  }
3979
3980  .tab-content-container {
3981    height: 300px;
3982    overflow-y: auto;
3983    overflow-x: hidden;
3984    scrollbar-width: none;
3985  }
3986
3987  .tab-content-container::-webkit-scrollbar {
3988    display: none;
3989  }
3990
3991  .account-button {
3992    width: auto;
3993    border: none;
3994    display: flex;
3995    align-items: center;
3996    justify-content: center;
3997    gap: var(--wui-spacing-s);
3998    height: 48px;
3999    padding: var(--wui-spacing-xs);
4000    padding-right: var(--wui-spacing-s);
4001    box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002);
4002    background-color: var(--wui-color-gray-glass-002);
4003    border-radius: 24px;
4004    transition: background-color 0.2s linear;
4005  }
4006
4007  .account-button:hover {
4008    background-color: var(--wui-color-gray-glass-005);
4009  }
4010
4011  .avatar-container {
4012    position: relative;
4013  }
4014
4015  wui-avatar.avatar {
4016    width: 32px;
4017    height: 32px;
4018    box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005);
4019  }
4020
4021  wui-avatar.network-avatar {
4022    width: 16px;
4023    height: 16px;
4024    position: absolute;
4025    left: 100%;
4026    top: 100%;
4027    transform: translate(-75%, -75%);
4028    box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005);
4029  }
4030
4031  .account-links {
4032    display: flex;
4033    justify-content: space-between;
4034    align-items: center;
4035  }
4036
4037  .account-links wui-flex {
4038    cursor: pointer;
4039    display: flex;
4040    align-items: center;
4041    justify-content: center;
4042    flex: 1;
4043    background: red;
4044    align-items: center;
4045    justify-content: center;
4046    height: 48px;
4047    padding: 10px;
4048    flex: 1 0 0;
4049    border-radius: var(--XS, 16px);
4050    border: 1px solid var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1));
4051    background: var(--dark-accent-glass-010, rgba(71, 161, 255, 0.1));
4052    transition:
4053      background-color var(--wui-ease-out-power-1) var(--wui-duration-md),
4054      opacity var(--wui-ease-out-power-1) var(--wui-duration-md);
4055    will-change: background-color, opacity;
4056  }
4057
4058  .account-links wui-flex:hover {
4059    background: var(--dark-accent-glass-015, rgba(71, 161, 255, 0.15));
4060  }
4061
4062  .account-links wui-flex wui-icon {
4063    width: var(--S, 20px);
4064    height: var(--S, 20px);
4065  }
4066
4067  .account-links wui-flex wui-icon svg path {
4068    stroke: #667dff;
4069  }
4070`;var nz=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nH=class extends nW.LitElement{constructor(){super(),this.unsubscribe=[],this.address=c.AccountController.state.address,this.profileImage=c.AccountController.state.profileImage,this.profileName=c.AccountController.state.profileName,this.disconnecting=!1,this.balance=c.AccountController.state.balance,this.balanceSymbol=c.AccountController.state.balanceSymbol,this.unsubscribe.push(c.AccountController.subscribe(e=>{e.address?(this.address=e.address,this.profileImage=e.profileImage,this.profileName=e.profileName,this.balance=e.balance,this.balanceSymbol=e.balanceSymbol):this.disconnecting||v.SnackController.showError("Account not found")}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!this.address)throw Error("w3m-account-view: No account provided");return O.html`<wui-flex
4071        flexDirection="column"
4072        .padding=${["0","xl","m","xl"]}
4073        alignItems="center"
4074        gap="l"
4075      >
4076        ${m.ChainController.state.activeChain===S.ConstantsUtil.CHAIN.EVM?this.multiAccountTemplate():this.singleAccountTemplate()}
4077        <wui-flex flexDirection="column" alignItems="center">
4078          <wui-text variant="paragraph-500" color="fg-200">
4079            ${p.CoreHelperUtil.formatBalance(this.balance,this.balanceSymbol)}
4080          </wui-text>
4081        </wui-flex>
4082        ${this.explorerBtnTemplate()}
4083      </wui-flex>
4084
4085      <wui-flex flexDirection="column" gap="xs" .padding=${["0","s","s","s"]}>
4086        ${this.authCardTemplate()} <w3m-account-auth-button></w3m-account-auth-button>
4087        ${this.onrampTemplate()} ${this.swapsTemplate()} ${this.activityTemplate()}
4088        <wui-list-item
4089          variant="icon"
4090          iconVariant="overlay"
4091          icon="disconnect"
4092          ?chevron=${!1}
4093          .loading=${this.disconnecting}
4094          @click=${this.onDisconnect.bind(this)}
4095          data-testid="disconnect-button"
4096        >
4097          <wui-text variant="paragraph-500" color="fg-200">Disconnect</wui-text>
4098        </wui-list-item>
4099      </wui-flex>`}onrampTemplate(){let{enableOnramp:e}=x.OptionsController.state;return e?O.html`
4100      <wui-list-item
4101        data-testid="w3m-account-default-onramp-button"
4102        iconVariant="blue"
4103        icon="card"
4104        ?chevron=${!0}
4105        @click=${this.handleClickPay.bind(this)}
4106      >
4107        <wui-text variant="paragraph-500" color="fg-100">Buy crypto</wui-text>
4108      </wui-list-item>
4109    `:null}activityTemplate(){let e=m.ChainController.state.activeChain===S.ConstantsUtil.CHAIN.SOLANA;return O.html` <wui-list-item
4110      iconVariant="blue"
4111      icon="clock"
4112      iconSize="sm"
4113      ?chevron=${!e}
4114      ?disabled=${e}
4115      @click=${this.onTransactions.bind(this)}
4116    >
4117      <wui-text variant="paragraph-500" color="fg-100" ?disabled=${e}> Activity </wui-text>
4118      ${e?O.html`<wui-tag variant="main">Coming soon</wui-tag>`:""}
4119    </wui-list-item>`}swapsTemplate(){let{enableSwaps:e}=x.OptionsController.state;return e&&m.ChainController.state.activeChain!==S.ConstantsUtil.CHAIN.SOLANA?O.html`
4120      <wui-list-item
4121        iconVariant="blue"
4122        icon="recycleHorizontal"
4123        ?chevron=${!0}
4124        @click=${this.handleClickSwap.bind(this)}
4125      >
4126        <wui-text variant="paragraph-500" color="fg-100">Swap</wui-text>
4127      </wui-list-item>
4128    `:null}authCardTemplate(){let e=ec.StorageUtil.getConnectedConnector(),t=d.ConnectorController.getAuthConnector(),{origin:r}=location;return!t||"AUTH"!==e||r.includes(eh.ConstantsUtil.SECURE_SITE)?null:O.html`
4129      <wui-notice-card
4130        @click=${this.onGoToUpgradeView.bind(this)}
4131        label="Upgrade your wallet"
4132        description="Transition to a self-custodial wallet"
4133        icon="wallet"
4134        data-testid="w3m-wallet-upgrade-card"
4135      ></wui-notice-card>
4136    `}handleSwitchAccountsView(){b.RouterController.push("SwitchAddress")}handleClickPay(){b.RouterController.push("OnRampProviders")}handleClickSwap(){b.RouterController.push("Swap")}explorerBtnTemplate(){return c.AccountController.state.addressExplorerUrl?O.html`
4137      <wui-button size="md" variant="neutral" @click=${this.onExplorer.bind(this)}>
4138        <wui-icon size="sm" color="inherit" slot="iconLeft" name="compass"></wui-icon>
4139        Block Explorer
4140        <wui-icon size="sm" color="inherit" slot="iconRight" name="externalLink"></wui-icon>
4141      </wui-button>
4141
4142    `:null}singleAccountTemplate(){return O.html`
4143      <wui-avatar
4144        alt=${this.address??O.nothing}
4145        address=${this.address??O.nothing}
4146        imageSrc=${(null===this.profileImage?void 0:this.profileImage)??O.nothing}
4147      ></wui-avatar>
4148      <wui-flex flexDirection="column" alignItems="center">
4149        <wui-flex gap="3xs" alignItems="center" justifyContent="center">
4150          <wui-text variant="large-600" color="fg-100">
4151            ${this.profileName?ed.UiHelperUtil.getTruncateString({string:this.profileName,charsStart:20,charsEnd:0,truncate:"end"}):ed.UiHelperUtil.getTruncateString({string:this.address?this.address:"",charsStart:4,charsEnd:4,truncate:"middle"})}
4152          </wui-text>
4153          <wui-icon-link
4154            size="md"
4155            icon="copy"
4156            iconColor="fg-200"
4157            @click=${this.onCopyAddress}
4158          ></wui-icon-link> </wui-flex
4159      ></wui-flex>
4160    `}multiAccountTemplate(){if(!this.address)throw Error("w3m-account-view: No account provided");let e=c.AccountController.state.allAccounts?.find(e=>e.address===this.address),t=c.AccountController.state.addressLabels.get(this.address);return O.html`
4161      <wui-profile-button-v2
4162        .onProfileClick=${this.handleSwitchAccountsView.bind(this)}
4163        address=${this.address??O.nothing}
4164        icon="${e?.type===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT&&m.ChainController.state.activeChain===S.ConstantsUtil.CHAIN.EVM?"lightbulb":"mail"}"
4165        avatarSrc=${(this.profileImage?this.profileImage:void 0)??O.nothing}
4166        profileName=${(t||this.profileName)??O.nothing}
4167        .onCopyClick=${this.onCopyAddress.bind(this)}
4168      ></wui-profile-button-v2>
4169    `}onCopyAddress(){try{this.address&&(p.CoreHelperUtil.copyToClopboard(this.address),v.SnackController.showSuccess("Address copied"))}catch{v.SnackController.showError("Failed to copy")}}onTransactions(){f.EventsController.sendEvent({type:"track",event:"CLICK_TRANSACTIONS",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),b.RouterController.push("Transactions")}async onDisconnect(){try{this.disconnecting=!0,await h.ConnectionController.disconnect(),f.EventsController.sendEvent({type:"track",event:"DISCONNECT_SUCCESS"}),g.ModalController.close()}catch{f.EventsController.sendEvent({type:"track",event:"DISCONNECT_ERROR"}),v.SnackController.showError("Failed to disconnect")}finally{this.disconnecting=!1}}onExplorer(){let e=c.AccountController.state.addressExplorerUrl;e&&p.CoreHelperUtil.openHref(e,"_blank")}onGoToUpgradeView(){f.EventsController.sendEvent({type:"track",event:"EMAIL_UPGRADE_FROM_MODAL"}),b.RouterController.push("UpgradeEmailWallet")}};nH.styles=nB,nz([(0,$.state)()],nH.prototype,"address",void 0),nz([(0,$.state)()],nH.prototype,"profileImage",void 0),nz([(0,$.state)()],nH.prototype,"profileName",void 0),nz([(0,$.state)()],nH.prototype,"disconnecting",void 0),nz([(0,$.state)()],nH.prototype,"balance",void 0),nz([(0,$.state)()],nH.prototype,"balanceSymbol",void 0),nH=nz([(0,P.customElement)("w3m-account-default-widget")],nH);var nK=R;let nV=U.css`
4170  wui-flex {
4171    width: 100%;
4172  }
4173
4174  wui-promo {
4175    position: absolute;
4176    top: -32px;
4177  }
4178
4179  wui-profile-button {
4180    margin-top: calc(-1 * var(--wui-spacing-2l));
4181  }
4182
4183  wui-promo + wui-profile-button {
4184    margin-top: var(--wui-spacing-2l);
4185  }
4186
4187  wui-tabs {
4188    width: 100%;
4189  }
4190
4191  .contentContainer {
4192    height: 280px;
4193  }
4194
4195  .contentContainer > wui-icon-box {
4196    width: 40px;
4197    height: 40px;
4198    border-radius: var(--wui-border-radius-xxs);
4199  }
4200
4201  .contentContainer > .textContent {
4202    width: 65%;
4203  }
4204`;var nF=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let nG=class extends nK.LitElement{constructor(){super(),this.unsubscribe=[],this.address=c.AccountController.state.address,this.profileImage=c.AccountController.state.profileImage,this.profileName=c.AccountController.state.profileName,this.smartAccountDeployed=c.AccountController.state.smartAccountDeployed,this.network=_.NetworkController.state.caipNetwork,this.currentTab=c.AccountController.state.currentTab,this.tokenBalance=c.AccountController.state.tokenBalance,this.preferredAccountType=c.AccountController.state.preferredAccountType,this.unsubscribe.push(c.AccountController.subscribe(e=>{e.address?(this.address=e.address,this.profileImage=e.profileImage,this.profileName=e.profileName,this.currentTab=e.currentTab,this.tokenBalance=e.tokenBalance,this.smartAccountDeployed=e.smartAccountDeployed,this.preferredAccountType=e.preferredAccountType):g.ModalController.close()}),_.NetworkController.subscribeKey("caipNetwork",e=>{this.network=e})),this.watchSwapValues()}
4204disconnectedCallback(){this.unsubscribe.forEach(e=>e()),clearInterval(this.watchTokenBalance)}firstUpdated(){c.AccountController.fetchTokenBalance()}render(){if(!this.address)throw Error("w3m-account-view: No account provided");let e=E.AssetUtil.getNetworkImage(this.network);return O.html`<wui-flex
4205      flexDirection="column"
4206      .padding=${["0","xl","m","xl"]}
4207      alignItems="center"
4208      gap="m"
4209    >
4210      ${this.network&&O.html`<wui-network-icon .network=${this.network}></wui-network-icon>`}
4211      ${this.activateAccountTemplate()}
4212      <wui-profile-button
4213        @click=${this.onProfileButtonClick.bind(this)}
4214        address=${this.address??O.nothing}
4215        networkSrc=${e??O.nothing}
4216        icon="chevronBottom"
4217        avatarSrc=${(this.profileImage?this.profileImage:void 0)??O.nothing}
4218        profileName=${this.profileName}
4219        data-testid="w3m-profile-button"
4220      ></wui-profile-button>
4221      ${this.tokenBalanceTemplate()}
4222      <wui-flex gap="s">
4223        <w3m-tooltip-trigger text="Buy">
4224          <wui-icon-button
4225            data-testid="wallet-features-onramp-button"
4226            @click=${this.onBuyClick.bind(this)}
4227            icon="card"
4228          ></wui-icon-button>
4229        </w3m-tooltip-trigger>
4230        ${this.swapsTemplate()}
4231        <w3m-tooltip-trigger text="Receive">
4232          <wui-icon-button
4233            data-testid="wallet-features-receive-button"
4234            @click=${this.onReceiveClick.bind(this)}
4235            icon="arrowBottomCircle"
4236          >
4237          </wui-icon-button>
4238        </w3m-tooltip-trigger>
4239        <w3m-tooltip-trigger text="Send">
4240          <wui-icon-button
4241            data-testid="wallet-features-send-button"
4242            @click=${this.onSendClick.bind(this)}
4243            icon="send"
4244          ></wui-icon-button>
4245        </w3m-tooltip-trigger>
4246      </wui-flex>
4247
4248      <wui-tabs
4249        .onTabChange=${this.onTabChange.bind(this)}
4250        .activeTab=${this.currentTab}
4251        localTabWidth=${p.CoreHelperUtil.isMobile()&&window.innerWidth<430?`${(window.innerWidth-48)/3}px`:"104px"}
4252        .tabs=${X.ACCOUNT_TABS}
4253      ></wui-tabs>
4254      ${this.listContentTemplate()}
4255    </wui-flex>`}swapsTemplate(){let{enableSwaps:e}=x.OptionsController.state;return e?O.html`
4256      <w3m-tooltip-trigger text="Swap">
4257        <wui-icon-button
4258          data-testid="wallet-features-swap-button"
4259          @click=${this.onSwapClick.bind(this)}
4260          icon="recycleHorizontal"
4261        >
4262        </wui-icon-button>
4263      </w3m-tooltip-trigger>
4264    `:null}watchSwapValues(){this.watchTokenBalance=setInterval(()=>c.AccountController.fetchTokenBalance(),1e4)}listContentTemplate(){return 0===this.currentTab?O.html`<w3m-account-tokens-widget></w3m-account-tokens-widget>`:1===this.currentTab?O.html`<w3m-account-nfts-widget></w3m-account-nfts-widget>`:2===this.currentTab?O.html`<w3m-account-activity-widget></w3m-account-activity-widget>`:O.html`<w3m-account-tokens-widget></w3m-account-tokens-widget>`}tokenBalanceTemplate(){if(this.tokenBalance&&this.tokenBalance?.length>=0){let e=p.CoreHelperUtil.calculateBalance(this.tokenBalance),{dollars:t="0",pennies:r="00"}=p.CoreHelperUtil.formatTokenBalance(e);return O.html`<wui-balance dollars=${t} pennies=${r}></wui-balance>`}return O.html`<wui-balance dollars="0" pennies="00"></wui-balance>`}activateAccountTemplate(){return!_.NetworkController.checkIfSmartAccountEnabled()||this.preferredAccountType!==ef.W3mFrameRpcConstants.ACCOUNT_TYPES.EOA||this.smartAccountDeployed?null:O.html` <wui-promo
4265      text=${"Activate your account"}
4266      @click=${this.onUpdateToSmartAccount.bind(this)}
4267      data-testid="activate-smart-account-promo"
4268    ></wui-promo>`}onTabChange(e){c.AccountController.setCurrentTab(e)}onProfileButtonClick(){b.RouterController.push("Profile")}onBuyClick(){b.RouterController.push("OnRampProviders")}onSwapClick(){this.network?.id&&!eh.ConstantsUtil.SWAP_SUPPORTED_NETWORKS.includes(this.network?.id)?b.RouterController.push("UnsupportedChain",{swapUnsupportedChain:!0}):(f.EventsController.sendEvent({type:"track",event:"OPEN_SWAP",properties:{network:this.network?.id||"",isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.A
4268CCOUNT_TYPES.SMART_ACCOUNT}}),b.RouterController.push("Swap"))}onReceiveClick(){b.RouterController.push("WalletReceive")}onSendClick(){f.EventsController.sendEvent({type:"track",event:"OPEN_SEND",properties:{network:this.network?.id||"",isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),b.RouterController.push("WalletSend")}onUpdateToSmartAccount(){b.RouterController.push("UpgradeToSmartAccount")}};nG.styles=nV,nF([(0,$.state)()],nG.prototype,"watchTokenBalance",void 0),nF([(0,$.state)()],nG.prototype,"address",void 0),nF([(0,$.state)()],nG.prototype,"profileImage",void 0),nF([(0,$.state)()],nG.prototype,"profileName",void 0),nF([(0,$.state)()],nG.prototype,"smartAccountDeployed",void 0),nF([(0,$.state)()],nG.prototype,"network",void 0),nF([(0,$.state)()],nG.prototype,"currentTab",void 0),nF([(0,$.state)()],nG.prototype,"tokenBalance",void 0),nF([(0,$.state)()],nG.prototype,"preferredAccountType",void 0),nG=nF([(0,P.customElement)("w3m-account-wallet-features-widget")],nG);var nY=R;let nJ=U.css`
4269  :host {
4270    width: 100%;
4271    max-height: 280px;
4272    overflow: scroll;
4273    scrollbar-width: none;
4274  }
4275
4276  :host::-webkit-scrollbar {
4277    display: none;
4278  }
4279`,nZ=class extends nY.LitElement{render(){return O.html`<w3m-activity-list page="account"></w3m-activity-list>`}};nZ.styles=nJ,nZ=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-account-activity-widget")],nZ);var nQ=R;let nX=U.css`
4280  .contentContainer {
4281    height: 280px;
4282  }
4283
4284  .contentContainer > wui-icon-box {
4285    width: 40px;
4286    height: 40px;
4287    border-radius: var(--wui-border-radius-xxs);
4288  }
4289
4290  .contentContainer > .textContent {
4291    width: 65%;
4292  }
4293`,n0=class extends nQ.LitElement{render(){return O.html`${this.nftTemplate()}`}nftTemplate(){return O.html` <wui-flex
4294      class="contentContainer"
4295      alignItems="center"
4296      justifyContent="center"
4297      flexDirection="column"
4298      gap="l"
4299    >
4300      <wui-icon-box
4301        icon="wallet"
4302        size="inherit"
4303        iconColor="fg-200"
4304        backgroundColor="fg-200"
4305        iconSize="lg"
4306      ></wui-icon-box>
4307      <wui-flex
4308        class="textContent"
4309        gap="xs"
4310        flexDirection="column"
4311        justifyContent="center"
4312        flexDirection="column"
4313      >
4314        <wui-text variant="paragraph-500" align="center" color="fg-100">Coming soon</wui-text>
4315        <wui-text variant="small-400" align="center" color="fg-200"
4316          >Stay tuned for our upcoming NFT feature</wui-text
4317        >
4318      </wui-flex>
4319      <wui-link @click=${this.onReceiveClick.bind(this)}>Receive funds</wui-link>
4320    </wui-flex>`}onReceiveClick(){b.RouterController.push("WalletReceive")}};n0.styles=nX,n0=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-account-nfts-widget")],n0);var n1=R;let n3=U.css`
4321  :host {
4322    width: 100%;
4323  }
4324
4325  wui-flex {
4326    width: 100%;
4327  }
4328
4329  .contentContainer {
4330    max-height: 280px;
4331    overflow: scroll;
4332    scrollbar-width: none;
4333  }
4334
4335  .contentContainer::-webkit-scrollbar {
4336    display: none;
4337  }
4338`;var n2=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let n5=class extends n1.LitElement{constructor(){super(),this.unsubscribe=[],this.tokenBalance=c.AccountController.state.tokenBalance,this.unsubscribe.push(c.AccountController.subscribe(e=>{this.tokenBalance=e.tokenBalance}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html`${this.tokenTemplate()}`}tokenTemplate(){return this.tokenBalance&&this.tokenBalance?.length>0?O.html`<wui-flex class="contentContainer" flexDirection="column" gap="xs">
4339        ${this.tokenItemTemplate()}
4340      </wui-flex>`:O.html` <wui-flex flexDirection="column" gap="xs"
4341      ><wui-list-description
4342        @click=${this.onBuyClick.bind(this)}
4343        text="Buy Crypto"
4344        description="Easy with card or bank account"
4345        icon="card"
4346        iconColor="success-100"
4347        iconBackgroundColor="success-100"
4348        tag="popular"
4349      ></wui-list-description
4350      ><wui-list-description
4351        @click=${this.onReceiveClick.bind(this)}
4352        text="Receive funds"
4353        description="Transfer tokens on your wallet"
4354        icon="arrowBottomCircle"
4355        iconColor="fg-200"
4356        iconBackgroundColor="fg-200"
4357      ></wui-list-description
4358    ></wui-flex>`}tokenItemTemplate(){return this.tokenBalance?.map(e=>O.html`<wui-list-token
4359          tokenName=${e.name}
4360          tokenImageUrl=${e.iconUrl}
4361          tokenAmount=${e.quantity.numeric}
4362          tokenValue=${e.value}
4363          tokenCurrency=${e.symbol}
4364        ></wui-list-token>`)}onReceiveClick(){b.RouterController.push("WalletReceive")}onBuyClick(){f.EventsController.sendEvent({type:"track",event:"SELECT_BUY_CRYPTO",properties:{isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT}}),b.RouterController.push("OnRampProviders")}};n5.styles=n3,n2([(0,$.state)()],n5.prototype,"tokenBalance",void 0),n5=n2([(0,P.customElement)("w3m-account-tokens-widget")],n5);var n4=R;let n6=U.css`
4365  :host {
4366    min-height: 100%;
4367  }
4368
4369  .group-container[last-group='true'] {
4370    padding-bottom: var(--wui-spacing-m);
4371  }
4372
4373  .contentContainer {
4374    height: 280px;
4375  }
4376
4377  .contentContainer > wui-icon-box {
4378    width: 40px;
4379    height: 40px;
4380    border-radius: var(--wui-border-radius-xxs);
4381  }
4382
4383  .contentContainer > .textContent {
4384    width: 65%;
4385  }
4386
4387  .emptyContainer {
4388    height: 100%;
4389  }
4390`;var n8=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let n9="last-transaction",n7=class extends n4.LitElement{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.page="activity",this.address=c.AccountController.state.address,this.transactionsByYear=tA.TransactionsController.state.transactionsByYear,this.loading=tA.TransactionsController.state.loading,this.empty=tA.TransactionsController.state.empty,this.next=tA.TransactionsController.state.next,tA.TransactionsController.clearCursor(),this.unsubscribe.push(c.AccountController.subscribe(e=>{e.isConnected&&this.address!==e.address&&(this.address=e.address,tA.TransactionsController.resetTransactions(),tA.TransactionsController.fetchTransactions(e.address))}),_.NetworkController.subscribeKey("caipNetwork",()=>{this.updateTransactionView()}),tA.TransactionsController.subscribe(e=>{this.transactionsByYear=e.transactionsByYear,this.loading=e.loading,this.empty=e.empty,this.next=e.next}))}firstUpdated(){this.updateTransactionView(),this.createPaginationObserver()}updated(){this.setPaginationObserver()}
4390disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return O.html` ${this.empty?null:this.templateTransactionsByYear()}
4391    ${this.loading?this.templateLoading():null}
4392    ${!this.loading&&this.empty?this.templateEmpty():null}`}updateTransactionView(){let e=_.NetworkController.state.caipNetwork?.id;tA.TransactionsController.state.lastNetworkInView!==e&&(tA.TransactionsController.resetTransactions(),tA.TransactionsController.fetchTransactions(this.address)),tA.TransactionsController.setLastNetworkInView(e)}templateTransactionsByYear(){return Object.keys(this.transactionsByYear).sort().reverse().map(e=>{let t=parseInt(e,10),r=Array(12).fill(null).map((e,r)=>({groupTitle:tT.TransactionUtil.getTransactionGroupTitle(t,r),transactions:this.transactionsByYear[t]?.[r]})).filter(({transactions:e})=>e).reverse();return r.map(({groupTitle:e,transactions:t},i)=>{let n=i===r.length-1;return t?O.html`
4393          <wui-flex
4394            flexDirection="column"
4395            class="group-container"
4396            last-group="${n?"true":"false"}"
4397          >
4398            <wui-flex
4399              alignItems="center"
4400              flexDirection="row"
4401              .padding=${["xs","s","s","s"]}
4402            >
4403              <wui-text variant="paragraph-500" color="fg-200">${e}</wui-text>
4404            </wui-flex>
4405            <wui-flex flexDirection="column" gap="xs">
4406              ${this.templateTransactions(t,n)}
4407            </wui-flex>
4408          </wui-flex>
4409        `:null})})}templateRenderTransaction(e,t){let{date:r,descriptions:i,direction:n,isAllNFT:s,images:o,status:a,transfers:l,type:c}=this.getTransactionListItemProps(e),u=l?.length>1;return l?.length!==2||s?u?l.map((e,i)=>{let n=tT.TransactionUtil.getTransferDescription(e),s=t&&i===l.length-1;return O.html` <wui-transaction-list-item
4410          date=${r}
4411          direction=${e.direction}
4412          id=${s&&this.next?n9:""}
4413          status=${a}
4414          type=${c}
4415          .onlyDirectionIcon=${!0}
4416          .images=${[o[i]]}
4417          .descriptions=${[n]}
4418        ></wui-transaction-list-item>`}):O.html`
4419      <wui-transaction-list-item
4420        date=${r}
4421        .direction=${n}
4422        id=${t&&this.next?n9:""}
4423        status=${a}
4424        type=${c}
4425        .images=${o}
4426        .descriptions=${i}
4427      ></wui-transaction-list-item>
4428    `:O.html`
4429        <wui-transaction-list-item
4430          date=${r}
4431          .direction=${n}
4432          id=${t&&this.next?n9:""}
4433          status=${a}
4434          type=${c}
4435          .images=${o}
4436          .descriptions=${i}
4437        ></wui-transaction-list-item>
4438      `}templateTransactions(e,t){return e.map((r,i)=>{let n=t&&i===e.length-1;return O.html`${this.templateRenderTransaction(r,n)}`})}emptyStateActivity(){return O.html`<wui-flex
4439      class="emptyContainer"
4440      flexGrow="1"
4441      flexDirection="column"
4442      justifyContent="center"
4443      alignItems="center"
4444      .padding=${["3xl","xl","3xl","xl"]}
4445      gap="xl"
4446    >
4447      <wui-icon-box
4448        backgroundColor="gray-glass-005"
4449        background="gray"
4450        iconColor="fg-200"
4451        icon="wallet"
4452        size="lg"
4453        ?border=${!0}
4454        borderColor="wui-color-bg-125"
4455      ></wui-icon-box>
4456      <wui-flex flexDirection="column" alignItems="center" gap="xs">
4457        <wui-text align="center" variant="paragraph-500" color="fg-100"
4458          >No Transactions yet</wui-text
4459        >
4460        <wui-text align="center" variant="small-500" color="fg-200"
4461          >Start trading on dApps <br />
4462          to grow your wallet!</wui-text
4463        >
4464      </wui-flex>
4465    </wui-flex>`}emptyStateAccount(){return O.html`<wui-flex
4466      class="contentContainer"
4467      alignItems="center"
4468      justifyContent="center"
4469      flexDirection="column"
4470      gap="l"
4471    >
4472      <wui-icon-box
4473        icon="swapHorizontal"
4474        size="inherit"
4475        iconColor="fg-200"
4476        backgroundColor="fg-200"
4477        iconSize="lg"
4478      ></wui-icon-box>
4479      <wui-flex
4480        class="textContent"
4481        gap="xs"
4482        flexDirection="column"
4483        justifyContent="center"
4484        flexDirection="column"
4485      >
4486        <wui-text variant="paragraph-500" align="center" color="fg-100">No activity yet</wui-text>
4487        <wui-text variant="small-400" align="center" color="fg-200"
4488          >Your next transactions will appear here</wui-text
4489        >
4490      </wui-flex>
4491      <wui-link @click=${this.onReceiveClick.bind(this)}>Trade</wui-link>
4492    </wui-flex>`}templateEmpty(){return"account"===this.page?O.html`${this.emptyStateAccount()}`:O.html`${this.emptyStateActivity()}`}templateLoading(){return"activity"===this.page?Array(7).fill(O.html` <wui-transaction-list-item-loader></wui-transaction-list-item-loader> `).map(e=>e):null}onReceiveClick(){b.RouterController.push("WalletReceive")}createPaginationObserver(){let{projectId:e}=x.OptionsController.state;this.paginationObserver=new IntersectionObserver(([t])=>{t?.isIntersecting&&!this.loading&&(tA.TransactionsController.fetchTransactions(this.address),f.EventsController.sendEvent({type:"track",event:"LOAD_MORE_TRANSACTIONS",properties:{address:this.address,projectId:e,cursor:this.next,isSmartAccount:c.AccountController.state.preferredAccountType===ef.W3mFrameRpcConstants.A
4492CCOUNT_TYPES.SMART_ACCOUNT}}))},{}),this.setPaginationObserver()}setPaginationObserver(){this.paginationObserver?.disconnect();let e=this.shadowRoot?.querySelector(`#${n9}`);e&&this.paginationObserver?.observe(e)}getTransactionListItemProps(e){let t=tI.DateUtil.formatDate(e?.metadata?.minedAt),r=tT.TransactionUtil.getTransactionDescriptions(e),i=e?.transfers,n=e?.transfers?.[0],s=!!n&&e?.transfers?.every(e=>!!e.nft_info),o=tT.TransactionUtil.getTransactionImages(i);return{date:t,direction:n?.direction,descriptions:r,isAllNFT:s,images:o,status:e.metadata?.status,transfers:i,type:e.metadata?.operationType}}};n7.styles=n6,n8([(0,N.property)()],n7.prototype,"page",void 0),n8([(0,$.state)()],n7.prototype,"address",void 0),n8([(0,$.state)()],n7.prototype,"transactionsByYear",void 0),n8([(0,$.state)()],n7.prototype,"loading",void 0),n8([(0,$.state)()],n7.prototype,"empty",void 0),n8([(0,$.state)()],n7.prototype,"next",void 0),n7=n8([(0,P.customElement)("w3m-activity-list")],n7);var se=R;let st=U.css`
4493  :host {
4494    width: 100%;
4495    height: 100px;
4496    border-radius: var(--wui-border-radius-s);
4497    border: 1px solid var(--wui-color-gray-glass-002);
4498    background-color: var(--wui-color-gray-glass-002);
4499    transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
4500    will-change: background-color;
4501  }
4502
4503  :host(:hover) {
4504    background-color: var(--wui-color-gray-glass-005);
4505  }
4506
4507  wui-flex {
4508    width: 100%;
4509    height: fit-content;
4510  }
4511
4512  wui-button {
4513    width: 100%;
4514    display: flex;
4515    justify-content: flex-end;
4516  }
4517
4518  wui-input-amount {
4519    mask-image: linear-gradient(
4520      270deg,
4521      transparent 0px,
4522      transparent 8px,
4523      black 24px,
4524      black 25px,
4525      black 32px,
4526      black 100%
4527    );
4528  }
4529
4530  .totalValue {
4531    width: 100%;
4532  }
4533`;var sr=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let si=class extends se.LitElement{render(){return O.html` <wui-flex
4534      flexDirection="column"
4535      gap="4xs"
4536      .padding=${["xl","s","l","l"]}
4537    >
4538      <wui-flex alignItems="center">
4539        <wui-input-amount
4540          @inputChange=${this.onInputChange.bind(this)}
4541          ?disabled=${!this.token}
4542          .value=${this.sendTokenAmount?String(this.sendTokenAmount):""}
4543        ></wui-input-amount>
4544        ${this.buttonTemplate()}
4545      </wui-flex>
4546      <wui-flex alignItems="center" justifyContent="space-between">
4547        ${this.sendValueTemplate()}
4548        <wui-flex alignItems="center" gap="4xs" justifyContent="flex-end">
4549          ${this.maxAmountTemplate()} ${this.actionTemplate()}
4550        </wui-flex>
4551      </wui-flex>
4552    </wui-flex>`}buttonTemplate(){return this.token?O.html`<wui-token-button
4553        text=${this.token.symbol}
4554        imageSrc=${this.token.iconUrl}
4555        @click=${this.handleSelectButtonClick.bind(this)}
4556      >
4557      </wui-token-button>`:O.html`<wui-button
4558      size="md"
4559      variant="accent"
4560      @click=${this.handleSelectButtonClick.bind(this)}
4561      >Select token</wui-button
4562    >`}handleSelectButtonClick(){b.RouterController.push("WalletSendSelectToken")}sendValueTemplate(){if(this.token&&this.sendTokenAmount){let e=this.token.price*this.sendTokenAmount;return O.html`<wui-text class="totalValue" variant="small-400" color="fg-200"
4563        >${e?`$${ed.UiHelperUtil.formatNumberToLocalString(e,2)}`:"Incorrect value"}</wui-text
4564      >`}return null}maxAmountTemplate(){return this.token?this.sendTokenAmount&&this.sendTokenAmount>Number(this.token.quantity.numeric)?O.html` <wui-text variant="small-400" color="error-100">
4565          ${ed.UiHelperUtil.roundNumber(Number(this.token.quantity.numeric),6,5)}
4566        </wui-text>`:O.html` <wui-text variant="small-400" color="fg-200">
4567        ${ed.UiHelperUtil.roundNumber(Number(this.token.quantity.numeric),6,5)}
4568      </wui-text>`:null}actionTemplate(){return this.token?this.sendTokenAmount&&this.sendTokenAmount>Number(this.token.quantity.numeric)?O.html`<wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>`:O.html`<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>`:null}onInputChange(e){eu.SendController.setTokenAmount(e.detail)}onMaxClick(){if(this.token&&void 0!==this.gasPrice){let e=void 0===this.token.address||Object.values(eh.ConstantsUtil.NATIVE_TOKEN_ADDRESS).some(e=>this.token?.address===e),t=tG.NumberUtil.bigNumber(this.gasPrice).shiftedBy(-this.token.quantity.decimals),r=e?tG.NumberUtil.bigNumber(this.token.quantity.numeric).minus(t):tG.NumberUtil.bigNumber(this.token.quantity.numeric);eu.SendController.setTokenAmount(Number(r.toFixed(20)))}}onBuyClick(){b.RouterController.push("OnRampProviders")}};si.styles=st,sr([(0,N.property)({type:Object})],si.prototype,"token",void 0),sr([(0,N.property)({type:Number})],si.prototype,"sendTokenAmount",void 0),sr([(0,N.property)({type:Number})],si.prototype,"gasPriceInUSD",void 0),sr([(0,N.property)({type:Number})],si.prototype,"gasPrice",void 0),si=sr([(0,P.customElement)("w3m-input-token")],si);var sn=R;let ss=U.css`
4569  :host {
4570    width: 100%;
4571    height: 100px;
4572    border-radius: var(--wui-border-radius-s);
4573    border: 1px solid var(--wui-color-gray-glass-002);
4574    background-color: var(--wui-color-gray-glass-002);
4575    transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
4576    will-change: background-color;
4577    position: relative;
4578  }
4579
4580  :host(:hover) {
4581    background-color: var(--wui-color-gray-glass-005);
4582  }
4583
4584  wui-flex {
4585    width: 100%;
4586    height: fit-content;
4587  }
4588
4589  wui-button {
4590    display: ruby;
4591    color: var(--wui-color-fg-100);
4592    margin: 0 var(--wui-spacing-xs);
4593  }
4594
4595  .instruction {
4596    position: absolute;
4597    top: 50%;
4598    transform: translateY(-50%);
4599    z-index: 2;
4600  }
4601
4602  .paste {
4603    display: inline-flex;
4604  }
4605
4606  textarea {
4607    background: transparent;
4608    width: 100%;
4609    font-family: var(--w3m-font-family);
4610    font-size: var(--wui-font-size-medium);
4611    font-style: normal;
4612    font-weight: var(--wui-font-weight-light);
4613    line-height: 130%;
4614    letter-spacing: var(--wui-letter-spacing-medium);
4615    color: var(--wui-color-fg-100);
4616    caret-color: var(--wui-color-accent-100);
4617    box-sizing: border-box;
4618    -webkit-appearance: none;
4619    -moz-appearance: textfield;
4620    padding: 0px;
4621    border: none;
4622    outline: none;
4623    appearance: none;
4624    resize: none;
4625    overflow: hidden;
4626  }
4627`;var so=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
4627);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sa=class extends sn.LitElement{constructor(){super(...arguments),this.inputElementRef=tl(),this.instructionElementRef=tl(),this.instructionHidden=!!this.value,this.pasting=!1,this.onDebouncedSearch=p.CoreHelperUtil.debounce(async e=>{let t=await h.ConnectionController.getEnsAddress(e);if(eu.SendController.setLoading(!1),t){eu.SendController.setReceiverProfileName(e),eu.SendController.setReceiverAddress(t);let r=await h.ConnectionController.getEnsAvatar(e);r&&eu.SendController.setReceiverProfileImageUrl(r)}else eu.SendController.setReceiverAddress(e),eu.SendController.setReceiverProfileName(void 0),eu.SendController.setReceiverProfileImageUrl(void 0)})}firstUpdated(){this.value&&(this.instructionHidden=!0),this.checkHidden()}render(){return O.html` <wui-flex
4628      @click=${this.onBoxClick.bind(this)}
4629      flexDirection="column"
4630      justifyContent="center"
4631      gap="4xs"
4632      .padding=${["2xl","l","xl","l"]}
4633    >
4634      <wui-text
4635        ${th(this.instructionElementRef)}
4636        class="instruction"
4637        color="fg-300"
4638        variant="medium-400"
4639      >
4640        Type or
4641        <wui-button
4642          class="paste"
4643          size="md"
4644          variant="neutral"
4645          iconLeft="copy"
4646          @click=${this.onPasteClick.bind(this)}
4647        >
4648          <wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
4649          Paste
4650        </wui-button>
4651        address
4652      </wui-text>
4653      <textarea
4654        spellcheck="false"
4655        ?disabled=${!this.instructionHidden}
4656        ${th(this.inputElementRef)}
4657        @input=${this.onInputChange.bind(this)}
4658        @blur=${this.onBlur.bind(this)}
4659        .value=${this.value??""}
4660        autocomplete="off"
4661      >
4662${this.value??""}</textarea
4663      >
4664    </wui-flex>`}async focusInput(){this.instructionElementRef.value&&(this.instructionHidden=!0,await this.toggleInstructionFocus(!1),this.instructionElementRef.value.style.pointerEvents="none",this.inputElementRef.value?.focus(),this.inputElementRef.value&&(this.inputElementRef.value.selectionStart=this.inputElementRef.value.selectionEnd=this.inputElementRef.value.value.length))}async focusInstruction(){this.instructionElementRef.value&&(this.instructionHidden=!1,await this.toggleInstructionFocus(!0),this.instructionElementRef.value.style.pointerEvents="auto",this.inputElementRef.value?.blur())}async toggleInstructionFocus(e){this.instructionElementRef.value&&await this.instructionElementRef.value.animate([{opacity:+!e},{opacity:+!!e}],{duration:100,easing:"ease",fill:"forwards"}).finished}onBoxClick(){this.value||this.instructionHidden||this.focusInput()}onBlur(){this.value||!this.instructionHidden||this.pasting||this.focusInstruction()}checkHidden(){this.instructionHidden&&this.focusInput()}async onPasteClick(){this.pasting=!0;let e=await navigator.clipboard.readText();eu.SendController.setReceiverAddress(e),this.focusInput()}onInputChange(e){this.pasting=!1;let t=e.target;t.value&&!this.instructionHidden&&this.focusInput(),eu.SendController.setLoading(!0),this.onDebouncedSearch(t.value)}};sa.styles=ss,so([(0,N.property)()],sa.prototype,"value",void 0),so([(0,$.state)()],sa.prototype,"instructionHidden",void 0),so([(0,$.state)()],sa.prototype,"pasting",void 0),sa=so([(0,P.customElement)("w3m-input-address")],sa);var sl=R;let sc=U.css`
4665  :host {
4666    display: flex;
4667    width: auto;
4668    flex-direction: column;
4669    gap: var(--wui-border-radius-1xs);
4670    border-radius: var(--wui-border-radius-s);
4671    background: var(--wui-color-gray-glass-002);
4672    padding: var(--wui-spacing-s) var(--wui-spacing-1xs) var(--wui-spacing-1xs)
4673      var(--wui-spacing-1xs);
4674  }
4675
4676  wui-text {
4677    padding: 0 var(--wui-spacing-1xs);
4678  }
4679
4680  wui-flex {
4681    margin-top: var(--wui-spacing-1xs);
4682  }
4683
4684  .network {
4685    cursor: pointer;
4686    transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
4687    will-change: background-color;
4688  }
4689
4690  .network:focus-visible {
4691    border: 1px solid var(--wui-color-accent-100);
4692    background-color: var(--wui-color-gray-glass-005);
4693    -webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
4694    -moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
4695    box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
4696  }
4697
4698  .network:hover {
4699    background-color: var(--wui-color-gray-glass-005);
4700  }
4701
4702  .network:active {
4703    background-color: var(--wui-color-gray-glass-010);
4704  }
4705`;var su=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sh=class extends sl.LitElement{render(){return O.html` <wui-text variant="small-400" color="fg-200">Details</wui-text>
4706      <wui-flex flexDirection="column" gap="xxs">
4707        <wui-list-content textTitle="Network cost" textValue="$${ed.UiHelperUtil.formatNumberToLocalString(this.networkFee,2)??O.nothing}"></wui-list-content></wui-list-content>
4708        <wui-list-content
4709          textTitle="Address"
4710          textValue=${ed.UiHelperUtil.getTruncateString({string:this.receiverAddress??"",charsStart:4,charsEnd:4,truncate:"middle"})}
4711        >
4712        </wui-list-content>
4713        ${this.networkTemplate()}
4714      </wui-flex>`}networkTemplate(){return this.caipNetwork?.name?O.html` <wui-list-content
4715        @click=${()=>this.onNetworkClick(this.caipNetwork)}
4716        class="network"
4717        textTitle="Network"
4718        imageSrc=${E.AssetUtil.getNetworkImage(this.caipNetwork)??O.nothing}
4719      ></wui-list-content>`:null}onNetworkClick(e){e&&b.RouterController.push("Networks",{network:e})}};sh.styles=sc,su([(0,N.property)()],sh.prototype,"receiverAddress",void 0),su([(0,N.property)({type:Object})],sh.prototype,"caipNetwork",void 0),su([(0,N.property)({type:Number})],sh.prototype,"networkFee",void 0),sh=su([(0,P.customElement)("w3m-wallet-send-details")],sh);var sd=R;let sp=U.css`
4720  :host {
4721    pointer-events: none;
4722  }
4723
4724  :host > wui-flex {
4725    display: var(--w3m-tooltip-display);
4726    opacity: var(--w3m-tooltip-opacity);
4727    padding: 9px var(--wui-spacing-s) 10px var(--wui-spacing-s);
4728    border-radius: var(--wui-border-radius-xxs);
4729    color: var(--wui-color-bg-100);
4730    position: fixed;
4731    top: var(--w3m-tooltip-top);
4732    left: var(--w3m-tooltip-left);
4733    transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px));
4734    max-width: calc(var(--w3m-modal-width) - var(--wui-spacing-xl));
4735    transition: opacity 0.2s var(--wui-ease-out-power-2);
4736    will-change: opacity;
4737  }
4738
4739  :host([data-variant='shade']) > wui-flex {
4740    background-color: var(--wui-color-bg-150);
4741    border: 1px solid var(--wui-color-gray-glass-005);
4742  }
4743
4744  :host([data-variant='shade']) > wui-flex > wui-text {
4745    color: var(--wui-color-fg-150);
4746  }
4747
4748  :host([data-variant='fill']) > wui-flex {
4749    background-color: var(--wui-color-fg-100);
4750    border: none;
4751  }
4752
4753  wui-icon {
4754    position: absolute;
4755    width: 12px !important;
4756    height: 4px !important;
4757    color: var(--wui-color-bg-150);
4758  }
4759
4760  wui-icon[data-placement='top'] {
4761    bottom: 0px;
4762    left: 50%;
4763    transform: translate(-50%, 95%);
4764  }
4765
4766  wui-icon[data-placement='bottom'] {
4767    top: 0;
4768    left: 50%;
4769    transform: translate(-50%, -95%) rotate(180deg);
4770  }
4771
4772  wui-icon[data-placement='right'] {
4773    top: 50%;
4774    left: 0;
4775    transform: translate(-65%, -50%) rotate(90deg);
4776  }
4777
4778  wui-icon[data-placement='left'] {
4779    top: 50%;
4780    right: 0%;
4781    transform: translate(65%, -50%) rotate(270deg);
4782  }
4783`;var sf=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sg=class extends sd.LitElement{constructor(){super(),this.unsubscribe=[],this.open=Y.TooltipController.state.open,this.message=Y.TooltipController.state.message,this.triggerRect=Y.TooltipController.state.triggerRect,this.variant=Y.TooltipController.state.variant,this.unsubscribe.push(Y.TooltipController.subscribe(e=>{this.open=e.open,this.message=e.message,this.triggerRect=e.triggerRect,this.variant=e.variant}))}
4783disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){this.dataset.variant=this.variant;let e=this.triggerRect.top,t=this.triggerRect.left;return this.style.cssText=`
4784    --w3m-tooltip-top: ${e}px;
4785    --w3m-tooltip-left: ${t}px;
4786    --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px;
4787    --w3m-tooltip-display: ${this.open?"flex":"none"};
4788    --w3m-tooltip-opacity: ${+!!this.open};
4789    `,O.html`<wui-flex>
4790      <wui-icon data-placement="top" color="fg-100" size="inherit" name="cursor"></wui-icon>
4791      <wui-text color="inherit" variant="small-500">${this.message}</wui-text>
4792    </wui-flex>`}};sg.styles=[sp],sf([(0,$.state)()],sg.prototype,"open",void 0),sf([(0,$.state)()],sg.prototype,"message",void 0),sf([(0,$.state)()],sg.prototype,"triggerRect",void 0),sf([(0,$.state)()],sg.prototype,"variant",void 0),sg=sf([(0,P.customElement)("w3m-tooltip")],sg);var sm=R;let sw=U.css`
4793  :host {
4794    width: 100%;
4795    display: block;
4796  }
4797`;var sy=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sv=class extends sm.LitElement{constructor(){super(),this.unsubscribe=[],this.text="",this.open=Y.TooltipController.state.open,this.unsubscribe.push(b.RouterController.subscribeKey("view",()=>{Y.TooltipController.hide()}),g.ModalController.subscribeKey("open",e=>{e||Y.TooltipController.hide()}),Y.TooltipController.subscribeKey("open",e=>{this.open=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e()),Y.TooltipController.hide()}render(){return O.html`
4798      <div
4799        @pointermove=${this.onMouseEnter.bind(this)}
4800        @pointerleave=${this.onMouseLeave.bind(this)}
4801      >
4802        ${this.renderChildren()}
4803      </div>
4804    `}renderChildren(){return O.html`<slot></slot> `}onMouseEnter(){let e=this.getBoundingClientRect();this.open||Y.TooltipController.showTooltip({message:this.text,triggerRect:{width:e.width,height:e.height,left:e.left,top:e.top},variant:"shade"})}onMouseLeave(e){this.contains(e.relatedTarget)||Y.TooltipController.hide()}};sv.styles=[sw],sy([(0,N.property)()],sv.prototype,"text",void 0),sy([(0,$.state)()],sv.prototype,"open",void 0),sv=sy([(0,P.customElement)("w3m-tooltip-trigger")],sv);var sb=R;let sC=U.css`
4805  :host > wui-flex:first-child {
4806    margin-top: var(--wui-spacing-s);
4807  }
4808  wui-separator {
4809    margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-m)
4810      calc(var(--wui-spacing-m) * -1);
4811    width: calc(100% + var(--wui-spacing-s) * 2);
4812  }
4813`;var sx=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let s_=class extends sb.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.connector=this.connectors.find(e=>"AUTH"===e.type),this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>{this.connectors=e,this.connector=this.connectors.find(e=>"AUTH"===e.type)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.connector?O.html`
4814      <wui-flex
4815        class="container"
4816        flexDirection="column"
4817        gap="xs"
4818        .padding=${["0","0","xs","0"]}
4819        data-testid="w3m-social-login-widget"
4820      >
4821        ${this.topViewTemplate()}${this.bottomViewTemplate()}
4822      </wui-flex>
4823      ${this.separatorTemplate()}
4824    `:null}topViewTemplate(){return this.connector?.socials?.length?2===this.connector.socials.length?O.html` <wui-flex gap="xs">
4825        ${this.connector.socials.slice(0,2).map(e=>O.html`<wui-logo-select
4826              data-testid=${`social-selector-${e}`}
4827              @click=${()=>{this.onSocialClick(e)}}
4828              logo=${e}
4829            ></wui-logo-select>`)}
4830      </wui-flex>`:O.html` <wui-list-social
4831      data-testid=${`social-selector-${this.connector?.socials?.[0]}`}
4832      @click=${()=>{this.onSocialClick(this.connector?.socials?.[0])}}
4833      logo=${this.connector.socials[0]??O.nothing}
4834      align="center"
4835      name=${`Continue with ${this.connector.socials[0]}`}
4836    ></wui-list-social>`:null}bottomViewTemplate(){return!this.connector?.socials?.length||this.connector?.socials.length<=2?null:this.connector?.socials.length>6?O.html`<wui-flex gap="xs">
4837        ${this.connector.socials.slice(1,5).map(e=>O.html`<wui-logo-select
4838              data-testid=${`social-selector-${e}`}
4839              @click=${()=>{this.onSocialClick(e)}}
4840              logo=${e}
4841            ></wui-logo-select>`)}
4842        <wui-logo-select logo="more" @click=${this.onMoreSocialsClick.bind(this)}></wui-logo-select>
4843      </wui-flex>`:O.html`<wui-flex gap="xs">
4844      ${this.connector.socials.slice(1,this.connector.socials.length).map(e=>O.html`<wui-logo-select
4845            data-testid=${`social-selector-${e}`}
4846            @click=${()=>{this.onSocialClick(e)}}
4847            logo=${e}
4848          ></wui-logo-select>`)}
4849    </wui-flex>`}separatorTemplate(){return this.connectors.find(e=>"WALLET_CONNECT"===e.type)?O.html`<wui-separator text="or"></wui-separator>`:null}onMoreSocialsClick(){b.RouterController.push("ConnectSocials")}async onSocialClick(e){if(e&&(c.AccountController.setSocialProvider(e,m.ChainController.state.activeChain),f.EventsController.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:e}}
4849)),e===l.Farcaster){b.RouterController.push("ConnectingFarcaster");let e=d.ConnectorController.getAuthConnector();if(e&&!c.AccountController.state.farcasterUrl)try{let{url:t}=await e.provider.getFarcasterUri();c.AccountController.setFarcasterUrl(t,m.ChainController.state.activeChain)}catch(e){b.RouterController.goBack(),v.SnackController.showError(e)}}else{b.RouterController.push("ConnectingSocial");let t=d.ConnectorController.getAuthConnector();this.popupWindow=p.CoreHelperUtil.returnOpenHref("","popupWindow","width=600,height=800,scrollbars=yes");try{if(t&&e){let{uri:r}=await t.provider.getSocialRedirectUri({provider:e});if(this.popupWindow&&r)c.AccountController.setSocialWindow(this.popupWindow,m.ChainController.state.activeChain),this.popupWindow.location.href=r;else throw this.popupWindow?.close(),Error("Something went wrong")}}catch(e){this.popupWindow?.close(),v.SnackController.showError("Something went wrong")}}}};s_.styles=sC,sx([(0,$.state)()],s_.prototype,"connectors",void 0),s_=sx([(0,P.customElement)("w3m-social-login-widget")],s_);var sE=R;let sk=class extends sE.LitElement{render(){return O.html`
4850      <wui-flex flexDirection="column" gap="xs">
4851        <w3m-connector-list></w3m-connector-list>
4852        <w3m-all-wallets-widget></w3m-all-wallets-widget>
4853      </wui-flex>
4854    `}};sk=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-wallet-login-list")],sk);var sS=R;let sI=U.css`
4855  :host {
4856    margin-top: var(--wui-spacing-3xs);
4857  }
4858  wui-separator {
4859    margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs)
4860      calc(var(--wui-spacing-m) * -1);
4861    width: calc(100% + var(--wui-spacing-s) * 2);
4862  }
4863`;var sA=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sT=class extends sS.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.connector=this.connectors.find(e=>"AUTH"===e.type),this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>{this.connectors=e,this.connector=this.connectors.find(e=>"AUTH"===e.type)}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){return this.connector?.socials?O.html` <wui-flex flexDirection="column" gap="xs">
4864      ${this.connector.socials.map(e=>O.html`<wui-list-social
4865            @click=${()=>{this.onSocialClick(e)}}
4866            name=${e}
4867            logo=${e}
4868          ></wui-list-social>`)}
4869    </wui-flex>`:null}async onSocialClick(e){if(e&&(c.AccountController.setSocialProvider(e,m.ChainController.state.activeChain),f.EventsController.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:e}})),e===l.Farcaster){b.RouterController.push("ConnectingFarcaster");let e=d.ConnectorController.getAuthConnector();if(e&&!c.AccountController.state.farcasterUrl)try{let{url:t}=await e.provider.getFarcasterUri();c.AccountController.setFarcasterUrl(t,m.ChainController.state.activeChain)}catch(e){b.RouterController.goBack(),v.SnackController.showError(e)}}else{b.RouterController.push("ConnectingSocial");let t=d.ConnectorController.getAuthConnector();this.popupWindow=p.CoreHelperUtil.returnOpenHref("","popupWindow","width=600,height=800,scrollbars=yes");try{if(t&&e){let{uri:r}=await t.provider.getSocialRedirectUri({provider:e});if(this.popupWindow&&r)c.AccountController.setSocialWindow(this.popupWindow,m.ChainController.state.activeChain),this.popupWindow.location.href=r;else throw this.popupWindow?.close(),Error("Something went wrong")}}catch(e){this.popupWindow?.close(),v.SnackController.showError("Something went wrong")}}}};
4869sT.styles=sI,sA([(0,$.state)()],sT.prototype,"connectors",void 0),sT=sA([(0,P.customElement)("w3m-social-login-list")],sT);var sP=R,sR=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sO=class extends sP.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.connectors.filter(e=>"ANNOUNCED"===e.type);return e?.length?O.html`
4870      <wui-flex flexDirection="column" gap="xs">
4871        ${e.map(e=>e.info?.rdns&&e5.ApiController.state.excludedRDNS&&e5.ApiController.state.excludedRDNS.includes(e?.info?.rdns)?null:O.html`
4872            <wui-list-wallet
4873              imageSrc=${E.AssetUtil.getConnectorImage(e)??O.nothing}
4874              name=${e.name??"Unknown"}
4875              @click=${()=>this.onConnector(e)}
4876              tagVariant="success"
4877              tagLabel="installed"
4878              data-testid=${`wallet-selector-${e.id}`}
4879              .installed=${!0}
4880            >
4881            </wui-list-wallet>
4882          `)}
4883      </wui-flex>
4884    `:(this.style.cssText="display: none",null)}onConnector(e){"WALLET_CONNECT"===e.type?p.CoreHelperUtil.isMobile()?b.RouterController.push("AllWallets"):b.RouterController.push("ConnectingWalletConnect"):b.RouterController.push("ConnectingExternal",{connector:e})}};sR([(0,$.state)()],sO.prototype,"connectors",void 0),sO=sR([(0,P.customElement)("w3m-connect-announced-widget")],sO);var sN=R,s$=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sD=class extends sN.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{customWallets:e}=x.OptionsController.state;if(!e?.length)return this.style.cssText="display: none",null;let t=this.filterOutDuplicateWallets(e);return O.html`<wui-flex flexDirection="column" gap="xs">
4885      ${t.map(e=>O.html`
4886          <wui-list-wallet
4887            imageSrc=${E.AssetUtil.getWalletImage(e)??O.nothing}
4888            name=${e.name??"Unknown"}
4889            @click=${()=>this.onConnectWallet(e)}
4890            data-testid=${`wallet-selector-${e.id}`}
4891          >
4892          </wui-list-wallet>
4893        `)}
4894    </wui-flex>`}filterOutDuplicateWallets(e){let t=ec.StorageUtil.getRecentWallets(),r=this.connectors.map(e=>e.info?.rdns).filter(Boolean),i=t.map(e=>e.rdns).filter(Boolean),n=r.concat(i);if(n.includes("io.metamask.mobile")&&p.CoreHelperUtil.isMobile()){let e=n.indexOf("io.metamask.mobile");n[e]="io.metamask"}return e.filter(e=>!n.includes(String(e?.rdns)))}onConnectWallet(e){b.RouterController.push("ConnectingWalletConnect",{wallet:e})}};s$([(0,$.state)()],sD.prototype,"connectors",void 0),sD=s$([(0,P.customElement)("w3m-connect-custom-widget")],sD);var sL=R;let sj={filterOutDuplicatesByRDNS(e){let t=x.OptionsController.state.enableEIP6963?d.ConnectorController.state.connectors:[],r=ec.StorageUtil.getRecentWallets(),i=t.map(e=>e.info?.rdns).filter(Boolean),n=r.map(e=>e.rdns).filter(Boolean),s=i.concat(n);if(s.includes("io.metamask.mobile")&&p.CoreHelperUtil.isMobile()){let e=s.indexOf("io.metamask.mobile");s[e]="io.metamask"}return e.filter(e=>!s.includes(String(e?.rdns)))},filterOutDuplicatesByIds(e){let t=d.ConnectorController.state.connectors.filter(e=>"ANNOUNCED"===e.type||"INJECTED"===e.type),r=ec.StorageUtil.getRecentWallets(),i=t.map(e=>e.explorerId),n=r.map(e=>e.id),s=i.concat(n);return e.filter(e=>
4894!s.includes(e?.id))},filterOutDuplicateWallets(e){let t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)}},sU=class extends sL.LitElement{constructor(){super(...arguments),this.unsubscribe=[]}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{featured:e}=e5.ApiController.state;if(!e.length)return this.style.cssText="display: none",null;let t=sj.filterOutDuplicateWallets(e);return O.html`
4895      <wui-flex flexDirection="column" gap="xs">
4896        ${t.map(e=>O.html`
4897            <wui-list-wallet
4898              imageSrc=${E.AssetUtil.getWalletImage(e)??O.nothing}
4899              name=${e.name??"Unknown"}
4900              @click=${()=>this.onConnectWallet(e)}
4901            >
4902            </wui-list-wallet>
4903          `)}
4904      </wui-flex>
4905    `}onConnectWallet(e){let t=d.ConnectorController.getConnector(e.id,e.rdns);t?b.RouterController.push("ConnectingExternal",{connector:t}):b.RouterController.push("ConnectingWalletConnect",{wallet:e})}};sU=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connect-featured-widget")],sU);var sM=R,sq=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sW=class extends sM.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.connectors.filter(e=>"INJECTED"===e.type);return e?.length&&(1!==e.length||e[0]?.name!=="Browser Wallet"||p.CoreHelperUtil.isMobile())?O.html`
4906      <wui-flex flexDirection="column" gap="xs">
4907        ${e.map(e=>p.CoreHelperUtil.isMobile()||"Browser Wallet"!==e.name?h.ConnectionController.checkInstalled(void 0,e.chain)?e.info?.rdns&&e5.ApiController.state.excludedRDNS&&e5.ApiController.state.excludedRDNS.includes(e?.info?.rdns)?null:O.html`
4908            <wui-list-wallet
4909              imageSrc=${E.AssetUtil.getConnectorImage(e)??O.nothing}
4910              .installed=${!0}
4911              name=${e.name??"Unknown"}
4912              tagVariant="success"
4913              tagLabel="installed"
4914              data-testid=${`wallet-selector-${e.id}`}
4915              @click=${()=>this.onConnector(e)}
4916            >
4917            </wui-list-wallet>
4918          `:(this.style.cssText="display: none",null):null)}
4919      </wui-flex>
4920    `:(this.style.cssText="display: none",null)}onConnector(e){m.ChainController.setActiveConnector(e),b.RouterController.push("ConnectingExternal",{connector:e})}};sq([(0,$.state)()],sW.prototype,"connectors",void 0),sW=sq([(0,P.customElement)("w3m-connect-injected-widget")],sW);var sB=R,sz=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sH=class extends sB.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.connectors.filter(e=>"MULTI_CHAIN"===e.type&&"WalletConnect"!==e.name);return e?.length?O.html`
4921      <wui-flex flexDirection="column" gap="xs">
4922        ${e.map(e=>O.html`
4923            <wui-list-wallet
4924              imageSrc=${E.AssetUtil.getConnectorImage(e)??O.nothing}
4925              .installed=${!0}
4926              name=${e.name??"Unknown"}
4927              tagVariant="shade"
4928              tagLabel="multichain"
4929              data-testid=${`wallet-selector-${e.id}`}
4930              @click=${()=>this.onConnector(e)}
4931            >
4932            </wui-list-wallet>
4933          `)}
4934      </wui-flex>
4935    `:(this.style.cssText="display: none",null)}onConnector(e){m.ChainController.setActiveConnector(e),b.RouterController.push("ConnectingMultiChain")}};sz([(0,$.state)()],sH.prototype,"connectors",void 0),sH=sz([(0,P.customElement)("w3m-connect-multi-chain-widget")],sH);var sK=R,sV=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
4935);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sF=class extends sK.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.connectors.filter(e=>"EXTERNAL"===e.type).filter(e=>"coinbaseWalletSDK"!==e.id);return e?.length?O.html`
4936      <wui-flex flexDirection="column" gap="xs">
4937        ${e.map(e=>O.html`
4938            <wui-list-wallet
4939              imageSrc=${E.AssetUtil.getConnectorImage(e)??O.nothing}
4940              .installed=${!0}
4941              name=${e.name??"Unknown"}
4942              data-testid=${`wallet-selector-external-${e.id}`}
4943              @click=${()=>this.onConnector(e)}
4944            >
4945            </wui-list-wallet>
4946          `)}
4947      </wui-flex>
4948    `:(this.style.cssText="display: none",null)}onConnector(e){b.RouterController.push("ConnectingExternal",{connector:e})}};sV([(0,$.state)()],sF.prototype,"connectors",void 0),sF=sV([(0,P.customElement)("w3m-connect-external-widget")],sF);var sG=R;let sY=class extends sG.LitElement{render(){let e=ec.StorageUtil.getRecentWallets();return e?.length?O.html`
4949      <wui-flex flexDirection="column" gap="xs">
4950        ${e.map(e=>O.html`
4951            <wui-list-wallet
4952              imageSrc=${E.AssetUtil.getWalletImage(e)??O.nothing}
4953              name=${e.name??"Unknown"}
4954              @click=${()=>this.onConnectWallet(e)}
4955              tagLabel="recent"
4956              tagVariant="shade"
4957            >
4958            </wui-list-wallet>
4959          `)}
4960      </wui-flex>
4961    `:(this.style.cssText="display: none",null)}onConnectWallet(e){b.RouterController.push("ConnectingWalletConnect",{wallet:e})}};sY=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-connect-recent-widget")],sY);var sJ=R,sZ=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let sQ=class extends sJ.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(!this.connectors.find(e=>"WALLET_CONNECT"===e.type))return null;let{recommended:e}=e5.ApiController.state,{customWallets:t,featuredWalletIds:r}=x.OptionsController.state,{connectors:i}=d.ConnectorController.state,n=ec.StorageUtil.getRecentWallets(),s=i.filter(e=>"INJECTED"===e.type||"ANNOUNCED"===e.type).filter(e=>"Browser Wallet"!==e.name);if(r||t||!e.length)return this.style.cssText="display: none",null;let o=Math.max(0,2-(s.length+n.length)),a=sj.filterOutDuplicateWallets(e).slice(0,o);return a.length?O.html`
4962      <wui-flex flexDirection="column" gap="xs">
4963        ${a.map(e=>O.html`
4964            <wui-list-wallet
4965              imageSrc=${E.AssetUtil.getWalletImage(e)??O.nothing}
4966              name=${e?.name??"Unknown"}
4967              @click=${()=>this.onConnectWallet(e)}
4968            >
4969            </wui-list-wallet>
4970          `)}
4971      </wui-flex>
4972    `:(this.style.cssText="display: none",null)}onConnectWallet(e){let t=d.ConnectorController.getConnector(e.id,e.rdns);t?b.RouterController.push("ConnectingExternal",{connector:t}):b.RouterController.push("ConnectingWalletConnect",{wallet:e})}};sZ([(0,$.state)()],sQ.prototype,"connectors",void 0),sQ=sZ([(0,P.customElement)("w3m-connect-recommended-widget")],sQ);var sX=R,s0=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
4972);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let s1=class extends sX.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){if(p.CoreHelperUtil.isMobile())return this.style.cssText="display: none",null;let e=this.connectors.find(e=>"WALLET_CONNECT"===e.type);return e?O.html`
4973      <wui-list-wallet
4974        imageSrc=${E.AssetUtil.getConnectorImage(e)??O.nothing}
4975        name=${e.name??"Unknown"}
4976        @click=${()=>this.onConnector(e)}
4977        tagLabel="qr code"
4978        tagVariant="main"
4979        data-testid="wallet-selector-walletconnect"
4980      >
4981      </wui-list-wallet>
4982    `:(this.style.cssText="display: none",null)}onConnector(e){"WALLET_CONNECT"===e.type?p.CoreHelperUtil.isMobile()?b.RouterController.push("AllWallets"):b.RouterController.push("ConnectingWalletConnect"):b.RouterController.push("ConnectingExternal",{connector:e})}};s0([(0,$.state)()],s1.prototype,"connectors",void 0),s1=s0([(0,P.customElement)("w3m-connect-walletconnect-widget")],s1);var s3=R;let s2=U.css`
4983  :host {
4984    margin-top: var(--wui-spacing-3xs);
4985  }
4986  wui-separator {
4987    margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs)
4988      calc(var(--wui-spacing-m) * -1);
4989    width: calc(100% + var(--wui-spacing-s) * 2);
4990  }
4991`;var s5=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let s4=class extends s3.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let{custom:e,recent:t,announced:r,injected:i,multiChain:n,recommended:s,featured:o,external:a}=this.getConnectorsByType();return O.html`
4992      <wui-flex flexDirection="column" gap="xs">
4993        <w3m-connect-walletconnect-widget></w3m-connect-walletconnect-widget>
4994        ${t.length?O.html`<w3m-connect-recent-widget></w3m-connect-recent-widget>`:null}
4995        ${n.length?O.html`<w3m-connect-multi-chain-widget></w3m-connect-multi-chain-widget>`:null}
4996        ${r.length?O.html`<w3m-connect-announced-widget></w3m-connect-announced-widget>`:null}
4997        ${i.length?O.html`<w3m-connect-injected-widget></w3m-connect-injected-widget>`:null}
4998        ${o.length?O.html`<w3m-connect-featured-widget></w3m-connect-featured-widget>`:null}
4999        ${e?.length?O.html`<w3m-connect-custom-widget></w3m-connect-custom-widget>`:null}
5000        ${a.length?O.html`<w3m-connect-external-widget></w3m-connect-external-widget>`:null}
5001        ${s.length?O.html`<w3m-connect-recommended-widget></w3m-connect-recommended-widget>`:null}
5002      </wui-flex>
5003    `}getConnectorsByType(){let{featured:e,recommended:t}=e5.ApiController.state,{customWallets:r}=x.OptionsController.state,i=ec.StorageUtil.getRecentWallets(),n=sj.filterOutDuplicateWallets(t),s=sj.filterOutDuplicateWallets(e),o=this.connectors.filter(e=>"MULTI_CHAIN"===e.type),a=this.connectors.filter(e=>"ANNOUNCED"===e.type),l=this.connectors.filter(e=>"INJECTED"===e.type),c=this.connectors.filter(e=>"EXTERNAL"===e.type),u=m.ChainController.state.activeChain!==S.ConstantsUtil.CHAIN.EVM||x.OptionsController.state.enableEIP6963;return{custom:r,recent:i,external:c,multiChain:o,announced:u?a:[],injected:u?l:[],recommended:n,featured:s}}};s4.styles=s2,s5([(0,$.state)()],s4.prototype,"connectors",void 0),s4=s5([(0,P.customElement)("w3m-connector-list")],s4);var s6=R,s8=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
5003);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o};let s9=class extends s6.LitElement{constructor(){super(),this.unsubscribe=[],this.connectors=d.ConnectorController.state.connectors,this.count=e5.ApiController.state.count,this.unsubscribe.push(d.ConnectorController.subscribeKey("connectors",e=>this.connectors=e),e5.ApiController.subscribeKey("count",e=>this.count=e))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){let e=this.connectors.find(e=>"WALLET_CONNECT"===e.type),{allWallets:t}=x.OptionsController.state;if(!e||"HIDE"===t||"ONLY_MOBILE"===t&&!p.CoreHelperUtil.isMobile())return null;let r=e5.ApiController.state.featured.length,i=this.count+r,n=i<10?i:10*Math.floor(i/10),s=n<i?`${n}+`:`${n}`;return O.html`
5004      <wui-list-wallet
5005        name="All Wallets"
5006        walletIcon="allWallets"
5007        showAllWallets
5008        @click=${this.onAllWallets.bind(this)}
5009        tagLabel=${s}
5010        tagVariant="shade"
5011        data-testid="all-wallets"
5012      ></wui-list-wallet>
5013    `}onAllWallets(){f.EventsController.sendEvent({type:"track",event:"CLICK_ALL_WALLETS"}),b.RouterController.push("AllWallets")}};s8([(0,$.state)()],s9.prototype,"connectors",void 0),s8([(0,$.state)()],s9.prototype,"count",void 0),s9=s8([(0,P.customElement)("w3m-all-wallets-widget")],s9);var s7=R;let oe=class extends s7.LitElement{constructor(){super(...arguments),this.socialProvider=ec.StorageUtil.getConnectedSocialProvider(),this.socialUsername=ec.StorageUtil.getConnectedSocialUsername()}render(){let e=ec.StorageUtil.getConnectedConnector(),t=d.ConnectorController.getAuthConnector();if(!t||"AUTH"!==e)return this.style.cssText="display: none",null;let r=t.provider.getEmail()??"";return O.html`
5014      <wui-list-item
5015        variant="icon"
5016        iconVariant="overlay"
5017        icon=${this.socialProvider??"mail"}
5018        iconSize=${this.socialProvider?"xxl":"sm"}
5019        data-testid="w3m-account-email-update"
5020        ?chevron=${!this.socialProvider}
5021        @click=${()=>{this.onGoToUpdateEmail(r,this.socialProvider)}}
5022      >
5023        <wui-text variant="paragraph-500" color="fg-100">${this.getAuthName(r)}</wui-text>
5024      </wui-list-item>
5025    `}onGoToUpdateEmail(e,t){t||b.RouterController.push("UpdateEmailWallet",{email:e})}getAuthName(e){return this.socialUsername?"discord"===this.socialProvider&&this.socialUsername.endsWith("0")?this.socialUsername.slice(0,-1):this.socialUsername:e.length>30?`${e.slice(0,-3)}...`:e}};oe=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}([(0,P.customElement)("w3m-account-auth-button")],oe),e.i(570602);let ot={[eO]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[eN]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[e$]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[eD]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927"},or={1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",0x4e454152:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700"},oi={[eO]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[eN]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[e$]:"461db637-8616-43ce-035a-d89b8a1d5800",[eD]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[eP]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[eR]:"07ba87ed-43aa-4adf-454
50250-9e6a2b9cae00"},on={[eR]:"Browser Wallet",[eP]:"WalletConnect",[eO]:"Coinbase",[eN]:"Coinbase",[eD]:"Ledger",[e$]:"Safe"},os={[eR]:"INJECTED",[eP]:"WALLET_CONNECT",[eL]:"ANNOUNCED",[ej]:"AUTH"},oo={getCaipTokens(e){if(!e)return;let t={};return Object.entries(e).forEach(([e,r])=>{t[`${eU}:${e}`]=r}),t}};var oa=e.i(219298),ol=e.i(741483);let oc=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,ou=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,oh=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function od(e,t){var r;return"__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t?void(r=e,console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)):t}function op(e,t={}){if("string"!=typeof e)return e;if('"'===e[0]&&'"'===e[e.length-1]&&-1===e.indexOf("\\"))return e.slice(1,-1);let r=e.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return NaN;case"infinity":return 1/0;case"-infinity":return-1/0}if(!oh.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(oc.test(e)||ou.test(e)){if(t.strict)throw Error("[destr] Possible prototype pollution");return JSON.parse(e,od)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var of=e.i(467034);function og(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function om(e){let t,r;if(t=typeof e,null===e||"object"!==t&&"function"!==t)return String(e);if(!(r=Object.getPrototypeOf(e))||r.isPrototypeOf(Object)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return om(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let ow="base64:";function oy(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function ov(e){return(e=oy(e))?e+":":""}function ob(e,t,r){return e.watch?e.watch((e,i)=>t(e,r+i)):()=>{}}async function oC(e){"function"==typeof e.dispose&&await og(e.dispose)}function ox(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function o_(e,t){let r;return(i,n)=>(()=>{if(r)return r;let i=indexedDB.open(e);return i.onupgradeneeded=()=>i.result.createObjectStore(t),(r=ox(i)).then(e=>{e.onclose=()=>r=void 0},()=>{}),r})().then(e=>n(e.transaction(t,i).objectStore(t)))}function oE(){return t||(t=o_("keyval-store","keyval")),t}function ok(e,t=oE()){return t("readonly",t=>ox(t.get(e)))}var oS=e.i(31794);class oI{constructor(){this.indexedDb=function(e={}){let t,r={mounts:{"":e.driver||(t=new Map,{name:"memory",getInstance:()=>t,hasItem:e=>t.has(e),getItem:e=>t.get(e)??null,getItemRaw:e=>t.get(e)??null,setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys:()=>[...t.keys()],clear(){t.clear()},dispose(){t.clear()}})},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},i=e=>{for(let t of r.mountpoints)if(e.startsWith(t))return{base:t,relativeKey:e.slice(t.length),driver:r.mounts[t]};return{base:"",relativeKey:e,driver:r.mounts[""]}},n=(e,t)=>r.mountpoints.filter(r=>r.startsWith(e)||t&&e.startsWith(r)).map(t=>({relativeBase:e.length>t.length?e.slice(t.length):void 0,mountpoint:t,driver:r.mounts[t]})),s=(e,t)=>{if(r.watching)for(let i of(t=oy(t),r.watchListeners))i(e,t)},o=async()=>{if(!r.watching)for(let e in r.watching=!0,r.mounts)r.unwatch[e]=await ob(r.mounts[e],s,e)},a=async()=>{if(r.watching){for(let e in r.unwatch)await r.unwatch[e]();r.unwatch={},r.watching=!1}},l=(e,t,r)=>{let n=new Map,s=e=>{let t=n.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},n.set(e.base,t)),t};for(let r of e){let e="string"==typeof r,n=oy(e?r:r.key),o=e?void 0:r.value,a=e||!r.options?t:{...t,...r.options},l=i(n);s(l).items.push({key:n,value:o,relativeKey:l.relativeKey,options:a})}return Promise.all([...n.values()].map(e=>r(e))).then(e=>e.flat())},c={hasItem(e,t={}){let{relativeKey:r,driver:n}=i(e=oy(e));return og(n.hasItem,r,t)},getItem(e,t={}){let{relativeKey:r,driver:n}=i(e=oy(e));return og(n.getItem,r,t).then(e=>op(e))},getItems:(e,t={})=>l(e,t,e=>e.driver.getItems?og(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return oy(e.join(":"))}(e.base,t.key),value:op(t.value)}))):Promise.all(e.items.map(t=>og(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:op(e)}))))),getItemRaw(e,t={}){let{relativeKey:r,driver:n}=i(e=oy(e));return n.getItemRaw?og(n.getItemRaw,r,t):og(n.getItem,r,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(ow)?(t=e.slice(ow.length),globalThis.Buffer?of.Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))):e})},async setItem(e,t,r={}){if(void 0===t)return c.removeItem(e);let{relativeKey:n,driver:o}=i(e=oy(e));
5025o.setItem&&(await og(o.setItem,n,om(t),r),o.watch||s("update",e))},async setItems(e,t){await l(e,t,async e=>{if(e.driver.setItems)return og(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:om(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>og(e.driver.setItem,t.relativeKey,om(t.value),t.options)))})},async setItemRaw(e,t,r={}){if(void 0===t)return c.removeItem(e,r);let{relativeKey:n,driver:o}=i(e=oy(e));if(o.setItemRaw)await og(o.setItemRaw,n,t,r);else{var a;if(!o.setItem)return;await og(o.setItem,n,"string"==typeof t?t:ow+(a=t,globalThis.Buffer?of.Buffer.from(a).toString("base64"):globalThis.btoa(String.fromCodePoint(...a))),r)}o.watch||s("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t});let{relativeKey:r,driver:n}=i(e=oy(e));n.removeItem&&(await og(n.removeItem,r,t),(t.removeMeta||t.removeMata)&&await og(n.removeItem,r+"$",t),n.watch||s("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t});let{relativeKey:r,driver:n}=i(e=oy(e)),s=Object.create(null);if(n.getMeta&&Object.assign(s,await og(n.getMeta,r,t)),!t.nativeOnly){let e=await og(n.getItem,r+"$",t).then(e=>op(e));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(s,e))}return s},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){let r=n(e=ov(e),!0),i=[],s=[],o=!0;for(let e of r){for(let r of(e.driver.flags?.maxDepth||(o=!1),await og(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+oy(r);i.some(e=>t.startsWith(e))||s.push(t)}i=[e.mountpoint,...i.filter(t=>!t.startsWith(e.mountpoint))]}let a=void 0!==t.maxDepth&&!o;return s.filter(r=>{var i;return(!a||function(e,t){if(void 0===t)return!0;let r=0,i=e.indexOf(":");for(;i>-1;)r++,i=e.indexOf(":",i+1);return r<=t}(r,t.maxDepth))&&((i=e)?r.startsWith(i)&&"$"!==r[r.length-1]:"$"!==r[r.length-1])})},async clear(e,t={}){e=ov(e),await Promise.all(n(e,!1).map(async e=>e.driver.clear?og(e.driver.clear,e.relativeBase,t):e.driver.removeItem?Promise.all((await e.driver.getKeys(e.relativeBase||"",t)).map(r=>e.driver.removeItem(r,t))):void 0))},async dispose(){await Promise.all(Object.values(r.mounts).map(e=>oC(e)))},watch:async e=>(await o(),r.watchListeners.push(e),async()=>{r.watchListeners=r.watchListeners.filter(t=>t!==e),0===r.watchListeners.length&&await a()}),async unwatch(){r.watchListeners=[],await a()},mount(e,t){if((e=ov(e))&&r.mounts[e])throw Error(`already mounted at ${e}`);return e&&(r.mountpoints.push(e),r.mountpoints.sort((e,t)=>t.length-e.length)),r.mounts[e]=t,r.watching&&Promise.resolve(ob(t,s,e)).then(t=>{r.unwatch[e]=t}).catch(console.error),c},async unmount(e,t=!0){(e=ov(e))&&r.mounts[e]&&(r.watching&&e in r.unwatch&&(r.unwatch[e]?.(),delete r.unwatch[e]),t&&await oC(r.mounts[e]),r.mountpoints=r.mountpoints.filter(t=>t!==e),delete r.mounts[e])},getMount(e=""){let t=i(e=oy(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>n(e=oy(e),t.parents).map(e=>({driver:e.driver,base:e.mountpoint})),keys:(e,t={})=>c.getKeys(e,t),get:(e,t={})=>c.getItem(e,t),set:(e,t,r={})=>c.setItem(e,t,r),has:(e,t={})=>c.hasItem(e,t),del:(e,t={})=>c.removeItem(e,t),remove:(e,t={})=>c.removeItem(e,t)};return c}({driver:((e={})=>{let t,r=e.base&&e.base.length>0?`${e.base}:`:"";return e.dbName&&e.storeName&&(t=o_(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await ok(r+e,t)>"u"),getItem:async e=>await ok(r+e,t)??null,setItem:(e,i)=>(function(e,t,r=oE()){return r("readwrite",r=>(r.put(t,e),ox(r.transaction)))})(r+e,i,t),removeItem:e=>(function(e,t=oE()){return t("readwrite",t=>(t.delete(e),ox(t.transaction)))})(r+e,t),getKeys:()=>(function(e=oE()){return e("readonly",e=>{var t;if(e.getAllKeys)return ox(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},ox(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=oE()){return e("readwrite",e=>(e.clear(),ox(e.transaction)))})(t)}})({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,(0,oS.safeJsonStringify)(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var oA="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,oT={exports:{}};function oP(e){var t;return[e[0],(0,oS.safeJsonParse)(null!=(t=e[1])?t:"")]}function oR(){}oR.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},oR.prototype.setItem=function(e,t){this[e]=String(t)},oR.prototype.removeItem=function(e){delete this[e]},oR.prototype.clear=function(){let e=this;Object.keys(e).forEach(function(t){e[t]=void 0,delete e[t]})},oR.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},oR.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),"u">typeof oA&&oA.localStorage?oT.exports=oA.localStorage:"u">typeof window&&window.localStorage?oT.exports=window.localStorage:oT.exp
5025orts=new oR;class oO{constructor(){this.localStorage=oT.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(oP)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return(0,oS.safeJsonParse)(t)}async setItem(e,t){this.localStorage.setItem(e,(0,oS.safeJsonStringify)(t))}async removeItem(e){this.localStorage.removeItem(e)}}let oN=async(e,t,r)=>{let i="wc_storage_version",n=await t.getItem(i);if(n&&n>=1)return void r(t);let s=await e.getKeys();if(!s.length)return void r(t);let o=[];for(;s.length;){let r=s.shift();if(!r)continue;let i=r.toLowerCase();if(i.includes("wc@")||i.includes("walletconnect")||i.includes("wc_")||i.includes("wallet_connect")){let i=await e.getItem(r);await t.setItem(r,i),o.push(r)}}await t.setItem(i,1),r(t),o$(e,o)},o$=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class oD{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const e=new oO;this.storage=e;try{const t=new oI;oN(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}var oL=e.i(648512);class oj{}class oU extends oj{constructor(e){super()}}let oM=oL.FIVE_SECONDS,oq="heartbeat_pulse";class oW extends oU{constructor(e){super(e),this.events=new oa.EventEmitter,this.interval=oM,this.interval=e?.interval||oM}static async init(e){let t=new oW(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,oL.toMiliseconds)(this.interval))}pulse(){this.events.emit(oq)}}var oB=e.i(278662),oz=e.i(102232),oz=oz;class oH extends oj{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class oK extends oj{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class oV{constructor(e,t){this.logger=e,this.core=t}}class oF extends oj{constructor(e,t){super(),this.relayer=e,this.logger=t}}class oG extends oj{constructor(e){super()}}
5025class oY{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class oJ extends oj{constructor(e,t){super(),this.relayer=e,this.logger=t}}class oZ extends oj{constructor(e,t){super(),this.core=e,this.logger=t}}class oQ{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}}class oX{constructor(e,t){this.projectId=e,this.logger=t}}class o0{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}}oa.default;class o1{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}oa.EventEmitter;class o3{constructor(e){this.client=e}}e.i(47759);var o2=e.i(830685),o5=e.i(682754),o4=ol;e.i(262265);var o6=e.i(773912),o8=e.i(438005);o8.isNode;class o9{}class o7 extends o9{constructor(){super()}}class ae extends o7{constructor(e){super()}}let at="INTERNAL_ERROR",ar="SERVER_ERROR",ai=[-32700,-32600,-32601,-32602,-32603],an={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[at]:{code:-32603,message:"Internal error"},[ar]:{code:-32e3,message:"Server error"}};function as(e){return Object.keys(an).includes(e)?an[e]:an[ar]}function ao(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?Error(`Unavailable ${r} RPC url at ${t}`):e}
5025function aa(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function al(e=6){return BigInt(aa(e))}function ac(e,t,r){return{id:r||aa(),jsonrpc:"2.0",method:e,params:t}}function au(e,t){return{id:e,jsonrpc:"2.0",result:t}}function ah(e,t,r){var i,n,s,o;let a;return{id:e,jsonrpc:"2.0",error:(i=t,n=r,void 0===i?as(at):("string"==typeof i&&(i=Object.assign(Object.assign({},as(ar)),{message:i})),void 0!==n&&(i.data=n),s=i.code,ai.includes(s)&&(o=i.code,i=(a=Object.values(an).find(e=>e.code===o))||an[ar]),i))}}function ad(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function ap(e){return ad(e)&&"method"in e}function af(e){return ad(e)&&(ag(e)||am(e))}function ag(e){return"result"in e}function am(e){return"error"in e}class aw extends ae{constructor(e){super(e),this.events=new oa.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(ac(e.method,e.params||[],e.id||al().toString()),t)}async requestStrict(e,t){return new Promise(async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,e=>{am(e)?i(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){i(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),af(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}function ay(e,t){let r=function(e){let t=e.match(RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function av(e){return ay(e,"^https?:")}function ab(e){return ay(e,"^wss?:")}let aC=e=>e.split("?")[0],ax="u">typeof WebSocket?WebSocket:"u">typeof e.g.WebSocket?e.g.WebSocket:"u">typeof window&&"u">typeof window.WebSocket?window.WebSocket:"u">typeof self&&"u">typeof self.WebSocket?self.WebSocket:e.r(756823);class a_{constructor(e){if(this.url=e,this.events=new oa.EventEmitter,this.registering=!1,!ab(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return"u">typeof this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{typeof this.socket>"u"?t(Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send((0,oS.safeJsonStringify)(e))}catch(t){this.onError(e.id,t)}}register(t=this.url){if(!ab(t))throw Error(`Provided URL is not compatible with WebSocket connection: ${t}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>
5025{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(Error("WebSocket connection is missing or invalid"));e(this.socket)})})}return this.url=t,this.registering=!0,new Promise((r,i)=>{let n=new URLSearchParams(t).get("origin"),s=(0,o8.isReactNative)()?{headers:{origin:n}}:{rejectUnauthorized:!RegExp("wss?://localhost(:d{2,5})?").test(t)},o=new ax(t,[],s);"u">typeof WebSocket||"u">typeof e.g.WebSocket||"u">typeof window&&"u">typeof window.WebSocket||"u">typeof self&&"u">typeof self.WebSocket?o.onerror=e=>{i(this.emitError(e.error))}:o.on("error",e=>{i(this.emitError(e))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,oS.safeJsonParse)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=ah(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return ao(e,aC(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){let t=this.parseError(Error(e?.message||`WebSocket connection failed for host: ${aC(this.url)}`));return this.events.emit("register_error",t),t}}var aE=e.i(338066),ak=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===l;)i++,t++;for(var s=(e.length-t)*c+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h<n)&&-1!==d;d--,h++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=h,t++}if(" "!==e[t]){for(var p=s-n;p!==s&&0===o[p];)p++;for(var f=new Uint8Array(i+(s-p)),g=i;p!==s;)f[g++]=o[p++];return f}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,c=new Uint8Array(o);n!==s;){for(var h=t[n],d=0,p=o-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*c[p]>>>0,c[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var g=l.repeat(r);f<o;++f)g+=e.charAt(c[f]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw Error(`Non-${t} character`)}}};let aS=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")};class aI{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class aA{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return aP(this,e)}}class aT{constructor(e){this.decoders=e}or(e){return aP(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}
5025, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let aP=(e,t)=>new aT({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class aR{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new aI(e,t,r),this.decoder=new aA(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let aO=({name:e,prefix:t,encode:r,decode:i})=>new aR(e,t,r,i),aN=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=ak(r,t);return aO({prefix:e,name:t,encode:i,decode:e=>aS(n(e))})},a$=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>aO({prefix:t,name:e,encode:e=>((e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,l=0,c=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);l=l<<r|s,(a+=r)>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=r||255&l<<8-a)throw SyntaxError("Unexpected end of data");return o})(t,i,r,e)});var aD=Object.freeze({__proto__:null,identity:aO({prefix:"\0",name:"identity",encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)})}),aL=Object.freeze({__proto__:null,base2:a$({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),aj=Object.freeze({__proto__:null,base8:a$({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),aU=Object.freeze({__proto__:null,base10:aN({prefix:"9",name:"base10",alphabet:"0123456789"})}),aM=Object.freeze({__proto__:null,base16:a$({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:a$({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})}),aq=Object.freeze({__proto__:null,base32:a$({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper:a$({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad:a$({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper:a$({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex:a$({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper:a$({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad:a$({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:a$({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:a$({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),aW=Object.freeze({__proto__:null,base36:aN({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:aN({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),aB=Object.freeze({__proto__:null,base58btc:aN({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:aN({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})}),az=Object.freeze({__proto__:null,base64:a$({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad:a$({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:a$({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:a$({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let aH=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈ðŸ‘
5025‡ðŸŽ¶ðŸ˜’🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),aK=aH.reduce((e,t,r)=>(e[r]=t,e),[]),aV=aH.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var aF=Object.freeze({__proto__:null,base256emoji:aO({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=aK[t],"")},decode:function(e){let t=[];for(let r of e){let e=aV[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function aG(e,t,r){t=t||[],r=r||0;for(var i=r;e>=0x80000000;)t[r++]=255&e|128,e/=128;for(;-128&e;)t[r++]=255&e|128,e>>>=7;return t[r]=0|e,aG.bytes=r-i+1,t}var aY=function(e){return e<128?1:e<16384?2:e<2097152?3:e<0x10000000?4:e<0x800000000?5:e<0x40000000000?6:e<0x2000000000000?7:e<0x100000000000000?8:e<0x8000000000000000?9:10};let aJ=(e,t,r=0)=>(aG(e,t,r),t),aZ=(e,t)=>{let r=t.byteLength,i=aY(e),n=i+aY(r),s=new Uint8Array(n+r);return aJ(e,s,0),aJ(r,s,i),s.set(t,n),new aQ(e,r,t,s)};
5025class aQ{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let aX=({name:e,code:t,encode:r})=>new a0(e,t,r);class a0{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?aZ(this.code,t):t.then(e=>aZ(this.code,e))}throw Error("Unknown type, must be binary type")}}let a1=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var a3=Object.freeze({__proto__:null,sha256:aX({name:"sha2-256",code:18,encode:a1("SHA-256")}),sha512:aX({name:"sha2-512",code:19,encode:a1("SHA-512")})}),a2=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:aS,digest:e=>aZ(0,aS(e))}});new TextEncoder,new TextDecoder;let a5={...aD,...aL,...aj,...aU,...aM,...aq,...aW,...aB,...az,...aF};function a4(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...a3,...a2});let a6=a4("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),a8=a4("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),a9={utf8:a6,"utf-8":a6,hex:a5.base16,latin1:a8,ascii:a8,binary:a8,...a5},a7="core",le=`wc@2:${a7}:`,lt={database:":memory:"},lr="client_ed25519_seed",li=oL.ONE_DAY,ln=oL.SIX_HOURS,ls="wss://relay.walletconnect.org",lo="relayer_message",la="relayer_message_ack",ll="relayer_connection_stalled",lc="relayer_publish",lu="payload",lh="connect",ld="disconnect",lp="error",lf="2.16.1",lg="link_mode",lm="relay",lw="WALLETCONNECT_LINK_MODE_APPS",ly="subscription_created",lv="subscription_deleted",lb=(oL.THIRTY_DAYS,1e3*oL.FIVE_SECONDS),lC=(oL.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:oL.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:oL.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:oL.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:oL.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:oL.ONE_DAY,prompt:!1,tag:0},res:{ttl:oL.ONE_DAY,prompt:!1,tag:0}}}),lx="pairing_create",l_="pairing_delete",lE="history_created",lk="history_updated",lS="history_deleted",lI="expirer_created",lA="expirer_deleted",lT="expirer_expired",lP=(oL.ONE_DAY,"https://verify.walletconnect.org"),lR=`${lP}/v3`,lO=["https://verify.walletconnect.com",lP],lN="malformed_pairing_uri",l$="session_approve_started";class lD{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=le,this.init=async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}},this.has=e=>(this.isInitialized(),this.keychain.has(e)),this.set=async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()},this.get=e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=(0,o4.getInternalError)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t},this.del=async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()},this.core=e,this.logger=(0,oB.generateChildLogger)(t,this.name)}get context(){return(0,oB.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,(0,o4.mapToObj)(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?(0,o4.objToMap)(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}}class lL{constructor(e,t,r){this.core=e,this.logger=t,this.name="crypto",this.randomSessionIdentifier=(0,o4.generateRandomBytes32)(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=e=>(this.isInitialized(),this.keychain.has(e)),this.getClientId=async()=>{this.isInitialized();let e=await this.getClientSeed(),t=o2.generateKeyPair(e);return o5.encodeIss(t.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let e=(0,o4.generateKeyPair)();return this.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=async e=>{this.isInitialized();let t=await this.getClientSeed(),r=o2.generateKeyPair(t),i=this.randomSessionIdentifier;return await o2.signJWT(i,e,li,r)},this.generateSharedKey=(e,t,r)=>{this.isInitialized();let i=this.getPrivateKey(e),n=(0,o4.deriveSymKey)(i,t);return this.setSymKey(n,r)},this.setSymKey=async(e,t)=>{this.isInitialized();let r=t||(0,o4.hashKey)(e);return await this.keychain.set(r,e),r},this.deleteKeyPair=async e=>{this.isInitialized(),await this.keychain.del(e)},this.deleteSymKey=async e=>{this.isInitialized(),await this.keychain.del(e)},this.encode=async(e,t,r)=>{this.isInitialized();let i=(0,o4.validateEncoding)(r),n=(0,oS.safeJsonStringify)(t);if((0,o4.isTypeTwoEnvelope)(i))return(0,o4.encodeTypeTwoEnvelope)(n,r?.encoding);
5025if((0,o4.isTypeOneEnvelope)(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:o,senderPublicKey:a}=i;return(0,o4.encrypt)({type:o,symKey:s,message:n,senderPublicKey:a,encoding:r?.encoding})},this.decode=async(e,t,r)=>{this.isInitialized();let i=(0,o4.validateDecoding)(t,r);if((0,o4.isTypeTwoEnvelope)(i)){let e=(0,o4.decodeTypeTwoEnvelope)(t,r?.encoding);return(0,oS.safeJsonParse)(e)}if((0,o4.isTypeOneEnvelope)(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let i=this.getSymKey(e),n=(0,o4.decrypt)({symKey:i,encoded:t,encoding:r?.encoding});return(0,oS.safeJsonParse)(n)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}},this.getPayloadType=(e,t=o4.BASE64)=>{let r=(0,o4.deserialize)({encoded:e,encoding:t});return(0,o4.decodeTypeByte)(r.type)},this.getPayloadSenderPublicKey=(e,t=o4.BASE64)=>{let r=(0,o4.deserialize)({encoded:e,encoding:t});return r.senderPublicKey?(0,o6.toString)(r.senderPublicKey,o4.BASE16):void 0},this.core=e,this.logger=(0,oB.generateChildLogger)(t,this.name),this.keychain=r||new lD(this.core,this.logger)}get context(){return(0,oB.getLoggerContext)(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(lr)}catch{e=(0,o4.generateRandomBytes32)(),await this.keychain.set(lr,e)}return function(e,t="utf8"){let r=a9[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}}class lj extends oV{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name="messages",this.version="0.3",this.initialized=!1,this.storagePrefix=le,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let e=await this.getRelayerMessages();"u">typeof e&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}},this.set=async(e,t)=>{this.isInitialized();let r=(0,o4.hashMessage)(t),i=this.messages.get(e);return typeof i>"u"&&(i={}),"u">typeof i[r]||(i[r]=t,this.messages.set(e,i),await this.persist()),r},this.get=e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t},this.has=(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[(0,o4.hashMessage)(t)]),this.del=async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()},this.logger=(0,oB.generateChildLogger)(e,this.name),this.core=t}get context(){return(0,oB.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,(0,o4.mapToObj)(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?(0,o4.objToMap)(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}}class lU extends oF{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new oa.EventEmitter,this.name="publisher",this.queue=new Map,this.publishTimeout=(0,oL.toMiliseconds)(oL.ONE_MINUTE),this.failedPublishTimeout=(0,oL.toMiliseconds)(oL.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});let n=r?.ttl||ln,s=(0,o4.getRelayProtocolName)(r),o=r?.prompt||!1,a=r?.tag||0,l=r?.id||al().toString(),c={topic:e,message:t,opts:{ttl:n,relay:s,prompt:o,tag:a,id:l,attestation:r?.attestation}},u=`Failed to publish payload, please try again. id:${l} tag:${a}`,h=Date.now(),d,p=1;try{for(;void 0===d;){if(Date.now()-h>this.publishTimeout)throw Error(u);this.logger.trace({id:l,attempts:p},`publisher.publish - attempt ${p}`),d=await await (0,o4.createExpiringPromise)(this.rpcPublish(e,t,n,s,o,a,l,r?.attestation).catch(e=>this.logger.warn(e)),this.publishTimeout,u),p++,d||await new Promise(e=>setTimeout(e,this.failedPublishTimeout))}this.relayer.events.emit(lc,c),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:l,topic:e,message:t,opts:r}})}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(i=r?.internal)&&i.throwOnFailedPublish)throw e;this.queue.set(l,c)}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.relayer=e,this.logger=(0,oB.generateChildLogger)(t,this.name),this.registerEventListeners()}get context(){return(0,oB.getLoggerContext)(this.logger)}rpcPublish(e,t,r,i,n,s,o,a){var l,c,u,h;let d={method:(0,o4.getRelayProtocolApi)(i.protocol).publish,params:{topic:e,message:t,ttl:r,prompt:n,tag:s,attestation:a},id:o};return(0,o4.isUndefined)(null==(l=d.params)?void 0:l.prompt)&&(null==(c=d.params)||delete c.prompt),(0,o4.isUndefined)(null==(u=d.params)?void 0:u.tag)&&(null==(h=d.params)||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:r,opts:i}=e;await this.publish(t,r,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(oq,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ll);return}this.checkQueue()}),this.relayer.on(la,e=>{this.removeRequestFromQueue(e.id.toString())})}}class lM{constructor(){this.map=new Map,this.set=(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>
5025{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;let r=this.get(e);if(!this.exists(e,t))return;let i=r.filter(e=>e!==t);i.length?this.map.set(e,i):this.map.delete(e)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var lq=Object.defineProperty,lW=Object.defineProperties,lB=Object.getOwnPropertyDescriptors,lz=Object.getOwnPropertySymbols,lH=Object.prototype.hasOwnProperty,lK=Object.prototype.propertyIsEnumerable,lV=(e,t,r)=>t in e?lq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lF=(e,t)=>{for(var r in t||(t={}))lH.call(t,r)&&lV(e,r,t[r]);if(lz)for(var r of lz(t))lK.call(t,r)&&lV(e,r,t[r]);return e};class lG extends oJ{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new lM,this.events=new oa.EventEmitter,this.name="subscription",this.version="0.3",this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=le,this.subscribeTimeout=(0,oL.toMiliseconds)(oL.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let r=(0,o4.getRelayProtocolName)(t),i={topic:e,relay:r,transportType:t?.transportType};this.pending.set(e,i);let n=await this.rpcSubscribe(e,r,t?.transportType);return"string"==typeof n&&(this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}},this.unsubscribe=async(e,t)=>{await this.restartToComplete(),this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)},this.isSubscribed=async e=>{if(this.topics.includes(e))return!0;let t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise((r,i)=>{let n=new oL.Watch;n.start(t);let s=setInterval(()=>{!this.pending.has(e)&&this.topics.includes(e)&&(clearInterval(s),n.stop(t),r(!0)),n.elapsed(t)>=lb&&(clearInterval(s),n.stop(t),i(Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=(0,oB.generateChildLogger)(t,this.name),this.clientId=""}get context(){return(0,oB.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let r=this.topicMap.get(e);await Promise.all(r.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{let i=(0,o4.getRelayProtocolName)(r);await this.rpcUnsubscribe(e,t,i);let n=(0,o4.getSdkError)("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t,r=lm){r===lm&&await this.restartToComplete();let i={method:(0,o4.getRelayProtocolApi)(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{let t=(0,o4.hashMessage)(e+this.clientId);return r===lg?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch(e=>this.logger.warn(e))},(0,oL.toMiliseconds)(oL.ONE_SECOND)),t):await await (0,o4.createExpiringPromise)(this.relayer.request(i).catch(e=>this.logger.warn(e)),this.subscribeTimeout)?t:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ll)}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t=e[0].relay,r={method:(0,o4.getRelayProtocolApi)(t.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{return await await (0,o4.createExpiringPromise)(this.relayer.request(r).cat
5025ch(e=>this.logger.warn(e)),this.subscribeTimeout)}catch{this.relayer.events.emit(ll)}}async rpcBatchFetchMessages(e){let t;if(!e.length)return;let r=e[0].relay,i={method:(0,o4.getRelayProtocolApi)(r.protocol).batchFetchMessages,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{t=await await (0,o4.createExpiringPromise)(this.relayer.request(i).catch(e=>this.logger.warn(e)),this.subscribeTimeout)}catch{this.relayer.events.emit(ll)}return t}rpcUnsubscribe(e,t,r){let i={method:(0,o4.getRelayProtocolApi)(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,lW(lF({},t),lB({id:e}))),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,lF({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,lF({},t)),this.topicMap.set(t.topic,e),this.events.emit(ly,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=(0,o4.getInternalError)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(lv,lW(lF({},r),lB({reason:t})))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit("subscription_sync")}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){let e=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(e),await this.batchSubscribe(e)}}this.events.emit("subscription_resubscribed")}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=(0,o4.getInternalError)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let t=await this.rpcBatchSubscribe(e);(0,o4.isValidArray)(t)&&this.onBatchSubscribe(t.map((t,r)=>lW(lF({},e[r]),lB({id:t}))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(oq,async()=>{await this.checkPending()}),this.events.on(ly,async e=>{this.logger.info(`Emitting ${ly}`),this.logger.debug({type:"event",event:ly,data:e}),await this.persist()}),this.events.on(lv,async e=>{this.logger.info(`Emitting ${lv}`),this.logger.debug({type:"event",event:lv,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}async restartToComplete(){this.relayer.connected||this.relayer.connecting||await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var lY=Object.defineProperty,lJ=Object.getOwnPropertySymbols,lZ=Object.prototype.hasOwnProperty,lQ=Object.prototype.propertyIsEnumerable,lX=(e,t,r)=>t in e?lY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;class l0 extends oG{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new oa.EventEmitter,this.name="relayer",this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["s
5025ocket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=(0,oL.toMiliseconds)(oL.THIRTY_SECONDS+oL.ONE_SECOND),this.request=async e=>{var t,r;this.logger.debug("Publishing Request Payload");let i=e.id||al().toString();await this.toEstablishConnection();try{let n=this.provider.request(e);this.requestsInFlight.set(i,{promise:n,request:e}),this.logger.trace({id:i,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - attempt to publish...");let s=await new Promise(async(e,t)=>{let r=()=>{t(Error(`relayer.request - publish interrupted, id: ${i}`))};this.provider.on(ld,r);let s=await n;this.provider.off(ld,r),e(s)});return this.logger.trace({id:i,method:e.method,topic:null==(r=e.params)?void 0:r.topic},"relayer.request - published"),s}catch(e){throw this.logger.debug(`Failed to Publish Request: ${i}`),e}finally{this.requestsInFlight.delete(i)}},this.resetPingTimeout=()=>{if((0,o4.isNode)())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,t,r;null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)||r.terminate()},this.heartBeatTimeout)}catch(e){this.logger.warn(e)}},this.onPayloadHandler=e=>{this.onProviderPayload(e),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit("relayer_connect")},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit("relayer_error",e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(lu,this.onPayloadHandler),this.provider.on(lh,this.onConnectHandler),this.provider.on(ld,this.onDisconnectHandler),this.provider.on(lp,this.onProviderErrorHandler)},this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?(0,oB.generateChildLogger)(e.logger,this.name):(0,oz.default)((0,oB.getDefaultLoggerOptions)({level:e.logger||"error"})),this.messages=new lj(this.logger,e.core),this.subscriber=new lG(this,this.logger),this.publisher=new lU(this,this.logger),this.relayUrl=e?.relayUrl||ls,this.projectId=e.projectId,this.bundleId=(0,o4.getBundleId)(),this.provider={}}
5025async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return(0,oB.getLoggerContext)(this.logger)}get connected(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===1}get connecting(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===0}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:lm})}async subscribe(e,t){var r;this.isInitialized(),t?.transportType==="relay"&&await this.toEstablishConnection();let i=(null==(r=this.subscriber.topicMap.get(e))?void 0:r[0])||"",n,s=t=>{t.topic===e&&(this.subscriber.off(ly,s),n())};return await Promise.all([new Promise(e=>{n=e,this.subscriber.on(ly,s)}),new Promise(async r=>{i=await this.subscriber.subscribe(e,t)||i,r()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await (0,o4.createExpiringPromise)(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(e,t)=>{let r=()=>{this.provider.off(ld,r),t(Error("Connection interrupted while trying to subscribe"))};this.provider.on(ld,r),await (0,o4.createExpiringPromise)(this.provider.connect(),(0,oL.toMiliseconds)(oL.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(e=>{t(e)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(e=>{this.logger.error(e),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){if(this.logger.error(e),this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(e.message))throw e}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await (0,o4.isOnline)())throw Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0)return void this.logger.trace("Batch message events is empty. Ignoring...");let t=e.sort((e,t)=>e.publishedAt-t.publishedAt);for(let e of(this.logger.trace(`Batch of ${t.length} message events sorted`),t))try{await this.onMessageEvent(e)}catch(e){this.logger.warn(e)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){let{topic:r}=e;if(!t.sessionExists){let e=(0,o4.calcExpiry)(oL.FIVE_MINUTES);await this.core.pairing.pairings.set(r,{topic:r,expiry:e,relay:{protocol:"irn"},active:!1})}this.events.emit(lo,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,t,r,i,n;if((0,o4.isNode)())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(n=null==(i=null==(r=this.provider)?void 0:r.connection)?void 0:i.socket)||n.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(e){this.logger.warn(e)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new aw(new a_((0,o4.formatRelayRpcUrl)({sdkVersion:lf,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){let{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.debug(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;let i=this.messages.has(t,r);return i&&this.logger.debug(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ap(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:i,publishedAt:n,attestation:s}=t.data,o={topic:r,message:i,publishedAt:n,transportType:lm,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(((e,t)=>{for(var r in t||(t={}))lZ.call(t,r)&&lX(e,r,t[r]);if(lJ)for(var r of lJ(t))lQ.call(t,r)&&lX(e,r,t[r]);return e})({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else af(e)&&this.events.emit(la,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(lo,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=au(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(lu,this.onPayloadHandler),this.provider.off(lh,this.onConnectHandler),this.provider.off(ld,this.onDisconnectHandler),this.provider.off(lp,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await (0,o4.isOnline)();(0,o4.subscribeToNetworkChange)(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(e=>this.logger.error(e)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit("relayer_disconnect"),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},(0,oL.toMiliseconds)(.1))))}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),this.connected||(this.connectionAttemptInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var l1=Object.defineProperty,l3=Object.getOwnPropertySymbols,l2=Object.prototype.hasOwnProperty,l5=Object.prototype.propertyIsEnumerable,l4=(e,t,r)=>t in e?l1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l6=(e,t)=>{for(var r in t||(t={}))l2.call(t,r)&&l4(e,r,t[r]);if(l3)for(var r of l3(t))l5.call(t,r)&&l4(e,r,t[r]);return e};
5025class l8 extends oY{constructor(e,t,r,i=le,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,this.map=new Map,this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=le,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{this.getKey&&null!==e&&!(0,o4.isUndefined)(e)?this.map.set(this.getKey(e),e):(0,o4.isProposalStruct)(e)?this.map.set(e.id,e):(0,o4.isSessionStruct)(e)&&this.map.set(e.topic,e)}),this.cached=[],this.initialized=!0)},this.set=async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())},this.get=e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)),this.getAll=e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>(0,aE.default)(t[r],e[r]))):this.values),this.update=async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});let r=l6(l6({},this.getData(e)),t);this.map.set(e,r),await this.persist()},this.delete=async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())},this.logger=(0,oB.generateChildLogger)(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,oB.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){let{message:t}=(0,o4.getInternalError)("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=(0,o4.getInternalError)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:e}=(0,o4.getInternalError)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}}class l9{constructor(e,t){this.core=e,this.logger=t,this.name="pairing",this.version="0.3",this.events=new oa.default,this.initialized=!1,this.storagePrefix=le,this.ignoredPayloadTypes=[o4.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]},this.create=async e=>{this.isInitialized();let t=(0,o4.generateRandomBytes32)(),r=await this.core.crypto.setSymKey(t),i=(0,o4.calcExpiry)(oL.FIVE_MINUTES),n={protocol:"irn"},s=(0,o4.formatUri)({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:n,expiryTimestamp:i,methods:e?.methods});return this.core.expirer.set(r,i),await this.pairings.set(r,{topic:r,expiry:i,relay:n,active:!1}),await this.core.relayer.subscribe(r,{transportType:e?.transportType}),{topic:r,uri:s}},this.pair=async e=>{let t;this.isInitialized();let r=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:["pairing_started"]}});this.isValidPair(e,r);let{topic:i,symKey:n,relay:s,expiryTimestamp:o,methods:a}=(0,o4.parseUri)(e.uri);if(r.props.properties.topic=i,r.addTrace("pairing_uri_validation_success"),r.addTrace("pairing_uri_not_expired"),this.pairings.keys.includes(i)){if(t=this.pairings.get(i),r.addTrace("existing_pairing"),t.active)throw r.setError("active_pairing_already_exists"),Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);r.addTrace("pairing_not_expired")}let l=o||(0,o4.calcExpiry)(oL.FIVE_MINUTES),c={topic:i,relay:s,expiry:l,active:!1,methods:a};this.core.expirer.set(i,l),await this.pairings.set(i,c),r.addTrace("store_new_pairing"),e.activatePairing&&await this.activate({topic:i}),this.events.emit(lx,c),r.addTrace("emit_inactive_pairing"),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(n,i),r.addTrace("subscribing_pairing_topic");try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError("no_internet_connection")}try{await this.core.relayer.subscribe(i,{relay:s})}catch(e){throw r.setError("subscribe_pairing_topic_failure"),e}return r.addTrace("subscribe_pairing_topic_success"),c},this.activate=async({topic:e})=>{this.isInitialized();let t=(0,o4.calcExpiry)(oL.THIRTY_DAYS);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})},this.ping=async e=>{this.isInitialized(),await this.isValidPing(e);let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=(0,o4.createDelayedPromise)();this.events.once((0,o4.engineEvent)("pairing_ping",e),({error:e})=>{e?n(e):i()}),await r()}},this.updateExpiry=async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})},this.updateMetadata=async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",(0,o4.getSdkError)("USER_DISCONNECTED")),await this.deletePairing(t))},this.sendRequest=async(e,t,r)=>{let i=ac(t,r),n=await this.core.crypto.encode(e,i),s=lC[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id},this.sendResult=async(e,t,r)=>{let i=au(e,r),n=await this.core.crypto.encode(t,i),s=lC[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,n,s),await this.core.history.resolve(i)},this.sendError=async(e,t,r)=>{let i=ah(e,r),n=await this.core.crypto.encode(t,i),s=await this.core.history.get(t,e),o=lC[s.request.method]?lC[s.request.method].res:lC.unregistered_method.res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)},this.deletePairing=async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,(0,o4.getSdkError)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])},this.cleanup=async()=>{let e=this.pairings.getAll().filter(e=>(0,o4.isExpired)(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))},this.onRelayEventRequest=e=>{let{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}},this.onRelayEventResponse=async e=>{let{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)},this.onPairingPingRequest=async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit("pairing_ping",{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onPairingPingResponse=(e,t)=>{let{id:r}=t;setTimeout(()=>{ag(t)?this.events.emit((0,o4.engineEvent)("pairing_ping",r),{}):am(t)&&this.events.emit((0,o4.engineEvent)("pairing_ping",r),{error:t.error})},500)},this.onPairingDeleteRequest=async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(l_,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodRequest=async(e,t)=>{let{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;let t=(0,o4.getSdkError)("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}},this.onUnknownRpcMethodResponse=e=>{this.registeredMethods.includes(e)||this.logger.error((0,o4.getSdkError)("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=(e,t)=>
5025{var r;if(!(0,o4.isValidParams)(e)){let{message:r}=(0,o4.getInternalError)("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(lN),Error(r)}if(!(0,o4.isValidUrl)(e.uri)){let{message:r}=(0,o4.getInternalError)("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(lN),Error(r)}let i=(0,o4.parseUri)(e?.uri);if(!(null!=(r=i?.relay)&&r.protocol)){let{message:e}=(0,o4.getInternalError)("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(lN),Error(e)}if(!(null!=i&&i.symKey)){let{message:e}=(0,o4.getInternalError)("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(lN),Error(e)}if(null!=i&&i.expiryTimestamp&&(0,oL.toMiliseconds)(i?.expiryTimestamp)<Date.now()){t.setError("pairing_expired");let{message:e}=(0,o4.getInternalError)("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw Error(e)}},this.isValidPing=async e=>{if(!(0,o4.isValidParams)(e)){let{message:t}=(0,o4.getInternalError)("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidDisconnect=async e=>{if(!(0,o4.isValidParams)(e)){let{message:t}=(0,o4.getInternalError)("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)},this.isValidPairingTopic=async e=>{if(!(0,o4.isValidString)(e,!1)){let{message:t}=(0,o4.getInternalError)("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=(0,o4.getInternalError)("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if((0,o4.isExpired)(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=(0,o4.getInternalError)("EXPIRED",`pairing topic: ${e}`);throw Error(t)}},this.core=e,this.logger=(0,oB.generateChildLogger)(t,this.name),this.pairings=new l8(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,oB.getLoggerContext)(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(lo,async e=>{let{topic:t,message:r,transportType:i}=e;if(!this.pairings.keys.includes(t)||i===lg||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;let n=await this.core.crypto.decode(t,r);try{ap(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):af(n)&&(await this.core.history.resolve(n),await this.onRelayEventResponse({topic:t,payload:n}),this.core.history.delete(t,n.id))}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(lT,async e=>{let{topic:t}=(0,o4.parseExpirerTarget)(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}}class l7 extends oK{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new oa.EventEmitter,this.name="history",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=le,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;let i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:(0,o4.calcExpiry)(oL.THIRTY_DAYS)};this.records.set(i.id,i),this.persist(),this.events.emit(lE,i)},this.resolve=async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=am(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(lk,t))},this.get=async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)),this.delete=(e,t)=>
5025{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{r.topic===e&&("u">typeof t&&r.id!==t||(this.records.delete(r.id),this.events.emit(lS,r)))}),this.persist()},this.exists=async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e),this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=(0,oB.generateChildLogger)(t,this.name)}get context(){return(0,oB.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if("u">typeof t.response)return;let r={topic:t.topic,request:ac(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=(0,o4.getInternalError)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit("history_sync")}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=(0,o4.getInternalError)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(lE,e=>{this.logger.info(`Emitting ${lE}`),this.logger.debug({type:"event",event:lE,record:e})}),this.events.on(lk,e=>{this.logger.info(`Emitting ${lk}`),this.logger.debug({type:"event",event:lk,record:e})}),this.events.on(lS,e=>{this.logger.info(`Emitting ${lS}`),this.logger.debug({type:"event",event:lS,record:e})}),this.core.heartbeat.on(oq,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,oL.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(lS,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}}class ce extends oZ{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new oa.EventEmitter,this.name="expirer",this.version="0.3",this.cached=[],this.initialized=!1,this.storagePrefix=le,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}},this.set=(e,t)=>{this.isInitialized();let r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(lI,{target:r,expiration:i})},this.get=e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)},this.del=e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(lA,{target:t,expiration:r})}},this.on=(e,t)=>{this.events.on(e,t)},this.once=(e,t)=>{this.events.once(e,t)},this.off=(e,t)=>{this.events.off(e,t)},this.removeListener=(e,t)=>{this.events.removeListener(e,t)},this.logger=(0,oB.generateChildLogger)(t,this.name)}get context(){return(0,oB.getLoggerContext)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return(0,o4.formatTopicTarget)(e);if("number"==typeof e)return(0,o4.formatIdTarget)(e);let{message:t}=(0,o4.getInternalError)("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit("expirer_sync")}
5025async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=(0,o4.getInternalError)("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=(0,o4.getInternalError)("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,oL.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(lT,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(oq,()=>this.checkExpirations()),this.events.on(lI,e=>{this.logger.info(`Emitting ${lI}`),this.logger.debug({type:"event",event:lI,data:e}),this.persist()}),this.events.on(lT,e=>{this.logger.info(`Emitting ${lT}`),this.logger.debug({type:"event",event:lT,data:e}),this.persist()}),this.events.on(lA,e=>{this.logger.info(`Emitting ${lA}`),this.logger.debug({type:"event",event:lA,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=(0,o4.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}}var ct={};function cr(e){let t;return"u">typeof window&&"u">typeof window[e]&&(t=window[e]),t}function ci(e){let t=cr(e);if(!t)throw Error(`${e} is not defined in Window`);return t}Object.defineProperty(ct,"__esModule",{value:!0}),ct.getLocalStorage=ct.getLocalStorageOrThrow=ct.getCrypto=ct.getCryptoOrThrow=ct.getLocation=ct.getLocationOrThrow=ct.getNavigator=ct.getNavigatorOrThrow=cn=ct.getDocument=ct.getDocumentOrThrow=ct.getFromWindowOrThrow=ct.getFromWindow=void 0,ct.getFromWindow=cr,ct.getFromWindowOrThrow=ci,ct.getDocumentOrThrow=function(){return ci("document")};var cn=ct.getDocument=function(){return cr("document")};ct.getNavigatorOrThrow=function(){return ci("navigator")},ct.getNavigator=function(){return cr("navigator")},ct.getLocationOrThrow=function(){return ci("location")},ct.getLocation=function(){return cr("location")},ct.getCryptoOrThrow=function(){return ci("crypto")},ct.getCrypto=function(){return cr("crypto")},ct.getLocalStorageOrThrow=function(){return ci("localStorage")},ct.getLocalStorage=function(){return cr("localStorage")};class cs extends oQ{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,this.name="verify-api",this.verifyUrlV3=lR,this.storagePrefix=le,this.version=2,this.init=async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,oL.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async e=>{if(!(0,o4.isBrowser)()||this.isDevEnv)return;let t=window.location.origin,{id:r,decryptedId:i}=e,n=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${i}`;try{let e=cn(),t=this.startAbortTimer(5*oL.ONE_SECOND),i=await new Promise((i,s)=>{let o=()=>{window.removeEventListener("message",l),e.body.removeChild(a),s("attestation aborted")};this.abortController.signal.addEventListener("abort",o);let a=e.createElement("iframe");a.src=n,a.style.display="none",a.addEventListener("error",o,{signal:this.abortController.signal});let l=n=>{if(!n.data)return;let s=JSON.parse(n.data);if("verify_attestation"===s.type){if((0,o5.decodeJWT)(s.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",o),window.removeEventListener("message",l),i(null===s.attestation?"":s.attestation)}};e.body.appendChild(a),window.addEventListener("message",l,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",i),i}catch(e){this.logger.warn(e)}return""},this.resolve=async e=>{if(this.isDevEnv)return"";let{attestationId:t,hash:r,encryptedId:i}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if((0,o5.decodeJWT)(t).payload.id!==i)return;let e=await this.isValidJwtAttestation(t);
5025if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!r)return;let n=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(r,n)},this.fetchAttestation=async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(5*oL.ONE_SECOND),i=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0},this.getVerifyUrl=e=>{let t=e||lP;return lO.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${lP}`),t=lP),t},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(oL.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}},this.persistPublicKey=async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async e=>{let t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}let r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async e=>{let t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))});let e=await this.fetchPromise;return this.fetchPromise=void 0,e},this.validateAttestation=(e,t)=>{let r=(0,o4.verifyP256Jwt)(e,t.publicKey),i={hasExpired:(0,oL.toMiliseconds)(r.exp)<Date.now(),payload:r};if(i.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),Error("JWT attestation expired");return{origin:i.payload.origin,isScam:i.payload.isScam,isVerified:i.payload.isVerified}},this.logger=(0,oB.generateChildLogger)(t,this.name),this.abortController=new AbortController,this.isDevEnv=(0,o4.isNode)()&&Q.default.env.IS_VITEST,this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return(0,oB.getLoggerContext)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,oL.toMiliseconds)(e))}}class co extends oX{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context="echo",this.registerDeviceToken=async e=>{let{clientId:t,token:r,notificationType:i,enableEncrypted:n=!1}=e,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:i,token:r,always_raw:n})})},this.logger=(0,oB.generateChildLogger)(t,this.context)}}var ca=Object.defineProperty,cl=Object.getOwnPropertySymbols,cc=Object.prototype.hasOwnProperty,cu=Object.prototype.propertyIsEnumerable,ch=(e,t,r)=>t in e?ca(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cd=(e,t)=>{for(var r in t||(t={}))cc.call(t,r)&&ch(e,r,t[r]);if(cl)for(var r of cl(t))cu.call(t,r)&&ch(e,r,t[r]);return e};class cp extends o0{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,this.context="event-client",this.storagePrefix=le,this.storageVersion=.1,this.events=new Map,this.shouldPersist=!1,this.createEvent=e=>{let{event:t="ERROR",type:r="",properties:{topic:i,trace:n}}=e,s=(0,o4.uuidv4)(),o=cd({eventId:s,bundleId:this.core.projectId||"",timestamp:Date.now(),props:{event:t,type:r,properties:{topic:i,trace:n}}},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,o),this.shouldPersist=!0),o},this.getEvent=e=>{let{eventId:t,topic:r}=e;if(t)return this.events.get(t);let i=Array.from(this.events.values()).find(e=>e.props.properties.topic===r);if(i)return cd(cd({},i),this.setMethods(i.eventId))},this.deleteEvent=e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(oq,async()=>
5025{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,oL.fromMiliseconds)(Date.now())-(0,oL.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})},this.setMethods=e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)}),this.addTrace=(e,t)=>{let r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)},this.setError=(e,t)=>{let r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{let e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach(e=>{this.events.set(e.eventId,cd(cd({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}},this.submit=async()=>{if(!this.telemetryEnabled||0===this.events.size)return;let e=[];for(let[t,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await fetch(`https://pulse.walletconnect.com/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-${lf}`,{method:"POST",body:JSON.stringify(e)})).ok)for(let t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(e){this.logger.warn(e)}},this.logger=(0,oB.generateChildLogger)(t,this.context),r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var cf=Object.defineProperty,cg=Object.getOwnPropertySymbols,cm=Object.prototype.hasOwnProperty,cw=Object.prototype.propertyIsEnumerable,cy=(e,t,r)=>t in e?cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cv=(e,t)=>{for(var r in t||(t={}))cm.call(t,r)&&cy(e,r,t[r]);if(cg)for(var r of cg(t))cw.call(t,r)&&cy(e,r,t[r]);return e};class cb extends oH{constructor(e){var t;super(e),this.protocol="wc",this.version=2,this.name=a7,this.events=new oa.EventEmitter,this.initialized=!1,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.dispatchEnvelope=({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;let i={topic:e,message:t,publishedAt:Date.now(),transportType:lg};this.relayer.onLinkMessageEvent(i,{sessionExists:r})},this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||ls,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const r=(0,oB.getDefaultLoggerOptions)({level:"string"==typeof e?.logger&&e.logger?e.logger:"error"}),{logger:i,chunkLoggerController:n}=(0,oB.generatePlatformLogger)({opts:r,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=n,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=(0,oB.generateChildLogger)(i,this.name),this.heartbeat=new oW,this.crypto=new lL(this,this.logger,e?.keychain),this.history=new l7(this,this.logger),this.expirer=new ce(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new oD(cv(cv({},lt),e?.storageOptions)),this.relayer=new l0({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new l9(this,this.logger),this.verify=new cs(this,this.logger,this.storage),this.echoClient=new co(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new cp(this,this.logger,e?.telemetryEnabled)}static async init(e){let t=new cb(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,oB.getLoggerContext)(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(lw,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(
5025),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(lw)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}var oz=oz;let cC="client",cx=`wc@2:${cC}:`,c_="WALLETCONNECT_DEEPLINK_CHOICE",cE=(oL.THIRTY_DAYS,"Proposal expired"),ck=oL.SEVEN_DAYS,cS={wc_sessionPropose:{req:{ttl:oL.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:oL.ONE_DAY,prompt:!1,tag:1104},res:{ttl:oL.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:oL.ONE_DAY,prompt:!1,tag:1106},res:{ttl:oL.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:oL.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:oL.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:oL.ONE_DAY,prompt:!1,tag:1112},res:{ttl:oL.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:oL.ONE_DAY,prompt:!1,tag:1114},res:{ttl:oL.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:oL.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:oL.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:oL.FIVE_MINUTES,prompt:!1,tag:1119}}},cI={min:oL.FIVE_MINUTES,max:oL.SEVEN_DAYS},cA="IDLE",cT="ACTIVE",cP=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],cR="[email protected]:auth:",cO=`${cR}:PUB_KEY`;var cN=Object.defineProperty,c$=Object.defineProperties,cD=Object.getOwnPropertyDescriptors,cL=Object.getOwnPropertySymbols,cj=Object.prototype.hasOwnProperty,cU=Object.prototype.propertyIsEnumerable,cM=(e,t,r)=>t in e?cN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cq=(e,t)=>{for(var r in t||(t={}))cj.call(t,r)&&cM(e,r,t[r]);if(cL)for(var r of cL(t))cU.call(t,r)&&cM(e,r,t[r]);return e};class cW extends o3{constructor(t){super(t),this.name="engine",this.events=new oa.default,this.initialized=!1,this.requestQueue={state:cA,queue:[]},this.sessionRequestQueue={state:cA,queue:[]},this.requestQueueDelay=oL.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(cS)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,oL.toMiliseconds)(this.requestQueueDelay)))},this.connect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=c$(cq({},e),cD({requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}}));await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,relays:o}=t,a=r,l,c=!1;try{a&&(c=this.client.core.pairing.pairings.get(a).active)}catch(e){throw this.client.logger.error(`connect() -> pairing.get(${a}) failed`),e}if(!a||!c){let{topic:e,uri:t}=await this.client.core.pairing.create();a=e,l=t}if(!a){let{message:e}=(0,ol.getInternalError)("NO_MATCHING_KEY",`connect() pairing topic: ${a}`);throw Error(e)}let u=await this.client.core.crypto.generateKeyPair(),h=cS.wc_sessionPropose.req.ttl||oL.FIVE_MINUTES,d=(0,ol.calcExpiry)(h),p=cq({requiredNamespaces:i,optionalNamespaces:n,relays:o??[{protocol:"irn"}],proposer:{publicKey:u,metadata:this.client.metadata},expiryTimestamp:d,pairingTopic:a},s&&{sessionProperties:s}),{reject:f,resolve:g,done:m}=(0,ol.createDelayedPromise)(h,cE);this.events.once((0,ol.engineEvent)("session_connect"),async({error:e,session:t})=>{if(e)f(e);else if(t){t.self.publicKey=u;let e=c$(cq({},t),cD({pairingTopic:p.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,transportType:lm}));await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),a&&await this.client.core.pairing.updateMetadata({topic:a,metadata:t.peer.metadata}
5025),this.cleanupDuplicatePairings(e),g(e)}});let w=await this.sendRequest({topic:a,method:"wc_sessionPropose",params:p,throwOnFailedPublish:!0});return await this.setProposal(w,cq({id:w},p)),{uri:l,approval:m}},this.pair=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(e){throw this.client.logger.error("pair() failed"),e}},this.approve=async e=>{var t,r,i;let n=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[l$]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw n.setError("no_internet_connection"),e}try{await this.isValidProposalId(e?.id)}catch(t){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),n.setError("proposal_not_found"),t}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error("approve() -> isValidApprove() failed"),n.setError("session_approve_namespace_validation_failure"),e}let{id:s,relayProtocol:o,namespaces:a,sessionProperties:l,sessionConfig:c}=e,u=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:n.eventId});let{pairingTopic:h,proposer:d,requiredNamespaces:p,optionalNamespaces:f}=u,g=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:h});g||(g=null==(i=this.client.core.eventClient)?void 0:i.createEvent({type:l$,properties:{topic:h,trace:[l$,"session_namespaces_validation_success"]}}));let m=await this.client.core.crypto.generateKeyPair(),w=d.publicKey,y=await this.client.core.crypto.generateSharedKey(m,w),v=cq(cq({relay:{protocol:o??"irn"},namespaces:a,controller:{publicKey:m,metadata:this.client.metadata},expiry:(0,ol.calcExpiry)(ck)},l&&{sessionProperties:l}),c&&{sessionConfig:c});g.addTrace("subscribing_session_topic");try{await this.client.core.relayer.subscribe(y,{transportType:lm})}catch(e){throw g.setError("subscribe_session_topic_failure"),e}g.addTrace("subscribe_session_topic_success");let b=c$(cq({},v),cD({topic:y,requiredNamespaces:p,optionalNamespaces:f,pairingTopic:h,acknowledged:!1,self:v.controller,peer:{publicKey:d.publicKey,metadata:d.metadata},controller:m,transportType:lm}));await this.client.session.set(y,b),g.addTrace("store_session");try{g.addTrace("publishing_session_settle"),await this.sendRequest({topic:y,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch(e=>{throw g?.setError("session_settle_publish_failure"),e}),g.addTrace("session_settle_publish_success"),g.addTrace("publishing_session_approve"),await this.sendResult({id:s,topic:h,result:{relay:{protocol:o??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch(e=>{throw g?.setError("session_approve_publish_failure"),e}),g.addTrace("session_approve_publish_success")}catch(e){throw this.client.logger.error(e),this.client.session.delete(y,(0,ol.getSdkError)("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(y),e}return this.client.core.eventClient.deleteEvent({eventId:g.eventId}),await this.client.core.pairing.updateMetadata({topic:h,metadata:d.metadata}),await this.client.proposal.delete(s,(0,ol.getSdkError)("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(y,(0,ol.calcExpiry)(ck)),{topic:y,acknowledged:()=>Promise.resolve(this.client.session.get(y))}},this.reject=async e=>{let t;this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(e){throw this.client.logger.error("reject() -> isValidReject() failed"),e}let{id:r,reason:i}=e;try{t=this.client.proposal.get(r).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),e}t&&(await this.sendError({id:r,topic:t,error:i,rpcOpts:cS.wc_sessionPropose.reject}),await this.client.proposal.delete(r,(0,ol.getSdkError)("USER_DISCONNECTED")))},this.update=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(e){throw this.client.logger.error("update() -> isValidUpdate() failed"),e}let{topic:t,namespaces:r}=e,{done:i,resolve:n,reject:s}=(0,ol.createDelayedPromise)(),o=aa(),a=al().toString(),l=this.client.session.get(t).namespaces;return this.events.once((0,ol.engineEvent)("session_update",o),({error:e})=>{e?s(e):n()}),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:a}).catch(e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:l}),s(e)}),{acknowledged:i}},this.extend=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(e){throw this.client.logger.error("extend() -> isValidExtend() failed"),e}let{topic:t}=e,r=aa(),{done:i,resolve:n,reject:s}=(0,ol.createDelayedPromise)();return this.events.once((0,ol.engineEvent)("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,(0,ol.calcExpiry)(ck)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(e=>{s(e)}),{acknowledged:i}},this.request=async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(e){throw this.client.logger.error("request() -> isValidRequest() failed"),e}let{chainId:t,request:r,topic:i,expiry:n=cS.wc_sessionRequest.req.ttl}=e,s=this.client.session.get(i);s?.transportType===lm&&await this.confirmOnlineStateOrThrow();let o=aa(),a=al().toString(),{done:l,resolve:c,reject:u}=(0,ol.createDelayedPromise)(n,"Request expired. Please try again.");this.events.once((0,ol.engineEvent)("session_request",o),({error:e,result:t})=>{e?u(e):c(t)});let h=this.getAppLinkIfEnabled(s.peer.metadata,s.transportType);return h?(await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:i,method:"wc_sessionRequest",params:{request:c$(cq({},r),cD({expiryTimestamp:(0,ol.calcExpiry)(n)})),chainId:t},expiry:n,throwOnFailedPublish:!0,appLink:h}).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),await l()):await Promise.all([new Promise(async e=>{await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:i,method:"wc_sessionRequest",params:{request:c$(cq({},r),cD({expiryTimestamp:(0,ol.calcExpiry)(n)})),chainId:t},expiry:n,throwOnFailedPublish:!0}).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),e()}),new Promise(async e=>{var t;if(!(null!=(t=s.sessionConfig)&&t.disableDeepLink)){let e=await (0,ol.getDeepLink)(this.client.core.storage,c_);(0,ol.handleDeeplinkRedirect)({id:o,topic:i,wcDeepLink:e})}e()}),l()]).then(e=>e[2])},this.respond=async e=>{this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r,n=this.client.session.get(t);n.transportType===lm&&await this.confirmOnlineStateOrThrow();let s=this.getAppLinkIfEnabled(n.peer.metadata,n.transportType);ag(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:s}
5025):am(r)&&await this.sendError({id:i,topic:t,error:r.error,appLink:s}),this.cleanupAfterResponse(e)},this.ping=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(e){throw this.client.logger.error("ping() -> isValidPing() failed"),e}let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=aa(),r=al().toString(),{done:i,resolve:n,reject:s}=(0,ol.createDelayedPromise)();this.events.once((0,ol.engineEvent)("session_ping",e),({error:e})=>{e?s(e):n()}),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),i()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:r,chainId:i}=e,n=al().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i},throwOnFailedPublish:!0,relayRpcId:n})},this.disconnect=async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);let{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:(0,ol.getSdkError)("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(t))await this.client.core.pairing.disconnect({topic:t});else{let{message:e}=(0,ol.getInternalError)("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw Error(e)}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(0,ol.isSessionCompatible)(t,e))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(e,t)=>{var r;let i;this.isInitialized(),this.isValidAuthenticate(e);let n=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),s=n?lg:lm;s===lm&&await this.confirmOnlineStateOrThrow();let{chains:o,statement:a="",uri:l,domain:c,nonce:u,type:h,exp:d,nbf:p,methods:f=[],expiry:g}=e,m=[...e.resources||[]],{topic:w,uri:y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:s});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:y}});let v=await this.client.core.crypto.generateKeyPair(),b=(0,ol.hashKey)(v);if(await Promise.all([this.client.auth.authKeys.set(cO,{responseTopic:b,publicKey:v}),this.client.auth.pairingTopics.set(b,{topic:b,pairingTopic:w})]),await this.client.core.relayer.subscribe(b,{transportType:s}),this.client.logger.info(`sending request to new pairing topic: ${w}`),f.length>0){let{namespace:e}=(0,ol.parseChainId)(o[0]),t=(0,ol.createEncodedRecap)(e,"request",f);(0,ol.getRecapFromResources)(m)&&(t=(0,ol.mergeEncodedRecaps)(t,m.pop())),m.push(t)}let C=g&&g>cS.wc_sessionAuthenticate.req.ttl?g:cS.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:h??"caip122",chains:o,statement:a,aud:l,domain:c,version:"1",nonce:u,iat:new Date().toISOString(),exp:d,nbf:p,resources:m},requester:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:(0,ol.calcExpiry)(C)},_={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:o,methods:[...new Set(["personal_sign",...f])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:w,proposer:{publicKey:v,metadata:this.client.metadata},expiryTimestamp:(0,ol.calcExpiry)(cS.wc_sessionPropose.req.ttl)},{done:E,resolve:k,reject:S}=(0,ol.createDelayedPromise)(C,"Request expired"),I=async({error:e,session:t})=>{if(this.events.off((0,ol.engineEvent)("session_request",T),A),e)S(e);else if(t){t.self.publicKey=v,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:t.peer.metadata});let e=this.client.session.get(t.topic);await this.deleteProposal(P),k({session:e})}},A=async e=>{var r,i,n;let o;if(await this.deletePendingAuthRequest(T,{message:"fulfilled",code:0}),e.error){let t=(0,ol.getSdkError)("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off((0,ol.engineEvent)("session_connect"),I),S(e.error.message))}await this.deleteProposal(P),this.events.off((0,ol.engineEvent)("session_connect"),I);let{cacaos:a,responder:l}=e.result,c=[],u=[];for(let e of a){await (0,ol.validateSignedCacao)({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,"Signature verification failed"),S((0,ol.getSdkError)("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:t}=e,r=(0,ol.getRecapFromResources)(t.resources),i=[(0,ol.getNamespacedDidChainId)(t.iss)],n=(0,ol.getDidAddress)(t.iss);if(r){let e=(0,ol.getMethodsFromRecap)(r),t=(0,ol.getChainsFromRecap)(r);c.push(...e),i.push(...t)}for(let e of i)u.push(`${e}:${n}`)}let h=await this.client.core.crypto.generateSharedKey(v,l.publicKey);c.length>0&&(o={topic:h,acknowledged:!0,self:{publicKey:v,metadata:this.client.metadata},peer:l,controller:l.publicKey,expiry:(0,ol.calcExpiry)(ck),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:(0,ol.buildNamespacesFromAuth)([...new Set(c)],[...new Set(u)]),transportType:s},await this.client.core.relayer.subscribe(h,{transportType:s}),await this.client.session.set(h,o),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:l.metadata}),o=this.client.session.get(h)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(i=l.metadata.redirect)&&i.linkMode&&null!=(n=l.metadata.redirect)&&n.universal&&t&&(this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.session.update(h,{transportType:lg})),k({auths:a,session:o})},T=aa(),P=aa();this.events.once((0,ol.engineEvent)("session_connect"),I),this.events.once((0,ol.engineEvent)("session_request",T),A);try{if(n){let e=ac("wc_sessionAuthenticate",x,T);this.client.core.history.set(w,e);let r=await this.client.core.crypto.encode("",e,{type:ol.TYPE_2,encoding:ol.BASE64URL});i=(0,ol.getLinkModeURL)(t,w,r)}else await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:x,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:T}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:_,expiry:cS.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:P})])}catch(e){throw this.events.off((0,ol.engineEvent)("session_connect"),I),this.events.off((0,ol.engineEvent)("session_request",T),A),e}return await this.setProposal(P,cq({id:P},_)),await this.setAuthRequest(T,{request:c$(cq({},x),cD({verifyContext:{}})),pairingTopic:w,transportType:s}),{uri:i??y,response:E}},this.approveSessionAuthenticate=async e=>{let t,{id:r,auths:i}=e,n=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:["authenticated_session_approve_started"]}});try{this.isInitialized()}catch(e){throw n.setError("no_internet_connection"),e}let s=this.getPendingAuthRequest(r);if(!s)throw n.setError("authenticated_session_pending_request_not_found"),Error(`Could not find pending auth request with id ${r}`);let o=s.transportType||lm;o===lm&&await this.confirmOnlineStateOrThrow();let a=s.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),c=(0,ol.hashKey)(a),u={type:ol.TYPE_1,receiverPublicKey:a,senderPublicKey:l},h=[],d=[];for(let e of i){if(!await (0,ol.validateSignedCacao)({cacao:e,projectId:this.client.core.projectId})){n.setError("invalid_cacao");let e=(0,ol.getSdkError)("SESSION_SETTLEMENT_FAILED","Signature verification failed");
5025throw await this.sendError({id:r,topic:c,error:e,encodeOpts:u}),Error(e.message)}n.addTrace("cacaos_verified");let{p:t}=e,i=(0,ol.getRecapFromResources)(t.resources),s=[(0,ol.getNamespacedDidChainId)(t.iss)],o=(0,ol.getDidAddress)(t.iss);if(i){let e=(0,ol.getMethodsFromRecap)(i),t=(0,ol.getChainsFromRecap)(i);h.push(...e),s.push(...t)}for(let e of s)d.push(`${e}:${o}`)}let p=await this.client.core.crypto.generateSharedKey(l,a);if(n.addTrace("create_authenticated_session_topic"),h?.length>0){t={topic:p,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:a,metadata:s.requester.metadata},controller:a,expiry:(0,ol.calcExpiry)(ck),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:s.pairingTopic,namespaces:(0,ol.buildNamespacesFromAuth)([...new Set(h)],[...new Set(d)]),transportType:o},n.addTrace("subscribing_authenticated_session_topic");try{await this.client.core.relayer.subscribe(p,{transportType:o})}catch(e){throw n.setError("subscribe_authenticated_session_topic_failure"),e}n.addTrace("subscribe_authenticated_session_topic_success"),await this.client.session.set(p,t),n.addTrace("store_authenticated_session"),await this.client.core.pairing.updateMetadata({topic:s.pairingTopic,metadata:s.requester.metadata})}n.addTrace("publishing_authenticated_session_approve");try{await this.sendResult({topic:c,id:r,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(s.requester.metadata,o)})}catch(e){throw n.setError("authenticated_session_approve_publish_failure"),e}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:t}},this.rejectSessionAuthenticate=async e=>{this.isInitialized();let{id:t,reason:r}=e,i=this.getPendingAuthRequest(t);if(!i)throw Error(`Could not find pending auth request with id ${t}`);i.transportType===lm&&await this.confirmOnlineStateOrThrow();let n=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),o=(0,ol.hashKey)(n),a={type:ol.TYPE_1,receiverPublicKey:n,senderPublicKey:s};await this.sendError({id:t,topic:o,error:r,encodeOpts:a,rpcOpts:cS.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,(0,ol.getSdkError)("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();let{request:t,iss:r}=e;return(0,ol.formatMessage)(t,r)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{let e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic});if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}},this.deleteSession=async e=>{var t;let{topic:r,expirerHasDeleted:i=!1,emitEvent:n=!0,id:s=0}=e,{self:o}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,(0,ol.getSdkError)("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),i||this.client.core.expirer.del(r),this.client.core.storage.removeItem(c_).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEac
5025h(e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,(0,ol.getSdkError)("USER_DISCONNECTED"))}),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=cA),n&&this.client.events.emit("session_delete",{id:s,topic:r})},this.deleteProposal=async(e,t)=>{if(t)try{let t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});r?.setError("proposal_expired")}catch{}await Promise.all([this.client.proposal.delete(e,(0,ol.getSdkError)("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),r&&(this.sessionRequestQueue.state=cA,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,(0,ol.calcExpiry)(cS.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{let{request:r,pairingTopic:i,transportType:n=lm}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:i,verifyContext:r.verifyContext,transportType:n})},this.setPendingSessionRequest=async e=>{let{id:t,topic:r,params:i,verifyContext:n}=e,s=i.request.expiryTimestamp||(0,ol.calcExpiry)(cS.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,s),await this.client.pendingRequest.set(t,{id:t,topic:r,params:i,verifyContext:n})},this.sendRequest=async t=>{let r,i,{topic:n,method:s,params:o,expiry:a,relayRpcId:l,clientRpcId:c,throwOnFailedPublish:u,appLink:h}=t,d=ac(s,o,c),p=!!h;try{let e=p?ol.BASE64URL:ol.BASE64;r=await this.client.core.crypto.encode(n,d,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),e}if(cP.includes(s)){let e=(0,ol.hashMessage)(JSON.stringify(d)),t=(0,ol.hashMessage)(r);i=await this.client.core.verify.register({id:t,decryptedId:e})}let f=cS[s].req;if(f.attestation=i,a&&(f.ttl=a),l&&(f.id=l),this.client.core.history.set(n,d),p){let t=(0,ol.getLinkModeURL)(h,n,r);await e.g.Linking.openURL(t,this.client.name)}else{let e,t=cS[s].req;a&&(t.ttl=a),l&&(t.id=l),u?(e=cq({},t.internal),t.internal=c$(e,cD({throwOnFailedPublish:!0})),await this.client.core.relayer.publish(n,r,t)):this.client.core.relayer.publish(n,r,t).catch(e=>this.client.logger.error(e))}return d.id},this.sendResult=async t=>{let r,i,{id:n,topic:s,result:o,throwOnFailedPublish:a,encodeOpts:l,appLink:c}=t,u=au(n,o),h=c&&"u">typeof(null==e.g?void 0:e.g.Linking);try{let e,t,i=h?ol.BASE64URL:ol.BASE64;r=await this.client.core.crypto.encode(s,u,(e=cq({},l||{}),t={encoding:i},c$(e,cD(t))))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),e}try{i=await this.client.core.history.get(s,n)}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${n}) failed`),e}if(h){let t=(0,ol.getLinkModeURL)(c,s,r);await e.g.Linking.openURL(t,this.client.name)}else{let e,t=cS[i.request.method].res;a?(e=cq({},t.internal),t.internal=c$(e,cD({throwOnFailedPublish:!0})),await this.client.core.relayer.publish(s,r,t)):this.client.core.relayer.publish(s,r,t).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(u)},this.sendError=async t=>{let r,i,{id:n,topic:s,error:o,encodeOpts:a,rpcOpts:l,appLink:c}=t,u=ah(n,o),h=c&&"u">typeof(null==e.g?void 0:e.g.Linking);try{let e,t,i=h?ol.BASE64URL:ol.BASE64;r=await this.client.core.crypto.encode(s,u,(e=cq({},a||{}),t={encoding:i},c$(e,cD(t))))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),e}try{i=await this.client.core.history.get(s,n)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),e}if(h){let t=(0,ol.getLinkModeURL)(c,s,r);await e.g.Linking.openURL(t,this.client.name)}else{let e=l||cS[i.request.method].res;this.client.core.relayer.publish(s,r,e)}await this.client.core.history.resolve(u)},this.cleanup=async()=>{let e=[],t=[];
5025this.client.session.getAll().forEach(t=>{let r=!1;(0,ol.isExpired)(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{(0,ol.isExpired)(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===cT)return void this.client.logger.info("Request queue already active, skipping...");for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=cT;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=cA},this.processRequest=async e=>{let{topic:t,payload:r,attestation:i,transportType:n,encryptedId:s}=e,o=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest
5025({topic:t,payload:r,attestation:i,encryptedId:s});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});default:return this.client.logger.info(`Unsupported request method ${o}`)}},this.onRelayEventResponse=async e=>{let{topic:t,payload:r,transportType:i}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,i);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}},this.onRelayEventUnknownPayload=e=>{let{topic:t}=e,{message:r}=(0,ol.getInternalError)("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)},this.shouldIgnorePairingRequest=e=>{let{topic:t,requestMethod:r}=e,i=this.expectedPairingMethodMap.get(t);return!(!i||i.includes(r))&&!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async e=>{let{topic:t,payload:r,attestation:i,encryptedId:n}=e,{params:s,id:o}=r;try{let e=this.client.core.eventClient.getEvent({topic:t});this.isValidConnect(cq({},r.params));let a=s.expiryTimestamp||(0,ol.calcExpiry)(cS.wc_sessionPropose.req.ttl),l=cq({id:o,pairingTopic:t,expiryTimestamp:a},s);await this.setProposal(o,l);let c=await this.getVerifyContext({attestationId:i,hash:(0,ol.hashMessage)(JSON.stringify(r)),encryptedId:n,metadata:l.proposer.metadata});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError("proposal_listener_not_found")),e?.addTrace("emit_session_proposal"),this.client.events.emit("session_proposal",{id:o,params:l,verifyContext:c})}catch(e){await this.sendError({id:o,topic:t,error:e,rpcOpts:cS.wc_sessionPropose.autoReject}),this.client.logger.error(e)}},this.onSessionProposeResponse=async(e,t,r)=>{let{id:i}=t;if(ag(t)){let{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});let s=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:s});let o=s.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});let a=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let l=await this.client.core.crypto.generateSharedKey(o,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let c=await this.client.core.relayer.subscribe(l,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:c}),await this.client.core.pairing.activate({topic:e})}else if(am(t)){await this.client.proposal.delete(i,(0,ol.getSdkError)("USER_DISCONNECTED"));let e=(0,ol.engineEvent)("session_connect");if(0===this.events.listenerCount(e))throw Error(`emitting ${e} without any listeners, 954`);this.events.emit((0,ol.engineEvent)("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{let{id:r,params:i}=t;try{let r,n;this.isValidSessionSettleRequest(i);let{relay:s,controller:o,expiry:a,namespaces:l,sessionProperties:c,sessionConfig:u}=t.params,h=(r=cq(cq({topic:e,relay:s,expiry:a,namespaces:l,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:o.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},c&&{sessionProperties:c}),u&&{sessionConfig:u}),n={transportType:lm},c$(r,cD(n))),d=(0,ol.engineEvent)("session_connect");
5025if(0===this.events.listenerCount(d))throw Error(`emitting ${d} without any listeners 997`);this.events.emit((0,ol.engineEvent)("session_connect"),{session:h}),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}},this.onSessionSettleResponse=async(e,t)=>{let{id:r}=t;ag(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit((0,ol.engineEvent)("session_approve",r),{})):am(t)&&(await this.client.session.delete(e,(0,ol.getSdkError)("USER_DISCONNECTED")),this.events.emit((0,ol.engineEvent)("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{let{params:r,id:i}=t;try{let t=`${e}_session_update`,n=ol.MemoryStore.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.info(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:e,error:(0,ol.getSdkError)("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(cq({topic:e},r));try{ol.MemoryStore.set(t,i),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0})}catch(e){throw ol.MemoryStore.delete(t),e}this.client.events.emit("session_update",{id:i,topic:e,params:r})}catch(t){await this.sendError({id:i,topic:e,error:t}),this.client.logger.error(t)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{let{id:r}=t,i=(0,ol.engineEvent)("session_update",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);ag(t)?this.events.emit((0,ol.engineEvent)("session_update",r),{}):am(t)&&this.events.emit((0,ol.engineEvent)("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,(0,ol.calcExpiry)(ck)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}},this.onSessionExtendResponse=(e,t)=>{let{id:r}=t,i=(0,ol.engineEvent)("session_extend",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);ag(t)?this.events.emit((0,ol.engineEvent)("session_extend",r),{}):am(t)&&this.events.emit((0,ol.engineEvent)("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}},this.onSessionPingResponse=(e,t)=>{let{id:r}=t,i=(0,ol.engineEvent)("session_ping",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);setTimeout(()=>{ag(t)?this.events.emit((0,ol.engineEvent)("session_ping",r),{}):am(t)&&this.events.emit((0,ol.engineEvent)("session_ping",r),{error:t.error})},500)},this.onSessionDeleteRequest=async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise(t=>{this.client.core.relayer.once(lc,async()=>{t(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:(0,ol.getSdkError)("USER_DISCONNECTED")})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}},this.onSessionRequest=async e=>{var t,r,i;let{topic:n,payload:s,attestation:o,encryptedId:a,transportType:l}=e,{id:c,params:u}=s;try{await this.isValidRequest(cq({topic:n},u));let e=this.client.session.get(n),s=await this.getVerifyContext({attestationId:o,hash:(0,ol.hashMessage)(JSON.stringify(ac("wc_sessionRequest",u,c))),encryptedId:a,metadata:e.peer.metadata,transportType:l}),h={id:c,topic:n,params:u,verifyContext:s};await this.setPendingSessionRequest(h),l===lg&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(i=this.client.signConfig)&&i.disableRequestQueue?this.emitSessionRequest(h):(this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue())}
5025catch(e){await this.sendError({id:c,topic:n,error:e}),this.client.logger.error(e)}},this.onSessionRequestResponse=(e,t)=>{let{id:r}=t,i=(0,ol.engineEvent)("session_request",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);ag(t)?this.events.emit((0,ol.engineEvent)("session_request",r),{result:t.result}):am(t)&&this.events.emit((0,ol.engineEvent)("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{let{id:r,params:i}=t;try{let t=`${e}_session_event_${i.event.name}`,n=ol.MemoryStore.get(t);if(n&&this.isRequestOutOfSync(n,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(cq({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),ol.MemoryStore.set(t,r)}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}},this.onSessionAuthenticateResponse=(e,t)=>{let{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),ag(t)?this.events.emit((0,ol.engineEvent)("session_request",r),{result:t.result}):am(t)&&this.events.emit((0,ol.engineEvent)("session_request",r),{error:t.error})},this.onSessionAuthenticateRequest=async e=>{var t;let{topic:r,payload:i,attestation:n,encryptedId:s,transportType:o}=e;try{let{requester:e,authPayload:a,expiryTimestamp:l}=i.params,c=await this.getVerifyContext({attestationId:n,hash:(0,ol.hashMessage)(JSON.stringify(i)),encryptedId:s,metadata:e.metadata,transportType:o}),u={requester:e,pairingTopic:r,id:i.id,authPayload:a,verifyContext:c,expiryTimestamp:l};await this.setAuthRequest(i.id,{request:u,pairingTopic:r,transportType:o}),o===lg&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:i.params,id:i.id,verifyContext:c})}catch(a){this.client.logger.error(a);let e=i.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),n=this.getAppLinkIfEnabled(i.params.requester.metadata,o),s={type:ol.TYPE_1,receiverPublicKey:e,senderPublicKey:t};await this.sendError({id:i.id,topic:r,error:a,encodeOpts:s,rpcOpts:cS.wc_sessionAuthenticate.autoReject,appLink:n})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=cA,this.processSessionRequestQueue()},(0,oL.toMiliseconds)(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{let r=this.client.core.history.pending;r.length>0&&r.filter(t=>t.topic===e&&"wc_sessionRequest"===t.request.method).forEach(e=>{let r=e.request.id,i=(0,ol.engineEvent)("session_request",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);this.events.emit((0,ol.engineEvent)("session_request",e.request.id),{error:t})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===cT)return void this.client.logger.info("session request queue is already active.");let e=this.sessionRequestQueue.queue[0];if(!e)return void this.client.logger.info("session request queue is empty.");try{this.sessionRequestQueue.state=cT,this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);
5025t&&this.onSessionProposeRequest({topic:e.topic,payload:ac("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})},this.isValidConnect=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:n,relays:s}=e;if((0,ol.isUndefined)(t)||await this.isValidPairingTopic(t),!(0,ol.isValidRelays)(s,!0)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`connect() relays: ${s}`);throw Error(e)}(0,ol.isUndefined)(r)||0===(0,ol.isValidObject)(r)||this.validateNamespaces(r,"requiredNamespaces"),(0,ol.isUndefined)(i)||0===(0,ol.isValidObject)(i)||this.validateNamespaces(i,"optionalNamespaces"),(0,ol.isUndefined)(n)||this.validateSessionProps(n,"sessionProperties")},this.validateNamespaces=(e,t)=>{let r=(0,ol.isValidRequiredNamespaces)(e,"connect()",t);if(r)throw Error(r.message)},this.isValidApprove=async e=>{if(!(0,ol.isValidParams)(e))throw Error((0,ol.getInternalError)("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:i,sessionProperties:n}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let s=this.client.proposal.get(t),o=(0,ol.isValidNamespaces)(r,"approve()");if(o)throw Error(o.message);let a=(0,ol.isConformingNamespaces)(s.requiredNamespaces,r,"approve()");if(a)throw Error(a.message);if(!(0,ol.isValidString)(i,!0)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}(0,ol.isUndefined)(n)||this.validateSessionProps(n,"sessionProperties")},this.isValidReject=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!(0,ol.isValidErrorReason)(r)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}},this.isValidSessionSettleRequest=e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}
5025let{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!(0,ol.isValidRelay)(t)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let s=(0,ol.isValidController)(r,"onSessionSettleRequest()");if(s)throw Error(s.message);let o=(0,ol.isValidNamespaces)(i,"onSessionSettleRequest()");if(o)throw Error(o.message);if((0,ol.isExpired)(n)){let{message:e}=(0,ol.getInternalError)("EXPIRED","onSessionSettleRequest()");throw Error(e)}},this.isValidUpdate=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let i=this.client.session.get(t),n=(0,ol.isValidNamespaces)(r,"update()");if(n)throw Error(n.message);let s=(0,ol.isConformingNamespaces)(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)},this.isValidExtend=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:t,request:r,chainId:i,expiry:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let{namespaces:s}=this.client.session.get(t);if(!(0,ol.isValidNamespacesChainId)(s,i)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`request() chainId: ${i}`);throw Error(e)}if(!(0,ol.isValidRequest)(r)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw Error(e)}if(!(0,ol.isValidNamespacesRequest)(s,i,r.method)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`request() method: ${r.method}`);throw Error(e)}if(n&&!(0,ol.isValidRequestExpiry)(n,cI)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${cI.min} and ${cI.max}`);throw Error(e)}},this.isValidRespond=async e=>{var t;if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:i}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(!(0,ol.isValidResponse)(i)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}},this.isValidPing=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:t,event:r,chainId:i}=e;await this.isValidSessionTopic(t);let{namespaces:n}=this.client.session.get(t);if(!(0,ol.isValidNamespacesChainId)(n,i)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw Error(e)}if(!(0,ol.isValidEvent)(r)||!(0,ol.isValidNamespacesEvent)(n,i,r.name)){let{message:e}=(0,ol.getInternalError)("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}},this.isValidDisconnect=async e=>{if(!(0,ol.isValidParams)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{let{chains:t,uri:r,domain:i,nonce:n}=e;if(!Array.isArray(t)||0===t.length)throw Error("chains is required and must be a non-empty array");if(!(0,ol.isValidString)(r,!1))throw Error("uri is required parameter");if(!(0,ol.isValidString)(i,!1))throw Error("domain is required parameter");if(!(0,ol.isValidString)(n,!1))throw Error("nonce is required parameter");if([...new Set(t.map(e=>(0,ol.parseChainId)(e).namespace))].length>1)throw Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:s}=(0,ol.parseChainId)(t[0]);if("eip155"!==s)throw Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async e=>{let{attestationId:t,hash:r,encryptedId:i,metadata:n,transportType:s}=e,o={verified:{verifyUrl:n.verifyUrl||lP,validation:"UNKNOWN",origin:n.url||""}};try{if(s===lg){let e=this.getAppLinkIfEnabled(n,s);return o.verified.validation=e&&new URL(e).origin===new URL(n.url).origin?"VALID":"INVALID",o}let e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:i,verifyUrl:n.verifyUrl});e&&(o.verified.origin=e.origin,o.verified.isScam=e.isScam,o.verified.validation=e.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o},this.validateSessionProps=(e,t)=>
5025{Object.values(e).forEach(e=>{if(!(0,ol.isValidString)(e,!1)){let{message:r}=(0,ol.getInternalError)("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw Error(r)}})},this.getPendingAuthRequest=e=>{let t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;for(let r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}},this.checkRecentlyDeleted=e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:r}=(0,ol.getInternalError)("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw Error(r)}},this.isLinkModeEnabled=(t,r)=>{var i,n,s,o,a,l,c,u,h;return!!t&&r===lg&&(null==(n=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:n.linkMode)===!0&&(null==(o=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:o.universal)!==void 0&&(null==(l=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:l.universal)!==""&&(null==(c=t?.redirect)?void 0:c.universal)!==void 0&&(null==(u=t?.redirect)?void 0:u.universal)!==""&&(null==(h=t?.redirect)?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&"u">typeof(null==e.g?void 0:e.g.Linking)},this.getAppLinkIfEnabled=(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=e?.redirect)?void 0:r.universal:void 0},this.handleLinkModeMessage=({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;let t=(0,ol.getSearchParamFromURL)(e,"topic")||"",r=decodeURIComponent((0,ol.getSearchParamFromURL)(e,"wc_ev")||""),i=this.client.session.keys.includes(t);i&&this.client.session.update(t,{transportType:lg}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:i})},this.registerLinkModeListeners=async()=>{var t;if("u">typeof Q.default&&Q.default.env.IS_VITEST||(0,ol.isReactNative)()&&null!=(t=this.client.metadata.redirect)&&t.linkMode){let t=null==e.g?void 0:e.g.Linking;if("u">typeof t){t.addEventListener("url",this.handleLinkModeMessage,this.client.name);let e=await t.getInitialURL();e&&setTimeout(()=>{this.handleLinkModeMessage({url:e})},50)}}}}isInitialized(){if(!this.initialized){let{message:e}=(0,ol.getInternalError)("NOT_INITIALIZED",this.name);throw Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(lo,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){let{topic:t,message:r,attestation:i,transportType:n}=e,{publicKey:s}=this.client.auth.authKeys.keys.includes(cO)?this.client.auth.authKeys.get(cO):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(t,r,{receiverPublicKey:s,encoding:n===lg?ol.BASE64URL:ol.BASE64});try{ap(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o,attestation:i,transportType:n,encryptedId:(0,ol.hashMessage)(r)})):af(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o,transportType:n}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o,transportType:n})}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(lT,async e=>{let{topic:t,id:r}=(0,ol.parseExpirerTarget)(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,(0,ol.getInternalError)("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,(0,ol.getInternalError)("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))})}registerPairingEvents(){this.client.core.pairing.events.on(lx,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(l_,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!(0,ol.isValidString)(e,!1)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=(0,ol.getInternalError)("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if((0,ol.isExpired)(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=(0,ol.getInternalError)("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!(0,ol.isValidString)(e,!1)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:t}=(0,ol.getInternalError)("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if((0,ol.isExpired)(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=(0,ol.getInternalError)("EXPIRED",`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if((0,ol.isValidString)(e,!1)){let{message:t}=(0,ol.getInternalError)("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if(!(0,ol.isValidId)(e)){let{message:t}=(0,ol.getInternalError)("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=(0,ol.getInternalError)("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if((0,ol.isExpired)(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=(0,ol.getInternalError)("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class cB extends l8{constructor(e,t){super(e,t,"proposal",cx),this.core=e,this.logger=t}}class cz extends l8{constructor(e,t){super(e,t,"session",cx),this.core=e,this.logger=t}}class cH extends l8{constructor(e,t){super(e,t,"request",cx,e=>e.id),this.core=e,this.logger=t}}class cK extends l8{constructor(e,t){super(e,t,"authKeys",cR,()=>cO),this.core=e,this.logger=t}}class cV extends l8{constructor(e,t){super(e,t,"pairingTopics",cR),this.core=e,this.logger=t}}class cF extends l8{constructor(e,t){super(e,t,"requests",cR,e=>e.id),this.core=e,this.logger=t}}class cG{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new cK(this.core,this.logger),this.pairingTopics=new cV(this.core,this.logger),this.requests=new cF(this.core,this.logger)}
5025async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class cY extends o1{constructor(e){super(e),this.protocol="wc",this.version=2,this.name=cC,this.events=new oa.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}},this.update=async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}},this.request=async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}},this.find=e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.authenticate=async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}},this.name=e?.name||cC,this.metadata=e?.metadata||(0,ol.getAppMetadata)(),this.signConfig=e?.signConfig;const t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,oz.default)((0,oB.getDefaultLoggerOptions)({level:e?.logger||"error"}));this.core=e?.core||new cb(e),this.logger=(0,oB.generateChildLogger)(t,this.name),this.session=new cz(this.core,this.logger),this.proposal=new cB(this.core,this.logger),this.pendingRequest=new cH(this.core,this.logger),this.engine=new cW(this),this.auth=new cG(this.core,this.logger)}static async init(e){let t=new cY(e);return await t.initialize(),t}get context(){return(0,oB.getLoggerContext)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var oz=oz,cJ=e.i(320502),cZ=Object.defineProperty,cQ=Object.defineProperties,cX=Object.getOwnPropertyDescriptors,c0=Object.getOwnPropertySymbols,c1=Object.prototype.hasOwnProperty,c3=Object.prototype.propertyIsEnumerable,c2=(e,t,r)=>t in e?cZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c5=(e,t)=>{for(var r in t||(t={}))c1.call(t,r)&&c2(e,r,t[r]);if(c0)for(var r of c0(t))c3.call(t,r)&&c2(e,r,t[r]);return e};let c4={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class c6{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new oa.EventEmitter,this.isAvailable=!1,this.registering=!1,!av(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}
5025get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{let t,r,i=(0,oS.safeJsonStringify)(e),n=await (await (0,cJ.default)(this.url,(t=c5({},c4),r={body:i},cQ(t,cX(r))))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!av(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(Error("HTTP connection is missing or invalid"));e()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){let t,r,i=(0,oS.safeJsonStringify)({id:1,jsonrpc:"2.0",method:"test",params:[]});await (0,cJ.default)(e,(t=c5({},c4),r={body:i},cQ(t,cX(r))))}this.onOpen()}catch(t){let e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,oS.safeJsonParse)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=ah(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return ao(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}let c8="error",c9="wc@2:universal_provider:",c7="generic",ue="default_chain_changed";var ut="u">typeof globalThis?globalThis:"u">typeof window?window:e.g,ur={exports:{}};o=ur.exports,(function(){var e,t="Expected a function",r="__lodash_hash_undefined__",i="__lodash_placeholder__",n=1/0,s=0/0,a=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],l="[object Arguments]",c="[object Array]",u="[object Boolean]",h="[object Date]",d="[object Error]",p="[object Function]",f="[object GeneratorFunction]",g="[object Map]",m="[object Number]",w="[object Object]",y="[object Promise]",v="[object RegExp]",b="[object Set]",C="[object String]",x="[object Symbol]",_="[object WeakMap]",E="[object ArrayBuffer]",k="[object DataView]",S="[object Float32Array]",I="[object Float64Array]",A="[object Int8Array]",T="[object Int16Array]",P="[object Int32Array]",R="[object Uint8Array]",O="[object Uint8ClampedArray]",N="[object Uint16Array]",$="[object Uint32Array]",D=/\b__p \+= '';/g,L=/\b(__p \+=) '' \+/g,j=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,M=/[&<>"']/g,q=RegExp(U.source),W=RegExp(M.source),B=/<%-([\s\S]+?)%>/g,z=/<%([\s\S]+?)%>/g,H=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,Y=RegExp(G.source),J=/^\s+/,Z=/\s/,Q=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,X=/\{\n\/\* \[wrapped with (.+)\] \*/,ee=/,? & /,et=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,er=/[()=,{}\[\]\/\s]/,ei=/\\(\\)?/g,en=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,es=/\w*$/,eo=/^[-+]0x[0-9a-f]+$/i,ea=/^0b[01]+$/i,el=/^\[object .+?Constructor\]$/,ec=/^0o[0-7]+$/i,eu=/^(?:0|[1-9]\d*)$/,eh=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u01
vendor: 7,560 bytes, line 5025
50257f]/g,ed=/($^)/,ep=/['\n\r\u2028\u2029\\]/g,ef="\\ud800-\\udfff",eg="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",em="\\u2700-\\u27bf",ew="a-z\\xdf-\\xf6\\xf8-\\xff",ey="A-Z\\xc0-\\xd6\\xd8-\\xde",ev="\\ufe0e\\ufe0f",eb="\\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",eC="['’]",ex="["+eb+"]",e_="["+eg+"]",eE="["+ew+"]",ek="[^"+ef+eb+"\\d+"+em+ew+ey+"]",eS="\\ud83c[\\udffb-\\udfff]",eI="[^"+ef+"]",eA="(?:\\ud83c[\\udde6-\\uddff]){2}",eT="[\\ud800-\\udbff][\\udc00-\\udfff]",eP="["+ey+"]",eR="\\u200d",eO="(?:"+eE+"|"+ek+")",eN="(?:"+eP+"|"+ek+")",e$="(?:"+eC+"(?:d|ll|m|re|s|t|ve))?",eD="(?:"+eC+"(?:D|LL|M|RE|S|T|VE))?",eL="(?:"+e_+"|"+eS+")?",ej="["+ev+"]?",eU="(?:"+eR+"(?:"+[eI,eA,eT].join("|")+")"+ej+eL+")*",eM=ej+eL+eU,eq="(?:"+["["+em+"]",eA,eT].join("|")+")"+eM,eW="(?:"+[eI+e_+"?",e_,eA,eT,"["+ef+"]"].join("|")+")",eB=RegExp(eC,"g"),ez=RegExp(e_,"g"),eH=RegExp(eS+"(?="+eS+")|"+eW+eM,"g"),eK=RegExp([eP+"?"+eE+"+"+e$+"(?="+[ex,eP,"$"].join("|")+")",eN+"+"+eD+"(?="+[ex,eP+eO,"$"].join("|")+")",eP+"?"+eO+"+"+e$,eP+"+"+eD,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",eq].join("|"),"g"),eV=RegExp("["+eR+ef+eg+ev+"]"),eF=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,eG=["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"],eY=-1,eJ={};eJ[S]=eJ[I]=eJ[A]=eJ[T]=eJ[P]=eJ[R]=eJ[O]=eJ[N]=eJ[$]=!0,eJ[l]=eJ[c]=eJ[E]=eJ[u]=eJ[k]=eJ[h]=eJ[d]=eJ[p]=eJ[g]=eJ[m]=eJ[w]=eJ[v]=eJ[b]=eJ[C]=eJ[_]=!1;var eZ={};eZ[l]=eZ[c]=eZ[E]=eZ[k]=eZ[u]=eZ[h]=eZ[S]=eZ[I]=eZ[A]=eZ[T]=eZ[P]=eZ[g]=eZ[m]=eZ[w]=eZ[v]=eZ[b]=eZ[C]=eZ[x]=eZ[R]=eZ[O]=eZ[N]=eZ[$]=!0,eZ[d]=eZ[p]=eZ[_]=!1;var eQ={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},eX=parseFloat,e0=parseInt,e1="object"==typeof ut&&ut&&ut.Object===Object&&ut,e3="object"==typeof self&&self&&self.Object===Object&&self,e2=e1||e3||Function("return this")(),e5=o&&!o.nodeType&&o,e4=e5&&ur&&!ur.nodeType&&ur,e6=e4&&e4.exports===e5,e8=e6&&e1.process,e9=function(){try{return e4&&e4.require&&e4.require("util").types||e8&&e8.binding&&e8.binding("util")}catch{}}(),e7=e9&&e9.isArrayBuffer,te=e9&&e9.isDate,tt=e9&&e9.isMap,tr=e9&&e9.isRegExp,ti=e9&&e9.isSet,tn=e9&&e9.isTypedArray;function ts(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 to(e,t,r,i){for(var n=-1,s=null==e?0:e.length;++n<s;){var o=e[n];t(i,o,r(o),e)}return i}function ta(e,t){for(var r=-1,i=null==e?0:e.length;++r<i&&!1!==t(e[r],r,e););return e}function tl(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(!t(e[r],r,e))return!1;return!0}function tc(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s}function tu(e,t){return!!(null==e?0:e.length)&&tb(e,t,0)>-1}function th(e,t,r){for(var i=-1,n=null==e?0:e.length;++i<n;)if(r(t,e[i]))return!0;return!1}function td(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}function tp(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}function tf(e,t,r,i){var n=-1,s=null==e?0:e.length;for(i&&s&&(r=e[++n]);++n<s;)r=t(r,e[n],n,e);return r}function tg(e,t,r,i){var n=null==e?0:e.length;for(i&&n&&(r=e[--n]);n--;)r=t(r,e[n],n,e);return r}function tm(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}var tw=tE("length");function ty(e,t,r){var i;return r(e,function(e,r,n){if(t(e,r,n))return i=r,!1}),i}function tv(e,t,r,i){for(var n=e.length,s=r+(i?1:-1);i?s--:++s<n;)if(t(e[s],s,e))return s;return -1}function tb(e,t,r){return t==t?function(e,t,r){for(var i=r-1,n=e.length;++i<n;)if(e[i]===t)return i;return -1}(e,t,r):tv(e,tx,r)}function tC(e,t,r,i){for(var n=r-1,s=e.length;++n<s;)if(i(e[n],t))return n;return -1}function tx(e){return e!=e}function t_(e,t){var r=null==e?0:e.length;return r?tI(e,t)/r:s}function tE(t){return function(r){return null==r?e:r[t]}}function tk(t){return function(r){return null==t?e:t[r]}}function tS(e,t,r,i,n){return n(e,function(e,n,s){r=i?(i=!1,e):t(r,e,n,s)}),r}function tI(t,r){for(var i,n=-1,s=t.length;++n<s;){var o=r(t[n]);o!==e&&(i=i===e?o:i+o)}return i}function tA(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}function tT(e){return e&&e.slice(0,tK(e)+1).replace(J,"")}function tP(e){return function(t){return e(t)}}function tR(e,t){return td(t,function(t){return e[t]})}function tO(e,t){return e.has(t)}function tN(e,t){for(var r=-1,i=e.length;++r<i&&tb(t,e[r],0)>-1;);return r}function t$(e,t){for(var r=e.length;r--&&tb(t,e[r],0)>-1;);return r}var tD=tk({À:"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"}),tL=tk({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function tj(e){return"\\"+eQ[e]}function tU(e){return eV.test(e)}function tM(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function tq(e,t){return function(r){return e(t(r))}}function tW(e,t){for(var r=-1,n=e.length,s=0,o=[];++r<n;){var a=e[r];(a===t||a===i)&&(e[r]=i,o[s++]=r)}return o}function tB(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function tz(e){return tU(e)?function(e){for(var t=eH.lastIndex=0;eH.test(e);)++t;return t}(e):tw(e)}function tH(e){return tU(e)?e.match(eH)||[]:e.split("")}function tK(e){for(var t=e.length;t--&&Z.test(e.charAt(t)););return t}var tV=tk({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),tF=function o(Z){var ef,eg,em,ew,ey=(Z=null==Z?e2:tF.defaults(e2.Object(),Z,tF.pick(e2,eG))).Array,ev=Z.Date,eb=Z.Error,eC=Z.Function,ex=Z.Math,e_=Z.Object,eE=Z.RegExp,ek=Z.String,eS=Z.TypeError,eI=ey.prototype,eA=eC.prototype,eT=e_.prototype,eP=Z["__core-js_shared__"],eR=eA.toString,eO=eT.hasOwnProperty,eN=0,e$=(ef=/[^.]+$/.exec(eP&&eP.keys&&eP.keys.IE_PROTO||""))?"Symbol(sr
5025c)_1."+ef:"",eD=eT.toString,eL=eR.call(e_),ej=e2._,eU=eE("^"+eR.call(eO).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),eM=e6?Z.Buffer:e,eq=Z.Symbol,eW=Z.Uint8Array,eH=eM?eM.allocUnsafe:e,eV=tq(e_.getPrototypeOf,e_),eQ=e_.create,e1=eT.propertyIsEnumerable,e3=eI.splice,e5=eq?eq.isConcatSpreadable:e,e4=eq?eq.iterator:e,e8=eq?eq.toStringTag:e,e9=function(){try{var e=nf(e_,"defineProperty");return e({},"",{}),e}catch{}}(),tw=Z.clearTimeout!==e2.clearTimeout&&Z.clearTimeout,tk=ev&&ev.now!==e2.Date.now&&ev.now,tG=Z.setTimeout!==e2.setTimeout&&Z.setTimeout,tY=ex.ceil,tJ=ex.floor,tZ=e_.getOwnPropertySymbols,tQ=eM?eM.isBuffer:e,tX=Z.isFinite,t0=eI.join,t1=tq(e_.keys,e_),t3=ex.max,t2=ex.min,t5=ev.now,t4=Z.parseInt,t6=ex.random,t8=eI.reverse,t9=nf(Z,"DataView"),t7=nf(Z,"Map"),re=nf(Z,"Promise"),rt=nf(Z,"Set"),rr=nf(Z,"WeakMap"),ri=nf(e_,"create"),rn=rr&&new rr,rs={},ro=nM(t9),ra=nM(t7),rl=nM(re),rc=nM(rt),ru=nM(rr),rh=eq?eq.prototype:e,rd=rh?rh.valueOf:e,rp=rh?rh.toString:e;function rf(e){if(sG(e)&&!sj(e)&&!(e instanceof ry)){if(e instanceof rw)return e;if(eO.call(e,"__wrapped__"))return nq(e)}return new rw(e)}var rg=function(){function t(){}return function(r){if(!sF(r))return{};if(eQ)return eQ(r);t.prototype=r;var i=new t;return t.prototype=e,i}}();function rm(){}function rw(t,r){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!r,this.__index__=0,this.__values__=e}function ry(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=0xffffffff,this.__views__=[]}function rv(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function rb(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function rC(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function rx(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new rC;++t<r;)this.add(e[t])}function r_(e){var t=this.__data__=new rb(e);this.size=t.size}function rE(e,t){var r=sj(e),i=!r&&sL(e),n=!r&&!i&&sW(e),s=!r&&!i&&!n&&s3(e),o=r||i||n||s,a=o?tA(e.length,ek):[],l=a.length;for(var c in e)(t||eO.call(e,c))&&!(o&&("length"==c||n&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||nC(c,l)))&&a.push(c);return a}function rk(t){var r=t.length;return r?t[iu(0,r-1)]:e}rf.templateSettings={escape:B,evaluate:z,interpolate:H,variable:"",imports:{_:rf}},rf.prototype=rm.prototype,rf.prototype.constructor=rf,rw.prototype=rg(rm.prototype),rw.prototype.constructor=rw,ry.prototype=rg(rm.prototype),ry.prototype.constructor=ry,rv.prototype.clear=function(){this.__data__=ri?ri(null):{},this.size=0},rv.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},rv.prototype.get=function(t){var i=this.__data__;if(ri){var n=i[t];return n===r?e:n}return eO.call(i,t)?i[t]:e},rv.prototype.has=function(t){var r=this.__data__;return ri?r[t]!==e:eO.call(r,t)},rv.prototype.set=function(t,i){var n=this.__data__;return this.size+=+!this.has(t),n[t]=ri&&i===e?r:i,this},rb.prototype.clear=function(){this.__data__=[],this.size=0},rb.prototype.delete=function(e){var t=this.__data__,r=rA(t,e);return!(r<0)&&(r==t.length-1?t.pop():e3.call(t,r,1),--this.size,!0)},rb.prototype.get=function(t){var r=this.__data__,i=rA(r,t);return i<0?e:r[i][1]},rb.prototype.has=function(e){return rA(this.__data__,e)>-1},rb.prototype.set=function(e,t){var r=this.__data__,i=rA(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},rC.prototype.clear=function(){this.size=0,this.__data__={hash:new rv,map:new(t7||rb),string:new rv}},rC.prototype.delete=function(e){var t=nd(this,e).delete(e);return this.size-=!!t,t},rC.prototype.get=function(e){return nd(this,e).get(e)},rC.prototype.has=function(e){return nd(this,e).has(e)},rC.prototype.set=function(e,t){var r=nd(this,e),i=r.size;return r.set(e,t),this.size+=+(r.size!=i),this},rx.prototype.add=rx.prototype.push=function(e){return this.__data__.set(e,r),this},rx.prototype.has=function(e){return this.__data__.has(e)};function rS(t,r,i){(i===e||sN(t[r],i))&&(i!==e||r in t)||rR(t,r,i)}function rI(t,r,i){var n=t[r];eO.call(t,r)&&sN(n,i)&&(i!==e||r in t)||rR(t,r,i)}function rA(e,t){for(var r=e.length;r--;)if(sN(e[r][0],t))return r;return -1}
5025function rT(e,t,r,i){return rU(e,function(e,n,s){t(i,e,r(e),s)}),i}function rP(e,t){return e&&iz(t,of(t),e)}function rR(e,t,r){"__proto__"==t&&e9?e9(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function rO(t,r){for(var i=-1,n=r.length,s=ey(n),o=null==t;++i<n;)s[i]=o?e:oc(t,r[i]);return s}function rN(t,r,i){return t==t&&(i!==e&&(t=t<=i?t:i),r!==e&&(t=t>=r?t:r)),t}function r$(t,r,i,n,s,o){var a,c=1&r,d=2&r,y=4&r;if(i&&(a=s?i(t,n,s,o):i(t)),a!==e)return a;if(!sF(t))return t;var _=sj(t);if(_){if(L=(D=t).length,j=new D.constructor(L),L&&"string"==typeof D[0]&&eO.call(D,"index")&&(j.index=D.index,j.input=D.input),a=j,!c)return iB(t,a)}else{var D,L,j,U,M,q,W,B,z=nw(t),H=z==p||z==f;if(sW(t))return iL(t,c);if(z==w||z==l||H&&!s){if(a=d||H?{}:nv(t),!c){return d?(U=t,M=(B=a)&&iz(t,og(t),B),iz(U,nm(U),M)):(q=t,W=rP(a,t),iz(q,ng(q),W))}}else{if(!eZ[z])return s?t:{};a=function(e,t,r){var i,n,s=e.constructor;switch(t){case E:return ij(e);case u:case h:return new s(+e);case k:return i=r?ij(e.buffer):e.buffer,new e.constructor(i,e.byteOffset,e.byteLength);case S:case I:case A:case T:case P:case R:case O:case N:case $:return iU(e,r);case g:return new s;case m:case C:return new s(e);case v:return(n=new e.constructor(e.source,es.exec(e))).lastIndex=e.lastIndex,n;case b:return new s;case x:return rd?e_(rd.call(e)):{}}}(t,z,c)}}o||(o=new r_);var K=o.get(t);if(K)return K;o.set(t,a),sX(t)?t.forEach(function(e){a.add(r$(e,r,i,e,t,o))}):sY(t)&&t.forEach(function(e,n){a.set(n,r$(e,r,i,n,t,o))});var V=y?d?na:no:d?og:of,F=_?e:V(t);return ta(F||t,function(e,n){F&&(e=t[n=e]),rI(a,n,r$(e,r,i,n,t,o))}),a}function rD(t,r,i){var n=i.length;if(null==t)return!n;for(t=e_(t);n--;){var s=i[n],o=r[s],a=t[s];if(a===e&&!(s in t)||!o(a))return!1}return!0}function rL(r,i,n){if("function"!=typeof r)throw new eS(t);return nO(function(){r.apply(e,n)},i)}function rj(e,t,r,i){var n=-1,s=tu,o=!0,a=e.length,l=[],c=t.length;if(!a)return l;r&&(t=td(t,tP(r))),i?(s=th,o=!1):t.length>=200&&(s=tO,o=!1,t=new rx(t));t:for(;++n<a;){var u=e[n],h=null==r?u:r(u);if(u=i||0!==u?u:0,o&&h==h){for(var d=c;d--;
5025)if(t[d]===h)continue t;l.push(u)}else s(t,h,i)||l.push(u)}return l}r_.prototype.clear=function(){this.__data__=new rb,this.size=0},r_.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},r_.prototype.get=function(e){return this.__data__.get(e)},r_.prototype.has=function(e){return this.__data__.has(e)},r_.prototype.set=function(e,t){var r=this.__data__;if(r instanceof rb){var i=r.__data__;if(!t7||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new rC(i)}return r.set(e,t),this.size=r.size,this};var rU=iV(rV),rM=iV(rF,!0);function rq(e,t){var r=!0;return rU(e,function(e,i,n){return r=!!t(e,i,n)}),r}function rW(t,r,i){for(var n=-1,s=t.length;++n<s;){var o=t[n],a=r(o);if(null!=a&&(l===e?a==a&&!s1(a):i(a,l)))var l=a,c=o}return c}function rB(e,t){var r=[];return rU(e,function(e,i,n){t(e,i,n)&&r.push(e)}),r}function rz(e,t,r,i,n){var s=-1,o=e.length;for(r||(r=nb),n||(n=[]);++s<o;){var a=e[s];t>0&&r(a)?t>1?rz(a,t-1,r,i,n):tp(n,a):i||(n[n.length]=a)}return n}var rH=iF(),rK=iF(!0);function rV(e,t){return e&&rH(e,t,of)}function rF(e,t){return e&&rK(e,t,of)}function rG(e,t){return tc(t,function(t){return sH(e[t])})}function rY(t,r){r=iN(r,t);for(var i=0,n=r.length;null!=t&&i<n;)t=t[nU(r[i++])];return i&&i==n?t:e}function rJ(e,t,r){var i=t(e);return sj(e)?i:tp(i,r(e))}function rZ(t){var r;return null==t?t===e?"[object Undefined]":"[object Null]":e8&&e8 in e_(t)?function(t){var r=eO.call(t,e8),i=t[e8];try{t[e8]=e;var n=!0}catch{}var s=eD.call(t);return n&&(r?t[e8]=i:delete t[e8]),s}(t):(r=t,eD.call(r))}function rQ(e,t){return e>t}function rX(e,t){return null!=e&&eO.call(e,t)}function r0(e,t){return null!=e&&t in e_(e)}function r1(t,r,i){for(var n=i?th:tu,s=t[0].length,o=t.length,a=o,l=ey(o),c=1/0,u=[];a--;){var h=t[a];a&&r&&(h=td(h,tP(r))),c=t2(h.length,c),l[a]=!i&&(r||s>=120&&h.length>=120)?new rx(a&&h):e}h=t[0];var d=-1,p=l[0];t:for(;++d<s&&u.length<c;){var f=h[d],g=r?r(f):f;if(f=i||0!==f?f:0,!(p?tO(p,g):n(u,g,i))){for(a=o;--a;){var m=l[a];if(!(m?tO(m,g):n(t[a],g,i)))continue t}p&&p.push(g),u.push(f)}}return u}function r3(t,r,i){r=iN(r,t);var n=null==(t=nT(t,r))?t:t[nU(nZ(r))];return null==n?e:ts(n,t,i)}function r2(e){return sG(e)&&rZ(e)==l}function r5(t,r,i,n,s){return t===r||(null!=t&&null!=r&&(sG(t)||sG(r))?function(t,r,i,n,s,o){var a=sj(t),p=sj(r),f=a?c:nw(t),y=p?c:nw(r);f=f==l?w:f,y=y==l?w:y;var _=f==w,S=y==w,I=f==y;if(I&&sW(t)){if(!sW(r))return!1;a=!0,_=!1}if(I&&!_)return o||(o=new r_),a||s3(t)?nn(t,r,i,n,s,o):function(e,t,r,i,n,s,o){switch(r){case k:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case E:return!(e.byteLength!=t.byteLength||!s(new eW(e),new eW(t)));case u:case h:case m:return sN(+e,+t);case d:return e.name==t.name&&e.message==t.message;case v:case C:return e==t+"";case g:var a=tM;case b:var l=1&i;if(a||(a=tB),e.size!=t.size&&!l)break;var c=o.get(e);if(c)return c==t;i|=2,o.set(e,t);var p=nn(a(e),a(t),i,n,s,o);return o.delete(e),p;case x:if(rd)return rd.call(e)==rd.call(t)}return!1}(t,r,f,i,n,s,o);if(!(1&i)){var A=_&&eO.call(t,"__wrapped__"),T=S&&eO.call(r,"__wrapped__");
5025if(A||T){var P=A?t.value():t,R=T?r.value():r;return o||(o=new r_),s(P,R,i,n,o)}}return!!I&&(o||(o=new r_),function(t,r,i,n,s,o){var a=1&i,l=no(t),c=l.length;if(c!=no(r).length&&!a)return!1;for(var u=c;u--;){var h=l[u];if(!(a?h in r:eO.call(r,h)))return!1}var d=o.get(t),p=o.get(r);if(d&&p)return d==r&&p==t;var f=!0;o.set(t,r),o.set(r,t);for(var g=a;++u<c;){var m=t[h=l[u]],w=r[h];if(n)var y=a?n(w,m,h,r,t,o):n(m,w,h,t,r,o);if(!(y===e?m===w||s(m,w,i,n,o):y)){f=!1;break}g||(g="constructor"==h)}if(f&&!g){var v=t.constructor,b=r.constructor;v!=b&&"constructor"in t&&"constructor"in r&&!("function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b)&&(f=!1)}return o.delete(t),o.delete(r),f}(t,r,i,n,s,o))}(t,r,i,n,r5,s):t!=t&&r!=r)}function r4(t,r,i,n){var s=i.length,o=s,a=!n;if(null==t)return!o;for(t=e_(t);s--;){var l=i[s];if(a&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<o;){var c=(l=i[s])[0],u=t[c],h=l[1];if(a&&l[2]){if(u===e&&!(c in t))return!1}else{var d=new r_;if(n)var p=n(u,h,c,t,r,d);if(!(p===e?r5(h,u,3,n,d):p))return!1}}return!0}function r6(e){var t;return!(!sF(e)||(t=e,e$&&e$ in t))&&(sH(e)?eU:el).test(nM(e))}function r8(e){return"function"==typeof e?e:null==e?oq:"object"==typeof e?sj(e)?ir(e[0],e[1]):it(e):oY(e)}function r9(e){if(!nS(e))return t1(e);var t=[];for(var r in e_(e))eO.call(e,r)&&"constructor"!=r&&t.push(r);return t}function r7(e,t){return e<t}function ie(e,t){var r=-1,i=sM(e)?ey(e.length):[];return rU(e,function(e,n,s){i[++r]=t(e,n,s)}),i}function it(e){var t=np(e);return 1==t.length&&t[0][2]?nI(t[0][0],t[0][1]):function(r){return r===e||r4(r,e,t)}}function ir(t,r){var i;return n_(t)&&(i=r)==i&&!sF(i)?nI(nU(t),r):function(i){var n=oc(i,t);return n===e&&n===r?ou(i,t):r5(r,n,3)}}function ii(t,r,i,n,s){t!==r&&rH(r,function(o,a){if(s||(s=new r_),sF(o))!function(t,r,i,n,s,o,a){var l=nP(t,i),c=nP(r,i),u=a.get(c);if(u)return rS(t,i,u);var h=o?o(l,c,i+"",t,r,a):e,d=h===e;if(d){var p=sj(c),f=!p&&sW(c),g=!p&&!f&&s3(c);h=c,p||f||g?sj(l)?h=l:sq(l)?h=iB(l):f?(d=!1,h=iL(c,!0)):g?(d=!1,h=iU(c,!0)):h=[]:sZ(c)||sL(c)?(h=l,sL(l)?h=oe(l):(!sF(l)||sH(l))&&(h=nv(c))):d=!1}d&&(a.set(c,h),s(h,c,n,o,a),a.delete(c)),rS(t,i,h)}(t,r,a,i,ii,n,s);else{var l=n?n(nP(t,a),o,a+"",t,r,s):e;l===e&&(l=o),rS(t,a,l)}},og)}function is(t,r){var i=t.length;if(i)return nC(r+=r<0?i:0,i)?t[r]:e}function io(e,t,r){t=t.length?td(t,function(e){return sj(e)?function(t){return rY(t,1===e.length?e[0]:e)}:e}):[oq];var i=-1;t=td(t,tP(nh()));var n=ie(e,function(e,r,n){return{criteria:td(t,function(t){return t(e)}),index:++i,value:e}}),s=n.length;for(n.sort(function(e,t){return function(e,t,r){for(var i=-1,n=e.criteria,s=t.criteria,o=n.length,a=r.length;++i<o;){var l=iM(n[i],s[i]);if(l){if(i>=a)return l;return l*("desc"==r[i]?-1:1)}}return e.index-t.index}(e,t,r)});s--;)n[s]=n[s].value;return n}function ia(e,t,r){for(var i=-1,n=t.length,s={};++i<n;){var o=t[i],a=rY(e,o);r(a,o)&&ip(s,iN(o,e),a)}return s}function il(e,t,r,i){var n=i?tC:tb,s=-1,o=t.length,a=e;for(e===t&&(t=iB(t)),r&&(a=td(e,tP(r)));++s<o;)for(var l=0,c=t[s],u=r?r(c):c;(l=n(a,u,l,i))>-1;)a!==e&&e3.call(a,l,1),e3.call(e,l,1);return e}function ic(e,t){for(var r=e?t.length:0,i=r-1;r--;){var n=t[r];if(r==i||n!==s){var s=n;nC(n)?e3.call(e,n,1):ik(e,n)}}return e}function iu(e,t){return e+tJ(t6()*(t-e+1))}function ih(e,t){var r="";if(!e||t<1||t>0x1fffffffffffff)return r;do t%2&&(r+=e),(t=tJ(t/2))&&(e+=e);while(t)return r}function id(e,t){return nN(nA(e,t,oq),e+"")}function ip(t,r,i,n){if(!sF(t))return t;r=iN(r,t);for(var s=-1,o=r.length,a=o-1,l=t;null!=l&&++s<o;){var c=nU(r[s]),u=i;if("__proto__"===c||"constructor"===c||"prototype"===c)break;if(s!=a){var h=l[c];(u=n?n(h,c,l):e)===e&&(u=sF(h)?h:nC(r[s+1])?[]:{})}rI(l,c,u),l=l[c]}return t}var ig=rn?function(e,t){return rn.set(e,t),e}:oq,im=e9?function(e,t){return e9(e,"toString",{configurable:!0,enumerable:!1,value:oj(t),writable:!0})}:oq;function iw(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var s=ey(n);++i<n;)s[i]=e[i+t];return s}function iy(e,t){var r;return rU(e,function(e,i,n){return!(r=t(e,i,n))}),!!r}function iv(e,t,r){var i=0,n=null==e?i:e.length;if("number"==typeof t&&t==t&&n<=0x7fffffff){for(;i<n;){var s=i+n>>>1,o=e[s];null!==o&&!s1(o)&&(r?o<=t:o<t)?i=s+1:n=s}return n}return ib(e,t,oq,r)}function ib(t,r,i,n){var s=0,o=null==t?0:t.length;if(0===o)return 0;r=i(r);for(var a=r!=r,l=null===r,c=s1(r),u=r===e;s<o;
vendor: 6,877 bytes, line 5025
5025){var h=tJ((s+o)/2),d=i(t[h]),p=d!==e,f=null===d,g=d==d,m=s1(d);if(a)var w=n||g;else w=u?g&&(n||p):l?g&&p&&(n||!f):c?g&&p&&!f&&(n||!m):!f&&!m&&(n?d<=r:d<r);w?s=h+1:o=h}return t2(o,0xfffffffe)}function iC(e,t){for(var r=-1,i=e.length,n=0,s=[];++r<i;){var o=e[r],a=t?t(o):o;if(!r||!sN(a,l)){var l=a;s[n++]=0===o?0:o}}return s}function ix(e){return"number"==typeof e?e:s1(e)?s:+e}function i_(e){if("string"==typeof e)return e;if(sj(e))return td(e,i_)+"";if(s1(e))return rp?rp.call(e):"";var t=e+"";return"0"==t&&1/e==-n?"-0":t}function iE(e,t,r){var i=-1,n=tu,s=e.length,o=!0,a=[],l=a;if(r)o=!1,n=th;else if(s>=200){var c=t?null:i9(e);if(c)return tB(c);o=!1,n=tO,l=new rx}else l=t?[]:a;t:for(;++i<s;){var u=e[i],h=t?t(u):u;if(u=r||0!==u?u:0,o&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue t;t&&l.push(h),a.push(u)}else n(l,h,r)||(l!==a&&l.push(h),a.push(u))}return a}function ik(e,t){return t=iN(t,e),null==(e=nT(e,t))||delete e[nU(nZ(t))]}function iS(e,t,r,i){return ip(e,t,r(rY(e,t)),i)}function iI(e,t,r,i){for(var n=e.length,s=i?n:-1;(i?s--:++s<n)&&t(e[s],s,e););return r?iw(e,i?0:s,i?s+1:n):iw(e,i?s+1:0,i?n:s)}function iA(e,t){var r=e;return r instanceof ry&&(r=r.value()),tf(t,function(e,t){return t.func.apply(t.thisArg,tp([e],t.args))},r)}function iT(e,t,r){var i=e.length;if(i<2)return i?iE(e[0]):[];for(var n=-1,s=ey(i);++n<i;)for(var o=e[n],a=-1;++a<i;)a!=n&&(s[n]=rj(s[n]||o,e[a],t,r));return iE(rz(s,1),t,r)}function iP(t,r,i){for(var n=-1,s=t.length,o=r.length,a={};++n<s;){var l=n<o?r[n]:e;i(a,t[n],l)}return a}function iR(e){return sq(e)?e:[]}function iO(e){return"function"==typeof e?e:oq}function iN(e,t){return sj(e)?e:n_(e,t)?[e]:nj(ot(e))}function i$(t,r,i){var n=t.length;return i=i===e?n:i,!r&&i>=n?t:iw(t,r,i)}var iD=tw||function(e){return e2.clearTimeout(e)};function iL(e,t){if(t)return e.slice();var r=e.length,i=eH?eH(r):new e.constructor(r);return e.copy(i),i}function ij(e){var t=new e.constructor(e.byteLength);return new eW(t).set(new eW(e)),t}function iU(e,t){var r=t?ij(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function iM(t,r){if(t!==r){var i=t!==e,n=null===t,s=t==t,o=s1(t),a=r!==e,l=null===r,c=r==r,u=s1(r);if(!l&&!u&&!o&&t>r||o&&a&&c&&!l&&!u||n&&a&&c||!i&&c||!s)return 1;if(!n&&!o&&!u&&t<r||u&&i&&s&&!n&&!o||l&&i&&s||!a&&s||!c)return -1}return 0}function iq(e,t,r,i){for(var n=-1,s=e.length,o=r.length,a=-1,l=t.length,c=t3(s-o,0),u=ey(l+c),h=!i;++a<l;)u[a]=t[a];for(;++n<o;)(h||n<s)&&(u[r[n]]=e[n]);for(;c--;)u[a++]=e[n++];return u}function iW(e,t,r,i){for(var n=-1,s=e.length,o=-1,a=r.length,l=-1,c=t.length,u=t3(s-a,0),h=ey(u+c),d=!i;++n<u;)h[n]=e[n];for(var p=n;++l<c;)h[p+l]=t[l];for(;++o<a;)(d||n<s)&&(h[p+r[o]]=e[n++]);return h}function iB(e,t){var r=-1,i=e.length;for(t||(t=ey(i));++r<i;)t[r]=e[r];return t}function iz(t,r,i,n){var s=!i;i||(i={});for(var o=-1,a=r.length;++o<a;){var l=r[o],c=n?n(i[l],t[l],l,i,t):e;c===e&&(c=t[l]),s?rR(i,l,c):rI(i,l,c)}return i}function iH(e,t){return function(r,i){var n=sj(r)?to:rT,s=t?t():{};return n(r,e,nh(i,2),s)}}function iK(t){return id(function(r,i){var n=-1,s=i.length,o=s>1?i[s-1]:e,a=s>2?i[2]:e;for(o=t.length>3&&"function"==typeof o?(s--,o):e,a&&nx(i[0],i[1],a)&&(o=s<3?e:o,s=1),r=e_(r);++n<s;){var l=i[n];l&&t(r,l,n,o)}return r})}function iV(e,t){return function(r,i){if(null==r)return r;if(!sM(r))return e(r,i);for(var n=r.length,s=t?n:-1,o=e_(r);(t?s--:++s<n)&&!1!==i(o[s],s,o););return r}}function iF(e){return function(t,r,i){for(var n=-1,s=e_(t),o=i(t),a=o.length;a--;){var l=o[e?a:++n];if(!1===r(s[l],l,s))break}return t}}function iG(t){return function(r){var i=tU(r=ot(r))?tH(r):e,n=i?i[0]:r.charAt(0),s=i?i$(i,1).join(""):r.slice(1);return n[t]()+s}}function iY(e){return function(t){return tf(o$(oS(t).replace(eB,"")),e,"")}}function iJ(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=rg(e.prototype),i=e.apply(r,t);return sF(i)?i:r}}function iZ(t){return function(r,i,n){var s=e_(r);if(!sM(r)){var o=nh(i,3);r=of(r),i=function(e){return o(s[e],e,s)}}var a=t(r,i,n);return a>-1?s[o?r[a]:a]:e}}function iQ(r){return ns(function(i){var n=i.length,s=n,o=rw.prototype.thru;for(r&&i.reverse();s--;){var a=i[s];if("function"!=typeof a)throw new eS(t);if(o&&!l&&"wrapper"==nc(a))var l=new rw([],!0)}for(s=l?s:n;++s<n;){var c=nc(a=i[s]),u="wrapper"==c?nl(a):e;l=u&&nE(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[nc(u[0])].apply(l,u[3]):1==a.length&&nE(a)?l[c]():l.thru(a)}return function(){var e=arguments,t=e[0];if(l&&1==e.length&&sj(t))return l.plant(t).value();for(var r=0,s=n?i[r].apply(this,e):t;++r<n;)s=i[r].call(this,s);return s}})}function iX(t,r,i,n,s,o,a,l,c,u){var h=128&r,d=1&r,p=2&r,f=24&r,g=512&r,m=p?e:iJ(t);function w(){for(var y=arguments.length,v=ey(y),b=y;b--;)v[b]=arguments[b];if(f)var C=nu(w),x=function(e,t){for(var r=e.length,i=0;r--;)e[r]===t&&++i;return i}(v,C);if(n&&(v=iq(v,n,s,f)),o&&(v=iW(v,o,a,f)),y-=x,f&&y<u){var _=tW(v,C);return i6(t,r,iX,w.placeholder,i,v,_,l,c,u-y)}var E=d?i:this,k=p?E[t]:t;return y=v.length,l?v=function(t,r){for(var i=t.length,n=t2(r.length,i),s=iB(t);n--;){var o=r[n];t[n]=nC(o,i)?s[o]:e}return t}(v,l):g&&y>1&&v.reverse(),h&&c<y&&(v.length=c),this&&this!==e2&&this instanceof w&&(k=m||iJ(k)),k.apply(E,v)}return w}function i0(e,t){return function(r,i){var n,s;return n=t(i),s={},rV(r,function(t,r,i){e(s,n(t),r,i)}),s}}function i1(t,r){return function(i,n){var s;if(i===e&&n===e)return r;if(i!==e&&(s=i),n!==e){if(s===e)return n;"string"==typeof i||"string"==typeof n?(i=i_(i),n=i_(n)):(i=ix(i),n=ix(n)),s=t(i,n)}return s}}function i3(e){return ns(function(t){return t=td(t,tP(nh())),id(function(r){var i=this;return e(t,function(e){return ts(e,i,r)})})})}function i2(t,r){var i=(r=r===e?" ":i_(r)).length;if(i<2)return i?ih(r,t):r;var n=ih(r,tY(t/tz(r)));return tU(r)?i$(tH(n),0,t).join(""):n.slice(0,t)}function i5(t){return function(r,i,n){return n&&"number"!=typeof n&&nx(r,i,n)&&(i=n=e),r=s6(r),i===e?(i=r,r=0):i=s6(i),n=n===e?r<i?1:-1:s6(n),function(e,t,r,i){for(var n=-1,s=t3(tY((t-e)/(r||1)),0),o=ey(s);s--;)o[i?s:++n]=e,e+=r;return o}(r,i,n,t)}}function i4(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=s7(t),r=s7(r)),e(t,r)}}function i6(t,r,i,n,s,o,a,l,c,u){var h=8&r,d=h?a:e,p=h?e:a,f=h?o:e,g=h?e:o;r|=h?32:64,4&(r&=~(h?64:32))||(r&=-4);var m=[t,r,s,f,d,g,p,l,c,u],w=i.apply(e,m);return nE(t)&&nR(w,m),w.placeholder=n,n$(w,t,r)}function i8(e){var t=ex[e];return function(e,r){if(e=s7(e),(r=null==r?0:t2(s8(r),292))&&tX(e)){var i=(ot(e)+"e").split("e");return+((i=(ot(t(i[0]+"e"+(+i[1]+r)))+"e").split("e"))[0]+"e"+(i[1]-r))}return t(e)}}
5025var i9=rt&&1/tB(new rt([,-0]))[1]==n?function(e){return new rt(e)}:oK;function i7(e){return function(t){var r,i,n=nw(t);return n==g?tM(t):n==b?(r=-1,i=Array(t.size),t.forEach(function(e){i[++r]=[e,e]}),i):td(e(t),function(e){return[e,t[e]]})}}function ne(r,n,s,o,a,l,c,u){var h=2&n;if(!h&&"function"!=typeof r)throw new eS(t);var d=o?o.length:0;if(d||(n&=-97,o=a=e),c=c===e?c:t3(s8(c),0),u=u===e?u:s8(u),d-=a?a.length:0,64&n){var p=o,f=a;o=a=e}var g=h?e:nl(r),m=[r,n,s,o,a,p,f,l,c,u];if(g&&function(e,t){var r=e[1],n=t[1],s=r|n,o=s<131,a=128==n&&8==r||128==n&&256==r&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(o||a){1&n&&(e[2]=t[2],s|=1&r?0:4);var l=t[3];if(l){var c=e[3];e[3]=c?iq(c,l,t[4]):l,e[4]=c?tW(e[3],i):t[4]}(l=t[5])&&(c=e[5],e[5]=c?iW(c,l,t[6]):l,e[6]=c?tW(e[5],i):t[6]),(l=t[7])&&(e[7]=l),128&n&&(e[8]=null==e[8]?t[8]:t2(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=s}}(m,g),r=m[0],n=m[1],s=m[2],o=m[3],a=m[4],(u=m[9]=m[9]===e?h?0:r.length:t3(m[9]-d,0))||!(24&n)||(n&=-25),n&&1!=n)8==n||16==n?A=function(t,r,i){var n=iJ(t);function s(){for(var o=arguments.length,a=ey(o),l=o,c=nu(s);l--;)a[l]=arguments[l];var u=o<3&&a[0]!==c&&a[o-1]!==c?[]:tW(a,c);return(o-=u.length)<i?i6(t,r,iX,s.placeholder,e,a,u,e,e,i-o):ts(this&&this!==e2&&this instanceof s?n:t,this,a)}return s}(r,n,u):32!=n&&33!=n||a.length?A=iX.apply(e,m):(w=r,y=n,v=s,b=o,C=1&y,x=iJ(w),A=function e(){for(var t=-1,r=arguments.length,i=-1,n=b.length,s=ey(n+r),o=this&&this!==e2&&this instanceof e?x:w;++i<n;)s[i]=b[i];for(;r--;)s[i++]=arguments[++t];return ts(o,C?v:this,s)});else var w,y,v,b,C,x,_,E,k,S,I,A=(_=r,E=n,k=s,S=1&E,I=iJ(_),function e(){return(this&&this!==e2&&this instanceof e?I:_).apply(S?k:this,arguments)});return n$((g?ig:nR)(A,m),r,n)}function nt(t,r,i,n){return t===e||sN(t,eT[i])&&!eO.call(n,i)?r:t}function nr(t,r,i,n,s,o){return sF(t)&&sF(r)&&(o.set(r,t),ii(t,r,e,nr,o),o.delete(r)),t}function ni(t){return sZ(t)?e:t}function nn(t,r,i,n,s,o){var a=1&i,l=t.length,c=r.length;if(l!=c&&!(a&&c>l))return!1;var u=o.get(t),h=o.get(r);if(u&&h)return u==r&&h==t;var d=-1,p=!0,f=2&i?new rx:e;for(o.set(t,r),o.set(r,t);++d<l;){var g=t[d],m=r[d];if(n)var w=a?n(m,g,d,r,t,o):n(g,m,d,t,r,o);if(w!==e){if(w)continue;p=!1;break}if(f){if(!tm(r,function(e,t){if(!tO(f,t)&&(g===e||s(g,e,i,n,o)))return f.push(t)})){p=!1;break}}else if(!(g===m||s(g,m,i,n,o))){p=!1;break}}return o.delete(t),o.delete(r),p}function ns(t){return nN(nA(t,e,nV),t+"")}function no(e){return rJ(e,of,ng)}function na(e){return rJ(e,og,nm)}var nl=rn?function(e){return rn.get(e)}:oK;function nc(e){for(var t=e.name+"",r=rs[t],i=eO.call(rs,t)?r.length:0;i--;){var n=r[i],s=n.func;if(null==s||s==e)return n.name}return t}function nu(e){return(eO.call(rf,"placeholder")?rf:e).placeholder}function nh(){var e=rf.iteratee||oW;return e=e===oW?r8:e,arguments.length?e(arguments[0],arguments[1]):e}function nd(e,t){var r,i,n=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function np(e){for(var t=of(e),r=t.length;r--;){var i,n=t[r],s=e[n];t[r]=[n,s,(i=s)==i&&!sF(i)]}return t}function nf(t,r){var i=null==t?e:t[r];return r6(i)?i:e}var ng=tZ?function(e){return null==e?[]:tc(tZ(e=e_(e)),function(t){return e1.call(e,t)})}:oQ,nm=tZ?function(e){for(var t=[];e;)tp(t,ng(e)),e=eV(e);return t}:oQ,nw=rZ;function ny(e,t,r){t=iN(t,e);for(var i=-1,n=t.length,s=!1;++i<n;){var o=nU(t[i]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++i!=n?s:!!(n=null==e?0:e.length)&&sV(n)&&nC(o,n)&&(sj(e)||sL(e))}function nv(e){return"function"!=typeof e.constructor||nS(e)?{}:rg(eV(e))}function nb(e){return sj(e)||sL(e)||!!(e5&&e&&e[e5])}function nC(e,t){var r=typeof e;return!!(t=t??0x1fffffffffffff)&&("number"==r||"symbol"!=r&&eu.test(e))&&e>-1&&e%1==0&&e<t}function nx(e,t,r){if(!sF(r))return!1;var i=typeof t;return("number"==i?!!(sM(r)&&nC(t,r.length)):"string"==i&&t in r)&&sN(r[t],e)}function n_(e,t){if(sj(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||s1(e))||V.test(e)||!K.test(e)||null!=t&&e in e_(t)}function nE(e){var t=nc(e),r=rf[t];if("function"!=typeof r||!(t in ry.prototype))return!1;if(e===r)return!0;var i=nl(r);return!!i&&e===i[0]}(t9&&nw(new t9(new ArrayBuffer(1)))!=k||t7&&nw(new t7)!=g||re&&nw(re.resolve())!=y||rt&&nw(new rt)!=b||rr&&nw(new rr)!=_)&&(nw=function(t){var r=rZ(t),i=r==w?t.constructor:e,n=i?nM(i):"";if(n)switch(n){case ro:return k;case ra:return g;case rl:return y;case rc:return b;case ru:return _}return r});var nk=eP?sH:oX;function nS(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||eT)}function nI(t,r){return function(i){return null!=i&&i[t]===r&&(r!==e||t in e_(i))}}function nA(t,r,i){return r=t3(r===e?t.length-1:r,0),function(){for(var e=arguments,n=-1,s=t3(e.length-r,0),o=ey(s);++n<s;)o[n]=e[r+n];n=-1;for(var a=ey(r+1);++n<r;)a[n]=e[n];return a[r]=i(o),ts(t,this,a)}}function nT(e,t){return t.length<2?e:rY(e,iw(t,0,-1))}function nP(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var nR=nD(ig),nO=tG||function(e,t){return e2.setTimeout(e,t)},nN=nD(im);function n$(e,t,r){var i,n,s,o=t+"";return nN(e,function(e,t){var r=t.length;if(!r)return e;var i=r-1;return t[i]=(r>1?"& ":"")+t[i],t=t.join(r>2?", ":" "),e.replace(Q,`{
5026/* [wrapped with `+t+`] */
5027`)}(o,(i=(s=o.match(X))?s[1].split(ee):[],n=r,ta(a,function(e){var t="_."+e[0];n&e[1]&&!tu(i,t)&&i.push(t)}),i.sort())))}function nD(t){var r=0,i=0;return function(){var n=t5(),s=16-(n-i);if(i=n,s>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(e,arguments)}}function nL(t,r){var i=-1,n=t.length,s=n-1;for(r=r===e?n:r;++i<r;){var o=iu(i,s),a=t[o];t[o]=t[i],t[i]=a}return t.length=r,t}var nj=(em=(eg=sI(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(F,function(e,r,i,n){t.push(i?n.replace(ei,"$1"):r||e)}),t},function(e){return 500===em.size&&em.clear(),e})).cache,eg);function nU(e){if("string"==typeof e||s1(e))return e;var t=e+"";return"0"==t&&1/e==-n?"-0":t}function nM(e){if(null!=e){try{return eR.call(e)}catch{}try{return e+""}catch{}}return""}function nq(e){if(e instanceof ry)return e.clone();var t=new rw(e.__wrapped__,e.__chain__);return t.__actions__=iB(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var nW=id(function(e,t){return sq(e)?rj(e,rz(t,1,sq,!0)):[]}),nB=id(function(t,r){var i=nZ(r);return sq(i)&&(i=e),sq(t)?rj(t,rz(r,1,sq,!0),nh(i,2)):[]}),nz=id(function(t,r){var i=nZ(r);return sq(i)&&(i=e),sq(t)?rj(t,rz(r,1,sq,!0),e,i):[]});function nH(e,t,r){var i=null==e?0:e.length;if(!i)return -1;var n=null==r?0:s8(r);return n<0&&(n=t3(i+n,0)),tv(e,nh(t,3),n)}function nK(t,r,i){var n=null==t?0:t.length;if(!n)return -1;var s=n-1;return i!==e&&(s=s8(i),s=i<0?t3(n+s,0):t2(s,n-1)),tv(t,nh(r,3),s,!0)}function nV(e){return(null==e?0:e.length)?rz(e,1):[]}function nF(t){return t&&t.length?t[0]:e}var nG=id(function(e){var t=td(e,iR);return t.length&&t[0]===e[0]?r1(t):[]}),nY=id(function(t){var r=nZ(t),i=td(t,iR);return r===nZ(i)?r=e:i.pop(),i.length&&i[0]===t[0]?r1(i,nh(r,2)):[]}),nJ=id(function(t){var r=nZ(t),i=td(t,iR);return(r="function"==typeof r?r:e)&&i.pop(),i.length&&i[0]===t[0]?r1(i,e,r):[]});function nZ(t){var r=null==t?0:t.length;
vendor: 11,194 bytes, line 5027
5027return r?t[r-1]:e}var nQ=id(nX);function nX(e,t){return e&&e.length&&t&&t.length?il(e,t):e}var n0=ns(function(e,t){var r=null==e?0:e.length,i=rO(e,t);return ic(e,td(t,function(e){return nC(e,r)?+e:e}).sort(iM)),i});function n1(e){return null==e?e:t8.call(e)}var n3=id(function(e){return iE(rz(e,1,sq,!0))}),n2=id(function(t){var r=nZ(t);return sq(r)&&(r=e),iE(rz(t,1,sq,!0),nh(r,2))}),n5=id(function(t){var r=nZ(t);return r="function"==typeof r?r:e,iE(rz(t,1,sq,!0),e,r)});function n4(e){if(!(e&&e.length))return[];var t=0;return e=tc(e,function(e){if(sq(e))return t=t3(e.length,t),!0}),tA(t,function(t){return td(e,tE(t))})}function n6(t,r){if(!(t&&t.length))return[];var i=n4(t);return null==r?i:td(i,function(t){return ts(r,e,t)})}var n8=id(function(e,t){return sq(e)?rj(e,t):[]}),n9=id(function(e){return iT(tc(e,sq))}),n7=id(function(t){var r=nZ(t);return sq(r)&&(r=e),iT(tc(t,sq),nh(r,2))}),se=id(function(t){var r=nZ(t);return r="function"==typeof r?r:e,iT(tc(t,sq),e,r)}),st=id(n4),sr=id(function(t){var r=t.length,i=r>1?t[r-1]:e;return i="function"==typeof i?(t.pop(),i):e,n6(t,i)});function si(e){var t=rf(e);return t.__chain__=!0,t}function sn(e,t){return t(e)}var ss=ns(function(t){var r=t.length,i=r?t[0]:0,n=this.__wrapped__,s=function(e){return rO(e,t)};return!(r>1)&&!this.__actions__.length&&n instanceof ry&&nC(i)?((n=n.slice(i,+i+ +!!r)).__actions__.push({func:sn,args:[s],thisArg:e}),new rw(n,this.__chain__).thru(function(t){return r&&!t.length&&t.push(e),t})):this.thru(s)}),so=iH(function(e,t,r){eO.call(e,r)?++e[r]:rR(e,r,1)}),sa=iZ(nH),sl=iZ(nK);function sc(e,t){return(sj(e)?ta:rU)(e,nh(t,3))}function su(e,t){return(sj(e)?function(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}:rM)(e,nh(t,3))}var sh=iH(function(e,t,r){eO.call(e,r)?e[r].push(t):rR(e,r,[t])}),sd=id(function(e,t,r){var i=-1,n="function"==typeof t,s=sM(e)?ey(e.length):[];return rU(e,function(e){s[++i]=n?ts(t,e,r):r3(e,t,r)}),s}),sp=iH(function(e,t,r){rR(e,r,t)});function sf(e,t){return(sj(e)?td:ie)(e,nh(t,3))}var sg=iH(function(e,t,r){e[+!r].push(t)},function(){return[[],[]]}),sm=id(function(e,t){if(null==e)return[];var r=t.length;return r>1&&nx(e,t[0],t[1])?t=[]:r>2&&nx(t[0],t[1],t[2])&&(t=[t[0]]),io(e,rz(t,1),[])}),sw=tk||function(){return e2.Date.now()};function sy(t,r,i){return r=i?e:r,r=t&&null==r?t.length:r,ne(t,128,e,e,e,e,r)}function sv(r,i){var n;if("function"!=typeof i)throw new eS(t);return r=s8(r),function(){return--r>0&&(n=i.apply(this,arguments)),r<=1&&(i=e),n}}var sb=id(function(e,t,r){var i=1;if(r.length){var n=tW(r,nu(sb));i|=32}return ne(e,i,t,r,n)}),sC=id(function(e,t,r){var i=3;if(r.length){var n=tW(r,nu(sC));i|=32}return ne(t,i,e,r,n)});function sx(t,r,i){r=i?e:r;var n=ne(t,8,e,e,e,e,e,r);return n.placeholder=sx.placeholder,n}function s_(t,r,i){r=i?e:r;var n=ne(t,16,e,e,e,e,e,r);return n.placeholder=s_.placeholder,n}function sE(r,i,n){var s,o,a,l,c,u,h=0,d=!1,p=!1,f=!0;if("function"!=typeof r)throw new eS(t);function g(t){var i=s,n=o;return s=o=e,h=t,l=r.apply(n,i)}function m(t){var r=t-u,n=t-h;return u===e||r>=i||r<0||p&&n>=a}function w(){var e,t,r,n=sw();if(m(n))return y(n);c=nO(w,(e=n-u,t=n-h,r=i-e,p?t2(r,a-t):r))}function y(t){return c=e,f&&s?g(t):(s=o=e,l)}function v(){var t,r=sw(),n=m(r);if(s=arguments,o=this,u=r,n){if(c===e)return h=t=u,c=nO(w,i),d?g(t):l;if(p)return iD(c),c=nO(w,i),g(u)}return c===e&&(c=nO(w,i)),l}return i=s7(i)||0,sF(n)&&(d=!!n.leading,a=(p="maxWait"in n)?t3(s7(n.maxWait)||0,i):a,f="trailing"in n?!!n.trailing:f),v.cancel=function(){c!==e&&iD(c),h=0,s=u=o=c=e},v.flush=function(){return c===e?l:y(sw())},v}var sk=id(function(e,t){return rL(e,1,t)}),sS=id(function(e,t,r){return rL(e,s7(t)||0,r)});function sI(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new eS(t);var i=function(){var t=arguments,n=r?r.apply(this,t):t[0],s=i.cache;if(s.has(n))return s.get(n);var o=e.apply(this,t);return i.cache=s.set(n,o)||s,o};return i.cache=new(sI.Cache||rC),i}function sA(e){if("function"!=typeof e)throw new eS(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)}}sI.Cache=rC;var sT=id(function(e,t){var r=(t=1==t.length&&sj(t[0])?td(t[0],tP(nh())):td(rz(t,1),tP(nh()))).length;return id(function(i){for(var n=-1,s=t2(i.length,r);++n<s;)i[n]=t[n].call(this,i[n]);return ts(e,this,i)})}),sP=id(function(t,r){var i=tW(r,nu(sP));return ne(t,32,e,r,i)}),sR=id(function(t,r){var i=tW(r,nu(sR));return ne(t,64,e,r,i)}),sO=ns(function(t,r){return ne(t,256,e,e,e,r)});function sN(e,t){return e===t||e!=e&&t!=t}var s$=i4(rQ),sD=i4(function(e,t){return e>=t}),sL=r2(function(){return arguments}())?r2:function(e){return sG(e)&&eO.call(e,"callee")&&!e1.call(e,"callee")},sj=ey.isArray,sU=e7?tP(e7):function(e){return sG(e)&&rZ(e)==E};function sM(e){return null!=e&&sV(e.length)&&!sH(e)}function sq(e){return sG(e)&&sM(e)}var sW=tQ||oX,sB=te?tP(te):function(e){return sG(e)&&rZ(e)==h};function sz(e){if(!sG(e))return!1;var t=rZ(e);return t==d||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!sZ(e)}function sH(e){if(!sF(e))return!1;var t=rZ(e);return t==p||t==f||"[object AsyncFunction]"==t||"[object Proxy]"==t}function sK(e){return"number"==typeof e&&e==s8(e)}function sV(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff}function sF(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function sG(e){return null!=e&&"object"==typeof e}var sY=tt?tP(tt):function(e){return sG(e)&&nw(e)==g};function sJ(e){return"number"==typeof e||sG(e)&&rZ(e)==m}function sZ(e){if(!sG(e)||rZ(e)!=w)return!1;var t=eV(e);if(null===t)return!0;var r=eO.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&eR.call(r)==eL}var sQ=tr?tP(tr):function(e){return sG(e)&&rZ(e)==v},sX=ti?tP(ti):function(e){return sG(e)&&nw(e)==b};function s0(e){return"string"==typeof e||!sj(e)&&sG(e)&&rZ(e)==C}function s1(e){return"symbol"==typeof e||sG(e)&&rZ(e)==x}var s3=tn?tP(tn):function(e){return sG(e)&&sV(e.length)&&!!eJ[rZ(e)]},s2=i4(r7),s5=i4(function(e,t){return e<=t});function s4(e){if(!e)return[];if(sM(e))return s0(e)?tH(e):iB(e);if(e4&&e[e4]){for(var t,r=e[e4](),i=[];!(t=r.next()).done;)i.push(t.value);return i}var n=nw(e);return(n==g?tM:n==b?tB:o_)(e)}function s6(e){return e?(e=s7(e))===n||e===-n?(e<0?-1:1)*17976931348623157e292:e==e?e:0:0===e?e:0}function s8(e){var t=s6(e),r=t%1;return t==t?r?t-r:t:0}function s9(e){return e?rN(s8(e),0,0xffffffff):0}function s7(e){if("number"==typeof e)return e;if(s1(e))return s;if(sF(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=sF(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=tT(e);var r=ea.test(e);return r||ec.test(e)?e0(e.slice(2),r?2:8):eo.test(e)?s:+e}function oe(e){return iz(e,og(e))}function ot(e){return null==e?"":i_(e)}var or=iK(function(e,t){if(nS(t)||sM(t))return void iz(t,of(t),e);for(var r in t)eO.call(t,r)&&rI(e,r,t[r])}),oi=iK(function(e,t){iz(t,og(t),e)}),on=iK(function(e,t,r,i){iz(t,og(t),e,i)}),os=iK(function(e,t,r,i){iz(t,of(t),e,i)}),oo=ns(rO),oa=id(function(t,r){t=e_(t);var i=-1,n=r.length,s=n>2?r[2]:e;for(s&&nx(r[0],r[1],s)&&(n=1);++i<n;)for(var o=r[i],a=og(o),l=-1,c=a.length;++l<c;){var u=a[l],h=t[u];(h===e||sN(h,eT[u])&&!eO.call(t,u))&&(t[u]=o[u])}return t}),ol=id(function(t){return t.push(e,nr),ts(ow,e,t)});function oc(t,r,i){var n=null==t?e:rY(t,r);return n===e?i:n}function ou(e,t){return null!=e&&ny(e,t,r0)}var oh=i0(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=eD.call(t)),e[t]=r},oj(oq)),od=i0(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=eD.call(t)),eO.call(e,t)?e[t].push(r):e[t]=[r]},nh),op=id(r3);function of(e){return sM(e)?rE(e):r9(e)}function og(e){return sM(e)?rE(e,!0):function(e){if(!sF(e)){var t=e,r=[];if(null!=t)for(var i in e_(t))r.push(i);return r}var n=nS(e),s=[];for(var o in e)"constructor"==o&&(n||!eO.call(e,o))||s.push(o);return s}(e)}var om=iK(function(e,t,r){ii(e,t,r)}),ow=iK(function(e,t,r,i){ii(e,t,r,i)}),oy=ns(function(e,t){var r={};if(null==e)return r;var i=!1;t=td(t,function(t){return t=iN(t,e),i||(i=t.length>1),t}),iz(e,na(e),r),i&&(r=r$(r,7,ni));for(var n=t.length;n--;)ik(r,t[n]);return r}),ov=ns(function(e,t){return null==e?{}:ia(e,t,function(t,r){return ou(e,r)})});function ob(e,t){if(null==e)return{};var r=td(na(e),function(e){return[e]});return t=nh(t),ia(e,r,function(e,r){return t(e,r[0])})}var oC=i7(of),ox=i7(og);function o_(e){return null==e?[]:tR(e,of(e))}var oE=iY(function(e,t,r){return t=t.toLowerCase(),e+(r?ok(t):t)});function ok(e){return oN(ot(e).toLowerCase())}function oS(e){return(e=ot(e))&&e.replace(eh,tD).replace(ez,"")}var oI=iY(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),oA=iY(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),oT=iG("toLowerCase"),oP=iY(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),oR=iY(function(e,t,r){return e+(r?" ":"")+oN(t)}),oO=iY(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),oN=iG("toUpperCase");function o$(t,r,i){var n;return t=ot(t),(r=i?e:r)===e?(n=t,eF.test(n))?t.match(eK)||[]:t.match(et)||[]:t.match(r)||[]}var oD=id(function(t,r){try{return ts(t,e,r)}catch(e){return sz(e)?e:new eb(e)}}),oL=ns(function(e,t){return ta(t,function(t){rR(e,t=nU(t),sb(e[t],e))}),e});function oj(e){return function(){return e}}var oU=iQ(),oM=iQ(!0);function oq(e){return e}function oW(e){return r8("function"==typeof e?e:r$(e,1))}var oB=id(function(e,t){return function(r){return r3(r,e,t)}}),oz=id(function(e,t){return function(r){return r3(e,r,t)}});function oH(e,t,r){var i=of(t),n=rG(t,i);null!=r||sF(t)&&(n.length||!i.length)||(r=t,t=e,e=this,n=rG(t,of(t)));var s=!(sF(r)&&"chain"in r)||!!r.chain,o=sH(e);return ta(n,function(r){var i=t[r];e[r]=i,o&&(e.prototype[r]=function(){var t=this.__chain__;if(s||t){var r=e(this.__wrapped__);return(r.__actions__=iB(this.__actions__)).push({func:i,args:arguments,thisArg:e}),r.__chain__=t,r}return i.apply(e,tp([this.value()],arguments))})}),e}function oK(){}var oV=i3(td),oF=i3(tl),oG=i3(tm);function oY(e){return n_(e)?tE(nU(e)):function(t){return rY(t,e)}}var oJ=i5(),oZ=i5(!0);function oQ(){return[]}function oX(){return!1}var o0=i1(function(e,t){return e+t},0),o1=i8("ceil"),o3=i1(function(e,t){return e/t},1),o2=i8("floor"),o5=i1(function(e,t){return e*t},1),o4=i8("round"),o6=i1(function(e,t){return e-t},0);return rf.after=function(e,r){if("function"!=typeof r)throw new eS(t);return e=s8(e),function(){if(--e<1)return r.apply(this,arguments)}},rf.ary=sy,rf.assign=or,rf.assignIn=oi,rf.assignInWith=on,rf.assignWith=os,rf.at=oo,rf.before=sv,rf.bind=sb,rf.bindAll=oL,rf.bindKey=sC,rf.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return sj(e)?e:[e]},rf.chain=si,rf.chunk=function(t,r,i){r=(i?nx(t,r,i):r===e)?1:t3(s8(r),0);var n=null==t?0:t.length;if(!n||r<1)return[];for(var s=0,o=0,a=ey(tY(n/r));s<n;)a[o++]=iw(t,s,s+=r);return a},rf.compact=function(e){for(var t=-1,r=null==e?0:e.length,i=0,n=[];++t<r;){var s=e[t];s&&(n[i++]=s)}return n},rf.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ey(e-1),r=arguments[0],i=e;i--;)t[i-1]=arguments[i];
5027return tp(sj(r)?iB(r):[r],rz(t,1))},rf.cond=function(e){var r=null==e?0:e.length,i=nh();return e=r?td(e,function(e){if("function"!=typeof e[1])throw new eS(t);return[i(e[0]),e[1]]}):[],id(function(t){for(var i=-1;++i<r;){var n=e[i];if(ts(n[0],this,t))return ts(n[1],this,t)}})},rf.conforms=function(e){var t,r;return r=of(t=r$(e,1)),function(e){return rD(e,t,r)}},rf.constant=oj,rf.countBy=so,rf.create=function(e,t){var r=rg(e);return null==t?r:rP(r,t)},rf.curry=sx,rf.curryRight=s_,rf.debounce=sE,rf.defaults=oa,rf.defaultsDeep=ol,rf.defer=sk,rf.delay=sS,rf.difference=nW,rf.differenceBy=nB,rf.differenceWith=nz,rf.drop=function(t,r,i){var n=null==t?0:t.length;return n?iw(t,(r=i||r===e?1:s8(r))<0?0:r,n):[]},rf.dropRight=function(t,r,i){var n=null==t?0:t.length;return n?iw(t,0,(r=n-(r=i||r===e?1:s8(r)))<0?0:r):[]},rf.dropRightWhile=function(e,t){return e&&e.length?iI(e,nh(t,3),!0,!0):[]},rf.dropWhile=function(e,t){return e&&e.length?iI(e,nh(t,3),!0):[]},rf.fill=function(t,r,i,n){var s=null==t?0:t.length;return s?(i&&"number"!=typeof i&&nx(t,r,i)&&(i=0,n=s),function(t,r,i,n){var s=t.length;for((i=s8(i))<0&&(i=-i>s?0:s+i),(n=n===e||n>s?s:s8(n))<0&&(n+=s),n=i>n?0:s9(n);i<n;)t[i++]=r;return t}(t,r,i,n)):[]},rf.filter=function(e,t){return(sj(e)?tc:rB)(e,nh(t,3))},rf.flatMap=function(e,t){return rz(sf(e,t),1)},rf.flatMapDeep=function(e,t){return rz(sf(e,t),n)},rf.flatMapDepth=function(t,r,i){return i=i===e?1:s8(i),rz(sf(t,r),i)},rf.flatten=nV,rf.flattenDeep=function(e){return(null==e?0:e.length)?rz(e,n):[]},rf.flattenDepth=function(t,r){return(null==t?0:t.length)?rz(t,r=r===e?1:s8(r)):[]},rf.flip=function(e){return ne(e,512)},rf.flow=oU,rf.flowRight=oM,rf.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,i={};++t<r;){var n=e[t];i[n[0]]=n[1]}return i},rf.functions=function(e){return null==e?[]:rG(e,of(e))},rf.functionsIn=function(e){return null==e?[]:rG(e,og(e))},rf.groupBy=sh,rf.initial=function(e){return(null==e?0:e.length)?iw(e,0,-1):[]},rf.intersection=nG,rf.intersectionBy=nY,rf.intersectionWith=nJ,rf.invert=oh,rf.invertBy=od,rf.invokeMap=sd,rf.iteratee=oW,rf.keyBy=sp,rf.keys=of,rf.keysIn=og,rf.map=sf,rf.mapKeys=function(e,t){var r={};return t=nh(t,3),rV(e,function(e,i,n){rR(r,t(e,i,n),e)}),r},rf.mapValues=function(e,t){var r={};return t=nh(t,3),rV(e,function(e,i,n){rR(r,i,t(e,i,n))}),r},rf.matches=function(e){return it(r$(e,1))},rf.matchesProperty=function(e,t){return ir(e,r$(t,1))},rf.memoize=sI,rf.merge=om,rf.mergeWith=ow,rf.method=oB,rf.methodOf=oz,rf.mixin=oH,rf.negate=sA,rf.nthArg=function(e){return e=s8(e),id(function(t){return is(t,e)})},rf.omit=oy,rf.omitBy=function(e,t){return ob(e,sA(nh(t)))},rf.once=function(e){return sv(2,e)},rf.orderBy=function(t,r,i,n){return null==t?[]:(sj(r)||(r=null==r?[]:[r]),sj(i=n?e:i)||(i=null==i?[]:[i]),io(t,r,i))},rf.over=oV,rf.overArgs=sT,rf.overEvery=oF,rf.overSome=oG,rf.partial=sP,rf.partialRight=sR,rf.partition=sg,rf.pick=ov,rf.pickBy=ob,rf.property=oY,rf.propertyOf=function(t){return function(r){return null==t?e:rY(t,r)}},rf.pull=nQ,rf.pullAll=nX,rf.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?il(e,t,nh(r,2)):e},rf.pullAllWith=function(t,r,i){return t&&t.length&&r&&r.length?il(t,r,e,i):t},rf.pullAt=n0,rf.range=oJ,rf.rangeRight=oZ,rf.rearg=sO,rf.reject=function(e,t){return(sj(e)?tc:rB)(e,sA(nh(t,3)))},rf.remove=function(e,t){var r=[];if(!(e&&e.length))return r;var i=-1,n=[],s=e.length;for(t=nh(t,3);++i<s;){var o=e[i];t(o,i,e)&&(r.push(o),n.push(i))}return ic(e,n),r},rf.rest=function(r,i){if("function"!=typeof r)throw new eS(t);return id(r,i=i===e?i:s8(i))},rf.reverse=n1,rf.sampleSize=function(t,r,i){return r=(i?nx(t,r,i):r===e)?1:s8(r),(sj(t)?function(e,t){return nL(iB(e),rN(t,0,e.length))}:function(e,t){var r=o_(e);return nL(r,rN(t,0,r.length))})(t,r)},rf.set=function(e,t,r){return null==e?e:ip(e,t,r)},rf.setWith=function(t,r,i,n){return n="function"==typeof n?n:e,null==t?t:ip(t,r,i,n)},rf.shuffle=function(e){return(sj(e)?function(e){return nL(iB(e))}:function(e){return nL(o_(e))})(e)},rf.slice=function(t,r,i){var n=null==t?0:t.length;return n?(i&&"number"!=typeof i&&nx(t,r,i)?(r=0,i=n):(r=null==r?0:s8(r),i=i===e?n:s8(i)),iw(t,r,i)):[]}
vendor: 4,525 bytes, line 5027
5027,rf.sortBy=sm,rf.sortedUniq=function(e){return e&&e.length?iC(e):[]},rf.sortedUniqBy=function(e,t){return e&&e.length?iC(e,nh(t,2)):[]},rf.split=function(t,r,i){return i&&"number"!=typeof i&&nx(t,r,i)&&(r=i=e),(i=i===e?0xffffffff:i>>>0)?(t=ot(t))&&("string"==typeof r||null!=r&&!sQ(r))&&!(r=i_(r))&&tU(t)?i$(tH(t),0,i):t.split(r,i):[]},rf.spread=function(e,r){if("function"!=typeof e)throw new eS(t);return r=null==r?0:t3(s8(r),0),id(function(t){var i=t[r],n=i$(t,0,r);return i&&tp(n,i),ts(e,this,n)})},rf.tail=function(e){var t=null==e?0:e.length;return t?iw(e,1,t):[]},rf.take=function(t,r,i){return t&&t.length?iw(t,0,(r=i||r===e?1:s8(r))<0?0:r):[]},rf.takeRight=function(t,r,i){var n=null==t?0:t.length;return n?iw(t,(r=n-(r=i||r===e?1:s8(r)))<0?0:r,n):[]},rf.takeRightWhile=function(e,t){return e&&e.length?iI(e,nh(t,3),!1,!0):[]},rf.takeWhile=function(e,t){return e&&e.length?iI(e,nh(t,3)):[]},rf.tap=function(e,t){return t(e),e},rf.throttle=function(e,r,i){var n=!0,s=!0;if("function"!=typeof e)throw new eS(t);return sF(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),sE(e,r,{leading:n,maxWait:r,trailing:s})},rf.thru=sn,rf.toArray=s4,rf.toPairs=oC,rf.toPairsIn=ox,rf.toPath=function(e){return sj(e)?td(e,nU):s1(e)?[e]:iB(nj(ot(e)))},rf.toPlainObject=oe,rf.transform=function(e,t,r){var i=sj(e),n=i||sW(e)||s3(e);if(t=nh(t,4),null==r){var s=e&&e.constructor;r=n?i?new s:[]:sF(e)&&sH(s)?rg(eV(e)):{}}return(n?ta:rV)(e,function(e,i,n){return t(r,e,i,n)}),r},rf.unary=function(e){return sy(e,1)},rf.union=n3,rf.unionBy=n2,rf.unionWith=n5,rf.uniq=function(e){return e&&e.length?iE(e):[]},rf.uniqBy=function(e,t){return e&&e.length?iE(e,nh(t,2)):[]},rf.uniqWith=function(t,r){return r="function"==typeof r?r:e,t&&t.length?iE(t,e,r):[]},rf.unset=function(e,t){return null==e||ik(e,t)},rf.unzip=n4,rf.unzipWith=n6,rf.update=function(e,t,r){return null==e?e:iS(e,t,iO(r))},rf.updateWith=function(t,r,i,n){return n="function"==typeof n?n:e,null==t?t:iS(t,r,iO(i),n)},rf.values=o_,rf.valuesIn=function(e){return null==e?[]:tR(e,og(e))},rf.without=n8,rf.words=o$,rf.wrap=function(e,t){return sP(iO(t),e)},rf.xor=n9,rf.xorBy=n7,rf.xorWith=se,rf.zip=st,rf.zipObject=function(e,t){return iP(e||[],t||[],rI)},rf.zipObjectDeep=function(e,t){return iP(e||[],t||[],ip)},rf.zipWith=sr,rf.entries=oC,rf.entriesIn=ox,rf.extend=oi,rf.extendWith=on,oH(rf,rf),rf.add=o0,rf.attempt=oD,rf.camelCase=oE,rf.capitalize=ok,rf.ceil=o1,rf.clamp=function(t,r,i){return i===e&&(i=r,r=e),i!==e&&(i=(i=s7(i))==i?i:0),r!==e&&(r=(r=s7(r))==r?r:0),rN(s7(t),r,i)},rf.clone=function(e){return r$(e,4)},rf.cloneDeep=function(e){return r$(e,5)},rf.cloneDeepWith=function(t,r){return r$(t,5,r="function"==typeof r?r:e)},rf.cloneWith=function(t,r){return r$(t,4,r="function"==typeof r?r:e)},rf.conformsTo=function(e,t){return null==t||rD(e,t,of(t))},rf.deburr=oS,rf.defaultTo=function(e,t){return null==e||e!=e?t:e},rf.divide=o3,rf.endsWith=function(t,r,i){t=ot(t),r=i_(r);var n=t.length,s=i=i===e?n:rN(s8(i),0,n);return(i-=r.length)>=0&&t.slice(i,s)==r},rf.eq=sN,rf.escape=function(e){return(e=ot(e))&&W.test(e)?e.replace(M,tL):e},rf.escapeRegExp=function(e){return(e=ot(e))&&Y.test(e)?e.replace(G,"\\$&"):e},rf.every=function(t,r,i){var n=sj(t)?tl:rq;return i&&nx(t,r,i)&&(r=e),n(t,nh(r,3))},rf.find=sa,rf.findIndex=nH,rf.findKey=function(e,t){return ty(e,nh(t,3),rV)},rf.findLast=sl,rf.findLastIndex=nK,rf.findLastKey=function(e,t){return ty(e,nh(t,3),rF)},rf.floor=o2,rf.forEach=sc,rf.forEachRight=su,rf.forIn=function(e,t){return null==e?e:rH(e,nh(t,3),og)},rf.forInRight=function(e,t){return null==e?e:rK(e,nh(t,3),og)},rf.forOwn=function(e,t){return e&&rV(e,nh(t,3))},rf.forOwnRight=function(e,t){return e&&rF(e,nh(t,3))},rf.get=oc,rf.gt=s$,rf.gte=sD,rf.has=function(e,t){return null!=e&&ny(e,t,rX)},rf.hasIn=ou,rf.head=nF,rf.identity=oq,rf.includes=function(e,t,r,i){e=sM(e)?e:o_(e),r=r&&!i?s8(r):0;var n=e.length;return r<0&&(r=t3(n+r,0)),s0(e)?r<=n&&e.indexOf(t,r)>-1:!!n&&tb(e,t,r)>-1},rf.indexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return -1;var n=null==r?0:s8(r);return n<0&&(n=t3(i+n,0)),tb(e,t,n)},rf.inRange=function(t,r,i){var n,s,o;return r=s6(r),i===e?(i=r,r=0):i=s6(i),(n=t=s7(t))>=t2(s=r,o=i)&&n<t3(s,o)},rf.invoke=op,rf.isArguments=sL,rf.isArray=sj,rf.isArrayBuffer=sU,rf.isArrayLike=sM,rf.isArrayLikeObject=sq,rf.isBoolean=function(e){return!0===e||!1===e||sG(e)&&rZ(e)==u},rf.isBuffer=sW,rf.isDate=sB,rf.isElement=function(e){return sG(e)&&1===e.nodeType&&!sZ(e)},rf.isEmpty=function(e){if(null==e)return!0;
vendor: 4,874 bytes, lines 5027-5028
5027if(sM(e)&&(sj(e)||"string"==typeof e||"function"==typeof e.splice||sW(e)||s3(e)||sL(e)))return!e.length;var t=nw(e);if(t==g||t==b)return!e.size;if(nS(e))return!r9(e).length;for(var r in e)if(eO.call(e,r))return!1;return!0},rf.isEqual=function(e,t){return r5(e,t)},rf.isEqualWith=function(t,r,i){var n=(i="function"==typeof i?i:e)?i(t,r):e;return n===e?r5(t,r,e,i):!!n},rf.isError=sz,rf.isFinite=function(e){return"number"==typeof e&&tX(e)},rf.isFunction=sH,rf.isInteger=sK,rf.isLength=sV,rf.isMap=sY,rf.isMatch=function(e,t){return e===t||r4(e,t,np(t))},rf.isMatchWith=function(t,r,i){return i="function"==typeof i?i:e,r4(t,r,np(r),i)},rf.isNaN=function(e){return sJ(e)&&e!=+e},rf.isNative=function(e){if(nk(e))throw new eb("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return r6(e)},rf.isNil=function(e){return null==e},rf.isNull=function(e){return null===e},rf.isNumber=sJ,rf.isObject=sF,rf.isObjectLike=sG,rf.isPlainObject=sZ,rf.isRegExp=sQ,rf.isSafeInteger=function(e){return sK(e)&&e>=-0x1fffffffffffff&&e<=0x1fffffffffffff},rf.isSet=sX,rf.isString=s0,rf.isSymbol=s1,rf.isTypedArray=s3,rf.isUndefined=function(t){return t===e},rf.isWeakMap=function(e){return sG(e)&&nw(e)==_},rf.isWeakSet=function(e){return sG(e)&&"[object WeakSet]"==rZ(e)},rf.join=function(e,t){return null==e?"":t0.call(e,t)},rf.kebabCase=oI,rf.last=nZ,rf.lastIndexOf=function(t,r,i){var n=null==t?0:t.length;if(!n)return -1;var s=n;return i!==e&&(s=(s=s8(i))<0?t3(n+s,0):t2(s,n-1)),r==r?function(e,t,r){for(var i=r+1;i--&&e[i]!==t;);return i}(t,r,s):tv(t,tx,s,!0)},rf.lowerCase=oA,rf.lowerFirst=oT,rf.lt=s2,rf.lte=s5,rf.max=function(t){return t&&t.length?rW(t,oq,rQ):e},rf.maxBy=function(t,r){return t&&t.length?rW(t,nh(r,2),rQ):e},rf.mean=function(e){return t_(e,oq)},rf.meanBy=function(e,t){return t_(e,nh(t,2))},rf.min=function(t){return t&&t.length?rW(t,oq,r7):e},rf.minBy=function(t,r){return t&&t.length?rW(t,nh(r,2),r7):e},rf.stubArray=oQ,rf.stubFalse=oX,rf.stubObject=function(){return{}},rf.stubString=function(){return""},rf.stubTrue=function(){return!0},rf.multiply=o5,rf.nth=function(t,r){return t&&t.length?is(t,s8(r)):e},rf.noConflict=function(){return e2._===this&&(e2._=ej),this},rf.noop=oK,rf.now=sw,rf.pad=function(e,t,r){e=ot(e);var i=(t=s8(t))?tz(e):0;if(!t||i>=t)return e;var n=(t-i)/2;return i2(tJ(n),r)+e+i2(tY(n),r)},rf.padEnd=function(e,t,r){e=ot(e);var i=(t=s8(t))?tz(e):0;return t&&i<t?e+i2(t-i,r):e},rf.padStart=function(e,t,r){e=ot(e);var i=(t=s8(t))?tz(e):0;return t&&i<t?i2(t-i,r)+e:e},rf.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t*=1),t4(ot(e).replace(J,""),t||0)},rf.random=function(t,r,i){if(i&&"boolean"!=typeof i&&nx(t,r,i)&&(r=i=e),i===e&&("boolean"==typeof r?(i=r,r=e):"boolean"==typeof t&&(i=t,t=e)),t===e&&r===e?(t=0,r=1):(t=s6(t),r===e?(r=t,t=0):r=s6(r)),t>r){var n=t;t=r,r=n}if(i||t%1||r%1){var s=t6();return t2(t+s*(r-t+eX("1e-"+((s+"").length-1))),r)}return iu(t,r)},rf.reduce=function(e,t,r){var i=sj(e)?tf:tS,n=arguments.length<3;return i(e,nh(t,4),r,n,rU)},rf.reduceRight=function(e,t,r){var i=sj(e)?tg:tS,n=arguments.length<3;return i(e,nh(t,4),r,n,rM)},rf.repeat=function(t,r,i){return r=(i?nx(t,r,i):r===e)?1:s8(r),ih(ot(t),r)},rf.replace=function(){var e=arguments,t=ot(e[0]);return e.length<3?t:t.replace(e[1],e[2])},rf.result=function(t,r,i){r=iN(r,t);var n=-1,s=r.length;for(s||(s=1,t=e);++n<s;){var o=null==t?e:t[nU(r[n])];o===e&&(n=s,o=i),t=sH(o)?o.call(t):o}return t},rf.round=o4,rf.runInContext=o,rf.sample=function(e){return(sj(e)?rk:function(e){return rk(o_(e))})(e)},rf.size=function(e){if(null==e)return 0;if(sM(e))return s0(e)?tz(e):e.length;var t=nw(e);return t==g||t==b?e.size:r9(e).length},rf.snakeCase=oP,rf.some=function(t,r,i){var n=sj(t)?tm:iy;return i&&nx(t,r,i)&&(r=e),n(t,nh(r,3))},rf.sortedIndex=function(e,t){return iv(e,t)},rf.sortedIndexBy=function(e,t,r){return ib(e,t,nh(r,2))},rf.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var i=iv(e,t);if(i<r&&sN(e[i],t))return i}return -1},rf.sortedLastIndex=function(e,t){return iv(e,t,!0)},rf.sortedLastIndexBy=function(e,t,r){return ib(e,t,nh(r,2),!0)},rf.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var r=iv(e,t,!0)-1;if(sN(e[r],t))return r}return -1},rf.startCase=oR,rf.startsWith=function(e,t,r){return e=ot(e),r=null==r?0:rN(s8(r),0,e.length),t=i_(t),e.slice(r,r+t.length)==t},rf.subtract=o6,rf.sum=function(e){return e&&e.length?tI(e,oq):0},rf.sumBy=function(e,t){return e&&e.length?tI(e,nh(t,2)):0},rf.template=function(t,r,i){var n=rf.templateSettings;i&&nx(t,r,i)&&(r=e),t=ot(t),r=on({},r,n,nt);var s,o,a=on({},r.imports,n.imports,nt),l=of(a),c=tR(a,l),u=0,h=r.interpolate||ed,d="__p += '",p=eE((r.escape||ed).source+"|"+h.source+"|"+(h===H?en:ed).source+"|"+(r.evaluate||ed).source+"|$","g"),f="//# sourceURL="+(eO.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++eY+"]")+`
5028`;
5028t.replace(p,function(e,r,i,n,a,l){return i||(i=n),d+=t.slice(u,l).replace(ep,tj),r&&(s=!0,d+=`' +
5029__e(`+r+`) +
5030'`),a&&(o=!0,d+=`';
5031`+a+`;
5032__p += '`),i&&(d+=`' +
5033((__t = (`+i+`)) == null ? '' : __t) +
5034'`),u=l+e.length,e}),d+=`';
5035`;var g=eO.call(r,"variable")&&r.variable;if(g){if(er.test(g))throw new eb("Invalid `variable` option passed into `_.template`")}else d=`with (obj) {
5036`+d+`
5037}
5038`;d=(o?d.replace(D,""):d).replace(L,"$1").replace(j,"$1;"),d="function("+(g||"obj")+`) {
5039`+(g?"":`obj || (obj = {});
5040`)+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?`, __j = Array.prototype.join;
5041function print() { __p += __j.call(arguments, '') }
5042`:`;
5043`)+d+`return __p
5044}`;var m=oD(function(){return eC(l,f+"return "+d).apply(e,c)});if(m.source=d,sz(m))throw m;return m},rf.times=function(e,t){if((e=s8(e))<1||e>0x1fffffffffffff)return[];var r=0xffffffff,i=t2(e,0xffffffff);t=nh(t),e-=0xffffffff;for(var n=tA(i,t);++r<e;)t(r);return n},rf.toFinite=s6,rf.toInteger=s8,rf.toLength=s9,rf.toLower=function(e){return ot(e).toLowerCase()},rf.toNumber=s7,rf.toSafeInteger=function(e){return e?rN(s8(e),-0x1fffffffffffff,0x1fffffffffffff):0===e?e:0},rf.toString=ot,rf.toUpper=function(e){return ot(e).toUpperCase()},rf.trim=function(t,r,i){if((t=ot(t))&&(i||r===e))return tT(t);if(!t||!(r=i_(r)))return t;var n=tH(t),s=tH(r),o=tN(n,s),a=t$(n,s)+1;return i$(n,o,a).join("")},rf.trimEnd=function(t,r,i){if((t=ot(t))&&(i||r===e))return t.slice(0,tK(t)+1);if(!t||!(r=i_(r)))return t;var n=tH(t),s=t$(n,tH(r))+1;return i$(n,0,s).join("")},rf.trimStart=function(t,r,i){if((t=ot(t))&&(i||r===e))return t.replace(J,"");if(!t||!(r=i_(r)))return t;var n=tH(t),s=tN(n,tH(r));return i$(n,s).join("")},rf.truncate=function(t,r){var i=30,n="...";if(sF(r)){var s="separator"in r?r.separator:s;i="length"in r?s8(r.length):i,n="omission"in r?i_(r.omission):n}var o=(t=ot(t)).length;if(tU(t)){var a=tH(t);o=a.length}if(i>=o)return t;var l=i-tz(n);if(l<1)return n;var c=a?i$(a,0,l).join(""):t.slice(0,l);if(s===e)return c+n;
vendor: 5,728 bytes, line 5044
5044if(a&&(l+=c.length-l),sQ(s)){if(t.slice(l).search(s)){var u,h=c;for(s.global||(s=eE(s.source,ot(es.exec(s))+"g")),s.lastIndex=0;u=s.exec(h);)var d=u.index;c=c.slice(0,d===e?l:d)}}else if(t.indexOf(i_(s),l)!=l){var p=c.lastIndexOf(s);p>-1&&(c=c.slice(0,p))}return c+n},rf.unescape=function(e){return(e=ot(e))&&q.test(e)?e.replace(U,tV):e},rf.uniqueId=function(e){var t=++eN;return ot(e)+t},rf.upperCase=oO,rf.upperFirst=oN,rf.each=sc,rf.eachRight=su,rf.first=nF,oH(rf,(ew={},rV(rf,function(e,t){eO.call(rf.prototype,t)||(ew[t]=e)}),ew),{chain:!1}),rf.VERSION="4.17.21",ta(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){rf[e].placeholder=rf}),ta(["drop","take"],function(t,r){ry.prototype[t]=function(i){i=i===e?1:t3(s8(i),0);var n=this.__filtered__&&!r?new ry(this):this.clone();return n.__filtered__?n.__takeCount__=t2(i,n.__takeCount__):n.__views__.push({size:t2(i,0xffffffff),type:t+(n.__dir__<0?"Right":"")}),n},ry.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),ta(["filter","map","takeWhile"],function(e,t){var r=t+1,i=1==r||3==r;ry.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:nh(e,3),type:r}),t.__filtered__=t.__filtered__||i,t}}),ta(["head","last"],function(e,t){var r="take"+(t?"Right":"");ry.prototype[e]=function(){return this[r](1).value()[0]}}),ta(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");ry.prototype[e]=function(){return this.__filtered__?new ry(this):this[r](1)}}),ry.prototype.compact=function(){return this.filter(oq)},ry.prototype.find=function(e){return this.filter(e).head()},ry.prototype.findLast=function(e){return this.reverse().find(e)},ry.prototype.invokeMap=id(function(e,t){return"function"==typeof e?new ry(this):this.map(function(r){return r3(r,e,t)})}),ry.prototype.reject=function(e){return this.filter(sA(nh(e)))},ry.prototype.slice=function(t,r){t=s8(t);var i=this;return i.__filtered__&&(t>0||r<0)?new ry(i):(t<0?i=i.takeRight(-t):t&&(i=i.drop(t)),r!==e&&(i=(r=s8(r))<0?i.dropRight(-r):i.take(r-t)),i)},ry.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ry.prototype.toArray=function(){return this.take(0xffffffff)},rV(ry.prototype,function(t,r){var i=/^(?:filter|find|map|reject)|While$/.test(r),n=/^(?:head|last)$/.test(r),s=rf[n?"take"+("last"==r?"Right":""):r],o=n||/^find/.test(r);s&&(rf.prototype[r]=function(){var r=this.__wrapped__,a=n?[1]:arguments,l=r instanceof ry,c=a[0],u=l||sj(r),h=function(e){var t=s.apply(rf,tp([e],a));return n&&d?t[0]:t};u&&i&&"function"==typeof c&&1!=c.length&&(l=u=!1);var d=this.__chain__,p=!!this.__actions__.length,f=o&&!d,g=l&&!p;if(!o&&u){r=g?r:new ry(this);var m=t.apply(r,a);return m.__actions__.push({func:sn,args:[h],thisArg:e}),new rw(m,d)}return f&&g?t.apply(this,a):(m=this.thru(h),f?n?m.value()[0]:m.value():m)})}),ta(["pop","push","shift","sort","splice","unshift"],function(e){var t=eI[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",i=/^(?:pop|shift)$/.test(e);rf.prototype[e]=function(){var e=arguments;if(i&&!this.__chain__){var n=this.value();return t.apply(sj(n)?n:[],e)}return this[r](function(r){return t.apply(sj(r)?r:[],e)})}}),rV(ry.prototype,function(e,t){var r=rf[t];if(r){var i=r.name+"";eO.call(rs,i)||(rs[i]=[]),rs[i].push({name:t,func:r})}}),rs[iX(e,2).name]=[{name:"wrapper",func:e}],ry.prototype.clone=function(){var e=new ry(this.__wrapped__);return e.__actions__=iB(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=iB(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=iB(this.__views__),e},ry.prototype.reverse=function(){if(this.__filtered__){var e=new ry(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e},ry.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=sj(e),i=t<0,n=r?e.length:0,s=function(e,t,r){for(var i=-1,n=r.length;++i<n;){var s=r[i],o=s.size;switch(s.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=t2(t,e+o);break;case"takeRight":e=t3(e,t-o)}}return{start:e,end:t}}(0,n,this.__views__),o=s.start,a=s.end,l=a-o,c=i?a:o-1,u=this.__iteratees__,h=u.length,d=0,p=t2(l,this.__takeCount__);if(!r||!i&&n==l&&p==l)return iA(e,this.__actions__);var f=[];t:for(;l--&&d<p;){c+=t;for(var g=-1,m=e[c];++g<h;){var w=u[g],y=w.iteratee,v=w.type,b=y(m);if(2==v)m=b;else if(!b){if(1==v)continue t;break t}}f[d++]=m}return f},rf.prototype.at=ss,rf.prototype.chain=function(){return si(this)},rf.prototype.commit=function(){return new rw(this.value(),this.__chain__)},rf.prototype.next=function(){this.__values__===e&&(this.__values__=s4(this.value()));var t=this.__index__>=this.__values__.length,r=t?e:this.__values__[this.__index__++];return{done:t,value:r}},rf.prototype.plant=function(t){for(var r,i=this;i instanceof rm;){var n=nq(i);n.__index__=0,n.__values__=e,r?s.__wrapped__=n:r=n;var s=n;i=i.__wrapped__}return s.__wrapped__=t,r},rf.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof ry){var r=t;return this.__actions__.length&&(r=new ry(this)),(r=r.reverse()).__actions__.push({func:sn,args:[n1],thisArg:e}),new rw(r,this.__chain__)}return this.thru(n1)},rf.prototype.toJSON=rf.prototype.valueOf=rf.prototype.value=function(){return iA(this.__wrapped__,this.__actions__)},rf.prototype.first=rf.prototype.head,e4&&(rf.prototype[e4]=function(){return this}),rf}();e4?((e4.exports=tF)._=tF,e5._=tF):e2._=tF}).call(ut);var ui=Object.defineProperty,un=Object.defineProperties,us=Object.getOwnPropertyDescriptors,uo=Object.getOwnPropertySymbols,ua=Object.prototype.hasOwnProperty,ul=Object.prototype.propertyIsEnumerable,uc=(e,t,r)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uu=(e,t)=>
5044{for(var r in t||(t={}))ua.call(t,r)&&uc(e,r,t[r]);if(uo)for(var r of uo(t))ul.call(t,r)&&uc(e,r,t[r]);return e},uh=(e,t)=>un(e,us(t));function ud(e,t,r){var i;let n=(0,ol.parseChainId)(e);return(null==(i=t.rpcMap)?void 0:i[n.reference])||`https://rpc.walletconnect.com/v1/?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function up(e){return e.includes(":")?e.split(":")[1]:e}function uf(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function ug(e={},t={}){let r=um(e),i=um(t);return ur.exports.merge(r,i)}function um(e){var t,r,i,n;let s={};if(!(0,ol.isValidObject)(e))return s;for(let[o,a]of Object.entries(e)){let e=(0,ol.isCaipNamespace)(o)?[o]:a.chains,l=a.methods||[],c=a.events||[],u=a.rpcMap||{},h=(0,ol.parseNamespaceKey)(o);s[h]=uh(uu(uu({},s[h]),a),{chains:(0,ol.mergeArrays)(e,null==(t=s[h])?void 0:t.chains),methods:(0,ol.mergeArrays)(l,null==(r=s[h])?void 0:r.methods),events:(0,ol.mergeArrays)(c,null==(i=s[h])?void 0:i.events),rpcMap:uu(uu({},u),null==(n=s[h])?void 0:n.rpcMap)})}return s}function uw(e){return e.includes(":")?e.split(":")[2]:e}function uy(e){let t={};for(let[r,i]of Object.entries(e)){let e=i.methods||[],n=i.events||[],s=i.accounts||[],o=(0,ol.isCaipNamespace)(r)?[r]:i.chains?i.chains:uf(i.accounts);t[r]={chains:o,methods:e,events:n,accounts:s}}return t}function uv(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):isNaN(Number(e=e.includes(":")?e.split(":")[1]:e))?e:Number(e)}let ub={},uC=e=>ub[e],ux=(e,t)=>{ub[e]=t};class u_{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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;let e=this.namespace.chains[0];if(!e)throw 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(ue,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=up(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){return new aw(new c6(t||ud(e,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}}var uE=Object.defineProperty,uk=Object.defineProperties,uS=Object.getOwnPropertyDescriptors,uI=Object.getOwnPropertySymbols,uA=Object.prototype.hasOwnProperty,uT=Object.prototype.propertyIsEnumerable,uP=(e,t,r)=>t in e?uE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uR=(e,t)=>{for(var r in t||(t={}))uA.call(t,r)&&uP(e,r,t[r]);if(uI)for(var r of uI(t))uT.call(t,r)&&uP(e,r,t[r]);return e};class uO{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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)}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(ue,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){return new aw(new c6(t||ud(`${this.name}:${e}`,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=parseInt(up(t));e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let i=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",n=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,i;let n=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!n)throw Error("Missing address parameter in `wallet_getCapabilities` request");let s=this.client.session.get(e.topic),o=(null==(i=s?.sessionProperties)?void 0:i.capabilities)||{};if(null!=o&&o[n])return o?.[n];let a=await this.client.request(e);try{let t,r,i,l;await this.client.session.update(e.topic,{sessionProperties:(i=uR({},s.sessionProperties||{}),l={capabilities:(t=uR({},o||{}),r={[n]:a},uk(t,uS(r)))},uk(i,uS(l)))})}catch(e){console.warn("Failed to update session with capabilities",e)}return a}}class uN{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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(ue,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=up(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){return new aw(new c6(t||ud(e,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}}class u${constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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;let e=this.namespace.chains[0];if(!e)throw 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(ue,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=up(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){return new aw(new c6(t||ud(e,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}}class uD{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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]){let r=t||ud(`${this.name}:${e}`,this.namespace,this.client.core.projectId);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(ue,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let 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(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ud(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new aw(new c6(r,uC("disableProviderPing")))}}class uL{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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;let e=this.namespace.chains[0];if(!e)throw 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(ue,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let r=this.getCardanoRPCUrl(t),i=up(t);e[i]=this.createHttpProvider(i,r)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||this.getCardanoRPCUrl(e);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new aw(new c6(r,uC("disableProviderPing")))}}class uj{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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(ue,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=up(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){return new aw(new c6(t||ud(e,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}}class uU{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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(ue,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=up(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){return new aw(new c6(t||ud(e,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}}class uM{constructor(e){this.name="near",this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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;let e=this.namespace.chains[0];if(!e)throw 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]){let r=t||ud(`${this.name}:${e}`,this.namespace);this.setHttpProvider(e,r)}this.events.emit(ue,`${this.name}:${this.chainId}`)}getA
5044ccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let 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(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ud(e,this.namespace);return typeof r>"u"?void 0:new aw(new c6(r,uC("disableProviderPing")))}}class uq{constructor(e){this.name=c7,this.namespace=e.namespace,this.events=uC("events"),this.client=uC("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(ue,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let 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;let r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach(e=>{let t=(0,ol.parseChainId)(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)}),r}getHttpProvider(e){let t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){return new aw(new c6(t||ud(e,this.namespace,this.client.core.projectId),uC("disableProviderPing")))}}var uW=Object.defineProperty,uB=Object.defineProperties,uz=Object.getOwnPropertyDescriptors,uH=Object.getOwnPropertySymbols,uK=Object.prototype.hasOwnProperty,uV=Object.prototype.propertyIsEnumerable,uF=(e,t,r)=>t in e?uW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uG=(e,t)=>{for(var r in t||(t={}))uK.call(t,r)&&uF(e,r,t[r]);if(uH)for(var r of uH(t))uV.call(t,r)&&uF(e,r,t[r]);return e};class uY{constructor(e){this.events=new oa.default,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,oz.default)((0,oB.getDefaultLoggerOptions)({level:e?.logger||c8})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new uY(e);return await t.initialize(),t}async request(e,t,r){let[i,n]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(i).request({request:uG({},e),chainId:`${i}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,i){let n=new Date().getTime();this.request(e,r,i).then(e=>t(null,au(n,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw 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 Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:(0,ol.getSdkError)("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw 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 Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:i}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let e=uy(this.session.namespaces);this.namespaces=ug(this.namespaces,e),this.persist("namespaces",this.namespaces),this.onConnect()}return n}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 Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw Error("Max auto pairing attempts reached");let{uri:r,approval:i}=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 i().then(e=>{this.session=e;let t=uy(e.namespaces);this.namespaces=ug(this.namespaces,t),this.persist("namespaces",this.namespaces)}).catch(e=>{if(e.message!==cE)throw e;t++})}while(!this.session)return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[r,i]=this.validateChain(e),n=this.getProvider(r);n.name===c7?n.setDefaultChain(`${r}:${i}`,t):n.setDefaultChain(i,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if((0,ol.isValidArray)(t)){for(let 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){let 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 cY.init({core:this.providerOpts.core,logger:this.providerOpts.logger||c8,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.com",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 Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(e=>(0,ol.parseNamespaceKey)(e)))];ux("client",this.client),ux("events",this.events),ux("disableProviderPing",this.disableProviderPing),e.forEach(e
5044=>{if(!this.session)return;let t=function(e,t){let r=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!r.length)return[];let i=[];return r.forEach(e=>{let r=t.namespaces[e].accounts;i.push(...r)}),i}(e,this.session),r=uf(t),i=uB(uG({},ug(this.namespaces,this.optionalNamespaces)[e]),uz({accounts:t,chains:r}));switch(e){case"eip155":this.rpcProviders[e]=new uO({namespace:i});break;case"algorand":this.rpcProviders[e]=new uD({namespace:i});break;case"solana":this.rpcProviders[e]=new uN({namespace:i});break;case"cosmos":this.rpcProviders[e]=new u$({namespace:i});break;case"polkadot":this.rpcProviders[e]=new u_({namespace:i});break;case"cip34":this.rpcProviders[e]=new uL({namespace:i});break;case"elrond":this.rpcProviders[e]=new uj({namespace:i});break;case"multiversx":this.rpcProviders[e]=new uU({namespace:i});break;case"near":this.rpcProviders[e]=new uM({namespace:i});break;default:this.rpcProviders[c7]?this.rpcProviders[c7].updateNamespace(i):this.rpcProviders[c7]=new uq({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{let{params:t}=e,{event:r}=t;if("accountsChanged"===r.name){let e=r.data;e&&(0,ol.isValidArray)(e)&&this.events.emit("accountsChanged",e.map(uw))}else if("chainChanged"===r.name){let e=t.chainId,r=t.event.data,i=(0,ol.parseNamespaceKey)(e),n=uv(e)!==uv(r)?`${i}:${uv(r)}`:e;this.onChainChanged(n)}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;let{namespaces:i}=t,n=null==(r=this.client)?void 0:r.session.get(e);this.session=uB(uG({},n),uz({namespaces:i})),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",uB(uG({},(0,ol.getSdkError)("USER_DISCONNECTED")),uz({data:e.topic})))}),this.on(ue,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[c7]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])})}setNamespaces(e){let{namespaces:t,optionalNamespaces:r,sessionProperties:i}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.persist("namespaces",t),this.persist("optionalNamespaces",r)}validateChain(e){let[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map(e=>(0,ol.parseNamespaceKey)(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let i=(0,ol.parseNamespaceKey)(Object.keys(this.namespaces)[0]),n=this.rpcProviders[i].getDefaultChain();return[i,n]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;let[r,i]=this.validateChain(e);i&&(t||this.getProvider(r).setDefaultChain(i),this.namespaces[r]?this.namespaces[r].defaultChain=i:this.namespaces[`${r}:${i}`]?this.namespaces[`${r}:${i}`].defaultChain=i:this.namespaces[`${r}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}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(`${c9}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${c9}/${e}`)}}let uJ=["eth_sendTransaction","personal_sign"],uZ=["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_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],uQ=["chainChanged","accountsChanged"],uX=["chainChanged","accountsChanged","message","disconnect","connect"];var u0=Object.defineProperty,u1=Object.defineProperties,u3=Object.getOwnPropertyDescriptors,u2=Object.getOwnPropertySymbols,u5=Object.prototype.hasOwnProperty,u4=Object.prototype.propertyIsEnumerable,u6=(e,t,r)=>t in e?u0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u8=(e,t)=>
5044{for(var r in t||(t={}))u5.call(t,r)&&u6(e,r,t[r]);if(u2)for(var r of u2(t))u4.call(t,r)&&u6(e,r,t[r]);return e};function u9(e){return Number(e[0].split(":")[1])}function u7(e){return`0x${e.toString(16)}`}class he{constructor(){this.events=new oa.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY="wc@2:ethereum_provider:",this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){let t=new he;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,r){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),r)}get connected(){return!!this.signer.client&&this.signer.client.core.relayer.connected}get connecting(){return!!this.signer.client&&this.signer.client.core.relayer.connecting}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);let{required:t,optional:r}=function(e){let{chains:t,optionalChains:r,methods:i,optionalMethods:n,events:s,optionalEvents:o,rpcMap:a}=e;if(!(0,ol.isValidArray)(t))throw Error("Invalid chains");let l={chains:t,methods:i||uJ,events:s||uQ,rpcMap:u8({},t.length?{[u9(t)]:a[u9(t)]}:{})},c=s?.filter(e=>!uQ.includes(e)),u=i?.filter(e=>!uJ.includes(e));if(!r&&!o&&!n&&!(null!=c&&c.length)&&!(null!=u&&u.length))return{required:t.length?l:void 0};let h={chains:[...new Set(c?.length&&u?.length||!r?l.chains.concat(r||[]):r)],methods:[...new Set(l.methods.concat(null!=n&&n.length?n:uZ))],events:[...new Set(l.events.concat(null!=o&&o.length?o:uX))],rpcMap:a};return{required:t.length?l:void 0,optional:r.length?h:void 0}}(this.rpc);try{let i=await new Promise(async(i,n)=>{var s;let o,a;this.rpc.showQrModal&&(null==(s=this.modal)||s.subscribeModal(e=>{e.open||this.signer.session||(this.signer.abortPairingAttempt(),n(Error("Connection request reset. Please try again.")))})),await this.signer.connect((o=u8({namespaces:u8({},t&&{[this.namespace]:t})},r&&{optionalNamespaces:{[this.namespace]:r}}),a={pairingTopic:e?.pairingTopic},u1(o,u3(a)))).then(e=>{i(e)}).catch(e=>{n(Error(e.message))})});if(!i)return;let n=(0,ol.getAccountsFromNamespaces)(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:u7(this.chainId)})}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{let r=await new Promise(async(r,i)=>{var n;let s,o;this.rpc.showQrModal&&(null==(n=this.modal)||n.subscribeModal(e=>{e.open||this.signer.session||(this.signer.abortPairingAttempt(),i(Error("Connection request reset. Please try again.")))})),await this.signer.authenticate((s=u8({},e),o={chains:this.rpc.chains},u1(s,u3(o))),t).then(e=>{r(e)}).catch(e=>{i(Error(e.message))})}),i=r.session;if(i){let e=(0,ol.getAccountsFromNamespaces)(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:e),this.setAccounts(e),this.events.emit("connect",{chainId:u7(this.chainId)})}return r}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{let{params:t}=e,{event:r}=t;"accountsChanged"===r.name?(this.accounts=this.parseAccounts(r.data),this.events.emit("accountsChanged",this.accounts)):"chainChanged"===r.name?this.setChainId(this.formatChainId(r.data)):this.events.emit(r.name,r.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{let t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",u7(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",u1(u8({},(0,ol.getSdkError)("USER_DISCONNECTED")),u3({data:e.topic,name:"USER_DISCONNECTED"})))}),this.signer.on("display_uri",e=>{var t,r;this.rpc.showQrModal&&(null==(t=this.modal)||t.closeModal(),null==(r=this.modal)||r.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return"string"==typeof e&&e.startsWith(`${this.namespace}:`)}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){let t=e.filter(e=>this.isCompatibleChainId(e)).map(e=>this.parseChainId(e));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",u7(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){let t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){let[t,r,i]=e.split(":");return{chainId:`${t}:${r}`,address:i}}setAccounts(e){this.accounts=e.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,r;let i=null!=(t=e?.chains)?t:[],n=null!=(r=e?.optionalChains)?r:[],s=i.concat(n);if(!s.length)throw Error("No chains specified in either `chains` or `optionalChains`");let o=i.length?e?.methods||uJ:[],a=i.length?e?.events||uQ:[],l=e?.optionalMethods||[],c=e?.optionalEvents||[],u=e?.rpcMap||this.buildRpcMap(s,e.projectId),h=e?.qrModalOptions||void 0;return{chains:i?.map(e=>this.formatChainId(e)),optionalChains:n.map(e=>this.formatChainId(e)),methods:o,events:a,optionalMethods:l,optionalEvents:c,rpcMap:u,showQrModal:!!(null!=e&&e.showQrModal),qrModalOptions:h,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){let r={};
5044return e.forEach(e=>{r[e]=this.getRpcUrl(e,t)}),r}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?u9(this.rpc.chains):u9(this.rpc.optionalChains),this.signer=await uY.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions,customStoragePrefix:t.customStoragePrefix,telemetryEnabled:t.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{let{WalletConnectModal:r}=await e.A(652518);t=r}catch{throw Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(u8({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(e){throw this.signer.logger.error(e),Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;let{chains:t,optionalChains:r,rpcMap:i}=e;t&&(0,ol.isValidArray)(t)&&(this.rpc.chains=t.map(e=>this.formatChainId(e)),t.forEach(e=>{this.rpc.rpcMap[e]=i?.[e]||this.getRpcUrl(e)})),r&&(0,ol.isValidArray)(r)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=r?.map(e=>this.formatChainId(e)),r.forEach(e=>{this.rpc.rpcMap[e]=i?.[e]||this.getRpcUrl(e)}))}getRpcUrl(e,t){var r;return(null==(r=this.rpc.rpcMap)?void 0:r[e])||`https://rpc.walletconnect.com/v1/?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{let e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return"string"==typeof e||e instanceof String?[this.parseAccount(e)]:e.map(e=>this.parseAccount(e))}}var ht=e.i(394367),hr=e.i(407120),hi=e.i(165640),hn=e.i(619183),hs=e.i(373095),ho=e.i(48259),ha=e.i(715882),hl=e.i(941655);let hc={getCaipDefaultChain(e){if(e)return{id:`${eU}:${e.chainId}`,name:e.name,imageId:or[e.chainId],chain:S.ConstantsUtil.CHAIN.EVM}},hexStringToNumber:e=>parseInt(e.startsWith("0x")?e.slice(2):e,16),numberToHexString:e=>`0x${e.toString(16)}`,async getUserInfo(e){let[t,r]=await Promise.all([hc.getAddresses(e),hc.getChainId(e)]);return{chainId:r,addresses:t}},getChainId:async e=>Number(await e.request({method:"eth_chainId"})),async getAddress(e){let[t]=await e.request({method:"eth_accounts"});return t},getAddresses:async e=>await e.request({method:"eth_accounts"}),async addEthereumChain(e,t){await e.request({method:"wallet_addEthereumChain",params:[{chainId:hc.numberToHexString(t.chainId),rpcUrls:[t.rpcUrl],chainName:t.name,nativeCurrency:{name:t.currency,decimals:18,symbol:t.currency},blockExplorerUrls:[t.explorerUrl],iconUrls:[or[t.chainId]]}]})}};var hu=e.i(742710),hh=e.i(365801);let hd=(0,hh.proxy)({provider:void 0,providerType:void 0,address:void 0,chainId:void 0,status:"reconnecting",isConnected:!1}),hp={state:hd,subscribeKey:(e,t)=>(0,hu.subscribeKey)(hd,e,t),subscribe:e=>(0,hh.subscribe)(hd,()=>e(hd)),setProvider(e){e&&(hd.provider=(0,hh.ref)(e))},setProviderType(e){hd.providerType=e},setAddress(e){hd.address=e},setPreferredAccountType(e){hd.preferredAccountType=e},setChainId(e){hd.chainId=e},setStatus(e){hd.status=e},setIsConnected(e){hd.isConnected=e},setError(e){hd.error=e},reset(){hd.provider=void 0,hd.address=void 0,hd.chainId=void 0,hd.providerType=void 0,hd.status="disconnected",hd.isConnected=!1,hd.error=void 0,hd.preferredAccountType=void 0}},hf="@w3m/wallet_id";var hg=e.i(346678),hm=e.i(707325);let hw={setItem(e,t){hy()&&localStorage.setItem(e,JSON.stringify(t))},getItem(e){if(hy()){let t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{}}return null},removeItem(e){hy()&&localStorage.removeItem(e)}};function hy(){return"u">typeof window&&"u">typeof localStorage}class hv{constructor(t){this.appKit=void 0,this.hasSyncedConnectedAccount=!1,this.EIP6963Providers=[],this.projectId="",this.options=void 0,this.chain=S.ConstantsUtil.CHAIN.EVM,this.siweControllerClient=this.options?.siweConfig,this.tokens=oo.getCaipTokens(this.options?.tokens),this.defaultChain=void 0;const{ethersConfig:r,siweConfig:i,chains:n,defaultChain:s}=t;if(!r)throw Error("web3modal:constructor - ethersConfig is undefined");this.ethersConfig=r,this.siweControllerClient=this.options?.siweConfig,this.tokens=oo.getCaipTokens(t.tokens),this.defaultChain=hc.getCaipDefaultChain(s),this.chains=n,this.networkControllerClient={switchCaipNetwork:async e=>{let t=hm.NetworkUtil.caipNetworkIdToNumber(e?.id);if(t)try{hp.setError(void 0),await this.switchNetwork(t)}catch(e){throw hp.setError(e),Error("networkControllerClient:switchCaipNetwork - unable to switch chain")}},getApprovedCaipNetworksData:async()=>new Promise(async e=>{let t=hw.getItem(hf);if(t?.includes(eP)){let t=await this.getWalletConnectProvider();if(!t)throw Error("networkControllerClient:getApprovedCaipNetworks - connector is undefined");let r=t.signer?.session?.namespaces,i=r?.[eU]?.methods,n=(0,ol.getChainsFromAccounts)(r?.[eU]?.accounts||[]);e({supportsAllNetworks:i?.includes("wallet_addEthereumChain")??!1,approvedCaipNetworkIds:n})}else e({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},this.connectionControllerClient={connectWalletConnect:async t=>{let r=await this.getWalletConnectProvider();if(!r)throw Error("connectionControllerClient:getWalletConnectUri - provider is undefined");r.on("display_uri",e=>{t(e)});let n=await r.signer?.client?.core?.crypto?.getClientId();n&&this.appKit?.setClientId(n);let s=await i?.getMessageParams?.();if(i?.options?.enabled&&s&&Object.keys(s||{}).length>0){let{SIWEController:t,getDidChainId:n,getDidAddress:o}=await e.A(430361),a=hm.NetworkUtil.caipNetworkIdToNumber(this.appKit?.getCaipNetwork()?.id),l=s.chains;a&&(l=[a,...s.chains.filter(e=>e!==a)]);let c=await r.authenticate({nonce:await i.getNonce(),methods:[...uZ],...s,chains:l}),u=c?.auths?.[0];if(u){let{p:e,s:i}=u,s=n(e.iss),a=o(e.iss);a&&s&&t.setSession({address:a,chainId:parseInt(s,10)});try{let n=r.signer.client.formatAuthMessage({request:e,iss:e.iss});
5044await t.verifyMessage({message:n,signature:i.s,cacao:u})}catch(e){throw console.error("Error verifying message",e),await r.disconnect().catch(console.error),await t.signOut().catch(console.error),e}}}else await r.connect({optionalChains:this.chains.map(e=>e.chainId)});await this.setWalletConnectProvider()},connectExternal:async({id:e,info:t,provider:i})=>{if(this.appKit?.setClientId(null),e===eR){let e=r.injected;if(!e)throw Error("connectionControllerClient:connectInjected - provider is undefined");try{hp.setError(void 0),await e.request({method:"eth_requestAccounts"}),this.setInjectedProvider(r)}catch(e){hp.setError(e)}}else if(e===eL&&t&&i)try{hp.setError(void 0),await i.request({method:"eth_requestAccounts"}),this.setEIP6963Provider(i,t.name)}catch(e){hp.setError(e)}else if(e===eN){let e=r.coinbase;if(!e)throw Error("connectionControllerClient:connectCoinbase - connector is undefined");try{hp.setError(void 0),await e.request({method:"eth_requestAccounts"}),this.setCoinbaseProvider(r)}catch(e){throw hp.setError(e),Error(e.message)}}else e===ej&&await this.setAuthProvider()},checkInstalled:e=>e?(!r.injected||!!window?.ethereum)&&e.some(e=>!!window.ethereum?.[String(e)]):!!window.ethereum,disconnect:async()=>{let t=hp.state.provider,n=hp.state.providerType;if(hw.removeItem(hf),hp.reset(),this.appKit?.setClientId(null),i?.options?.signOutOnDisconnect){let{SIWEController:t}=await e.A(430361);await t.signOut()}if(n===eP||"coinbaseWalletSDK"===n)await t.disconnect();else if(n===ej)await this.authProvider?.disconnect();else if(n===eL&&t)await this.revokeProviderPermissions(t);else if(n===eR){let e=r.injected;e&&await this.revokeProviderPermissions(e)}t?.emit?.("disconnect"),hw.removeItem(hf),hp.reset()},signMessage:async e=>{let t=hp.state.provider;if(!t)throw Error("connectionControllerClient:signMessage - provider is undefined");let r=(0,ha.isHexString)(e)?e:(0,ha.hexlify)((0,hl.toUtf8Bytes)(e));return await t.request({method:"personal_sign",params:[r,this.getAddress()]})},parseUnits:(e,t)=>(0,ht.parseUnits)(e,t),formatUnits:(e,t)=>(0,ht.formatUnits)(e,t),async estimateGas(e){let{chainId:t,provider:r,address:i}=hp.state;if(e.chainNamespace&&"eip155"!==e.chainNamespace)throw Error("connectionControllerClient:estimateGas - invalid chain namespace");if(!r)throw Error("connectionControllerClient:sendTransaction - provider is undefined");if(!i)throw Error("connectionControllerClient:sendTransaction - address is undefined");let n={from:e.address,to:e.to,data:e.data,type:0},s=new hs.BrowserProvider(r,t),o=new hr.JsonRpcSigner(s,i);return await o.estimateGas(n)},sendTransaction:async e=>{let{chainId:t,provider:r,address:i}=hp.state;if(e.chainNamespace&&"eip155"!==e.chainNamespace)throw Error("ethersClient:sendTransaction - invalid chain namespace");if(!r)throw Error("ethersClient:sendTransaction - provider is undefined");if(!i)throw Error("ethersClient:sendTransaction - address is undefined");let n={to:e.to,value:e.value,gasLimit:e.gas,gasPrice:e.gasPrice,data:e.data,type:0},s=new hs.BrowserProvider(r,t),o=new hr.JsonRpcSigner(s,i),a=await o.sendTransaction(n),l=await a.wait();return l?.hash||null},writeContract:async e=>{let{chainId:t,provider:r,address:i}=hp.state;if(!r)throw Error("ethersClient:writeContract - provider is undefined");if(!i)throw Error("ethersClient:writeContract - address is undefined");let n=new hs.BrowserProvider(r,t),s=new hr.JsonRpcSigner(n,i),o=new ho.Contract(e.tokenAddress,e.abi,s);if(!o||!e.method)throw Error("Contract method is undefined");let a=o[e.method];if(a)return await a(e.receiverAddress,e.tokenAmount);throw Error("Contract method is undefined")},getEnsAddress:async e=>{try{let t=hm.NetworkUtil.caipNetworkIdToNumber(this.appKit?.getCaipNetwork()?.id),r=null,i=!1;if(e?.endsWith(S.ConstantsUtil.WC_NAME_SUFFIX)&&(i=await this.appKit?.resolveWalletConnectName(e)||!1),1===t){let t=new hi.InfuraProvider("mainnet");r=await t.resolveName(e)}return r||i||!1}catch{return!1}},getEnsAvatar:async e=>{let{chainId:t}=hp.state;if(t&&1===t){let t=new hi.InfuraProvider("mainnet"),r=await t.getAvatar(e);if(r)return r}return!1}}}construct(e,t){if(!t.projectId)throw Error("web3modal:initialize - projectId is undefined");this.appKit=e,this.options=t,this.projectId=t.projectId,this.metadata=this.ethersConfig.metadata,this.defaultChain&&this.appKit?.setCaipNetwork(this.defaultChain),this.createProvider(),hp.subscribeKey("address",()=>{this.syncAccount()}),hp.subscribeKey("chainId",()=>{this.syncNetwork()}),this.appKit?.subscribeCaipNetworkChange(e=>{!this.getChainId()&&e&&hp.setChainId(hm.NetworkUtil.caipNetworkIdToNumber(e.id))}),this.appKit?.subscribeShouldUpdateToAddress(e=>{e&&hp.setAddress((0,hn.getAddress)(e))}),this.syncRequestedNetworks(this.chains,this.options?.chainImages),this.syncConnectors(this.ethersConfig),"u">typeof window&&(this.listenConnectors(!0),this.checkActive6963Provider()),this.appKit?.setEIP6963Enabled(this.ethersConfig.EIP6963),this.ethersConfig.injected&&this.checkActiveInjectedProvider(this.ethersConfig),(this.ethersConfig.auth?.email||this.ethersConfig.auth?.socials?.length)&&this.syncAuthConnector(this.options.projectId,this.ethersConfig.auth),this.ethersConfig.coinbase&&this.checkActiveCoinbaseProvider(this.ethersConfig)}
5044getState(){let e=this.appKit?.getState();return{...e,selectedNetworkId:hm.NetworkUtil.caipNetworkIdToNumber(e?.selectedNetworkId)}}subscribeState(e){return this.appKit?.subscribeState(t=>e({...t,selectedNetworkId:hm.NetworkUtil.caipNetworkIdToNumber(t.selectedNetworkId)}))}setAddress(e){let t=e?(0,hn.getAddress)(e):void 0;hp.setAddress(t)}getAddress(){let{address:e}=hp.state;return e?(0,hn.getAddress)(e):void 0}getError(){return hp.state.error}getChainId(){let e=hp.state.chainId,t=hm.NetworkUtil.caipNetworkIdToNumber(this.appKit?.getCaipNetwork()?.id);return e??t}getStatus(){return hp.state.status}getIsConnected(){return hp.state.isConnected}getWalletProvider(){return hp.state.provider}getWalletProviderType(){return hp.state.providerType}subscribeProvider(e){return hp.subscribe(e)}async disconnect(){let{provider:e,providerType:t}=hp.state;if(hw.removeItem(hf),hp.reset(),this.appKit?.setClientId(null),t===ej)await this.authProvider?.disconnect();else if(e&&("injected"===t||"eip6963"===t))await this.revokeProviderPermissions(e),e?.emit("disconnect");else if(("walletConnect"===t||"coinbaseWalletSDK"===t)&&e)try{hp.setError(void 0),await e.disconnect()}catch(e){hp.setError(e)}}createProvider(){return!this.walletConnectProviderInitPromise&&"u">typeof window&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider()),this.walletConnectProviderInitPromise}async initWalletConnectProvider(){let e=this.chains?this.chains.reduce((e,t)=>(e[t.chainId]=t.rpcUrl,e),{}):{},t={projectId:this.projectId,showQrModal:!1,rpcMap:e,optionalChains:[...this.chains.map(e=>e.chainId)],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:[""]}};this.walletConnectProvider=await he.init(t),await this.checkActiveWalletConnectProvider()}async revokeProviderPermissions(e){try{(await e.request({method:"wallet_getPermissions"})).find(e=>"eth_accounts"===e.parentCapability)&&await e.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch(e){console.info("Could not revoke permissions from wallet. Disconnecting...",e)}}
5044async getWalletConnectProvider(){if(!this.walletConnectProvider)try{hp.setError(void 0),await this.createProvider()}catch(e){hp.setError(e)}return this.walletConnectProvider}syncRequestedNetworks(e,t){let r=e?.map(e=>({id:`${eU}:${e.chainId}`,name:e.name,imageId:or[e.chainId],imageUrl:t?.[e.chainId],chain:S.ConstantsUtil.CHAIN.EVM}));this.appKit?.setRequestedCaipNetworks(r??[],this.chain)}async checkActiveWalletConnectProvider(){let e=await this.getWalletConnectProvider(),t=hw.getItem(hf);e&&t===eP&&await this.setWalletConnectProvider();let r=hp.state.isConnected;hp.setStatus(r?"connected":"disconnected")}checkActiveInjectedProvider(e){let t=e.injected,r=hw.getItem(hf);t&&r===eR&&(this.setInjectedProvider(e),this.watchInjected(e))}checkActiveCoinbaseProvider(e){let t=e.coinbase,r=hw.getItem(hf);t&&r===eN&&(t.accounts&&t.accounts?.length>0?(this.setCoinbaseProvider(e),this.watchCoinbase(e)):(hw.removeItem(hf),hp.reset()))}checkActive6963Provider(){let e=hw.getItem(hf);if(e){let t=this.EIP6963Providers.find(t=>t.info.name===e);t&&this.setEIP6963Provider(t.provider,t.info.name)}}async setWalletConnectProvider(){hw.setItem(hf,eP);let e=await this.getWalletConnectProvider();if(e){hp.setChainId(e.chainId),hp.setProviderType("walletConnect"),hp.setProvider(e),hp.setStatus("connected"),hp.setIsConnected(!0),this.appKit?.setAllAccounts(e.accounts.map(e=>({address:e,type:"eoa"})),this.chain);let t=e.signer?.session;for(let r of e.accounts){let e=t?.sessionProperties?.[r];e&&this.appKit?.addAddressLabel(r,e,this.chain)}this.setAddress(e.accounts?.[0]),this.watchWalletConnect()}}async setInjectedProvider(e){hw.setItem(hf,eR);let t=e.injected;if(t){let{addresses:r,chainId:i}=await hc.getUserInfo(t);r?.[0]&&i&&(hp.setChainId(i),hp.setProviderType("injected"),hp.setProvider(e.injected),hp.setStatus("connected"),hp.setIsConnected(!0),this.appKit?.setAllAccounts(r.map(e=>({address:e,type:"eoa"})),this.chain),this.setAddress(r[0]),this.watchCoinbase(e))}}async setEIP6963Provider(e,t){if(hw.setItem(hf,t),e){let{addresses:t,chainId:r}=await hc.getUserInfo(e);t?.[0]&&r&&(hp.setChainId(r),hp.setProviderType("eip6963"),hp.setProvider(e),hp.setStatus("connected"),hp.setIsConnected(!0),this.appKit?.setAllAccounts(t.map(e=>({address:e,type:"eoa"})),this.chain),this.setAddress(t[0]),this.watchEIP6963(e))}}async setCoinbaseProvider(e){hw.setItem(hf,eN);let t=e.coinbase;if(t){let{addresses:r,chainId:i}=await hc.getUserInfo(t);r?.[0]&&i&&(hp.setChainId(i),hp.setProviderType("coinbaseWalletSDK"),hp.setProvider(e.coinbase),hp.setStatus("connected"),hp.setIsConnected(!0),this.appKit?.setAllAccounts(r.map(e=>({address:e,type:"eoa"})),this.chain),this.setAddress(r[0]),this.watchCoinbase(e))}}
5044async setAuthProvider(){if(hw.setItem(hf,ej),this.authProvider){this.appKit?.setLoading(!0);let{address:e,chainId:t,smartAccountDeployed:r,preferredAccountType:i,accounts:n=[]}=await this.authProvider.connect({chainId:this.getChainId()}),{smartAccountEnabledNetworks:s}=await this.authProvider.getSmartAccountEnabledNetworks();this.appKit?.setSmartAccountEnabledNetworks(s,this.chain),e&&t&&(this.appKit?.setAllAccounts(n.length>0?n:[{address:e,type:i}],this.chain),hp.setChainId(hm.NetworkUtil.parseEvmChainId(t)),hp.setProviderType(ej),hp.setProvider(this.authProvider),hp.setStatus("connected"),hp.setIsConnected(!0),hp.setAddress(e),hp.setPreferredAccountType(i),this.appKit?.setSmartAccountDeployed(!!r,this.chain),this.watchAuth(),this.watchModal()),this.appKit?.setLoading(!1)}}async watchWalletConnect(){let e=await this.getWalletConnectProvider();function t(e){if(e){let t=hc.hexStringToNumber(e);hp.setChainId(t)}}let r=async e=>{e.length>0&&await this.setWalletConnectProvider()};e&&(e.on("disconnect",function i(){hw.removeItem(hf),hp.reset(),e?.removeListener("disconnect",i),e?.removeListener("accountsChanged",r),e?.removeListener("chainChanged",t)}),e.on("accountsChanged",r),e.on("chainChanged",t))}watchInjected(e){let t=e.injected;function r(e){let t=e?.[0];t?hp.setAddress((0,hn.getAddress)(t)):(hw.removeItem(hf),hp.reset())}function i(e){if(e){let t="string"==typeof e?hc.hexStringToNumber(e):Number(e);hp.setChainId(t)}}t&&(t.on("disconnect",function e(){hw.removeItem(hf),hp.reset(),t?.removeListener("disconnect",e),t?.removeListener("accountsChanged",r),t?.removeListener("chainChanged",i)}),t.on("accountsChanged",r),t.on("chainChanged",i))}watchEIP6963(e){let t=e=>{let t=e?.[0];t?(hp.setAddress((0,hn.getAddress)(t)),this.appKit?.setAllAccounts(e.map(e=>({address:e,type:"eoa"})),this.chain)):(this.appKit?.setAllAccounts([],this.chain),hw.removeItem(hf),hp.reset())};function r(e){if(e){let t="string"==typeof e?hc.hexStringToNumber(e):Number(e);hp.setChainId(t)}}e&&(e.on("disconnect",function i(){hw.removeItem(hf),hp.reset(),e.removeListener("disconnect",i),e.removeListener("accountsChanged",t),e.removeListener("chainChanged",r)}),e.on("accountsChanged",t),e.on("chainChanged",r))}watchCoinbase(e){let t=e.coinbase,r=hw.getItem(hf);function i(e){let t=e?.[0];t?hp.setAddress((0,hn.getAddress)(t)):(hw.removeItem(hf),hp.reset())}function n(e){if(e&&r===eN){let t=Number(e);hp.setChainId(t)}}t&&(t.on("disconnect",function e(){hw.removeItem(hf),hp.reset(),t?.removeListener("disconnect",e),t?.removeListener("accountsChanged",i),t?.removeListener("chainChanged",n)}),t.on("accountsChanged",i),t.on("chainChanged",n))}watchAuth(){this.authProvider&&(this.authProvider.onRpcRequest(e=>{rp.W3mFrameHelpers.checkIfRequestExists(e)?rp.W3mFrameHelpers.checkIfRequestIsSafe(e)||this.appKit?.handleUnsafeRPCRequest():(this.appKit?.open(),console.error(ef.W3mFrameRpcConstants.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:e.method}),setTimeout(()=>{this.appKit?.showErrorMessage(ef.W3mFrameRpcConstants.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300))}),this.authProvider.onRpcError(()=>{this.appKit?.isOpen()&&(this.appKit?.isTransactionStackEmpty()?this.appKit?.close():this.appKit?.popTransactionStack(!0))}),this.authProvider.onRpcSuccess((e,t)=>{rp.W3mFrameHelpers.checkIfRequestIsSafe(t)||(this.appKit?.isTransactionStackEmpty()?this.appKit?.close():this.appKit?.popTransactionStack())}),this.authProvider.onNotConnected(()=>{this.appKit?.setIsConnected(!1,this.chain),this.appKit?.setLoading(!1)}),this.authProvider.onIsConnected(({preferredAccountType:e})=>{this.appKit?.setIsConnected(!0,this.chain),this.appKit?.setLoading(!1),hp.setPreferredAccountType(e)}),this.authProvider.onSetPreferredAccount(({address:e,type:t})=>{if(!e)return;this.appKit?.setLoading(!0);let r=hm.NetworkUtil.caipNetworkIdToNumber(this.appKit?.getCaipNetwork()?.id);hp.setAddress(e),hp.setChainId(r),hp.setStatus("connected"),hp.setIsConnected(!0),hp.setPreferredAccountType(t),this.syncAccount().then(()=>this.appKit?.setLoading(!1))}))}watchModal(){this.authProvider&&this.subscribeState(e=>{e.open||this.authProvider?.rejectRpcRequests()})}async syncAccount(){let e=hp.state.address,t=hp.state.chainId,r=hp.state.isConnected,i=hp.state.preferredAccountType;if(this.appKit?.resetAccount(this.chain),r&&e&&t){let n=`${eU}:${t}:${e}`;this.appKit?.setIsConnected(r,this.chain),this.appKit?.setPreferredAccountType(i,this.chain),this.appKit?.setCaipAddress(n,this.chain),this.syncConnectedWalletInfo();let s=this.chains.find(e=>e.chainId===t);s?.explorerUrl&&this.appKit?.setAddressExplorerUrl(`${s.explorerUrl}/address/${e}`,this.chain),await Promise.all([this.syncProfile(e),this.syncBalance(e),this.appKit?.setApprovedCaipNetworksData(this.chain)]),this.hasSyncedConnectedAccount=!0}else!r&&this.hasSyncedConnectedAccount&&(this.appKit?.resetWcConnection(),this.appKit?.resetNetwork(),this.appKit?.setAllAccounts([],this.chain))}async syncNetwork(){let e=this.options?.chainImages,t=hp.state.address,r=hp.state.chainId,i=hp.state.isConnected;if(this.chains){let n=this.chains.find(e=>e.chainId===r);if(n){let s=`${eU}:${n.chainId}`;if(this.appKit?.setCaipNetwork({id:s,name:n.name,imageId:or[n.chainId],imageUrl:e?.[n.chainId],chain:this.chain}),i&&t){let e=`${eU}:${r}:${t}`;if(this.appKit?.setCaipAddress(e,this.chain),n.explorerUrl){let e=`${n.explorerUrl}/address/${t}`;this.appKit?.setAddressExplorerUrl(e,this.chain)}else this.appKit?.setAddressExplorerUrl(void 0,this.chain);this.hasSyncedConnectedAccount&&(await this.syncProfile(t),await this.syncBalance(t))}}else i&&this.appKit?.setCaipNetwork({id:`${eU}:${r}`,chain:this.chain})}}async syncWalletConnectName(e){try{let t=await this.appKit?.getWalletConnectName(e);
5044if(t?.[0]){let e=t[0];this.appKit?.setProfileName(e.name,this.chain)}else this.appKit?.setProfileName(null,this.chain)}catch{this.appKit?.setProfileName(null,this.chain)}}async syncProfile(e){let t=hp.state.chainId;try{let t=await this.appKit?.fetchIdentity({address:e}),r=t?.name,i=t?.avatar;this.appKit?.setProfileName(r,this.chain),this.appKit?.setProfileImage(i,this.chain),r||await this.syncWalletConnectName(e)}catch{if(1===t){let t=new hi.InfuraProvider("mainnet"),r=await t.lookupAddress(e),i=await t.getAvatar(e);r?this.appKit?.setProfileName(r,this.chain):await this.syncWalletConnectName(e),i&&this.appKit?.setProfileImage(i,this.chain)}else await this.syncWalletConnectName(e),this.appKit?.setProfileImage(null,this.chain)}}async syncBalance(e){let t=hp.state.chainId;if(t&&this.chains){let r=this.chains.find(e=>e.chainId===t);if(r){let i=new hr.JsonRpcProvider(r.rpcUrl,{chainId:t,name:r.name});if(i&&i.ready){let t=await i.getBalance(e),n=(0,ht.formatEther)(t);this.appKit?.setBalance(n,r.currency,this.chain)}}}}syncConnectedWalletInfo(){let e=hw.getItem(hf),t=hp.state.providerType;if(t===eL){if(e){let t=this.EIP6963Providers.find(t=>t.info.name===e);t&&this.appKit?.setConnectedWalletInfo({...t.info},this.chain)}}else if(t===eP){let e=hp.state.provider;e.session&&this.appKit?.setConnectedWalletInfo({...e.session.peer.metadata,name:e.session.peer.metadata.name,icon:e.session.peer.metadata.icons?.[0]},this.chain)}else if(t===eN){let e=this.appKit?.getConnectors().find(e=>e.id===eN);this.appKit?.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.appKit?.getConnectorImage(e)},this.chain)}else e&&this.appKit?.setConnectedWalletInfo({name:e},this.chain)}async switchNetwork(e){let t=hp.state.provider,r=hp.state.providerType;if(this.chains){let i=this.chains.find(t=>t.chainId===e);if(r===eP&&i){if(t)try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:hc.numberToHexString(i.chainId)}]}),hp.setChainId(e)}catch(r){let e=r?.message;if(/(?<temp1>user rejected)/u.test(e?.toLowerCase()))throw Error("Chain is not supported");await hc.addEthereumChain(t,i)}}else if(r===eR&&i){if(t)try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:hc.numberToHexString(i.chainId)}]}),hp.setChainId(i.chainId)}catch(e){if(4902===e.code||5e3===e.code||e?.data?.originalError?.code===4902)await hc.addEthereumChain(t,i);else throw Error("Chain is not supported")}}else if(r===eL&&i){if(t)try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:hc.numberToHexString(i.chainId)}]}),hp.setChainId(i.chainId)}catch(e){if(4902===e.code||5e3===e.code||e?.data?.originalError?.code===4902)await hc.addEthereumChain(t,i);else throw Error("Chain is not supported")}}else if(r===eN&&i){if(t)try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:hc.numberToHexString(i.chainId)}]}),hp.setChainId(i.chainId)}catch(e){if(4902===e.code||5e3===e.code||e?.data?.originalError?.code===4902)await hc.addEthereumChain(t,i);else throw Error("Error switching network")}}else if(r===ej&&this.authProvider&&i?.chainId)try{this.appKit?.setLoading(!0),await this.authProvider.switchNetwork(i?.chainId),hp.setChainId(i.chainId);let{address:e,preferredAccountType:t}=await this.authProvider.connect({chainId:i?.chainId});hp.setAddress(e),hp.setPreferredAccountType(t),await this.syncAccount()}catch{throw Error("Switching chain failed")}finally{this.appKit?.setLoading(!1)}}}syncConnectors(e){let t=[],r=os[eP];if(r&&t.push({id:eP,explorerId:ot[eP],imageId:oi[eP],imageUrl:this.options?.connectorImages?.[eP],name:on[eP],type:r,chain:this.chain}),e.injected){let e=os[eR];e&&t.push({id:eR,explorerId:ot[eR],imageId:oi[eR],imageUrl:this.options?.connectorImages?.[eR],name:on[eR],type:e,chain:this.chain})}e.coinbase&&t.push({id:eN,explorerId:ot[eN],imageId:oi[eN],imageUrl:this.options?.connectorImages?.[eN],name:on[eN],type:"EXTERNAL",chain:this.chain}),this.appKit?.setConnectors(t)}async syncAuthConnector(e,t){if("u">typeof window){this.authProvider=new hg.W3mFrameProvider(e),this.appKit?.addConnector({id:ej,type:"AUTH",name:"Auth",provider:this.authProvider,email:t?.email,socials:t?.socials,showWallets:t?.showWallets===void 0||t.showWallets,chain:this.chain,walletFeatures:t?.walletFeatures}),this.appKit?.setLoading(!0);let r=this.authProvider.getLoginEmailUsed();this.appKit?.setLoading(r);let{isConnected:i}=await this.authProvider.isConnected();i?await this.setAuthProvider():this.appKit?.setLoading(!1)}}eip6963EventHandler(e){if(e.detail){let{info:t,provider:r}=e.detail,i=this.appKit?.getConnectors();if(!i?.find(e=>e.name===t.name)){let e=os[eL];e&&(this.appKit?.addConnector({id:eL,type:e,imageUrl:t.icon??this.options?.connectorImages?.[eL],name:t.name,provider:r,info:t,chain:this.chain}),this.EIP6963Providers.push({provider:r,info:t}))}}}listenConnectors(e){if("u">typeof window&&e){let e=this.eip6963EventHandler.bind(this);window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider"))}}}var hb=e.i(471554);e.s(["defaultConfig",0,function(e){let t,r,{enableEIP6963:i=!0,enableCoinbase:n=!0,enableInjected:s=!0,auth:o,metadata:a}=e,l={metadata:a};return s&&(l.injected=t||("u"<typeof window?void 0:window.ethereum?t=window.ethereum:void 0)),n&&(l.coinbase=r?r:"u"<typeof window?void 0:r=new hb.CoinbaseWalletSDK({appName:a.name,appLogoUrl:a.icons[0],appChainIds:e.chains?.map(e=>e.chainId)||[1,84532]}).makeWeb3Provider({options:e.coinbasePreference||"all"})),i&&(l.EIP6963=!0),l.auth={email:!0,showWallets:!0,walletFeatures:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],...o},l}],186251);var hC=e.i(271645);function hx(e){e&&(i=e)}e.s(["getWeb3Modal",0,hx,"useWeb3Modal",0,function(){if(!i)throw Error('Please call "createWeb3Modal" before using "useWeb3Modal" hook');return{open:async function(e){await i?.open(e)},close:async function(){await i?.close()}}}],909014);var h_=e.i(334138),hE=e.i(536496);let hk={get url(){return`file://${e.P("node_modules/valtio/esm/react.mjs")}`}},{use:hS}=hC.default,{useSyncExternalStore:hI}=hE.default,hA=new WeakMap;function hT(e,t){let r,i=null==t?void 0:t.sync,n=(0,hC.useRef)(),s=(0,hC.useRef)(),o=!0,a=hI((0,hC.useCallback)(t=>{let r=(0,hh.subscribe)(e,t,i);return t(),r},[e,i]),()=>{let t=(0,hh.snapshot)(e,hS);try{if(!o&&n.current&&s.current&&!(0,h_.isChanged)(n.current,t,s.current,new WeakMap))return n.current}catch(e){}return t},()=>(0,hh.snapshot)(e,hS));o=!1;let l=new WeakMap;(0,hC.useEffect)(()=>{n.current=a,s.current=l}),(hk.env?hk.env.MODE:void 0)!=="production"&&(r=(0,hC.useRef)(),(0,hC.useEffect)(()=>{r.current=(0,h_.affectedToPathList)(a,l,!0)}),(0,hC.useDebugValue)(r.current));let c=(0,hC.useMemo)(()=>new WeakMap,[]);return(0,h_.createProxy)(a,l,c,hA)}e.s(["createWeb3Modal",0,function(e){return s=new hv({ethersConfig:e.ethersConfig,siweConfig:e.siweConfig,chains:e.chains,defaultChain:e.defaultChain}),hx(n=new A({...e,defaultChain:s.defaultChain,adapters:[s],sdkType:"w3m",sdkVersion:"react-ethers-5.1.11"})),n},"useWeb3ModalAccount",0,function(){let{address:e,isConnected:t,chainId:r,status:i}=hT(hp.state);return{address:e,isConnected:t,chainId:r,status:i}},"useWeb3ModalProvider",0,function(){let{provider:e,providerType:t}=hT(hp.state);return{walletProvider:e,walletProviderType:t}}],747319)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.