vendor: 4,205 bytes, lines 1-2
1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PhArrowCircleDown-C8sfqb_q.js","assets/property-D7F1pPU6.js","assets/PhArrowClockwise-DtPSkNiy.js","assets/PhArrowDown-BA6bqI-h.js","assets/PhArrowLeft-BagVykqk.js","assets/PhArrowRight-meiNum-s.js","assets/PhArrowSquareOut-DuB9-oNy.js","assets/PhArrowsDownUp-Bwprpk5p.js","assets/PhArrowsLeftRight-CBa1AHPv.js","assets/PhArrowUp-BNML-ssX.js","assets/PhArrowUpRight-E9p7twEV.js","assets/PhArrowsClockwise-DPavEfmI.js","assets/PhBank-ChEGvcrG.js","assets/PhBrowser-DAHUmQYP.js","assets/PhCaretDown-CVPAhONG.js","assets/PhCaretLeft-Cjnn7efI.js","assets/PhCaretRight-BOw6b8E-.js","assets/PhCaretUp-CRyMReh0.js","assets/PhCheck-BjfM-ObM.js","assets/PhCircleHalf-Dw6KHNdh.js","assets/PhClock-DgL7-xE_.js","assets/PhCompass-Dfw_iYBq.js","assets/PhCopy-CBFzCcT0.js","assets/PhCreditCard-DxzeozHs.js","assets/PhCurrencyDollar-DBM7izx7.js","assets/PhDesktop-BQJ0jJEw.js","assets/PhDeviceMobile-B5SC4g2S.js","assets/PhDotsThree-89amEoiE.js","assets/PhVault-tuRA-lQz.js","assets/PhEnvelope-DheiVAl2.js","assets/PhFunnelSimple-D2VcnCQ3.js","assets/PhGlobe-BOWfnrZq.js","assets/PhIdentificationCard-CoKk3ytY.js","assets/PhImage-DYKjtKeZ.js","assets/PhInfo-Wr7tBEGO.js","assets/PhLightbulb-DfclYvXe.js","assets/PhMagnifyingGlass-ptT4GDlT.js","assets/PhPaperPlaneRight-DlGPga9t.js","assets/PhPlus-Bv1d-A17.js","assets/PhPower-i0OFmFkP.js","assets/PhPuzzlePiece-BIQHBxgR.js","assets/PhQrCode-DYymT0U6.js","assets/PhQuestion-V-t4d9L8.js","assets/PhQuestionMark-BlrV0OLv.js","assets/PhSealCheck-DJg6zkcd.js","assets/PhSignOut-3LIUMyak.js","assets/PhSpinner-CgS0DtZv.js","assets/PhTrash-Bjt7wbP4.js","assets/PhUser-DHlhekvv.js","assets/PhWallet-CzKiZSmU.js","assets/PhWarning-VwPb-1BV.js","assets/PhWarningCircle-B82beykt.js","assets/PhX-iUNICe98.js"])))=>i.map(i=>d[i]); 2var g$e=Object.defineProperty;var m$e=(e,t,n)=>t in e?g$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Lt=(e,t,n)=>m$e(e,typeof t!="symbol"?t+"":t,n);import{c as w$e,s as y$e,H as b$e,a as Mm,u as v$e,b as uZ,d as dZ,t as E$e,e as hZ,f as C$e,g as ple,r as $$e,h as x$e,i as I$e,j as S$e,k as mf,l as gle,m as g6,n as m6,o as w6,p as y6,q as wq,v as wf,w as yq}from"./vendor-sui-Brbyv1yG.js";var WP={},v3={},fZ;function A$e(){if(fZ)return v3;fZ=1,v3.byteLength=a,v3.toByteArray=l,v3.fromByteArray=h;for(var e=[],t=[],n=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=r.length;s<i;++s)e[s]=r[s],t[r.charCodeAt(s)]=s;t[45]=62,t[95]=63;function o(f){var g=f.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var p=f.indexOf("=");p===-1&&(p=g);var m=p===g?0:4-p%4;return[p,m]}function a(f){var g=o(f),p=g[0],m=g[1];return(p+m)*3/4-m}function c(f,g,p){return(g+p)*3/4-p}function l(f){var g,p=o(f),m=p[0],w=p[1],C=new n(c(f,m,w)),E=0,b=w>0?m-4:m,S;for(S=0;S<b;S+=4)g=t[f.charCodeAt(S)]<<18|t[f.charCodeAt(S+1)]<<12|t[f.charCodeAt(S+2)]<<6|t[f.charCodeAt(S+3)],C[E++]=g>>16&255,C[E++]=g>>8&255,C[E++]=g&255;return w===2&&(g=t[f.charCodeAt(S)]<<2|t[f.charCodeAt(S+1)]>>4,C[E++]=g&255),w===1&&(g=t[f.charCodeAt(S)]<<10|t[f.charCodeAt(S+1)]<<4|t[f.charCodeAt(S+2)]>>2,C[E++]=g>>8&255,C[E++]=g&255),C}function u(f){return e[f>>18&63]+e[f>>12&63]+e[f>>6&63]+e[f&63]}function d(f,g,p){for(var m,w=[],C=g;C<p;C+=3)m=(f[C]<<16&16711680)+(f[C+1]<<8&65280)+(f[C+2]&255),w.push(u(m));return w.join("")}function h(f){for(var g,p=f.length,m=p%3,w=[],C=16383,E=0,b=p-m;E<b;E+=C)w.push(d(f,E,E+C>b?b:E+C));return m===1?(g=f[p-1],w.push(e[g>>2]+e[g<<4&63]+"==")):m===2&&(g=(f[p-2]<<8)+f[p-1],w.push(e[g>>10]+e[g>>4&63]+e[g<<2&63]+"=")),w.join("")}return v3}var yx={};var pZ;function _$e(){return pZ||(pZ=1,yx.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?s-1:0,h=n?-1:1,f=e[t+d];for(d+=h,i=f&(1<<-u)-1,f>>=-u,u+=a;u>0;i=i*256+e[t+d],d+=h,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=h,u-=8);if(i===0)i=1-l;else{if(i===c)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-l}return(f?-1:1)*o*Math.pow(2,i-r)},yx.write=function(e,t,n,r,s,i){var o,a,c,l=i*8-s-1,u=(1<<l)-1,d=u>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,g=r?1:-1,p=t<0||t===0&&1
vendor: 21,931 bytes, line 2
2/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?t+=h/c:t+=h*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=u?(a=0,o=u):o+d>=1?(a=(t*c-1)*Math.pow(2,s),o=o+d):(a=t*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;e[n+f]=a&255,f+=g,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[n+f]=o&255,f+=g,o/=256,l-=8);e[n+f-g]|=p*128}),yx}var gZ;function N$e(){return gZ||(gZ=1,(function(e){const t=A$e(),n=_$e(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=C,e.INSPECT_MAX_BYTES=50;const s=2147483647;e.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const W=new Uint8Array(1),L={foo:function(){return 42}};return Object.setPrototypeOf(L,Uint8Array.prototype),Object.setPrototypeOf(W,L),W.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(W){if(W>s)throw new RangeError('The value "'+W+'" is invalid for option "size"');const L=new Uint8Array(W);return Object.setPrototypeOf(L,a.prototype),L}function a(W,L,M){if(typeof W=="number"){if(typeof L=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(W)}return c(W,L,M)}a.poolSize=8192;function c(W,L,M){if(typeof W=="string")return h(W,L);if(ArrayBuffer.isView(W))return g(W);if(W==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof W);if(kc(W,ArrayBuffer)||W&&kc(W.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(kc(W,SharedArrayBuffer)||W&&kc(W.buffer,SharedArrayBuffer)))return p(W,L,M);if(typeof W=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Y=W.valueOf&&W.valueOf();if(Y!=null&&Y!==W)return a.from(Y,L,M);const ne=m(W);if(ne)return ne;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof W[Symbol.toPrimitive]=="function")return a.from(W[Symbol.toPrimitive]("string"),L,M);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof W)}a.from=function(W,L,M){return c(W,L,M)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function l(W){if(typeof W!="number")throw new TypeError('"size" argument must be of type number');if(W<0)throw new RangeError('The value "'+W+'" is invalid for option "size"')}function u(W,L,M){return l(W),W<=0?o(W):L!==void 0?typeof M=="string"?o(W).fill(L,M):o(W).fill(L):o(W)}a.alloc=function(W,L,M){return u(W,L,M)};function d(W){return l(W),o(W<0?0:w(W)|0)}a.allocUnsafe=function(W){return d(W)},a.allocUnsafeSlow=function(W){return d(W)};function h(W,L){if((typeof L!="string"||L==="")&&(L="utf8"),!a.isEncoding(L))throw new TypeError("Unknown encoding: "+L);const M=E(W,L)|0;let Y=o(M);const ne=Y.write(W,L);return ne!==M&&(Y=Y.slice(0,ne)),Y}function f(W){const L=W.length<0?0:w(W.length)|0,M=o(L);for(let Y=0;Y<L;Y+=1)M[Y]=W[Y]&255;return M}function g(W){if(kc(W,Uint8Array)){const L=new Uint8Array(W);return p(L.buffer,L.byteOffset,L.byteLength)}return f(W)}function p(W,L,M){if(L<0||W.byteLength<L)throw new RangeError('"offset" is outside of buffer bounds');if(W.byteLength<L+(M||0))throw new RangeError('"length" is outside of buffer bounds');let Y;return L===void 0&&M===void 0?Y=new Uint8Array(W):M===void 0?Y=new Uint8Array(W,L):Y=new Uint8Array(W,L,M),Object.setPrototypeOf(Y,a.prototype),Y}function m(W){if(a.isBuffer(W)){const L=w(W.length)|0,M=o(L);return M.length===0||W.copy(M,0,0,L),M}if(W.length!==void 0)return typeof W.length!="number"||Fb(W.length)?o(0):f(W);if(W.type==="Buffer"&&Array.isArray(W.data))return f(W.data)}function w(W){if(W>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return W|0}function C(W){return+W!=W&&(W=0),a.alloc(+W)}a.isBuffer=function(L){return L!=null&&L._isBuffer===!0&&L!==a.prototype},a.compare=function(L,M){if(kc(L,Uint8Array)&&(L=a.from(L,L.offset,L.byteLength)),kc(M,Uint8Array)&&(M=a.from(M,M.offset,M.byteLength)),!a.isBuffer(L)||!a.isBuffer(M))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(L===M)return 0;let Y=L.length,ne=M.length;for(let ue=0,me=Math.min(Y,ne);ue<me;++ue)if(L[ue]!==M[ue]){Y=L[ue],ne=M[ue];break}return Y<ne?-1:ne<Y?1:0},a.isEncoding=function(L){switch(String(L).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(L,M){if(!Array.isArray(L))throw new TypeError('"list" argument must be an Array of Buffers');if(L.length===0)return a.alloc(0);let Y;if(M===void 0)for(M=0,Y=0;Y<L.length;++Y)M+=L[Y].length;const ne=a.allocUnsafe(M);let ue=0;for(Y=0;Y<L.length;++Y){let me=L[Y];if(kc(me,Uint8Array))ue+me.length>ne.length?(a.isBuffer(me)||(me=a.from(me)),me.copy(ne,ue)):Uint8Array.prototype.set.call(ne,me,ue);else if(a.isBuffer(me))me.copy(ne,ue);else throw new TypeError('"list" argument must be an Array of Buffers');ue+=me.length}return ne};function E(W,L){if(a.isBuffer(W))return W.length;if(ArrayBuffer.isView(W)||kc(W,ArrayBuffer))return W.byteLength;if(typeof W!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof W);const M=W.length,Y=arguments.length>2&&arguments[2]===!0;if(!Y&&M===0)return 0;let ne=!1;for(;;)switch(L){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return y3(W).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return b3(W).length;default:if(ne)return Y?-1:y3(W).length;L=(""+L).toLowerCase(),ne=!0}}a.byteLength=E;function b(W,L,M){let Y=!1;if((L===void 0||L<0)&&(L=0),L>this.length||((M===void 0||M>this.length)&&(M=this.length),M<=0)||(M>>>=0,L>>>=0,M<=L))return"";for(W||(W="utf8");;)switch(W){case"hex":return k(this,L,M);case"utf8":case"utf-8":return _(this,L,M);case"ascii":return R(this,L,M);case"latin1":case"binary":return B(this,L,M);case"base64":return P(this,L,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,L,M);default:if(Y)throw new TypeError("Unknown encoding: "+W);W=(W+"").toLowerCase(),Y=!0}}a.prototype._isBuffer=!0;function S(W,L,M){const Y=W[L];W[L]=W[M],W[M]=Y}a.prototype.swap16=function(){const L=this.length;if(L%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let M=0;M<L;M+=2)S(this,M,M+1);return this},a.prototype.swap32=function(){const L=this.length;if(L%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let M=0;M<L;M+=4)S(this,M,M+3),S(this,M+1,M+2);return this},a.prototype.swap64=function(){const L=this.length;if(L%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let M=0;M<L;M+=8)S(this,M,M+7),S(this,M+1,M+6),S(this,M+2,M+5),S(this,M+3,M+4);return this},a.prototype.toString=function(){const L=this.length;return L===0?"":arguments.length===0?_(this,0,L):b.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(L){if(!a.isBuffer(L))throw new TypeError("Argument must be a Buffer");return this===L?!0:a.compare(this,L)===0},a.prototype.inspect=function(){let L="";const M=e.INSPECT_MAX_BYTES;return L=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(L+=" ... "),"<Buffer "+L+">"},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(L,M,Y,ne,ue){if(kc(L,Uint8Array)&&(L=a.from(L,L.offset,L.byteLength)),!a.isBuffer(L))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof L);if(M===void 0&&(M=0),Y===void 0&&(Y=L?L.length:0),ne===void 0&&(ne=0),ue===void 0&&(ue=this.length),M<0||Y>L.length||ne<0||ue>this.length)throw new RangeError("out of range index");if(ne>=ue&&M>=Y)return 0;if(ne>=ue)return-1;if(M>=Y)return 1;if(M>>>=0,Y>>>=0,ne>>>=0,ue>>>=0,this===L)return 0;let me=ue-ne,pn=Y-M;const as=Math.min(me,pn),Vr=this.slice(ne,ue),cs=L.slice(M,Y);for(let wr=0;wr<as;++wr)if(Vr[wr]!==cs[wr]){me=Vr[wr],pn=cs[wr];break}return me<pn?-1:pn<me?1:0};function v(W,L,M,Y,ne){if(W.length===0)return-1;if(typeof M=="string"?(Y=M,M=0):M>2147483647?M=2147483647:M<-2147483648&&(M=-2147483648),M=+M,Fb(M)&&(M=ne?0:W.length-1),M<0&&(M=W.length+M),M>=W.length){if(ne)return-1;M=W.length-1}else if(M<0)if(ne)M=0;else return-1;if(typeof L=="string"&&(L=a.from(L,Y)),a.isBuffer(L))return L.length===0?-1:x(W,L,M,Y,ne);if(typeof L=="number")return L=L&255,typeof Uint8Array.prototype.indexOf=="function"?ne?Uint8Array.prototype.indexOf.call(W,L,M):Uint8Array.prototype.lastIndexOf.call(W,L,M):x(W,[L],M,Y,ne);throw new TypeError("val must be string, number or Buffer")}function x(W,L,M,Y,ne){let ue=1,me=W.length,pn=L.length;if(Y!==void 0&&(Y=String(Y).toLowerCase(),Y==="ucs2"||Y==="ucs-2"||Y==="utf16le"||Y==="utf-16le")){if(W.length<2||L.length<2)return-1;ue=2,me/=2,pn/=2,M/=2}function as(cs,wr){return ue===1?cs[wr]:cs.readUInt16BE(wr*ue)}let Vr;if(ne){let cs=-1;for(Vr=M;Vr<me;Vr++)if(as(W,Vr)===as(L,cs===-1?0:Vr-cs)){if(cs===-1&&(cs=Vr),Vr-cs+1===pn)return cs*ue}else cs!==-1&&(Vr-=Vr-cs),cs=-1}else for(M+pn>me&&(M=me-pn),Vr=M;Vr>=0;Vr--){let cs=!0;for(let wr=0;wr<pn;wr++)if(as(W,Vr+wr)!==as(L,wr)){cs=!1;break}if(cs)return Vr}return-1}a.prototype.includes=function(L,M,Y){return this.indexOf(L,M,Y)!==-1},a.prototype.indexOf=function(L,M,Y){return v(this,L,M,Y,!0)},a.prototype.lastIndexOf=function(L,M,Y){return v(this,L,M,Y,!1)};function A(W,L,M,Y){M=Number(M)||0;const ne=W.length-M;Y?(Y=Number(Y),Y>ne&&(Y=ne)):Y=ne;const ue=L.length;Y>ue/2&&(Y=ue/2);let me;for(me=0;me<Y;++me){const pn=parseInt(L.substr(me*2,2),16);if(Fb(pn))return me;W[M+me]=pn}return me}function I(W,L,M,Y){return X0(y3(L,W.length-M),W,M,Y)}function O(W,L,M,Y){return X0(qP(L),W,M,Y)}function N(W,L,M,Y){return X0(b3(L),W,M,Y)}function T(W,L,M,Y){return X0(gx(L,W.length-M),W,M,Y)}a.prototype.write=function(L,M,Y,ne){if(M===void 0)ne="utf8",Y=this.length,M=0;else if(Y===void 0&&typeof M=="string")ne=M,Y=this.length,M=0;else if(isFinite(M))M=M>>>0,isFinite(Y)?(Y=Y>>>0,ne===void 0&&(ne="utf8")):(ne=Y,Y=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ue=this.length-M;if((Y===void 0||Y>ue)&&(Y=ue),L.length>0&&(Y<0||M<0)||M>this.length)throw new RangeError("Attempt to write outside buffer bounds");ne||(ne="utf8");let me=!1;for(;;)switch(ne){case"hex":return A(this,L,M,Y);case"utf8":case"utf-8":return I(this,L,M,Y);case"ascii":case"latin1":case"binary":return O(this,L,M,Y);case"base64":return N(this,L,M,Y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,L,M,Y);default:if(me)throw new TypeError("Unknown encoding: "+ne);ne=(""+ne).toLowerCase(),me=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(W,L,M){return L===0&&M===W.length?t.fromByteArray(W):t.fromByteArray(W.slice(L,M))}function _(W,L,M){M=Math.min(W.length,M);const Y=[];let ne=L;for(;ne<M;){const ue=W[ne];let me=null,pn=ue>239?4:ue>223?3:ue>191?2:1;if(ne+pn<=M){let as,Vr,cs,wr;switch(pn){case 1:ue<128&&(me=ue);break;case 2:as=W[ne+1],(as&192)===128&&(wr=(ue&31)<<6|as&63,wr>127&&(me=wr));break;case 3:as=W[ne+1],Vr=W[ne+2],(as&192)===128&&(Vr&192)===128&&(wr=(ue&15)<<12|(as&63)<<6|Vr&63,wr>2047&&(wr<55296||wr>57343)&&(me=wr));break;case 4:as=W[ne+1],Vr=W[ne+2],cs=W[ne+3],(as&192)===128&&(Vr&192)===128&&(cs&192)===128&&(wr=(ue&15)<<18|(as&63)<<12|(Vr&63)<<6|cs&63,wr>65535&&wr<1114112&&(me=wr))}}me===null?(me=65533,pn=1):me>65535&&(me-=65536,Y.push(me>>>10&1023|55296),me=56320|me&1023),Y.push(me),ne+=pn}return $(Y)}const y=4096;function $(W){const L=W.length;if(L<=y)return String.fromCharCode.apply(String,W);let M="",Y=0;for(;Y<L;)M+=String.fromCharCode.apply(String,W.slice(Y,Y+=y));return M}function R(W,L,M){let Y="";M=Math.min(W.length,M);for(let ne=L;ne<M;++ne)Y+=String.fromCharCode(W[ne]&127);return Y}function B(W,L,M){let Y="";M=Math.min(W.length,M);for(let ne=L;ne<M;++ne)Y+=String.fromCharCode(W[ne]);return Y}function k(W,L,M){const Y=W.length;(!L||L<0)&&(L=0),(!M||M<0||M>Y)&&(M=Y);let ne="";for(let ue=L;ue<M;++ue)ne+=mx[W[ue]];return ne}function D(W,L,M){const Y=W.slice(L,M);let ne="";for(let ue=0;ue<Y.length-1;ue+=2)ne+=String.fromCharCode(Y[ue]+Y[ue+1]*256);return ne}a.prototype.slice=function(L,M){const Y=this.length;L=~~L,M=M===void 0?Y:~~M,L<0?(L+=Y,L<0&&(L=0)):L>Y&&(L=Y),M<0?(M+=Y,M<0&&(M=0)):M>Y&&(M=Y),M<L&&(M=L);const ne=this.subarray(L,M);return Object.setPrototypeOf(ne,a.prototype),ne};function U(W,L,M){if(W%1!==0||W<0)throw new RangeError("offset is not uint");if(W+L>M)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(L,M,Y){L=L>>>0,M=M>>>0,Y||U(L,M,this.length);let ne=this[L],ue=1,me=0;for(;++me<M&&(ue*=256);)ne+=this[L+me]*ue;return ne},a.prototype.readUintBE=a.prototype.readUIntBE=function(L,M,Y){L=L>>>0,M=M>>>0,Y||U(L,M,this.length);let ne=this[L+--M],ue=1;for(;M>0&&(ue*=256);)ne+=this[L+--M]*ue;return ne},a.prototype.readUint8=a.prototype.readUInt8=function(L,M){return L=L>>>0,M||U(L,1,this.length),this[L]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(L,M){return L=L>>>0,M||U(L,2,this.length),this[L]|this[L+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(L,M){return L=L>>>0,M||U(L,2,this.length),this[L]<<8|this[L+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(L,M){return L=L>>>0,M||U(L,4,this.length),(this[L]|this[L+1]<<8|this[L+2]<<16)+this[L+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(L,M){return L=L>>>0,M||U(L,4,this.length),this[L]*16777216+(this[L+1]<<16|this[L+2]<<8|this[L+3])},a.prototype.readBigUInt64LE=Hu(function(L){L=L>>>0,be(L,"offset");const M=this[L],Y=this[L+7];(M===void 0||Y===void 0)&&Me(L,this.length-8);const ne=M+this[++L]*2**8+this[++L]*2**16+this[++L]*2**24,ue=this[++L]+this[++L]*2**8+this[++L]*2**16+Y*2**24;return BigInt(ne)+(BigInt(ue)<<BigInt(32))}),a.prototype.readBigUInt64BE=Hu(function(L){L=L>>>0,be(L,"offset");const M=this[L],Y=this[L+7];(M===void 0||Y===void 0)&&Me(L,this.length-8);const ne=M*2**24+this[++L]*2**16+this[++L]*2**8+this[++L],ue=this[++L]*2**24+this[++L]*2**16+this[++L]*2**8+Y;return(BigInt(ne)<<BigInt(32))+BigInt(ue)}),a.prototype.readIntLE=function(L,M,Y){L=L>>>0,M=M>>>0,Y||U(L,M,this.length);let ne=this[L],ue=1,me=0;for(;++me<M&&(ue*=256);)ne+=this[L+me]*ue;return ue*=128,ne>=ue&&(ne-=Math.pow(2,8*M)),ne},a.prototype.readIntBE=function(L,M,Y){L=L>>>0,M=M>>>0,Y||U(L,M,this.length);let ne=M,ue=1,me=this[L+--ne];for(;ne>0&&(ue*=256);)me+=this[L+--ne]*ue;return ue*=128,me>=ue&&(me-=Math.pow(2,8*M)),me},a.prototype.readInt8=function(L,M){return L=L>>>0,M||U(L,1,this.length),this[L]&128?(255-this[L]+1)*-1:this[L]},a.prototype.readInt16LE=function(L,M){L=L>>>0,M||U(L,2,this.length);const Y=this[L]|this[L+1]<<8;return Y&32768?Y|4294901760:Y},a.prototype.readInt16BE=function(L,M){L=L>>>0,M||U(L,2,this.length);const Y=this[L+1]|this[L]<<8;return Y&32768?Y|4294901760:Y},a.prototype.readInt32LE=function(L,M){return L=L>>>0,M||U(L,4,this.length),this[L]|this[L+1]<<8|this[L+2]<<16|this[L+3]<<24},a.prototype.readInt32BE=function(L,M){return L=L>>>0,M||U(L,4,this.length),this[L]<<24|this[L+1]<<16|this[L+2]<<8|this[L+3]},a.prototype.readBigInt64LE=Hu(function(L){L=L>>>0,be(L,"offset");const M=this[L],Y=this[L+7];(M===void 0||Y===void 0)&&Me(L,this.length-8);const ne=this[L+4]+this[L+5]*2**8+this[L+6]*2**16+(Y<<24);return(BigInt(ne)<<BigInt(32))+BigInt(M+this[++L]*2**8+this[++L]*2**16+this[++L]*2**24)}),a.prototype.readBigInt64BE=Hu(function(L){L=L>>>0,be(L,"offset");const M=this[L],Y=this[L+7];(M===void 0||Y===void 0)&&Me(L,this.length-8);const ne=(M<<24)+this[++L]*2**16+this[++L]*2**8+this[++L];return(BigInt(ne)<<BigInt(32))+BigInt(this[++L]*2**24+this[++L]*2**16+this[++L]*2**8+Y)}),a.prototype.readFloatLE=function(L,M){return L=L>>>0,M||U(L,4,this.length),n.read(this,L,!0,23,4)},a.prototype.readFloatBE=function(L,M){return L=L>>>0,M||U(L,4,this.length),n.read(this,L,!1,23,4)},a.prototype.readDoubleLE=function(L,M){return L=L>>>0,M||U(L,8,this.length),n.read(this,L,!0,52,8)},a.prototype.readDoubleBE=function(L,M){return L=L>>>0,M||U(L,8,this.length),n.read(this,L,!1,52,8)};function F(W,L,M,Y,ne,ue){if(!a.isBuffer(W))throw new TypeError('"buffer" argument must be a Buffer instance');if(L>ne||L<ue)throw new RangeError('"value" argument is out of bounds');if(M+Y>W.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(L,M,Y,ne){if(L=+L,M=M>>>0,Y=Y>>>0,!ne){const pn=Math.pow(2,8*Y)-1;F(this,L,M,Y,pn,0)}let ue=1,me=0;for(this[M]=L&255;++me<Y&&(ue*=256);)this[M+me]=L/ue&255;return M+Y},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(L,M,Y,ne){if(L=+L,M=M>>>0,Y=Y>>>0,!ne){const pn=Math.pow(2,8*Y)-1;F(this,L,M,Y,pn,0)}let ue=Y-1,me=1;for(this[M+ue]=L&255;--ue>=0&&(me*=256);)this[M+ue]=L/me&255;return M+Y},a.prototype.writeUint8=a.prototype.writeUInt8=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,1,255,0),this[M]=L&255,M+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,2,65535,0),this[M]=L&255,this[M+1]=L>>>8,M+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,2,65535,0),this[M]=L>>>8,this[M+1]=L&255,M+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,4,4294967295,0),this[M+3]=L>>>24,this[M+2]=L>>>16,this[M+1]=L>>>8,this[M]=L&255,M+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,4,4294967295,0),this[M]=L>>>24,this[M+1]=L>>>16,this[M+2]=L>>>8,this[M+3]=L&255,M+4};function K(W,L,M,Y,ne){Ne(L,Y,ne,W,M,7);let ue=Number(L&BigInt(4294967295));W[M++]=ue,ue=ue>>8,W[M++]=ue,ue=ue>>8,W[M++]=ue,ue=ue>>8,W[M++]=ue;let me=Number(L>>BigInt(32)&BigInt(4294967295));return W[M++]=me,me=me>>8,W[M++]=me,me=me>>8,W[M++]=me,me=me>>8,W[M++]=me,M}function q(W,L,M,Y,ne){Ne(L,Y,ne,W,M,7);let ue=Number(L&BigInt(4294967295));W[M+7]=ue,ue=ue>>8,W[M+6]=ue,ue=ue>>8,W[M+5]=ue,ue=ue>>8,W[M+4]=ue;let me=Number(L>>BigInt(32)&BigInt(4294967295));return W[M+3]=me,me=me>>8,W[M+2]=me,me=me>>8,W[M+1]=me,me=me>>8,W[M]=me,M+8}a.prototype.writeBigUInt64LE=Hu(function(L,M=0){return K(this,L,M,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=Hu(function(L,M=0){return q(this,L,M,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(L,M,Y,ne){if(L=+L,M=M>>>0,!ne){const as=Math.pow(2,8*Y-1);F(this,L,M,Y,as-1,-as)}let ue=0,me=1,pn=0;for(this[M]=L&255;++ue<Y&&(me*=256);)L<0&&pn===0&&this[M+ue-1]!==0&&(pn=1),this[M+ue]=(L/me>>0)-pn&255;return M+Y},a.prototype.writeIntBE=function(L,M,Y,ne){if(L=+L,M=M>>>0,!ne){const as=Math.pow(2,8*Y-1);F(this,L,M,Y,as-1,-as)}let ue=Y-1,me=1,pn=0;for(this[M+ue]=L&255;--ue>=0&&(me*=256);)L<0&&pn===0&&this[M+ue+1]!==0&&(pn=1),this[M+ue]=(L/me>>0)-pn&255;return M+Y},a.prototype.writeInt8=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,1,127,-128),L<0&&(L=255+L+1),this[M]=L&255,M+1},a.prototype.writeInt16LE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,2,32767,-32768),this[M]=L&255,this[M+1]=L>>>8,M+2},a.prototype.writeInt16BE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,2,32767,-32768),this[M]=L>>>8,this[M+1]=L&255,M+2},a.prototype.writeInt32LE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,4,2147483647,-2147483648),this[M]=L&255,this[M+1]=L>>>8,this[M+2]=L>>>16,this[M+3]=L>>>24,M+4},a.prototype.writeInt32BE=function(L,M,Y){return L=+L,M=M>>>0,Y||F(this,L,M,4,2147483647,-2147483648),L<0&&(L=4294967295+L+1),this[M]=L>>>24,this[M+1]=L>>>16,this[M+2]=L>>>8,this[M+3]=L&255,M+4},a.prototype.writeBigInt64LE=Hu(function(L,M=0){return K(this,L,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=Hu(function(L,M=0){return q(this,L,M,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(W,L,M,Y,ne,ue){if(M+Y>W.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("Index out of range")}function Z(W,L,M,Y,ne){return L=+L,M=M>>>0,ne||H(W,L,M,4),n.write(W,L,M,Y,23,4),M+4}a.prototype.writeFloatLE=function(L,M,Y){return Z(this,L,M,!0,Y)},a.prototype.writeFloatBE=function(L,M,Y){return Z(this,L,M,!1,Y)};function ee(W,L,M,Y,ne){return L=+L,M=M>>>0,ne||H(W,L,M,8),n.write(W,L,M,Y,52,8),M+8}a.prototype.writeDoubleLE=function(L,M,Y){return ee(this,L,M,!0,Y)},a.prototype.writeDoubleBE=function(L,M,Y){return ee(this,L,M,!1,Y)},a.prototype.copy=function(L,M,Y,ne){if(!a.isBuffer(L))throw new TypeError("argument should be a Buffer");if(Y||(Y=0),!ne&&ne!==0&&(ne=this.length),M>=L.length&&(M=L.length),M||(M=0),ne>0&&ne<Y&&(ne=Y),ne===Y||L.length===0||this.length===0)return 0;if(M<0)throw new RangeError("targetStart out of bounds");if(Y<0||Y>=this.length)throw new RangeError("Index out of range");if(ne<0)throw new RangeError("sourceEnd out of bounds");ne>this.length&&(ne=this.length),L.length-M<ne-Y&&(ne=L.length-M+Y);const ue=ne-Y;return this===L&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(M,Y,ne):Uint8Array.prototype.set.call(L,this.subarray(Y,ne),M),ue},a.prototype.fill=function(L,M,Y,ne){if(typeof L=="string"){if(typeof M=="str
2ing"?(ne=M,M=0,Y=this.length):typeof Y=="string"&&(ne=Y,Y=this.length),ne!==void 0&&typeof ne!="string")throw new TypeError("encoding must be a string");if(typeof ne=="string"&&!a.isEncoding(ne))throw new TypeError("Unknown encoding: "+ne);if(L.length===1){const me=L.charCodeAt(0);(ne==="utf8"&&me<128||ne==="latin1")&&(L=me)}}else typeof L=="number"?L=L&255:typeof L=="boolean"&&(L=Number(L));if(M<0||this.length<M||this.length<Y)throw new RangeError("Out of range index");if(Y<=M)return this;M=M>>>0,Y=Y===void 0?this.length:Y>>>0,L||(L=0);let ue;if(typeof L=="number")for(ue=M;ue<Y;++ue)this[ue]=L;else{const me=a.isBuffer(L)?L:a.from(L,ne),pn=me.length;if(pn===0)throw new TypeError('The value "'+L+'" is invalid for argument "value"');for(ue=0;ue<Y-M;++ue)this[ue+M]=me[ue%pn]}return this};const ie={};function X(W,L,M){ie[W]=class extends M{constructor(){super(),Object.defineProperty(this,"message",{value:L.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${W}]`,this.stack,delete this.name}get code(){return W}set code(ne){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:ne,writable:!0})}toString(){return`${this.name} [${W}]: ${this.message}`}}}X("ERR_BUFFER_OUT_OF_BOUNDS",function(W){return W?`${W} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),X("ERR_INVALID_ARG_TYPE",function(W,L){return`The "${W}" argument must be of type number. Received type ${typeof L}`},TypeError),X("ERR_OUT_OF_RANGE",function(W,L,M){let Y=`The value of "${W}" is out of range.`,ne=M;return Number.isInteger(M)&&Math.abs(M)>2**32?ne=le(String(M)):typeof M=="bigint"&&(ne=String(M),(M>BigInt(2)**BigInt(32)||M<-(BigInt(2)**BigInt(32)))&&(ne=le(ne)),ne+="n"),Y+=` It must be ${L}. Received ${ne}`,Y},RangeError);function le(W){let L="",M=W.length;const Y=W[0]==="-"?1:0;for(;M>=Y+4;M-=3)L=`_${W.slice(M-3,M)}${L}`;return`${W.slice(0,M)}${L}`}function _e(W,L,M){be(L,"offset"),(W[L]===void 0||W[L+M]===void 0)&&Me(L,W.length-(M+1))}function Ne(W,L,M,Y,ne,ue){if(W>M||W<L){const me=typeof L=="bigint"?"n":"";let pn;throw L===0||L===BigInt(0)?pn=`>= 0${me} and < 2${me} ** ${(ue+1)*8}${me}`:pn=`>= -(2${me} ** ${(ue+1)*8-1}${me}) and < 2 ** ${(ue+1)*8-1}${me}`,new ie.ERR_OUT_OF_RANGE("value",pn,W)}_e(Y,ne,ue)}function be(W,L){if(typeof W!="number")throw new ie.ERR_INVALID_ARG_TYPE(L,"number",W)}function Me(W,L,M){throw Math.floor(W)!==W?(be(W,M),new ie.ERR_OUT_OF_RANGE("offset","an integer",W)):L<0?new ie.ERR_BUFFER_OUT_OF_BOUNDS:new ie.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${L}`,W)}const Ct=/[^+/0-9A-Za-z-_]/g;function Wt(W){if(W=W.split("=")[0],W=W.trim().replace(Ct,""),W.length<2)return"";for(;W.length%4!==0;)W=W+"=";return W}function y3(W,L){L=L||1/0;let M;const Y=W.length;let ne=null;const ue=[];for(let me=0;me<Y;++me){if(M=W.charCodeAt(me),M>55295&&M<57344){if(!ne){if(M>56319){(L-=3)>-1&&ue.push(239,191,189);continue}else if(me+1===Y){(L-=3)>-1&&ue.push(239,191,189);continue}ne=M;continue}if(M<56320){(L-=3)>-1&&ue.push(239,191,189),ne=M;continue}M=(ne-55296<<10|M-56320)+65536}else ne&&(L-=3)>-1&&ue.push(239,191,189);if(ne=null,M<128){if((L-=1)<0)break;ue.push(M)}else if(M<2048){if((L-=2)<0)break;ue.push(M>>6|192,M&63|128)}else if(M<65536){if((L-=3)<0)break;ue.push(M>>12|224,M>>6&63|128,M&63|128)}else if(M<1114112){if((L-=4)<0)break;ue.push(M>>18|240,M>>12&63|128,M>>6&63|128,M&63|128)}else throw new Error("Invalid code point")}return ue}function qP(W){const L=[];for(let M=0;M<W.length;++M)L.push(W.charCodeAt(M)&255);return L}function gx(W,L){let M,Y,ne;const ue=[];for(let me=0;me<W.length&&!((L-=2)<0);++me)M=W.charCodeAt(me),Y=M>>8,ne=M%256,ue.push(ne),ue.push(Y);return ue}function b3(W){return t.toByteArray(Wt(W))}function X0(W,L,M,Y){let ne;for(ne=0;ne<Y&&!(ne+M>=L.length||ne>=W.length);++ne)L[ne+M]=W[ne];return ne}function kc(W,L){return W instanceof L||W!=null&&W.constructor!=null&&W.constructor.name!=null&&W.constructor.name===L.name}function Fb(W){return W!==W}const mx=(function(){const W="0123456789abcdef",L=new Array(256);for(let M=0;M<16;++M){const Y=M*16;for(let ne=0;ne<16;++ne)L[Y+ne]=W[M]+W[ne]}return L})();function Hu(W){return typeof BigInt>"u"?wx:W}function wx(){throw new Error("BigInt not supported")}})(WP)),WP}var zzt=N$e();const T$e="modulepreload",P$e=function(e){return"/"+e},mZ={},te=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(l){return Promise.all(l.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(l=>{if(l=P$e(l),l in mZ)return;mZ[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");
2if(h.rel=u?"stylesheet":T$e,u||(h.as="script"),h.crossOrigin="",h.href=l,c&&h.setAttribute("nonce",c),document.head.appendChild(h),u)return new Promise((f,g)=>{h.addEventListener("load",f),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},O$e={},qzt=Object.freeze(Object.defineProperty({__proto__:null,default:O$e},Symbol.toStringTag,{value:"Module"})),k$e=BigInt(0),E3=BigInt(1),R$e=BigInt(2),B$e=BigInt(7),D$e=BigInt(256),U$e=BigInt(113),mle=[],wle=[],yle=[];for(let e=0,t=E3,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],mle.push(2*(5*r+n)),wle.push((e+1)*(e+2)/2%64);let s=k$e;for(let i=0;i<7;i++)t=(t<<E3^(t>>B$e)*U$e)%D$e,t&R$e&&(s^=E3<<(E3<<BigInt(i))-E3);yle.push(s)}const ble=y$e(yle,!0),L$e=ble[0],M$e=ble[1],wZ=(e,t,n)=>n>32?$$e(e,t,n):x$e(e,t,n),yZ=(e,t,n)=>n>32?I$e(e,t,n):S$e(e,t,n);function j$e(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=wZ(l,u,1)^n[a],h=yZ(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=wle[o],c=wZ(s,i,a),l=yZ(s,i,a),u=mle[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=L$e[r],e[1]^=M$e[r]}ple(n)}let F$e=class vle extends b$e{constructor(t,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,Mm(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=v$e(this.state)}clone(){return this._cloneInto()}keccak(){uZ(this.state32),j$e(this.state32,this.rounds),uZ(this.state32),this.posOut=0,this.pos=0}update(t){dZ(this),t=E$e(t),hZ(t);const{blockLen:n,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){dZ(this,!1),hZ(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Mm(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(C$e(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ple(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new vle(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}};const z$e=(e,t,n)=>w$e(()=>new F$e(t,e,n)),U0=z$e(1,136,256/8);var uS={exports:{}},q$e=uS.exports,bZ;function W$e(){return bZ||(bZ=1,(function(e,t){(function(n,r){e.exports=r()})(q$e,(function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",c="hour",l="day",u="week",d="month",h="quarter",f="year",g="date",p="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(_){var y=["th","st","nd","rd"],$=_%100;return"["+_+(y[($-20)%10]||y[$]||y[0])+"]"}},E=function(_,y,$){var R=String(_);return!R||R.length>=y?_:""+Array(y+1-R.length).join($)+_},b={s:E,z:function(_){var y=-_.utcOffset(),$=Math.abs(y),R=Math.floor($/60),B=$%60;return(y<=0?"+":"-")+E(R,2,"0")+":"+E(B,2,"0")},m:function _(y,$){if(y.date()<$.date())return-_($,y);var R=12*($.year()-y.year())+($.month()-y.month()),B=y.clone().add(R,d),k=$-B<0,D=y.clone().add(R+(k?-1:1),d);return+(-(R+($-B)/(k?B-D:D-B))||0)},a:function(_){return _<0?Math.ceil(_)||0:Math.floor(_)},p:function(_){return{M:d,y:f,w:u,d:l,D:g,h:c,m:a,s:o,ms:i,Q:h}[_]||String(_||"").toLowerCase().replace(/s$/,"")},u:function(_){return _===void 0}},S="en",v={};v[S]=C;var x="$isDayjsObject",A=function(_){return _ instanceof T||!(!_||!_[x])},I=function _(y,$,R){var B;if(!y)return S;if(typeof y=="string"){var k=y.toLowerCase();v[k]&&(B=k),$&&(v[k]=$,B=k);var D=y.split("-");if(!B&&D.length>1)return _(D[0])}else{var U=y.name;v[U]=y,B=U}return!R&&B&&(S=B),B||!R&&S},O=function(_,y){if(A(_))return _.clone();var $=typeof y=="object"?y:{};return $.date=_,$.args=arguments,new T($)},N=b;N.l=I,N.i=A,N.w=function(_,y){return O(_,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var T=(function(){function _($){this.$L=I($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[x]=!0}var y=_.prototype;return y.parse=function($){this.$d=(function(R){var B=R.date,k=R.utc;if(B===null)return new Date(NaN);if(N.u(B))return new Date;if(B instanceof Date)return new Date(B);
vendor: 4,206 bytes, line 2
2if(typeof B=="string"&&!/Z$/i.test(B)){var D=B.match(m);if(D){var U=D[2]-1||0,F=(D[7]||"0").substring(0,3);return k?new Date(Date.UTC(D[1],U,D[3]||1,D[4]||0,D[5]||0,D[6]||0,F)):new Date(D[1],U,D[3]||1,D[4]||0,D[5]||0,D[6]||0,F)}}return new Date(B)})($),this.init()},y.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},y.$utils=function(){return N},y.isValid=function(){return this.$d.toString()!==p},y.isSame=function($,R){var B=O($);return this.startOf(R)<=B&&B<=this.endOf(R)},y.isAfter=function($,R){return O($)<this.startOf(R)},y.isBefore=function($,R){return this.endOf(R)<O($)},y.$g=function($,R,B){return N.u($)?this[R]:this.set(B,$)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function($,R){var B=this,k=!!N.u(R)||R,D=N.p($),U=function(X,le){var _e=N.w(B.$u?Date.UTC(B.$y,le,X):new Date(B.$y,le,X),B);return k?_e:_e.endOf(l)},F=function(X,le){return N.w(B.toDate()[X].apply(B.toDate("s"),(k?[0,0,0,0]:[23,59,59,999]).slice(le)),B)},K=this.$W,q=this.$M,H=this.$D,Z="set"+(this.$u?"UTC":"");switch(D){case f:return k?U(1,0):U(31,11);case d:return k?U(1,q):U(0,q+1);case u:var ee=this.$locale().weekStart||0,ie=(K<ee?K+7:K)-ee;return U(k?H-ie:H+(6-ie),q);case l:case g:return F(Z+"Hours",0);case c:return F(Z+"Minutes",1);case a:return F(Z+"Seconds",2);case o:return F(Z+"Milliseconds",3);default:return this.clone()}},y.endOf=function($){return this.startOf($,!1)},y.$set=function($,R){var B,k=N.p($),D="set"+(this.$u?"UTC":""),U=(B={},B[l]=D+"Date",B[g]=D+"Date",B[d]=D+"Month",B[f]=D+"FullYear",B[c]=D+"Hours",B[a]=D+"Minutes",B[o]=D+"Seconds",B[i]=D+"Milliseconds",B)[k],F=k===l?this.$D+(R-this.$W):R;if(k===d||k===f){var K=this.clone().set(g,1);K.$d[U](F),K.init(),this.$d=K.set(g,Math.min(this.$D,K.daysInMonth())).$d}else U&&this.$d[U](F);return this.init(),this},y.set=function($,R){return this.clone().$set($,R)},y.get=function($){return this[N.p($)]()},y.add=function($,R){var B,k=this;$=Number($);var D=N.p(R),U=function(q){var H=O(k);return N.w(H.date(H.date()+Math.round(q*$)),k)};if(D===d)return this.set(d,this.$M+$);if(D===f)return this.set(f,this.$y+$);if(D===l)return U(1);if(D===u)return U(7);var F=(B={},B[a]=r,B[c]=s,B[o]=n,B)[D]||1,K=this.$d.getTime()+$*F;return N.w(K,this)},y.subtract=function($,R){return this.add(-1*$,R)},y.format=function($){var R=this,B=this.$locale();if(!this.isValid())return B.invalidDate||p;var k=$||"YYYY-MM-DDTHH:mm:ssZ",D=N.z(this),U=this.$H,F=this.$m,K=this.$M,q=B.weekdays,H=B.months,Z=B.meridiem,ee=function(le,_e,Ne,be){return le&&(le[_e]||le(R,k))||Ne[_e].slice(0,be)},ie=function(le){return N.s(U%12||12,le,"0")},X=Z||function(le,_e,Ne){var be=le<12?"AM":"PM";return Ne?be.toLowerCase():be};return k.replace(w,(function(le,_e){return _e||(function(Ne){switch(Ne){case"YY":return String(R.$y).slice(-2);case"YYYY":return N.s(R.$y,4,"0");case"M":return K+1;case"MM":return N.s(K+1,2,"0");case"MMM":return ee(B.monthsShort,K,H,3);case"MMMM":return ee(H,K);case"D":return R.$D;case"DD":return N.s(R.$D,2,"0");case"d":return String(R.$W);case"dd":return ee(B.weekdaysMin,R.$W,q,2);case"ddd":return ee(B.weekdaysShort,R.$W,q,3);case"dddd":return q[R.$W];case"H":return String(U);case"HH":return N.s(U,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return X(U,F,!0);case"A":return X(U,F,!1);case"m":return String(F);case"mm":return N.s(F,2,"0");case"s":return String(R.$s);case"ss":return N.s(R.$s,2,"0");case"SSS":return N.s(R.$ms,3,"0");case"Z":return D}return null})(le)||D.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function($,R,B){var k,D=this,U=N.p(R),F=O($),K=(F.utcOffset()-this.utcOffset())*r,q=this-F,H=function(){return N.m(D,F)};switch(U){case f:k=H()/12;break;case d:k=H();break;case h:k=H()/3;break;case u:k=(q-K)/6048e5;break;case l:k=(q-K)/864e5;break;case c:k=q/s;break;case a:k=q/r;break;case o:k=q/n;break;default:k=q}return B?k:N.a(k)},y.daysInMonth=function(){return this.endOf(d).$D},y.$locale=function(){return v[this.$L]}
2,y.locale=function($,R){if(!$)return this.$L;var B=this.clone(),k=I($,R,!0);return k&&(B.$L=k),B},y.clone=function(){return N.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},_})(),P=T.prototype;return O.prototype=P,[["$ms",i],["$s",o],["$m",a],["$H",c],["$W",l],["$M",d],["$y",f],["$D",g]].forEach((function(_){P[_[1]]=function(y){return this.$g(y,_[0],_[1])}})),O.extend=function(_,y){return _.$i||(_(y,T,O),_.$i=!0),O},O.locale=I,O.isDayjs=A,O.unix=function(_){return O(1e3*_)},O.en=v[S],O.Ls=v,O.p={},O}))})(uS)),uS.exports}var H$e=W$e();const Wzt=mf(H$e);var dS={exports:{}},V$e=dS.exports,vZ;function K$e(){return vZ||(vZ=1,(function(e,t){(function(n,r){e.exports=r()})(V$e,(function(){return function(n,r,s){n=n||{};var i=r.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function a(l,u,d,h){return i.fromToBase(l,u,d,h)}s.en.relativeTime=o,i.fromToBase=function(l,u,d,h,f){for(var g,p,m,w=d.$locale().relativeTime||o,C=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],E=C.length,b=0;b<E;b+=1){var S=C[b];S.d&&(g=h?s(l).diff(d,S.d,!0):d.diff(l,S.d,!0));var v=(n.rounding||Math.round)(Math.abs(g));if(m=g>0,v<=S.r||!S.r){v<=1&&b>0&&(S=C[b-1]);var x=w[S.l];f&&(v=f(""+v)),p=typeof x=="string"?x.replace("%d",v):x(v,u,S.l,m);break}}if(u)return p;var A=m?w.future:w.past;return typeof A=="function"?A(p):A.replace("%s",p)},i.to=function(l,u){return a(l,u,this,!0)},i.from=function(l,u){return a(l,u,this)};var c=function(l){return l.$u?s.utc():s()};i.toNow=function(l){return this.to(c(this),l)},i.fromNow=function(l){return this.from(c(this),l)}}}))})(dS)),dS.exports}var G$e=K$e();const Hzt=mf(G$e);var HP={exports:{}},EZ;function Z$e(){return EZ||(EZ=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,l,u){this.fn=c,this.context=l,this.once=u||!1}function i(c,l,u,d,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,d||c,h),g=n?n+l:l;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],f]:c._events[g].push(f):(c._events[g]=f,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new r:delete c._events[l]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],u,d;if(this._eventsCount===0)return l;for(d in u=this._events)t.call(u,d)&&l.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},a.prototype.listeners=function(l){var u=n?n+l:l,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,f=d.length,g=new Array(f);h<f;h++)g[h]=d[h].fn;return g},a.prototype.listenerCount=function(l){var u=n?n+l:l,d=this._events[u];return d?d.fn?1:d.length:0},a.prototype.emit=function(l,u,d,h,f,g){var p=n?n+l:l;if(!this._events[p])return!1;var m=this._events[p],w=arguments.length,C,E;if(m.fn){switch(m.once&&this.removeListener(l,m.fn,void 0,!0),w){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,u),!0;case 3:return m.fn.call(m.context,u,d),!0;case 4:return m.fn.call(m.context,u,d,h),!0;case 5:return m.fn.call(m.context,u,d,h,f),!0;case 6:return m.fn.call(m.context,u,d,h,f,g),!0}for(E=1,C=new Array(w-1);E<w;E++)C[E-1]=arguments[E];m.fn.apply(m.context,C)}else{var b=m.length,S;for(E=0;E<b;E++)switch(m[E].once&&this.removeListener(l,m[E].fn,void 0,!0),w){case 1:m[E].fn.call(m[E].context);break;case 2:m[E].fn.call(m[E].context,u);break;case 3:m[E].fn.call(m[E].context,u,d);break;case 4:m[E].fn.call(m[E].context,u,d,h);break;default:if(!C)for(S=1,C=new Array(w-1);S<w;S++)C[S-1]=arguments[S];m[E].fn.apply(m[E].context,C)}}return!0},a.prototype.on=function(l,u,d){return i(this,l,u,d,!1)},a.prototype.once=function(l,u,d){return i(this,l,u,d,!0)},a.prototype.removeListener=function(l,u,d,h){var f=n?n+l:l;if(!this._events[f])return this;if(!u)return o(this,f),this;var g=this._events[f];if(g.fn)g.fn===u&&(!h||g.once)&&(!d||g.context===d)&&o(this,f);else{for(var p=0,m=[],w=g.length;p<w;p++)(g[p].fn!==u||h&&!g[p].once||d&&g[p].context!==d)&&m.push(g[p]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var u;return l?(u=n?n+l:l,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a})(HP)),HP.exports}var Y$e=Z$e();const Vzt=mf(Y$e);var VP,CZ;function J$e(){return CZ||(CZ=1,VP=function(t){for(var n=[],r=t.length,s=0;s<r;s++){var i=t.charCodeAt(s);if(i>=55296&&i<=56319&&r>s+1){var o=t.charCodeAt(s+1);o>=56320&&o<=57343&&(i=(i-55296)*1024+o-56320+65536,s+=1)}if(i<128){n.push(i);continue}if(i<2048){n.push(i>
2>6|192),n.push(i&63|128);continue}if(i<55296||i>=57344&&i<65536){n.push(i>>12|224),n.push(i>>6&63|128),n.push(i&63|128);continue}if(i>=65536&&i<=1114111){n.push(i>>18|240),n.push(i>>12&63|128),n.push(i>>6&63|128),n.push(i&63|128);continue}n.push(239,191,189)}return new Uint8Array(n).buffer}),VP}var KP={exports:{}},$Z;function X$e(){return $Z||($Z=1,(function(e){var t={single_source_shortest_paths:function(n,r,s){var i={},o={};o[r]=0;var a=t.PriorityQueue.make();a.push(r,0);for(var c,l,u,d,h,f,g,p,m;!a.empty();){c=a.pop(),l=c.value,d=c.cost,h=n[l]||{};for(u in h)h.hasOwnProperty(u)&&(f=h[u],g=d+f,p=o[u],m=typeof o[u]>"u",(m||p>g)&&(o[u]=g,a.push(u,g),i[u]=l))}if(typeof s<"u"&&typeof o[s]>"u"){var w=["Could not find a path from ",r," to ",s,"."].join("");throw new Error(w)}return i},extract_shortest_path_from_predecessor_list:function(n,r){for(var s=[],i=r;i;)s.push(i),n[i],i=n[i];return s.reverse(),s},find_path:function(n,r,s){var i=t.single_source_shortest_paths(n,r,s);return t.extract_shortest_path_from_predecessor_list(i,s)},PriorityQueue:{make:function(n){var r=t.PriorityQueue,s={},i;n=n||{};for(i in r)r.hasOwnProperty(i)&&(s[i]=r[i]);return s.queue=[],s.sorter=n.sorter||r.default_sorter,s},default_sorter:function(n,r){return n.cost-r.cost},push:function(n,r){var s={value:n,cost:r};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(KP)),KP.exports}var bx={exports:{}},xZ;function Q$e(){if(xZ)return bx.exports;xZ=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(S,v,x){return Function.prototype.apply.call(S,v,x)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(S){return Object.getOwnPropertyNames(S).concat(Object.getOwnPropertySymbols(S))}:n=function(S){return Object.getOwnPropertyNames(S)};function r(b){console&&console.warn&&console.warn(b)}var s=Number.isNaN||function(S){return S!==S};function i(){i.init.call(this)}bx.exports=i,bx.exports.once=w,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function a(b){if(typeof b!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof b)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(b){if(typeof b!="number"||b<0||s(b))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+b+".");o=b}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(S){if(typeof S!="number"||S<0||s(S))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+S+".");return this._maxListeners=S,this};function c(b){return b._maxListeners===void 0?i.defaultMaxListeners:b._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function(S){for(var v=[],x=1;x<arguments.length;x++)v.push(arguments[x]);var A=S==="error",I=this._events;if(I!==void 0)A=A&&I.error===void 0;else if(!A)return!1;if(A){var O;if(v.length>0&&(O=v[0]),O instanceof Error)throw O;var N=new Error("Unhandled error."+(O?" ("+O.message+")":""));throw N.context=O,N}var T=I[S];if(T===void 0)return!1;if(typeof T=="function")t(T,this,v);else for(var P=T.length,_=g(T,P),x=0;x<P;++x)t(_[x],this,v);return!0};function l(b,S,v,x){var A,I,O;if(a(v),I=b._events,I===void 0?(I=b._events=Object.create(null),b._eventsCount=0):(I.newListener!==void 0&&(b.emit("newListener",S,v.listener?v.listener:v),I=b._events),O=I[S]),O===void 0)O=I[S]=v,++b._eventsCount;else if(typeof O=="function"?O=I[S]=x?[v,O]:[O,v]:x?O.unshift(v):O.push(v),A=c(b),A>0&&O.length>A&&!O.warned){O.warned=!0;var N=new Error("Possible EventEmitter memory leak detected. "+O.length+" "+String(S)+" listeners added. Use emitter.setMaxListeners() to increase limit");N.name="MaxListenersExceededWarning",N.emitter=b,N.type=S,N.count=O.length,r(N)}return b}i.prototype.addListener=function(S,v){return l(this,S,v,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(S,v){return l(this,S,v,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(b,S,v){var x={fired:!1,wrapFn:void 0,target:b,type:S,listener:v},A=u.bind(x);return A.listener=v,x.wrapFn=A,A}i.prototype.once=function(S,v){return a(v),this.on(S,d(this,S,v)),this},i.prototype.prependOnceListener=function(S,v){return a(v),this.prependListener(S,d(this,S,v)),this},i.prototype.removeListener=function(S,v){var x,A,I,O,N;if(a(v),A=this._events,A===void 0)return this;if(x=A[S],x===void 0)return this;if(x===v||x.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete A[S],A.removeListener&&this.emit
vendor: 1,471 bytes, line 2
2("removeListener",S,x.listener||v));else if(typeof x!="function"){for(I=-1,O=x.length-1;O>=0;O--)if(x[O]===v||x[O].listener===v){N=x[O].listener,I=O;break}if(I<0)return this;I===0?x.shift():p(x,I),x.length===1&&(A[S]=x[0]),A.removeListener!==void 0&&this.emit("removeListener",S,N||v)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(S){var v,x,A;if(x=this._events,x===void 0)return this;if(x.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):x[S]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete x[S]),this;if(arguments.length===0){var I=Object.keys(x),O;for(A=0;A<I.length;++A)O=I[A],O!=="removeListener"&&this.removeAllListeners(O);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=x[S],typeof v=="function")this.removeListener(S,v);else if(v!==void 0)for(A=v.length-1;A>=0;A--)this.removeListener(S,v[A]);return this};function h(b,S,v){var x=b._events;if(x===void 0)return[];var A=x[S];return A===void 0?[]:typeof A=="function"?v?[A.listener||A]:[A]:v?m(A):g(A,A.length)}i.prototype.listeners=function(S){return h(this,S,!0)},i.prototype.rawListeners=function(S){return h(this,S,!1)},i.listenerCount=function(b,S){return typeof b.listenerCount=="function"?b.listenerCount(S):f.call(b,S)},i.prototype.listenerCount=f;function f(b){var S=this._events;if(S!==void 0){var v=S[b];
vendor: 14,834 bytes, line 2
2if(typeof v=="function")return 1;if(v!==void 0)return v.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function g(b,S){for(var v=new Array(S),x=0;x<S;++x)v[x]=b[x];return v}function p(b,S){for(;S+1<b.length;S++)b[S]=b[S+1];b.pop()}function m(b){for(var S=new Array(b.length),v=0;v<S.length;++v)S[v]=b[v].listener||b[v];return S}function w(b,S){return new Promise(function(v,x){function A(O){b.removeListener(S,I),x(O)}function I(){typeof b.removeListener=="function"&&b.removeListener("error",A),v([].slice.call(arguments))}E(b,S,I,{once:!0}),S!=="error"&&C(b,A,{once:!0})})}function C(b,S,v){typeof b.on=="function"&&E(b,"error",S,v)}function E(b,S,v,x){if(typeof b.on=="function")x.once?b.once(S,v):b.on(S,v);else if(typeof b.addEventListener=="function")b.addEventListener(S,function A(I){x.once&&b.removeEventListener(S,A),v(I)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof b)}return bx.exports}var Dn=Q$e();const Bu=mf(Dn);var IZ=function(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},exe=(function(){function e(t,n,r){this.name=t,this.version=n,this.os=r,this.type="browser"}return e})(),txe=(function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e})(),nxe=(function(){function e(t,n,r,s){this.name=t,this.version=n,this.os=r,this.bot=s,this.type="bot-device"}return e})(),rxe=(function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e})(),sxe=(function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e})(),ixe=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,oxe=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,SZ=3,axe=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",ixe]],AZ=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function MN(e){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new sxe:typeof navigator<"u"?lxe(navigator.userAgent):dxe()}function cxe(e){return e!==""&&axe.reduce(function(t,n){var r=n[0],s=n[1];if(t)return t;var i=s.exec(e);return!!i&&[r,i]},!1)}function lxe(e){var t=cxe(e);if(!t)return null;var n=t[0],r=t[1];if(n==="searchbot")return new rxe;var s=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);s?s.length<SZ&&(s=IZ(IZ([],s,!0),hxe(SZ-s.length),!0)):s=[];var i=s.join("."),o=uxe(e),a=oxe.exec(e);return a&&a[1]?new nxe(n,i,o,a[1]):new exe(n,i,o)}function uxe(e){for(var t=0,n=AZ.length;t<n;t++){var r=AZ[t],s=r[0],i=r[1],o=i.exec(e);if(o)return s}return null}function dxe(){var e=typeof process<"u"&&process.version;return e?new txe(process.version.slice(1)):null}function hxe(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}var GP={};var CU=function(e,t){return CU=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)r.hasOwnProperty(s)&&(n[s]=r[s])},CU(e,t)};function fxe(e,t){CU(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var $U=function(){return $U=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},$U.apply(this,arguments)};function pxe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function gxe(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i}function mxe(e,t){return function(n,r){t(n,r,e)}}function wxe(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function yxe(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{l(r.next(u))}catch(d){o(d)}}function c(u){try{l(r.throw(u))}catch(d){o(d)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function bxe(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,s=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],s=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function vxe(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function Exe(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function xU(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ele(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function Cxe(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ele(arguments[t]));return e}function $xe(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),s=0,t=0;t<n;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function T8(e){return this instanceof T8?(this.v=e,this):new T8(e)}function xxe(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),s,i=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(h){r[h]&&(s[h]=function(f){return new Promise(function(g,p){i.push([h,f,g,p])>1||a(h,f)})})}function a(h,f){try{c(r[h](f))}catch(g){d(i[0][3],g)}}function c(h){h.value instanceof T8?Promise.resolve(h.value.v).then(l,u):d(i[0][2],h)}function l(h){a("next",h)}function u(h){a("throw",h)}function d(h,f){h(f),i.shift(),i.length&&a(i[0][0],i[0][1])}}function Ixe(e){var t,n;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,i){t[s]=e[s]?function(o){return(n=!n)?{value:T8(e[s](o)),done:s==="return"}:i?i(o):o}:i}}function Sxe(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof xU=="function"?xU(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=e[i]&&function(o){return new Promise(function(a,c){o=e[i](o),s(a,c,o.done,o.value)})}}function s(i,o,a,c){Promise.resolve(c).then(function(l){i({value:l,done:a})},o)}}function Axe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _xe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Nxe(e){return e&&e.__esModule?e:{default:e}}function Txe(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function Pxe(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}const Oxe=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return $U},__asyncDelegator:Ixe,__asyncGenerator:xxe,__asyncValues:Sxe,__await:T8,__awaiter:yxe,__classPrivateFieldGet:Txe,__classPrivateFieldSet:Pxe,__createBinding:vxe,__decorate:gxe,__exportStar:Exe,__extends:fxe,__generator:bxe,__importDefault:Nxe,__importStar:_xe,__makeTemplateObject:Axe,__metadata:wxe,__param:mxe,__read:Ele,__rest:pxe,__spread:Cxe,__spreadArrays:$xe,__values:xU},Symbol.toStringTag,{value:"Module"})),jN=gle(Oxe);var ZP={},C3={},_Z;function kxe(){if(_Z)return C3;_Z=1,Object.defineProperty(C3,"__esModule",{value:!0}),C3.delay=void 0;function e(t){return new Promise(n=>{setTimeout(()=>{n(!0)},t)})}return C3.delay=e,C3}var I1={},YP={},S1={},NZ;function Rxe(){return NZ||(NZ=1,Object.defineProperty(S1,"__esModule",{value:!0}),S1.ONE_THOUSAND=S1.ONE_HUNDRED=void 0,S1.ONE_HUNDRED=100,S1.ONE_THOUSAND=1e3),S1}var JP={},TZ;function Bxe(){return TZ||(TZ=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=e.ONE_MINUTE*5,e.TEN_MINUTES=e.ONE_MINUTE*10,e.THIRTY_MINUTES=e.ONE_MINUTE*30,e.SIXTY_MINUTES=e.ONE_MINUTE*60,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=e.ONE_HOUR*3,e.SIX_HOURS=e.ONE_HOUR*6,e.TWELVE_HOURS=e.ONE_HOUR*12,e.TWENTY_FOUR_HOURS=e.ONE_HOUR*24,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=e.ONE_DAY*3,e.FIVE_DAYS=e.ONE_DAY*5,e.SEVEN_DAYS=e.ONE_DAY*7,e.THIRTY_DAYS=e.ONE_DAY*30,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=e.ONE_WEEK*2,e.THREE_WEEKS=e.ONE_WEEK*3,e.FOUR_WEEKS=e.ONE_WEEK*4,e.ONE_YEAR=e.ONE_DAY*365})(JP)),JP}var PZ;function Cle(){return PZ||(PZ=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=jN;t.__exportStar(Rxe(),e),t.__exportStar(Bxe(),e)})(YP)),YP}var OZ;function Dxe(){if(OZ)return I1;OZ=1,Object.defineProperty(I1,"__esModule",{value:!0}),I1.fromMiliseconds=I1.toMiliseconds=void 0;const e=Cle();function t(r){return r*e.ONE_THOUSAND}I1.toMiliseconds=t;function n(r){return Math.floor(r/e.ONE_THOUSAND)}return I1.fromMiliseconds=n,I1}var kZ;function Uxe(){return kZ||(kZ=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=jN;t.__exportStar(kxe(),e),t.__exportStar(Dxe(),e)})(ZP)),ZP}var zb={},RZ;function Lxe(){if(RZ)return zb;RZ=1,Object.defineProperty(zb,"__esModule",{value:!0}),zb.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(n){if(this.timestamps.has(n))throw new Error(`Watch already started for label: ${n}`);this.timestamps.set(n,{started:Date.now()})}stop(n){const r=this.get(n);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${n}`);const s=Date.now()-r.started;this.timestamps.set(n,{started:r.started,elapsed:s})}get(n){const r=this.timestamps.get(n);if(typeof r>"u")throw new Error(`No timestamp found for label: ${n}`);return r}elapsed(n){const r=this.get(n);return r.elapsed||Date.now()-r.started}}return zb.Watch=e,zb.default=e,zb}var XP={},$3={},BZ;function Mxe(){if(BZ)return $3;BZ=1,Object.defineProperty($3,"__esModule",{value:!0}),$3.IWatch=void 0;class e{}return $3.IWatch=e,$3}var DZ;function jxe(){return DZ||(DZ=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),jN.__exportStar(Mxe(),e)})(XP)),XP}var UZ;function Fxe(){return UZ||(UZ=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=jN;t.__exportStar(Uxe(),e),t.__exportStar(Lxe(),e),t.__exportStar(jxe(),e),t.__exportStar(Cle(),e)})(GP)),GP}var V=Fxe(),yr={},LZ;function $le(){if(LZ)return yr;
2LZ=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.getLocalStorage=yr.getLocalStorageOrThrow=yr.getCrypto=yr.getCryptoOrThrow=yr.getLocation=yr.getLocationOrThrow=yr.getNavigator=yr.getNavigatorOrThrow=yr.getDocument=yr.getDocumentOrThrow=yr.getFromWindowOrThrow=yr.getFromWindow=void 0;function e(h){let f;return typeof window<"u"&&typeof window[h]<"u"&&(f=window[h]),f}yr.getFromWindow=e;function t(h){const f=e(h);if(!f)throw new Error(`${h} is not defined in Window`);return f}yr.getFromWindowOrThrow=t;function n(){return t("document")}yr.getDocumentOrThrow=n;function r(){return e("document")}yr.getDocument=r;function s(){return t("navigator")}yr.getNavigatorOrThrow=s;function i(){return e("navigator")}yr.getNavigator=i;function o(){return t("location")}yr.getLocationOrThrow=o;function a(){return e("location")}yr.getLocation=a;function c(){return t("crypto")}yr.getCryptoOrThrow=c;function l(){return e("crypto")}yr.getCrypto=l;function u(){return t("localStorage")}yr.getLocalStorageOrThrow=u;function d(){return e("localStorage")}return yr.getLocalStorage=d,yr}var cn=$le(),x3={},MZ;function zxe(){if(MZ)return x3;MZ=1,Object.defineProperty(x3,"__esModule",{value:!0}),x3.getWindowMetadata=void 0;const e=$le();function t(){let n,r;try{n=e.getDocumentOrThrow(),r=e.getLocationOrThrow()}catch{return null}function s(){const f=n.getElementsByTagName("link"),g=[];for(let p=0;p<f.length;p++){const m=f[p],w=m.getAttribute("rel");if(w&&w.toLowerCase().indexOf("icon")>-1){const C=m.getAttribute("href");if(C)if(C.toLowerCase().indexOf("https:")===-1&&C.toLowerCase().indexOf("http:")===-1&&C.indexOf("//")!==0){let E=r.protocol+"//"+r.host;if(C.indexOf("/")===0)E+=C;else{const b=r.pathname.split("/");b.pop();const S=b.join("/");E+=S+"/"+C}g.push(E)}else if(C.indexOf("//")===0){const E=r.protocol+C;g.push(E)}else g.push(C)}}return g}function i(...f){const g=n.getElementsByTagName("meta");for(let p=0;p<g.length;p++){const m=g[p],w=["itemprop","property","name"].map(C=>m.getAttribute(C)).filter(C=>C?f.includes(C):!1);if(w.length&&w){const C=m.getAttribute("content");if(C)return C}}return""}function o(){let f=i("name","og:site_name","og:title","twitter:title");return f||(f=n.title),f}function a(){return i("description","og:description","twitter:description","keywords")}const c=o(),l=a(),u=r.origin,d=s();return{description:l,url:u,icons:d,name:c}}return x3.getWindowMetadata=t,x3}var gC=zxe();function P8(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function IU(e){return P8(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const xle="2.31.0";let I3={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${xle}`},FN=class SU extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof SU?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof SU&&n.cause.docsPath||n.docsPath,i=(a=I3.getDocsUrl)==null?void 0:a.call(I3,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...I3.version?[`Version: ${I3.version}`]:[]].join(` 3`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=xle}walk(t){return Ile(this,t)}};function Ile(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Ile
3(e.cause,t):t?null:e}let Sle=class extends FN{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function b6(e,{dir:t,size:n=32}={}){return typeof e=="string"?qxe(e,{dir:t,size:n}):Wxe(e,{dir:t,size:n})}function qxe(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Sle({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Wxe(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Sle({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let Hxe=class extends FN{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},Vxe=class extends FN{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function v6(e,{size:t}){if(IU(e)>t)throw new Vxe({givenSize:IU(e),maxSize:t})}function AU(e,t={}){const{signed:n}=t;t.size&&v6(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function Kxe(e,t={}){return Number(AU(e,t))}const Gxe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _U(e,t={}){return typeof e=="number"||typeof e=="bigint"?_le(e,t):typeof e=="string"?Jxe(e,t):typeof e=="boolean"?Zxe(e,t):Ale(e,t)}function Zxe(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(v6(n,{size:t.size}),b6(n,{size:t.size})):n}function Ale(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=Gxe[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(v6(r,{size:t.size}),b6(r,{dir:"right",size:t.size})):r}function _le(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new Hxe({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?b6(a,{size:r}):a}const Yxe=new TextEncoder;function Jxe(e,t={}){const n=Yxe.encode(e);return Ale(n,t)}const Xxe=new TextEncoder;function Qxe(e,t={}){return typeof e=="number"||typeof e=="bigint"?tIe(e,t):typeof e=="boolean"?eIe(e,t):P8(e)?Nle(e,t):Tle(e,t)}function eIe(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(v6(n,{size:t.size}),b6(n,{size:t.size})):n}const Nf={zero:48,nine:57,A:65,F:70,a:97,f:102};function jZ(e){if(e>=Nf.zero&&e<=Nf.nine)return e-Nf.zero;if(e>=Nf.A&&e<=Nf.F)return e-(Nf.A-10);if(e>=Nf.a&&e<=Nf.f)return e-(Nf.a-10)}function Nle(e,t={}){let n=e;t.size&&(v6(n,{size:t.size}),n=b6(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=jZ(r.charCodeAt(a++)),l=jZ(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new FN(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[o]=c*16+l}return i}function tIe(e,t){const n=_le(e,t);return Nle(n)}function Tle(e,t={}){const n=Xxe.encode(e);return typeof t.size=="number"?(v6(n,{size:t.size}),b6(n,{dir:"right",size:t.size})):n}function Ple(e,t){const n=t||"hex",r=U0(P8(e,{strict:!1})?Qxe(e):e);return n==="bytes"?r:_U(r)}let nIe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const QP=new nIe(8192);function rIe(e,t){if(QP.has(`${e}.${t}`))return QP.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ple(Tle(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const i=`0x${s.join("")}`;return QP.set(`${e}.${t}`,i),i}function sIe(e){const t=Ple(`0x${e.substring(4)}`).substring(26);return rIe(`0x${t}`)}async function iIe({hash:e,signature:t}){const n=P8(e)?e:_U(e),{secp256k1:r}=await te(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>BIe);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:d,yParity:h}=t,f=Number(h??d),g=FZ(f);return new r.Signature(AU(l),AU(u)).addRecoveryBit(g)}const o=P8(t)?t:_U(t);if(IU(o)!==65)throw new Error("invalid signature length");const a=Kxe(`0x${o.slice(130)}`),c=FZ(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function FZ(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function oIe({hash:e,signature:t}){return sIe(await iIe({hash:e,signature:t}))}const bq=BigInt(0),NU=BigInt(1);function mC(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function vq(e){if(!mC(e))throw new Error("Uint8Array expected")}function O8(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function vx(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Ole(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?bq:BigInt("0x"+e)}const kle=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",aIe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function k8(e){if(vq(e),kle)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=aIe[e[n]];return t}const Tf={_0:48,_9:57,A:65,F:70,a:97,f:102};function zZ(e){if(e>=Tf._0&&e<=Tf._9)return e-Tf._0;if(e>=Tf.A&&e<=Tf.F)return e-(Tf.A-10);if(e>=Tf.a&&e<=Tf.f)return e-(Tf.a-10)}function VS(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(kle)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);
vendor: 54,568 bytes, line 3
3const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=zZ(e.charCodeAt(i)),a=zZ(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function _w(e){return Ole(k8(e))}function Rle(e){return vq(e),Ole(k8(Uint8Array.from(e).reverse()))}function wC(e,t){return VS(e.toString(16).padStart(t*2,"0"))}function Ble(e,t){return wC(e,t).reverse()}function nu(e,t,n){let r;if(typeof t=="string")try{r=VS(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(mC(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function KS(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];vq(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const eO=e=>typeof e=="bigint"&&bq<=e;function Eq(e,t,n){return eO(e)&&eO(t)&&eO(n)&&t<=e&&e<n}function kv(e,t,n,r){if(!Eq(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function cIe(e){let t;for(t=0;e>bq;e>>=NU,t+=1);return t}const zN=e=>(NU<<BigInt(e))-NU,tO=e=>new Uint8Array(e),qZ=e=>Uint8Array.from(e);function lIe(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=tO(e),s=tO(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=tO(0))=>{s=a(qZ([0]),d),r=a(),d.length!==0&&(s=a(qZ([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return KS(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const uIe={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||mC(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function qN(e,t,n={}){const r=(s,i,o)=>{const a=uIe[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function WZ(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const ac=BigInt(0),Zo=BigInt(1),iw=BigInt(2),dIe=BigInt(3),Dle=BigInt(4),Ule=BigInt(5),Lle=BigInt(8);function Ha(e,t){const n=e%t;return n>=ac?n:t+n}function Pl(e,t,n){let r=e;for(;t-- >ac;)r*=r,r%=n;return r}function TU(e,t){if(e===ac)throw new Error("invert: expected non-zero number");if(t<=ac)throw new Error("invert: expected positive modulus, got "+t);let n=Ha(e,t),r=t,s=ac,i=Zo;for(;n!==ac;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==Zo)throw new Error("invert: does not exist");return Ha(s,t)}function Mle(e,t){const n=(e.ORDER+Zo)/Dle,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function hIe(e,t){const n=(e.ORDER-Ule)/Lle,r=e.mul(t,iw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,iw),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function fIe(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Zo,n=0;for(;t%iw===ac;)t/=iw,n++;let r=iw;const s=Cq(e);for(;HZ(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Mle;let i=s.pow(r,t);const o=(t+Zo)/iw;return function(c,l){if(c.is0(l))return l;if(HZ(c,l)!==1)throw new Error("Cannot find square root");let u=n,d=c.mul(c.ONE,i),h=c.pow(l,t),f=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let g=1,p=c.sqr(h);for(;!c.eql(p,c.ONE);)if(g++,p=c.sqr(p),g===u)throw new Error("Cannot find square root");const m=Zo<<BigInt(u-g-1),w=c.pow(d,m);u=g,d=c.sqr(w),h=c.mul(h,d),f=c.mul(f,w)}return f}}function pIe(e){return e%Dle===dIe?Mle:e%Lle===Ule?hIe:fIe(e)}const gIe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mIe(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=gIe.reduce((r,s)=>(r[s]="function",r),t);return qN(e,n)}function wIe(e,t,n){if(n<ac)throw new Error("invalid exponent, negatives unsupported");if(n===ac)return e.ONE;if(n===Zo)return t;let r=e.ONE,s=t;for(;n>ac;)n&Zo&&(r=e.mul(r,s)),s=e.sqr(s),n>>=Zo;return r}function jle(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function HZ(e,t){const n=(e.ORDER-Zo)/iw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Fle(e,t){t!==void 0&&Mm(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Cq(e,t,n=!1,r={}){if(e<=ac)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=Fle(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:zN(s),ZERO:ac,ONE:Zo,create:c=>Ha(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return ac<=c&&c<e},is0:c=>c===ac,isOdd:c=>(c&Zo)===Zo,neg:c=>Ha(-c,e),eql:(c,l)=>c===l,sqr:c=>Ha(c*c,e),add:(c,l)=>Ha(c+l,e),sub:(c,l)=>Ha(c-l,e),mul:(c,l)=>Ha(c*l,e),pow:(c,l)=>wIe(a,c,l),div:(c,l)=>Ha(c*TU(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>TU(c,e),sqrt:r.sqrt||(c=>(o||(o=pIe(e)),o(a,c))),toBytes:c=>n?Ble(c,i):wC(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?Rle(c):_w(c)},invertBatch:c=>jle(a,c),cmov:(c,l,u)=>u?l:c});return Object.freeze(a)}function zle(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function qle(e){const t=zle(e);return t+Math.ceil(t/2)}function yIe(e,t,n=!1){const r=e.length,s=zle(t),i=qle(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?Rle(e):_w(e),a=Ha(o,t-Zo)+Zo;return n?Ble(a,s):wC(a,s)}const VZ=BigInt(0),PU=BigInt(1);function nO(e,t){const n=t.negate();return e?n:t}function Wle(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function rO(e,t){Wle(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=zN(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function KZ(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=PU);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function bIe(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function vIe(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const sO=new WeakMap,Hle=new WeakMap;function iO(e){return Hle.get(e)||1}function EIe(e,t){return{constTimeNegate:nO,hasPrecomputes(n){return iO(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>VZ;)r&PU&&(s=s.add(i)),i=i.double(),r>>=PU;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=rO(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=rO(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=KZ(s,c,a);s=l,d?o=o.add(nO(f,r[g])):i=i.add(nO(h,r[u]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=rO(n,t);for(let a=0;a<o.windows&&s!==VZ;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=KZ(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return i},getPrecomputes(n,r,s){let i=sO.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&sO.set(r,s(i))),i},wNAFCached(n,r,s){const i=iO(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=iO(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){Wle(r,t),Hle.set(n,r),sO.delete(n)}}}function CIe(e,t,n,r){bIe(n,e),vIe(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=cIe(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=zN(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function Vle(e){return mIe(e.Fp),qN(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Fle(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function GZ(e){e.lowS!==void 0&&O8("lowS",e.lowS),e.prehash!==void 0&&O8("prehash",e.prehash)}function $Ie(e){const t=Vle(e);qN(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}let xIe=class extends Error{constructor(t=""){super(t)}};const $p={Err:xIe,_tlv:{encode:(e,t)=>{const{Err:n}=$p;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=vx(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?vx(s.length/2|128):"";return vx(e)+i+s+t},decode(e,t){const{Err:n}=$p;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=$p;if(e<Bp)throw new t("integer: negative integers are not allowed");let n=vx(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=$p;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return _w(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=$p,s=nu("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=$p,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function oO(e,t){return k8(wC(e,t))}const Bp=BigInt(0),li=BigInt(1);BigInt(2);const aO=BigInt(3),IIe=BigInt(4);function SIe(e){const t=$Ie(e),{Fp:n}=t,r=Cq(t.n,t.nBitLength),s=t.toBytes||((E,b,S)=>{const v=b.toAffine();return KS(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const b=E.subarray(1),S=n.fromBytes(b.subarray(0,n.BYTES)),v=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:S,y:v}});function o(E){const{a:b,b:S}=t,v=n.sqr(E),x=n.mul(v,E);return n.add(n.add(x,n.mul(E,b)),S)}function a(E,b){const S=n.sqr(b),v=o(E);return n.eql(S,v)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,aO),IIe),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(E){return Eq(E,li,t.n)}function d(E){const{allowedPrivateKeyLengths:b,nByteLength:S,wrapPrivateKey:v,n:x}=t;if(b&&typeof E!="bigint"){if(mC(E)&&(E=k8(E)),typeof E!="string"||!b.includes(E.length))throw new Error("invalid private key");E=E.padStart(S*2,"0")}let A;try{A=typeof E=="bigint"?E:_w(nu("private key",E,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof E)}return v&&(A=Ha(A,x)),kv("private key",A,li,x),A}function h(E){if(!(E instanceof p))throw new Error("ProjectivePoint expected")}const f=WZ((E,b)=>{const{px:S,py:v,pz:x}=E;if(n.eql(x,n.ONE))return{x:S,y:v};const A=E.is0();b==null&&(b=A?n.ONE:n.inv(x));const I=n.mul(S,b),O=n.mul(v,b),N=n.mul(x,b);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:I,y:O}}),g=WZ(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:b,y:S}=E.toAffine();if(!n.isValid(b)||!n.isValid(S))throw new Error("bad point: x or y not FE");if(!a(b,S))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(b,S,v){if(b==null||!n.isValid(b))throw new Error("x required");if(S==null||!n.isValid(S)||n.is0(S))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=b,this.py=S,this.pz=v,Object.freeze(this)}static fromAffine(b){const{x:S,y:v}=b||{};if(!b||!n.isValid(S)||!n.isValid(v))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const x=A=>n.eql(A,n.ZERO);return x(S)&&x(v)?p.ZERO:new p(S,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const S=jle(n,b.map(v=>v.pz));return b.map((v,x)=>v.toAffine(S[x])).map(p.fromAffine)}static fromHex(b){const S=p.fromAffine(i(nu("pointHex",b)));return S.assertValidity(),S}static fromPrivateKey(b){return p.BASE.multiply(d(b))}static msm(b,S){return CIe(p,r,b,S)}_setWindowSize(b){C.setWindowSize(this,b)}assertValidity(){g(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b,N=n.eql(n.mul(S,O),n.mul(A,x)),T=n.eql(n.mul(v,O),n.mul(I,x));return N&&T}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:S}=t,v=n.mul(S,aO),{px:x,py:A,pz:I}=this;let O=n.ZERO,N=n.ZERO,T=n.ZERO,P=n.mul(x,x),_=n.mul(A,A),y=n.mul(I,I),$=n.mul(x,A);return $=n.add($,$),T=n.mul(x,I),T=n.add(T,T),O=n.mul(b,T),N=n.mul(v,y),N=n.add(O,N),O=n.sub(_,N),N=n.add(_,N),N=n.mul(O,N),O=n.mul($,O),T=n.mul(v,T),y=n.mul(b,y),$=n.sub(P,y),$=n.mul(b,$),$=n.add($,T),T=n.add(P,P),P=n.add(T,P),P=n.add(P,y),P=n.mul(P,$),N=n.add(N,P),y=n.mul(A,I),y=n.add(y,y),P=n.mul(y,$),O=n.sub(O,P),T=n.mul(y,_),T=n.add(T,T),T=n.add(T,T),new p(O,N,T)}add(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b;let N=n.ZERO,T=n.ZERO,P=n.ZERO;const _=t.a,y=n.mul(t.b,aO);let $=n.mul(S,A),R=n.mul(v,I),B=n.mul(x,O),k=n.add(S,v),D=n.add(A,I);k=n.mul(k,D),D=n.add($,R),k=n.sub(k,D),D=n.add(S,x);let U=n.add(A,O);return D=n.mul(D,U),U=n.add($,B),D=n.sub(D,U),U=n.add(v,x),N=n.add(I,O),U=n.mul(U,N),N=n.add(R,B),U=n.sub(U,N),P=n.mul(_,D),N=n.mul(y,B),P=n.add(N,P),N=n.sub(R,P),P=n.add(R,P),T=n.mul(N,P),R=n.add($,$),R=n.add(R,$),B=n.mul(_,B),D=n.mul(y,D),R=n.add(R,B),B=n.sub($,B),B=n.mul(_,B),D=n.add(D,B),$=n.mul(R,D),T=n.add(T,$),$=n.mul(U,D),N=n.mul(k,N),N=n.sub(N,$),$=n.mul(k,R),P=n.mul(U,P),P=n.add(P,$),new p(N,T,P)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return C.wNAFCached(this,b,p.normalizeZ)}multiplyUnsafe(b){const{endo:S,n:v}=t;kv("scalar",b,Bp,v);const x=p.ZERO;if(b===Bp)return x;if(this.is0()||b===li)return this;if(!S||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,b,p.normalizeZ);let{k1neg:A,k1:I,k2neg:O,k2:N}=S.splitScalar(b),T=x,P=x,_=this;for(;I>Bp||N>Bp;)I&li&&(T=T.add(_)),N&li&&(P=P.add(_)),_=_.double(),I>>=li,N>>=li;return A&&(T=T.negate()),O&&(P=P.negate()),P=new p(n.mul(P.px,S.beta),P.py,P.pz),T.add(P)}multiply(b){const{endo:S,n:v}=t;kv("scalar",b,li,v);let x,A;if(S){const{k1neg:I,k1:O,k2neg:N,k2:T}=S.splitScalar(b);let{p:P,f:_}=this.wNAF(O),{p:y,f:$}=this.wNAF(T);P=C.constTimeNegate(I,P),y=C.constTimeNegate(N,y),y=new p(n.mul(y.px,S.beta),y.py,y.pz),x=P.add(y),A=_.add($)}else{const{p:I,f:O}=this.wNAF(b);x=I,A=O}return p.normalizeZ([x,A])[0]}multiplyAndAddUnsafe(b,S,v){const x=p.BASE,A=(O,N)=>N===Bp||N===li||!O.equals(x)?O.multiplyUnsafe(N):O.multiply(N),I=A(this,S).add(A(b,v));return I.is0()?void 0:I}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:S}=t;if(b===li)return!0;if(S)return S(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:S}=t;return b===li?this:S?S(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return O8("isCompressed",b),this.assertValidity(),s(p,this,b)}toHex(b=!0){return O8("isCompressed",b),k8(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,C=EIe(p,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:u}}function AIe(e){const t=Vle(e);return qN(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function _Ie(e){const t=AIe(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(y){return Ha(y,r)}function l(y){return TU(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:h,isWithinCurveOrder:f}=SIe({...t,toBytes(y,$,R){const B=$.toAffine(),k=n.toBytes(B.x),D=KS;return O8("isCompressed",R),R?D(Uint8Array.from([$.hasEvenY()?2:3]),k):D(Uint8Array.from([4]),k,n.toBytes(B.y))},fromBytes(y){const $=y.length,R=y[0],B=y.subarray(1);if($===o&&(R===2||R===3)){const k=_w(B);if(!Eq(k,li,n.ORDER))throw new Error("Point is not on curve");const D=h(k);let U;try{U=n.sqrt(D)}catch(q){const H=q instanceof Error?": "+q.message:"";throw new Error("Point is not on curve"+H)}const F=(U&li)===li;return(R&1)===1!==F&&(U=n.neg(U)),{x:k,y:U}}else if($===a&&R===4){const k=n.fromBytes(B.subarray(0,n.BYTES)),D=n.fromBytes(B.subarray(n.BYTES,2*n.BYTES));return{x:k,y:D}}else{const k=o,D=a;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+D+", got "+$)}}});function g(y){const $=r>>li;return y>$}function p(y){return g(y)?c(-y):y}const m=(y,$,R)=>_w(y.slice($,R));class w{constructor($,R,B){kv("r",$,li,r),kv("s",R,li,r),this.r=$,this.s=R,B!=null&&(this.recovery=B),Object.freeze(this)}static fromCompact($){const R=s;return $=nu("compactSignature",$,R*2),new w(m($,0,R),m($,R,2*R))}static fromDER($){const{r:R,s:B}=$p.toSig(nu("DER",$));return new w(R,B)}assertValidity(){}addRecoveryBit($){return new w(this.r,this.s,$)}recoverPublicKey($){const{r:R,s:B,recovery:k}=this,D=x(nu("msgHash",$));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const U=k===2||k===3?R+t.n:R;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=(k&1)===0?"02":"03",K=u.fromHex(F+oO(U,n.BYTES)),q=l(U),H=c(-D*q),Z=c(B*q),ee=u.BASE.multiplyAndAddUnsafe(K,H,Z);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return VS(this.toDERHex())}toDERHex(){return $p.hexFromSig(this)}toCompactRawBytes(){return VS(this.toCompactHex())}toCompactHex(){const $=s;return oO(this.r,$)+oO(this.s,$)}}const C={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=qle(t.n);return yIe(t.randomBytes(y),t.n)},precompute(y=8,$=u.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}};function E(y,$=!0){return u.fromPrivateKey(y).toRawBytes($)}function b(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const R=nu("key",y).length,B=n.BYTES,k=B+1,D=2*B+1;if(!(t.allowedPrivateKeyLengths||s===k))return R===k||R===D}function S(y,$,R=!0){if(b(y)===!0)throw new Error("first arg must be private key");if(b($)===!1)throw new Error("second arg must be public key");return u.fromHex($).multiply(d(y)).toRawBytes(R)}const v=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const $=_w(y),R=y.length*8-i;return R>0?$>>BigInt(R):$},x=t.bits2int_modN||function(y){return c(v(y))},A=zN(i);function I(y){return kv("num < 2^"+i,y,Bp,A),wC(y,s)}function O(y,$,R=N){if(["recovered","canonical"].some(X=>X in R))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:k}=t;let{lowS:D,prehash:U,extraEntropy:F}=R;D==null&&(D=!0),y=nu("msgHash",y),GZ(R),U&&(y=nu("prehashed msgHash",B(y)));const K=x(y),q=d($),H=[I(q),I(K)];if(F!=null&&F!==!1){const X=F===!0?k(n.BYTES):F;H.push(nu("extraEntropy",X))}const Z=KS(...H),ee=K;function ie(X){const le=v(X);if(!f(le))return;const _e=l(le),Ne=u.BASE.multiply(le).toAffine(),be=c(Ne.x);if(be===Bp)return;const Me=c(_e*c(ee+be*q));if(Me===Bp)return;let Ct=(Ne.x===be?0:2)|Number(Ne.y&li),Wt=Me;return D&&g(Me)&&(Wt=p(Me),Ct^=1),new w(be,Wt,Ct)}return{seed:Z,k2sig:ie}}const N={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(y,$,R=N){const{seed:B,k2sig:k}=O(y,$,R),D=t;return lIe(D.hash.outputLen,D.nByteLength,D.hmac)(B,k)}u.BASE._setWindowSize(8);function _(y,$,R,B=T){var Ct;const k=y;$=nu("msgHash",$),R=nu("publicKey",R);const{lowS:D,prehash:U,format:F}=B;if(GZ(B),"strict"in B)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw new Error("format must be compact or der");const K=typeof k=="string"||mC(k),q=!K&&!F&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!K&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,Z;try{if(q&&(H=new w(k.r,k.s)),K){try{F!=="compact"&&(H=w.fromDER(k))}catch(Wt){if(!(Wt instanceof $p.Err))throw Wt}!H&&F!=="der"&&(H=w.fromCompact(k))}Z=u.fromHex(R)}catch{return!1}if(!H||D&&H.hasHighS())return!1;U&&($=t.hash($));const{r:ee,s:ie}=H,X=x($),le=l(ie),_e=c(X*le),Ne=c(ee*le),be=(Ct=u.BASE.multiplyAndAddUnsafe(Z,_e,Ne))==null?void 0:Ct.toAffine();return be?c(be.x)===ee:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:S,sign:P,verify:_,ProjectivePoint:u,Signature:w,utils:C}}function NIe(e){return{hash:e,hmac:(t,...n)=>m6(e,t,w6(...n)),randomBytes:g6}}function TIe(e,t){const n=r=>_Ie({...e,...NIe(r)});return{...n(t),create:n}}const Kle=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ZZ=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),PIe=BigInt(0),OIe=BigInt(1),OU=BigInt(2),YZ=(e,t)=>(e+t/OU)/t;function kIe(e){const t=Kle,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Pl(u,n,t)*u%t,h=Pl(d,n,t)*u%t,f=Pl(h,OU,t)*l%t,g=Pl(f,s,t)*f%t,p=Pl(g,i,t)*g%t,m=Pl(p,a,t)*p%t,w=Pl(m,c,t)*m%t,C=Pl(w,a,t)*p%t,E=Pl(C,n,t)*u%t,b=Pl(E,o,t)*g%t,S=Pl(b,r,t)*l%t,v=Pl(S,OU,t);if(!kU.eql(kU.sqr(v),e))throw new Error("Cannot find square root");return v}const kU=Cq(Kle,void 0,void 0,{sqrt:kIe}),RIe=TIe({a:PIe,b:BigInt(7),Fp:kU,n:ZZ,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=ZZ,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-OIe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=YZ(i*e,t),c=YZ(-r*e,t);let l=Ha(e-a*n-c*s,t),u=Ha(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},y6),BIe=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:RIe},Symbol.toStringTag,{value:"Module"}));function DIe(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let l=0;l<t.length;l++)t[l]=255;for(let l=0;l<e.length;l++){const u=e.charAt(l),d=u.charCodeAt(0);if(t[d]!==255)throw new TypeError(u+" is ambiguous");t[d]=l}const n=e.length,r=e.charAt(0),s=Math.log(n)/Math.log(256),i=Math.log(256)/Math.log(n);function o(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let u=0,d=0,h=0;const f=l.length;for(;h!==f&&l[h]===0;)h++,u++;const g=(f-h)*i+1>>>0,p=new Uint8Array(g);for(;h!==f;){let C=l[h],E=0;for(let b=g-1;(C!==0||E<d)&&b!==-1;b--,E++)C+=256*p[b]>>>0,p[b]=C%n>>>0,C=C/n>>>0;if(C!==0)throw new Error("Non-zero carry");d=E,h++}let m=g-d;for(;m!==g&&p[m]===0;)m++;let w=r.repeat(u);for(;m<g;++m)w+=e.charAt(p[m]);return w}function a(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let u=0,d=0,h=0;for(;l[u]===r;)d++,u++;const f=(l.length-u)*s+1>>>0,g=new Uint8Array(f);for(;u<l.length;){const C=l.charCodeAt(u);if(C>255)return;let E=t[C];if(E===255)return;let b=0;for(let S=f-1;(E!==0||b<h)&&S!==-1;S--,b++)E+=n*g[S]>>>0,g[S]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");h=b,u++}let p=f-h;for(;p!==f&&g[p]===0;)p++;const m=new Uint8Array(d+(f-p));let w=d;for(;p!==f;)m[w++]=g[p++];return m}function c(l){const u=a(l);if(u)return u;throw new Error("Non-base"+n+" character")}return{encode:o,decodeUnsafe:a,decode:c}}var UIe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const l1=DIe(UIe);function LIe(e){const t=e.length;let n=0,r=0;for(;r<t;){let s=e.charCodeAt(r++);if((s&4294967168)===0){n++;continue}else if((s&4294965248)===0)n+=2;else{if(s>=55296&&s<=56319&&r<t){const i=e.charCodeAt(r);(i&64512)===56320&&(++r,s=((s&1023)<<10)+(i&1023)+65536)}(s&4294901760)===0?n+=3:n+=4}}return n}function MIe(e,t,n){const r=e.length;let s=n,i=0;for(;i<r;){let o=e.charCodeAt(i++);if((o&4294967168)===0){t[s++]=o;continue}else if((o&4294965248)===0)t[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<r){const a=e.charCodeAt(i);(a&64512)===56320&&(++i,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(t[s++]=o>>12&15|224,t[s++]=o>>6&63|128):(t[s++]=o>>18&7|240,t[s++]=o>>12&63|128,t[s++]=o>>6&63|128)}t[s++]=o&63|128}}const jIe=new TextEncoder,FIe=50;function zIe(e,t,n){jIe.encodeInto(e,t.subarray(n))}function qIe(e,t,n){e.length>FIe?zIe(e,t,n):MIe(e,t,n)}const WIe=4096;function Gle(e,t,n){let r=t;const s=r+n,i=[];let o="";for(;r<s;){const a=e[r++];if((a&128)===0)i.push(a);else if((a&224)===192){const c=e[r++]&63;i.push((a&31)<<6|c)}else if((a&240)===224){const c=e[r++]&63,l=e[r++]&63;i.push((a&31)<<12|c<<6|l)}else if((a&248)===240){const c=e[r++]&63,l=e[r++]&63,u=e[r++]&63;let d=(a&7)<<18|c<<12|l<<6|u;d>65535&&(d-=65536,i.push(d>>>10&1023|55296),d=56320|d&1023),i.push(d)}else i.push(a);i.length>=WIe&&(o+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(o+=String.fromCharCode(...i)),o}const HIe=new TextDecoder,VIe=200;function KIe(e,t,n){const r=e.subarray(t,t+n);return HIe.decode(r)}function GIe(e,t,n){return n>VIe?KIe(e,t,n):Gle(e,t,n)}let Ex=class{constructor(t,n){this.type=t,this.data=n}},Th=class RU extends Error{constructor(t){super(t);const n=Object.create(RU.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:RU.name})}};const S3=4294967295;function ZIe(e,t,n){const r=n/4294967296,s=n;e.setUint32(t,r),e.setUint32(t+4,s)}function Zle(e,t,n){const r=Math.floor(n/4294967296),s=n;e.setUint32(t,r),e.setUint32(t+4,s)}function Yle(e,t){const n=e.getInt32(t),r=e.getUint32(t+4);return n*4294967296+r}function YIe(e,t){const n=e.getUint32(t),r=e.getUint32(t+4);return n*4294967296+r}const JIe=-1,XIe=4294967296-1,QIe=17179869184-1;function eSe({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=QIe)if(t===0&&e<=XIe){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e),n}else{const n=e/4294967296,r=e&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|n&3),i.setUint32(4,r),s}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,t),Zle(r,4,e),n}}function tSe(e){const t=e.getTime(),n=Math.floor(t/1e3),r=(t-n*1e3)*1e6,s=Math.floor(r/1e9);return{sec:n+s,nsec:r-s*1e9}}function nSe(e){if(e instanceof Date){const t=tSe(e);return eSe(t)}else return null}function rSe(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const n=t.getUint32(0),r=t.getUint32(4),s=(n&3)*4294967296+r,i=n>>>2;return{sec:s,nsec:i}}case 12:{const n=Yle(t,4),r=t.getUint32(0);return{sec:n,nsec:r}}default:throw new Th(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function sSe(e){const t=rSe(e);return new Date(t.sec*1e3+t.nsec/1e6)}const iSe={type:JIe,encode:nSe,decode:sSe};let GS=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(iSe)}register({type:t,encode:n,decode:r}){if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{const s=-1-t;this.builtInEncoders[s]=n,this.builtInDecoders[s]=r}}tryToEncode(t,n){for(let r=0;r<this.builtInEncoders.length;r++){const s=this.builtInEncoders[r];if(s!=null){const i=s(t,n);if(i!=null){const o=-1-r;return new Ex(o,i)}}}for(let r=0;r<this.encoders.length;r++){const s=this.encoders[r];if(s!=null){const i=s(t,n);if(i!=null){const o=r;return new Ex(o,i)}}}return t instanceof Ex?t:null}decode(t,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(t,n,r):new Ex(n,t)}};GS.defaultCodec=new GS;function oSe(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function BU(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):oSe(e)?new Uint8Array(e):Uint8Array.from(e)}const aSe=100,cSe=2048;let lSe=class Jle{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??GS.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??aSe,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??cSe,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Jle({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,n)}ensureBufferSizeToWrite(t){const n=this.pos+t;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(t){const n=new ArrayBuffer(t),r=new Uint8Array(n),s=new DataView(n);r.set(this.bytes),this.view=s,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=LIe(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),qIe(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,n){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,n);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const n=t.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=BU(t);this.writeU8a(r)}encodeArray(t,n){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const s of t)this.doEncode(s,n+1)}countWithoutUndefined(t,n){let r=0;for(const s of n)t[s]!==void 0&&r++;return r}encodeMap(t,n){const r=Object.keys(t);this.sortKeys&&r.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const i of r){const o=t[i];this.ignoreUndefined&&o===void 0||(this.encodeString(i),this.doEncode(o,n+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),s=r.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(t.type),this.writeU8a(r);return}const n=t.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const n=t.length;this.ensureBufferSizeToWrite(n),this.bytes.set(t,this.pos),this.pos+=n}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),ZIe(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),Zle(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}};function uSe(e,t){return new lSe(t).encodeSharedRef(e)}function cO(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}const dSe=16,hSe=16;let fSe=class{constructor(t=dSe,n=hSe){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=n,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,n,r){const s=this.caches[r-1];e:for(const i of s){const o=i.bytes;for(let a=0;a<r;a++)if(o[a]!==t[n+a])continue e;return i.str}return null}store(t,n){const r=this.caches[t.length-1],s={bytes:t,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=s:r.push(s)}decode(t,n,r){const s=this.find(t,n,r);if(s!=null)return this.hit++,s;this.miss++;const i=Gle(t,n,r),o=Uint8Array.prototype.slice.call(t,n,n+r);return this.store(o,i),i}};const DU="array",JE="map_key",Xle="map_value",pSe=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new Th("The type of key must be string or number but "+typeof e)};let gSe=class{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const n=this.getUninitializedStateFromPool();n.type=DU,n.position=0,n.size=t,n.array=new Array(t)}pushMapState(t){const n=this.getUninitializedStateFromPool();n.type=JE,n.readCount=0,n.size=t,n.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===DU){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===JE||t.type===Xle){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}};const A3=-1,$q=new DataView(new ArrayBuffer(0)),mSe=new Uint8Array($q.buffer);try{$q.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const JZ=new RangeError("Insufficient data"),wSe=new fSe;let ySe=class Qle{constructor(t){this.totalPos=0,this.pos=0,this.view=$q,this.bytes=mSe,this.headByte=A3,this.stack=new gSe,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??GS.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??S3,this.maxBinLength=(t==null?void 0:t.maxBinLength)??S3,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??S3,this.maxMapLength=(t==null?void 0:t.maxMapLength)??S3,this.maxExtLength=(t==null?void 0:t.maxExtLength)??S3,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:wSe,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??pSe}clone(){return new Qle({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=A3,this.stack.reset()}setBuffer(t){const n=BU(t);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===A3&&!this.hasRemaining(1))this.setBuffer(t);else{const n=this.bytes.subarray(this.pos),r=BU(t),s=new Uint8Array(n.length+r.length);s.set(n),s.set(r,n.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:n,pos:r}=this;return new RangeError(`Extra ${n.byteLength-r} of ${n.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let n=!1,r;for await(const a of t){if(n)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{r=this.doDecodeSync(),n=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(n){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:s,pos:i,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${cO(s)} at ${o} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,n){if(this.entered){yield*this.clone().decodeMultiAsync(t,n);return}try{this.entered=!0;let r=n,s=-1;for await(const i of t){if(n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),r&&(s=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let n;if(t>=224)n=t-256;else if(t<192)if(t<128)n=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else{const s=t-160;n=this.decodeString(s,0)}else if(t===192)n=null;else if(t===194)n=!1;else if(t===195)n=!0;else if(t===202)n=this.readF32();else if(t===203)n=this.readF64();else if(t===204)n=this.readU8();else if(t===205)n=this.readU16();else if(t===206)n=this.readU32();else if(t===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(t===208)n=this.readI8();else if(t===209)n=this.readI16();else if(t===210)n=this.readI32();else if(t===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(t===217){const s=this.lookU8();n=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();n=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();n=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(t===196){const s=this.lookU8();n=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();n=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();n=this.decodeBinary(s,4)}else if(t===212)n=this.decodeExtension(1,0);else if(t===213)n=this.decodeExtension(2,0);else if(t===214)n=this.decodeExtension(4,0);else if(t===215)n=this.decodeExtension(8,0);else if(t===216)n=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();n=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();n=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();n=this.decodeExtension(s,4)}else throw new Th(`Unrecognized type byte: ${cO(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const s=r.top();if(s.type===DU)if(s.array[s.position]=n,s.position++,s.position===s.size)n=s.array,r.release(s);else continue e;else if(s.type===JE){if(n==="__proto__")throw new Th("The key __proto__ is not allowed");s.key=this.mapKeyConverter(n),s.type=Xle;continue e}else if(s.map[s.key]=n,s.readCount++,s.readCount===s.size)n=s.map,r.release(s);else{s.key=null,s.type=JE;continue e}}return n}}readHeadByte(){return this.headByte===A3&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=A3}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new Th(`Unrecognized array type byte: ${cO(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new Th(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new Th(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,n):this.decodeBinary(t,n)}decodeUtf8String(t,n){var i;if(t>this.maxStrLength)throw new Th(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+n+t)throw JZ;const r=this.pos+n;let s;return this.stateIsMapKey()&&((i=this.keyDecoder)!=null&&i.canBeCached(t))?s=this.keyDecoder.decode(this.bytes,r,t):s=GIe(this.bytes,r,t),this.pos+=n+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===JE:!1}decodeBinary(t,n){if(t>this.maxBinLength)throw new Th(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+n))throw JZ;const r=this.pos+n,s=this.bytes.subarray(r,r+t);return this.pos+=n+t,s}decodeExtension(t,n){if(t>this.maxExtLength)throw new Th(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+n),s=this.decodeBinary(t,n+1);return this.extensionCodec.decode(s,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=YIe(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Yle(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}};function bSe(e,t){return new ySe(t).decode(e)}const vSe=e=>JSON.stringify(e,(t,n)=>typeof n=="bigint"?n.toString()+"n":n),ESe=e=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=e.replace(t,'$1"$2n"$3');return JSON.parse(n,(r,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function ul(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return ESe(e)}catch{return e}}function Ao(e){return typeof e=="string"?e:vSe(e)||""}function CSe(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function eue(e,...t){if(!CSe(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function XZ(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function $Se(e,t){eue(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const qb=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;const lO=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function xSe(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function tue(e){return typeof e=="string"&&(e=xSe(e)),eue(e),e}let ISe=class{clone(){return this._cloneInto()}};function SSe(e){const t=r=>e().update(tue(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function nue(e=32){if(qb&&typeof qb.getRandomValues=="function")return qb.getRandomValues(new Uint8Array(e));if(qb&&typeof qb.randomBytes=="function")return qb.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function ASe(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}let _Se=class extends ISe{constructor(t,n,r,s){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=lO(this.buffer)}update(t){XZ(this);const{view:n,buffer:r,blockLen:s}=this;t=tue(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=lO(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){XZ(this),$Se(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;ASe(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=lO(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.length=s,t.pos=a,t.finished=i,t.destroyed=o,s%n&&t.buffer.set(r),t}};const Cx=BigInt(2**32-1),UU=BigInt(32);function rue(e,t=!1){return t?{h:Number(e&Cx),l:Number(e>>UU&Cx)}:{h:Number(e>>UU&Cx)|0,l:Number(e&Cx)|0}}function NSe(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:o}=rue(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const TSe=(e,t)=>BigInt(e>>>0)<<UU|BigInt(t>>>0),PSe=(e,t,n)=>e>>>n,OSe=(e,t,n)=>e<<32-n|t>>>n,kSe=(e,t,n)=>e>>>n|t<<32-n,RSe=(e,t,n)=>e<<32-n|t>>>n,BSe=(e,t,n)=>e<<64-n|t>>>n-32,DSe=(e,t,n)=>e>>>n-32|t<<64-n,USe=(e,t)=>t,LSe=(e,t)=>e,MSe=(e,t,n)=>e<<n|t>>>32-n,jSe=(e,t,n)=>t<<n|e>>>32-n,FSe=(e,t,n)=>t<<n-32|e>>>64-n,zSe=(e,t,n)=>e<<n-32|t>>>64-n;function qSe(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const WSe=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),HSe=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,VSe=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),KSe=(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,GSe=(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0),ZSe=(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0,on={fromBig:rue,split:NSe,toBig:TSe,shrSH:PSe,shrSL:OSe,rotrSH:kSe,rotrSL:RSe,rotrBH:BSe,rotrBL:DSe,rotr32H:USe,rotr32L:LSe,rotlSH:MSe,rotlSL:jSe,rotlBH:FSe,rotlBL:zSe,add:qSe,add3L:WSe,add3H:HSe,add4L:VSe,add4H:KSe,add5H:ZSe,add5L:GSe},[YSe,JSe]=on.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
35771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Q0=new Uint32Array(80),eg=new Uint32Array(80);let XSe=class extends _Se{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:p,Hl:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=f|0,this.Gl=g|0,this.Hh=p|0,this.Hl=m|0}process(t,n){for(let E=0;E<16;E++,n+=4)Q0[E]=t.getUint32(n),eg[E]=t.getUint32(n+=4);for(let E=16;E<80;E++){const b=Q0[E-15]|0,S=eg[E-15]|0,v=on.rotrSH(b,S,1)^on.rotrSH(b,S,8)^on.shrSH(b,S,7),x=on.rotrSL(b,S,1)^on.rotrSL(b,S,8)^on.shrSL(b,S,7),A=Q0[E-2]|0,I=eg[E-2]|0,O=on.rotrSH(A,I,19)^on.rotrBH(A,I,61)^on.shrSH(A,I,6),N=on.rotrSL(A,I,19)^on.rotrBL(A,I,61)^on.shrSL(A,I,6),T=on.add4L(x,N,eg[E-7],eg[E-16]),P=on.add4H(T,v,O,Q0[E-7],Q0[E-16]);Q0[E]=P|0,eg[E]=T|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:p,Gl:m,Hh:w,Hl:C}=this;for(let E=0;E<80;E++){const b=on.rotrSH(d,h,14)^on.rotrSH(d,h,18)^on.rotrBH(d,h,41),S=on.rotrSL(d,h,14)^on.rotrSL(d,h,18)^on.rotrBL(d,h,41),v=d&f^~d&p,x=h&g^~h&m,A=on.add5L(C,S,x,JSe[E],eg[E]),I=on.add5H(A,w,b,v,YSe[E],Q0[E]),O=A|0,N=on.rotrSH(r,s,28)^on.rotrBH(r,s,34)^on.rotrBH(r,s,39),T=on.rotrSL(r,s,28)^on.rotrBL(r,s,34)^on.rotrBL(r,s,39),P=r&i^r&a^i&a,_=s&o^s&c^o&c;w=p|0,C=m|0,p=f|0,m=g|0,f=d|0,g=h|0,{h:d,l:h}=on.add(l|0,u|0,I|0,O|0),l=a|0,u=c|0,a=i|0,c=o|0,i=r|0,o=s|0;const y=on.add3L(O,T,_);r=on.add3H(y,I,N,P),s=y|0}({h:r,l:s}=on.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=on.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=on.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=on.add(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:h}=on.add(this.Eh|0,this.El|0,d|0,h|0),{h:f,l:g}=on.add(this.Fh|0,this.Fl|0,f|0,g|0),{h:p,l:m}=on.add(this.Gh|0,this.Gl|0,p|0,m|0),{h:w,l:C}=on.add(this.Hh|0,this.Hl|0,w|0,C|0),this.set(r,s,i,o,a,c,l,u,d,h,f,g,p,m,w,C)}roundClean(){Q0.fill(0),eg.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const QSe=SSe(()=>new XSe);const xq=BigInt(0),sue=BigInt(1),e9e=BigInt(2);function Iq(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Sq(e){if(!Iq(e))throw new Error("Uint8Array expected")}function uO(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}const t9e=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Aq(e){Sq(e);let t="";for(let n=0;n<e.length;n++)t+=t9e[e[n]];return t}function iue(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?xq:BigInt("0x"+e)}const Pf={_0:48,_9:57,A:65,F:70,a:97,f:102};function QZ(e){if(e>=Pf._0&&e<=Pf._9)return e-Pf._0;if(e>=Pf.A&&e<=Pf.F)return e-(Pf.A-10);if(e>=Pf.a&&e<=Pf.f)return e-(Pf.a-10)}function oue(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=QZ(e.charCodeAt(i)),a=QZ(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function n9e(e){return iue(Aq(e))}function hS(e){return Sq(e),iue(Aq(Uint8Array.from(e).reverse()))}function aue(e,t){return oue(e.toString(16).padStart(t*2,"0"))}function LU(e,t){return aue(e,t).reverse()}function Of(e,t,n){let r;if(typeof t=="string")try{r=oue(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(Iq(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function eY(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];Sq(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const dO=e=>typeof e=="bigint"&&xq<=e;function r9e(e,t,n){return dO(e)&&dO(t)&&dO(n)&&t<=e&&e<n}function _3(e,t,n,r){if(!r9e(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function s9e(e){let t;for(t=0;e>xq;e>>=sue,t+=1);return t}const i9e=e=>(e9e<<BigInt(e-1))-sue,o9e={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Iq(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function _q(e,t,n={}){const r=(s,i,o)=>{const a=o9e[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invali
3d. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function tY(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const xi=BigInt(0),gs=BigInt(1),Z1=BigInt(2),a9e=BigInt(3),MU=BigInt(4),nY=BigInt(5),rY=BigInt(8);function Js(e,t){const n=e%t;return n>=xi?n:t+n}function c9e(e,t,n){if(t<xi)throw new Error("invalid exponent, negatives unsupported");if(n<=xi)throw new Error("invalid modulus");if(n===gs)return xi;let r=gs;for(;t>xi;)t&gs&&(r=r*e%n),e=e*e%n,t>>=gs;return r}function dh(e,t,n){let r=e;for(;t-- >xi;)r*=r,r%=n;return r}function sY(e,t){if(e===xi)throw new Error("invert: expected non-zero number");if(t<=xi)throw new Error("invert: expected positive modulus, got "+t);let n=Js(e,t),r=t,s=xi,i=gs;for(;n!==xi;){const o=r/n,a=r%n,c=s-i*o;r=n,n=a,s=i,i=c}if(r!==gs)throw new Error("invert: does not exist");return Js(s,t)}function l9e(e){const t=(e-gs)/Z1;let n,r,s;for(n=e-gs,r=0;n%Z1===xi;n/=Z1,r++);for(s=Z1;s<e&&c9e(s,t,e)!==e-gs;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+gs)/MU;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const i=(n+gs)/Z1;return function(o,a){if(o.pow(a,t)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,s),n),u=o.pow(a,i),d=o.pow(a,n);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let h=1;for(let g=o.sqr(d);h<c&&!o.eql(g,o.ONE);h++)g=o.sqr(g);const f=o.pow(l,gs<<BigInt(c-h-1));l=o.sqr(f),u=o.mul(u,f),d=o.mul(d,l),c=h}return u}}function u9e(e){if(e%MU===a9e){const t=(e+gs)/MU;return function(n,r){const s=n.pow(r,t);if(!n.eql(n.sqr(s),r))throw new Error("Cannot find square root");return s}}if(e%rY===nY){const t=(e-nY)/rY;return function(n,r){const s=n.mul(r,Z1),i=n.pow(s,t),o=n.mul(r,i),a=n.mul(n.mul(o,Z1),i),c=n.mul(o,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),r))throw new Error("Cannot find square root");return c}}return l9e(e)}const d9e=(e,t)=>(Js(e,t)&gs)===gs,h9e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function f9e(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=h9e.reduce((r,s)=>(r[s]="function",r),t);return _q(e,n)}function p9e(e,t,n){if(n<xi)throw new Error("invalid exponent, negatives unsupported");if(n===xi)return e.ONE;if(n===gs)return t;let r=e.ONE,s=t;for(;n>xi;)n&gs&&(r=e.mul(r,s)),s=e.sqr(s),n>>=gs;return r}function g9e(e,t){const n=new Array(t.length),r=t.reduce((i,o,a)=>e.is0(o)?i:(n[a]=i,e.mul(i,o)),e.ONE),s=e.inv(r);return t.reduceRight((i,o,a)=>e.is0(o)?i:(n[a]=e.mul(i,n[a]),e.mul(i,o)),s),n}function cue(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function lue(e,t,n=!1,r={}){if(e<=xi)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=cue(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:i9e(s),ZERO:xi,ONE:gs,create:c=>Js(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return xi<=c&&c<e},is0:c=>c===xi,isOdd:c=>(c&gs)===gs,neg:c=>Js(-c,e),eql:(c,l)=>c===l,sqr:c=>Js(c*c,e),add:(c,l)=>Js(c+l,e),sub:(c,l)=>Js(c-l,e),mul:(c,l)=>Js(c*l,e),pow:(c,l)=>p9e(a,c,l),div:(c,l)=>Js(c*sY(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>sY(c,e),sqrt:r.sqrt||(c=>(o||(o=u9e(e)),o(a,c))),invertBatch:c=>g9e(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>n?LU(c,i):aue(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?hS(c):n9e(c)}});return Object.freeze(a)}const iY=BigInt(0),$x=BigInt(1);function hO(e,t){const n=t.negate();return e?n:t}function uue(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function fO(e,t){uue(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1);return{windows:n,windowSize:r}}function m9e(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function w9e(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const pO=new WeakMap,due=new WeakMap;function gO(e){return due.get(e)||1}function y9e(e,t){return{constTimeNegate:hO,hasPrecomputes(n){return gO(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>iY;)r&$x&&(s=s.add(i)),i=i.double(),r>>=$x;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=fO(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){const{windows:i,windowSize:o}=fO(n,t);let a=e.ZERO,c=e.BASE;const l=BigInt(2**n-1),u=2**n,d=BigInt(n);for(let h=0;h<i;h++){const f=h*o;let g=Number(s&l);s>>=d,g>o&&(g-=u,s+=$x);const p=f,m=f+Math.abs(g)-1,w=h%2!==0,C=g<0;g===0?c=c.add(hO(w,r[p])):a=a.add(hO(C,r[m]))}return{p:a,f:c}},wNAFUnsafe(n,r,s,i=e.ZERO){const{windows:o,windowSize:a}=fO(n,t),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let d=0;d<o;d++){const h=d*a;if(s===iY)break;let f=Number(s&c);if(s>>=u,f>a&&(f-=l,s+=$x),f===0)continue;let g=r[h+Math.abs(f)-1];f<0&&(g=g.negate()),i=i.add(g)}return i},getPrecomputes(n,r,s){let i=pO.get(r);
vendor: 15,017 bytes, line 3
3return i||(i=this.precomputeWindow(r,n),n!==1&&pO.set(r,s(i))),i},wNAFCached(n,r,s){const i=gO(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=gO(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){uue(r,t),due.set(n,r),pO.delete(n)}}}function b9e(e,t,n,r){if(m9e(n,e),w9e(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,i=s9e(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((t.BITS-1)/o)*o;let u=s;for(let d=l;d>=0;d-=o){c.fill(s);for(let f=0;f<r.length;f++){const g=r[f],p=Number(g>>BigInt(d)&BigInt(a));c[p]=c[p].add(n[f])}let h=s;for(let f=c.length-1,g=s;f>0;f--)g=g.add(c[f]),h=h.add(g);if(u=u.add(h),d!==0)for(let f=0;f<o;f++)u=u.double()}return u}function v9e(e){return f9e(e.Fp),_q(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...cue(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const Vu=BigInt(0),$a=BigInt(1),xx=BigInt(2),E9e=BigInt(8),C9e={zip215:!0};function $9e(e){const t=v9e(e);return _q(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function x9e(e){const t=$9e(e),{Fp:n,n:r,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=t,l=xx<<BigInt(a*8)-$a,u=n.create,d=lue(t.n,t.nBitLength),h=t.uvRatio||((y,$)=>{try{return{isValid:!0,value:n.sqrt(y*n.inv($))}}catch{return{isValid:!1,value:Vu}}}),f=t.adjustScalarBytes||(y=>y),g=t.domain||((y,$,R)=>{if(uO("phflag",R),$.length||R)throw new Error("Contexts/pre-hash are not supported");return y});function p(y,$){_3("coordinate "+y,$,Vu,l)}function m(y){if(!(y instanceof E))throw new Error("ExtendedPoint expected")}const w=tY((y,$)=>{const{ex:R,ey:B,ez:k}=y,D=y.is0();$==null&&($=D?E9e:n.inv(k));const U=u(R*$),F=u(B*$),K=u(k*$);if(D)return{x:Vu,y:$a};if(K!==$a)throw new Error("invZ was invalid");return{x:U,y:F}}),C=tY(y=>{const{a:$,d:R}=t;if(y.is0())throw new Error("bad point: ZERO");const{ex:B,ey:k,ez:D,et:U}=y,F=u(B*B),K=u(k*k),q=u(D*D),H=u(q*q),Z=u(F*$),ee=u(q*u(Z+K)),ie=u(H+u(R*u(F*K)));if(ee!==ie)throw new Error("bad point: equation left != right (1)");const X=u(B*k),le=u(D*U);if(X!==le)throw new Error("bad point: equation left != right (2)");return!0});class E{constructor($,R,B,k){this.ex=$,this.ey=R,this.ez=B,this.et=k,p("x",$),p("y",R),p("z",B),p("t",k),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine($){if($ instanceof E)throw new Error("extended point not allowed");const{x:R,y:B}=$||{};return p("x",R),p("y",B),new E(R,B,$a,u(R*B))}static normalizeZ($){const R=n.invertBatch($.map(B=>B.ez));return $.map((B,k)=>B.toAffine(R[k])).map(E.fromAffine)}static msm($,R){return b9e(E,d,$,R)}_setWindowSize($){v.setWindowSize(this,$)}assertValidity(){C(this)}equals($){m($);const{ex:R,ey:B,ez:k}=this,{ex:D,ey:U,ez:F}=$,K=u(R*F),q=u(D*k),H=u(B*F),Z=u(U*k);return K===q&&H===Z}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:$}=t,{ex:R,ey:B,ez:k}=this,D=u(R*R),U=u(B*B),F=u(xx*u(k*k)),K=u($*D),q=R+B,H=u(u(q*q)-D-U),Z=K+U,ee=Z-F,ie=K-U,X=u(H*ee),le=u(Z*ie),_e=u(H*ie),Ne=u(ee*Z);return new E(X,le,Ne,_e)}add($){m($);const{a:R,d:B}=t,{ex:k,ey:D,ez:U,et:F}=this,{ex:K,ey:q,ez:H,et:Z}=$;if(R===BigInt(-1)){const gx=u((D-k)*(q+K)),b3=u((D+k)*(q-K)),X0=u(b3-gx);if(X0===Vu)return this.double();const kc=u(U*xx*Z),Fb=u(F*xx*H),mx=Fb+kc,Hu=b3+gx,wx=Fb-kc,W=u(mx*X0),L=u(Hu*wx),M=u(mx*wx),Y=u(X0*Hu);return new E(W,L,Y,M)}const ee=u(k*K),ie=u(D*q),X=u(F*B*Z),le=u(U*H),_e=u((k+D)*(K+q)-ee-ie),Ne=le-X,be=le+X,Me=u(ie-R*ee),Ct=u(_e*Ne),Wt=u(be*Me),y3=u(_e*Me),qP=u(Ne*be);return new E(Ct,Wt,qP,y3)}subtract($){return this.add($.negate())}wNAF($){return v.wNAFCached(this,$,E.normalizeZ)}multiply($){const R=$;_3("scalar",R,$a,r);const{p:B,f:k}=this.wNAF(R);return E.normalizeZ([B,k])[0]}multiplyUnsafe($,R=E.ZERO){const B=$;return _3("scalar",B,Vu,r),B===Vu?S:this.is0()||B===$a?this:v.wNAFCachedUnsafe(this,B,E.normalizeZ,R)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return v.unsafeLadder(this,r).is0()}toAffine($){return w(this,$)}clearCofactor(){const{h:$}=t;return $===$a?this:this.multiplyUnsafe($)}static fromHex($,R=!1){const{d:B,a:k}=t,D=n.BYTES;$=Of("pointHex",$,D),uO("zip215",R);const U=$.slice(),F=$[D-1];U[D-1]=F&-129;const K=hS(U),q=R?l:n.ORDER;_3("pointHex.y",K,Vu,q);const H=u(K*K),Z=u(H-$a),ee=u(B*H-k);let{isValid:ie,value:X}=h(Z,ee);if(!ie)throw new Error("Point.fromHex: invalid y coordinate");const le=(X&$a)===$a,_e=(F&128)!==0;if(!R&&X===Vu&&_e)throw new Error("Point.fromHex: x=0 and x_0=1");return _e!==le&&(X=u(-X)),E.fromAffine({x:X,y:K})}static fromPrivateKey($){return I($).point}toRawBytes(){const{x:$,y:R}=this.toAffine(),B=LU(R,n.BYTES);return B[B.length-1]|=$&$a?128:0,B}toHex(){return Aq(this.toRawBytes())}}E.BASE=new E(t.Gx,t.Gy,$a,u(t.Gx*t.Gy)),E.ZERO=new E(Vu,$a,$a,Vu);const{BASE:b,ZERO:S}=E,v=y9e(E,a*8);function x(y){return Js(y,r)}function A(y){return x(hS(y))}function I(y){const $=n.BYTES;y=Of("private key",y,$);const R=Of("hashed private key",i(y),2*$),B=f(R.slice(0,$)),k=R.slice($,2*$),D=A(B),U=b.multiply(D),F=U.toRawBytes();return{head:B,prefix:k,scalar:D,point:U,pointBytes:F}}function O(y){return I(y).pointBytes}function N(y=new Uint8Array,...$){const R=eY(...$);return A(i(g(R,Of("context",y),!!s)))}function T(y,$,R={}){y=Of("message",y),s&&(y=s(y));const{prefix:B,scalar:k,pointBytes:D}=I($),U=N(R.context,B,y),F=b.multiply(U).toRawBytes(),K=N(R.context,F,D,y),q=x(U+K*k);_3("signature.s",q,Vu,r);const H=eY(F,LU(q,n.BYTES));return Of("result",H,n.BYTES*2)}const P=C9e;function _(y,$,R,B=P){const{context:k,zip215:D}=B,U=n.BYTES;y=Of("signature",y,2*U),$=Of("message",$),R=Of("publicKey",R,U),D!==void 0&&uO("zip215",D),s&&($=s($));const F=hS(y.slice(U,2*U));let K,q,H;try{K=E.fromHex(R,D),q=E.fromHex(y.slice(0,U),D),H=b.multiplyUnsafe(F)}catch{return!1}if(!D&&K.isSmallOrder())return!1;const Z=N(k,q.toRawBytes(),K.toRawBytes(),$);return q.add(K.multiplyUnsafe(Z)).subtract(H).clearCofactor().equals(E.ZERO)}return b._setWindowSize(8),{CURVE:t,getPublicKey:O,sign:T,verify:_,ExtendedPoint:E,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>o(n.BYTES),precompute(y=8,$=E.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}}}}BigInt(0),BigInt(1);const Nq=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),oY=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const I9e=BigInt(1),aY=BigInt(2);BigInt(3);const S9e=BigInt(5),A9e=BigInt(8);function _9e(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=Nq,o=e*e%i*e%i,a=dh(o,aY,i)*o%i,c=dh(a,I9e,i)*e%i,l=dh(c,S9e,i)*c%i,u=dh(l,t,i)*l%i,d=dh(u,n,i)*u%i,h=dh(d,r,i)*d%i,f=dh(h,s,i)*h%i,g=dh(f,s,i)*h%i,p=dh(g,t,i)*l%i;return{pow_p_5_8:dh(p,aY,i)*e%i,b2:o}}function N9e(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function T9e(e,t){const n=Nq,r=Js(t*t*t,n),s=Js(r*r*t,n),i=_9e(e*s).pow_p_5_8;let o=Js(e*r*i,n);const a=Js(t*o*o,n),c=o,l=Js(o*oY,n),u=a===e,d=a===Js(-e,n),h=a===Js(-e*oY,n);return u&&(o=c),(d||h)&&(o=l),d9e(o,n)&&(o=Js(-o,n)),{isValid:u||d,value:o}}const P9e=lue(Nq,void 0,!0),O9e={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:P9e,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:A9e,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:QSe,randomBytes:nue,adjustScalarBytes:N9e,uvRatio:T9e},hue=x9e(O9e),k9e="EdDSA",R9e="JWT",ZS=".",WN="base64url",fue="utf8",pue="utf8",B9e=":",D9e="did",U9e="key",cY="base58btc",L9e="z",M9e="K36",j9e=32;function Tq(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function gue(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Tq(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function mue(e,t){t||(t=e.reduce((s,i)=>s+i.length,0));const n=gue(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return Tq(n)}function F9e(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),o=i.charCodeAt(0);if(n[o]!==255)throw new TypeError(i+" is ambiguous");n[o]=s}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var p=0,m=0,w=0,C=g.length;w!==C&&g[w]===0;)w++,p++;for(var E=(C-w)*u+1>>>0,b=new Uint8Array(E);w!==C;){for(var S=g[w],v=0,x=E-1;(S!==0||v<m)&&x!==-1;x--,v++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");m=v,w++}for(var A=E-m;A!==E&&b[A]===0;)A++;for(var I=c.repeat(p);A<E;++A)I+=e.charAt(b[A]);return I}function h(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var p=0;if(g[p]!==" "){for(var m=0,w=0;g[p]===c;)m++,p++;for(var C=(g.length-p)*l+1>>>0,E=new Uint8Array(C);g[p];){var b=n[g.charCodeAt(p)];if(b===255)return;for(var S=0,v=C-1;(b!==0||S<w)&&v!==-1;v--,S++)b+=a*E[v]>>>0,E[v]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");w=S,p++}if(g[p]!==" "){for(var x=C-w;x!==C&&E[x]===0;)x++;for(var A=new Uint8Array(m+(C-x)),I=m;x!==C;)A[I++]=E[x++];return A}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var z9e=F9e,q9e=z9e;const wue=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},W9e=e=>new TextEncoder().encode(e),H9e=e=>new TextDecoder().decode(e);let V9e=class{constructor(t,n,r){this.name=t,this.prefix=n,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},K9e=class{constructor(t,n,r){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return yue(this,t)}},G9e=class{constructor(t){this.decoders=t}or(t){return yue(this,t)}decode(t){const n=t[0],r=this.decoders[n];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const yue=(e,t)=>new G9e({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let Z9e=class{constructor(t,n,r,s){this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new V9e(t,n,r),this.decoder=new K9e(t,n,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};const HN=({name:e,prefix:t,encode:n,decode:r})=>new Z9e(e,t,n,r),yC=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:s}=q9e(n,t);return HN({prefix:e,name:t,encode:r,decode:i=>wue(s(i))})},Y9e=(e,t,n,r)=>{const s={};for(let u=0;u<t.length;++u)s[t[u]]=u;let i=e.length;for(;e[i-1]==="=";)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,l=0;for(let u=0;u<i;++u){const d=s[e[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<n|d,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},J9e=(e,t,n)=>{const r=t[t.length-1]==="=",s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>n;)o-=n,i+=t[s&a>>o];if(o&&(i+=t[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i},Qi=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>HN({prefix:t,name:e,encode(s){return J9e(s,r,n)},decode(s){return Y9e(s,r,n,e)}}),X9e=HN({prefix:"\0",name:"identity",encode:e=>H9e(e),decode:e=>W9e(e)});var Q9e=Object.freeze({__proto__:null,identity:X9e});const eAe=Qi({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var tAe=Object.freeze({__proto__:null,base2:eAe});const nAe=Qi({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rAe=Object.freeze({__proto__:null,base8:nAe});const sAe=yC({prefix:"9",name:"base10",alphabet:"0123456789"});var iAe=Object.freeze({__proto__:null,base10:sAe});const oAe=Qi({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),aAe=Qi({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var cAe=Object.freeze({__proto__:null,base16:oAe,base16upper:aAe});const lAe=Qi({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),uAe=Qi({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dAe=Qi({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hAe=Qi({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fAe=Qi({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pAe=Qi({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),gAe=Qi({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),mAe=Qi({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),wAe=Qi({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var yAe=Object.freeze({__proto__:null,base32:lAe,base32upper:uAe,base32pad:dAe,base32padupper:hAe,base32hex:fAe,base32hexupper:pAe,base32hexpad:gAe,base32hexpadupper:mAe,base32z:wAe});const bAe=yC({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vAe=yC({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var EAe=Object.freeze({__proto__:null,base36:bAe,base36upper:vAe});const CAe=yC({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$Ae=yC({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xAe=Object.freeze({__proto__:null,base58btc:CAe,base58flickr:$Ae});const IAe=Qi({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
3+/",bitsPerChar:6}),SAe=Qi({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),AAe=Qi({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_Ae=Qi({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var NAe=Object.freeze({__proto__:null,base64:IAe,base64pad:SAe,base64url:AAe,base64urlpad:_Ae});const bue=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),TAe=bue.reduce((e,t,n)=>(e[n]=t,e),[]),PAe=bue.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function OAe(e){return e.reduce((t,n)=>(t+=TAe[n],t),"")}function kAe(e){const t=[];for(const n of e){const r=PAe[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);t.push(r)}return new Uint8Array(t)}const RAe=HN({prefix:"ð",name:"base256emoji",encode:OAe,decode:kAe});var BAe=Object.freeze({__proto__:null,base256emoji:RAe}),DAe=vue,lY=128,UAe=-128,LAe=Math.pow(2,31);function vue(e,t,n){t=t||[],n=n||0;for(var r=n;e>=LAe;)t[n++]=e&255|lY,e/=128;for(;e&UAe;)t[n++]=e&255|lY,e>>>=7;return t[n]=e|0,vue.bytes=n-r+1,t}var MAe=jU,jAe=128,uY=127;function jU(e,r){var n=0,r=r||0,s=0,i=r,o,a=e.length;do{if(i>=a)throw jU.bytes=0,new RangeError("Could not decode varint");o=e[i++],n+=s<28?(o&uY)<<s:(o&uY)*Math.pow(2,s),s+=7}while(o>=jAe);return jU.bytes=i-r,n}var FAe=Math.pow(2,7),zAe=Math.pow(2,14),qAe=Math.pow(2,21),WAe=Math.pow(2,28),HAe=Math.pow(2,35),VAe=Math.pow(2,42),KAe=Math.pow(2,49),GAe=Math.pow(2,56),ZAe=Math.pow(2,63),YAe=function(e){return e<FAe?1:e<zAe?2:e<qAe?3:e<WAe?4:e<HAe?5:e<VAe?6:e<KAe?7:e<GAe?8:e<ZAe?9:10},JAe={encode:DAe,decode:MAe,encodingLength:YAe},Eue=JAe;const dY=(e,t,n=0)=>(Eue.encode(e,t,n),t),hY=e=>Eue.encodingLength(e),FU=(e,t)=>{const n=t.byteLength,r=hY(e),s=r+hY(n),i=new Uint8Array(s+n);return dY(e,i,0),dY(n,i,r),i.set(t,s),new XAe(e,n,t,i)};let XAe=class{constructor(t,n,r,s){this.code=t,this.size=n,this.digest=r,this.bytes=s}};const Cue=({name:e,code:t,encode:n})=>new QAe(e,t,n);let QAe=class{constructor(t,n,r){this.name=t,this.code=n,this.encode=r}digest(t){if(t instanceof Uint8Array){const n=this.encode(t);return n instanceof Uint8Array?FU(this.code,n):n.then(r=>FU(this.code,r))}else throw Error("Unknown type, must be binary type")}};const $ue=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),e_e=Cue({name:"sha2-256",code:18,encode:$ue("SHA-256")}),t_e=Cue({name:"sha2-512",code:19,encode:$ue("SHA-512")});var n_e=Object.freeze({__proto__:null,sha256:e_e,sha512:t_e});const xue=0,r_e="identity",Iue=wue,s_e=e=>FU(xue,Iue(e)),i_e={code:xue,name:r_e,encode:Iue,digest:s_e};var o_e=Object.freeze({__proto__:null,identity:i_e});new TextEncoder,new TextDecoder;const fY={...Q9e,...tAe,...rAe,...iAe,...cAe,...yAe,...EAe,...xAe,...NAe,...BAe};({...n_e,...o_e});function Sue(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const pY=Sue("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),mO=Sue("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=gue(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),Aue={utf8:pY,"utf-8":pY,hex:fY.base16,latin1:mO,ascii:mO,binary:mO,...fY};function VN(e,t="utf8"){const n=Aue[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):n.encoder.encode(e).substring(1)}function E6(e,t="utf8"){const n=Aue[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Tq(globalThis.Buffer.from(e,"utf-8")):n.decoder.decode(`${n.prefix}${e}`)}function gY(e){return ul(VN(E6(e,WN),fue))}function YS(e){return VN(E6(Ao(e),fue),WN)}function bC(e){const t=E6(M9e,cY),n=L9e+VN(mue([t,e]),cY);return[D9e,U9e,n].join(B9e)}function a_e(e){return VN(e,WN)}function c_e(e){return E6(e,WN)}function l_e(e){return E6([YS(e.header),YS(e.payload)].join(ZS),pue)}function u_e(e){return[YS(e.header),YS(e.payload),a_e(e.signature)].join(ZS)}function wu(e){const t=e.split(ZS),n=gY(t[0]),r=gY(t[1]),s=c_e(t[2]),i=E6(t.slice(0,2).join(ZS),pue);return{header:n,payload:r,signature:s,data:i}}function jm(e=nue(j9e)){const t=hue.getPublicKey(e);return{secretKey:mue([e,t]),publicKey:t}}async function KN(e,t,n,r,s=V.fromMiliseconds(Date.now())){const i={alg:k9e,typ:R9e},o=bC(r.publicKey),a=s+n,c={iss:o,sub:e,aud:t,iat:s,exp:a},l=l_e({header:i,payload:c}),u=hue.sign(l,r.secretKey.slice(0,32));return u_e({header:i,payload:c,signature:u})}function Pq(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function _ue(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Pq(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function Yo(e,t){t||(t=e.reduce((s,i)=>s+i.length,0));const n=_ue(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return Pq(n)}
vendor: 4,259 bytes, line 3
3function d_e(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),o=i.charCodeAt(0);if(n[o]!==255)throw new TypeError(i+" is ambiguous");n[o]=s}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var p=0,m=0,w=0,C=g.length;w!==C&&g[w]===0;)w++,p++;for(var E=(C-w)*u+1>>>0,b=new Uint8Array(E);w!==C;){for(var S=g[w],v=0,x=E-1;(S!==0||v<m)&&x!==-1;x--,v++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");m=v,w++}for(var A=E-m;A!==E&&b[A]===0;)A++;for(var I=c.repeat(p);A<E;++A)I+=e.charAt(b[A]);return I}function h(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var p=0;if(g[p]!==" "){for(var m=0,w=0;g[p]===c;)m++,p++;for(var C=(g.length-p)*l+1>>>0,E=new Uint8Array(C);g[p];){var b=n[g.charCodeAt(p)];if(b===255)return;for(var S=0,v=C-1;(b!==0||S<w)&&v!==-1;v--,S++)b+=a*E[v]>>>0,E[v]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");w=S,p++}if(g[p]!==" "){for(var x=C-w;x!==C&&E[x]===0;)x++;for(var A=new Uint8Array(m+(C-x)),I=m;x!==C;)A[I++]=E[x++];return A}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var h_e=d_e,f_e=h_e;const p_e=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},g_e=e=>new TextEncoder().encode(e),m_e=e=>new TextDecoder().decode(e);let w_e=class{constructor(t,n,r){this.name=t,this.prefix=n,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},y_e=class{constructor(t,n,r){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Nue(this,t)}};class b_e{constructor(t){this.decoders=t}or(t){return Nue(this,t)}decode(t){const n=t[0],r=this.decoders[n];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nue=(e,t)=>new b_e({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class v_e{constructor(t,n,r,s){this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new w_e(t,n,r),this.decoder=new y_e(t,n,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const GN=({name:e,prefix:t,encode:n,decode:r})=>new v_e(e,t,n,r),vC=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:s}=f_e(n,t);return GN({prefix:e,name:t,encode:r,decode:i=>p_e(s(i))})},E_e=(e,t,n,r)=>{const s={};for(let u=0;u<t.length;++u)s[t[u]]=u;let i=e.length;for(;e[i-1]==="=";)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,l=0;for(let u=0;u<i;++u){const d=s[e[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<n|d,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},C_e=(e,t,n)=>{const r=t[t.length-1]==="=",s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>n;)o-=n,i+=t[s&a>>o];if(o&&(i+=t[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i},eo=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>GN({prefix:t,name:e,encode(s){return C_e(s,r,n)},decode(s){return E_e(s,r,n,e)}}),$_e=GN({prefix:"\0",name:"identity",encode:e=>m_e(e),decode:e=>g_e(e)}
3),x_e=Object.freeze(Object.defineProperty({__proto__:null,identity:$_e},Symbol.toStringTag,{value:"Module"})),I_e=eo({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),S_e=Object.freeze(Object.defineProperty({__proto__:null,base2:I_e},Symbol.toStringTag,{value:"Module"})),A_e=eo({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),__e=Object.freeze(Object.defineProperty({__proto__:null,base8:A_e},Symbol.toStringTag,{value:"Module"})),N_e=vC({prefix:"9",name:"base10",alphabet:"0123456789"}),T_e=Object.freeze(Object.defineProperty({__proto__:null,base10:N_e},Symbol.toStringTag,{value:"Module"})),P_e=eo({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),O_e=eo({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),k_e=Object.freeze(Object.defineProperty({__proto__:null,base16:P_e,base16upper:O_e},Symbol.toStringTag,{value:"Module"})),R_e=eo({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),B_e=eo({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),D_e=eo({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),U_e=eo({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),L_e=eo({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),M_e=eo({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),j_e=eo({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),F_e=eo({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),z_e=eo({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),q_e=Object.freeze(Object.defineProperty({__proto__:null,base32:R_e,base32hex:L_e,base32hexpad:j_e,base32hexpadupper:F_e,base32hexupper:M_e,base32pad:D_e,base32padupper:U_e,base32upper:B_e,base32z:z_e},Symbol.toStringTag,{value:"Module"})),W_e=vC({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),H_e=vC({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),V_e=Object.freeze(Object.defineProperty({__proto__:null,base36:W_e,base36upper:H_e},Symbol.toStringTag,{value:"Module"})),K_e=vC({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),G_e=vC({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Z_e=Object.freeze(Object.defineProperty({__proto__:null,base58btc:K_e,base58flickr:G_e},Symbol.toStringTag,{value:"Module"})),Y_e=eo({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),J_e=eo({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),X_e=eo({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Q_e=eo({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),eNe=Object.freeze(Object.defineProperty({__proto__:null,base64:Y_e,base64pad:J_e,base64url:X_e,base64urlpad:Q_e},Symbol.toStringTag,{value:"Module"})),Tue=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),tNe=Tue.reduce((e,t,n
vendor: 28,756 bytes, lines 3-5
3)=>(e[n]=t,e),[]),nNe=Tue.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function rNe(e){return e.reduce((t,n)=>(t+=tNe[n],t),"")}function sNe(e){const t=[];for(const n of e){const r=nNe[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);t.push(r)}return new Uint8Array(t)}const iNe=GN({prefix:"ð",name:"base256emoji",encode:rNe,decode:sNe}),oNe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:iNe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const JS={...x_e,...S_e,...__e,...T_e,...k_e,...q_e,...V_e,...Z_e,...eNe,...oNe};function Pue(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const mY=Pue("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),wO=Pue("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=_ue(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),Oue={utf8:mY,"utf-8":mY,hex:JS.base16,latin1:wO,ascii:wO,binary:wO,...JS};function vn(e,t="utf8"){const n=Oue[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Pq(globalThis.Buffer.from(e,"utf-8")):n.decoder.decode(`${n.prefix}${e}`)}function rn(e,t="utf8"){const n=Oue[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):n.encoder.encode(e).substring(1)}const ZN={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var yO,wY;function kue(){if(wY)return yO;wY=1;const e="Input must be an string, Buffer or Uint8Array";function t(o){let a;if(o instanceof Uint8Array)a=o;else if(typeof o=="string")a=new TextEncoder().encode(o);else throw new Error(e);return a}function n(o){return Array.prototype.map.call(o,function(a){return(a<16?"0":"")+a.toString(16)}).join("")}function r(o){return(4294967296+o).toString(16).substring(1)}function s(o,a,c){let l=` 4`+o+" = ";for(let u=0;u<a.length;u+=2){if(c===32)l+=r(a[u]).toUpperCase(),l+=" ",l+=r(a[u+1]).toUpperCase();else if(c===64)l+=r(a[u+1]).toUpperCase(),l+=r(a[u]).toUpperCase();else throw new Error("Invalid size "+c);u%6===4?l+=` 5`+new Array(o.length+4).join(" "):u<a.length-2&&(l+=" ")}console.log(l)}function i(o,a,c){let l=new Date().getTime();const u=new Uint8Array(a);for(let h=0;h<a;h++)u[h]=h%256;const d=new Date().getTime();console.log("Generated random input in "+(d-l)+"ms"),l=d;for(let h=0;h<c;h++){const f=o(u),g=new Date().getTime(),p=g-l;l=g,console.log("Hashed in "+p+"ms: "+f.substring(0,20)+"..."),console.log(Math.round(a/(1<<20)/(p/1e3)*100)/100+" MB PER SECOND")}}return yO={normalizeInput:t,toHex:n,debugPrint:s,testSpeed:i},yO}var bO,yY;function aNe(){if(yY)return bO;yY=1;const e=kue();function t(w,C,E){const b=w[C]+w[E];let S=w[C+1]+w[E+1];b>=4294967296&&S++,w[C]=b,w[C+1]=S}function n(w,C,E,b){let S=w[C]+E;E<0&&(S+=4294967296);let v=w[C+1]+b;S>=4294967296&&v++,w[C]=S,w[C+1]=v}function r(w,C){return w[C]^w[C+1]<<8^w[C+2]<<16^w[C+3]<<24}function s(w,C,E,b,S,v){const x=l[S],A=l[S+1],I=l[v],O=l[v+1];t(c,w,C),n(c,w,x,A);let N=c[b]^c[w],T=c[b+1]^c[w+1];c[b]=T,c[b+1]=N,t(c,E,b),N=c[C]^c[E],T=c[C+1]^c[E+1],c[C]=N>>>24^T<<8,c[C+1]=T>>>24^N<<8,t(c,w,C),n(c,w,I,O),N=c[b]^c[w],T=c[b+1]^c[w+1],c[b]=N>>>16^T<<16,c[b+1]=T>>>16^N<<16,t(c,E,b),N=c[C]^c[E],T=c[C+1]^c[E+1],c[C]=T>>>31^N<<1,c[C+1]=N>>>31^T<<1}const i=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),o=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],a=new Uint8Array(o.map(function(w){return w*2})),c=new Uint32Array(32),l=new Uint32Array(32);function u(w,C){let E=0;for(E=0;E<16;E++)c[E]=w.h[E],c[E+16]=i[E];for(c[24]=c[24]^w.t,c[25]=c[25]^w.t/4294967296,C&&(c[28]=~c[28],c[29]=~c[29]),E=0;E<32;E++)l[E]=r(w.b,4*E);for(E=0;E<12;E++)s(0,8,16,24,a[E*16+0],a[E*16+1]),s(2,10,18,26,a[E*16+2],a[E*16+3]),s(4,12,20,28,a[E*16+4],a[E*16+5]),s(6,14,22,30,a[E*16+6],a[E*16+7]),s(0,10,20,30,a[E*16+8],a[E*16+9]),s(2,12,22,24,a[E*16+10],a[E*16+11]),s(4,14,16,26,a[E*16+12],a[E*16+13]),s(6,8,18,28,a[E*16+14],a[E*16+15]);for(E=0;E<16;E++)w.h[E]=w.h[E]^c[E]^c[E+16]}const d=new Uint8Array([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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function h(w,C,E,b){if(w===0||w>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(C&&C.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(E&&E.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(b&&b.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const S={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:w};d.fill(0),d[0]=w,C&&(d[1]=C.length),d[2]=1,d[3]=1,E&&d.set(E,32),b&&d.set(b,48);for(let v=0;v<16;v++)S.h[v]=i[v]^r(d,v*4);return C&&(f(S,C),S.c=128),S}function f(w,C){for(let E=0;E<C.length;E++)w.c===128&&(w.t+=w.c,u(w,!1),w.c=0),w.b[w.c++]=C[E]}function g(w){for(w.t+=w.c;w.c<128;)w.b[w.c++]=0;u(w,!0);const C=new Uint8Array(w.outlen);for(let E=0;E<w.outlen;E++)C[E]=w.h[E>>2]>>8*(E&3);return C}function p(w,C,E,b,S){E=E||64,w=e.normalizeInput(w),b&&(b=e.normalizeInput(b)),S&&(S=e.normalizeInput(S));const v=h(E,C,b,S);return f(v,w),g(v)}function m(w,C,E,b,S){const v=p(w,C,E,b,S);return e.toHex(v)}return bO={blake2b:p,blake2bHex:m,blake2bInit:h,blake2bUpdate:f,blake2bFinal:g},bO}var vO,bY;function cNe(){if(bY)return vO;bY=1;const e=kue();function t(g,p){return g[p]^g[p+1]<<8^g[p+2]<<16^g[p+3]<<24}function n(g,p,m,w,C,E){o[g]=o[g]+o[p]+C,o[w]=r(o[w]^o[g],16),o[m]=o[m]+o[w],o[p]=r(o[p]^o[m],12),o[g]=o[g]+o[p]+E,o[w]=r(o[w]^o[g],8),o[m]=o[m]+o[w],o[p]=r(o[p]^o[m],7)}function r(g,p){return g>>>p^g<<32-p}const s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),i=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),o=new Uint32Array(16),a=new Uint32Array(16);function c(g,p){let m=0;for(m=0;m<8;m++)o[m]=g.h[m],o[m+8]=s[m];for(o[12]^=g.t,o[13]^=g.t/4294967296,p&&(o[14]=~o[14]),m=0;m<16;m++)a[m]=t(g.b,4*m);for(m=0;m<10;m++)n(0,4,8,12,a[i[m*16+0]],a[i[m*16+1]]),n(1,5,9,13,a[i[m*16+2]],a[i[m*16+3]]),n(2,6,10,14,a[i[m*16+4]],a[i[m*16+5]]),n(3,7,11,15,a[i[m*16+6]],a[i[m*16+7]]),n(0,5,10,15,a[i[m*16+8]],a[i[m*16+9]]),n(1,6,11,12,a[i[m*16+10]],a[i[m*16+11]]),n(2,7,8,13,a[i[m*16+12]],a[i[m*16+13]]),n(3,4,9,14,a[i[m*16+14]],a[i[m*16+15]]);for(m=0;m<8;m++)g.h[m]^=o[m]^o[m+8]}function l(g,p){if(!(g>0&&g<=32))throw new Error("Incorrect output length, should be in [1, 32]");const m=p?p.length:0;if(p&&!(m>0&&m<=32))throw new Error("Incorrect key length, should be in [1, 32]");const w={h:new Uint32Array(s),b:new Uint8Array(64),c:0,t:0,outlen:g};return w.h[0]^=16842752^m<<8^g,m>0&&(u(w,p),w.c=64),w}function u(g,p){for(let m=0;m<p.length;m++)g.c===64&&(g.t+=g.c,c(g,!1),g.c=0),g.b[g.c++]=p[m]}function d(g){for(g.t+=g.c;g.c<64;)g.b[g.c++]=0;c(g,!0);const p=new Uint8Array(g.outlen);for(let m=0;m<g.outlen;m++)p[m]=g.h[m>>2]>>8*(m&3)&255;return p}function h(g,p,m){m=m||32,g=e.normalizeInput(g);const w=l(m,p);return u(w,g),d(w)}function f(g,p,m){const w=h(g,p,m);return e.toHex(w)}return vO={blake2s:h,blake2sHex:f,blake2sInit:l,blake2sUpdate:u,blake2sFinal:d},vO}var EO,vY;function lNe(){if(vY)return EO;vY=1;const e=aNe(),t=cNe();return EO={blake2b:e.blake2b,blake2bHex:e.blake2bHex,blake2bInit:e.blake2bInit,blake2bUpdate:e.blake2bUpdate,blake2bFinal:e.blake2bFinal,blake2s:t.blake2s,blake2sHex:t.blake2sHex,blake2sInit:t.blake2sInit,blake2sUpdate:t.blake2sUpdate,blake2sFinal:t.blake2sFinal},EO}var Oq=lNe(),uNe={};const dNe=":";function Rv(e){const[t,n]=e.split(dNe);return{namespace:t,reference:n}}function EY(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const s=e[r];n.push(...s.accounts)}),n}function Rue(e,t){return e.includes(":")?[e]:t.chains||[]}var hNe=Object.defineProperty,fNe=Object.defineProperties,pNe=Object.getOwnPropertyDescriptors,CY=Object.getOwnPropertySymbols,gNe=Object.prototype.hasOwnProperty,mNe=Object.prototype.propertyIsEnumerable,zU=(e,t,n)=>t in e?hNe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$Y=(e,t)=>{for(var n in t||(t={}))gNe.call(t,n)&&zU(e,n,t[n]);if(CY)for(var n of CY(t))mNe.call(t,n)&&zU(e,n,t[n]);return e},wNe=(e,t)=>fNe(e,pNe(t)),xY=(e,t,n)=>zU(e,typeof t!="symbol"?t+"":t,n);const yNe="ReactNative",il={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},bNe="js";function XS(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function u1(){return!cn.getDocument()&&!!cn.getNavigator()&&navigator.product===yNe}function vNe(){return u1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="android"}function ENe(){return u1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="ios"}function C6(){return!XS()&&!!cn.getNavigator()&&!!cn.getDocument()}function EC(){return u1()?il.reactNative:XS()?il.node:C6()?il.browser:il.unknown}function IY(){var e;try{return u1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Application)<"u"?(e=globalThis.Application)==null?void 0:e.applicationId:void 0}catch{return}}function CNe(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const s=t[r];s!==void 0&&n.set(r,s)}return n.toString()}function $Ne(e){var t,n;const r=Bue();try{return e!=null&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),e.url=r.url),(t=e==null?void 0:e.icons)!=null&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(s=>s!=="")),wNe($Y($Y({},r),e),{url:(e==null?void 0:e.url)||r.url,name:(e==null?void 0:e.name)||r.name,description:(e==null?void 0:e.description)||r.description,icons:(n=e==null?void 0:e.icons)!=null&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(s){return console.warn("Error populating app metadata",s),e||r}}function Bue(){return gC.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function xNe(){if(EC()===il.reactNative&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"){const{OS:n,Version:r}=globalThis.Platform;return[n,r].join("-")}const e=MN();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function INe(){var e;const t=EC();return t===il.browser?[t,((e=cn.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function Due(e,t,n){const r=xNe(),s=INe();return[[e,t].join("-"),[bNe,n].join("-"),r,s].join("/")}function SNe({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:s,projectId:i,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=n.split("?"),u=Due(e,t,r),d={auth:s,ua:u,projectId:i,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=CNe(l[1]||"",d);return l[0]+"?"+h}function ow(e,t){return e.filter(n=>t.includes(n)).length===e.length}function qU(e){return Object.fromEntries(e.entries())}function WU(e){return new Map(Object.entries(e))}function F1(e=V.FIVE_MINUTES,t){const n=V.toMiliseconds(e||V.FIVE_MINUTES);let r,s,i,o;return{resolve:a=>{i&&r&&(clearTimeout(i),r(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const l=new Error(t);o=Promise.reject(l),c(l)},n),r=a,s=c})}}function om(e,t,n){return new Promise(async(r,s)=>{const i=setTimeout(()=>s(new Error(n)),t);try{const o=await e;r(o)}catch(o){s(o)}clearTimeout(i)})}function Uue(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function ANe(e){return Uue("topic",e)}function _Ne(e){return Uue("id",e)}function Lue(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function Ys(e,t){return V.fromMiliseconds(Date.now()+V.toMiliseconds(e))}function Mg(e){return Date.now()>=V.toMiliseconds(e)}function rr(e,t){return`${e}${t?`:${t}`:""}`}function zh(e=[],t=[]){return[...new Set([...e,...t])]}async function NNe({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const s=typeof n=="string"?JSON.parse(n):n,i=s==null?void 0:s.href;if(typeof i!="string")return;const o=TNe(i,e,t),a=EC();if(a===il.browser){if(!((r=cn.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}PNe(o)}else a===il.reactNative&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"&&await globalThis.Linking.openURL(o)}catch(s){console.error(s)}}function TNe(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let s=`${e}`;if(e.startsWith("https://t.me")){const i=e.includes("?")?"&startapp=":"?startapp=";s=`${s}${i}${BNe(r,!0)}`}else s=`${s}/wc?${r}`;return s}function PNe(e){let t="_self";RNe()?t="_top":(kNe()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function ONe(e,t){let n="";try{if(C6()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function SY(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function AY(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function kq(){return typeof process<"u"&&uNe.IS_VITEST==="true"}function kNe(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function RNe(){try{return window.self!==window.top}catch{return!1}}function BNe(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function Mue(e){return Buffer.from(e,"base64").toString("utf-8")}function DNe(e){return new Promise(t=>setTimeout(t,e))}let UNe=class{constructor({limit:t}){xY(this,"limit"),xY(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}};const Ix=BigInt(2**32-1),_Y=BigInt(32);function jue(e,t=!1){return t?{h:Number(e&Ix),l:Number(e>>_Y&Ix)}:{h:Number(e>>_Y&Ix)|0,l:Number(e&Ix)|0}}function Fue(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:o,l:a}=jue(e[i],t);[r[i],s[i]]=[o,a]}return[r,s]}const NY=(e,t,n)=>e>>>n,TY=(e,t,n)=>e<<32-n|t>>>n,jg=(e,t,n)=>e>>>n|t<<32-n,Fg=(e,t,n)=>e<<32-n|t>>>n,CE=(e,t,n)=>e<<64-n|t>>>n-32,$E=(e,t,n)=>e>>>n-32|t<<64-n,LNe=(e,t)=>t,MNe=(e,t)=>e,jNe=(e,t,n)=>e<<n|t>>>32-n,FNe=(e,t,n)=>t<<n|e>>>32-n,zNe=(e,t,n)=>t<<n-32|e>>>64-n,qNe=(e,t,n)=>e<<n-32|t>>>64-n;function fd(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const Rq=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Bq=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,WNe=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),HNe=(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,VNe=(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0),KNe=(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0,Wb=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Dq(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function g0(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function yu(e,...t){if(!Dq(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Uq(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");g0(e.outputLen),g0(e.blockLen)}function Fm(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Lq(e,t){yu(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function R8(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function bu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function CO(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function hh(e,t){return e<<32-t|e>>>t}const zue=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function que(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const cp=zue?e=>e:e=>que(e);function GNe(e){for(let t=0;t<e.length;t++)e[t]=que(e[t]);return e}const zg=zue?e=>e:GNe,Wue=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ZNe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function B8(e){if(yu(e),Wue)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=ZNe[e[n]];return t}const kf={_0:48,_9:57,A:65,F:70,a:97,f:102};function PY(e){if(e>=kf._0&&e<=kf._9)return e-kf._0;if(e>=kf.A&&e<=kf.F)return e-(kf.A-10);if(e>=kf.a&&e<=kf.f)return e-(kf.a-10)}function Mq(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Wue)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=PY(e.charCodeAt(i)),a=PY(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function YNe(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function _d(e){return typeof e=="string"&&(e=YNe(e)),yu(e),e}function aw(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];yu(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}let YN=class{};function CC(e){const t=r=>e().update(_d(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function JNe(e){const t=(r,s)=>e(s).update(_d(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function $6(e=32){if(Wb&&typeof Wb.getRandomValues=="function")return Wb.getRandomValues(new Uint8Array(e));if(Wb&&typeof Wb.randomBytes=="function")return Uint8Array.from(Wb.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const XNe=BigInt(0),N3=BigInt(1),QNe=BigInt(2),e7e=BigInt(7),t7e=BigInt(256),n7e=BigInt(113),Hue=[],Vue=[],Kue=[];for(let e=0,t=N3,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Hue.push(2*(5*r+n)),Vue.push((e+1)*(e+2)/2%64);let s=XNe;for(let i=0;i<7;i++)t=(t<<N3^(t>>e7e)*n7e)%t7e,t&QNe&&(s^=N3<<(N3<<BigInt(i))-N3);Kue.push(s)}const Gue=Fue(Kue,!0),r7e=Gue[0],s7e=Gue[1],OY=(e,t,n)=>n>32?zNe(e,t,n):jNe(e,t,n),kY=(e,t,n)=>n>32?qNe(e,t,n):FNe(e,t,n);function i7e(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=OY(l,u,1)^n[a],h=kY(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=Vue[o],c=OY(s,i,a),l=kY(s,i,a),u=Hue[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=r7e[r],e[1]^=s7e[r]}bu(n)}let o7e=class Zue extends YN{constructor(t,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,g0(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=R8(this.state)}clone(){return this._cloneInto()}keccak(){zg(this.state32),i7e(this.state32,this.rounds),zg(this.state32),this.posOut=0,this.pos=0}update(t){Fm(this),t=_d(t),yu(t);const{blockLen:n,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Fm(this,!1),yu(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return g0(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Lq(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,bu(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new Zue(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}};const a7e=(e,t,n)=>CC(()=>new o7e(t,e,n)),c7e=a7e(1,136,256/8);function l7e(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}function u7e(e,t,n){return e&t^~e&n}function d7e(e,t,n){return e&t^e&n^t&n}let Yue=class extends YN{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=CO(this.buffer)}update(t){Fm(this),t=_d(t),yu(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=CO(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Fm(this),Lq(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,bu(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;l7e(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=CO(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=i,t.length=s,t.pos=a,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const tg=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),lo=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),uo=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),h7e=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ng=new Uint32Array(64);let f7e=class extends Yue{constructor(t=32){super(64,t,8,!1),this.A=tg[0]|0,this.B=tg[1]|0,this.C=tg[2]|0,this.D=tg[3]|0,this.E=tg[4]|0,this.F=tg[5]|0,this.G=tg[6]|0,this.H=tg[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)ng[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=ng[d-15],f=ng[d-2],g=hh(h,7)^hh(h,18)^h>>>3,p=hh(f,17)^hh(f,19)^f>>>10;ng[d]=p+ng[d-7]+g+ng[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=hh(a,6)^hh(a,11)^hh(a,25),f=u+h+u7e(a,c,l)+h7e[d]+ng[d]|0,g=(hh(r,2)^hh(r,13)^hh(r,22))+d7e(r,s,i)|0;u=l,l=c,c=a,a=o+f|0,o=i,i=s,s=r,r=f+g|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,c,l,u)}roundClean(){bu(ng)}destroy(){this.set(0,0,0,0,0,0,0,0),bu(this.buffer)}};const Jue=Fue(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
55771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),p7e=Jue[0],g7e=Jue[1],rg=new Uint32Array(80),sg=new Uint32Array(80);let jq=class extends Yue{constructor(t=64){super(128,t,16,!1),this.Ah=uo[0]|0,this.Al=uo[1]|0,this.Bh=uo[2]|0,this.Bl=uo[3]|0,this.Ch=uo[4]|0,this.Cl=uo[5]|0,this.Dh=uo[6]|0,this.Dl=uo[7]|0,this.Eh=uo[8]|0,this.El=uo[9]|0,this.Fh=uo[10]|0,this.Fl=uo[11]|0,this.Gh=uo[12]|0,this.Gl=uo[13]|0,this.Hh=uo[14]|0,this.Hl=uo[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:p,Hl:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=f|0,this.Gl=g|0,this.Hh=p|0,this.Hl=m|0}process(t,n){for(let E=0;E<16;E++,n+=4)rg[E]=t.getUint32(n),sg[E]=t.getUint32(n+=4);for(let E=16;E<80;E++){const b=rg[E-15]|0,S=sg[E-15]|0,v=jg(b,S,1)^jg(b,S,8)^NY(b,S,7),x=Fg(b,S,1)^Fg(b,S,8)^TY(b,S,7),A=rg[E-2]|0,I=sg[E-2]|0,O=jg(A,I,19)^CE(A,I,61)^NY(A,I,6),N=Fg(A,I,19)^$E(A,I,61)^TY(A,I,6),T=WNe(x,N,sg[E-7],sg[E-16]),P=HNe(T,v,O,rg[E-7],rg[E-16]);rg[E]=P|0,sg[E]=T|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:p,Gl:m,Hh:w,Hl:C}=this;for(let E=0;E<80;E++){const b=jg(d,h,14)^jg(d,h,18)^CE(d,h,41),S=Fg(d,h,14)^Fg(d,h,18)^$E(d,h,41),v=d&f^~d&p,x=h&g^~h&m,A=VNe(C,S,x,g7e[E],sg[E]),I=KNe(A,w,b,v,p7e[E],rg[E]),O=A|0,N=jg(r,s,28)^CE(r,s,34)^CE(r,s,39),T=Fg(r,s,28)^$E(r,s,34)^$E(r,s,39),P=r&i^r&a^i&a,_=s&o^s&c^o&c;w=p|0,C=m|0,p=f|0,m=g|0,f=d|0,g=h|0,{h:d,l:h}=fd(l|0,u|0,I|0,O|0),l=a|0,u=c|0,a=i|0,c=o|0,i=r|0,o=s|0;const y=Rq(O,T,_);r=Bq(y,I,N,P),s=y|0}({h:r,l:s}=fd(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=fd(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=fd(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=fd(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:h}=fd(this.Eh|0,this.El|0,d|0,h|0),{h:f,l:g}=fd(this.Fh|0,this.Fl|0,f|0,g|0),{h:p,l:m}=fd(this.Gh|0,this.Gl|0,p|0,m|0),{h:w,l:C}=fd(this.Hh|0,this.Hl|0,w|0,C|0),this.set(r,s,i,o,a,c,l,u,d,h,f,g,p,m,w,C)}roundClean(){bu(rg,sg)}destroy(){bu(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},m7e=class extends jq{constructor(){super(48),this.Ah=lo[0]|0,this.Al=lo[1]|0,this.Bh=lo[2]|0,this.Bl=lo[3]|0,this.Ch=lo[4]|0,this.Cl=lo[5]|0,this.Dh=lo[6]|0,this.Dl=lo[7]|0,this.Eh=lo[8]|0,this.El=lo[9]|0,this.Fh=lo[10]|0,this.Fl=lo[11]|0,this.Gh=lo[12]|0,this.Gl=lo[13]|0,this.Hh=lo[14]|0,this.Hl=lo[15]|0}};const ho=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);let w7e=class extends jq{constructor(){super(32),this.Ah=ho[0]|0,this.Al=ho[1]|0,this.Bh=ho[2]|0,this.Bl=ho[3]|0,this.Ch=ho[4]|0,this.Cl=ho[5]|0,this.Dh=ho[6]|0,this.Dl=ho[7]|0,this.Eh=ho[8]|0,this.El=ho[9]|0,this.Fh=ho[10]|0,this.Fl=ho[11]|0,this.Gh=ho[12]|0,this.Gl=ho[13]|0,this.Hh=ho[14]|0,this.Hl=ho[15]|0}};const JN=CC(()=>new f7e),y7e=CC(()=>new jq),b7e=CC(()=>new m7e),v7e=CC(()=>new w7e),E7e=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),js=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),tt=new
vendor: 42,295 bytes, lines 5-8
5Uint32Array(32);function ig(e,t,n,r,s,i){const o=s[i],a=s[i+1];let c=tt[2*e],l=tt[2*e+1],u=tt[2*t],d=tt[2*t+1],h=tt[2*n],f=tt[2*n+1],g=tt[2*r],p=tt[2*r+1],m=Rq(c,u,o);l=Bq(m,l,d,a),c=m|0,{Dh:p,Dl:g}={Dh:p^l,Dl:g^c},{Dh:p,Dl:g}={Dh:LNe(p,g),Dl:MNe(p)},{h:f,l:h}=fd(f,h,p,g),{Bh:d,Bl:u}={Bh:d^f,Bl:u^h},{Bh:d,Bl:u}={Bh:jg(d,u,24),Bl:Fg(d,u,24)},tt[2*e]=c,tt[2*e+1]=l,tt[2*t]=u,tt[2*t+1]=d,tt[2*n]=h,tt[2*n+1]=f,tt[2*r]=g,tt[2*r+1]=p}function og(e,t,n,r,s,i){const o=s[i],a=s[i+1];let c=tt[2*e],l=tt[2*e+1],u=tt[2*t],d=tt[2*t+1],h=tt[2*n],f=tt[2*n+1],g=tt[2*r],p=tt[2*r+1],m=Rq(c,u,o);l=Bq(m,l,d,a),c=m|0,{Dh:p,Dl:g}={Dh:p^l,Dl:g^c},{Dh:p,Dl:g}={Dh:jg(p,g,16),Dl:Fg(p,g,16)},{h:f,l:h}=fd(f,h,p,g),{Bh:d,Bl:u}={Bh:d^f,Bl:u^h},{Bh:d,Bl:u}={Bh:CE(d,u,63),Bl:$E(d,u,63)},tt[2*e]=c,tt[2*e+1]=l,tt[2*t]=u,tt[2*t+1]=d,tt[2*n]=h,tt[2*n+1]=f,tt[2*r]=g,tt[2*r+1]=p}function C7e(e,t={},n,r,s){if(g0(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:i,salt:o,personalization:a}=t;if(i!==void 0&&(i.length<1||i.length>n))throw new Error("key length must be undefined or 1.."+n);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(a!==void 0&&a.length!==s)throw new Error("personalization must be undefined or "+s)}let $7e=class extends YN{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,g0(t),g0(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=R8(this.buffer)}update(t){Fm(this),t=_d(t),yu(t);const{blockLen:n,buffer:r,buffer32:s}=this,i=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<i;){this.pos===n&&(zg(s),this.compress(s,0,!1),zg(s),this.pos=0);const l=Math.min(n-this.pos,i-c),u=o+c;if(l===n&&!(u%4)&&c+l<i){const d=new Uint32Array(a,u,Math.floor((i-c)/4));zg(d);for(let h=0;c+n<i;h+=s.length,c+=n)this.length+=n,this.compress(d,h,!1);zg(d);continue}r.set(t.subarray(c,c+l),this.pos),this.pos+=l,this.length+=l,c+=l}return this}digestInto(t){Fm(this),Lq(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,bu(this.buffer.subarray(n)),zg(r),this.compress(r,0,!0),zg(r);const s=R8(t);this.get().forEach((i,o)=>s[o]=cp(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:i,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(n),t.destroyed=i,t.finished=s,t.length=r,t.pos=a,t.outputLen=o,t}clone(){return this._cloneInto()}},x7e=class extends $7e{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=js[0]|0,this.v0h=js[1]|0,this.v1l=js[2]|0,this.v1h=js[3]|0,this.v2l=js[4]|0,this.v2h=js[5]|0,this.v3l=js[6]|0,this.v3h=js[7]|0,this.v4l=js[8]|0,this.v4h=js[9]|0,this.v5l=js[10]|0,this.v5h=js[11]|0,this.v6l=js[12]|0,this.v6h=js[13]|0,this.v7l=js[14]|0,this.v7h=js[15]|0,C7e(n,t,64,16,16);let{key:r,personalization:s,salt:i}=t,o=0;if(r!==void 0&&(r=_d(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,i!==void 0){i=_d(i);const a=R8(i);this.v4l^=cp(a[0]),this.v4h^=cp(a[1]),this.v5l^=cp(a[2]),this.v5h^=cp(a[3])}if(s!==void 0){s=_d(s);const a=R8(s);this.v6l^=cp(a[0]),this.v6h^=cp(a[1]),this.v7l^=cp(a[2]),this.v7h^=cp(a[3])}if(r!==void 0){const a=new Uint8Array(this.blockLen);a.set(r),this.update(a)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:i,v2h:o,v3l:a,v3h:c,v4l:l,v4h:u,v5l:d,v5h:h,v6l:f,v6h:g,v7l:p,v7h:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=i|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=l|0,this.v4h=u|0,this.v5l=d|0,this.v5h=h|0,this.v6l=f|0,this.v6h=g|0,this.v7l=p|0,this.v7h=m|0}compress(t,n,r){this.get().forEach((c,l)=>tt[l]=c),tt.set(js,16);let{h:s,l:i}=jue(BigInt(this.length));tt[24]=js[8]^i,tt[25]=js[9]^s,r&&(tt[28]=~tt[28],tt[29]=~tt[29]);let o=0;const a=E7e;for(let c=0;c<12;c++)ig(0,4,8,12,t,n+2*a[o++]),og(0,4,8,12,t,n+2*a[o++]),ig(1,5,9,13,t,n+2*a[o++]),og(1,5,9,13,t,n+2*a[o++]),ig(2,6,10,14,t,n+2*a[o++]),og(2,6,10,14,t,n+2*a[o++]),ig(3,7,11,15,t,n+2*a[o++]),og(3,7,11,15,t,n+2*a[o++]),ig(0,5,10,15,t,n+2*a[o++]),og(0,5,10,15,t,n+2*a[o++]),ig(1,6,11,12,t,n+2*a[o++]),og(1,6,11,12,t,n+2*a[o++]),ig(2,7,8,13,t,n+2*a[o++]),og(2,7,8,13,t,n+2*a[o++]),ig(3,4,9,14,t,n+2*a[o++]),og(3,4,9,14,t,n+2*a[o++]);this.v0l^=tt[0]^tt[16],this.v0h^=tt[1]^tt[17],this.v1l^=tt[2]^tt[18],this.v1h^=tt[3]^tt[19],this.v2l^=tt[4]^tt[20],this.v2h^=tt[5]^tt[21],this.v3l^=tt[6]^tt[22],this.v3h^=tt[7]^tt[23],this.v4l^=tt[8]^tt[24],this.v4h^=tt[9]^tt[25],this.v5l^=tt[10]^tt[26],this.v5h^=tt[11]^tt[27],this.v6l^=tt[12]^tt[28],this.v6h^=tt[13]^tt[29],this.v7l^=tt[14]^tt[30],this.v7h^=tt[15]^tt[31],bu(tt)}destroy(){this.destroyed=!0,bu(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const I7e=JNe(e=>new x7e(e)),S7e="https://rpc.walletconnect.org/v1";function Xue(e){const t=`�Ethereum Signed Message: 6${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(c7e(n)).toString("hex")}async function A7e(e,t,n,r,s,i){switch(n.t){case"eip191":return await _7e(e,t,n.s);case"eip1271":return await N7e(e,t,n.s,r,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}async function _7e(e,t,n){return(await oIe({hash:Xue(t),signature:n})).toLowerCase()===e.toLowerCase()}async function N7e(e,t,n,r,s,i){const o=Rv(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l=n.substring(2),u=(l.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Xue(t)).substring(2),h=a+d+c+u+l,f=await fetch(`${i||S7e}/?chainId=${r}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:T7e(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:h},"latest"]})}),{result:g}=await f.json();return g?g.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function T7e(){return Date.now()+Math.floor(Math.random()*1e3)}function P7e(e){const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);const r=n[0];if(r===0)throw new Error("No signatures found");const s=1+r*64;if(n.length<s)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const i=Buffer.from(e,"base64").slice(1,65);return l1.encode(i)}function O7e(e){const t=new Uint8Array(Buffer.from(e,"base64")),n=Array.from("TransactionData::").map(i=>i.charCodeAt(0)),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const s=I7e(r,{dkLen:32});return l1.encode(s)}function RY(e){const t=new Uint8Array(JN(k7e(e)));return l1.encode(t)}function k7e(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="object"&&e!=null&&e.data)return new Uint8Array(Object.values(e.data));if(typeof e=="object"&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function BY(e){const t=Buffer.from(e,"base64"),n=bSe(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=uSe(n),s=Buffer.from("TX"),i=Buffer.concat([s,Buffer.from(r)]),o=v7e(i);return wq.encode(o).replace(/=+$/,"")}function $O(e){const t=[];let n=BigInt(e);for(;n>=BigInt(128);)t.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return t.push(Number(n)),Buffer.from(t)}function R7e(e){const t=Buffer.from(e.signed.bodyBytes,"base64"),n=Buffer.from(e.signed.authInfoBytes,"base64"),r=Buffer.from(e.signature.signature,"base64"),s=[];s.push(Buffer.from([10])),s.push($O(t.length)),s.push(t),s.push(Buffer.from([18])),s.push($O(n.length)),s.push(n),s.push(Buffer.from([26])),s.push($O(r.length)),s.push(r);const i=Buffer.concat(s),o=JN(i);return Buffer.from(o).toString("hex").toUpperCase()}var B7e=Object.defineProperty,D7e=Object.defineProperties,U7e=Object.getOwnPropertyDescriptors,DY=Object.getOwnPropertySymbols,L7e=Object.prototype.hasOwnProperty,M7e=Object.prototype.propertyIsEnumerable,UY=(e,t,n)=>t in e?B7e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j7e=(e,t)=>{for(var n in t||(t={}))L7e.call(t,n)&&UY(e,n,t[n]);if(DY)for(var n of DY(t))M7e.call(t,n)&&UY(e,n,t[n]);return e},F7e=(e,t)=>D7e(e,U7e(t));const z7e="did:pkh:",Fq=e=>e==null?void 0:e.split(":"),q7e=e=>{const t=e&&Fq(e);if(t)return e.includes(z7e)?t[3]:t[1]},HU=e=>{const t=e&&Fq(e);if(t)return t[2]+":"+t[3]},QS=e=>{const t=e&&Fq(e);if(t)return t.pop()};async function LY(e){const{cacao:t,projectId:n}=e,{s:r,p:s}=t,i=Que(s,s.iss),o=QS(s.iss);return await A7e(o,i,r,HU(s.iss),n)}const Que=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=QS(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,o=`Version: ${e.version}`,a=`Chain ID: ${q7e(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map(p=>` 7- ${p}`).join("")}`:void 0,g=fS(e.resources);if(g){const p=D8(g);s=X7e(s,p)}return[n,r,"",s,"",i,o,a,c,l,u,d,h,f].filter(p=>p!=null).join(` 8`)};function W7e(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function H7e(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function qw(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(s=>{const i=r[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);i.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function V7e(e,t,n,r={}){return n==null||n.sort((s,i)=>s.localeCompare(i)),{att:{[e]:K7e(t,n,r)}}}function K7e(e,t,n={}){t=t==null?void 0:t.sort((s,i)=>s.localeCompare(i));const r=t.map(s=>({[`${e}/${s}`]:[n]}));return Object.assign({},...r)}function ede(e){return qw(e),`urn:recap:${W7e(e).replace(/=/g,"")}`}function D8(e){const t=H7e(e.replace("urn:recap:",""));return qw(t),t}function G7e(e,t,n){const r=V7e(e,t,n);return ede(r)}function Z7e(e){return e&&e.includes("urn:recap:")}function Y7e(e,t){const n=D8(e),r=D8(t),s=J7e(n,r);return ede(s)}function J7e(e,t){qw(e),qw(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((s,i)=>s.localeCompare(i)),r={att:{}};return n.forEach(s=>{var i,o;Object.keys(((i=e.att)==null?void 0:i[s])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;r.att[s]=F7e(j7e({},r.att[s]),{[a]:((c=e.att[s])==null?void 0:c[a])||((l=t.att[s])==null?void 0:l[a])})})}),r}function X7e(e="",t){qw(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let s=0;Object.keys(t.att).forEach(a=>{const c=Object.keys(t.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));c.sort((d,h)=>d.action.localeCompare(h.action));const l={};c.forEach(d=>{l[d.ability]||(l[d.ability]=[]),l[d.ability].push(d.action)});const u=Object.keys(l).map(d=>(s++,`(${s}) '${d}': '${l[d].join("', '")}' for '${a}'.`));r.push(u.join(", ").replace(".,","."))});const i=r.join(" "),o=`${n}${i}`;return`${e?e+" ":""}${o}`}function MY(e){var t;const n=D8(e);qw(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(s=>s.split("/")[1]):[]}function jY(e){const t=D8(e);qw(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(s=>{var i;(i=s==null?void 0:s[0])!=null&&i.chains&&n.push(s[0].chains)})}),[...new Set(n.flat())]}function fS(e){if(!e)return;const t=e==null?void 0:e[e.length-1];return Z7e(t)?t:void 0}function tde(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function VU(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function xO(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Va(e,...t){if(!tde(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function FY(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Q7e(e,t){Va(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function mm(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function a5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function eTe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const tTe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function nTe(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function KU(e){if(typeof e=="string")e=nTe(e);else if(tde(e))e=GU(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function rTe(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function sTe(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const iTe=(e,t)=>{function n(r,...s){if(Va(r),!tTe)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?Va(l):Va(l,e.nonceLength)}const i=e.tagLength;i&&s[1]!==void 0&&Va(s[1]);const o=t(r,...s),a=(l,u)=>{if(u!==void 0){if(l!==2)throw new Error("cipher output not supported");Va(u)}};let c=!1;return{encrypt(l,u){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Va(l),a(o.encrypt.length,u),o.encrypt(l,u)},decrypt(l,u){if(Va(l),i&&l.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,u),o.decrypt(l,u)}}}return Object.assign(n,e),n};function zY(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!aTe(t))throw new Error("invalid output, must be aligned");return t}function qY(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i);e.setUint32(t+4,o,r),e.setUint32(t+0,a,r)}function oTe(e,t,n){VU(n);const r=new Uint8Array(16),s=eTe(r);return qY(s,0,BigInt(t),n),qY(s,8,BigInt(e),n),r}function aTe(e){return e.byteOffset%4===0}function GU(e){return Uint8Array.from(e)}const nde=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),cTe=nde("expand 16-byte k"),lTe=nde("expand 32-byte k"),uTe=mm(cTe),dTe=mm(lTe);function jn(e,t){return e<<t|e>>>32-t}function ZU(e){return e.byteOffset%4===0}const Sx=64,hTe=16,rde=2**32-1,WY=new Uint32Array;function fTe(e,t,n,r,s,i,o,a){const c=s.length,l=new Uint8Array(Sx),u=mm(l),d=ZU(s)&&ZU(i),h=d?mm(s):WY,f=d?mm(i):WY;for(let g=0;g<c;o++){if(e(t,n,r,u,o,a),o>=rde)throw new Error("arx: counter overflow");const p=Math.min(Sx,c-g);if(d&&p===Sx){const m=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let w=0,C;w<hTe;w++)C=m+w,f[C]=h[C]^u[w];g+=Sx;continue}for(let m=0,w;m<p;m++)w=g+m,i[w]=s[w]^l[m];g+=p}}function pTe(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:s,counterRight:i,rounds:o}=rTe({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return xO(s),xO(o),VU(i),VU(n),(a,c,l,u,d=0)=>{Va(a),Va(c),Va(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),Va(u),xO(d),d<0||d>=rde)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g=a.length,p,m;if(g===32)f.push(p=GU(a)),m=dTe;else if(g===16&&n)p=new Uint8Array(32),p.set(a),p.set(a,16),m=uTe,f.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${g}`);ZU(c)||f.push(c=GU(c));const w=mm(p);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,w,mm(c.subarray(0,16)),w),c=c.subarray(16)}const C=16-s;if(C!==c.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const b=new Uint8Array(12);b.set(c,i?0:12-c.length),c=b,f.push(c)}const E=mm(c);return fTe(e,m,w,E,l,u,d,o),a5(...f),u}}const ki=(e,t)=>e[t++]&255|(e[t++]&255)<<8;let gTe=class{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=KU(t),Va(t,32);const n=ki(t,0),r=ki(t,2),s=ki(t,4),i=ki(t,6),o=ki(t,8),a=ki(t,10),c=ki(t,12),l=ki(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=ki(t,16+2*u)}process(t,n,r=!1){const s=r?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],l=o[2],u=o[3],d=o[4],h=o[5],f=o[6],g=o[7],p=o[8],m=o[9],w=ki(t,n+0),C=ki(t,n+2),E=ki(t,n+4),b=ki(t,n+6),S=ki(t,n+8),v=ki(t,n+10),x=ki(t,n+12),A=ki(t,n+14);let I=i[0]+(w&8191),O=i[1]+((w>>>13|C<<3)&8191),N=i[2]+((C>>>10|E<<6)&8191),T=i[3]+((E>>>7|b<<9)&8191),P=i[4]+((b>>>4|S<<12)&8191),_=i[5]+(S>>>1&8191),y=i[6]+((S>>>14|v<<2)&8191),$=i[7]+((v>>>11|x<<5)&8191),R=i[8]+((x>>>8|A<<8)&8191),B=i[9]+(A>>>5|s),k=0,D=k+I*a+O*(5*m)+N*(5*p)+T*(5*g)+P*(5*f);k=D>>>13,D&=8191,D+=_*(5*h)+y*(5*d)+$*(5*u)+R*(5*l)+B*(5*c),k+=D>>>13,D&=8191;let U=k+I*c+O*a+N*(5*m)+T*(5*p)+P*(5*g);k=U>>>13,U&=8191,U+=_*(5*f)+y*(5*h)+$*(5*d)+R*(5*u)+B*(5*l),k+=U>>>13,U&=8191;let F=k+I*l+O*c+N*a+T*(5*m)+P*(5*p);k=F>>>13,F&=8191,F+=_*(5*g)+y*(5*f)+$*(5*h)+R*(5*d)+B*(5*u),k+=F>>>13,F&=8191;let K=k+I*u+O*l+N*c+T*a+P*(5*m);k=K>>>13,K&=8191,K+=_*(5*p)+y*(5*g)+$*(5*f)+R*(5*h)+B*(5*d),k+=K>>>13,K&=8191;let q=k+I*d+O*u+N*l+T*c+P*a;k=q>>>13,q&=8191,q+=_*(5*m)+y*(5*p)+$*(5*g)+R*(5*f)+B*(5*h),k+=q>>>13,q&=8191;let H=k+I*h+O*d+N*u+T*l+P*c;k=H>>>13,H&=8191,H+=_*a+y*(5*m)+$*(5*p)+R*(5*g)+B*(5*f),k+=H>>>13,H&=8191;let Z=k+I*f+O*h+N*d+T*u+P*l;k=Z>>>13,Z&=8191,Z+=_*c+y*a+$*(5*m)+R*(5*p)+B*(5*g),k+=Z>>>13,Z&=8191;let ee=k+I*g+O*f+N*h+T*d+P*u;k=ee>>>13,ee&=8191,ee+=_*l+y*c+$*a+R*(5*m)+B*(5*p),k+=ee>>>13,ee&=8191;let ie=k+I*p+O*g+N*f+T*h+P*d;k=ie>>>13,ie&=8191,ie+=_*u+y*l+$*c+R*a+B*(5*m),k+=ie>>>13,ie&=8191;let X=k+I*m+O*p+N*g+T*f+P*h;k=X>>>13,X&=8191,X+=_*d+y*u+$*l+R*c+B*a,k+=X>>>13,X&=8191,k=(k<<2)+k|0,k=k+D|0,D=k&8191,k=k>>>13,U+=k,i[0]=D,i[1]=U,i[2]=F,i[3]=K,i[4]=q,i[5]=H,i[6]=Z,i[7]=ee,i[8]=ie,i[9]=X}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let s=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=s,s=t[a]>>>13,t[a]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,r[0]=t[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+n[0];t[0]=o&65535;for(let a=1;a<8;a++)o=(t[a]+n[a]|0)+(o>>>16)|0,t[a]=o&65535;a5(r)}update(t){FY(this),t=KU(t),Va(t);const{buffer:n,blockLen:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o===r){for(;r<=s-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){a5(this.h,this.r,this.buffer,this.pad)}digestInto(t){FY(this),Q7e(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)t[i++]=r[o]>>>0,t[i++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}};function mTe(e){const t=(r,s)=>e(s).update(KU(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const wTe=mTe(e=>new gTe(e));function yTe(e,t,n,r,s,i=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],d=t[1],h=t[2],f=t[3],g=t[4],p=t[5],m=t[6],w=t[7],C=s,E=n[0],b=n[1],S=n[2],v=o,x=a,A=c,I=l,O=u,N=d,T=h,P=f,_=g,y=p,$=m,R=w,B=C,k=E,D=b,U=S;for(let K=0;K<i;K+=2)v=v+O|0,B=jn(B^v,16),_=_+B|0,O=jn(O^_,12),v=v+O|0,B=jn(B^v,8),_=_+B|0,O=jn(O^_,7),x=x+N|0,k=jn(k^x,16),y=y+k|0,N=jn(N^y,12),x=x+N|0,k=jn(k^x,8),y=y+k|0,N=jn(N^y,7),A=A+T|0,D=jn(D^A,16),$=$+D|0,T=jn(T^$,12),A=A+T|0,D=jn(D^A,8),$=$+D|0,T=jn(T^$,7),I=I+P|0,U=jn(U^I,16),R=R+U|0,P=jn(P^R,12),I=I+P|0,U=jn(U^I,8),R=R+U|0,P=jn(P^R,7),v=v+N|0,U=jn(U^v,16),$=$+U|0,N=jn(N^$,12),v=v+N|0,U=jn(U^v,8),$=$+U|0,N=jn(N^$,7),x=x+T|0,B=jn(B^x,16),R=R+B|0,T=jn(T^R,12),x=x+T|0,B=jn(B^x,8),R=R+B|0,T=jn(T^R,7),A=A+P|0,k=jn(k^A,16),_=_+k|0,P=jn(P^_,12),A=A+P|0,k=jn(k^A,8),_=_+k|0,P=jn(P^_,7),I=I+O|0,D=jn(D^I,16),y=y+D|0,O=jn(O^y,12),I=I+O|0,D=jn(D^I,8),y=y+D|0,O=jn(O^y,7);let F=0;r[F++]=o+v|0,r[F++]=a+x|0,r[F++]=c+A|0,r[F++]=l+I|0,r[F++]=u+O|0,r[F++]=d+N|0,r[F++]=h+T|0,r[F++]=f+P|0,r[F++]=g+_|0,r[F++]=p+y|0,r[F++]=m+$|0,r[F++]=w+R|0,r[F++]=C+B|0,r[F++]=E+k|0,r[F++]=b+D|0,r[F++]=S+U|0}const bTe=pTe(yTe,{counterRight:!1,counterLength:4,allowShortKeys:!1}),vTe=new Uint8Array(16),HY=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(vTe.subarray(n))},ETe=new Uint8Array(32);function VY(e,t,n,r,s){const i=e(t,n,ETe),o=wTe.create(i);s&&HY(o,s),HY(o,r);const a=oTe(r.length,s?s.length:0,!0);o.update(a);const c=o.digest();return a5(i,a),c}const CTe=e=>(t,n,r)=>({encrypt(s,i){const o=s.length;i=zY(o+16,i,!1),i.set(s);const a=i.subarray(0,-16);e(t,n,a,a,1);const c=VY(e,t,n,a,r);return i.set(c,o),a5(c),i},decrypt(s,i){i=zY(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=VY(e,t,n,o,r);if(!sTe(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),a5(c),i}}),sde=iTe({blockSize:64,nonceLength:12,tagLength:16},CTe(bTe));let ide=class extends YN{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Uq(t);const r=_d(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),bu(i)}update(t){return Fm(this),this.iHash.update(t),this}digestInto(t){Fm(this),yu(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const XN=(e,t,n)=>new ide(e,t).update(n).digest();XN.create=(e,t)=>new ide(e,t);function $Te(e,t,n){return Uq(e),n===void 0&&(n=new Uint8Array(e.outputLen)),XN(e,_d(n),_d(t))}const IO=Uint8Array.from([0]),KY=Uint8Array.of();function xTe(e,t,n,r=32){Uq(e),g0(r);const s=e.outputLen;if(r>255*s)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/s);n===void 0&&(n=KY);const o=new Uint8Array(i*s),a=XN.create(e,t),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let u=0;u<i;u++)IO[0]=u+1,c.update(u===0?KY:l).update(n).update(IO).digestInto(l),o.set(l,s*u),a._cloneInto(c);return a.destroy(),c.destroy(),bu(l,IO),o.slice(0,r)}const ITe=(e,t,n,r,s)=>xTe(e,$Te(e,t,n),r,s),QN=JN,zq=BigInt(0),YU=BigInt(1);function e9(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Ax(e){const t=e.toString(16);return t.length&1?"0"+t:t}function ode(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?zq:BigInt("0x"+e)}function e7(e){return ode(B8(e))}function t9(e){return yu(e),ode(B8(Uint8Array.from(e).reverse()))}function qq(e,t){return Mq(e.toString(16).padStart(t*2,"0"))}function Wq(e,t){return qq(e,t).reverse()}function qa(e,t,n){let r;if(typeof t=="string")try{r=Mq(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(Dq(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}const SO=e=>typeof e=="bigint"&&zq<=e;function STe(e,t,n){return SO(e)&&SO(t)&&SO(n)&&t<=e&&e<n}function JU(e,t,n,r){if(!STe(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function ATe(e){let t;for(t=0;e>zq;e>>=YU,t+=1);return t}const t7=e=>(YU<<BigInt(e))-YU;function _Te(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=h=>new Uint8Array(h),s=h=>Uint8Array.of(h);let i=r(e),o=r(e),a=0;const c=()=>{i.fill(1),o.fill(0),a=0},l=(...h)=>n(o,i,...h),u=(h=r(0))=>{o=l(s(0),h),i=l(),h.length!==0&&(o=l(s(1),h),i=l())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const f=[];for(;h<t;){i=l();const g=i.slice();f.push(g),h+=i.length}return aw(...f)};return(h,f)=>{c(),u(h);let g;for(;!(g=f(d()));)u();return c(),g}}function n7(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(s,i,o){const a=e[s];if(o&&a===void 0)return;const c=typeof a;if(c!==i||a===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${c}`)}Object.entries(t).forEach(([s,i])=>r(s,i,!1)),Object.entries(n).forEach(([s,i])=>r(s,i,!0))}function GY(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const cc=BigInt(0),Jo=BigInt(1),cw=BigInt(2),NTe=BigInt(3),ade=BigInt(4),cde=BigInt(5),lde=BigInt(8);function uu(e,t){const n=e%t;return n>=cc?n:t+n}function cd(e,t,n){let r=e;for(;t-- >cc;)r*=r,r%=n;return r}function ZY(e,t){if(e===cc)throw new Error("invert: expected non-zero number");if(t<=cc)throw new Error("invert: expected positive modulus, got "+t);let n=uu(e,t),r=t,s=cc,i=Jo;for(;n!==cc;){const o=r/n,a=r%n,c=s-i*o;r=n,n=a,s=i,i=c}if(r!==Jo)throw new Error("invert: does not exist");return uu(s,t)}function ude(e,t){const n=(e.ORDER+Jo)/ade,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function TTe(e,t){const n=(e.ORDER-cde)/lde,r=e.mul(t,cw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,cw),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function PTe(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Jo,n=0;for(;t%cw===cc;)t/=cw,n++;let r=cw;const s=x6(e);for(;YY(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return ude;let i=s.pow(r,t);const o=(t+Jo)/cw;return function(a,c){if(a.is0(c))return c;if(YY(a,c)!==1)throw new Error("Cannot find square root");let l=n,u=a.mul(a.ONE,i),d=a.pow(c,t),h=a.pow(c,o);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let f=1,g=a.sqr(d);for(;!a.eql(g,a.ONE);)if(f++,g=a.sqr(g),f===l)throw new Error("Cannot find square root");const p=Jo<<BigInt(l-f-1),m=a.pow(u,p);l=f,u=a.sqr(m),d=a.mul(d,u),h=a.mul(h,m)}return h}}function OTe(e){return e%ade===NTe?ude:e%lde===cde?TTe:PTe(e)}const kTe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function RTe(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=kTe.reduce((r,s)=>(r[s]="function",r),t);return n7(e,n),e}function BTe(e,t,n){if(n<cc)throw new Error("invalid exponent, negatives unsupported");if(n===cc)return e.ONE;if(n===Jo)return t;let r=e.ONE,s=t;for(;n>cc;)n&Jo&&(r=e.mul(r,s)),s=e.sqr(s),n>>=Jo;return r}function dde(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function YY(e,t){const n=(e.ORDER-Jo)/cw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function DTe(e,t){t!==void 0&&g0(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function x6(e,t,n=!1,r={}){if(e<=cc)throw new Error("invalid field: expected ORDER > 0, got "+e);let s,i;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const u=t;u.BITS&&(s=u.BITS),u.sqrt&&(i=u.sqrt),typeof u.isLE=="boolean"&&(n=u.isLE)}else typeof t=="number"&&(s=t),r.sqrt&&(i=r.sqrt);const{nBitLength:o,nByteLength:a}=DTe(e,s);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let c;const l=Object.freeze({ORDER:e,isLE:n,BITS:o,BYTES:a,MASK:t7(o),ZERO:cc,ONE:Jo,create:u=>uu(u,e),isValid:u=>{if(typeof u!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof u);return cc<=u&&u<e},is0:u=>u===cc,isValidNot0:u=>!l.is0(u)&&l.isValid(u),isOdd:u=>(u&Jo)===Jo,neg:u=>uu(-u,e),eql:(u,d)=>u===d,sqr:u=>uu(u*u,e),add:(u,d)=>uu(u+d,e),sub:(u,d)=>uu(u-d,e),mul:(u,d)=>uu(u*d,e),pow:(u,d)=>BTe(l,u,d),div:(u,d)=>uu(u*ZY(d,e),e),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>ZY(u,e),sqrt:i||(u=>(c||(c=OTe(e)),c(l,u))),toBytes:u=>n?Wq(u,a):qq(u,a),fromBytes:u=>{if(u.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+u.length);return n?t9(u):e7(u)},invertBatch:u=>dde(l,u),cmov:(u,d,h)=>h?d:u});return Object.freeze(l)}function hde(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function fde(e){const t=hde(e);return t+Math.ceil(t/2)}function UTe(e,t,n=!1){const r=e.length,s=hde(t),i=fde(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?t9(e):e7(e),a=uu(o,t-Jo)+Jo;return n?Wq(a,s):qq(a,s)}const c5=BigInt(0),lw=BigInt(1);function XE(e,t){const n=t.negate();return e?n:t}function LTe(e,t,n){const r=i=>i.pz,s=dde(e.Fp,n.map(r));return n.map((i,o)=>i.toAffine(s[o])).map(e.fromAffine)}function pde(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function AO(e,t){pde(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=t7(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function JY(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=lw);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function MTe(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function jTe(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const _O=new WeakMap,gde=new WeakMap;function NO(e){return gde.get(e)||1}function XY(e){if(e!==c5)throw new Error("invalid wNAF")}function FTe(e,t){return{constTimeNegate:XE,hasPrecomputes(n){return NO(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>c5;)r&lw&&(s=s.add(i)),i=i.double(),r>>=lw;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=AO(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=AO(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=JY(s,c,a);s=l,d?o=o.add(XE(f,r[g])):i=i.add(XE(h,r[u]))}return XY(s),{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=AO(n,t);for(let a=0;a<o.windows&&s!==c5;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=JY(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return XY(s),i},getPrecomputes(n,r,s){let i=_O.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&(typeof s=="function"&&(i=s(i)),_O.set(r,i))),i},wNAFCached(n,r,s){const i=NO(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=NO(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){pde(r,t),gde.set(n,r),_O.delete(n)}}}function zTe(e,t,n,r){let s=t,i=e.ZERO,o=e.ZERO;for(;n>c5||r>c5;)n&lw&&(i=i.add(s)),r&lw&&(o=o.add(s)),s=s.double(),n>>=lw,r>>=lw;return{p1:i,p2:o}}function qTe(e,t,n,r){MTe(n,e),jTe(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=ATe(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=t7(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function QY(e,t){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return RTe(t),t}else return x6(e)}function WTe(e,t,n={}){if(!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const o of["p","n","h"]){const a=t[o];if(!(typeof a=="bigint"&&a>c5))throw new Error(`CURVE.${o} must be positive bigint`)}const r=QY(t.p,n.Fp),s=QY(t.n,n.Fn),i=["Gx","Gy","a","b"];for(const o of i)if(!r.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:s}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const T3=BigInt(0),Hb=BigInt(1),_x=BigInt(2);function HTe(e){return n7(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function VTe(e){const t=HTe(e),{P:n,type:r,adjustScalarBytes:s,powPminus2:i,randomBytes:o}=t,a=r==="x25519";if(!a&&r!=="x448")throw new Error("invalid type");const c=o||$6,l=a?255:448,u=a?32:56,d=BigInt(a?9:5),h=BigInt(a?121665:39081),f=a?_x**BigInt(254):_x**BigInt(447),g=a?BigInt(8)*_x**BigInt(251)-Hb:BigInt(4)*_x**BigInt(445)-Hb,p=f+g+Hb,m=I=>uu(I,n),w=C(d);function C(I){return Wq(m(I),u)}function E(I){const O=qa("u coordinate",I,u);return a&&(O[31]&=127),m(t9(O))}function b(I){return t9(s(qa("scalar",I,u)))}function S(I,O){const N=A(E(O),b(I));if(N===T3)throw new Error("invalid private or public key received");return C(N)}function v(I){return S(I,w)}function x(I,O,N){const T=m(I*(O-N));return O=m(O-T),N=m(N+T),{x_2:O,x_3:N}}function A(I,O){JU("u",I,T3,n),JU("scalar",O,f,p);const N=O,T=I;let P=Hb,_=T3,y=I,$=Hb,R=T3;for(let k=BigInt(l-1);k>=T3;k--){const D=N>>k&Hb;R^=D,{x_2:P,x_3:y}=x(R,P,y),{x_2:_,x_3:$}=x(R,_,$),R=D;const U=P+_,F=m(U*U),K=P-_,q=m(K*K),H=F-q,Z=y+$,ee=y-$,ie=m(ee*U),X=m(Z*K),le=ie+X,_e=ie-X;y=m(le*le),$=m(T*m(_e*_e)),P=m(F*q),_=m(H*(F+m(h*H)))}({x_2:P,x_3:y}=x(R,P,y)),{x_2:_,x_3:$}=x(R,_,$);const B=i(_);return m(P*B)}return{scalarMult:S,scalarMultBase:v,getSharedSecret:(I,O)=>S(I,O),getPublicKey:I=>v(I),utils:{randomPrivateKey:()=>c(u)},GuBytes:w.slice()}}BigInt(0);const KTe=BigInt(1),eJ=BigInt(2),GTe=BigInt(3),ZTe=BigInt(5);BigInt(8);const mde={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function YTe(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=mde.p,o=e*e%i*e%i,a=cd(o,eJ,i)*o%i,c=cd(a,KTe,i)*e%i,l=cd(c,ZTe,i)*c%i,u=cd(l,t,i)*l%i,d=cd(u,n,i)*u%i,h=cd(d,r,i)*d%i,f=cd(h,s,i)*h%i,g=cd(f,s,i)*h%i,p=cd(g,t,i)*l%i;return{pow_p_5_8:cd(p,eJ,i)*e%i,b2:o}}function JTe(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const XU=(()=>{const e=mde.p;return VTe({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=YTe(t);return uu(cd(n,GTe,e)*r,e)},adjustScalarBytes:JTe})})();function tJ(e){e.lowS!==void 0&&e9("lowS",e.lowS),e.prehash!==void 0&&e9("prehash",e.prehash)}let XTe=class extends Error{constructor(t=""){super(t)}};const xp={Err:XTe,_tlv:{encode:(e,t)=>{const{Err:n}=xp;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=Ax(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?Ax(s.length/2|128):"";return Ax(e)+i+s+t},decode(e,t){const{Err:n}=xp;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=xp;if(e<QE)throw new t("integer: negative integers are not allowed");let n=Ax(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=xp;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return e7(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=xp,s=qa("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=xp,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}},QE=BigInt(0),e8=BigInt(1),QTe=BigInt(2),Nx=BigInt(3),ePe=BigInt(4);function tPe(e,t,n){function r(s){const i=e.sqr(s),o=e.mul(i,s);return e.add(e.add(o,e.mul(s,t)),n)}return r}function wde(e,t,n){const{BYTES:r}=e;function s(i){let o;if(typeof i=="bigint")o=i;else{let a=qa("private key",i);if(t){if(!t.includes(a.length*2))throw new Error("invalid private key");const c=new Uint8Array(r);c.set(a,c.length-a.length),a=c}try{o=e.fromBytes(a)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof i}`)}}if(n&&(o=e.create(o)),!e.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return s}function nPe(e,t={}){const{Fp:n,Fn:r}=WTe("weierstrass",e,t),{h:s,n:i}=e;n7(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!n.is0(e.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function a(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function c(A,I,O){const{x:N,y:T}=I.toAffine(),P=n.toBytes(N);if(e9("isCompressed",O),O){a();const _=!n.isOdd(T);return aw(yde(_),P)}else return aw(Uint8Array.of(4),P,n.toBytes(T))}function l(A){yu(A);const I=n.BYTES,O=I+1,N=2*I+1,T=A.length,P=A[0],_=A.subarray(1);if(T===O&&(P===2||P===3)){const y=n.fromBytes(_);if(!n.isValid(y))throw new Error("bad point: is not on curve, wrong x");const $=h(y);let R;try{R=n.sqrt($)}catch(k){const D=k instanceof Error?": "+k.message:"";throw new Error("bad point: is not on curve, sqrt error"+D)}a();const B=n.isOdd(R);return(P&1)===1!==B&&(R=n.neg(R)),{x:y,y:R}}else if(T===N&&P===4){const y=n.fromBytes(_.subarray(I*0,I*1)),$=n.fromBytes(_.subarray(I*1,I*2));if(!f(y,$))throw new Error("bad point: is not on curve");return{x:y,y:$}}else throw new Error(`bad point: got length ${T}, expected compressed=${O} or uncompressed=${N}`)}const u=t.toBytes||c,d=t.fromBytes||l,h=tPe(n,e.a,e.b);function f(A,I){const O=n.sqr(I),N=h(A);return n.eql(O,N)}if(!f(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const g=n.mul(n.pow(e.a,Nx),ePe),p=n.mul(n.sqr(e.b),BigInt(27));if(n.is0(n.add(g,p)))throw new Error("bad curve params: a or b");function m(A,I,O=!1){if(!n.isValid(I)||O&&n.is0(I))throw new Error(`bad point coordinate ${A}`);return I}function w(A){if(!(A instanceof S))throw new Error("ProjectivePoint expected")}const C=GY((A,I)=>{const{px:O,py:N,pz:T}=A;if(n.eql(T,n.ONE))return{x:O,y:N};const P=A.is0();I==null&&(I=P?n.ONE:n.inv(T));const _=n.mul(O,I),y=n.mul(N,I),$=n.mul(T,I);if(P)return{x:n.ZERO,y:n.ZERO};
vendor: 4,369 bytes, line 8
8if(!n.eql($,n.ONE))throw new Error("invZ was invalid");return{x:_,y}}),E=GY(A=>{if(A.is0()){if(t.allowInfinityPoint&&!n.is0(A.py))return;throw new Error("bad point: ZERO")}const{x:I,y:O}=A.toAffine();if(!n.isValid(I)||!n.isValid(O))throw new Error("bad point: x or y not field elements");if(!f(I,O))throw new Error("bad point: equation left != right");if(!A.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function b(A,I,O,N,T){return O=new S(n.mul(O.px,A),O.py,O.pz),I=XE(N,I),O=XE(T,O),I.add(O)}class S{constructor(I,O,N){this.px=m("x",I),this.py=m("y",O,!0),this.pz=m("z",N),Object.freeze(this)}static fromAffine(I){const{x:O,y:N}=I||{};if(!I||!n.isValid(O)||!n.isValid(N))throw new Error("invalid affine point");if(I instanceof S)throw new Error("projective point not allowed");return n.is0(O)&&n.is0(N)?S.ZERO:new S(O,N,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(I){return LTe(S,"pz",I)}static fromBytes(I){return yu(I),S.fromHex(I)}static fromHex(I){const O=S.fromAffine(d(qa("pointHex",I)));return O.assertValidity(),O}static fromPrivateKey(I){const O=wde(r,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return S.BASE.multiply(O(I))}static msm(I,O){return qTe(S,r,I,O)}precompute(I=8,O=!0){return x.setWindowSize(this,I),O||this.multiply(Nx),this}_setWindowSize(I){this.precompute(I)}assertValidity(){E(this)}hasEvenY(){const{y:I}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(I)}equals(I){w(I);const{px:O,py:N,pz:T}=this,{px:P,py:_,pz:y}=I,$=n.eql(n.mul(O,y),n.mul(P,T)),R=n.eql(n.mul(N,y),n.mul(_,T));return $&&R}negate(){return new S(this.px,n.neg(this.py),this.pz)}double(){const{a:I,b:O}=e,N=n.mul(O,Nx),{px:T,py:P,pz:_}=this;let y=n.ZERO,$=n.ZERO,R=n.ZERO,B=n.mul(T,T),k=n.mul(P,P),D=n.mul(_,_),U=n.mul(T,P);return U=n.add(U,U),R=n.mul(T,_),R=n.add(R,R),y=n.mul(I,R),$=n.mul(N,D),$=n.add(y,$),y=n.sub(k,$),$=n.add(k,$),$=n.mul(y,$),y=n.mul(U,y),R=n.mul(N,R),D=n.mul(I,D),U=n.sub(B,D),U=n.mul(I,U),U=n.add(U,R),R=n.add(B,B),B=n.add(R,B),B=n.add(B,D),B=n.mul(B,U),$=n.add($,B),D=n.mul(P,_),D=n.add(D,D),B=n.mul(D,U),y=n.sub(y,B),R=n.mul(D,k),R=n.add(R,R),R=n.add(R,R),new S(y,$,R)}add(I){w(I);const{px:O,py:N,pz:T}=this,{px:P,py:_,pz:y}=I;let $=n.ZERO,R=n.ZERO,B=n.ZERO;const k=e.a,D=n.mul(e.b,Nx);let U=n.mul(O,P),F=n.mul(N,_),K=n.mul(T,y),q=n.add(O,N),H=n.add(P,_);q=n.mul(q,H),H=n.add(U,F),q=n.sub(q,H),H=n.add(O,T);let Z=n.add(P,y);return H=n.mul(H,Z),Z=n.add(U,K),H=n.sub(H,Z),Z=n.add(N,T),$=n.add(_,y),Z=n.mul(Z,$),$=n.add(F,K),Z=n.sub(Z,$),B=n.mul(k,H),$=n.mul(D,K),B=n.add($,B),$=n.sub(F,B),B=n.add(F,B),R=n.mul($,B),F=n.add(U,U),F=n.add(F,U),K=n.mul(k,K),H=n.mul(D,H),F=n.add(F,K),K=n.sub(U,K),K=n.mul(k,K),H=n.add(H,K),U=n.mul(F,H),R=n.add(R,U),U=n.mul(Z,H),$=n.mul(q,$),$=n.sub($,U),U=n.mul(q,F),B=n.mul(Z,B),B=n.add(B,U),new S($,R,B)}subtract(I){return this.add(I.negate())}is0(){return this.equals(S.ZERO)}multiply(I){const{endo:O}=t;if(!r.isValidNot0(I))throw new Error("invalid scalar: out of range");let N,T;const P=_=>x.wNAFCached(this,_,S.normalizeZ);if(O){const{k1neg:_,k1:y,k2neg:$,k2:R}=O.splitScalar(I),{p:B,f:k}=P(y),{p:D,f:U}=P(R);T=k.add(U),N=b(O.beta,B,D,_,$)}else{const{p:_,f:y}=P(I);N=_,T=y}return S.normalizeZ([N,T])[0]}multiplyUnsafe(I){const{endo:O}=t,N=this;if(!r.isValid(I))throw new Error("invalid scalar: out of range");if(I===QE||N.is0())return S.ZERO;if(I===e8)return N;if(x.hasPrecomputes(this))return this.multiply(I);if(O){const{k1neg:T,k1:P,k2neg:_,k2:y}=O.splitScalar(I),{p1:$,p2:R}=zTe(S,N,P,y);return b(O.beta,$,R,T,_)}else return x.wNAFCachedUnsafe(N,I)}multiplyAndAddUnsafe(I,O,N){const T=this.multiplyUnsafe(O).add(I.multiplyUnsafe(N));return T.is0()?void 0:T}toAffine(I){return C(this,I)}isTorsionFree(){const{isTorsionFree:I}=t;return s===e8?!0:I?I(S,this):x.wNAFCachedUnsafe(this,i).is0()}clearCofactor(){const{clearCofactor:I}=t;return s===e8?this:I?I(S,this):this.multiplyUnsafe(s)}toBytes(I=!0){return e9("isCompressed",I),this.assertValidity(),u(S,this,I)}toRawBytes(I=!0){return this.toBytes(I)}toHex(I=!0){return B8(this.toBytes(I))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}S.BASE=new S(e.Gx,e.Gy,n.ONE),S.ZERO=new S(n.ZERO,n.ONE,n.ZERO),S.Fp=n,S.Fn=r;const v=r.BITS,x=FTe(S,t.endo?Math.ceil(v/2):v);return S}function yde(e){return Uint8Array.of(e?2:3)}
vendor: 40,907 bytes, lines 8-14
8function rPe(e,t,n={}){n7(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=t.randomBytes||$6,s=t.hmac||((N,...T)=>XN(t.hash,N,aw(...T))),{Fp:i,Fn:o}=e,{ORDER:a,BITS:c}=o;function l(N){const T=a>>e8;return N>T}function u(N){return l(N)?o.neg(N):N}function d(N,T){if(!o.isValidNot0(T))throw new Error(`invalid signature ${N}: out of range 1..CURVE.n`)}class h{constructor(T,P,_){d("r",T),d("s",P),this.r=T,this.s=P,_!=null&&(this.recovery=_),Object.freeze(this)}static fromCompact(T){const P=o.BYTES,_=qa("compactSignature",T,P*2);return new h(o.fromBytes(_.subarray(0,P)),o.fromBytes(_.subarray(P,P*2)))}static fromDER(T){const{r:P,s:_}=xp.toSig(qa("DER",T));return new h(P,_)}assertValidity(){}addRecoveryBit(T){return new h(this.r,this.s,T)}recoverPublicKey(T){const P=i.ORDER,{r:_,s:y,recovery:$}=this;if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");if(a*QTe<P&&$>1)throw new Error("recovery id is ambiguous for h>1 curve");const R=$===2||$===3?_+a:_;if(!i.isValid(R))throw new Error("recovery id 2 or 3 invalid");const B=i.toBytes(R),k=e.fromHex(aw(yde(($&1)===0),B)),D=o.inv(R),U=E(qa("msgHash",T)),F=o.create(-U*D),K=o.create(y*D),q=e.BASE.multiplyUnsafe(F).add(k.multiplyUnsafe(K));if(q.is0())throw new Error("point at infinify");return q.assertValidity(),q}hasHighS(){return l(this.s)}normalizeS(){return this.hasHighS()?new h(this.r,o.neg(this.s),this.recovery):this}toBytes(T){if(T==="compact")return aw(o.toBytes(this.r),o.toBytes(this.s));if(T==="der")return Mq(xp.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return B8(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return B8(this.toBytes("compact"))}}const f=wde(o,n.allowedPrivateKeyLengths,n.wrapPrivateKey),g={isValidPrivateKey(N){try{return f(N),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const N=a;return UTe(r(fde(N)),N)},precompute(N=8,T=e.BASE){return T.precompute(N,!1)}};function p(N,T=!0){return e.fromPrivateKey(N).toBytes(T)}function m(N){if(typeof N=="bigint")return!1;if(N instanceof e)return!0;const T=qa("key",N).length,P=i.BYTES,_=P+1,y=2*P+1;if(!(n.allowedPrivateKeyLengths||o.BYTES===_))return T===_||T===y}function w(N,T,P=!0){if(m(N)===!0)throw new Error("first arg must be private key");if(m(T)===!1)throw new Error("second arg must be public key");return e.fromHex(T).multiply(f(N)).toBytes(P)}const C=t.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");const T=e7(N),P=N.length*8-c;return P>0?T>>BigInt(P):T},E=t.bits2int_modN||function(N){return o.create(C(N))},b=t7(c);function S(N){return JU("num < 2^"+c,N,QE,b),o.toBytes(N)}function v(N,T,P=x){if(["recovered","canonical"].some(q=>q in P))throw new Error("sign() legacy options not supported");const{hash:_}=t;let{lowS:y,prehash:$,extraEntropy:R}=P;y==null&&(y=!0),N=qa("msgHash",N),tJ(P),$&&(N=qa("prehashed msgHash",_(N)));const B=E(N),k=f(T),D=[S(k),S(B)];if(R!=null&&R!==!1){const q=R===!0?r(i.BYTES):R;D.push(qa("extraEntropy",q))}const U=aw(...D),F=B;function K(q){const H=C(q);if(!o.isValidNot0(H))return;const Z=o.inv(H),ee=e.BASE.multiply(H).toAffine(),ie=o.create(ee.x);if(ie===QE)return;const X=o.create(Z*o.create(F+ie*k));if(X===QE)return;let le=(ee.x===ie?0:2)|Number(ee.y&e8),_e=X;return y&&l(X)&&(_e=u(X),le^=1),new h(ie,_e,le)}return{seed:U,k2sig:K}}const x={lowS:t.lowS,prehash:!1},A={lowS:t.lowS,prehash:!1};function I(N,T,P=x){const{seed:_,k2sig:y}=v(N,T,P);return _Te(t.hash.outputLen,o.BYTES,s)(_,y)}e.BASE.precompute(8);function O(N,T,P,_=A){const y=N;T=qa("msgHash",T),P=qa("publicKey",P),tJ(_);const{lowS:$,prehash:R,format:B}=_;if("strict"in _)throw new Error("options.strict was renamed to lowS");if(B!==void 0&&!["compact","der","js"].includes(B))throw new Error('format must be "compact", "der" or "js"');const k=typeof y=="string"||Dq(y),D=!k&&!B&&typeof y=="object"&&y!==null&&typeof y.r=="bigint"&&typeof y.s=="bigint";if(!k&&!D)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let U,F;try{if(D)if(B===void 0||B==="js")U=new h(y.r,y.s);else throw new Error("invalid format");if(k){try{B!=="compact"&&(U=h.fromDER(y))}catch(le){if(!(le instanceof xp.Err))throw le}!U&&B!=="der"&&(U=h.fromCompact(y))}F=e.fromHex(P)}catch{return!1}if(!U||$&&U.hasHighS())return!1;R&&(T=t.hash(T));const{r:K,s:q}=U,H=E(T),Z=o.inv(q),ee=o.create(H*Z),ie=o.create(K*Z),X=e.BASE.multiplyUnsafe(ee).add(F.multiplyUnsafe(ie));return X.is0()?!1:o.create(X.x)===K}return Object.freeze({getPublicKey:p,getSharedSecret:w,sign:I,verify:O,utils:g,Point:e,Signature:h})}function sPe(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp,r=x6(t.n,e.nBitLength),s={Fp:n,Fn:r,allowedPrivateKeyLengths:e.allowedPrivateKeyLengths,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,wrapPrivateKey:e.wrapPrivateKey,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:s}}function iPe(e){const{CURVE:t,curveOpts:n}=sPe(e),r={hash:e.hash,hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,ecdsaOpts:r}}function oPe(e,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:e})}function aPe(e){const{CURVE:t,curveOpts:n,ecdsaOpts:r}=iPe(e),s=nPe(t,n),i=rPe(s,r,n);return oPe(e,i)}function QU(e,t){const n=r=>aPe({...e,hash:r});return{...n(t),create:n}}const bde={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},vde={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Ede={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},cPe=x6(bde.p),lPe=x6(vde.p),uPe=x6(Ede.p),dPe=QU({...bde,Fp:cPe,lowS:!1},JN);QU({...vde,Fp:lPe,lowS:!1},b7e),QU({...Ede,Fp:uPe,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},y7e);const hPe=dPe,Cde="base10",Xo="base16",Cd="base64pad",Jg="base64url",$C="utf8",$de=0,Xp=1,xC=2,fPe=0,nJ=1,t8=12,Hq=32;function pPe(){const e=XU.utils.randomPrivateKey(),t=XU.getPublicKey(e);return{privateKey:rn(e,Xo),publicKey:rn(t,Xo)}}function eL(){const e=$6(Hq);return rn(e,Xo)}function gPe(e,t){const n=XU.getSharedSecret(vn(e,Xo),vn(t,Xo)),r=ITe(QN,n,void 0,void 0,Hq);return rn(r,Xo)}function pS(e){const t=QN(vn(e,Xo));return rn(t,Xo)}function Oh(e){const t=QN(vn(e,$C));return rn(t,Xo)}function xde(e){return vn(`${e}`,Cde)}function Ww(e){return Number(rn(e,Cde))}function Ide(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Sde(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}function mPe(e){const t=xde(typeof e.type<"u"?e.type:$de);if(Ww(t)===Xp&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?vn(e.senderPublicKey,Xo):void 0,r=typeof e.iv<"u"?vn(e.iv,Xo):$6(t8),s=vn(e.symKey,Xo),i=sde(s,r).encrypt(vn(e.message,$C)),o=Ade({type:t,sealed:i,iv:r,senderPublicKey:n});return e.encoding===Jg?Ide(o):o}function wPe(e){const t=vn(e.symKey,Xo),{sealed:n,iv:r}=U8({encoded:e.encoded,encoding:e.encoding}),s=sde(t,r).decrypt(n);if(s===null)throw new Error("Failed to decrypt");return rn(s,$C)}function yPe(e,t){const n=xde(xC),r=$6(t8),s=vn(e,$C),i=Ade({type:n,sealed:s,iv:r});return t===Jg?Ide(i):i}function bPe(e,t){const{sealed:n}=U8({encoded:e,encoding:t});return rn(n,$C)}function Ade(e){if(Ww(e.type)===xC)return rn(Yo([e.type,e.sealed]),Cd);if(Ww(e.type)===Xp){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return rn(Yo([e.type,e.senderPublicKey,e.iv,e.sealed]),Cd)}return rn(Yo([e.type,e.iv,e.sealed]),Cd)}function U8(e){const t=(e.encoding||Cd)===Jg?Sde(e.encoded):e.encoded,n=vn(t,Cd),r=n.slice(fPe,nJ),s=nJ;if(Ww(r)===Xp){const c=s+Hq,l=c+t8,u=n.slice(s,c),d=n.slice(c,l),h=n.slice(l);return{type:r,sealed:h,iv:d,senderPublicKey:u}}if(Ww(r)===xC){const c=n.slice(s),l=$6(t8);return{type:r,sealed:c,iv:l}}const i=s+t8,o=n.slice(s,i),a=n.slice(i);return{type:r,sealed:a,iv:o}}function vPe(e,t){const n=U8({encoded:e,encoding:t==null?void 0:t.encoding});return _de({type:Ww(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?rn(n.senderPublicKey,Xo):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function _de(e){const t=(e==null?void 0:e.type)||$de;if(t===Xp){if(typeof(e==null?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(e==null?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e==null?void 0:e.senderPublicKey,receiverPublicKey:e==null?void 0:e.receiverPublicKey}}function rJ(e){return e.type===Xp&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function sJ(e){return e.type===xC}function EPe(e){const t=Buffer.from(e.x,"base64"),n=Buffer.from(e.y,"base64");return Yo([new Uint8Array([4]),t,n])}function CPe(e,t){const[n,r,s]=e.split("."),i=Buffer.from(Sde(s),"base64");if(i.length!==64)throw new Error("Invalid signature length");const o=i.slice(0,32),a=i.slice(32,64),c=`${n}.${r}`,l=QN(c),u=EPe(t);if(!hPe.verify(Yo([o,a]),l,u))throw new Error("Invalid signature");return wu(e).payload}const $Pe="irn";function n9(e){return(e==null?void 0:e.relay)||{protocol:$Pe}}function xE(e){const t=ZN[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}function xPe(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(s=>{if(s.startsWith(r)){const i=s.replace(r,""),o=e[s];n[i]=o}}),n}function iJ(e){if(!e.includes("wc:")){const l=Mue(e);l!=null&&l.includes("wc:")&&(e=l)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),s=e.substring(t+1,n).split("@"),i=typeof n<"u"?e.substring(n):"",o=new URLSearchParams(i),a={};o.forEach((l,u)=>{a[u]=l});const c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:r,topic:IPe(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:xPe(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function IPe(e){return e.startsWith("//")?e.substring(2):e}function SPe(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(s=>{const i=s,o=n+t+i;e[i]&&(r[o]=e[i])}),r}function oJ(e){const t=new URLSearchParams,n=SPe(e.relay);Object.keys(n).sort().forEach(s=>{t.set(s,n[s])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));const r=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${r}`}function Tx(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}var APe=Object.defineProperty,_Pe=Object.defineProperties,NPe=Object.getOwnPropertyDescriptors,aJ=Object.getOwnPropertySymbols,TPe=Object.prototype.hasOwnProperty,PPe=Object.prototype.propertyIsEnumerable,cJ=(e,t,n)=>t in e?APe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,OPe=(e,t)=>{for(var n in t||(t={}))TPe.call(t,n)&&cJ(e,n,t[n]);if(aJ)for(var n of aJ(t))PPe.call(t,n)&&cJ(e,n,t[n]);return e},kPe=(e,t)=>_Pe(e,NPe(t));function I6(e){const t=[];return e.forEach(n=>{const[r,s]=n.split(":");t.push(`${r}:${s}`)}),t}function RPe(e){const t=[];return Object.values(e).forEach(n=>{t.push(...I6(n.accounts))}),t}function BPe(e,t){const n=[];return Object.values(e).forEach(r=>{I6(r.accounts).includes(t)&&n.push(...r.methods)}),n}function DPe(e,t){const n=[];return Object.values(e).forEach(r=>{I6(r.accounts).includes(t)&&n.push(...r.events)}),n}function r7(e){return e.includes(":")}function uv(e){return r7(e)?e.split(":")[0]:e}function lJ(e){var t,n,r;const s={};if(!qh(e))return s;for(const[i,o]of Object.entries(e)){const a=r7(i)?[i]:o.chains,c=o.methods||[],l=o.events||[],u=uv(i);s[u]=kPe(OPe({},s[u]),{chains:zh(a,(t=s[u])==null?void 0:t.chains),methods:zh(c,(n=s[u])==null?void 0:n.methods),events:zh(l,(r=s[u])==null?void 0:r.events)})}return s}function UPe(e){const t={};return e==null||e.forEach(n=>{var r;const[s,i]=n.split(":");t[s]||(t[s]={accounts:[],chains:[],events:[],methods:[]}),t[s].accounts.push(n),(r=t[s].chains)==null||r.push(`${s}:${i}`)}),t}function uJ(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=UPe(t);for(const[r,s]of Object.entries(n))s.methods?s.methods=zh(s.methods,e):s.methods=e,s.events=["chainChanged","accountsChanged"];return n}function LPe(e,t){var n,r,s,i,o,a;const c=lJ(e),l=lJ(t),u={},d=Object.keys(c).concat(Object.keys(l));for(const h of d)u[h]={chains:zh((n=c[h])==null?void 0:n.chains,(r=l[h])==null?void 0:r.chains),methods:zh((s=c[h])==null?void 0:s.methods,(i=l[h])==null?void 0:i.methods),events:zh((o=c[h])==null?void 0:o.events,(a=l[h])==null?void 0:a.events)};return u}const MPe={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},jPe={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function We(e,t){const{message:n,code:r}=jPe[e];return{message:t?`${n} ${t}`:n,code:r}}function jr(e,t){const{message:n,code:r}=MPe[e];return{message:t?`${n} ${t}`:n,code:r}}function mu(e,t){return!!Array.isArray(e)}function qh(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Ki(e){return typeof e>"u"}function _s(e,t){return t&&Ki(e)?!0:typeof e=="string"&&!!e.trim().length}function Vq(e,t){return t&&Ki(e)?!0:typeof e=="number"&&!isNaN(e)}function FPe(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),s=Object.keys(n);let i=!0;return ow(s,r)?(r.forEach(o=>{const{accounts:a,methods:c,events:l}=e.namespaces[o],u=I6(a),d=n[o];(!ow(Rue(o,d),u)||!ow(d.methods,c)||!ow(d.events,l))&&(i=!1)}),i):!1}function r9(e){return _s(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function zPe(e){if(_s(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&r9(n)}}return!1}function qPe(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(_s(e,!1)){if(t(e))return!0;const n=Mue(e);return t(n)}}catch{}return!1}function WPe(e){var t;return(t=e==null?void 0:e.proposer)==null?void 0:t.publicKey}function HPe(e){return e==null?void 0:e.topic}function VPe(e,t){let n=null;return _s(e==null?void 0:e.publicKey,!1)||(n=We("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function dJ(e){let t=!0;return mu(e)?e.length&&(t=e.every(n=>_s(n,!1))):t=!1,t}function KPe(e,t,n){let r=null;return mu(t)&&t.length?t.forEach(s=>{r||r9(s)||(r=jr("UNSUPPORTED_CHAINS",`${n}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):r9(e)||(r=jr("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function GPe(e,t,n){let r=null;return Object.entries(e).forEach(([s,i])=>{if(r)return;const o=KPe(s,Rue(s,i),`${t} ${n}`);o&&(r=o)}),r}function ZPe(e,t){let n=null;return mu(e)?e.forEach(r=>{n||zPe(r)||(n=jr("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=jr("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function YPe(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=ZPe(r==null?void 0:r.accounts,`${t} namespace`);s&&(n=s)}),n}function JPe(e,t){let n=null;return dJ(e==null?void 0:e.methods)?dJ(e==null?void 0:e.events)||(n=jr("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=jr("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function Nde(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=JPe(r,`${t}, namespace`);s&&(n=s)}),n}function XPe(e,t,n){let r=null;if(e&&qh(e)){const s=Nde(e,t);s&&(r=s);const i=GPe(e,t,n);i&&(r=i)}else r=We("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function TO(e,t){let n=null;if(e&&qh(e)){const r=Nde(e,t);r&&(n=r);const s=YPe(e,t);s&&(n=s)}else n=We("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function Tde(e){return _s(e.protocol,!0)}function QPe(e,t){let n=!1;return e?e&&mu(e)&&e.length&&e.forEach(r=>{n=Tde(r)}):n=!0,n}function eOe(e){return typeof e=="number"}function ja(e){return typeof e<"u"&&typeof e!==null}function tOe(e){return!(!e||typeof e!="object"||!e.code||!Vq(e.code,!1)||!e.message||!_s(e.message,!1))}function nOe(e){return!(Ki(e)||!_s(e.method,!1))}function rOe(e){return!(Ki(e)||Ki(e.result)&&Ki(e.error)||!Vq(e.id,!1)||!_s(e.jsonrpc,!1))}function sOe(e){return!(Ki(e)||!_s(e.name,!1))}function hJ(e,t){return!(!r9(t)||!RPe(e).includes(t))}function iOe(e,t,n){return _s(n,!1)?BPe(e,t).includes(n):!1}function oOe(e,t,n){return _s(n,!1)?DPe(e,t).includes(n):!1}function fJ(e,t,n){let r=null;const s=aOe(e),i=cOe(t),o=Object.keys(s),a=Object.keys(i),c=pJ(Object.keys(e)),l=pJ(Object.keys(t)),u=c.filter(d=>!l.includes(d));return u.length&&(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces. 9 Required: ${u.toString()} 10 Received: ${Object.keys(t).toString()}`)),ow(o,a)||(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces. 11 Required: ${o.toString()} 12 Approved: ${a.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const h=I6(t[d].accounts);h.includes(d)||(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${d} 13 Required: ${d} 14 Approved: ${h.toString()}`))}),o.forEach(d=>{r||(ow(s[d].methods,i[d].methods)?ow(s[d].events,i[d].events)||(r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${d}`)):r=We("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function aOe(e){const t={};return Object.keys(e).forEach(n=>{var r;n.includes(":")?t[n]=e[n]:(r=e[n].chains)==null||r.forEach(s=>{t[s]={methods:e[n].methods,events:e[n].events}})}),t}function pJ(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function cOe(e){const t={};return Object.keys(e).forEach(n=>{if(n.includes(":"))t[n]=e[n];else{const r=I6(e[n].accounts);r==null||r.forEach(s=>{t[s]={accounts:e[n].accounts.filter(i=>i.includes(`${s}:`)),methods:e[n].methods,events:e[n].events}})}}),t}function lOe(e,t){return Vq(e,!1)&&e<=t.max&&e>=t.min}function gJ(){const e=EC();return new Promise(t=>{switch(e){case il.browser:t(uOe());break;case il.reactNative:t(dOe());break;case il.node:t(hOe());break;default:t(!0)}})}function uOe(){return C6()&&(navigator==null?void 0:navigator.onLine)}async function dOe(){if(u1()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const e=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return e==null?void 0:e.isConnected}return!0}function hOe(){return!0}function fOe(e){switch(EC()){case il.browser:pOe(e);break;case il.reactNative:gOe(e);break}}function pOe(e){!u1()&&C6()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function gOe(e){u1()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(t=>e(t==null?void 0:t.isConnected)))}function mOe(){var e;return C6()&&cn.getDocument()?((e=cn.getDocument())==null?void 0:e.visibilityState)==="visible":!0}const PO={};let P3=class{static get(t){return PO[t]}static set(t,n){PO[t]=n}static delete(t){delete PO[t]}};function wOe(e){const t=l1.decode(e);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function yOe({publicKey:e,signature:t,payload:n}){var r;const s=tL(n.method),i=128|parseInt(((r=n.version)==null?void 0:r.toString())||"4"),o=EOe(n.address),a=n.era==="00"?new Uint8Array([0]):tL(n.era);if(a.length!==1&&a.length!==2)throw new Error("Invalid era length");const c=parseInt(n.nonce,16),l=new Uint8Array([c&255,c>>8&255]),u=BigInt(`0x${vOe(n.tip)}`),d=$Oe(u),h=new Uint8Array([0,...e,o,...t,...a,...l,...d,...s]),f=COe(h.length+1);return new Uint8Array([...f,i,...h])}function bOe(e){const t=tL(e),n=Oq.blake2b(t,void 0,32);return"0x"+Buffer.from(n).toString("hex")}function tL(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function vOe(e){return e.startsWith("0x")?e.slice(2):e}function EOe(e){const t=l1.decode(e)[0];return t===42?0:t===60?2:1}function COe(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){const t=e<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(e<1<<30){const t=e<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function $Oe(e){if(e<BigInt(1)<<BigInt(6))return new Uint8Array([Number(e<<BigInt(2))]);if(e<BigInt(1)<<BigInt(14)){const t=e<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(e<BigInt(1)<<BigInt(30)){const t=e<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function xOe(e){const t=Uint8Array.from(Buffer.from(e.signature,"hex")),n=wOe(e.transaction.address),r=yOe({publicKey:n,signature:t,payload:e.transaction}),s=Buffer.from(r).toString("hex");return bOe(s)}class Wr{}let IOe=class extends Wr{constructor(t){super()}};const mJ=V.FIVE_SECONDS,Hr={pulse:"heartbeat_pulse"};let s7=class Pde extends IOe{constructor(t){super(t),this.events=new Dn.EventEmitter,this.interval=mJ,this.interval=(t==null?void 0:t.interval)||mJ}static async init(t){const n=new Pde(t);return await n.init(),n}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),V.toMiliseconds(this.interval))}pulse(){this.events.emit(Hr.pulse)}};const SOe=/"(?:_|\\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*:/,AOe=/"(?: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*:/,_Oe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function NOe(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){TOe(e);return}return t}function TOe(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function Px(e,t={}){if(typeof e!="string")return e;if(e[0]==='"'&&e[e.length-1]==='"'&&e.indexOf("\\")===-1)return e.slice(1,-1);const n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!_Oe.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(SOe.test(e)||AOe.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,NOe)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}function POe(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function ci(e,...t){try{return POe(e(...t))}catch(n){return Promise.reject(n)}}function OOe(e){const t=typeof e;return e===null||t!=="object"&&t!=="function"}function kOe(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function gS(e){if(OOe(e))return String(e);if(kOe(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return gS(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const nL="base64:";function ROe(e){return typeof e=="string"?e:nL+UOe(e)}function BOe(e){return typeof e!="string"||!e.startsWith(nL)?e:DOe(e.slice(nL.length))}function DOe(e){return globalThis.Buffer?Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),t=>t.codePointAt(0))}function UOe(e){return globalThis.Buffer?Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function Ma(e){var t;return e&&((t=e.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function LOe(...e){return Ma(e.join(":"))}function Ox(e){return e=Ma(e),e?e+":":""}function MOe(e,t){if(t===void 0)return!0;let n=0,r=e.indexOf(":");for(;r>-1;)n++,r=e.indexOf(":",r+1);return n<=t}function jOe(e,t){return t?e.startsWith(t)&&e[e.length-1]!=="$":e[e.length-1]!=="$"}const FOe="memory",zOe=()=>{const e=new Map;return{name:FOe,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}};function qOe(e={}){const t={mounts:{"":e.driver||zOe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=l=>{for(const u of t.mountpoints)if(l.startsWith(u))return{base:u,relativeKey:l.slice(u.length),driver:t.mounts[u]};return{base:"",relativeKey:l,driver:t.mounts[""]}},r=(l,u)=>t.mountpoints.filter(d=>d.startsWith(l)||u&&l.startsWith(d)).map(d=>({relativeBase:l.length>d.length?l.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),s=(l,u)=>{if(t.watching){u=Ma(u);for(const d of t.watchListeners)d(l,u)}},i=async()=>{if(!t.watching){t.watching=!0;for(const l in t.mounts)t.unwatch[l]=await wJ(t.mounts[l],s,l)}},o=async()=>{if(t.watching){for(const l in t.unwatch)await t.unwatch[l]();t.unwatch={},t.watching=!1}},a=(l,u,d)=>{const h=new Map,f=g=>{let p=h.get(g.base);return p||(p={driver:g.driver,base:g.base,items:[]},h.set(g.base,p)),p};for(const g of l){const p=typeof g=="string",m=Ma(p?g:g.key),w=p?void 0:g.value,C=p||!g.options?u:{...u,...g.options},E=n(m);f(E).items.push({key:m,value:w,relativeKey:E.relativeKey,options:C})}return Promise.all([...h.values()].map(g=>d(g))).then(g=>g.flat())},c={hasItem(l,u={}){l=Ma(l);const{relativeKey:d,driver:h}=n(l);return ci(h.hasItem,d,u)},getItem(l,u={}){l=Ma(l);const{relativeKey:d,driver:h}=n(l);return ci(h.getItem,d,u).then(f=>Px(f))},getItems(l,u={}){return a(l,u,d=>d.driver.getItems?ci(d.driver.getItems,d.items.map(h=>({key:h.relativeKey,options:h.options})),u).then(h=>h.map(f=>({key:LOe(d.base,f.key),value:Px(f.value)}))):Promise.all(d.items.map(h=>ci(d.driver.getItem,h.relativeKey,h.options).then(f=>({key:h.key,value:Px(f)})))))},getItemRaw(l,u={}){l=Ma(l);const{relativeKey:d,driver:h}=n(l);return h.getItemRaw?ci(h.getItemRaw,d,u):ci(h.getItem,d,u).then(f=>BOe(f))},async setItem(l,u,d={}){if(u===void 0)return c.removeItem(l);l=Ma(l);const{relativeKey:h,driver:f}=n(l);f.setItem&&(await ci(f.setItem,h,gS(u),d),f.watch||s("update",l))},async setItems(l,u){await a(l,u,async d=>{if(d.driver.setItems)return ci(d.driver.setItems,d.items.map(h=>({key:h.relativeKey,value:gS(h.value),options:h.options})),u);d.driver.setItem&&await Promise.all(d.items.map(h=>ci(d.driver.setItem,h.relativeKey,gS(h.value),h.options)))})},async setItemRaw(l,u,d={}){if(u===void 0)return c.removeItem(l,d);l=Ma(l);const{relativeKey:h,driver:f}=n(l);if(f.setItemRaw)await ci(f.setItemRaw,h,u,d);else if(f.setItem)await ci(f.setItem,h,ROe(u),d);else return;f.watch||s("update",l)},async removeItem(l,u={}){typeof u=="boolean"&&(u={removeMeta:u}),l=Ma(l);const{relativeKey:d,driver:h}=n(l);h.removeItem&&(await ci(h.removeItem,d,u),(u.removeMeta||u.removeMata)&&await ci(h.removeItem,d+"$",u),h.watch||s("remove",l))},async getMeta(l,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),l=Ma(l);const{relativeKey:d,driver:h}=n(l),f=Object.create(null);if(h.getMeta&&Object.assign(f,await ci(h.getMeta,d,u)),!u.nativeOnly){const g=await ci(h.getItem,d+"$",u).then(p=>Px(p));g&&typeof g=="object"&&(typeof g.atime=="string"&&(g.atime=new Date(g.atime)),typeof g.mtime=="string"&&(g.mtime=new Date(g.mtime)),Object.assign(f,g))}return f},setMeta(l,u,d={}){return this.setItem(l+"$",u,d)},removeMeta(l,u={}){return this.removeItem(l+"$",u)},async getKeys(l,u={}){var m;l=Ox(l);const d=r(l,!0);let h=[];const f=[];let g=!0;for(const w of d){(m=w.driver.flags)!=null&&m.maxDepth||(g=!1);const C=await ci(w.driver.getKeys,w.relativeBase,u);for(const E of C){const b=w.mountpoint+Ma(E);h.some(S=>b.startsWith(S))||f.push(b)}h=[w.mountpoint,...h.filter(E=>!E.startsWith(w.mountpoint))]}const p=u.maxDepth!==void 0&&!g;return f.filter(w=>(!p||MOe(w,u.maxDepth))&&jOe(w,l))},async clear(l,u={}){l=Ox(l),await Promise.all(r(l,!1).map(async d=>{if(d.driver.clear)return ci(d.driver.clear,d.relativeBase,u);if(d.driver.removeItem){const h=await d.driver.getKeys(d.relativeBase||"",u);return Promise.all(h.map(f=>d.driver.removeItem(f,u)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(l=>yJ(l)))},async watch(l){return await i(),t.watchListeners.push(l),async()=>{t.watchListeners=t.watchListeners.filter(u=>u!==l),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(l,u){if(l=Ox(l),l&&t.mounts[l])throw new Error(`already mounted at ${l}`);return l&&(t.mountpoints.push(l),t.mountpoints.sort((d,h)=>h.length-d.length)),t.mounts[l]=u,t.watching&&Promise.resolve(wJ(u,s,l)).then(d=>{t.unwatch[l]=d}).catch(console.error),c},async unmount(l,u=!0){var d,h;l=Ox(l),!(!l||!t.mounts[l])&&(t.watching&&l in t.unwatch&&((h=(d=t.unwatch)[l])==null||h.call(d),delete t.unwatch[l]),u&&await yJ(t.mounts[l]),t.mountpoints=t.mountpoints.filter(f=>f!==l),delete t.mounts[l])},getMount(l=""){l=Ma(l)+":";const u=n(l);return{driver:u.driver,base:u.base}},getMounts(l="",u={}){return l=Ma(l),r(l,u.parents).map(h=>({driver:h.driver,base:h.mountpoint}))},keys:(l,u={})=>c.getKeys(l,u),get:(l,u={})=>c.getItem(l,u),set:(l,u,d={})=>c.setItem(l,u,d),has:(l,u={})=>c.hasItem(l,u),del:(l,u={})=>c.removeItem(l,u),remove:(l,u={})=>c.removeItem(l,u)};return c}function wJ(e,t,n){return e.watch?e.watch((r,s)=>t(r,n+s)):()=>{}}async function yJ(e){typeof e.dispose=="function"&&await ci(e.dispose)}function nb(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Ode(e,t){let n;const r=()=>{if(n)return n;const s=indexedDB.open(e);return s.onupgradeneeded=()=>s.result.createObjectStore(t),n=nb(s),n.then(i=>{i.onclose=()=>n=void 0},()=>{}),n};return(s,i)=>r().then(o=>i(o.transaction(t,s).objectStore(t)))}let OO;function IC(){return OO||(OO=Ode("keyval-store","keyval")),OO}function bJ(e,t=IC()){return t("readonly",n=>nb(n.get(e)))}function WOe(e,t,n=IC()){return n("readwrite",r=>(r.put(t,e),nb(r.transaction)))}function HOe(e,t=IC()){return t("readwrite",n=>(n.delete(e),nb(n.transaction)))}function VOe(e=IC()){return e("readwrite",t=>(t.clear(),nb(t.transaction)))}function KOe(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},nb(e.transaction)}function GOe(e=IC()){return e("readonly",t=>{if(t.getAllKeys)return nb(t.getAllKeys());const n=[];return KOe(t,r=>n.push(r.key)).then(()=>n)})}const ZOe="idb-keyval";var YOe=(e={})=>{const t=e.base&&e.base.length>0?`${e.base}:`:"",n=s=>t+s;let r;return e.dbName&&e.storeName&&(r=Ode(e.dbName,e.storeName)),{name:ZOe,options:e,async hasItem(s){return!(typeof await bJ(n(s),r)>"u")},async getItem(s){return await bJ(n(s),r)??null},setItem(s,i){return WOe(n(s),i,r)},removeItem(s){return HOe(n(s),r)},getKeys(){return GOe(r)},clear(){return VOe(r)}}};const JOe="WALLET_CONNECT_V2_INDEXED_DB",XOe="keyvaluestorage";let QOe=class{constructor(){this.indexedDb=qOe({driver:YOe({dbName:JOe,storeName:XOe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const n=await this.indexedDb.getItem(t);if(n!==null)return n}async setItem(t,n){await this.indexedDb.setItem(t,Ao(n))}async removeItem(t){await this.indexedDb.removeItem(t)}};var kO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},mS={exports:{}};(function(){let e;function t(){}e=t,e.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},e.prototype.setItem=function(n,r){this[n]=String(r)},e.prototype.removeItem=function(n){delete this[n]},e.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(r){n[r]=void 0,delete n[r]})},e.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof kO<"u"&&kO.localStorage?mS.exports=kO.localStorage:typeof window<"u"&&window.localStorage?mS.exports=window.localStorage:mS.exports=new t})();function eke(e){var t;return[e[0],ul((t=e[1])!=null?t:"")]}let tke=class{constructor(){this.localStorage=mS.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(eke)}async getItem(t){const n=this.localStorage.getItem(t);if(n!==null)return ul(n)}async setItem(t,n){this.localStorage.setItem(t,Ao(n))}async removeItem(t){this.localStorage.removeItem(t)}};const nke="wc_storage_version",vJ=1,rke=async(e,t,n)=>{const r=nke,s=await t.getItem(r);if(s&&s>=vJ){n(t);return}const i=await e.getKeys();if(!i.length){n(t);return}const o=[];for(;i.length;){const a=i.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const l=await e.getItem(a);await t.setItem(a,l),o.push(a)}}await t.setItem(r,vJ),n(t),ske(e,o)},ske=async(e,t)=>{t.length&&t.forEach(async n=>{await e.removeItem(n)})};let i7=class{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const t=new tke;this.storage=t;try{const n=new QOe;rke(t,n,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(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,n){return await this.initialize(),this.storage.setItem(t,n)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),t())},20)})}};var RO,EJ;function SC(){if(EJ)return RO;EJ=1;function e(n){try{return JSON.stringify(n)}catch{return'"[Circular]"'}}RO=t;function t(n,r,s){var i=s&&s.stringify||e,o=1;if(typeof n=="object"&&n!==null){var a=r.length+o;if(a===1)return n;var c=new Array(a);c[0]=i(n);for(var l=1;l<a;l++)c[l]=i(r[l]);return c.join(" ")}if(typeof n!="string")return n;var u=r.length;if(u===0)return n;for(var d="",h=1-o,f=-1,g=n&&n.length||0,p=0;p<g;){if(n.charCodeAt(p)===37&&p+1<g){switch(f=f>-1?f:0,n.charCodeAt(p+1)){case 100:case 102:if(h>=u||r[h]==null)break;f<p&&(d+=n.slice(f,p)),d+=Number(r[h]),f=p+2,p++;break;case 105:if(h>=u||r[h]==null)break;f<p&&(d+=n.slice(f,p)),d+=Math.floor(Number(r[h])),f=p+2,p++;break;case 79:case 111:case 106:if(h>=u||r[h]===void 0)break;f<p&&(d+=n.slice(f,p));var m=typeof r[h];if(m==="string"){d+="'"+r[h]+"'",f=p+2,p++;break}if(m==="function"){d+=r[h].name||"<anonymous>",f=p+2,p++;break}d+=i(r[h]),f=p+2,p++;break;case 115:if(h>=u)break;f<p&&(d+=n.slice(f,p)),d+=String(r[h]),f=p+2,p++;break;case 37:f<p&&(d+=n.slice(f,p)),d+="%",f=p+2,p++,h--;break}++h}++p}return f===-1?n:(f<g&&(d+=n.slice(f)),d)}return RO}var BO,CJ;function ike(){if(CJ)return BO;CJ=1;const e=SC();BO=s;const t=S().console||{},n={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:p,wrapResponseSerializer:p,wrapErrorSerializer:p,req:g,res:g,err:h};function r(v,x){return Array.isArray(v)?v.filter(function(I){return I!=="!stdSerializers.err"}):v===!0?Object.keys(x):!1}function s(v){v=v||{},v.browser=v.browser||{};const x=v.browser.transmit;if(x&&typeof x.send!="function")throw Error("pino: transmit option must have a send function");const A=v.browser.write||t;v.browser.write&&(v.browser.asObject=!0);const I=v.serializers||{},O=r(v.browser.serialize,I);let N=v.browser.serialize;Array.isArray(v.browser.serialize)&&v.browser.serialize.indexOf("!stdSerializers.err")>-1&&(N=!1);const T=["error","fatal","warn","info","debug","trace"];typeof A=="function"&&(A.error=A.fatal=A.warn=A.info=A.debug=A.trace=A),v.enabled===!1&&(v.level="silent");const P=v.level||"info",_=Object.create(A);_.log||(_.log=m),Object.defineProperty(_,"levelVal",{get:$}),Object.defineProperty(_,"level",{get:R,set:B});const y={transmit:x,serialize:O,asObject:v.browser.asObject,levels:T,timestamp:f(v)};_.levels=s.levels,_.level=P,_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=m,_.serializers=I,_._serialize=O,_._stdErrSerialize=N,_.child=k,x&&(_._logEvent=d());
14function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function R(){return this._level}function B(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,i(y,_,"error","log"),i(y,_,"fatal","error"),i(y,_,"warn","error"),i(y,_,"info","log"),i(y,_,"debug","log"),i(y,_,"trace","log")}function k(D,U){if(!D)throw new Error("missing bindings for child Pino");U=U||{},O&&D.serializers&&(U.serializers=D.serializers);const F=U.serializers;if(O&&F){var K=Object.assign({},I,F),q=v.browser.serialize===!0?Object.keys(K):O;delete D.serializers,c([D],q,K,this._stdErrSerialize)}function H(Z){this._childLevel=(Z._childLevel|0)+1,this.error=l(Z,D,"error"),this.fatal=l(Z,D,"fatal"),this.warn=l(Z,D,"warn"),this.info=l(Z,D,"info"),this.debug=l(Z,D,"debug"),this.trace=l(Z,D,"trace"),K&&(this.serializers=K,this._serialize=q),x&&(this._logEvent=d([].concat(Z._logEvent.bindings,D)))}return H.prototype=this,new H(this)}return _}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers=n,s.stdTimeFunctions=Object.assign({},{nullTime:w,epochTime:C,unixTime:E,isoTime:b});function i(v,x,A,I){const O=Object.getPrototypeOf(x);x[A]=x.levelVal>x.levels.values[A]?m:O[A]?O[A]:t[A]||t[I]||m,o(v,x,A)}function o(v,x,A){!v.transmit&&x[A]===m||(x[A]=(function(I){return function(){const N=v.timestamp(),T=new Array(arguments.length),P=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var _=0;_<T.length;_++)T[_]=arguments[_];if(v.serialize&&!v.asObject&&c(T,this._serialize,this.serializers,this._stdErrSerialize),v.asObject?I.call(P,a(this,A,T,N)):I.apply(P,T),v.transmit){const y=v.transmit.level||x.level,$=s.levels.values[y],R=s.levels.values[A];if(R<$)return;u(this,{ts:N,methodLevel:A,methodValue:R,transmitValue:s.levels.values[v.transmit.level||x.level],send:v.transmit.send,val:x.levelVal},T)}}})(x[A]))}
vendor: 32,835 bytes, line 14
14function a(v,x,A,I){v._serialize&&c(A,v._serialize,v.serializers,v._stdErrSerialize);const O=A.slice();let N=O[0];const T={};I&&(T.time=I),T.level=s.levels.values[x];let P=(v._childLevel|0)+1;if(P<1&&(P=1),N!==null&&typeof N=="object"){for(;P--&&typeof O[0]=="object";)Object.assign(T,O.shift());N=O.length?e(O.shift(),O):void 0}else typeof N=="string"&&(N=e(O.shift(),O));return N!==void 0&&(T.msg=N),T}function c(v,x,A,I){for(const O in v)if(I&&v[O]instanceof Error)v[O]=s.stdSerializers.err(v[O]);else if(typeof v[O]=="object"&&!Array.isArray(v[O]))for(const N in v[O])x&&x.indexOf(N)>-1&&N in A&&(v[O][N]=A[N](v[O][N]))}function l(v,x,A){return function(){const I=new Array(1+arguments.length);I[0]=x;for(var O=1;O<I.length;O++)I[O]=arguments[O-1];return v[A].apply(this,I)}}function u(v,x,A){const I=x.send,O=x.ts,N=x.methodLevel,T=x.methodValue,P=x.val,_=v._logEvent.bindings;c(A,v._serialize||Object.keys(v.serializers),v.serializers,v._stdErrSerialize===void 0?!0:v._stdErrSerialize),v._logEvent.ts=O,v._logEvent.messages=A.filter(function(y){return _.indexOf(y)===-1}),v._logEvent.level.label=N,v._logEvent.level.value=T,I(N,v._logEvent,P),v._logEvent=d(_)}function d(v){return{ts:0,messages:[],bindings:v||[],level:{label:"",value:0}}}function h(v){const x={type:v.constructor.name,msg:v.message,stack:v.stack};for(const A in v)x[A]===void 0&&(x[A]=v[A]);return x}function f(v){return typeof v.timestamp=="function"?v.timestamp:v.timestamp===!1?w:C}function g(){return{}}function p(v){return v}function m(){}function w(){return!1}function C(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function S(){function v(x){return typeof x<"u"&&x}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return v(self)||v(window)||v(this)||{}}}return BO}var Y2=ike();const Kq=mf(Y2),oke={level:"info"},AC="custom_context",Gq=1e3*1024;let ake=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},$J=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const n=new ake(t);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let n=this.head;for(;n!==null;)t.push(n.value),n=n.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const n=t.value;return t=t.next,{done:!1,value:n}}}}},kde=class{constructor(t,n=Gq){this.level=t??"error",this.levelValue=Y2.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new $J(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,n){n===Y2.levels.values.error?console.error(t):n===Y2.levels.values.warn?console.warn(t):n===Y2.levels.values.debug?console.debug(t):n===Y2.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Ao({timestamp:new Date().toISOString(),log:t}));const n=typeof t=="string"?JSON.parse(t).level:t.level;n>=this.levelValue&&this.forwardToConsole(t,n)}getLogs(){return this.logs}clearLogs(){this.logs=new $J(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const n=this.getLogArray();return n.push(Ao({extraMetadata:t})),new Blob(n,{type:"application/json"})}},cke=class{constructor(t,n=Gq){this.baseChunkLogger=new kde(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const n=URL.createObjectURL(this.logsToBlob(t)),r=document.createElement("a");r.href=n,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}},lke=class{constructor(t,n=Gq){this.baseChunkLogger=new kde(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var uke=Object.defineProperty,dke=Object.defineProperties,hke=Object.getOwnPropertyDescriptors,xJ=Object.getOwnPropertySymbols,fke=Object.prototype.hasOwnProperty,pke=Object.prototype.propertyIsEnumerable,IJ=(e,t,n)=>t in e?uke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s9=(e,t)=>{for(var n in t||(t={}))fke.call(t,n)&&IJ(e,n,t[n]);if(xJ)for(var n of xJ(t))pke.call(t,n)&&IJ(e,n,t[n]);return e},i9=(e,t)=>dke(e,hke(t));function Rde(e){return i9(s9({},e),{level:(e==null?void 0:e.level)||oke.level})}function gke(e,t=AC){return e[t]||""}function mke(e,t,n=AC){return e[n]=t,e}function Il(e,t=AC){let n="";return typeof e.bindings>"u"?n=gke(e,t):n=e.bindings().context||"",n}function wke(e,t,n=AC){const r=Il(e,n);return r.trim()?`${r}/${t}`:t}function Ec(e,t,n=AC){const r=wke(e,t,n),s=e.child({context:r});return mke(s,r,n)}function yke(e){var t,n;const r=new cke((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:Kq(i9(s9({},e.opts),{level:"trace",browser:i9(s9({},(n=e.opts)==null?void 0:n.browser),{write:s=>r.write(s)})})),chunkLoggerController:r}}function bke(e){var t;const n=new lke((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:Kq(i9(s9({},e.opts),{level:"trace"}),n),chunkLoggerController:n}}function vke(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?yke(e):bke(e)}var Eke=Object.defineProperty,Cke=(e,t,n)=>t in e?Eke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SJ=(e,t,n)=>Cke(e,typeof t!="symbol"?t+"":t,n);let $ke=class extends Wr{constructor(t){super(),this.opts=t,SJ(this,"protocol","wc"),SJ(this,"version",2)}};var xke=Object.defineProperty,Ike=(e,t,n)=>t in e?xke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ske=(e,t,n)=>Ike(e,t+"",n);let Ake=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n,Ske(this,"records",new Map)}},_ke=class{constructor(t,n){this.logger=t,this.core=n}},Nke=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},Tke=class extends Wr{constructor(t){super()}},Pke=class{constructor(t,n,r,s){this.core=t,this.logger=n,this.name=r}},Oke=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},kke=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n}},Rke=class{constructor(t,n,r){this.core=t,this.logger=n,this.store=r}},Bke=class{constructor(t,n){this.projectId=t,this.logger=n}},Dke=class{constructor(t,n,r){this.core=t,this.logger=n,this.telemetryEnabled=r}};const Uke="PARSE_ERROR",Lke="INVALID_REQUEST",Mke="METHOD_NOT_FOUND",jke="INVALID_PARAMS",Bde="INTERNAL_ERROR",Zq="SERVER_ERROR",Fke=[-32700,-32600,-32601,-32602,-32603],n8={[Uke]:{code:-32700,message:"Parse error"},[Lke]:{code:-32600,message:"Invalid Request"},[Mke]:{code:-32601,message:"Method not found"},[jke]:{code:-32602,message:"Invalid params"},[Bde]:{code:-32603,message:"Internal error"},[Zq]:{code:-32e3,message:"Server error"}},Dde=Zq;function zke(e){return Fke.includes(e)}function AJ(e){return Object.keys(n8).includes(e)?n8[e]:n8[Dde]}function qke(e){const t=Object.values(n8).find(n=>n.code===e);return t||n8[Dde]}function Ude(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${t}`):e}var DO={};var rL=function(e,t){return rL=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)r.hasOwnProperty(s)&&(n[s]=r[s])},rL(e,t)};function Wke(e,t){rL(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var sL=function(){return sL=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},sL.apply(this,arguments)};function Hke(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Vke(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i}function Kke(e,t){return function(n,r){t(n,r,e)}}function Gke(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Zke(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{l(r.next(u))}catch(d){o(d)}}function c(u){try{l(r.throw(u))}catch(d){o(d)}}function l(u){u.done?i(u.value):s(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function Yke(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,s=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){n.label=l[1];break}if(l[0]===6&&n.label<i[1]){n.label=i[1],i=l;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(l);break}i[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],s=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Jke(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function Xke(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function iL(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lde(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function Qke(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Lde(arguments[t]));return e}function eRe(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),s=0,t=0;t<n;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function L8(e){return this instanceof L8?(this.v=e,this):new L8(e)}function tRe(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),s,i=[];return s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s;function o(h){r[h]&&(s[h]=function(f){return new Promise(function(g,p){i.push([h,f,g,p])>1||a(h,f)})})}function a(h,f){try{c(r[h](f))}catch(g){d(i[0][3],g)}}function c(h){h.value instanceof L8?Promise.resolve(h.value.v).then(l,u):d(i[0][2],h)}function l(h){a("next",h)}function u(h){a("throw",h)}function d(h,f){h(f),i.shift(),i.length&&a(i[0][0],i[0][1])}}function nRe(e){var t,n;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,i){t[s]=e[s]?function(o){return(n=!n)?{value:L8(e[s](o)),done:s==="return"}:i?i(o):o}:i}}function rRe(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof iL=="function"?iL(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=e[i]&&function(o){return new Promise(function(a,c){o=e[i](o),s(a,c,o.done,o.value)})}}function s(i,o,a,c){Promise.resolve(c).then(function(l){i({value:l,done:a})},o)}}function sRe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function iRe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function oRe(e){return e&&e.__esModule?e:{default:e}}function aRe(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function cRe(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}const lRe=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return sL},__asyncDelegator:nRe,__asyncGenerator:tRe,__asyncValues:rRe,__await:L8,__awaiter:Zke,__classPrivateFieldGet:aRe,__classPrivateFieldSet:cRe,__createBinding:Jke,__decorate:Vke,__exportStar:Xke,__extends:Wke,__generator:Yke,__importDefault:oRe,__importStar:iRe,__makeTemplateObject:sRe,__metadata:Gke,__param:Kke,__read:Lde,__rest:Hke,__spread:Qke,__spreadArrays:eRe,__values:iL},Symbol.toStringTag,{value:"Module"})),uRe=gle(lRe);var Rf={},_J;function dRe(){if(_J)return Rf;_J=1,Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.isBrowserCryptoAvailable=Rf.getSubtleCrypto=Rf.getBrowerCrypto=void 0;function e(){return(globalThis==null?void 0:globalThis.crypto)||(globalThis==null?void 0:globalThis.msCrypto)||{}}Rf.getBrowerCrypto=e;function t(){const r=e();return r.subtle||r.webkitSubtle}Rf.getSubtleCrypto=t;function n(){return!!e()&&!!t()}return Rf.isBrowserCryptoAvailable=n,Rf}var Bf={},NJ;function hRe(){if(NJ)return Bf;NJ=1,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.isBrowser=Bf.isNode=Bf.isReactNative=void 0;function e(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Bf.isReactNative=e;function t(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Bf.isNode=t;function n(){return!e()&&!t()}return Bf.isBrowser=n,Bf}var TJ;function fRe(){return TJ||(TJ=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=uRe;t.__exportStar(dRe(),e),t.__exportStar(hRe(),e)})(DO)),DO}var pRe=fRe();function Bn(e=3){const t=Date.now()*Math.pow(10,e),n=Math.floor(Math.random()*Math.pow(10,e));return t+n}function Ir(e=6){return BigInt(Bn(e))}function _n(e,t,n){return{id:n||Bn(),jsonrpc:"2.0",method:e,params:t}}function Pi(e,t){return{id:e,jsonrpc:"2.0",result:t}}function yf(e,t,n){return{id:e,jsonrpc:"2.0",error:gRe(t)}}function gRe(e,t){return typeof e>"u"?AJ(Bde):(typeof e=="string"&&(e=Object.assign(Object.assign({},AJ(Zq)),{message:e})),zke(e.code)&&(e=qke(e.code)),e)}let mRe=class{},wRe=class extends mRe{constructor(){super()}},yRe=class extends wRe{constructor(t){super()}};const bRe="^https?:",vRe="^wss?:";function ERe(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(!(!t||!t.length))return t[0]}function Mde(e,t){const n=ERe(e);return typeof n>"u"?!1:new RegExp(t).test(n)}function PJ(e){return Mde(e,bRe)}function OJ(e){return Mde(e,vRe)}function CRe(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function jde(e){return typeof e=="object"&&"id"in e&&"jsonrpc"in e&&e.jsonrpc==="2.0"}function Du(e){return jde(e)&&"method"in e}function Sl(e){return jde(e)&&(wn(e)||nn(e))}function wn(e){return"result"in e}function nn(e){return"error"in e}let or=class extends yRe{constructor(t){super(t),this.events=new Dn.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async request(t,n){return this.requestStrict(_n(t.method,t.params||[],t.id||Ir().toString()),n)}async requestStrict(t,n){return new Promise(async(r,s)=>{if(!this.connection.connected)try{await this.open()}catch(i){s(i)}this.events.on(`${t.id}`,i=>{nn(i)?s(i.error):r(i.result)});try{await this.connection.send(t,n)}catch(i){s(i)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Sl(t)?this.events.emit(`${t.id}`,t):this.events.emit("message",{type:t.method,data:t.params})}onClose(t){t&&t.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${t.code} ${t.reason?`(${t.reason})`:""}`)),this.events.emit("disconnect")}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),typeof t=="string"&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",t=>this.onClose(t)),this.connection.on("error",t=>this.events.emit("error",t)),this.connection.on("register_error",t=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const $Re=()=>typeof WebSocket<"u"?WebSocket:typeof globalThis<"u"&&typeof globalThis.WebSocket<"u"?globalThis.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),xRe=()=>typeof WebSocket<"u"||typeof globalThis<"u"&&typeof globalThis.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",kJ=e=>e.split("?")[0],RJ=10,IRe=$Re();let o7=class{constructor(t){if(this.url=t,this.events=new Dn.EventEmitter,this.registering=!1,!OJ(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);this.url=t}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async open(t=this.url){await this.register(t)}async close(){return new Promise((t,n)=>{if(typeof this.socket>"u"){n(new Error("Connection already closed"));return}this.socket.onclose=r=>{this.onClose(r),t()},this.socket.close()})}async send(t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ao(t))}catch(n){this.onError(t.id,n)}}register(t=this.url){if(!OJ(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);if(this.registering){const n=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=n||this.events.listenerCount("open")>=n)&&this.events.setMaxListeners(n+1),new Promise((r,s)=>{this.events.once("register_error",i=>{this.resetMaxListeners(),s(i)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));r(this.socket)})})}return this.url=t,this.registering=!0,new Promise((n,r)=>{const s=pRe.isReactNative()?void 0:{rejectUnauthorized:!CRe(t)},i=new IRe(t,[],s);xRe()?i.onerror=o=>{const a=o;r(this.emitError(a.error))}:i.on("error",o=>{r(this.emitError(o))}),i.onopen=()=>{this.onOpen(i),n(i)}})}onOpen(t){t.onmessage=n=>this.onPayload(n),t.onclose=n=>this.onClose(n),this.socket=t,this.registering=!1,this.events.emit("open")}onClose(t){this.socket=void 0,this.registering=!1,this.events.emit("close",t)}onPayload(t){if(typeof t.data>"u")return;const n=typeof t.data=="string"?ul(t.data):t.data;this.events.emit("payload",n)}onError(t,n){const r=this.parseError(n),s=r.message||r.toString(),i=yf(t,s);this.events.emit("payload",i)}parseError(t,n=this.url){return Ude(t,kJ(n),"WS")}resetMaxListeners(){this.events.getMaxListeners()>RJ&&this.events.setMaxListeners(RJ)}emitError(t){const n=this.parseError(new Error((t==null?void 0:t.message)||`WebSocket connection failed for host: ${kJ(this.url)}`));return this.events.emit("register_error",n),n}};var SRe={};const Fde="wc",zde=2,oL="core",nf=`${Fde}@2:${oL}:`,ARe={logger:"error"},_Re={database:":memory:"},NRe="crypto",BJ="client_ed25519_seed",TRe=V.ONE_DAY,PRe="keychain",ORe="0.3",kRe="messages",RRe="0.3",DJ=V.SIX_HOURS,BRe="publisher",qde="irn",DRe="error",Wde="wss://relay.walletconnect.org",URe="relayer",Ei={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},LRe="_subscription",Ol={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},MRe=.1,aL="2.21.5",Dr={link_mode:"link_mode",relay:"relay"},wS={inbound:"inbound",outbound:"outbound"},jRe="0.3",FRe="WALLETCONNECT_CLIENT_ID",UJ="WALLETCONNECT_LINK_MODE_APPS",Wc={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},zRe="subscription",qRe="0.3",WRe="pairing",HRe="0.3",O3={wc_pairingDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:V.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:V.ONE_DAY,prompt:!1,tag:0},res:{ttl:V.ONE_DAY,prompt:!1,tag:0}}},Y1={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ku={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},VRe="history",KRe="0.3",GRe="expirer",Xl={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ZRe="0.3",YRe="verify-api",JRe="https://verify.walletconnect.com",Hde="https://verify.walletconnect.org",r8=Hde,XRe=`${r8}/v3`,QRe=[JRe,Hde],eBe="echo",tBe="https://echo.walletconnect.com",Sh={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},lp={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Gu={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},A1={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},_1={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},k3={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},nBe=.1,rBe="event-client",sBe=86400,iBe="https://pulse.walletconnect.org/batch";function oBe(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),o=i.charCodeAt(0);if(n[o]!==255)throw new TypeError(i+" is ambiguous");n[o]=s}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var p=0,m=0,w=0,C=g.length;w!==C&&g[w]===0;)w++,p++;for(var E=(C-w)*u+1>>>0,b=new Uint8Array(E);w!==C;){for(var S=g[w],v=0,x=E-1;(S!==0||v<m)&&x!==-1;x--,v++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");m=v,w++}for(var A=E-m;A!==E&&b[A]===0;)A++;for(var I=c.repeat(p);A<E;++A)I+=e.charAt(b[A]);return I}function h(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var p=0;if(g[p]!==" "){for(var m=0,w=0;g[p]===c;)m++,p++;for(var C=(g.length-p)*l+1>>>0,E=new Uint8Array(C);g[p];){var b=n[g.charCodeAt(p)];if(b===255)return;for(var S=0,v=C-1;(b!==0||S<w)&&v!==-1;v--,S++)b+=a*E[v]>>>0,E[v]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");w=S,p++}if(g[p]!==" "){for(var x=C-w;x!==C&&E[x]===0;)x++;for(var A=new Uint8Array(m+(C-x)),I=m;x!==C;)A[I++]=E[x++];return A}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var aBe=oBe,cBe=aBe;const Vde=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},lBe=e=>new TextEncoder().encode(e),uBe=e=>new TextDecoder().decode(e);let dBe=class{constructor(t,n,r){this.name=t,this.prefix=n,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},hBe=class{constructor(t,n,r){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Kde(this,t)}},fBe=class{constructor(t){this.decoders=t}or(t){return Kde(this,t)}decode(t){const n=t[0],r=this.decoders[n];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Kde=(e,t)=>new fBe({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let pBe=class{constructor(t,n,r,s){this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new dBe(t,n,r),this.decoder=new hBe(t,n,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};const a7=({name:e,prefix:t,encode:n,decode:r})=>new pBe(e,t,n,r),_C=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:s}=cBe(n,t);return a7({prefix:e,name:t,encode:r,decode:i=>Vde(s(i))})},gBe=(e,t,n,r)=>{const s={};for(let u=0;u<t.length;++u)s[t[u]]=u;let i=e.length;for(;e[i-1]==="=";)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,l=0;for(let u=0;u<i;++u){const d=s[e[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<n|d,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},mBe=(e,t,n)=>{const r=t[t.length-1]==="=",s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>n;)o-=n,i+=t[s&a>>o];if(o&&(i+=t[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i},to=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>a7({prefix:t,name:e,encode(s){return mBe(s,r,n)},decode(s){return gBe(s,r,n,e)}}),wBe=a7({prefix:"\0",name:"identity",encode:e=>uBe(e),decode:e=>lBe(e)});var yBe=Object.freeze({__proto__:null,identity:wBe});const bBe=to({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var vBe=Object.freeze({__proto__:null,base2:bBe});const EBe=to({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var CBe=Object.freeze({__proto__:null,base8:EBe});const $Be=_C({prefix:"9",name:"base10",alphabet:"0123456789"});var xBe=Object.freeze({__proto__:null,base10:$Be});const IBe=to({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),SBe=to({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ABe=Object.freeze({__proto__:null,base16:IBe,base16upper:SBe});const _Be=to({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),NBe=to({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),TBe=to({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),PBe=to({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),OBe=to({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kBe=to({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),RBe=to({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),BBe=to({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),DBe=to({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var UBe=Object.freeze({__proto__:null,base32:_Be,base32upper:NBe,base32pad:TBe,base32padupper:PBe,base32hex:OBe,base32hexupper:kBe,base32hexpad:RBe,base32hexpadupper:BBe,base32z:DBe});const LBe=_C({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),MBe=_C({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jBe=Object.freeze({__proto__:null,base36:LBe,base36upper:MBe});const FBe=_C({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zBe=_C({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var qBe=Object.freeze({__proto__:null,base58btc:FBe,base58flickr:zBe});const WBe=to({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
14+/",bitsPerChar:6}),HBe=to({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),VBe=to({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),KBe=to({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var GBe=Object.freeze({__proto__:null,base64:WBe,base64pad:HBe,base64url:VBe,base64urlpad:KBe});const Gde=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),ZBe=Gde.reduce((e,t,n)=>(e[n]=t,e),[]),YBe=Gde.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function JBe(e){return e.reduce((t,n)=>(t+=ZBe[n],t),"")}function XBe(e){const t=[];for(const n of e){const r=YBe[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);t.push(r)}return new Uint8Array(t)}const QBe=a7({prefix:"ð",name:"base256emoji",encode:JBe,decode:XBe});var eDe=Object.freeze({__proto__:null,base256emoji:QBe}),tDe=Zde,LJ=128,nDe=-128,rDe=Math.pow(2,31);function Zde(e,t,n){t=t||[],n=n||0;for(var r=n;e>=rDe;)t[n++]=e&255|LJ,e/=128;for(;e&nDe;)t[n++]=e&255|LJ,e>>>=7;return t[n]=e|0,Zde.bytes=n-r+1,t}var sDe=cL,iDe=128,MJ=127;function cL(e,r){var n=0,r=r||0,s=0,i=r,o,a=e.length;do{if(i>=a)throw cL.bytes=0,new RangeError("Could not decode varint");o=e[i++],n+=s<28?(o&MJ)<<s:(o&MJ)*Math.pow(2,s),s+=7}while(o>=iDe);return cL.bytes=i-r,n}var oDe=Math.pow(2,7),aDe=Math.pow(2,14),cDe=Math.pow(2,21),lDe=Math.pow(2,28),uDe=Math.pow(2,35),dDe=Math.pow(2,42),hDe=Math.pow(2,49),fDe=Math.pow(2,56),pDe=Math.pow(2,63),gDe=function(e){return e<oDe?1:e<aDe?2:e<cDe?3:e<lDe?4:e<uDe?5:e<dDe?6:e<hDe?7:e<fDe?8:e<pDe?9:10},mDe={encode:tDe,decode:sDe,encodingLength:gDe},Yde=mDe;const jJ=(e,t,n=0)=>(Yde.encode(e,t,n),t),FJ=e=>Yde.encodingLength(e),lL=(e,t)=>{const n=t.byteLength,r=FJ(e),s=r+FJ(n),i=new Uint8Array(s+n);return jJ(e,i,0),jJ(n,i,r),i.set(t,s),new wDe(e,n,t,i)};let wDe=class{constructor(t,n,r,s){this.code=t,this.size=n,this.digest=r,this.bytes=s}};const Jde=({name:e,code:t,encode:n})=>new yDe(e,t,n);let yDe=class{constructor(t,n,r){this.name=t,this.code=n,this.encode=r}digest(t){if(t instanceof Uint8Array){const n=this.encode(t);return n instanceof Uint8Array?lL(this.code,n):n.then(r=>lL(this.code,r))}else throw Error("Unknown type, must be binary type")}};const Xde=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),bDe=Jde({name:"sha2-256",code:18,encode:Xde("SHA-256")}),vDe=Jde({name:"sha2-512",code:19,encode:Xde("SHA-512")});var EDe=Object.freeze({__proto__:null,sha256:bDe,sha512:vDe});const Qde=0,CDe="identity",ehe=Vde,$De=e=>lL(Qde,ehe(e)),xDe={code:Qde,name:CDe,encode:ehe,digest:$De};var IDe=Object.freeze({__proto__:null,identity:xDe});new TextEncoder,new TextDecoder;const zJ={...yBe,...vBe,...CBe,...xBe,...ABe,...UBe,...jBe,...qBe,...GBe,...eDe};({...EDe,...IDe});function the(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function SDe(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?the(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function nhe(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const qJ=nhe("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),UO=nhe("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=SDe(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),ADe={utf8:qJ,"utf-8":qJ,hex:zJ.base16,latin1:UO,ascii:UO,binary:UO,...zJ};function _De(e,t="utf8"){const n=ADe[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?the(globalThis.Buffer.from(e,"utf-8")):n.decoder.decode(`${n.prefix}${e}`)}var NDe=Object.defineProperty,TDe=(e,t,n)=>t in e?NDe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fh=(e,t,n)=>TDe(e,typeof t!="symbol"?t+"":t,n);let PDe=class{constructor(t,n){this.core=t,this.logger=n,fh(this,"keychain",new Map),fh(this,"name",PRe),fh(this,"version",ORe),fh(this,"initialized",!1),fh(this,"storagePrefix",nf),fh(this,"init",async()=>
vendor: 7,740 bytes, line 14
14{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),fh(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),fh(this,"set",async(r,s)=>{this.isInitialized(),this.keychain.set(r,s),await this.persist()}),fh(this,"get",r=>{this.isInitialized();const s=this.keychain.get(r);if(typeof s>"u"){const{message:i}=We("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(i)}return s}),fh(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=Ec(n,this.name)}get context(){return Il(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,qU(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?WU(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}};var ODe=Object.defineProperty,kDe=(e,t,n)=>t in e?ODe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ri=(e,t,n)=>kDe(e,typeof t!="symbol"?t+"":t,n);let RDe=class{constructor(t,n,r){this.core=t,this.logger=n,Ri(this,"name",NRe),Ri(this,"keychain"),Ri(this,"randomSessionIdentifier",eL()),Ri(this,"initialized",!1),Ri(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Ri(this,"hasKeys",s=>(this.isInitialized(),this.keychain.has(s))),Ri(this,"getClientId",async()=>{this.isInitialized();const s=await this.getClientSeed(),i=jm(s);return bC(i.publicKey)}),Ri(this,"generateKeyPair",()=>{this.isInitialized();const s=pPe();return this.setPrivateKey(s.publicKey,s.privateKey)}),Ri(this,"signJWT",async s=>{this.isInitialized();const i=await this.getClientSeed(),o=jm(i),a=this.randomSessionIdentifier;return await KN(a,s,TRe,o)}),Ri(this,"generateSharedKey",(s,i,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=gPe(a,i);return this.setSymKey(c,o)}),Ri(this,"setSymKey",async(s,i)=>{this.isInitialized();const o=i||pS(s);return await this.keychain.set(o,s),o}),Ri(this,"deleteKeyPair",async s=>{this.isInitialized(),await this.keychain.del(s)}),Ri(this,"deleteSymKey",async s=>{this.isInitialized(),await this.keychain.del(s)}),Ri(this,"encode",async(s,i,o)=>{this.isInitialized();const a=_de(o),c=Ao(i);if(sJ(a))return yPe(c,o==null?void 0:o.encoding);if(rJ(a)){const h=a.senderPublicKey,f=a.receiverPublicKey;s=await this.generateSharedKey(h,f)}const l=this.getSymKey(s),{type:u,senderPublicKey:d}=a;return mPe({type:u,symKey:l,message:c,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),Ri(this,"decode",async(s,i,o)=>{this.isInitialized();const a=vPe(i,o);if(sJ(a)){const c=bPe(i,o==null?void 0:o.encoding);return ul(c)}if(rJ(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(s),l=wPe({symKey:c,encoded:i,encoding:o==null?void 0:o.encoding});return ul(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),Ri(this,"getPayloadType",(s,i=Cd)=>{const o=U8({encoded:s,encoding:i});return Ww(o.type)}),Ri(this,"getPayloadSenderPublicKey",(s,i=Cd)=>{const o=U8({encoded:s,encoding:i});return o.senderPublicKey?rn(o.senderPublicKey,Xo):void 0}),this.core=t,this.logger=Ec(n,this.name),this.keychain=r||new PDe(this.core,this.logger)}get context(){return Il(this.logger)}async setPrivateKey(t,n){return await this.keychain.set(t,n),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(BJ)}catch{t=eL(),await this.keychain.set(BJ,t)}return _De(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}};var BDe=Object.defineProperty,DDe=Object.defineProperties,UDe=Object.getOwnPropertyDescriptors,WJ=Object.getOwnPropertySymbols,LDe=Object.prototype.hasOwnProperty,MDe=Object.prototype.propertyIsEnumerable,uL=(e,t,n)=>t in e?BDe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jDe=(e,t)=>{for(var n in t||(t={}))LDe.call(t,n)&&uL(e,n,t[n]);if(WJ)for(var n of WJ(t))MDe.call(t,n)&&uL(e,n,t[n]);return e},FDe=(e,t)=>DDe(e,UDe(t)),Rc=(e,t,n)=>uL(e,typeof t!="symbol"?t+"":t,n);let zDe=class extends _ke{constructor(t,n){super(t,n),this.logger=t,this.core=n,Rc(this,"messages",new Map),Rc(this,"messagesWithoutClientAck",new Map),Rc(this,"name",kRe),Rc(this,"version",RRe),Rc(this,"initialized",!1),Rc(this,"storagePrefix",nf),Rc(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Rc(this,"set",async(r,s,i)=>{this.isInitialized();const o=Oh(s);let a=this.messages.get(r);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(r,a),i===wS.inbound){const c=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,FDe(jDe({},c),{[o]:s}))}return await this.persist(),o}),Rc(this,"get",r=>{this.isInitialized();let s=this.messages.get(r);return typeof s>"u"&&(s={}),s}),Rc(this,"getWithoutAck",r=>{this.isInitialized();const s={};for(const i of r){const o=this.messagesWithoutClientAck.get(i)||{};s[i]=Object.values(o)}return s}),Rc(this,"has",(r,s)=>{this.isInitialized();const i=this.get(r),o=Oh(s);return typeof i[o]<"u"}),Rc(this,"ack",async(r,s)=>{this.isInitialized();const i=this.messagesWithoutClientAck.get(r);if(typeof i>"u")return;const o=Oh(s);delete i[o],Object.keys(i).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,i),await this.persist()}),Rc(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=Ec(t,this.name),this.core=n}get context(){return Il(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,qU(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,qU(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?WU(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?WU(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}};var qDe=Object.defineProperty,WDe=Object.defineProperties,HDe=Object.getOwnPropertyDescriptors,HJ=Object.getOwnPropertySymbols,VDe=Object.prototype.hasOwnProperty,KDe=Object.prototype.propertyIsEnumerable,dL=(e,t,n)=>t in e?qDe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kx=(e,t)=>{for(var n in t||(t={}))VDe.call(t,n)&&dL(e,n,t[n]);if(HJ)for(var n of HJ(t))KDe.call(t,n)&&dL(e,n,t[n]);return e},LO=(e,t)=>
14WDe(e,HDe(t)),Zu=(e,t,n)=>dL(e,typeof t!="symbol"?t+"":t,n);let GDe=class extends Nke{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,Zu(this,"events",new Dn.EventEmitter),Zu(this,"name",BRe),Zu(this,"queue",new Map),Zu(this,"publishTimeout",V.toMiliseconds(V.ONE_MINUTE)),Zu(this,"initialPublishTimeout",V.toMiliseconds(V.ONE_SECOND*15)),Zu(this,"needsTransportRestart",!1),Zu(this,"publish",async(r,s,i)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:s,opts:i}});const a=(i==null?void 0:i.ttl)||DJ,c=n9(i),l=(i==null?void 0:i.prompt)||!1,u=(i==null?void 0:i.tag)||0,d=(i==null?void 0:i.id)||Ir().toString(),h={topic:r,message:s,opts:{ttl:a,relay:c,prompt:l,tag:u,id:d,attestation:i==null?void 0:i.attestation,tvf:i==null?void 0:i.tvf}},f=`Failed to publish payload, please try again. id:${d} tag:${u}`;try{const g=new Promise(async p=>{const m=({id:C})=>{h.opts.id===C&&(this.removeRequestFromQueue(C),this.relayer.events.removeListener(Ei.publish,m),p(h))};this.relayer.events.on(Ei.publish,m);const w=om(new Promise((C,E)=>{this.rpcPublish({topic:r,message:s,ttl:a,prompt:l,tag:u,id:d,attestation:i==null?void 0:i.attestation,tvf:i==null?void 0:i.tvf}).then(C).catch(b=>{this.logger.warn(b,b==null?void 0:b.message),E(b)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${d} tag:${u}`);try{await w,this.events.removeListener(Ei.publish,m)}catch(C){this.queue.set(d,LO(kx({},h),{attempt:1})),this.logger.warn(C,C==null?void 0:C.message)}});this.logger.trace({type:"method",method:"publish",params:{id:d,topic:r,message:s,opts:i}}),await om(g,this.publishTimeout,f)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(o=i==null?void 0:i.internal)!=null&&o.throwOnFailedPublish)throw g}finally{this.queue.delete(d)}}),Zu(this,"on",(r,s)=>{this.events.on(r,s)}),Zu(this,"once",(r,s)=>{this.events.once(r,s)}),Zu(this,"off",(r,s)=>{this.events.off(r,s)}),Zu(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.relayer=t,this.logger=Ec(n,this.name),this.registerEventListeners()}get context(){return Il(this.logger)}async rpcPublish(t){var n,r,s,i;const{topic:o,message:a,ttl:c=DJ,prompt:l,tag:u,id:d,attestation:h,tvf:f}=t,g={method:xE(n9().protocol).publish,params:kx({topic:o,message:a,ttl:c,prompt:l,tag:u,attestation:h},f),id:d};Ki((n=g.params)==null?void 0:n.prompt)&&((r=g.params)==null||delete r.prompt),Ki((s=g.params)==null?void 0:s.tag)&&((i=g.params)==null||delete i.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g});const p=await this.relayer.request(g);return this.relayer.events.emit(Ei.publish,t),this.logger.debug("Successfully Published Payload"),p}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,n)=>{const r=t.attempt+1;this.queue.set(n,LO(kx({},t),{attempt:r}));const{topic:s,message:i,opts:o,attestation:a}=t;this.logger.warn({},`Publisher: queue->publishing: ${t.opts.id}, tag: ${t.opts.tag}, attempt: ${r}`),await this.rpcPublish(LO(kx({},t),{topic:s,message:i,ttl:o.ttl,prompt:o.prompt,tag:o.tag,id:o.id,attestation:a,tvf:o.tvf})),this.logger.warn({},`Publisher: queue->published: ${t.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Hr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Ei.connection_stalled);return}this.checkQueue()}),this.relayer.on(Ei.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}};var ZDe=Object.defineProperty,YDe=(e,t,n)=>t in e?ZDe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vb=(e,t,n)=>YDe(e,typeof t!="symbol"?t+"":t,n);let JDe=class{constructor(){Vb(this,"map",new Map),Vb(this,"set",(t,n)=>{const r=this.get(t);this.exists(t,n)||this.map.set(t,[...r,n])}),Vb(this,"get",t=>this.map.get(t)||[]),Vb(this,"exists",(t,n)=>this.get(t).includes(n)),Vb(this,"delete",(t,n)=>{if(typeof n>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,n))return;const s=r.filter(i=>i!==n);if(!s.length){this.map.delete(t);return}this.map.set(t,s)}),Vb(this,"clear",()=>{this.map.clear()})}
vendor: 38,925 bytes, line 14
14get topics(){return Array.from(this.map.keys())}};var XDe=Object.defineProperty,QDe=Object.defineProperties,eUe=Object.getOwnPropertyDescriptors,VJ=Object.getOwnPropertySymbols,tUe=Object.prototype.hasOwnProperty,nUe=Object.prototype.propertyIsEnumerable,hL=(e,t,n)=>t in e?XDe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R3=(e,t)=>{for(var n in t||(t={}))tUe.call(t,n)&&hL(e,n,t[n]);if(VJ)for(var n of VJ(t))nUe.call(t,n)&&hL(e,n,t[n]);return e},MO=(e,t)=>QDe(e,eUe(t)),br=(e,t,n)=>hL(e,typeof t!="symbol"?t+"":t,n);let rUe=class extends Oke{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,br(this,"subscriptions",new Map),br(this,"topicMap",new JDe),br(this,"events",new Dn.EventEmitter),br(this,"name",zRe),br(this,"version",qRe),br(this,"pending",new Map),br(this,"cached",[]),br(this,"initialized",!1),br(this,"storagePrefix",nf),br(this,"subscribeTimeout",V.toMiliseconds(V.ONE_MINUTE)),br(this,"initialSubscribeTimeout",V.toMiliseconds(V.ONE_SECOND*15)),br(this,"clientId"),br(this,"batchSubscribeTopicsLimit",500),br(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),br(this,"subscribe",async(r,s)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}});try{const i=n9(s),o={topic:r,relay:i,transportType:s==null?void 0:s.transportType};this.pending.set(r,o);const a=await this.rpcSubscribe(r,i,s);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}})),a}catch(i){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(i),i}}),br(this,"unsubscribe",async(r,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(r,s.id,s):await this.unsubscribeByTopic(r,s)}),br(this,"isSubscribed",r=>new Promise(s=>{s(this.topicMap.topics.includes(r))})),br(this,"isKnownTopic",r=>new Promise(s=>{s(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(i=>i.topic===r))})),br(this,"on",(r,s)=>{this.events.on(r,s)}),br(this,"once",(r,s)=>{this.events.once(r,s)}),br(this,"off",(r,s)=>{this.events.off(r,s)}),br(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),br(this,"start",async()=>{await this.onConnect()}),br(this,"stop",async()=>{await this.onDisconnect()}),br(this,"restart",async()=>{await this.restore(),await this.onRestart()}),br(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(s=>{r.push(s)}),await this.batchSubscribe(r)}),br(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Hr.pulse,async()=>{await this.checkPending()}),this.events.on(Wc.created,async r=>{const s=Wc.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()}),this.events.on(Wc.deleted,async r=>{const s=Wc.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()})}),this.relayer=t,this.logger=Ec(n,this.name),this.clientId=""}get context(){return Il(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}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,n){let r=!1;try{r=this.getSubscription(t).topic===n}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,n){const r=this.topicMap.get(t);await Promise.all(r.map(async s=>await this.unsubscribeById(t,s,n)))}async unsubscribeById(t,n,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}});try{const s=n9(r);await this.restartToComplete({topic:t,id:n,relay:s}),await this.rpcUnsubscribe(t,n,s);const i=jr("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,n,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(t,n,r){var s;(!r||(r==null?void 0:r.transportType)===Dr.relay)&&await this.restartToComplete({topic:t,id:t,relay:n});const i={method:xE(n.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});const o=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{const a=await this.getSubscriptionId(t);if((r==null?void 0:r.transportType)===Dr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch(u=>this.logger.warn(u))},V.toMiliseconds(V.ONE_SECOND)),a;const c=new Promise(async u=>{const d=h=>{h.topic===t&&(this.events.removeListener(Wc.created,d),u(h.id))};this.events.on(Wc.created,d);try{const h=await om(new Promise((f,g)=>{this.relayer.request(i).catch(p=>{this.logger.warn(p,p==null?void 0:p.message),g(p)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(Wc.created,d),u(h)}catch{}}),l=await om(c,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!l&&o)throw new Error(`Subscribing to ${t} failed, please try again`);return l?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Ei.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(t){if(!t.length)return;const n=t[0].relay,r={method:xE(n.protocol).batchSubscribe,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await om(new Promise(s=>{this.relayer.request(r).catch(i=>this.logger.warn(i)).then(s)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(Ei.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const n=t[0].relay,r={method:xE(n.protocol).batchFetchMessages,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let s;try{s=await await om(new Promise((i,o)=>{this.relayer.request(r).catch(a=>{this.logger.warn(a),o(a)}).then(i)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(Ei.connection_stalled)}return s}rpcUnsubscribe(t,n,r){const s={method:xE(r.protocol).unsubscribe,params:{topic:t,id:n}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(t,n){this.setSubscription(t,MO(R3({},n),{id:t})),this.pending.delete(n.topic)}onBatchSubscribe(t){t.length&&t.forEach(n=>{this.setSubscription(n.id,R3({},n)),this.pending.delete(n.topic)})}async onUnsubscribe(t,n,r){this.events.removeAllListeners(n),this.hasSubscription(n,t)&&this.deleteSubscription(n,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,n){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:n}),this.addSubscription(t,n)}addSubscription(t,n){this.subscriptions.set(t,R3({},n)),this.topicMap.set(n.topic,t),this.events.emit(Wc.created,n)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const n=this.subscriptions.get(t);if(!n){const{message:r}=We("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}deleteSubscription(t,n){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:n});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(Wc.deleted,MO(R3({},r),{reason:n}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Wc.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],n=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<n;r++){const s=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(Wc.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size){const{message:n}=We("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async n=>MO(R3({},n),{id:await this.getSubscriptionId(n.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const n=await this.rpcBatchFetchMessages(t);n&&n.messages&&(await DNe(V.toMiliseconds(V.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(n.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Oh(t+await this.getClientId())}};var sUe=Object.defineProperty,KJ=Object.getOwnPropertySymbols,iUe=Object.prototype.hasOwnProperty,oUe=Object.prototype.propertyIsEnumerable,fL=(e,t,n)=>t in e?sUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,GJ=(e,t)=>{for(var n in t||(t={}))iUe.call(t,n)&&fL(e,n,t[n]);if(KJ)for(var n of KJ(t))oUe.call(t,n)&&fL(e,n,t[n]);return e},Fn=(e,t,n)=>fL(e,typeof t!="symbol"?t+"":t,n);let aUe=class extends Tke{constructor(t){super(t),Fn(this,"protocol","wc"),Fn(this,"version",2),Fn(this,"core"),Fn(this,"logger"),Fn(this,"events",new Dn.EventEmitter),Fn(this,"provider"),Fn(this,"messages"),Fn(this,"subscriber"),Fn(this,"publisher"),Fn(this,"name",URe),Fn(this,"transportExplicitlyClosed",!1),Fn(this,"initialized",!1),Fn(this,"connectionAttemptInProgress",!1),Fn(this,"relayUrl"),Fn(this,"projectId"),Fn(this,"packageName"),Fn(this,"bundleId"),Fn(this,"hasExperiencedNetworkDisruption",!1),Fn(this,"pingTimeout"),Fn(this,"heartBeatTimeout",V.toMiliseconds(V.THIRTY_SECONDS+V.FIVE_SECONDS)),Fn(this,"reconnectTimeout"),Fn(this,"connectPromise"),Fn(this,"reconnectInProgress",!1),Fn(this,"requestsInFlight",[]),Fn(this,"connectTimeout",V.toMiliseconds(V.ONE_SECOND*15)),Fn(this,"request",async n=>{var r,s;this.logger.debug("Publishing Request Payload");const i=n.id||Ir().toString();await this.toEstablishConnection();try{this.logger.trace({id:i,method:n.method,topic:(r=n.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${i}:${((s=n.params)==null?void 0:s.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(n);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${i}`),o}}),Fn(this,"resetPingTimeout",()=>{XS()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var n,r,s,i;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(i=(s=(r=(n=this.provider)==null?void 0:n.connection)==null?void 0:r.socket)==null?void 0:s.terminate)==null||i.call(s)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Fn(this,"onPayloadHandler",n=>{this.onProviderPayload(n),this.resetPingTimeout()}),Fn(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected ð"),this.startPingTimeout(),this.events.emit(Ei.connect)}),Fn(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected ð"),this.requestsInFlight=[],this.onProviderDisconnect()}),Fn(this,"onProviderErrorHandler",n=>{this.logger.fatal(`Fatal socket error: ${n.message}`),this.events.emit(Ei.error,n),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Fn(this,"registerProviderListeners",()=>{this.provider.on(Ol.payload,this.onPayloadHandler),this.provider.on(Ol.connect,this.onConnectHandler),this.provider.on(Ol.disconnect,this.onDisconnectHandler),this.provider.on(Ol.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ec(t.logger,this.name):Kq(Rde({level:t.logger||DRe})),this.messages=new zDe(this.logger,t.core),this.subscriber=new rUe(this,this.logger),this.publisher=new GDe(this,this.logger),this.relayUrl=(t==null?void 0:t.relayUrl)||Wde,this.projectId=t.projectId,vNe()?this.packageName=IY():ENe()&&(this.bundleId=IY()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Il(this.logger)}get connected(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,n,r){this.isInitialized(),await this.publisher.publish(t,n,r),await this.recordMessageEvent({topic:t,message:n,publishedAt:Date.now(),transportType:Dr.relay},wS.outbound)}async subscribe(t,n){var r,s,i;this.isInitialized(),(!(n!=null&&n.transportType)||(n==null?void 0:n.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=n==null?void 0:n.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;let a=((i=this.subscriber.topicMap.get(t))==null?void 0:i[0])||"",c;const l=u=>{u.topic===t&&(this.subscriber.off(Wc.created,l),c())};return await Promise.all([new Promise(u=>{c=u,this.subscriber.on(Wc.created,l)}),new Promise(async(u,d)=>{a=await this.subscriber.subscribe(t,GJ({internal:{throwOnFailedPublish:o}},n)).catch(h=>{o&&d(h)})||a,u()})]),a}async unsubscribe(t,n){this.isInitialized(),await this.subscriber.unsubscribe(t,n)}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await om(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(n,r)=>{await this.connect(t).then(n).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await gJ())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const n=t.sort((r,s)=>r.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${n.length} message events sorted`);for(const r of n)try{await this.onMessageEvent(r)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${n.length} message events processed`)}async onLinkMessageEvent(t,n){const{topic:r}=t;if(!n.sessionExists){const s=Ys(V.FIVE_MINUTES),i={topic:r,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,i)}this.events.emit(Ei.message,t),await this.recordMessageEvent(t,wS.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let n=1;for(;n<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${n}...`),await this.createProvider(),await new Promise(async(r,s)=>{const i=()=>{s(new Error("Connection interrupted while trying to connect"))};this.provider.once(Ol.disconnect,i),await om(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(Ol.disconnect,i),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ol.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(Ol.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const s=r;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${n}`);break}await new Promise(r=>setTimeout(r,V.toMiliseconds(n*1))),n++}}startPingTimeout(){var t,n,r,s,i;if(XS())try{(n=(t=this.provider)==null?void 0:t.connection)!=null&&n.socket&&((i=(s=(r=this.provider)==null?void 0:r.connection)==null?void 0:s.socket)==null||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new or(new o7(SNe({sdkVersion:aL,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,n){const{topic:r,message:s}=t;await this.messages.set(r,s,n)}async shouldIgnoreMessageEvent(t){const{topic:n,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(n))return this.logger.warn(`Ignoring message for unknown topic ${n}`),!0;const s=this.messages.has(n,r);return s&&this.logger.warn(`Ignoring duplicate message: ${r}`),s}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Du(t)){if(!t.method.endsWith(LRe))return;const n=t.params,{topic:r,message:s,publishedAt:i,attestation:o}=n.data,a={topic:r,message:s,publishedAt:i,transportType:Dr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(GJ({type:"event",event:n.id},a)),this.events.emit(n.id,a),await this.acknowledgePayload(t),await this.onMessageEvent(a)}else Sl(t)&&this.events.emit(Ei.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,wS.inbound),this.events.emit(Ei.message,t))}async acknowledgePayload(t){const n=Pi(t.id,!0);await this.provider.connection.send(n)}unregisterProviderListeners(){this.provider.off(Ol.payload,this.onPayloadHandler),this.provider.off(Ol.connect,this.onConnectHandler),this.provider.off(Ol.disconnect,this.onDisconnectHandler),this.provider.off(Ol.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await gJ();fOe(async n=>{t!==n&&(t=n,n?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Hr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&mOe())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(n){this.logger.warn(n,n==null?void 0:n.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(Ei.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},V.toMiliseconds(MRe)))))}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}};function cUe(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ZJ(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function YJ(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const lUe="[object RegExp]",uUe="[object String]",dUe="[object Number]",hUe="[object Boolean]",JJ="[object Arguments]",fUe="[object Symbol]",pUe="[object Date]",gUe="[object Map]",mUe="[object Set]",wUe="[object Array]",yUe="[object Function]",bUe="[object ArrayBuffer]",jO="[object Object]",vUe="[object Error]",EUe="[object DataView]",CUe="[object Uint8Array]",$Ue="[object Uint8ClampedArray]",xUe="[object Uint16Array]",IUe="[object Uint32Array]",SUe="[object BigUint64Array]",AUe="[object Int8Array]",_Ue="[object Int16Array]",NUe="[object Int32Array]",TUe="[object BigInt64Array]",PUe="[object Float32Array]",OUe="[object Float64Array]";function kUe(){}function XJ(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)==="[object Object]":!1}function RUe(e,t,n){return IE(e,t,void 0,void 0,void 0,void 0,n)}function IE(e,t,n,r,s,i,o){const a=o(e,t,n,r,s,i);if(a!==void 0)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return e===t;case"number":return e===t||Object.is(e,t);case"function":return e===t;case"object":return s8(e,t,i,o)}return s8(e,t,i,o)}function s8(e,t,n,r){if(Object.is(e,t))return!0;let s=YJ(e),i=YJ(t);if(s===JJ&&(s=jO),i===JJ&&(i=jO),s!==i)return!1;switch(s){case uUe:return e.toString()===t.toString();case dUe:{const c=e.valueOf(),l=t.valueOf();return cUe(c,l)}case hUe:case pUe:case fUe:return Object.is(e.valueOf(),t.valueOf());case lUe:return e.source===t.source&&e.flags===t.flags;case yUe:return e===t}n=n??new Map;const o=n.get(e),a=n.get(t);if(o!=null&&a!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(s){case gUe:{if(e.size!==t.size)return!1;for(const[c,l]of e.entries())if(!t.has(c)||!IE(l,t.get(c),c,e,t,n,r))return!1;return!0}case mUe:{if(e.size!==t.size)return!1;const c=Array.from(e.values()),l=Array.from(t.values());for(let u=0;u<c.length;u++){const d=c[u],h=l.findIndex(f=>IE(d,f,void 0,e,t,n,r));if(h===-1)return!1;l.splice(h,1)}return!0}case wUe:case CUe:case $Ue:case xUe:case IUe:case SUe:case AUe:case _Ue:case NUe:case TUe:case PUe:case OUe:{if(typeof Buffer<"u"&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let c=0;c<e.length;c++)if(!IE(e[c],t[c],c,e,t,n,r))return!1;return!0}case bUe:return e.byteLength!==t.byteLength?!1:s8(new Uint8Array(e),new Uint8Array(t),n,r);case EUe:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:s8(new Uint8Array(e),new Uint8Array(t),n,r);case vUe:return e.name===t.name&&e.message===t.message;case jO:{if(!(s8(e.constructor,t.constructor,n,r)||XJ(e)&&XJ(t)))return!1;const c=[...Object.keys(e),...ZJ(e)],l=[...Object.keys(t),...ZJ(t)];if(c.length!==l.length)return!1;for(let u=0;u<c.length;u++){const d=c[u],h=e[d];if(!Object.hasOwn(t,d))return!1;const f=t[d];if(!IE(h,f,d,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function BUe(e,t){return RUe(e,t,kUe)}var DUe=Object.defineProperty,QJ=Object.getOwnPropertySymbols,UUe=Object.prototype.hasOwnProperty,LUe=Object.prototype.propertyIsEnumerable,pL=(e,t,n)=>t in e?DUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eX=(e,t)=>{for(var n in t||(t={}))UUe.call(t,n)&&pL(e,n,t[n]);if(QJ)for(var n of QJ(t))LUe.call(t,n)&&pL(e,n,t[n]);return e},xa=(e,t,n)=>pL(e,typeof t!="symbol"?t+"":t,n);let rb=class extends Pke{constructor(t,n,r,s=nf,i=void 0){super(t,n,r,s),this.core=t,this.logger=n,this.name=r,xa(this,"map",new Map),xa(this,"version",jRe),xa(this,"cached",[]),xa(this,"initialized",!1),xa(this,"getKey"),xa(this,"storagePrefix",nf),xa(this,"recentlyDeleted",[]),xa(this,"recentlyDeletedLimit",200),xa(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Ki(o)?this.map.set(this.getKey(o),o):WPe(o)?this.map.set(o.id,o):HPe(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),xa(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),xa(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),xa(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>BUe(a[c],o[c]))):this.values)),xa(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=eX(eX({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),xa(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Ec(n,this.name),this.storagePrefix=s,this.getKey=i}get context(){return Il(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const n=this.map.get(t);if(!n){if(this.recentlyDeleted.includes(t)){const{message:s}=We("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}const{message:r}=We("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return n}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:n}=We("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}};var MUe=Object.defineProperty,jUe=(e,t,n)=>t in e?MUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,En=(e,t,n)=>jUe(e,typeof t!="symbol"?t+"":t,n);let FUe=class{constructor(t,n){this.core=t,this.logger=n,En(this,"name",WRe),En(this,"version",HRe),En(this,"events",new Bu),En(this,"pairings"),En(this,"initialized",!1),En(this,"storagePrefix",nf),En(this,"ignoredPayloadTypes",[Xp]),En(this,"registeredMethods",[]),En(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),En(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),En(this,"create",async r=>{this.isInitialized();const s=eL(),i=await this.core.crypto.setSymKey(s),o=Ys(V.FIVE_MINUTES),a={protocol:qde},c={topic:i,expiry:o,relay:a,active:!1,methods:r==null?void 0:r.methods},l=oJ({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:s,relay:a,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(Y1.create,c),this.core.expirer.set(i,o),await this.pairings.set(i,c),await this.core.relayer.subscribe(i,{transportType:r==null?void 0:r.transportType}),{topic:i,uri:l}}),En(this,"pair",async r=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[Sh.pairing_started]}});this.isValidPair(r,s);const{topic:i,symKey:o,relay:a,expiryTimestamp:c,methods:l}=iJ(r.uri);s.props.properties.topic=i,s.addTrace(Sh.pairing_uri_validation_success),s.addTrace(Sh.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(i)){if(u=this.pairings.get(i),s.addTrace(Sh.existing_pairing),u.active)throw s.setError(lp.active_pairing_already_exists),new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);s.addTrace(Sh.pairing_not_expired)}const d=c||Ys(V.FIVE_MINUTES),h={topic:i,relay:a,expiry:d,active:!1,methods:l};this.core.expirer.set(i,d),await this.pairings.set(i,h),s.addTrace(Sh.store_new_pairing),r.activatePairing&&await this.activate({topic:i}),this.events.emit(Y1.create,h),s.addTrace(Sh.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(o,i),s.addTrace(Sh.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(lp.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:a})}catch(f){throw s.setError(lp.subscribe_pairing_topic_failure),f}return s.addTrace(Sh.subscribe_pairing_topic_success),h}),En(this,"activate",async({topic:r})=>{this.isInitialized();const s=Ys(V.FIVE_MINUTES);this.core.expirer.set(r,s),await this.pairings.update(r,{active:!0,expiry:s})}),En(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=r;if(this.pairings.keys.includes(s)){const i=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=F1();this.events.once(rr("pairing_ping",i),({error:l})=>{l?c(l):a()}),await o()}}),En(this,"updateExpiry",async({topic:r,expiry:s})=>{this.isInitialized(),await this.pairings.update(r,{expiry:s})}),En(this,"updateMetadata",async({topic:r,metadata:s})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:s})}),En(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),En(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:s}=r;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",jr("USER_DISCONNECTED")),await this.deletePairing(s))}),En(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:s,relay:i,expiry:o,methods:a}=r,c=this.core.crypto.keychain.get(s);return oJ({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:i,expiryTimestamp:o,methods:a})}),En(this,"sendRequest",async(r,s,i)=>{const o=_n(s,i),a=await this.core.crypto.encode(r,o),c=O3[s].req;return this.core.history.set(r,o),this.core.relayer.publish(r,a,c),o.id}),En(this,"sendResult",async(r,s,i)=>{const o=Pi(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=O3[c].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),En(this,"sendError",async(r,s,i)=>{const o=yf(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=O3[c]?O3[c].res:O3.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),En(this,"deletePairing",async(r,s)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,jr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),s?Promise.resolve():this.core.expirer.del(r)])}),En(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(s=>Mg(s.expiry));await Promise.all(r.map(s=>this.deletePairing(s.topic)))}),En(this,"onRelayEventRequest",async r=>{const{topic:s,payload:i}=r;switch(i.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,i);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,i);default:return await this.onUnknownRpcMethodRequest(s,i)}}),En(this,"onRelayEventResponse",async r=>{const{topic:s,payload:i}=r,o=(await this.core.history.get(s,i.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,i);default:return this.onUnknownRpcMethodResponse(o)}}),En(this,"onPairingPingRequest",async(r,s)=>{const{id:i}=s;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.events.emit(Y1.ping,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}}),En(this,"onPairingPingResponse",(r,s)=>{const{id:i}=s;setTimeout(()=>{wn(s)?this.events.emit(rr("pairing_ping",i),{}):nn(s)&&this.events.emit(rr("pairing_ping",i),{error:s.error})},500)}),En(this,"onPairingDeleteRequest",async(r,s)=>{const{id:i}=s;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Y1.delete,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}}),En(this,"onUnknownRpcMethodRequest",async(r,s)=>{const{id:i,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=jr("WC_METHOD_UNSUPPORTED",o);await this.sendError(i,r,a),this.logger.error(a)}catch(a){await this.sendError(i,r,a),this.logger.error(a)}}),En(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(jr("WC_METHOD_UNSUPPORTED",r))}),En(this,"isValidPair",(r,s)=>{var i;if(!ja(r)){const{message:a}=We("MISSING_OR_INVALID",`pair() params: ${r}`);throw s.setError(lp.malformed_pairing_uri),new Error(a)}if(!qPe(r.uri)){const{message:a}=We("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw s.setError(lp.malformed_pairing_uri),new Error(a)}const o=iJ(r==null?void 0:r.uri);if(!((i=o==null?void 0:o.relay)!=null&&i.protocol)){const{message:a}=We("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(lp.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=We("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(lp.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&V.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){s.setError(lp.pairing_expired);const{message:a}=We("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),En(this,"isValidPing",async r=>{if(!ja(r)){const{message:i}=We("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)}),En(this,"isValidDisconnect",async r=>{if(!ja(r)){const{message:i}=We("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)}),En(this,"isValidPairingTopic",async r=>{if(!_s(r,!1)){const{message:s}=We("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(s)}if(!this.pairings.keys.includes(r)){const{message:s}=We("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(s)}if(Mg(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:s}=We("EXPIRED",`pairing topic: ${r}`);throw new Error(s)}}),this.core=t,this.logger=Ec(n,this.name),this.pairings=new rb(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Il(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(Ei.message,async t=>{const{topic:n,message:r,transportType:s}=t;if(this.pairings.keys.includes(n)&&s!==Dr.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const i=await this.core.crypto.decode(n,r);Du(i)?(this.core.history.set(n,i),await this.onRelayEventRequest({topic:n,payload:i})):Sl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:n,payload:i}),this.core.history.delete(n,i.id)),await this.core.relayer.messages.ack(n,r)}catch(i){this.logger.error(i)}})}registerExpirerEvents(){this.core.expirer.on(Xl.expired,async t=>{const{topic:n}=Lue(t.target);n&&this.pairings.keys.includes(n)&&(await this.deletePairing(n,!0),this.events.emit(Y1.expire,{topic:n}))})}};var zUe=Object.defineProperty,qUe=(e,t,n)=>t in e?zUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bi=(e,t,n)=>qUe(e,typeof t!="symbol"?t+"":t,n);let WUe=class extends Ake{constructor(t,n){super(t,n),this.core=t,this.logger=n,Bi(this,"records",new Map),Bi(this,"events",new Dn.EventEmitter),Bi(this,"name",VRe),Bi(this,"version",KRe),Bi(this,"cac
14hed",[]),Bi(this,"initialized",!1),Bi(this,"storagePrefix",nf),Bi(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Bi(this,"set",(r,s,i)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:s,chainId:i}),this.records.has(s.id))return;const o={id:s.id,topic:r,request:{method:s.method,params:s.params||null},chainId:i,expiry:Ys(V.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Ku.created,o)}),Bi(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const s=await this.getRecord(r.id);typeof s.response>"u"&&(s.response=nn(r)?{error:r.error}:{result:r.result},this.records.set(s.id,s),this.persist(),this.events.emit(Ku.updated,s))}),Bi(this,"get",async(r,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:s}),await this.getRecord(s))),Bi(this,"delete",(r,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(i=>{if(i.topic===r){if(typeof s<"u"&&i.id!==s)return;this.records.delete(i.id),this.events.emit(Ku.deleted,i)}}),this.persist()}),Bi(this,"exists",async(r,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===r:!1)),Bi(this,"on",(r,s)=>{this.events.on(r,s)}),Bi(this,"once",(r,s)=>{this.events.once(r,s)}),Bi(this,"off",(r,s)=>{this.events.off(r,s)}),Bi(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=Ec(n,this.name)}get context(){return Il(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(){const t=[];return this.values.forEach(n=>{if(typeof n.response<"u")return;const r={topic:n.topic,request:_n(n.request.method,n.request.params,n.id),chainId:n.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const n=this.records.get(t);if(!n){const{message:r}=We("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Ku.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:n}=We("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(Ku.created,t=>{const n=Ku.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(Ku.updated,t=>{const n=Ku.updated;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(Ku.deleted,t=>{const n=Ku.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.core.heartbeat.on(Hr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(n=>{V.toMiliseconds(n.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${n.id}`),this.records.delete(n.id),this.events.emit(Ku.deleted,n,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}};var HUe=Object.defineProperty,VUe=(e,t,n)=>t in e?HUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fo=(e,t,n)=>VUe(e,typeof t!="symbol"?t+"":t,n);let KUe=class extends kke{constructor(t,n){super(t,n),this.core=t,this.logger=n,fo(this,"expirations",new Map),fo(this,"events",new Dn.EventEmitter),fo(this,"name",GRe),fo(this,"version",ZRe),fo(this,"cac
14hed",[]),fo(this,"initialized",!1),fo(this,"storagePrefix",nf),fo(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),fo(this,"has",r=>{try{const s=this.formatTarget(r);return typeof this.getExpiration(s)<"u"}catch{return!1}}),fo(this,"set",(r,s)=>{this.isInitialized();const i=this.formatTarget(r),o={target:i,expiry:s};this.expirations.set(i,o),this.checkExpiry(i,o),this.events.emit(Xl.created,{target:i,expiration:o})}),fo(this,"get",r=>{this.isInitialized();const s=this.formatTarget(r);return this.getExpiration(s)}),fo(this,"del",r=>{if(this.isInitialized(),this.has(r)){const s=this.formatTarget(r),i=this.getExpiration(s);this.expirations.delete(s),this.events.emit(Xl.deleted,{target:s,expiration:i})}}),fo(this,"on",(r,s)=>{this.events.on(r,s)}),fo(this,"once",(r,s)=>{this.events.once(r,s)}),fo(this,"off",(r,s)=>{this.events.off(r,s)}),fo(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=Ec(n,this.name)}get context(){return Il(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(t){if(typeof t=="string")return ANe(t);if(typeof t=="number")return _Ne(t);const{message:n}=We("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(n)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Xl.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:n}=We("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const n=this.expirations.get(t);if(!n){const{message:r}=We("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return n}checkExpiry(t,n){const{expiry:r}=n;V.toMiliseconds(r)-Date.now()<=0&&this.expire(t,n)}expire(t,n){this.expirations.delete(t),this.events.emit(Xl.expired,{target:t,expiration:n})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,n)=>this.checkExpiry(n,t))}registerEventListeners(){this.core.heartbeat.on(Hr.pulse,()=>this.checkExpirations()),this.events.on(Xl.created,t=>{const n=Xl.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(Xl.expired,t=>{const n=Xl.expired;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(Xl.deleted,t=>{const n=Xl.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}};var GUe=Object.defineProperty,ZUe=(e,t,n)=>t in e?GUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$s=(e,t,n)=>ZUe(e,typeof t!="symbol"?t+"":t,n);let YUe=class extends Rke{constructor(t,n,r){super(t,n,r),this.core=t,this.logger=n,this.store=r,$s(this,"name",YRe),$s(this,"abortController"),$s(this,"isDevEnv"),$s(this,"verifyUrlV3",XRe),$s(this,"storagePrefix",nf),$s(this,"version",zde),$s(this,"publicKey"),$s(this,"fetchPromise"),$s(this,"init",async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&V.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),$s(this,"register",async s=>{if(!C6()||this.isDevEnv)return;const i=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${i}&id=${o}&decryptedId=${a}`;try{const l=cn.getDocument(),u=this.startAbortTimer(V.ONE_SECOND*5),d=await new Promise((h,f)=>{const g=()=>{window.removeEventListener("message",m),l.body.removeChild(p),f("attestation aborted")};this.abortController.signal.addEventListener("abort",g);const p=l.createElement("iframe");p.src=c,p.style.display="none",p.addEventListener("error",g,{signal:this.abortController.signal});const m=w=>
vendor: 8,799 bytes, line 14
14{if(w.data&&typeof w.data=="string")try{const C=JSON.parse(w.data);if(C.type==="verify_attestation"){if(wu(C.attestation).payload.id!==o)return;clearInterval(u),l.body.removeChild(p),this.abortController.signal.removeEventListener("abort",g),window.removeEventListener("message",m),h(C.attestation===null?"":C.attestation)}}catch(C){this.logger.warn(C)}};l.body.appendChild(p),window.addEventListener("message",m,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(l){this.logger.warn(l)}return""}),$s(this,"resolve",async s=>{if(this.isDevEnv)return"";const{attestationId:i,hash:o,encryptedId:a}=s;if(i===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(i){if(wu(i).payload.id!==a)return;const l=await this.isValidJwtAttestation(i);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)}),$s(this,"fetchAttestation",async(s,i)=>{this.logger.debug(`resolving attestation: ${s} from url: ${i}`);const o=this.startAbortTimer(V.ONE_SECOND*5),a=await fetch(`${i}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),$s(this,"getVerifyUrl",s=>{let i=s||r8;return QRe.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${r8}`),i=r8),i}),$s(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(V.FIVE_SECONDS),i=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await i.json()}catch(s){this.logger.warn(s)}}),$s(this,"persistPublicKey",async s=>{this.logger.debug("persisting public key to local storage",s),await this.store.setItem(this.storeKey,s),this.publicKey=s}),$s(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),$s(this,"isValidJwtAttestation",async s=>{const i=await this.getPublicKey();try{if(i)return this.validateAttestation(s,i)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),$s(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),$s(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async i=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),i(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s}),$s(this,"validateAttestation",(s,i)=>{const o=CPe(s,i.publicKey),a={hasExpired:V.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=Ec(n,this.name),this.abortController=new AbortController,this.isDevEnv=kq(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Il(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),V.toMiliseconds(t))}};var JUe=Object.defineProperty,XUe=(e,t,n)=>t in e?JUe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tX=(e,t,n)=>XUe(e,typeof t!="symbol"?t+"":t,n);let QUe=class extends Bke{constructor(t,n){super(t,n),this.projectId=t,this.logger=n,tX(this,"context",eBe),tX(this,"registerDeviceToken",async r=>{const{clientId:s,token:i,notificationType:o,enableEncrypted:a=!1}=r,c=`${tBe}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:i,always_raw:a})})}),this.logger=Ec(n,this.context)}};var eLe=Object.defineProperty,nX=Object.getOwnPropertySymbols,tLe=Object.prototype.hasOwnProperty,nLe=Object.prototype.propertyIsEnumerable,gL=(e,t,n)=>t in e?eLe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B3=(e,t)=>{for(var n in t||(t={}))tLe.call(t,n)&&gL(e,n,t[n]);if(nX)for(var n of nX(t))nLe.call(t,n)&&gL(e,n,t[n]);return e},ni=(e,t,n)=>gL(e,typeof t!="symbol"?t+"":t,n);let rLe=class extends Dke{constructor(t,n,r=!0){super(t,n,r),this.core=t,this.logger=n,ni(this,"context",rBe),ni(this,"storagePrefix",nf),ni(this,"storageVersion",nBe),ni(this,"events",new Map),ni(this,"shouldPersist",!1),ni(this,"init",async()=>{if(!kq())try{const s={eventId:AY(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Due(this.core.relayer.protocol,this.core.relayer.version,aL)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}}),ni(this,"createEvent",s=>{const{event:i="ERROR",type:o="",properties:{topic:a,trace:c}}=s,l=AY(),u=this.core.projectId||"",d=Date.now(),h=B3({eventId:l,timestamp:d,props:{event:i,type:o,properties:{topic:a,trace:c}},bundleId:u,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,h),this.shouldPersist=!0),h}),ni(this,"getEvent",s=>{const{eventId:i,topic:o}=s;if(i)return this.events.get(i);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return B3(B3({},a),this.setMethods(a.eventId))}),ni(this,"deleteEvent",s=>{const{eventId:i}=s;this.events.delete(i),this.shouldPersist=!0}),ni(this,"setEventListeners",()=>{this.core.heartbeat.on(Hr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{V.fromMiliseconds(Date.now())-V.fromMiliseconds(s.timestamp)>sBe&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})}),ni(this,"setMethods",s=>({addTrace:i=>this.addTrace(s,i),setError:i=>this.setError(s,i)})),ni(this,"addTrace",(s,i)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(i),this.events.set(s,o),this.shouldPersist=!0)}),ni(this,"setError",(s,i)=>{const o=this.events.get(s);o&&(o.props.type=i,o.timestamp=Date.now(),this.events.set(s,o),this.shouldPersist=!0)}),ni(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),ni(this,"restore",async()=>{try{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(i=>{this.events.set(i.eventId,B3(B3({},i),this.setMethods(i.eventId)))})}catch(s){this.logger.warn(s)}}),ni(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[i,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const i of s)this.events.delete(i.eventId),this.shouldPersist=!0}catch(i){this.logger.warn(i)}}),ni(this,"sendEvent",async s=>{const i=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${iBe}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${aL}${i}`,{method:"POST",body:JSON.stringify(s)})}),ni(this,"getAppDomain",()=>Bue().url),this.logger=Ec(n,this.context),this.telemetryEnabled=r,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 sLe=Object.defineProperty,rX=Object.getOwnPropertySymbols,iLe=Object.prototype.hasOwnProperty,oLe=Object.prototype.propertyIsEnumerable,mL=(e,t,n)=>t in e?sLe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sX=(e,t)=>{for(var n in t||(t={}))iLe.call(t,n)&&mL(e,n,t[n]);if(rX)for(var n of rX(t))oLe.call(t,n)&&mL(e,n,t[n]);return e},Ar=(e,t,n)=>mL(e,typeof t!="symbol"?t+"":t,n);let aLe=class rhe extends $ke{constructor(t){var n;super(t),Ar(this,"protocol",Fde),Ar(this,"version",zde),Ar(this,"name",oL),Ar(this,"relayUrl"),Ar(this,"projectId"),Ar(this,"customStoragePrefix"),Ar(this,"events",new Dn.EventEmitter),Ar(this,"logger"),Ar(this,"heartbeat"),Ar(this,"relayer"),Ar(this,"crypto"),Ar(this,"storage"),Ar(this,"history"),Ar(this,"expirer"),Ar(this,"pairing"),Ar(this,"verify"),Ar(this,"echoClient"),Ar(this,"linkModeSupportedApps"),Ar(this,"eventClient"),Ar(this,"initialized",!1),Ar(this,"logChunkController"),Ar(this,"on",(a,c)=>this.events.on(a,c)),Ar(this,"once",(a,c)=>this.events.once(a,c)),Ar(this,"off",(a,c)=>this.events.off(a,c)),Ar(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),Ar(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:l})=>
14{if(!a||!c)return;const u={topic:a,message:c,publishedAt:Date.now(),transportType:Dr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:l})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(a){console.warn("Failed to copy global core",a)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Wde,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const s=Rde({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:ARe.logger,name:oL}),{logger:i,chunkLoggerController:o}=vke({opts:s,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(n=this.logChunkController)!=null&&n.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Ec(i,this.name),this.heartbeat=new s7,this.crypto=new RDe(this,this.logger,t==null?void 0:t.keychain),this.history=new WUe(this,this.logger),this.expirer=new KUe(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new i7(sX(sX({},_Re),t==null?void 0:t.storageOptions)),this.relayer=new aUe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new FUe(this,this.logger),this.verify=new YUe(this,this.logger,this.storage),this.echoClient=new QUe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new rLe(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const n=new rhe(t);await n.initialize();const r=await n.crypto.getClientId();return await n.storage.setItem(FRe,r),n}get context(){return Il(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(UJ,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(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(UJ)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${t}`,r=`${n}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[n]}catch(n){console.warn("Failed to get global WalletConnect core",n);return}}setGlobalCore(t){var n;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((n=t.opts)==null?void 0:n.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&SRe.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const cLe=aLe;var FO,iX;function lLe(){if(iX)return FO;iX=1;const e=SC();FO=s;const t=S().console||{},n={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:p,wrapResponseSerializer:p,wrapErrorSerializer:p,req:g,res:g,err:h};function r(v,x){return Array.isArray(v)?v.filter(function(I){return I!=="!stdSerializers.err"}):v===!0?Object.keys(x):!1}function s(v){v=v||{},v.browser=v.browser||{};const x=v.browser.transmit;if(x&&typeof x.send!="function")throw Error("pino: transmit option must have a send function");const A=v.browser.write||t;v.browser.write&&(v.browser.asObject=!0);const I=v.serializers||{},O=r(v.browser.serialize,I);let N=v.browser.serialize;Array.isArray(v.browser.serialize)&&v.browser.serialize.indexOf("!stdSerializers.err")>-1&&(N=!1);const T=["error","fatal","warn","info","debug","trace"];typeof A=="function"&&(A.error=A.fatal=A.warn=A.info=A.debug=A.trace=A),v.enabled===!1&&(v.level="silent");const P=v.level||"info",_=Object.create(A);_.log||(_.log=m),Object.defineProperty(_,"levelVal",{get:$}),Object.defineProperty(_,"level",{get:R,set:B});const y={transmit:x,serialize:O,asObject:v.browser.asObject,levels:T,timestamp:f(v)};_.levels=s.levels,_.level=P,_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=m,_.serializers=I,_._serialize=O,_._stdErrSerialize=N,_.child=k,x&&(_._logEvent=d());
14function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function R(){return this._level}function B(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,i(y,_,"error","log"),i(y,_,"fatal","error"),i(y,_,"warn","error"),i(y,_,"info","log"),i(y,_,"debug","log"),i(y,_,"trace","log")}function k(D,U){if(!D)throw new Error("missing bindings for child Pino");U=U||{},O&&D.serializers&&(U.serializers=D.serializers);const F=U.serializers;if(O&&F){var K=Object.assign({},I,F),q=v.browser.serialize===!0?Object.keys(K):O;delete D.serializers,c([D],q,K,this._stdErrSerialize)}function H(Z){this._childLevel=(Z._childLevel|0)+1,this.error=l(Z,D,"error"),this.fatal=l(Z,D,"fatal"),this.warn=l(Z,D,"warn"),this.info=l(Z,D,"info"),this.debug=l(Z,D,"debug"),this.trace=l(Z,D,"trace"),K&&(this.serializers=K,this._serialize=q),x&&(this._logEvent=d([].concat(Z._logEvent.bindings,D)))}return H.prototype=this,new H(this)}return _}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers=n,s.stdTimeFunctions=Object.assign({},{nullTime:w,epochTime:C,unixTime:E,isoTime:b});function i(v,x,A,I){const O=Object.getPrototypeOf(x);x[A]=x.levelVal>x.levels.values[A]?m:O[A]?O[A]:t[A]||t[I]||m,o(v,x,A)}function o(v,x,A){!v.transmit&&x[A]===m||(x[A]=(function(I){return function(){const N=v.timestamp(),T=new Array(arguments.length),P=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var _=0;_<T.length;_++)T[_]=arguments[_];if(v.serialize&&!v.asObject&&c(T,this._serialize,this.serializers,this._stdErrSerialize),v.asObject?I.call(P,a(this,A,T,N)):I.apply(P,T),v.transmit){const y=v.transmit.level||x.level,$=s.levels.values[y],R=s.levels.values[A];if(R<$)return;u(this,{ts:N,methodLevel:A,methodValue:R,transmitValue:s.levels.values[v.transmit.level||x.level],send:v.transmit.send,val:x.levelVal},T)}}})(x[A]))}
14function a(v,x,A,I){v._serialize&&c(A,v._serialize,v.serializers,v._stdErrSerialize);const O=A.slice();let N=O[0];const T={};I&&(T.time=I),T.level=s.levels.values[x];let P=(v._childLevel|0)+1;if(P<1&&(P=1),N!==null&&typeof N=="object"){for(;P--&&typeof O[0]=="object";)Object.assign(T,O.shift());N=O.length?e(O.shift(),O):void 0}else typeof N=="string"&&(N=e(O.shift(),O));return N!==void 0&&(T.msg=N),T}function c(v,x,A,I){for(const O in v)if(I&&v[O]instanceof Error)v[O]=s.stdSerializers.err(v[O]);else if(typeof v[O]=="object"&&!Array.isArray(v[O]))for(const N in v[O])x&&x.indexOf(N)>-1&&N in A&&(v[O][N]=A[N](v[O][N]))}function l(v,x,A){return function(){const I=new Array(1+arguments.length);I[0]=x;for(var O=1;O<I.length;O++)I[O]=arguments[O-1];return v[A].apply(this,I)}}function u(v,x,A){const I=x.send,O=x.ts,N=x.methodLevel,T=x.methodValue,P=x.val,_=v._logEvent.bindings;c(A,v._serialize||Object.keys(v.serializers),v.serializers,v._stdErrSerialize===void 0?!0:v._stdErrSerialize),v._logEvent.ts=O,v._logEvent.messages=A.filter(function(y){return _.indexOf(y)===-1}),v._logEvent.level.label=N,v._logEvent.level.value=T,I(N,v._logEvent,P),v._logEvent=d(_)}function d(v){return{ts:0,messages:[],bindings:v||[],level:{label:"",value:0}}}function h(v){const x={type:v.constructor.name,msg:v.message,stack:v.stack};for(const A in v)x[A]===void 0&&(x[A]=v[A]);return x}function f(v){return typeof v.timestamp=="function"?v.timestamp:v.timestamp===!1?w:C}function g(){return{}}function p(v){return v}function m(){}function w(){return!1}function C(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function S(){function v(x){return typeof x<"u"&&x}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return v(self)||v(window)||v(this)||{}}}return FO}var uLe=lLe();const dLe=mf(uLe),hLe={level:"info"},NC="custom_context";var fLe=Object.defineProperty,pLe=Object.defineProperties,gLe=Object.getOwnPropertyDescriptors,oX=Object.getOwnPropertySymbols,mLe=Object.prototype.hasOwnProperty,wLe=Object.prototype.propertyIsEnumerable,aX=(e,t,n)=>t in e?fLe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yLe=(e,t)=>{for(var n in t||(t={}))mLe.call(t,n)&&aX(e,n,t[n]);if(oX)for(var n of oX(t))wLe.call(t,n)&&aX(e,n,t[n]);return e},bLe=(e,t)=>pLe(e,gLe(t));function vLe(e){return bLe(yLe({},e),{level:(e==null?void 0:e.level)||hLe.level})}function ELe(e,t=NC){return e[t]||""}function CLe(e,t,n=NC){return e[n]=t,e}function she(e,t=NC){let n="";return typeof e.bindings>"u"?n=ELe(e,t):n=e.bindings().context||"",n}function $Le(e,t,n=NC){const r=she(e,n);return r.trim()?`${r}/${t}`:t}function xLe(e,t,n=NC){const r=$Le(e,t,n),s=e.child({context:r});return CLe(s,r,n)}var ILe=Object.defineProperty,SLe=(e,t,n)=>t in e?ILe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cX=(e,t,n)=>SLe(e,typeof t!="symbol"?t+"":t,n);let ALe=class{constructor(t){this.opts=t,cX(this,"protocol","wc"),cX(this,"version",2)}},_Le=class{constructor(t){this.client=t}};const ihe="wc",ohe=2,ahe="client",Yq=`${ihe}@${ohe}:${ahe}:`,zO={name:ahe,logger:"error"},lX="WALLETCONNECT_DEEPLINK_CHOICE",NLe="proposal",uX="Proposal expired",TLe="session",Kb=V.SEVEN_DAYS,PLe="engine",ri={wc_sessionPropose:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1104},res:{ttl:V.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1106},res:{ttl:V.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1112},res:{ttl:V.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1114},res:{ttl:V.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:V.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:V.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1119}}},qO={min:V.FIVE_MINUTES,max:V.SEVEN_DAYS},ph={idle:"IDLE",active:"ACTIVE"},OLe={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""}
vendor: 56,850 bytes, line 14
14,cosmos_signDirect:{key:""}},kLe="request",RLe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],BLe="wc",DLe="auth",ULe="authKeys",LLe="pairingTopics",MLe="requests",c7=`${BLe}@${1.5}:${DLe}:`,yS=`${c7}:PUB_KEY`;var jLe=Object.defineProperty,FLe=Object.defineProperties,zLe=Object.getOwnPropertyDescriptors,dX=Object.getOwnPropertySymbols,qLe=Object.prototype.hasOwnProperty,WLe=Object.prototype.propertyIsEnumerable,wL=(e,t,n)=>t in e?jLe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rr=(e,t)=>{for(var n in t||(t={}))qLe.call(t,n)&&wL(e,n,t[n]);if(dX)for(var n of dX(t))WLe.call(t,n)&&wL(e,n,t[n]);return e},Ia=(e,t)=>FLe(e,zLe(t)),Ie=(e,t,n)=>wL(e,typeof t!="symbol"?t+"":t,n);let HLe=class extends _Le{constructor(t){super(t),Ie(this,"name",PLe),Ie(this,"events",new Bu),Ie(this,"initialized",!1),Ie(this,"requestQueue",{state:ph.idle,queue:[]}),Ie(this,"sessionRequestQueue",{state:ph.idle,queue:[]}),Ie(this,"emittedSessionRequests",new UNe({limit:500})),Ie(this,"requestQueueDelay",V.ONE_SECOND),Ie(this,"expectedPairingMethodMap",new Map),Ie(this,"recentlyDeletedMap",new Map),Ie(this,"recentlyDeletedLimit",200),Ie(this,"relayMessageCache",[]),Ie(this,"pendingSessions",new Map),Ie(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(ri)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay)))}),Ie(this,"connect",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Ia(Rr({},n),{requiredNamespaces:n.requiredNamespaces||{},optionalNamespaces:n.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=LPe(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:s,requiredNamespaces:i,optionalNamespaces:o,sessionProperties:a,scopedProperties:c,relays:l}=r;let u=s,d,h=!1;try{if(u){const v=this.client.core.pairing.pairings.get(u);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),h=v.active}}catch(v){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),v}if(!u||!h){const{topic:v,uri:x}=await this.client.core.pairing.create();u=v,d=x}if(!u){const{message:v}=We("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(v)}const f=await this.client.core.crypto.generateKeyPair(),g=ri.wc_sessionPropose.req.ttl||V.FIVE_MINUTES,p=Ys(g),m=Ia(Rr(Rr({requiredNamespaces:i,optionalNamespaces:o,relays:l??[{protocol:qde}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:p,pairingTopic:u},a&&{sessionProperties:a}),c&&{scopedProperties:c}),{id:Bn()}),w=rr("session_connect",m.id),{reject:C,resolve:E,done:b}=F1(g,uX),S=({id:v})=>{v===m.id&&(this.client.events.off("proposal_expire",S),this.pendingSessions.delete(m.id),this.events.emit(w,{error:{message:uX,code:0}}))};return this.client.events.on("proposal_expire",S),this.events.once(w,({error:v,session:x})=>{this.client.events.off("proposal_expire",S),v?C(v):x&&E(x)}),await this.sendRequest({topic:u,method:"wc_sessionPropose",params:m,throwOnFailedPublish:!0,clientRpcId:m.id}),await this.setProposal(m.id,m),{uri:d,approval:b}}),Ie(this,"pair",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(n)}catch(r){throw this.client.logger.error("pair() failed"),r}}),Ie(this,"approve",async n=>{var r,s,i;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=n==null?void 0:n.id)==null?void 0:r.toString(),trace:[Gu.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(I){throw o.setError(A1.no_internet_connection),I}try{await this.isValidProposalId(n==null?void 0:n.id)}catch(I){throw this.client.logger.error(`approve() -> proposal.get(${n==null?void 0:n.id}) failed`),o.setError(A1.proposal_not_found),I}try{await this.isValidApprove(n)}catch(I){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(A1.session_approve_namespace_validation_failure),I}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h}=n,f=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:p,requiredNamespaces:m,optionalNamespaces:w}=f;let C=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:g});C||(C=(i=this.client.core.eventClient)==null?void 0:i.createEvent({type:Gu.session_approve_started,properties:{topic:g,trace:[Gu.session_approve_started,Gu.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),b=p.publicKey,S=await this.client.core.crypto.generateSharedKey(E,b),v=Rr(Rr(Rr({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:E,metadata:this.client.metadata},expiry:Ys(Kb)},u&&{sessionProperties:u}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),x=Dr.relay;C.addTrace(Gu.subscribing_session_topic);try{await this.client.core.relayer.subscribe(S,{transportType:x})}catch(I){throw C.setError(A1.subscribe_session_topic_failure),I}C.addTrace(Gu.subscribe_session_topic_success);const A=Ia(Rr({},v),{topic:S,requiredNamespaces:m,optionalNamespaces:w,pairingTopic:g,acknowledged:!1,self:v.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:E,transportType:Dr.relay});await this.client.session.set(S,A),C.addTrace(Gu.store_session);try{C.addTrace(Gu.publishing_session_settle),await this.sendRequest({topic:S,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch(I=>{throw C==null||C.setError(A1.session_settle_publish_failure),I}),C.addTrace(Gu.session_settle_publish_success),C.addTrace(Gu.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:E},throwOnFailedPublish:!0}).catch(I=>{throw C==null||C.setError(A1.session_approve_publish_failure),I}),C.addTrace(Gu.session_approve_publish_success)}catch(I){throw this.client.logger.error(I),this.client.session.delete(S,jr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(S),I}return this.client.core.eventClient.deleteEvent({eventId:C.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:p.metadata}),await this.deleteProposal(a),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(S,Ys(Kb)),{topic:S,acknowledged:()=>Promise.resolve(this.client.session.get(S))}}),Ie(this,"reject",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(n)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:s}=n;let i;try{i=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}i&&await this.sendError({id:r,topic:i,error:s,rpcOpts:ri.wc_sessionPropose.reject}),await this.deleteProposal(r)}),Ie(this,"update",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(n)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:s}=n,{done:i,resolve:o,reject:a}=F1(),c=Bn(),l=Ir().toString(),u=this.client.session.get(r).namespaces;return this.events.once(rr("session_update",c),({error:d})=>{d?a(d):o()}),await this.client.session.update(r,{namespaces:s}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:u}),a(d)}),{acknowledged:i}}),Ie(this,"extend",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(n)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:r}=n,s=Bn(),{done:i,resolve:o,reject:a}=F1();return this.events.once(rr("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(r,Ys(Kb)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:i}}),Ie(this,"request",async n=>{this.isInitialized();try{await this.isValidRequest(n)}catch(m){throw this.client.logger.error("request() -> isValidRequest() failed"),m}const{chainId:r,request:s,topic:i,expiry:o=ri.wc_sessionRequest.req.ttl}=n,a=this.client.session.get(i);(a==null?void 0:a.transportType)===Dr.relay&&await this.confirmOnlineStateOrThrow();const c=Bn(),l=Ir().toString(),{done:u,resolve:d,reject:h}=F1(o,"Request expired. Please try again.");this.events.once(rr("session_request",c),({error:m,result:w})=>{m?h(m):d(w)});const f="wc_sessionRequest",g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(g)return await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:{request:Ia(Rr({},s),{expiryTimestamp:Ys(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(m=>h(m)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),await u();const p={request:Ia(Rr({},s),{expiryTimestamp:Ys(o)}),chainId:r};return await Promise.all([new Promise(async m=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:p,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(c,p)}).catch(w=>h(w)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),m()}),new Promise(async m=>{var w;if(!((w=a.sessionConfig)!=null&&w.disableDeepLink)){const C=await ONe(this.client.core.storage,lX);await NNe({id:c,topic:i,wcDeepLink:C})}m()}),u()]).then(m=>m[2])}),Ie(this,"respond",async n=>{this.isInitialized(),await this.isValidRespond(n);const{topic:r,response:s}=n,{id:i}=s,o=this.client.session.get(r);o.transportType===Dr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);wn(s)?await this.sendResult({id:i,topic:r,result:s.result,throwOnFailedPublish:!0,appLink:a}):nn(s)&&await this.sendError({id:i,topic:r,error:s.error,appLink:a}),this.cleanupAfterResponse(n)}),Ie(this,"ping",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(n)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:r}=n;if(this.client.session.keys.includes(r)){const s=Bn(),i=Ir().toString(),{done:o,resolve:a,reject:c}=F1();this.events.once(rr("session_ping",s),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:i}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),Ie(this,"emit",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(n);const{topic:r,event:s,chainId:i}=n,o=Ir().toString(),a=Bn();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:s,chainId:i},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),Ie(this,"disconnect",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(n);const{topic:r}=n;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:jr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:s}=We("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(s)}}),Ie(this,"find",n=>(this.isInitialized(),this.client.session.getAll().filter(r=>FPe(r,n)))),Ie(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),Ie(this,"authenticate",async(n,r)=>{var s;this.isInitialized(),this.isValidAuthenticate(n);const i=r&&this.client.core.linkModeSupportedApps.includes(r)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),o=i?Dr.link_mode:Dr.relay;o===Dr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:u,nonce:d,type:h,exp:f,nbf:g,methods:p=[],expiry:m}=n,w=[...n.resources||[]],{topic:C,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:C,uri:E}});const b=await this.client.core.crypto.generateKeyPair(),S=pS(b);if(await Promise.all([this.client.auth.authKeys.set(yS,{responseTopic:S,publicKey:b}),this.client.auth.pairingTopics.set(S,{topic:S,pairingTopic:C})]),await this.client.core.relayer.subscribe(S,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${C}`),p.length>0){const{namespace:k}=Rv(a[0]);let D=G7e(k,"request",p);fS(w)&&(D=Y7e(D,w.pop())),w.push(D)}const v=m&&m>ri.wc_sessionAuthenticate.req.ttl?m:ri.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:h??"caip122",chains:a,statement:c,aud:l,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:g,resources:w},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:Ys(v)},A={eip155:{chains:a,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},I={requiredNamespaces:{},optionalNamespaces:A,relays:[{protocol:"irn"}],pairingTopic:C,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:Ys(ri.wc_sessionPropose.req.ttl),id:Bn()},{done:O,resolve:N,reject:T}=F1(v,"Request expired"),P=Bn(),_=rr("session_connect",I.id),y=rr("session_request",P),$=async({error:k,session:D})=>{this.events.off(y,R),k?T(k):D&&N({session:D})},R=async k=>{var D,U,F;if(await this.deletePendingAuthRequest(P,{message:"fulfilled",code:0}),k.error){const X=jr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return k.error.code===X.code?void 0:(this.events.off(_,$),T(k.error.message))}await this.deleteProposal(I.id),this.events.off(_,$);const{cacaos:K,responder:q}=k.result,H=[],Z=[];for(const X of K){await LY({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),T(jr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:le}=X,_e=fS(le.resources),Ne=[HU(le.iss)],be=QS(le.iss);if(_e){const Me=MY(_e),Ct=jY(_e);H.push(...Me),Ne.push(...Ct)}for(const Me of Ne)Z.push(`${Me}:${be}`)}const ee=await this.client.core.crypto.generateSharedKey(b,q.publicKey);let ie;H.length>0&&(ie={topic:ee,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:q,controller:q.publicKey,expiry:Ys(Kb),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:C,namespaces:uJ([...new Set(H)],[...new Set(Z)]),transportType:o},await this.client.core.relayer.subscribe(ee,{transportType:o}),await this.client.session.set(ee,ie),C&&await this.client.core.pairing.updateMetadata({topic:C,metadata:q.metadata}),ie=this.client.session.get(ee)),(D=this.client.metadata.redirect)!=null&&D.linkMode&&(U=q.metadata.redirect)!=null&&U.linkMode&&(F=q.metadata.redirect)!=null&&F.universal&&r&&(this.client.core.addLinkModeSupportedApp(q.metadata.redirect.universal),this.client.session.update(ee,{transportType:Dr.link_mode})),N({auths:K,session:ie})};this.events.once(_,$),this.events.once(y,R);let B;try{if(i){const k=_n("wc_sessionAuthenticate",x,P);this.client.core.history.set(C,k);const D=await this.client.core.crypto.encode("",k,{type:xC,encoding:Jg});B=Tx(r,C,D)}else await Promise.all([this.sendRequest({topic:C,method:"wc_sessionAuthenticate",params:x,expiry:n.expiry,throwOnFailedPublish:!0,clientRpcId:P}),this.sendRequest({topic:C,method:"wc_sessionPropose",params:I,expiry:ri.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:I.id})])}catch(k){throw this.events.off(_,$),this.events.off(y,R),k}return await this.setProposal(I.id,I),await this.setAuthRequest(P,{request:Ia(Rr({},x),{verifyContext:{}}),pairingTopic:C,transportType:o}),{uri:B??E,response:O}}),Ie(this,"approveSessionAuthenticate",async n=>{const{id:r,auths:s}=n,i=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[_1.authenticated_session_approve_started]}});try{this.isInitialized()}catch(m){throw i.setError(k3.no_internet_connection),m}const o=this.getPendingAuthRequest(r);if(!o)throw i.setError(k3.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const a=o.transportType||Dr.relay;a===Dr.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),u=pS(c),d={type:Xp,receiverPublicKey:c,senderPublicKey:l},h=[],f=[];for(const m of s){if(!await LY({cacao:m,projectId:this.client.core.projectId})){i.setError(k3.invalid_cacao);const S=jr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:u,error:S,encodeOpts:d}),new Error(S.message)}i.addTrace(_1.cacaos_verified);const{p:w}=m,C=fS(w.resources),E=[HU(w.iss)],b=QS(w.iss);if(C){const S=MY(C),v=jY(C);h.push(...S),E.push(...v)}for(const S of E)f.push(`${S}:${b}`)}const g=await this.client.core.crypto.generateSharedKey(l,c);i.addTrace(_1.create_authenticated_session_topic);let p;if((h==null?void 0:h.length)>0){p={topic:g,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Ys(Kb),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:uJ([...new Set(h)],[...new Set(f)]),transportType:a},i.addTrace(_1.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(g,{transportType:a})}catch(m){throw i.setError(k3.subscribe_authenticated_session_topic_failure),m}i.addTrace(_1.subscribe_authenticated_session_topic_success),await this.client.session.set(g,p),i.addTrace(_1.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}i.addTrace(_1.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:r,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(m){throw i.setError(k3.authenticated_session_approve_publish_failure),m}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:p}}),Ie(this,"rejectSessionAuthenticate",async n=>{this.isInitialized();const{id:r,reason:s}=n,i=this.getPendingAuthRequest(r);if(!i)throw new Error(`Could not find pending auth request with id ${r}`);i.transportType===Dr.relay&&await this.confirmOnlineStateOrThrow();const o=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=pS(o),l={type:Xp,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:r,topic:c,error:s,encodeOpts:l,rpcOpts:ri.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),Ie(this,"formatAuthMessage",n=>{this.isInitialized();const{request:r,iss:s}=n;return Que(r,s)}),Ie(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const n=this.relayMessageCache.shift();n&&await this.onRelayMessage(n)}catch(n){this.client.logger.error(n)}},50)}),Ie(this,"cleanupDuplicatePairings",async n=>{if(n.pairingTopic)try{const r=this.client.core.pairing.pairings.get(n.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(i=>{var o,a;return((o=i.peerMetadata)==null?void 0:o.url)&&((a=i.peerMetadata)==null?void 0:a.url)===n.peer.metadata.url&&i.topic&&i.topic!==r.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(i=>this.client.core.pairing.disconnect({topic:i.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),Ie(this,"deleteSession",async n=>{var r;const{topic:s,expirerHasDeleted:i=!1,emitEvent:o=!0,id:a=0}=n,{self:c}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,jr("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),i||this.client.core.expirer.del(s),this.client.core.storage.removeItem(lX).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===s&&this.deletePendingSessionRequest(l.id,jr("USER_DISCONNECTED"))}),s===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=ph.idle),o&&this.client.events.emit("session_delete",{id:a,topic:s})}),Ie(this,"deleteProposal",async(n,r)=>{if(r)try{const s=this.client.proposal.get(n),i=this.client.core.eventClient.getEvent({topic:s.pairingTopic});i==null||i.setError(A1.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(n,jr("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"proposal")}),Ie(this,"deletePendingSessionRequest",async(n,r,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==n),s&&(this.sessionRequestQueue.state=ph.idle,this.client.events.emit("session_request_expire",{id:n}))}),Ie(this,"deletePendingAuthRequest",async(n,r,s=!1)=>{await Promise.all([this.client.auth.requests.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)])}),Ie(this,"setExpiry",async(n,r)=>{this.client.session.keys.includes(n)&&(this.client.core.expirer.set(n,r),await this.client.session.update(n,{expiry:r}))}),Ie(this,"setProposal",async(n,r)=>{this.client.core.expirer.set(n,Ys(ri.wc_sessionPropose.req.ttl)),await this.client.proposal.set(n,r)}),Ie(this,"setAuthRequest",async(n,r)=>{const{request:s,pairingTopic:i,transportType:o=Dr.relay}=r;this.client.core.expirer.set(n,s.expiryTimestamp),await this.client.auth.requests.set(n,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:n,pairingTopic:i,verifyContext:s.verifyContext,transportType:o})}),Ie(this,"setPendingSessionRequest",async n=>{const{id:r,topic:s,params:i,verifyContext:o}=n,a=i.request.expiryTimestamp||Ys(ri.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,a),await this.client.pendingRequest.set(r,{id:r,topic:s,params:i,verifyContext:o})}),Ie(this,"sendRequest",async n=>{const{topic:r,method:s,params:i,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:u,tvf:d}=n,h=_n(s,i,c);let f;const g=!!u;try{const w=g?Jg:Cd;f=await this.client.core.crypto.encode(r,h,{encoding:w})}catch(w){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),w}let p;if(RLe.includes(s)){const w=Oh(JSON.stringify(h)),C=Oh(f);p=await this.client.core.verify.register({id:C,decryptedId:w})}const m=ri[s].req;if(m.attestation=p,o&&(m.ttl=o),a&&(m.id=a),this.client.core.history.set(r,h),g){const w=Tx(u,r,f);await globalThis.Linking.openURL(w,this.client.name)}else{const w=ri[s].req;o&&(w.ttl=o),a&&(w.id=a),w.tvf=Ia(Rr({},d),{correlationId:h.id}),l?(w.internal=Ia(Rr({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,w)):this.client.core.relayer.publish(r,f,w).catch(C=>this.client.logger.error(C))}return h.id}),Ie(this,"sendResult",async n=>{const{id:r,topic:s,result:i,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=n,l=Pi(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const g=d?Jg:Cd;u=await this.client.core.crypto.encode(s,l,Ia(Rr({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),g}let h,f;try{h=await this.client.core.history.get(s,r);const g=h.request;try{f=this.getTVFParams(r,g.params,i)}catch(p){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${p==null?void 0:p.message}`)}}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${r}) failed`),g}if(d){const g=Tx(c,s,u);await globalThis.Linking.openURL(g,this.client.name)}else{const g=h.request.method,p=ri[g].res;p.tvf=Ia(Rr({},f),{correlationId:r}),o?(p.internal=Ia(Rr({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,u,p)):this.client.core.relayer.publish(s,u,p).catch(m=>this.client.logger.error(m))}await this.client.core.history.resolve(l)}),Ie(this,"sendError",async n=>{const{id:r,topic:s,error:i,encodeOpts:o,rpcOpts:a,appLink:c}=n,l=yf(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const f=d?Jg:Cd;u=await this.client.core.crypto.encode(s,l,Ia(Rr({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),f}let h;try{h=await this.client.core.history.get(s,r)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${s}, ${r}) failed`),f}if(d){const f=Tx(c,s,u);await globalThis.Linking.openURL(f,this.client.name)}else{const f=h.request.method,g=a||ri[f].res;this.client.core.relayer.publish(s,u,g)}await this.client.core.history.resolve(l)}),Ie(this,"cleanup",async()=>{const n=[],r=[];this.client.session.getAll().forEach(s=>{let i=!1;Mg(s.expiry)&&(i=!0),this.client.core.crypto.keychain.has(s.topic)||(i=!0),i&&n.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{Mg(s.expiryTimestamp)&&r.push(s.id)}),await Promise.all([...n.map(s=>this.deleteSession({topic:s})),...r.map(s=>this.deleteProposal(s))])}),Ie(this,"onProviderMessageEvent",async n=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(n):await this.onRelayMessage(n)}),Ie(this,"onRelayEventRequest",async n=>{this.requestQueue.queue.push(n),await this.processRequestsQueue()}),Ie(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ph.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ph.active;const n=this.requestQueue.queue.shift();if(n)try{await this.processRequest(n)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=ph.idle}),Ie(this,"processRequest",async n=>{const{topic:r,payload:s,attestation:i,transportType:o,encryptedId:a}=n,c=s.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:s,attestation:i,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,s);case"wc_sessionPing":return await this.onSessionPingRequest(r,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),Ie(this,"onRelayEventResponse",async n=>{const{topic:r,payload:s,transportType:i}=n,o=(await this.client.core.history.get(r,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,s,i);case"wc_sessionSettle":return this.onSessionSettleResponse(r,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,s);case"wc_sessionExtend":return this.onSessionExtendResponse(r,s);case"wc_sessionPing":return this.onSessionPingResponse(r,s);case"wc_sessionRequest":return this.onSessionRequestResponse(r,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),Ie(this,"onRelayEventUnknownPayload",n=>{const{topic:r}=n,{message:s}=We("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)}),Ie(this,"shouldIgnorePairingRequest",n=>{const{topic:r,requestMethod:s}=n,i=this.expectedPairingMethodMap.get(r);return!i||i.includes(s)?!1:!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),Ie(this,"onSessionProposeRequest",async n=>{const{topic:r,payload:s,attestation:i,encryptedId:o}=n,{params:a,id:c}=s;try{const l=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(lp.proposal_listener_not_found)),this.isValidConnect(Rr({},s.params));const u=a.expiryTimestamp||Ys(ri.wc_sessionPropose.req.ttl),d=Rr({id:c,pairingTopic:r,expiryTimestamp:u,attestation:i,encryptedId:o},a);await this.setProposal(c,d);const h=await this.getVerifyContext({attestationId:i,hash:Oh(JSON.stringify(s)),encryptedId:o,metadata:d.proposer.metadata});l==null||l.addTrace(Sh.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:d,verifyContext:h})}catch(l){await this.sendError({id:c,topic:r,error:l,rpcOpts:ri.wc_sessionPropose.autoReject}),this.client.logger.error(l)}}),Ie(this,"onSessionProposeResponse",async(n,r,s)=>{const{id:i}=r;if(wn(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const u=await this.client.core.crypto.generateSharedKey(c,l);this.pendingSessions.set(i,{sessionTopic:u,pairingTopic:n,proposalId:i,publicKey:c});const d=await this.client.core.relayer.subscribe(u,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:n})}else if(nn(r)){await this.deleteProposal(i);const o=rr("session_connect",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),Ie(this,"onSessionSettleRequest",async(n,r)=>{const{id:s,params:i}=r;try{this.isValidSessionSettleRequest(i);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h}=r.params,f=[...this.pendingSessions.values()].find(m=>m.sessionTopic===n);if(!f)return this.client.logger.error(`Pending session not found for topic ${n}`);const g=this.client.proposal.get(f.proposalId),p=Ia(Rr(Rr(Rr({topic:n,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:f.pairingTopic,requiredNamespaces:g.requiredNamespaces,optionalNamespaces:g.optionalNamespaces,controller:a.publicKey,self:{publicKey:f.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},u&&{sessionProperties:u}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),{transportType:Dr.relay});await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:p.peer.metadata}),this.client.events.emit("session_connect",{session:p}),this.events.emit(rr("session_connect",f.proposalId),{session:p}),this.pendingSessions.delete(f.proposalId),this.deleteProposal(f.proposalId,!1),this.cleanupDuplicatePairings(p),await this.sendResult({id:r.id,topic:n,result:!0})}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),Ie(this,"onSessionSettleResponse",async(n,r)=>{const{id:s}=r;wn(r)?(await this.client.session.update(n,{acknowledged:!0}),this.events.emit(rr("session_approve",s),{})):nn(r)&&(await this.client.session.delete(n,jr("USER_DISCONNECTED")),this.events.emit(rr("session_approve",s),{error:r.error}))}),Ie(this,"onSessionUpdateRequest",async(n,r)=>{const{params:s,id:i}=r;try{const o=`${n}_session_update`,a=P3.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:n,error:jr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Rr({topic:n},s));try{P3.set(o,i),await this.client.session.update(n,{namespaces:s.namespaces}),await this.sendResult({id:i,topic:n,result:!0})}catch(c){throw P3.delete(o),c}this.client.events.emit("session_update",{id:i,topic:n,params:s})}catch(o){await this.sendError({id:i,topic:n,error:o}),this.client.logger.error(o)}}),Ie(this,"isRequestOutOfSync",(n,r)=>r.toString().slice(0,-3)<n.toString().slice(0,-3)),Ie(this,"onSessionUpdateResponse",(n,r)=>{const{id:s}=r,i=rr("session_update",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(rr("session_update",s),{}):nn(r)&&this.events.emit(rr("session_update",s),{error:r.error})}),Ie(this,"onSessionExtendRequest",async(n,r)=>{const{id:s}=r;try{this.isValidExtend({topic:n}),await this.setExpiry(n,Ys(Kb)),await this.sendResult({id:s,topic:n,result:!0}),this.client.events.emit("session_extend",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}}),Ie(this,"onSessionExtendResponse",(n,r)=>{const{id:s}=r,i=rr("session_extend",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(rr("session_extend",s),{}):nn(r)&&this.events.emit(rr("session_extend",s),{error:r.error})}),Ie(this,"onSessionPingRequest",async(n,r)=>{const{id:s}=r;try{this.isValidPing({topic:n}),await this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}}),Ie(this,"onSessionPingResponse",(n,r)=>{const{id:s}=r,i=rr("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners 2176`);wn(r)?this.events.emit(rr("session_ping",s),{}):nn(r)&&this.events.emit(rr("session_ping",s),{error:r.error})},500)}),Ie(this,"onSessionDeleteRequest",async(n,r)=>{const{id:s}=r;try{this.isValidDisconnect({topic:n,reason:r.params}),Promise.all([new Promise(i=>{this.client.core.relayer.once(Ei.publish,async()=>{i(await this.deleteSession({topic:n,id:s}))})}),this.sendResult({id:s,topic:n,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:n,error:jr("USER_DISCONNECTED")})]).catch(i=>this.client.logger.error(i))}catch(i){this.client.logger.error(i)}}),Ie(this,"onSessionRequest",async n=>{var r,s,i;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:u}=n,{id:d,params:h}=a;try{await this.isValidRequest(Rr({topic:o},h));const f=this.client.session.get(o),g=await this.getVerifyContext({attestationId:c,hash:Oh(JSON.stringify(_n("wc_sessionRequest",h,d))),encryptedId:l,metadata:f.peer.metadata,transportType:u}),p={id:d,topic:o,params:h,verifyContext:g};await this.setPendingSessionRequest(p),u===Dr.link_mode&&(r=f.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((s=f.peer.metadata.redirect)==null?void 0:s.universal),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(p):(this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue())}catch(f){await this.sendError({id:d,topic:o,error:f}),this.client.logger.error(f)}}),Ie(this,"onSessionRequestResponse",(n,r)=>{const{id:s}=r,i=rr("session_request",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(rr("session_request",s),{result:r.result}):nn(r)&&this.events.emit(rr("session_request",s),{error:r.error})}),Ie(this,"onSessionEventRequest",async(n,r)=>{const{id:s,params:i}=r;try{const o=`${n}_session_event_${i.event.name}`,a=P3.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(Rr({topic:n},i)),this.client.events.emit("session_event",{id:s,topic:n,params:i}),P3.set(o,s)}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),Ie(this,"onSessionAuthenticateResponse",(n,r)=>{const{id:s}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:n,payload:r}),wn(r)?this.events.emit(rr("session_request",s),{result:r.result}):nn(r)&&this.events.emit(rr("session_request",s),{error:r.error})}),Ie(this,"onSessionAuthenticateRequest",async n=>{var r;const{topic:s,payload:i,attestation:o,encryptedId:a,transportType:c}=n;try{const{requester:l,authPayload:u,expiryTimestamp:d}=i.params,h=await this.getVerifyContext({attestationId:o,hash:Oh(JSON.stringify(i)),encryptedId:a,metadata:l.metadata,transportType:c}),f={requester:l,pairingTopic:s,id:i.id,authPayload:u,verifyContext:h,expiryTimestamp:d};await this.setAuthRequest(i.id,{request:f,pairingTopic:s,transportType:c}),c===Dr.link_mode&&(r=l.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:i.params,id:i.id,verifyContext:h})}catch(l){this.client.logger.error(l);const u=i.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(i.params.requester.metadata,c),f={type:Xp,receiverPublicKey:u,senderPublicKey:d};await this.sendError({id:i.id,topic:s,error:l,encodeOpts:f,rpcOpts:ri.wc_sessionAuthenticate.autoReject,appLink:h})}}),Ie(this,"addSessionRequestToSessionRequestQueue",n=>{this.sessionRequestQueue.queue.push(n)}),Ie(this,"cleanupAfterResponse",n=>{this.deletePendingSessionRequest(n.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ph.idle,this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay))}),Ie(this,"cleanupPendingSentRequestsForTopic",({topic:n,error:r})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(i=>i.topic===n&&i.request.method==="wc_sessionRequest").forEach(i=>{const o=i.request.id,a=rr("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(rr("session_request",i.request.id),{error:r})})}),Ie(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ph.active){this.client.logger.info("session request queue is already active.");return}const n=this.sessionRequestQueue.queue[0];if(!n){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(n)}catch(r){this.client.logger.error(r)}}),Ie(this,"emitSessionRequest",n=>{if(this.emittedSessionRequests.has(n.id)){this.client.logger.warn({id:n.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${n.id}`);return}this.sessionRequestQueue.state=ph.active,this.emittedSessionRequests.add(n.id),this.client.events.emit("session_request",n)}),Ie(this,"onPairingCreated",n=>{if(n.methods&&this.expectedPairingMethodMap.set(n.topic,n.methods),n.active)return;const r=this.client.proposal.getAll().find(s=>s.pairingTopic===n.topic);r&&this.onSessionProposeRequest({topic:n.topic,payload:_n("wc_sessionPropose",Ia(Rr({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),Ie(this,"isValidConnect",async n=>{if(!ja(n)){const{message:l}=We("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(n)}`);throw new Error(l)}const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:i,sessionProperties:o,scopedProperties:a,relays:c}=n;if(Ki(r)||await this.isValidPairingTopic(r),!QPe(c)){const{message:l}=We("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(l)}if(!Ki(s)&&qh(s)!==0){const l="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(l):this.client.logger.warn(l),this.validateNamespaces(s,"requiredNamespaces")}if(!Ki(i)&&qh(i)!==0&&this.validateNamespaces(i,"optionalNamespaces"),Ki(o)||this.validateSessionProps(o,"sessionProperties"),!Ki(a)){this.validateSessionProps(a,"scopedProperties");const l=Object.keys(s||{}).concat(Object.keys(i||{}));if(!Object.keys(a).every(u=>l.includes(u.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(l)}`)}}),Ie(this,"validateNamespaces",(n,r)=>{const s=XPe(n,"connect()",r);if(s)throw new Error(s.message)}),Ie(this,"isValidApprove",async n=>{if(!ja(n))throw new Error(We("MISSING_OR_INVALID",`approve() params: ${n}`).message);const{id:r,namespaces:s,relayProtocol:i,sessionProperties:o,scopedProperties:a}=n;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const c=this.client.proposal.get(r),l=TO(s,"approve()");if(l)throw new Error(l.message);const u=fJ(c.requiredNamespaces,s,"approve()");if(u)throw new Error(u.message);if(!_s(i,!0)){const{message:d}=We("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(d)}if(Ki(o)||this.validateSessionProps(o,"sessionProperties"),!Ki(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(s));if(!Object.keys(a).every(h=>d.has(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),Ie(this,"isValidReject",async n=>{if(!ja(n)){const{message:i}=We("MISSING_OR_INVALID",`reject() params: ${n}`);throw new Error(i)}const{id:r,reason:s}=n;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!tOe(s)){const{message:i}=We("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(i)}}),Ie(this,"isValidSessionSettleRequest",n=>{if(!ja(n)){const{message:l}=We("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${n}`);throw new Error(l)}const{relay:r,controller:s,namespaces:i,expiry:o}=n;if(!Tde(r)){const{message:l}=We("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=VPe(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=TO(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Mg(o)){const{message:l}=We("EXPIRED","onSessionSettleRequest()");throw new Error(l)}}),Ie(this,"isValidUpdate",async n=>{if(!ja(n)){const{message:c}=We("MISSING_OR_INVALID",`update() params: ${n}`);throw new Error(c)}const{topic:r,namespaces:s}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const i=this.client.session.get(r),o=TO(s,"update()");if(o)throw new Error(o.message);const a=fJ(i.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)}),Ie(this,"isValidExtend",async n=>{if(!ja(n)){const{message:s}=We("MISSING_OR_INVALID",`extend() params: ${n}`);throw new Error(s)}const{topic:r}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),Ie(this,"isValidRequest",async n=>{if(!ja(n)){const{message:c}=We("MISSING_OR_INVALID",`request() params: ${n}`);throw new Error(c)}const{topic:r,request:s,chainId:i,expiry:o}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:a}=this.client.session.get(r);if(!hJ(a,i)){const{message:c}=We("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(c)}if(!nOe(s)){const{message:c}=We("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!iOe(a,i,s.method)){const{message:c}=We("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}if(o&&!lOe(o,qO)){const{message:c}=We("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${qO.min} and ${qO.max}`);throw new Error(c)}}),Ie(this,"isValidRespond",async n=>{var r;if(!ja(n)){const{message:o}=We("MISSING_OR_INVALID",`respond() params: ${n}`);throw new Error(o)}const{topic:s,response:i}=n;try{await this.isValidSessionTopic(s)}catch(o){throw(r=n==null?void 0:n.response)!=null&&r.id&&this.cleanupAfterResponse(n),o}if(!rOe(i)){const{message:o}=We("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(o)}}),Ie(this,"isValidPing",async n=>{if(!ja(n)){const{message:s}=We("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)}),Ie(this,"isValidEmit",async n=>{if(!ja(n)){const{message:a}=We("MISSING_OR_INVALID",`emit() params: ${n}`);throw new Error(a)}const{topic:r,event:s,chainId:i}=n;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!hJ(o,i)){const{message:a}=We("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(a)}if(!sOe(s)){const{message:a}=We("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!oOe(o,i,s.name)){const{message:a}=We("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}}),Ie(this,"isValidDisconnect",async n=>{if(!ja(n)){const{message:s}=We("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)}),Ie(this,"isValidAuthenticate",n=>{const{chains:r,uri:s,domain:i,nonce:o}=n;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!_s(s,!1))throw new Error("uri is required parameter");if(!_s(i,!1))throw new Error("domain is required parameter");if(!_s(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(c=>Rv(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Rv(r[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),Ie(this,"getVerifyContext",async n=>{const{attestationId:r,hash:s,encryptedId:i,metadata:o,transportType:a}=n,c={verified:{verifyUrl:o.verifyUrl||r8,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Dr.link_mode){const u=this.getAppLinkIfEnabled(o,a);return c.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:r,hash:s,encryptedId:i,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),Ie(this,"validateSessionProps",(n,r)=>{Object.values(n).forEach((s,i)=>{if(s==null){const{message:o}=We("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${s} for key ${Object.keys(n)[i]}`);throw new Error(o)}})}),Ie(this,"getPendingAuthRequest",n=>{const r=this.client.auth.requests.get(n);return typeof r=="object"?r:void 0}),Ie(this,"addToRecentlyDeleted",(n,r)=>{if(this.recentlyDeletedMap.set(n,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const i=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=i)break;this.recentlyDeletedMap.delete(o)}}}),Ie(this,"checkRecentlyDeleted",n=>{const r=this.recentlyDeletedMap.get(n);if(r){const{message:s}=We("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${n}`);throw new Error(s)}}),Ie(this,"isLinkModeEnabled",(n,r)=>{var s,i,o,a,c,l,u,d,h;return!n||r!==Dr.link_mode?!1:((i=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:i.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((u=n==null?void 0:n.redirect)==null?void 0:u.universal)!==void 0&&((d=n==null?void 0:n.redirect)==null?void 0:d.universal)!==""&&((h=n==null?void 0:n.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(n.redirect.universal)&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"}),Ie(this,"getAppLinkIfEnabled",(n,r)=>{var s;return this.isLinkModeEnabled(n,r)?(s=n==null?void 0:n.redirect)==null?void 0:s.universal:void 0}),Ie(this,"handleLinkModeMessage",({url:n})=>{if(!n||!n.includes("wc_ev")||!n.includes("topic"))return;const r=SY(n,"topic")||"",s=decodeURIComponent(SY(n,"wc_ev")||""),i=this.client.session.keys.includes(r);i&&this.client.session.update(r,{transportType:Dr.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:s,sessionExists:i})}),Ie(this,"registerLinkModeListeners",async()=>{var n;if(kq()||u1()&&(n=this.client.metadata.redirect)!=null&&n.linkMode){const r=globalThis==null?void 0:globalThis.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await r.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}),Ie(this,"getTVFParams",(n,r,s)=>{var i,o,a;if(!((i=r.request)!=null&&i.method))return{};const c={correlationId:n,rpcMethods:[r.request.method],chainId:r.chainId};try{const l=this.extractTxHashesFromResult(r.request,s);c.txHashes=l,c.contractAddresses=this.isValidContractData(r.request.params)?[(a=(o=r.request.params)==null?void 0:o[0])==null?void 0:a.to]:[]}catch(l){this.client.logger.warn("Error getting TVF params",l)}return c}),Ie(this,"isValidContractData",n=>{var r;if(!n)return!1;try{const s=(n==null?void 0:n.data)||((r=n==null?void 0:n[0])==null?void 0:r.data);if(!s.startsWith("0x"))return!1;const i=s.slice(2);return/^[0-9a-fA-F]*$/.test(i)?i.length%2===0:!1}catch{}return!1}),Ie(this,"extractTxHashesFromResult",(n,r)=>{var s;try{if(!r)return[];const i=n.method,o=OLe[i];if(i==="sui_signTransaction")return[O7e(r.transactionBytes)];if(i==="near_signTransaction")return[RY(r)];if(i==="near_signTransactions")return r.map(c=>RY(c));if(i==="xrpl_signTransactionFor"||i==="xrpl_signTransaction")return[(s=r.tx_json)==null?void 0:s.hash];if(i==="polkadot_signTransaction")return[xOe({transaction:n.params.transactionPayload,signature:r.signature})];if(i==="algo_signTxn")return mu(r)?r.map(c=>BY(c)):[BY(r)];if(i==="cosmos_signDirect")return[R7e(r)];if(typeof r=="string")return[r];const a=r[o.key];if(mu(a))return i==="solana_signAllTransactions"?a.map(c=>P7e(c)):a;if(typeof a=="string")return[a]}catch(i){this.client.logger.warn("Error extracting tx hashes from result",i)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,n=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,s]of Object.entries(n))for(const i of s)try{await this.onProviderMessageEvent({topic:r,message:i,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${i}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=We("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ei.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:n,message:r,attestation:s,transportType:i}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(yS)?this.client.auth.authKeys.get(yS):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(n,r,{receiverPublicKey:o,encoding:i===Dr.link_mode?Jg:Cd});Du(a)?(this.client.core.history.set(n,a),await this.onRelayEventRequest({topic:n,payload:a,attestation:s,transportType:i,encryptedId:Oh(r)})):Sl(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:n,payload:a,transportType:i}),this.client.core.history.delete(n,a.id)):await this.onRelayEventUnknownPayload({topic:n,payload:a,transportType:i}),await this.client.core.relayer.messages.ack(n,r)}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(Xl.expired,async t=>{const{topic:n,id:r}=Lue(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,We("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,We("EXPIRED"),!0);n?this.client.session.keys.includes(n)&&(await this.deleteSession({topic:n,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:n})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(Y1.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Y1.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!_s(t,!1)){const{message:n}=We("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(n)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:n}=We("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(n)}if(Mg(this.client.core.pairing.pairings.get(t).expiry)){const{message:n}=We("EXPIRED",`pairing topic: ${t}`);throw new Error(n)}}async isValidSessionTopic(t){if(!_s(t,!1)){const{message:n}=We("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(n)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:n}=We("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(n)}if(Mg(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:n}=We("EXPIRED",`session topic: ${t}`);throw new Error(n)}if(!this.client.core.crypto.keychain.has(t)){const{message:n}=We("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(n)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(_s(t,!1)){const{message:n}=We("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(n)}else{const{message:n}=We("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(n)}}async isValidProposalId(t){if(!eOe(t)){const{message:n}=We("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(n)}if(!this.client.proposal.keys.includes(t)){const{message:n}=We("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(n)}if(Mg(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:n}=We("EXPIRED",`proposal id: ${t}`);throw new Error(n)}}},VLe=class extends rb{constructor(t,n){super(t,n,NLe,Yq),this.core=t,this.logger=n}},KLe=class extends rb{constructor(t,n){super(t,n,TLe,Yq),this.core=t,this.logger=n}},GLe=class extends rb{constructor(t,n){super(t,n,kLe,Yq,r=>r.id),this.core=t,this.logger=n}},ZLe=class extends rb{constructor(t,n){super(t,n,ULe,c7,()=>yS),this.core=t,this.logger=n}},YLe=class extends rb{constructor(t,n){super(t,n,LLe,c7),this.core=t,this.logger=n}},JLe=class extends rb{constructor(t,n){super(t,n,MLe,c7,r=>r.id),this.core=t,this.logger=n}};var XLe=Object.defineProperty,QLe=(e,t,n)=>t in e?XLe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WO=(e,t,n)=>QLe(e,typeof t!="symbol"?t+"":t,n);let eMe=class{constructor(t,n){this.core=t,this.logger=n,WO(this,"authKeys"),WO(this,"pairingTopics"),WO(this,"requests"),this.authKeys=new ZLe(this.core,this.logger),this.pairingTopics=new YLe(this.core,this.logger),this.requests=new JLe(this.core,this.logger)}
14async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}};var tMe=Object.defineProperty,nMe=(e,t,n)=>t in e?tMe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cn=(e,t,n)=>nMe(e,typeof t!="symbol"?t+"":t,n);let rMe=class che extends ALe{constructor(t){super(t),Cn(this,"protocol",ihe),Cn(this,"version",ohe),Cn(this,"name",zO.name),Cn(this,"metadata"),Cn(this,"core"),Cn(this,"logger"),Cn(this,"events",new Dn.EventEmitter),Cn(this,"engine"),Cn(this,"session"),Cn(this,"proposal"),Cn(this,"pendingRequest"),Cn(this,"auth"),Cn(this,"signConfig"),Cn(this,"on",(r,s)=>this.events.on(r,s)),Cn(this,"once",(r,s)=>this.events.once(r,s)),Cn(this,"off",(r,s)=>this.events.off(r,s)),Cn(this,"removeListener",(r,s)=>this.events.removeListener(r,s)),Cn(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),Cn(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"update",async r=>{try{return await this.engine.update(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"request",async r=>{try{return await this.engine.request(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"find",r=>{try{return this.engine.find(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),Cn(this,"authenticate",async(r,s)=>{try{return await this.engine.authenticate(r,s)}catch(i){throw this.logger.error(i.message),i}}),Cn(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),Cn(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),this.name=(t==null?void 0:t.name)||zO.name,this.metadata=$Ne(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const n=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:dLe(vLe({level:(t==null?void 0:t.logger)||zO.logger}));this.core=(t==null?void 0:t.core)||new cLe(t),this.logger=xLe(n,this.name),this.session=new KLe(this.core,this.logger),this.proposal=new VLe(this.core,this.logger),this.pendingRequest=new GLe(this.core,this.logger),this.engine=new HLe(this),this.auth=new eMe(this.core,this.logger)}static async init(t){const n=new che(t);return await n.initialize(),n}get context(){return she(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")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}};var HO,hX;function sMe(){if(hX)return HO;hX=1;const e=SC();HO=s;const t=S().console||{},n={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:p,wrapResponseSerializer:p,wrapErrorSerializer:p,req:g,res:g,err:h};function r(v,x){return Array.isArray(v)?v.filter(function(I){return I!=="!stdSerializers.err"}):v===!0?Object.keys(x):!1}function s(v){v=v||{},v.browser=v.browser||{};const x=v.browser.transmit;if(x&&typeof x.send!="function")throw Error("pino: transmit option must have a send function");const A=v.browser.write||t;v.browser.write&&(v.browser.asObject=!0);const I=v.serializers||{},O=r(v.browser.serialize,I);let N=v.browser.serialize;Array.isArray(v.browser.serialize)&&v.browser.serialize.indexOf("!stdSerializers.err")>-1&&(N=!1);const T=["error","fatal","warn","info","debug","trace"];typeof A=="function"&&(A.error=A.fatal=A.warn=A.info=A.debug=A.trace=A),v.enabled===!1&&(v.level="silent");const P=v.level||"info",_=Object.create(A);_.log||(_.log=m),Object.defineProperty(_,"levelVal",{get:$}),Object.defineProperty(_,"level",{get:R,set:B});const y={transmit:x,serialize:O,asObject:v.browser.asObject,levels:T,timestamp:f(v)};_.levels=s.levels,_.level=P,_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=m,_.serializers=I,_._serialize=O,_._stdErrSerialize=N,_.child=k,x&&(_._logEvent=d());
14function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function R(){return this._level}function B(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,i(y,_,"error","log"),i(y,_,"fatal","error"),i(y,_,"warn","error"),i(y,_,"info","log"),i(y,_,"debug","log"),i(y,_,"trace","log")}function k(D,U){if(!D)throw new Error("missing bindings for child Pino");U=U||{},O&&D.serializers&&(U.serializers=D.serializers);const F=U.serializers;if(O&&F){var K=Object.assign({},I,F),q=v.browser.serialize===!0?Object.keys(K):O;delete D.serializers,c([D],q,K,this._stdErrSerialize)}function H(Z){this._childLevel=(Z._childLevel|0)+1,this.error=l(Z,D,"error"),this.fatal=l(Z,D,"fatal"),this.warn=l(Z,D,"warn"),this.info=l(Z,D,"info"),this.debug=l(Z,D,"debug"),this.trace=l(Z,D,"trace"),K&&(this.serializers=K,this._serialize=q),x&&(this._logEvent=d([].concat(Z._logEvent.bindings,D)))}return H.prototype=this,new H(this)}return _}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers=n,s.stdTimeFunctions=Object.assign({},{nullTime:w,epochTime:C,unixTime:E,isoTime:b});function i(v,x,A,I){const O=Object.getPrototypeOf(x);x[A]=x.levelVal>x.levels.values[A]?m:O[A]?O[A]:t[A]||t[I]||m,o(v,x,A)}function o(v,x,A){!v.transmit&&x[A]===m||(x[A]=(function(I){return function(){const N=v.timestamp(),T=new Array(arguments.length),P=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var _=0;_<T.length;_++)T[_]=arguments[_];if(v.serialize&&!v.asObject&&c(T,this._serialize,this.serializers,this._stdErrSerialize),v.asObject?I.call(P,a(this,A,T,N)):I.apply(P,T),v.transmit){const y=v.transmit.level||x.level,$=s.levels.values[y],R=s.levels.values[A];if(R<$)return;u(this,{ts:N,methodLevel:A,methodValue:R,transmitValue:s.levels.values[v.transmit.level||x.level],send:v.transmit.send,val:x.levelVal},T)}}})(x[A]))}
vendor: 5,226 bytes, line 14
14function a(v,x,A,I){v._serialize&&c(A,v._serialize,v.serializers,v._stdErrSerialize);const O=A.slice();let N=O[0];const T={};I&&(T.time=I),T.level=s.levels.values[x];let P=(v._childLevel|0)+1;if(P<1&&(P=1),N!==null&&typeof N=="object"){for(;P--&&typeof O[0]=="object";)Object.assign(T,O.shift());N=O.length?e(O.shift(),O):void 0}else typeof N=="string"&&(N=e(O.shift(),O));return N!==void 0&&(T.msg=N),T}function c(v,x,A,I){for(const O in v)if(I&&v[O]instanceof Error)v[O]=s.stdSerializers.err(v[O]);else if(typeof v[O]=="object"&&!Array.isArray(v[O]))for(const N in v[O])x&&x.indexOf(N)>-1&&N in A&&(v[O][N]=A[N](v[O][N]))}function l(v,x,A){return function(){const I=new Array(1+arguments.length);I[0]=x;for(var O=1;O<I.length;O++)I[O]=arguments[O-1];return v[A].apply(this,I)}}function u(v,x,A){const I=x.send,O=x.ts,N=x.methodLevel,T=x.methodValue,P=x.val,_=v._logEvent.bindings;c(A,v._serialize||Object.keys(v.serializers),v.serializers,v._stdErrSerialize===void 0?!0:v._stdErrSerialize),v._logEvent.ts=O,v._logEvent.messages=A.filter(function(y){return _.indexOf(y)===-1}),v._logEvent.level.label=N,v._logEvent.level.value=T,I(N,v._logEvent,P),v._logEvent=d(_)}function d(v){return{ts:0,messages:[],bindings:v||[],level:{label:"",value:0}}}function h(v){const x={type:v.constructor.name,msg:v.message,stack:v.stack};for(const A in v)x[A]===void 0&&(x[A]=v[A]);return x}function f(v){return typeof v.timestamp=="function"?v.timestamp:v.timestamp===!1?w:C}function g(){return{}}function p(v){return v}function m(){}function w(){return!1}function C(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function S(){function v(x){return typeof x<"u"&&x}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return v(self)||v(window)||v(this)||{}}}return HO}var J2=sMe();const S6=mf(J2),iMe={level:"info"},TC="custom_context",Jq=1e3*1024;let oMe=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},fX=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const n=new oMe(t);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let n=this.head;for(;n!==null;)t.push(n.value),n=n.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const n=t.value;return t=t.next,{done:!1,value:n}}}}},lhe=class{constructor(t,n=Jq){this.level=t??"error",this.levelValue=J2.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new fX(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,n){n===J2.levels.values.error?console.error(t):n===J2.levels.values.warn?console.warn(t):n===J2.levels.values.debug?console.debug(t):n===J2.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Ao({timestamp:new Date().toISOString(),log:t}));const n=typeof t=="string"?JSON.parse(t).level:t.level;n>=this.levelValue&&this.forwardToConsole(t,n)}getLogs(){return this.logs}clearLogs(){this.logs=new fX(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const n=this.getLogArray();return n.push(Ao({extraMetadata:t})),new Blob(n,{type:"application/json"})}},aMe=class{constructor(t,n=Jq){this.baseChunkLogger=new lhe(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const n=URL.createObjectURL(this.logsToBlob(t)),r=document.createElement("a");r.href=n,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}},cMe=class{constructor(t,n=Jq){this.baseChunkLogger=new lhe(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var lMe=Object.defineProperty,uMe=Object.defineProperties,dMe=Object.getOwnPropertyDescriptors,pX=Object.getOwnPropertySymbols,hMe=Object.prototype.hasOwnProperty,fMe=Object.prototype.propertyIsEnumerable,gX=(e,t,n)=>t in e?lMe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o9=(e,t)=>{for(var n in t||(t={}
14))hMe.call(t,n)&&gX(e,n,t[n]);if(pX)for(var n of pX(t))fMe.call(t,n)&&gX(e,n,t[n]);return e},a9=(e,t)=>uMe(e,dMe(t));function PC(e){return a9(o9({},e),{level:(e==null?void 0:e.level)||iMe.level})}function pMe(e,t=TC){return e[t]||""}function gMe(e,t,n=TC){return e[n]=t,e}function Cc(e,t=TC){let n="";return typeof e.bindings>"u"?n=pMe(e,t):n=e.bindings().context||"",n}function mMe(e,t,n=TC){const r=Cc(e,n);return r.trim()?`${r}/${t}`:t}function pa(e,t,n=TC){const r=mMe(e,t,n),s=e.child({context:r});return gMe(s,r,n)}function wMe(e){var t,n;const r=new aMe((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:S6(a9(o9({},e.opts),{level:"trace",browser:a9(o9({},(n=e.opts)==null?void 0:n.browser),{write:s=>r.write(s)})})),chunkLoggerController:r}}function yMe(e){var t;const n=new cMe((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:S6(a9(o9({},e.opts),{level:"trace"}),n),chunkLoggerController:n}}function bMe(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?wMe(e):yMe(e)}var Rx={exports:{}},mX;function vMe(){return mX||(mX=1,(function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof globalThis<"u"&&globalThis,r=(function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i})();(function(i){(function(o){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof i<"u"&&i||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(y){return y&&DataView.prototype.isPrototypeOf(y)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(y){return y&&u.indexOf(Object.prototype.toString.call(y))>-1};function h(y){if(typeof y!="string"&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(y)||y==="")throw new TypeError('Invalid character in header field name: "'+y+'"');return y.toLowerCase()}function f(y){return typeof y!="string"&&(y=String(y)),y}function g(y){var $={next:function(){var R=y.shift();return{done:R===void 0,value:R}}};return c.iterable&&($[Symbol.iterator]=function(){return $}),$}function p(y){this.map={},y instanceof p?y.forEach(function($,R){this.append(R,$)},this):Array.isArray(y)?y.forEach(function($){if($.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+$.length);this.append($[0],$[1])}
vendor: 4,858 bytes, line 14
14,this):y&&Object.getOwnPropertyNames(y).forEach(function($){this.append($,y[$])},this)}p.prototype.append=function(y,$){y=h(y),$=f($);var R=this.map[y];this.map[y]=R?R+", "+$:$},p.prototype.delete=function(y){delete this.map[h(y)]},p.prototype.get=function(y){return y=h(y),this.has(y)?this.map[y]:null},p.prototype.has=function(y){return this.map.hasOwnProperty(h(y))},p.prototype.set=function(y,$){this.map[h(y)]=f($)},p.prototype.forEach=function(y,$){for(var R in this.map)this.map.hasOwnProperty(R)&&y.call($,this.map[R],R,this)},p.prototype.keys=function(){var y=[];return this.forEach(function($,R){y.push(R)}),g(y)},p.prototype.values=function(){var y=[];return this.forEach(function($){y.push($)}),g(y)},p.prototype.entries=function(){var y=[];return this.forEach(function($,R){y.push([R,$])}),g(y)},c.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(y){if(!y._noBody){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}}function w(y){return new Promise(function($,R){y.onload=function(){$(y.result)},y.onerror=function(){R(y.error)}})}function C(y){var $=new FileReader,R=w($);return $.readAsArrayBuffer(y),R}function E(y){var $=new FileReader,R=w($),B=/charset=([A-Za-z0-9_-]+)/.exec(y.type),k=B?B[1]:"utf-8";return $.readAsText(y,k),R}function b(y){for(var $=new Uint8Array(y),R=new Array($.length),B=0;B<$.length;B++)R[B]=String.fromCharCode($[B]);return R.join("")}function S(y){if(y.slice)return y.slice(0);var $=new Uint8Array(y.byteLength);return $.set(new Uint8Array(y)),$.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(y){this.bodyUsed=this.bodyUsed,this._bodyInit=y,y?typeof y=="string"?this._bodyText=y:c.blob&&Blob.prototype.isPrototypeOf(y)?this._bodyBlob=y:c.formData&&FormData.prototype.isPrototypeOf(y)?this._bodyFormData=y:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)?this._bodyText=y.toString():c.arrayBuffer&&c.blob&&l(y)?(this._bodyArrayBuffer=S(y.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(y)||d(y))?this._bodyArrayBuffer=S(y):this._bodyText=y=Object.prototype.toString.call(y):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof y=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var y=m(this);if(y)return y;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var y=m(this);return y||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(C);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var y=m(this);if(y)return y;if(this._bodyBlob)return E(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(b(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function A(y){var $=y.toUpperCase();return x.indexOf($)>-1?$:y}function I(y,$){if(!(this instanceof I))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');$=$||{};var R=$.body;if(y instanceof I){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,$.headers||(this.headers=new p(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!R&&y._bodyInit!=null&&(R=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=$.credentials||this.credentials||"same-origin",($.headers||!this.headers)&&(this.headers=new p($.headers)),this.method=A($.method||this.method||"GET"),this.mode=$.mode||this.mode||null,this.signal=$.signal||this.signal||(function(){if("AbortController"in a){var D=new AbortController;return D.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&R)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(R),(this.method==="GET"||this.method==="HEAD")&&($.cache==="no-store"||$.cac
vendor: 22,812 bytes, lines 14-15
14he==="no-cache")){var B=/([?&])_=[^&]*/;if(B.test(this.url))this.url=this.url.replace(B,"$1_="+new Date().getTime());else{var k=/\?/;this.url+=(k.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}I.prototype.clone=function(){return new I(this,{body:this._bodyInit})};function O(y){var $=new FormData;return y.trim().split("&").forEach(function(R){if(R){var B=R.split("="),k=B.shift().replace(/\+/g," "),D=B.join("=").replace(/\+/g," ");$.append(decodeURIComponent(k),decodeURIComponent(D))}}),$}function N(y){var $=new p,R=y.replace(/\r?\n[\t ]+/g," ");return R.split("\r").map(function(B){return B.indexOf(` 15`)===0?B.substr(1,B.length):B}).forEach(function(B){var k=B.split(":"),D=k.shift().trim();if(D){var U=k.join(":").trim();try{$.append(D,U)}catch(F){console.warn("Response "+F.message)}}}),$}v.call(I.prototype);function T(y,$){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if($||($={}),this.type="default",this.status=$.status===void 0?200:$.status,this.status<200||this.status>599)throw new 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=$.statusText===void 0?"":""+$.statusText,this.headers=new p($.headers),this.url=$.url||"",this._initBody(y)}v.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},T.error=function(){var y=new T(null,{status:200,statusText:""});return y.ok=!1,y.status=0,y.type="error",y};var P=[301,302,303,307,308];T.redirect=function(y,$){if(P.indexOf($)===-1)throw new RangeError("Invalid status code");return new T(null,{status:$,headers:{location:y}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function($,R){this.message=$,this.name=R;var B=Error($);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function _(y,$){return new Promise(function(R,B){var k=new I(y,$);if(k.signal&&k.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var D=new XMLHttpRequest;function U(){D.abort()}D.onload=function(){var q={statusText:D.statusText,headers:N(D.getAllResponseHeaders()||"")};k.url.indexOf("file://")===0&&(D.status<200||D.status>599)?q.status=200:q.status=D.status,q.url="responseURL"in D?D.responseURL:q.headers.get("X-Request-URL");var H="response"in D?D.response:D.responseText;setTimeout(function(){R(new T(H,q))},0)},D.onerror=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)},D.ontimeout=function(){setTimeout(function(){B(new TypeError("Network request timed out"))},0)},D.onabort=function(){setTimeout(function(){B(new o.DOMException("Aborted","AbortError"))},0)};function F(q){try{return q===""&&a.location.href?a.location.href:q}catch{return q}}if(D.open(k.method,F(k.url),!0),k.credentials==="include"?D.withCredentials=!0:k.credentials==="omit"&&(D.withCredentials=!1),"responseType"in D&&(c.blob?D.responseType="blob":c.arrayBuffer&&(D.responseType="arraybuffer")),$&&typeof $.headers=="object"&&!($.headers instanceof p||a.Headers&&$.headers instanceof a.Headers)){var K=[];Object.getOwnPropertyNames($.headers).forEach(function(q){K.push(h(q)),D.setRequestHeader(q,f($.headers[q]))}),k.headers.forEach(function(q,H){K.indexOf(H)===-1&&D.setRequestHeader(H,q)})}else k.headers.forEach(function(q,H){D.setRequestHeader(H,q)});k.signal&&(k.signal.addEventListener("abort",U),D.onreadystatechange=function(){D.readyState===4&&k.signal.removeEventListener("abort",U)}),D.send(typeof k._bodyInit>"u"?null:k._bodyInit)})}return _.polyfill=!0,a.fetch||(a.fetch=_,a.Headers=p,a.Request=I,a.Response=T),o.Headers=p,o.Request=I,o.Response=T,o.fetch=_,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=n.fetch?n:r;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t})(Rx,Rx.exports)),Rx.exports}var EMe=vMe();const wX=mf(EMe);var CMe=Object.defineProperty,$Me=Object.defineProperties,xMe=Object.getOwnPropertyDescriptors,yX=Object.getOwnPropertySymbols,IMe=Object.prototype.hasOwnProperty,SMe=Object.prototype.propertyIsEnumerable,bX=(e,t,n)=>t in e?CMe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vX=(e,t)=>{for(var n in t||(t={}))IMe.call(t,n)&&bX(e,n,t[n]);if(yX)for(var n of yX(t))SMe.call(t,n)&&bX(e,n,t[n]);return e},EX=(e,t)=>$Me(e,xMe(t));const AMe={Accept:"application/json","Content-Type":"application/json"},_Me="POST",CX={headers:AMe,method:_Me},$X=10;let Or=class{constructor(t,n=!1){if(this.url=t,this.disableProviderPing=n,this.events=new Dn.EventEmitter,this.isAvailable=!1,this.registering=!1,!PJ(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=n}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t){this.isAvailable||await this.register();try{const n=Ao(t),r=await(await wX(this.url,EX(vX({},CX),{body:n}))).json();this.onPayload({data:r})}catch(n){this.onError(t.id,n)}}async register(t=this.url){if(!PJ(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);if(this.registering){const n=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=n||this.events.listenerCount("open")>=n)&&this.events.setMaxListeners(n+1),new Promise((r,s)=>{this.events.once("register_error",i=>{this.resetMaxListeners(),s(i)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));r()})})}this.url=t,this.registering=!0;try{if(!this.disableProviderPing){const n=Ao({id:1,jsonrpc:"2.0",method:"test",params:[]});await wX(t,EX(vX({},CX),{body:n}))}this.onOpen()}catch(n){const r=this.parseError(n);throw this.events.emit("register_error",r),this.onClose(),r}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(typeof t.data>"u")return;const n=typeof t.data=="string"?ul(t.data):t.data;this.events.emit("payload",n)}onError(t,n){const r=this.parseError(n),s=r.message||r.toString(),i=yf(t,s);this.events.emit("payload",i)}parseError(t,n=this.url){return Ude(t,n,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>$X&&this.events.setMaxListeners($X)}};const xX="error",NMe="wss://relay.walletconnect.org",TMe="wc",PMe="universal_provider",Bx=`${TMe}@2:${PMe}:`,uhe="https://rpc.walletconnect.org/v1/",X2="generic",OMe=`${uhe}bundler`,Uu={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function Xq(e){return e==null||typeof e!="object"&&typeof e!="function"}function dhe(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function hhe(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const kMe="[object RegExp]",fhe="[object String]",phe="[object Number]",ghe="[object Boolean]",mhe="[object Arguments]",RMe="[object Symbol]",BMe="[object Date]",DMe="[object Map]",UMe="[object Set]",LMe="[object Array]",MMe="[object ArrayBuffer]",jMe="[object Object]",FMe="[object DataView]",zMe="[object Uint8Array]",qMe="[object Uint8ClampedArray]",WMe="[object Uint16Array]",HMe="[object Uint32Array]",VMe="[object Int8Array]",KMe="[object Int16Array]",GMe="[object Int32Array]",ZMe="[object Float32Array]",YMe="[object Float64Array]";function Qq(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function JMe(e,t){return dv(e,void 0,e,new Map,t)}function dv(e,t,n,r=new Map,s=void 0){const i=s==null?void 0:s(e,t,n,r);if(i!=null)return i;if(Xq(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const o=new Array(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=dv(e[a],a,n,r,s);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;r.set(e,o);for(const[a,c]of e)o.set(a,dv(c,a,n,r,s));return o}if(e instanceof Set){const o=new Set;r.set(e,o);for(const a of e)o.add(dv(a,void 0,n,r,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(Qq(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=dv(e[a],a,n,r,s);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,o),J1(o,e,n,r,s),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return r.set(e,o),J1(o,e,n,r,s),o}if(e instanceof Blob){const o=new Blob([e],{type:e.type});return r.set(e,o),J1(o,e,n,r,s),o}if(e instanceof Error){const o=new e.constructor;return r.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,J1(o,e,n,r,s),o}if(typeof e=="object"&&XMe(e)){const o=Object.create(Object.getPrototypeOf(e));return r.set(e,o),J1(o,e,n,r,s),o}return e}function J1(e,t,n=e,r,s){const i=[...Object.keys(t),...dhe(t)];for(let o=0;o<i.length;o++){const a=i[o],c=Object.getOwnPropertyDescriptor(e,a);(c==null||c.writable)&&(e[a]=dv(t[a],a,n,r,s))}}function XMe(e){switch(hhe(e)){case mhe:case LMe:case MMe:case FMe:case ghe:case BMe:case ZMe:case YMe:case VMe:case KMe:case GMe:case DMe:case phe:case jMe:case kMe:case UMe:case fhe:case RMe:case zMe:case qMe:case WMe:case HMe:return!0;default:return!1}}function QMe(e,t){return JMe(e,(n,r,s,i)=>{if(typeof e=="object")switch(Object.prototype.toString.call(e)){case phe:case fhe:case ghe:{const o=new e.constructor(e==null?void 0:e.valueOf());return J1(o,e),o}case mhe:{const o={};return J1(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}})}function IX(e){return QMe(e)}function SX(e){return e!==null&&typeof e=="object"&&hhe(e)==="[object Arguments]"}function AX(e){return typeof e=="object"&&e!==null}function eje(){}function tje(e){return Qq(e)}function nje(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){const r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function rje(e){if(Xq(e))return e;if(Array.isArray(e)||Qq(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e),n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){const r=new n(e);return r.lastIndex=e.lastIndex,r}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){const r=new n(e.message);return r.stack=e.stack,r.name=e.name,r.cause=e.cause,r}if(typeof File<"u"&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e=="object"){const r=Object.create(t);return Object.assign(r,e)}return e}function sje(e,...t){const n=t.slice(0,-1),r=t[t.length-1];let s=e;for(let i=0;i<n.length;i++){const o=n[i];s=yL(s,o,r,new Map)}return s}function yL(e,t,n,r){if(Xq(e)&&(e=Object(e)),t==null||typeof t!="object")return e;if(r.has(t))return rje(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let i=0;i<t.length;i++)t[i]=t[i]??void 0}const s=[...Object.keys(t),...dhe(t)];for(let i=0;i<s.length;i++){const o=s[i];let a=t[o],c=e[o];if(SX(a)&&(a={...a}),SX(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=IX(a)),Array.isArray(a))if(typeof c=="object"&&c!=null){const u=[],d=Reflect.ownKeys(c);for(let h=0;h<d.length;h++){const f=d[h];u[f]=c[f]}c=u}else c=[];const l=n(c,a,o,e,t,r);l!=null?e[o]=l:Array.isArray(a)||AX(c)&&AX(a)?e[o]=yL(c,a,n,r):c==null&&nje(a)?e[o]=yL({},a,n,r):c==null&&tje(a)?e[o]=IX(a):(c===void 0||a!==void 0)&&(e[o]=a)}return e}function ije(e,...t){return sje(e,...t,eje)}var oje=Object.defineProperty,aje=Object.defineProperties,cje=Object.getOwnPropertyDescriptors,_X=Object.getOwnPropertySymbols,lje=Object.prototype.hasOwnProperty,uje=Object.prototype.propertyIsEnumerable,NX=(e,t,n)=>t in e?oje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dx=(e,t)=>{for(var n in t||(t={}))lje.call(t,n)&&NX(e,n,t[n]);if(_X)for(var n of _X(t))uje.call(t,n)&&NX(e,n,t[n]);return e},dje=(e,t)=>aje(e,cje(t));function dl(e,t,n){var r;const s=Rv(e);return((r=t.rpcMap)==null?void 0:r[s.reference])||`${uhe}?chainId=${s.namespace}:${s.reference}&projectId=${n}`}function sb(e){return e.includes(":")?e.split(":")[1]:e}function whe(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function hje(e,t){const n=Object.keys(t.namespaces).filter(s=>s.includes(e));if(!n.length)return[];const r=[];return n.forEach(s=>{const i=t.namespaces[s].accounts;r.push(...i)}),r}function TX(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>{var r,s;return((r=n==null?void 0:n.chains)==null?void 0:r.length)&&((s=n==null?void 0:n.chains)==null?void 0:s.length)>0}))}function Ux(e={},t={}){const n=TX(PX(e)),r=TX(PX(t));return ije(n,r)}function PX(e){var t,n,r,s,i;const o={};if(!qh(e))return o;for(const[a,c]of Object.entries(e)){const l=r7(a)?[a]:c.chains,u=c.methods||[],d=c.events||[],h=c.rpcMap||{},f=uv(a);o[f]=dje(Dx(Dx({},o[f]),c),{chains:zh(l,(t=o[f])==null?void 0:t.chains),methods:zh(u,(n=o[f])==null?void 0:n.methods),events:zh(d,(r=o[f])==null?void 0:r.events)}),(qh(h)||qh(((s=o[f])==null?void 0:s.rpcMap)||{}))&&(o[f].rpcMap=Dx(Dx({},h),(i=o[f])==null?void 0:i.rpcMap))}return o}function OX(e){return e.includes(":")?e.split(":")[2]:e}function kX(e){const t={};for(const[n,r]of Object.entries(e)){const s=r.methods||[],i=r.events||[],o=r.accounts||[],a=r7(n)?[n]:r.chains?r.chains:whe(r.accounts);t[n]={chains:a,methods:s,events:i,accounts:o}}return t}function VO(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const yhe={},Gn=e=>yhe[e],KO=(e,t)=>{yhe[e]=t};var fje=Object.defineProperty,RX=Object.getOwnPropertySymbols,pje=Object.prototype.hasOwnProperty,gje=Object.prototype.propertyIsEnumerable,BX=(e,t,n)=>t in e?fje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DX=(e,t)=>{for(var n in t||(t={}))pje.call(t,n)&&BX(e,n,t[n]);if(RX)for(var n of RX(t))gje.call(t,n)&&BX(e,n,t[n]);return e};const UX="eip155",mje=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],wje=e=>e&&e.startsWith("0x")?BigInt(e).toString(10):e,GO=e=>e&&e.startsWith("0x")?e:`0x${BigInt(e).toString(16)}`,LX=e=>Object.keys(e).filter(t=>mje.includes(t)).reduce((t,n)=>(t[n]=e[n],t),{}),yje=(e,t,n)=>{const{sessionProperties:r={},scopedProperties:s={}}=e,i={};if(!qh(s)&&!qh(r))return;const o=LX(r);for(const a of n){const c=wje(a);if(!c)continue;i[GO(c)]=o;const l=s==null?void 0:s[`${UX}:${c}`];if(l){const u=l==null?void 0:l[`${UX}:${c}:${t}`];i[GO(c)]=DX(DX({},i[GO(c)]),LX(u||l))}}for(const[a,c]of Object.entries(i))Object.keys(c).length===0&&delete i[a];return Object.keys(i).length>0?i:void 0};var bje=Object.defineProperty,vje=(e,t,n)=>t in e?bje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gb=(e,t,n)=>vje(e,typeof t!="symbol"?t+"":t,n);let Eje=class{constructor(t){Gb(this,"name","polkadot"),Gb(this,"client"),Gb(this,"httpProviders"),Gb(this,"events"),Gb(this,"namespace"),Gb(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=sb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var Cje=Object.defineProperty,$je=Object.defineProperties,xje=Object.getOwnPropertyDescriptors,MX=Object.getOwnPropertySymbols,Ije=Object.prototype.hasOwnProperty,Sje=Object.prototype.propertyIsEnumerable,bL=(e,t,n)=>t in e?Cje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jX=(e,t)=>{for(var n in t||(t={}))Ije.call(t,n)&&bL(e,n,t[n]);if(MX)for(var n of MX(t))Sje.call(t,n)&&bL(e,n,t[n]);return e},FX=(e,t)=>$je(e,xje(t)),Zb=(e,t,n)=>bL(e,typeof t!="symbol"?t+"":t,n);let Aje=class{constructor(t){Zb(this,"name","eip155"),Zb(this,"client"),Zb(this,"chainId"),Zb(this,"namespace"),Zb(this,"httpProviders"),Zb(this,"events"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(parseInt(t),n),this.chainId=parseInt(t),this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,n){const r=n||dl(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=parseInt(sb(n));t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}async handleSwitchChain(t){var n,r;let s=t.request.params?(n=t.request.params[0])==null?void 0:n.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const i=parseInt(s,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(r=this.namespace.chains)==null?void 0:r[0]}),this.setDefaultChain(`${i}`);else throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var n,r,s,i,o;const a=(r=(n=t.request)==null?void 0:n.params)==null?void 0:r[0],c=((i=(s=t.request)==null?void 0:s.params)==null?void 0:i[1])||[];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const l=this.client.session.get(t.topic),u=((o=l==null?void 0:l.sessionProperties)==null?void 0:o.capabilities)||{},d=`${a}${c.join(",")}`,h=u==null?void 0:u[d];if(h)return h;let f;try{f=yje(l,a,c)}catch(p){console.warn("Failed to extract capabilities from session",p)}if(f)return f;const g=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:FX(jX({},l.sessionProperties||{}),{capabilities:FX(jX({},u||{}),{[d]:g})})})}catch(p){console.warn("Failed to update session with capabilities",p)}return g}async getCallStatus(t){var n,r;const s=this.client.session.get(t.topic),i=(n=s.sessionProperties)==null?void 0:n.bundler_name;if(i){const a=this.getBundlerUrl(t.chainId,i);try{return await this.getUserOperationReceipt(a,t)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(r=s.sessionProperties)==null?void 0:r.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,n){var r;const s=new URL(t),i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_n("eth_getUserOperationReceipt",[(r=n.request.params)==null?void 0:r[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}
15getBundlerUrl(t,n){return`${OMe}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${n}`}};var _je=Object.defineProperty,Nje=(e,t,n)=>t in e?_je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yb=(e,t,n)=>Nje(e,typeof t!="symbol"?t+"":t,n);let Tje=class{constructor(t){Yb(this,"name","solana"),Yb(this,"client"),Yb(this,"httpProviders"),Yb(this,"events"),Yb(this,"namespace"),Yb(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=sb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var Pje=Object.defineProperty,Oje=(e,t,n)=>t in e?Pje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jb=(e,t,n)=>Oje(e,typeof t!="symbol"?t+"":t,n);let kje=class{constructor(t){Jb(this,"name","cosmos"),Jb(this,"client"),Jb(this,"httpProviders"),Jb(this,"events"),Jb(this,"namespace"),Jb(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=sb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var Rje=Object.defineProperty,Bje=(e,t,n)=>t in e?Rje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xb=(e,t,n)=>Bje(e,typeof t!="symbol"?t+"":t,n);let Dje=class{constructor(t){Xb(this,"name","algorand"),Xb(this,"client"),Xb(this,"httpProviders"),Xb(this,"events"),Xb(this,"namespace"),Xb(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){if(!this.httpProviders[t]){const r=n||dl(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;t[n]=this.createHttpProvider(n,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new or(new Or(r,Gn("disableProviderPing")))}};var Uje=Object.defineProperty,Lje=(e,t,n)=>t in e?Uje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
15):e[t]=n,Qb=(e,t,n)=>Lje(e,typeof t!="symbol"?t+"":t,n);let Mje=class{constructor(t){Qb(this,"name","cip34"),Qb(this,"client"),Qb(this,"httpProviders"),Qb(this,"events"),Qb(this,"namespace"),Qb(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{const r=this.getCardanoRPCUrl(n),s=sb(n);t[s]=this.createHttpProvider(s,r)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}getCardanoRPCUrl(t){const n=this.namespace.rpcMap;if(n)return n[t]}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||this.getCardanoRPCUrl(t);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var jje=Object.defineProperty,Fje=(e,t,n)=>t in e?jje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,e2=(e,t,n)=>Fje(e,typeof t!="symbol"?t+"":t,n);let zje=class{constructor(t){e2(this,"name","elrond"),e2(this,"client"),e2(this,"httpProviders"),e2(this,"events"),e2(this,"namespace"),e2(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=sb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var qje=Object.defineProperty,Wje=(e,t,n)=>t in e?qje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t2=(e,t,n)=>Wje(e,typeof t!="symbol"?t+"":t,n);let Hje=class{constructor(t){t2(this,"name","multiversx"),t2(this,"client"),t2(this,"httpProviders"),t2(this,"events"),t2(this,"namespace"),t2(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=sb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var Vje=Object.defineProperty,Kje=(e,t,n)=>t in e?Vje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
15):e[t]=n,n2=(e,t,n)=>Kje(e,typeof t!="symbol"?t+"":t,n);let Gje=class{constructor(t){n2(this,"name","near"),n2(this,"client"),n2(this,"httpProviders"),n2(this,"events"),n2(this,"namespace"),n2(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){if(this.chainId=t,!this.httpProviders[t]){const r=n||dl(`${this.name}:${t}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;t[n]=this.createHttpProvider(n,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace);return typeof r>"u"?void 0:new or(new Or(r,Gn("disableProviderPing")))}};var Zje=Object.defineProperty,Yje=(e,t,n)=>t in e?Zje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r2=(e,t,n)=>Yje(e,typeof t!="symbol"?t+"":t,n);let Jje=class{constructor(t){r2(this,"name","tezos"),r2(this,"client"),r2(this,"httpProviders"),r2(this,"events"),r2(this,"namespace"),r2(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){if(this.chainId=t,!this.httpProviders[t]){const r=n||dl(`${this.name}:${t}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{t[n]=this.createHttpProvider(n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace);return typeof r>"u"?void 0:new or(new Or(r))}};var Xje=Object.defineProperty,Qje=(e,t,n)=>t in e?Xje(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,s2=(e,t,n)=>Qje(e,typeof t!="symbol"?t+"":t,n);let eFe=class{constructor(t){s2(this,"name",X2),s2(this,"client"),s2(this,"httpProviders"),s2(this,"events"),s2(this,"namespace"),s2(this,"chainId"),this.namespace=t.namespace,this.events=Gn("events"),this.client=Gn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Uu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){var t,n;const r={};return(n=(t=this.namespace)==null?void 0:t.accounts)==null||n.forEac
vendor: 12,610 bytes, line 15
15h(s=>{const i=Rv(s);r[`${i.namespace}:${i.reference}`]=this.createHttpProvider(s)}),r}getHttpProvider(t){const n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||dl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Gn("disableProviderPing")))}};var tFe=Object.defineProperty,nFe=Object.defineProperties,rFe=Object.getOwnPropertyDescriptors,zX=Object.getOwnPropertySymbols,sFe=Object.prototype.hasOwnProperty,iFe=Object.prototype.propertyIsEnumerable,vL=(e,t,n)=>t in e?tFe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lx=(e,t)=>{for(var n in t||(t={}))sFe.call(t,n)&&vL(e,n,t[n]);if(zX)for(var n of zX(t))iFe.call(t,n)&&vL(e,n,t[n]);return e},ZO=(e,t)=>nFe(e,rFe(t)),kl=(e,t,n)=>vL(e,typeof t!="symbol"?t+"":t,n);let oFe=class bhe{constructor(t){kl(this,"client"),kl(this,"namespaces"),kl(this,"optionalNamespaces"),kl(this,"sessionProperties"),kl(this,"scopedProperties"),kl(this,"events",new Bu),kl(this,"rpcProviders",{}),kl(this,"session"),kl(this,"providerOpts"),kl(this,"logger"),kl(this,"uri"),kl(this,"disableProviderPing",!1),this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:S6(PC({level:(t==null?void 0:t.logger)||xX})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const n=new bhe(t);return await n.initialize(),n}async request(t,n,r){const[s,i]=this.validateChain(n);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Lx({},t),chainId:`${s}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(t,n,r,s){const i=new Date().getTime();this.request(t,r,s).then(o=>n(null,Pi(i,o))).catch(o=>n(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:jr("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,n){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:r,response:s}=await this.client.authenticate(t,n);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await s();if(this.session=i.session,this.session){const o=kX(this.session.namespaces);this.namespaces=Ux(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}removeListener(t,n){this.events.removeListener(t,n)}off(t,n){this.events.off(t,n)}get isWalletConnect(){return!0}async pair(t){const{uri:n,approval:r}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});n&&(this.uri=n,this.events.emit("display_uri",n));const s=await r();this.session=s;const i=kX(s.namespaces);return this.namespaces=Ux(this.namespaces,i),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,n){try{if(!this.session)return;const[r,s]=this.validateChain(t),i=this.getProvider(r);i.name===X2?i.setDefaultChain(`${r}:${s}`,n):i.setDefaultChain(s,n)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const n=this.client.pairing.getAll();if(mu(n)){for(const r of n)t.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${n.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,n;if(this.client=this.providerOpts.client||await rMe.init({core:this.providerOpts.core,logger:this.providerOpts.logger||xX,relayUrl:this.providerOpts.relayUrl||NMe,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.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error("Failed to get session",r),new Error(`The provided session: ${(n=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:n.topic} doesn't exist in the Sign client`)}else{const r=this.client.session.getAll();this.session=r[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(n=>uv(n)))];KO("client",this.client),KO("events",this.events),KO("disableProviderPing",this.disableProviderPing),t.forEach(n=>{if(!this.session)return;const r=hje(n,this.session);if((r==null?void 0:r.length)===0)return;const s=whe(r),i=Ux(this.namespaces,this.optionalNamespaces),o=ZO(Lx({},i[n]),{accounts:r,chains:s});switch(n){case"eip155":this.rpcProviders[n]=new Aje({namespace:o});break;case"algorand":this.rpcProviders[n]=new Dje({namespace:o});break;case"solana":this.rpcProviders[n]=new Tje({namespace:o});break;case"cosmos":this.rpcProviders[n]=new kje({namespace:o});break;case"polkadot":this.rpcProviders[n]=new Eje({namespace:o});break;case"cip34":this.rpcProviders[n]=new Mje({namespace:o});break;case"elrond":this.rpcProviders[n]=new zje({namespace:o});break;case"multiversx":this.rpcProviders[n]=new Hje({namespace:o});break;case"near":this.rpcProviders[n]=new Gje({namespace:o});break;case"tezos":this.rpcProviders[n]=new Jje({namespace:o});break;default:this.rpcProviders[X2]?this.rpcProviders[X2].updateNamespace(o):this.rpcProviders[X2]=new eFe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var n;const{topic:r}=t;r===((n=this.session)==null?void 0:n.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var n;const{params:r,topic:s}=t;if(s!==((n=this.session)==null?void 0:n.topic))return;const{event:i}=r;if(i.name==="accountsChanged"){const o=i.data;o&&mu(o)&&this.events.emit("accountsChanged",o.map(OX))}else if(i.name==="chainChanged"){const o=r.chainId,a=r.event.data,c=uv(o),l=VO(o)!==VO(a)?`${c}:${VO(a)}`:o;this.onChainChanged(l)}else this.events.emit(i.name,i.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:n})=>{var r,s;if(t!==((r=this.session)==null?void 0:r.topic))return;const{namespaces:i}=n,o=(s=this.client)==null?void 0:s.session.get(t);this.session=ZO(Lx({},o),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:n})}),this.client.on("session_delete",async t=>{var n;t.topic===((n=this.session)==null?void 0:n.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",ZO(Lx({},jr("USER_DISCONNECTED")),{data:t.topic})))}),this.on(Uu.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[X2]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var n;this.getProvider(t).updateNamespace((n=this.session)==null?void 0:n.namespaces[t])})}setNamespaces(t){const{namespaces:n={},optionalNamespaces:r={},sessionProperties:s,scopedProperties:i}=t;this.optionalNamespaces=Ux(n,r),this.sessionProperties=s,this.scopedProperties=i}validateChain(t){const[n,r]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[n,r];if(n&&!Object.keys(this.namespaces||{}).map(o=>uv(o)).includes(n))throw new Error(`Namespace '${n}' is not configured. Please call connect() first with namespace config.`);if(n&&r)return[n,r];const s=uv(Object.keys(this.namespaces)[0]),i=this.rpcProviders[s].getDefaultChain();return[s,i]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,n=!1){if(!this.namespaces)return;const[r,s]=this.validateChain(t);if(!s)return;this.updateNamespaceChain(r,s),this.events.emit("chainChanged",s);const i=this.getProvider(r).getDefaultChain();n||this.getProvider(r).setDefaultChain(s),this.emitAccountsChangedOnChainChange({namespace:r,previousChainId:i,newChainId:t}),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:n,newChainId:r}){var s,i;try{if(n===r)return;const o=(i=(s=this.session)==null?void 0:s.namespaces[t])==null?void 0:i.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${r}:`)).map(OX);if(!mu(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn("Failed to emit accountsChanged on chain change",o)}}updateNamespaceChain(t,n){if(!this.namespaces)return;const r=this.namespaces[t]?t:`${t}:${n}`,s={chains:[],methods:[],events:[],defaultChain:n};this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=n):this.namespaces[r]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,n){var r;const s=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.setItem(`${Bx}/${t}${s}`,n)}async getFromStore(t){var n;const r=((n=this.session)==null?void 0:n.topic)||"";return await this.client.core.storage.getItem(`${Bx}/${t}${r}`)}async deleteFromStore(t){var n;const r=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.removeItem(`${Bx}/${t}${r}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const n=await this.client.core.storage.getKeys();for(const r of n)r.startsWith(Bx)&&await this.client.core.storage.removeItem(r)}catch(n){this.logger.warn("Failed to cleanup storage",n)}}};const aFe=oFe,cFe="wc",lFe="ethereum_provider",uFe=`${cFe}@2:${lFe}:`,dFe="https://rpc.walletconnect.org/v1/",EL=["eth_sendTransaction","personal_sign"],hFe=["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"],CL=["chainChanged","accountsChanged"],fFe=["chainChanged","accountsChanged","message","disconnect","connect"],pFe=async()=>{const{createAppKit:e}=await te(()=>Promise.resolve().then(()=>Pxt),void 0);return e};var gFe=Object.defineProperty,mFe=Object.defineProperties,wFe=Object.getOwnPropertyDescriptors,qX=Object.getOwnPropertySymbols,yFe=Object.prototype.hasOwnProperty,bFe=Object.prototype.propertyIsEnumerable,$L=(e,t,n)=>t in e?gFe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z1=(e,t)=>{for(var n in t||(t={}
15))yFe.call(t,n)&&$L(e,n,t[n]);if(qX)for(var n of qX(t))bFe.call(t,n)&&$L(e,n,t[n]);return e},D3=(e,t)=>mFe(e,wFe(t)),Bc=(e,t,n)=>$L(e,typeof t!="symbol"?t+"":t,n);function c9(e){return Number(e[0].split(":")[1])}function Mx(e){return`0x${e.toString(16)}`}function vFe(e){const{chains:t,optionalChains:n,methods:r,optionalMethods:s,events:i,optionalEvents:o,rpcMap:a}=e;if(!mu(t))throw new Error("Invalid chains");const c={chains:t,methods:r||EL,events:i||CL,rpcMap:z1({},t.length?{[c9(t)]:a[c9(t)]}:{})},l=i==null?void 0:i.filter(f=>!CL.includes(f)),u=r==null?void 0:r.filter(f=>!EL.includes(f));if(!n&&!o&&!s&&!(l!=null&&l.length)&&!(u!=null&&u.length))return{required:t.length?c:void 0};const d=(l==null?void 0:l.length)&&(u==null?void 0:u.length)||!n,h={chains:[...new Set(d?c.chains.concat(n||[]):n)],methods:[...new Set(c.methods.concat(s!=null&&s.length?s:hFe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:fFe))],rpcMap:a};return{required:t.length?c:void 0,optional:n.length?h:void 0}}let WWt=class vhe{constructor(){Bc(this,"events",new Dn.EventEmitter),Bc(this,"namespace","eip155"),Bc(this,"accounts",[]),Bc(this,"signer"),Bc(this,"chainId",1),Bc(this,"modal"),Bc(this,"rpc"),Bc(this,"STORAGE_KEY",uFe),Bc(this,"on",(t,n)=>(this.events.on(t,n),this)),Bc(this,"once",(t,n)=>(this.events.once(t,n),this)),Bc(this,"removeListener",(t,n)=>(this.events.removeListener(t,n),this)),Bc(this,"off",(t,n)=>(this.events.off(t,n),this)),Bc(this,"parseAccount",t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t),this.signer={},this.rpc={}}static async init(t){const n=new vhe;return await n.initialize(t),n}async request(t,n){return await this.signer.request(t,this.formatChainId(this.chainId),n)}sendAsync(t,n,r){this.signer.sendAsync(t,n,this.formatChainId(this.chainId),r)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){var n;if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:r,optional:s}=vFe(this.rpc);try{const i=await new Promise(async(a,c)=>{var l,u;this.rpc.showQrModal&&((l=this.modal)==null||l.open(),(u=this.modal)==null||u.subscribeState(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))}));const d=t!=null&&t.scopedProperties?{[this.namespace]:t.scopedProperties}:void 0;await this.signer.connect(D3(z1({namespaces:z1({},r&&{[this.namespace]:r})},s&&{optionalNamespaces:{[this.namespace]:s}}),{pairingTopic:t==null?void 0:t.pairingTopic,scopedProperties:d})).then(h=>{a(h)}).catch(h=>{var f;(f=this.modal)==null||f.showErrorMessage("Unable to connect"),c(new Error(h.message))})});if(!i)return;const o=EY(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Mx(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{(n=this.modal)==null||n.close()}}async authenticate(t,n){var r;if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const s=await new Promise(async(o,a)=>{var c,l;this.rpc.showQrModal&&((c=this.modal)==null||c.open(),(l=this.modal)==null||l.subscribeState(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(D3(z1({},t),{chains:this.rpc.chains}),n).then(u=>{o(u)}).catch(u=>{var d;(d=this.modal)==null||d.showErrorMessage("Unable to connect"),a(new Error(u.message))})}),i=s.session;if(i){const o=EY(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:Mx(this.chainId)})}return s}catch(s){throw this.signer.logger.error(s),s}finally{(r=this.modal)==null||r.close()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}
15registerEventListeners(){this.signer.on("session_event",t=>{const{params:n}=t,{event:r}=n;r.name==="accountsChanged"?(this.accounts=this.parseAccounts(r.data),this.events.emit("accountsChanged",this.accounts)):r.name==="chainChanged"?this.setChainId(this.formatChainId(r.data)):this.events.emit(r.name,r.data),this.events.emit("session_event",t)}),this.signer.on("accountsChanged",t=>{this.accounts=this.parseAccounts(t),this.events.emit("accountsChanged",this.accounts)}),this.signer.on("chainChanged",t=>{const n=parseInt(t);this.chainId=n,this.events.emit("chainChanged",Mx(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",D3(z1({},jr("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const n=t.filter(r=>this.isCompatibleChainId(r)).map(r=>this.parseChainId(r));n.length&&(this.chainId=n[0],this.events.emit("chainChanged",Mx(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const n=this.parseChainId(t);this.chainId=n,this.switchEthereumChain(n)}}parseAccountId(t){const[n,r,s]=t.split(":");return{chainId:`${n}:${r}`,address:s}}setAccounts(t){this.accounts=t.filter(n=>this.parseChainId(this.parseAccountId(n).chainId)===this.chainId).map(n=>this.parseAccountId(n).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var n,r;const s=(n=t==null?void 0:t.chains)!=null?n:[],i=(r=t==null?void 0:t.optionalChains)!=null?r:[],o=s.concat(i);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=s.length?(t==null?void 0:t.methods)||EL:[],c=s.length?(t==null?void 0:t.events)||CL:[],l=(t==null?void 0:t.optionalMethods)||[],u=(t==null?void 0:t.optionalEvents)||[],d=(t==null?void 0:t.rpcMap)||this.buildRpcMap(o,t.projectId),h=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(f=>this.formatChainId(f)),optionalChains:i.map(f=>this.formatChainId(f)),methods:a,events:c,optionalMethods:l,optionalEvents:u,rpcMap:d,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:h,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,n){const r={};return t.forEach(s=>{r[s]=this.getRpcUrl(s,n)}),r}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?c9(this.rpc.chains):c9(this.rpc.optionalChains),this.signer=await aFe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storage:t.storage,storageOptions:t.storageOptions,customStoragePrefix:t.customStoragePrefix,telemetryEnabled:t.telemetryEnabled,logger:t.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let n;try{const r=await pFe(),{convertWCMToAppKitOptions:s}=await Promise.resolve().then(function(){return TFe}),i=s(D3(z1({},this.rpc.qrModalOptions),{chains:[...new Set([...this.rpc.chains,...this.rpc.optionalChains])],metadata:this.rpc.metadata,projectId:this.rpc.projectId}));if(!i.networks.length)throw new Error("No networks found for WalletConnect·");n=r(D3(z1({},i),{universalProvider:this.signer,manualWCControl:!0}))}catch(r){throw console.warn(r),new Error("To use QR modal, please install @reown/appkit package")}if(n)try{this.modal=n}catch(r){throw this.signer.logger.error(r),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:n,optionalChains:r,rpcMap:s}=t;n&&mu(n)&&(this.rpc.chains=n.map(i=>this.formatChainId(i)),n.forEach(i=>{this.rpc.rpcMap[i]=(s==null?void 0:s[i])||this.getRpcUrl(i)})),r&&mu(r)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=r==null?void 0:r.map(i=>this.formatChainId(i)),r.forEach(i=>
15{this.rpc.rpcMap[i]=(s==null?void 0:s[i])||this.getRpcUrl(i)}))}getRpcUrl(t,n){var r;return((r=this.rpc.rpcMap)==null?void 0:r[t])||`${dFe}?chainId=eip155:${t}&projectId=${n||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),n=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:n==null?void 0:n.accounts),this.setAccounts(n==null?void 0:n.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(n=>this.signer.logger.warn(n))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(n=>this.parseAccount(n))}};var EFe=Object.defineProperty,CFe=Object.defineProperties,$Fe=Object.getOwnPropertyDescriptors,WX=Object.getOwnPropertySymbols,xFe=Object.prototype.hasOwnProperty,IFe=Object.prototype.propertyIsEnumerable,HX=(e,t,n)=>t in e?EFe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ehe=(e,t)=>{for(var n in t||(t={}))xFe.call(t,n)&&HX(e,n,t[n]);if(WX)for(var n of WX(t))IFe.call(t,n)&&HX(e,n,t[n]);return e},SFe=(e,t)=>CFe(e,$Fe(t));function AFe(e){if(e)return{"--w3m-font-family":e["--wcm-font-family"],"--w3m-accent":e["--wcm-accent-color"],"--w3m-color-mix":e["--wcm-background-color"],"--w3m-z-index":e["--wcm-z-index"]?Number(e["--wcm-z-index"]):void 0,"--w3m-qr-color":e["--wcm-accent-color"],"--w3m-font-size-master":e["--wcm-text-medium-regular-size"],"--w3m-border-radius-master":e["--wcm-container-border-radius"],"--w3m-color-mix-strength":0}}const _Fe=e=>{const[t,n]=e.split(":");return Che({id:n,caipNetworkId:e,chainNamespace:t,name:"",nativeCurrency:{name:"",symbol:"",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}})};function NFe(e){var t,n,r,s,i,o,a;const c=(t=e.chains)==null?void 0:t.map(_Fe).filter(Boolean);if(c.length===0)throw new Error("At least one chain must be specified");const l=c.find(d=>{var h;return d.id===((h=e.defaultChain)==null?void 0:h.id)}),u={projectId:e.projectId,networks:c,themeMode:e.themeMode,themeVariables:AFe(e.themeVariables),chainImages:e.chainImages,connectorImages:e.walletImages,defaultNetwork:l,metadata:SFe(Ehe({},e.metadata),{name:((n=e.metadata)==null?void 0:n.name)||"WalletConnect",description:((r=e.metadata)==null?void 0:r.description)||"Connect to WalletConnect-compatible wallets",url:((s=e.metadata)==null?void 0:s.url)||"https://walletconnect.org",icons:((i=e.metadata)==null?void 0:i.icons)||["https://walletconnect.org/walletconnect-logo.png"]}),showWallets:!0,featuredWalletIds:e.explorerRecommendedWalletIds==="NONE"?[]:Array.isArray(e.explorerRecommendedWalletIds)?e.explorerRecommendedWalletIds:[],excludeWalletIds:e.explorerExcludedWalletIds==="ALL"?[]:Array.isArray(e.explorerExcludedWalletIds)?e.explorerExcludedWalletIds:[],enableEIP6963:!1,enableInjected:!1,enableCoinbase:!0,enableWalletConnect:!0,features:{email:!1,socials:!1}};if((o=e.mobileWallets)!=null&&o.length||(a=e.desktopWallets)!=null&&a.length){const d=[...(e.mobileWallets||[]).map(g=>({id:g.id,name:g.name,links:g.links})),...(e.desktopWallets||[]).map(g=>({id:g.id,name:g.name,links:{native:g.links.native,universal:g.links.universal}}))],h=[...u.featuredWalletIds||[],...u.excludeWalletIds||[]],f=d.filter(g=>!h.includes(g.id));f.length&&(u.customWallets=f)}return u}function Che(e){return Ehe({formatters:void 0,fees:void 0,serializers:void 0},e)}var TFe=Object.freeze({__proto__:null,convertWCMToAppKitOptions:NFe,defineChain:Che});const PFe="1.2.3";let $c=class xL extends Error{constructor(t,n={}){var o;const r=n.cause instanceof xL?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof xL&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${PFe}`].join(` 16`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function L0(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const $he=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,xhe=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Ihe=/^\(.+?\).*?$/,VX=/^tuple(?<array>(\[(\d*)\])*)$/;function IL(e){let t=e.type;if(VX.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const i=e.components[s];t+=IL(i),s<n-1&&(t+=", ")}const r=L0(VX,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,IL({...e,type:t})}
16return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Xg(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=IL(s),r!==n-1&&(t+=", ")}return t}function vu(e){var t;return e.type==="function"?`function ${e.name}(${Xg(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Xg(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Xg(e.inputs)})`:e.type==="error"?`error ${e.name}(${Xg(e.inputs)})`:e.type==="constructor"?`constructor(${Xg(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const She=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function OFe(e){return She.test(e)}function kFe(e){return L0(She,e)}const Ahe=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function RFe(e){return Ahe.test(e)}function BFe(e){return L0(Ahe,e)}const _he=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function DFe(e){return _he.test(e)}function UFe(e){return L0(_he,e)}const Nhe=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function l7(e){return Nhe.test(e)}function LFe(e){return L0(Nhe,e)}const The=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function MFe(e){return The.test(e)}function jFe(e){return L0(The,e)}const Phe=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function FFe(e){return Phe.test(e)}function zFe(e){return L0(Phe,e)}const qFe=/^receive\(\) external payable$/;function WFe(e){return qFe.test(e)}const KX=new Set(["memory","indexed","storage","calldata"]),HFe=new Set(["indexed"]),SL=new Set(["calldata","memory","storage"]);class u7 extends $c{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class d7 extends $c{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class VFe extends $c{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class h7 extends $c{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class f7 extends $c{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class p7 extends $c{constructor({param:t,name:n}
16){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class g7 extends $c{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class m7 extends $c{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class w7 extends $c{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class M0 extends $c{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class y7 extends $c{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class b7 extends $c{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class v7 extends $c{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class E7 extends $c{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function KFe(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let i="";for(const o of s[1])i+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${s[0]}{${i}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const YO=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function AL(e,t={}){if(DFe(e))return GFe(e,t);if(RFe(e))return ZFe(e,t);if(OFe(e))return YFe(e,t);if(MFe(e))return JFe(e,t);if(FFe(e))return XFe(e);if(WFe(e))return{type:"receive",stateMutability:"payable"};throw new y7({signature:e})}function GFe(e,t={}){const n=UFe(e);if(!n)throw new M0({signature:e,type:"function"});const r=rl(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(m0(r[a],{modifiers:SL,structs:t,type:"function"}));const o=[];if(n.returns){const a=rl(n.returns),c=a.length;for(let l=0;l<c;l++)o.push(m0(a[l],{modifiers:SL,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function ZFe(e,t={}){const n=BFe(e);if(!n)throw new M0({signature:e,type:"event"});const r=rl(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(m0(r[o],{modifiers:HFe,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function YFe(e,t={}){const n=kFe(e);if(!n)throw new M0({signature:e,type:"error"});const r=rl(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(m0(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function JFe(e,t={}){const n=jFe(e);if(!n)throw new M0({signature:e,type:"constructor"});const r=rl(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(m0(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function XFe(e){const t=zFe(e);if(!t)throw new M0({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const QFe=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,eze=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,tze=/^u?int$/;function m0(e,t){var d,h;const n=KFe(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(YO.has(n))return YO.get(n);const r=Ihe.test(e),s=L0(r?eze:QFe,e);if(!s)throw new f7({param:e});if(s.name&&rze(s.name))throw new p7({param:e,name:s.name});const i=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},a=(t==null?void 0:t.structs)??{};let c,l={};if(r){c="tuple";const f=rl(s.type),g=[],p=f.length;for(let m=0;m<p;m++)g.push(m0(f[m],{structs:a}));l={components:g}}else if(s.type in a)c="tuple",l={components:a[s.type]};else if(tze.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!Ohe(c))throw new VFe({type:c});if(s.modifier){if(!((h=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&h.call(d,s.modifier)))throw new g7({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(SL.has(s.modifier)&&!sze(c,!!s.array))throw new m7({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const u={type:`${c}${s.array??""}`,...i,...o,...l};return YO.set(n,u),u}function rl(e,t=[],n="",r=0){const s=e.trim().length;for(let i=0;i<s;i++){const o=e[i],a=e.slice(i+1);
16switch(o){case",":return r===0?rl(a,[...t,n.trim()]):rl(a,t,`${n}${o}`,r);case"(":return rl(a,t,`${n}${o}`,r+1);case")":return rl(a,t,`${n}${o}`,r-1);default:return rl(a,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new E7({current:n,depth:r});return t.push(n.trim()),t}function Ohe(e){return e==="address"||e==="bool"||e==="function"||e==="string"||$he.test(e)||xhe.test(e)}const nze=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function rze(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||$he.test(e)||xhe.test(e)||nze.test(e)}function sze(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function eW(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!l7(a))continue;const c=LFe(a);if(!c)throw new M0({signature:a,type:"struct"});const l=c.properties.split(";"),u=[],d=l.length;for(let h=0;h<d;h++){const g=l[h].trim();if(!g)continue;const p=m0(g,{type:"struct"});u.push(p)}if(!u.length)throw new b7({signature:a});t[c.name]=u}const r={},s=Object.entries(t),i=s.length;for(let o=0;o<i;o++){const[a,c]=s[o];r[a]=khe(c,t)}return r}const ize=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function khe(e=[],t={},n=new Set){const r=[],s=e.length;for(let i=0;i<s;i++){const o=e[i];if(Ihe.test(o.type))r.push(o);else{const c=L0(ize,o.type);if(!(c!=null&&c.type))throw new w7({abiParameter:o});const{array:l,type:u}=c;if(u in t){if(n.has(u))throw new v7({type:u});r.push({...o,type:`tuple${l??""}`,components:khe(t[u],t,new Set([...n,u]))})}else if(Ohe(u))r.push(o);else throw new d7({type:u})}}return r}function j0(e){const t=eW(e),n=[],r=e.length;for(let s=0;s<r;s++){const i=e[s];l7(i)||n.push(AL(i,t))}return n}function w0(e){let t;if(typeof e=="string")t=AL(e);else{const n=eW(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(!l7(i)){t=AL(i,n);break}}}if(!t)throw new u7({signature:e});return t}function y0(e){const t=[];if(typeof e=="string"){const n=rl(e),r=n.length;for(let s=0;s<r;s++)t.push(m0(n[s],{modifiers:KX}))}else{const n=eW(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(l7(i))continue;const o=rl(i),a=o.length;for(let c=0;c<a;c++)t.push(m0(o[c],{modifiers:KX,structs:n}))}}if(t.length===0)throw new h7({params:e});return t}var Dh={exports:{}};function oze(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var aze=cze;function cze(e,t,n){var r=n&&n.stringify||oze,s=1;if(typeof e=="object"&&e!==null){var i=t.length+s;if(i===1)return e;var o=new Array(i);o[0]=r(e);for(var a=1;a<i;a++)o[a]=r(t[a]);return o.join(" ")}if(typeof e!="string")return e;var c=t.length;if(c===0)return e;for(var l="",u=1-s,d=-1,h=e&&e.length||0,f=0;f<h;){if(e.charCodeAt(f)===37&&f+1<h){switch(d=d>-1?d:0,e.charCodeAt(f+1)){case 100:case 102:if(u>=c||t[u]==null)break;d<f&&(l+=e.slice(d,f)),l+=Number(t[u]),d=f+2,f++;break;case 105:if(u>=c||t[u]==null)break;d<f&&(l+=e.slice(d,f)),l+=Math.floor(Number(t[u])),d=f+2,f++;break;case 79:case 111:case 106:if(u>=c||t[u]===void 0)break;d<f&&(l+=e.slice(d,f));var g=typeof t[u];if(g==="string"){l+="'"+t[u]+"'",d=f+2,f++;break}if(g==="function"){l+=t[u].name||"<anonymous>",d=f+2,f++;break}l+=r(t[u]),d=f+2,f++;break;case 115:if(u>=c)break;d<f&&(l+=e.slice(d,f)),l+=String(t[u]),d=f+2,f++;break;case 37:d<f&&(l+=e.slice(d,f)),l+="%",d=f+2,f++,u--;break}++u}++f}return d===-1?e:(d<h&&(l+=e.slice(d)),l)}const GX=aze;Dh.exports=Qp;const M8=$ze().console||{},lze={mapHttpRequest:jx,mapHttpResponse:jx,wrapRequestSerializer:JO,wrapResponseSerializer:JO,wrapErrorSerializer:JO,req:jx,res:jx,err:YX,errWithCause:YX};function am(e,t){return e==="silent"?1/0:t.levels.values[e]}const tW=Symbol("pino.logFuncs"),_L=Symbol("pino.hierarchy"),uze={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function ZX(e,t){const n={logger:t,parent:e[_L]};t[_L]=n}function dze(e,t,n){const r={};t.forEach(s=>{r[s]=n[s]?n[s]:M8[s]||M8[uze[s]||"log"]||Bv}),e[tW]=r}function hze(e,t){return Array.isArray(e)?e.filter(function(n){return n!=="!stdSerializers.err"}):e===!0?Object.keys(t):!1}function Qp(e){e=e||{},e.browser=e.browser||{};const t=e.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const n=e.browser.write||M8;e.browser.write&&(e.browser.asObject=!0);const r=e.serializers||{},s=hze(e.browser.serialize,r);let i=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(i=!1);const o=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(o);
vendor: 59,115 bytes, lines 16-17
16typeof n=="function"&&a.forEach(function(p){n[p]=n}),(e.enabled===!1||e.browser.disabled)&&(e.level="silent");const c=e.level||"info",l=Object.create(n);l.log||(l.log=Bv),dze(l,a,n),ZX({},l),Object.defineProperty(l,"levelVal",{get:d}),Object.defineProperty(l,"level",{get:h,set:f});const u={transmit:t,serialize:s,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:vze(e),messageKey:e.messageKey||"msg",onChild:e.onChild||Bv};l.levels=fze(e),l.level=c,l.isLevelEnabled=function(p){return this.levels.values[p]?this.levels.values[p]>=this.levels.values[this.level]:!1},l.setMaxListeners=l.getMaxListeners=l.emit=l.addListener=l.on=l.prependListener=l.once=l.prependOnceListener=l.removeListener=l.removeAllListeners=l.listeners=l.listenerCount=l.eventNames=l.write=l.flush=Bv,l.serializers=r,l._serialize=s,l._stdErrSerialize=i,l.child=function(...p){return g.call(this,u,...p)},t&&(l._logEvent=NL());function d(){return am(this.level,this)}function h(){return this._level}function f(p){if(p!=="silent"&&!this.levels.values[p])throw Error("unknown level "+p);this._level=p,N1(this,u,l,"error"),N1(this,u,l,"fatal"),N1(this,u,l,"warn"),N1(this,u,l,"info"),N1(this,u,l,"debug"),N1(this,u,l,"trace"),o.forEach(m=>{N1(this,u,l,m)})}function g(p,m,w){if(!m)throw new Error("missing bindings for child Pino");w=w||{},s&&m.serializers&&(w.serializers=m.serializers);const C=w.serializers;if(s&&C){var E=Object.assign({},r,C),b=e.browser.serialize===!0?Object.keys(E):s;delete m.serializers,nW([m],b,E,this._stdErrSerialize)}function S(x){this._childLevel=(x._childLevel|0)+1,this.bindings=m,E&&(this.serializers=E,this._serialize=b),t&&(this._logEvent=NL([].concat(x._logEvent.bindings,m)))}S.prototype=this;const v=new S(this);return ZX(this,v),v.child=function(...x){return g.call(this,p,...x)},v.level=w.level||this.level,p.onChild(v),v}return l}function fze(e){const t=e.customLevels||{},n=Object.assign({},Qp.levels.values,t),r=Object.assign({},Qp.levels.labels,pze(t));return{values:n,labels:r}}function pze(e){const t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}Qp.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},Qp.stdSerializers=lze,Qp.stdTimeFunctions=Object.assign({},{nullTime:Rhe,epochTime:Bhe,unixTime:Eze,isoTime:Cze});function gze(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[_L];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}function N1(e,t,n,r){if(Object.defineProperty(e,r,{value:am(e.level,n)>am(r,n)?Bv:n[tW][r],writable:!0,enumerable:!0,configurable:!0}),e[r]===Bv){if(!t.transmit)return;const i=t.transmit.level||e.level,o=am(i,n);if(am(r,n)<o)return}e[r]=wze(e,t,n,r);const s=gze(e);s.length!==0&&(e[r]=mze(s,e[r]))}function mze(e,t){return function(){return t.apply(this,[...e,...arguments])}}function wze(e,t,n,r){return(function(s){return function(){const i=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===M8?M8:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];var l=!1;if(t.serialize&&(nW(o,this._serialize,this.serializers,this._stdErrSerialize),l=!0),t.asObject||t.formatters?s.call(a,...yze(this,r,o,i,t)):s.apply(a,o),t.transmit){const u=t.transmit.level||e._level,d=am(u,n),h=am(r,n);if(h<d)return;bze(this,{ts:i,methodLevel:r,methodValue:h,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:am(e._level,n)},o,l)}}})(e[tW][r])}function yze(e,t,n,r,s){const{level:i,log:o=d=>d}=s.formatters||{},a=n.slice();let c=a[0];const l={};let u=(e._childLevel|0)+1;if(u<1&&(u=1),r&&(l.time=r),i){const d=i(t,e.levels.values[t]);Object.assign(l,d)}else l.level=e.levels.values[t];if(s.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;u--&&typeof a[0]=="object";)Object.assign(l,a.shift());return[o(l),...a]}else{if(c!==null&&typeof c=="object"){for(;u--&&typeof a[0]=="object";)Object.assign(l,a.shift());c=a.length?GX(a.shift(),a):void 0}else typeof c=="string"&&(c=GX(a.shift(),a));return c!==void 0&&(l[s.messageKey]=c),[o(l)]}}function nW(e,t,n,r){for(const s in e)if(r&&e[s]instanceof Error)e[s]=Qp.stdSerializers.err(e[s]);else if(typeof e[s]=="object"&&!Array.isArray(e[s])&&t)for(const i in e[s])t.indexOf(i)>-1&&i in n&&(e[s][i]=n[i](e[s][i]))}function bze(e,t,n,r=!1){const s=t.send,i=t.ts,o=t.methodLevel,a=t.methodValue,c=t.val,l=e._logEvent.bindings;r||nW(n,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter(function(u){return l.indexOf(u)===-1}),e._logEvent.level.label=o,e._logEvent.level.value=a,s(o,e._logEvent,c),e._logEvent=NL(l)}function NL(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function YX(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)t[n]===void 0&&(t[n]=e[n]);return t}function vze(e){return typeof e.timestamp=="function"?e.timestamp:e.timestamp===!1?Rhe:Bhe}function jx(){return{}}function JO(e){return e}function Bv(){}function Rhe(){return!1}function Bhe(){return Date.now()}function Eze(){return Math.round(Date.now()/1e3)}function Cze(){return new Date(Date.now()).toISOString()}function $ze(){function e(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}Dh.exports.default=Qp;Dh.exports.pino=Qp;const xze={level:"info"},C7="custom_context",rW=1e3*1024;var Ize=Object.defineProperty,Sze=(e,t,n)=>t in e?Ize(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qg=(e,t,n)=>Sze(e,typeof t!="symbol"?t+"":t,n);let Aze=class{constructor(t){Qg(this,"nodeValue"),Qg(this,"sizeInBytes"),Qg(this,"next"),this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},JX=class{constructor(t){Qg(this,"lengthInNodes"),Qg(this,"sizeInBytes"),Qg(this,"head"),Qg(this,"tail"),Qg(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const n=new Aze(t);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let n=this.head;for(;n!==null;)t.push(n.value),n=n.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const n=t.value;return t=t.next,{done:!1,value:n}}}}};const _ze=e=>JSON.stringify(e,(t,n)=>typeof n=="bigint"?n.toString()+"n":n);function XX(e){return typeof e=="string"?e:_ze(e)||""}var Nze=Object.defineProperty,Tze=(e,t,n)=>t in e?Nze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fx=(e,t,n)=>Tze(e,typeof t!="symbol"?t+"":t,n);let Dhe=class{constructor(t,n=rW){Fx(this,"logs"),Fx(this,"level"),Fx(this,"levelValue"),Fx(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=t??"error",this.levelValue=Dh.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new JX(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,n){n===Dh.exports.levels.values.error?console.error(t):n===Dh.exports.levels.values.warn?console.warn(t):n===Dh.exports.levels.values.debug?console.debug(t):n===Dh.exports.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(XX({timestamp:new Date().toISOString(),log:t}));const n=typeof t=="string"?JSON.parse(t).level:t.level;n>=this.levelValue&&this.forwardToConsole(t,n)}getLogs(){return this.logs}clearLogs(){this.logs=new JX(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const n=this.getLogArray();return n.push(XX({extraMetadata:t})),new Blob(n,{type:"application/json"})}};var Pze=Object.defineProperty,Oze=(e,t,n)=>t in e?Pze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kze=(e,t,n)=>Oze(e,t+"",n);let Rze=class{constructor(t,n=rW){kze(this,"baseChunkLogger"),this.baseChunkLogger=new Dhe(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const n=URL.createObjectURL(this.logsToBlob(t)),r=document.createElement("a");r.href=n,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}};var Bze=Object.defineProperty,Dze=(e,t,n)=>t in e?Bze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uze=(e,t,n)=>Dze(e,t+"",n);let Lze=class{constructor(t,n=rW){Uze(this,"baseChunkLogger"),this.baseChunkLogger=new Dhe(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var Mze=Object.defineProperty,jze=Object.defineProperties,Fze=Object.getOwnPropertyDescriptors,QX=Object.getOwnPropertySymbols,zze=Object.prototype.hasOwnProperty,qze=Object.prototype.propertyIsEnumerable,eQ=(e,t,n)=>t in e?Mze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wm=(e,t)=>{for(var n in t||(t={}))zze.call(t,n)&&eQ(e,n,t[n]);if(QX)for(var n of QX(t))qze.call(t,n)&&eQ(e,n,t[n]);return e},ym=(e,t)=>jze(e,Fze(t));function sW(e){return ym(wm({},e),{level:(e==null?void 0:e.level)||xze.level})}function Wze(e,t,n=C7){return e[n]=t,e}function Sr(e,t=C7){return e[t]||""}function Hze(e,t,n=C7){const r=Sr(e,n);return r.trim()?`${r}/${t}`:t}function kr(e,t,n=C7){const r=Hze(e,t,n),s=e.child({context:r});return Wze(s,r,n)}function Vze(e){var t,n;const r=new Rze((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:Dh.exports(ym(wm({},e.opts),{level:"trace",browser:ym(wm({},(n=e.opts)==null?void 0:n.browser),{write:s=>r.write(s)})})),chunkLoggerController:r}}function Kze(e){var t,n;const r=new Lze((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:Dh.exports(ym(wm({},e.opts),{level:"trace",browser:ym(wm({},(n=e.opts)==null?void 0:n.browser),{write:s=>r.write(s)})}),r),chunkLoggerController:r}}function OC(e){var t;if(typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string")return{logger:e.loggerOverride,chunkLoggerController:null};const n=ym(wm({},e.opts),{level:typeof e.loggerOverride=="string"?e.loggerOverride:(t=e.opts)==null?void 0:t.level});return typeof window<"u"?Vze(ym(wm({},e),{opts:n})):Kze(ym(wm({},e),{opts:n}))}let Gze=class extends Wr{constructor(t){super(),this.opts=t,this.protocol="wc",this.version=2}},Zze=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n,this.records=new Map}},Yze=class{constructor(t,n){this.logger=t,this.core=n}},Jze=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},Xze=class extends Wr{constructor(t){super()}},Qze=class{constructor(t,n,r,s){this.core=t,this.logger=n,this.name=r}},eqe=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},tqe=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n}},nqe=class{constructor(t,n,r){this.core=t,this.logger=n,this.store=r}},rqe=class{constructor(t,n){this.projectId=t,this.logger=n}},sqe=class{constructor(t,n,r){this.core=t,this.logger=n,this.telemetryEnabled=r}},iqe=class{constructor(t){this.opts=t,this.protocol="wc",this.version=2}},oqe=class{constructor(t){this.client=t}};const aqe="0.1.1";function cqe(){return aqe}let Es=class TL extends Error{constructor(t,n={}){const r=(()=>{var c;if(n.cause instanceof TL){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof TL&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,a=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(` 17`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${cqe()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=t}walk(t){return Uhe(this,t)}};function Uhe(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Uhe(e.cause,t):t?null:e}const iW=BigInt(0),PL=BigInt(1);function kC(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function oW(e){if(!kC(e))throw new Error("Uint8Array expected")}function j8(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function zx(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Lhe(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?iW:BigInt("0x"+e)}const Mhe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",lqe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function F8(e){if(oW(e),Mhe)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=lqe[e[n]];return t}const Df={_0:48,_9:57,A:65,F:70,a:97,f:102};function tQ(e){if(e>=Df._0&&e<=Df._9)return e-Df._0;if(e>=Df.A&&e<=Df.F)return e-(Df.A-10);if(e>=Df.a&&e<=Df.f)return e-(Df.a-10)}function l9(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Mhe)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=tQ(e.charCodeAt(i)),a=tQ(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Nw(e){return Lhe(F8(e))}function jhe(e){return oW(e),Lhe(F8(Uint8Array.from(e).reverse()))}function RC(e,t){return l9(e.toString(16).padStart(t*2,"0"))}function Fhe(e,t){return RC(e,t).reverse()}function ru(e,t,n){let r;if(typeof t=="string")try{r=l9(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(kC(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function u9(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];oW(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const XO=e=>typeof e=="bigint"&&iW<=e;function aW(e,t,n){return XO(e)&&XO(t)&&XO(n)&&t<=e&&e<n}function Dv(e,t,n,r){if(!aW(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function uqe(e){let t;for(t=0;e>iW;e>>=PL,t+=1);return t}const $7=e=>(PL<<BigInt(e))-PL,QO=e=>new Uint8Array(e),nQ=e=>Uint8Array.from(e);function dqe(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=QO(e),s=QO(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=QO(0))=>{s=a(nQ([0]),d),r=a(),d.length!==0&&(s=a(nQ([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return u9(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const hqe={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||kC(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function x7(e,t,n={}){const r=(s,i,o)=>{const a=hqe[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function rQ(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}function fqe(e,t){if(aQ(e)>t)throw new Rqe({givenSize:aQ(e),maxSize:t})}const Uf={zero:48,nine:57,A:65,F:70,a:97,f:102};function sQ(e){if(e>=Uf.zero&&e<=Uf.nine)return e-Uf.zero;if(e>=Uf.A&&e<=Uf.F)return e-(Uf.A-10);if(e>=Uf.a&&e<=Uf.f)return e-(Uf.a-10)}function pqe(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Bqe({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o=n==="right";s[o?i:r-i-1]=e[o?i:e.length-i-1]}return s}function zhe(e,t){if(zm(e)>t)throw new xqe({givenSize:zm(e),maxSize:t})}function gqe(e,t){if(typeof t=="number"&&t>0&&t>zm(e)-1)throw new Hhe({offset:t,position:"start",size:zm(e)})}function mqe(e,t,n){if(typeof t=="number"&&typeof n=="number"&&zm(e)!==n-t)throw new Hhe({offset:n,position:"end",size:zm(e)})}function qhe(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new Iqe({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const wqe="#__bigint";function cW(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+wqe:s,n)}const yqe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bqe(e,t={}){const{strict:n=!1}=t;if(!e)throw new iQ(e);if(typeof e!="string")throw new iQ(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new oQ(e);if(!e.startsWith("0x"))throw new oQ(e)}function vqe(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function lW(e){return e instanceof Uint8Array?d9(e):Array.isArray(e)?d9(new Uint8Array(e)):e}function d9(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=yqe[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(zhe(r,t.size),Whe(r,t.size)):r}function ek(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const l=typeof e=="bigint"?"n":"";throw new $qe({max:i?`${i}${l}`:void 0,min:`${o}${l}`,signed:n,size:r,value:`${e}${l}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?Eqe(c,r):c}function Eqe(e,t){return qhe(e,{dir:"left",size:t})}function Whe(e,t){return qhe(e,{dir:"right",size:t})}function bp(e,t,n,r={}){const{strict:s}=r;gqe(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&mqe(i,t,n),i}function zm(e){return Math.ceil((e.length-2)/2)}function Cqe(e,t={}){const{strict:n=!1}=t;try{return bqe(e,{strict:n}),!0}catch{return!1}}let $qe=class extends Es{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},iQ=class extends Es{constructor(t){super(`Value \`${typeof t=="object"?cW(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},oQ=class extends Es{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},xqe=class extends Es{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},Hhe=class extends Es{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},Iqe=class extends Es{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};const Sqe=new TextEncoder;function Aqe(e){if(!(e instanceof Uint8Array)){if(!e)throw new qx(e);if(typeof e!="object")throw new qx(e);if(!("BYTES_PER_ELEMENT"in e))throw new qx(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new qx(e)}}function _qe(e){return e instanceof Uint8Array?e:typeof e=="string"?Tqe(e):Nqe(e)}function Nqe(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Tqe(e,t={}){const{size:n}=t;let r=e;n&&(zhe(e,n),r=Whe(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const l=sQ(s.charCodeAt(c++)),u=sQ(s.charCodeAt(c++));if(l===void 0||u===void 0)throw new Es(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l*16+u}return o}function Pqe(e,t={}){const{size:n}=t,r=Sqe.encode(e);return typeof n=="number"?(fqe(r,n),Oqe(r,n)):r}function Oqe(e,t){return pqe(e,{dir:"right",size:t})}function aQ(e){return e.length}function kqe(e){try{return Aqe(e),!0}catch{return!1}}let qx=class extends Es{constructor(t){super(`Value \`${typeof t=="object"?cW(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}},Rqe=class extends Es{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Bqe=class extends Es{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};function Vhe(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=U0(_qe(e));return n==="Bytes"?r:d9(r)}let Dqe=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const Uqe={checksum:new Dqe(8192)},tk=Uqe.checksum;function Khe(e,t={}){const{compressed:n}=t,{prefix:r,x:s,y:i}=e;if(n===!1||typeof s=="bigint"&&typeof i=="bigint"){if(r!==4)throw new cQ({prefix:r,cause:new qqe});return}if(n===!0||typeof s=="bigint"&&typeof i>"u"){if(r!==3&&r!==2)throw new cQ({prefix:r,cause:new zqe});return}throw new Fqe({publicKey:e})}function Lqe(e){const t=(()=>{if(Cqe(e))return Ghe(e);if(kqe(e))return Mqe(e);const{prefix:n,x:r,y:s}=e;return typeof r=="bigint"&&typeof s=="bigint"?{prefix:n??4,x:r,y:s}:{prefix:n,x:r}})();return Khe(t),t}function Mqe(e){return Ghe(d9(e))}function Ghe(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new Wqe({publicKey:e});if(e.length===130){const r=BigInt(bp(e,0,32)),s=BigInt(bp(e,32,64));return{prefix:4,x:r,y:s}}if(e.length===132){const r=Number(bp(e,0,1)),s=BigInt(bp(e,1,33)),i=BigInt(bp(e,33,65));return{prefix:r,x:s,y:i}}const t=Number(bp(e,0,1)),n=BigInt(bp(e,1,33));return{prefix:t,x:n}}function jqe(e,t={}){Khe(e);const{prefix:n,x:r,y:s}=e,{includePrefix:i=!0}=t;return vqe(i?ek(n,{size:1}):"0x",ek(r,{size:32}),typeof s=="bigint"?ek(s,{size:32}):"0x")}let Fqe=class extends Es{constructor({publicKey:t}){super(`Value \`${cW(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}},cQ=class extends Es{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}},zqe=class extends Es{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}},qqe=class extends Es{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}},Wqe=class extends Es{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${zm(lW(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Hqe=/^0x[a-fA-F0-9]{40}$/;function Zhe(e,t={}){const{strict:n=!0}=t;if(!Hqe.test(e))throw new lQ({address:e,cause:new Gqe});if(n){if(e.toLowerCase()===e)return;if(Yhe(e)!==e)throw new lQ({address:e,cause:new Zqe})}}function Yhe(e){if(tk.has(e))return tk.get(e);Zhe(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Vhe(Pqe(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return tk.set(e,s),s}function Vqe(e,t={}){const{checksum:n=!1}=t;return Zhe(e),n?Yhe(e):e}function Kqe(e,t={}){const n=Vhe(`0x${jqe(e).slice(4)}`).substring(26);return Vqe(`0x${n}`,t)}let lQ=class extends Es{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},Gqe=class extends Es{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},Zqe=class extends Es{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}};const lc=BigInt(0),Qo=BigInt(1),uw=BigInt(2),Yqe=BigInt(3),Jhe=BigInt(4),Xhe=BigInt(5),Qhe=BigInt(8);function Ka(e,t){const n=e%t;return n>=lc?n:t+n}function Rl(e,t,n){let r=e;for(;t-- >lc;)r*=r,r%=n;return r}function OL(e,t){if(e===lc)throw new Error("invert: expected non-zero number");if(t<=lc)throw new Error("invert: expected positive modulus, got "+t);let n=Ka(e,t),r=t,s=lc,i=Qo;for(;n!==lc;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==Qo)throw new Error("invert: does not exist");return Ka(s,t)}function efe(e,t){const n=(e.ORDER+Qo)/Jhe,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Jqe(e,t){const n=(e.ORDER-Xhe)/Qhe,r=e.mul(t,uw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,uw),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function Xqe(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-Qo,n=0;for(;t%uw===lc;)t/=uw,n++;let r=uw;const s=uW(e);for(;uQ(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return efe;let i=s.pow(r,t);const o=(t+Qo)/uw;return function(c,l){if(c.is0(l))return l;if(uQ(c,l)!==1)throw new Error("Cannot find square root");let u=n,d=c.mul(c.ONE,i),h=c.pow(l,t),f=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let g=1,p=c.sqr(h);for(;!c.eql(p,c.ONE);)if(g++,p=c.sqr(p),g===u)throw new Error("Cannot find square root");const m=Qo<<BigInt(u-g-1),w=c.pow(d,m);u=g,d=c.sqr(w),h=c.mul(h,d),f=c.mul(f,w)}return f}}function Qqe(e){return e%Jhe===Yqe?efe:e%Qhe===Xhe?Jqe:Xqe(e)}const eWe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tWe(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=eWe.reduce((r,s)=>(r[s]="function",r),t);return x7(e,n)}function nWe(e,t,n){if(n<lc)throw new Error("invalid exponent, negatives unsupported");if(n===lc)return e.ONE;if(n===Qo)return t;let r=e.ONE,s=t;for(;n>lc;)n&Qo&&(r=e.mul(r,s)),s=e.sqr(s),n>>=Qo;return r}function tfe(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function uQ(e,t){const n=(e.ORDER-Qo)/uw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function nfe(e,t){t!==void 0&&Mm(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function uW(e,t,n=!1,r={}){if(e<=lc)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=nfe(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:$7(s),ZERO:lc,ONE:Qo,create:c=>Ka(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return lc<=c&&c<e},is0:c=>c===lc,isOdd:c=>(c&Qo)===Qo,neg:c=>Ka(-c,e),eql:(c,l)=>c===l,sqr:c=>Ka(c*c,e),add:(c,l)=>Ka(c+l,e),sub:(c,l)=>Ka(c-l,e),mul:(c,l)=>Ka(c*l,e),pow:(c,l)=>nWe(a,c,l),div:(c,l)=>Ka(c*OL(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>OL(c,e),sqrt:r.sqrt||(c=>(o||(o=Qqe(e)),o(a,c))),toBytes:c=>n?Fhe(c,i):RC(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?jhe(c):Nw(c)},invertBatch:c=>tfe(a,c),cmov:(c,l,u)=>u?l:c});return Object.freeze(a)}function rfe(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function sfe(e){const t=rfe(e);return t+Math.ceil(t/2)}function rWe(e,t,n=!1){const r=e.length,s=rfe(t),i=sfe(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?jhe(e):Nw(e),a=Ka(o,t-Qo)+Qo;return n?Fhe(a,s):RC(a,s)}const dQ=BigInt(0),kL=BigInt(1);function nk(e,t){const n=t.negate();return e?n:t}function ife(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function rk(e,t){ife(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=$7(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function hQ(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=kL);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function sWe(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function iWe(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const sk=new WeakMap,ofe=new WeakMap;function ik(e){return ofe.get(e)||1}function oWe(e,t){return{constTimeNegate:nk,hasPrecomputes(n){return ik(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>dQ;)r&kL&&(s=s.add(i)),i=i.double(),r>>=kL;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=rk(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=rk(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=hQ(s,c,a);s=l,d?o=o.add(nk(f,r[g])):i=i.add(nk(h,r[u]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=rk(n,t);for(let a=0;a<o.windows&&s!==dQ;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=hQ(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return i},getPrecomputes(n,r,s){let i=sk.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&sk.set(r,s(i))),i},wNAFCached(n,r,s){const i=ik(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=ik(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){ife(r,t),ofe.set(n,r),sk.delete(n)}}}function aWe(e,t,n,r){sWe(n,e),iWe(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=uqe(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=$7(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function afe(e){return tWe(e.Fp),x7(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...nfe(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function fQ(e){e.lowS!==void 0&&j8("lowS",e.lowS),e.prehash!==void 0&&j8("prehash",e.prehash)}function cWe(e){const t=afe(e);x7(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}let lWe=class extends Error{constructor(t=""){super(t)}};const Ip={Err:lWe,_tlv:{encode:(e,t)=>{const{Err:n}=Ip;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=zx(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?zx(s.length/2|128):"";return zx(e)+i+s+t},decode(e,t){const{Err:n}=Ip;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Ip;if(e<Dp)throw new t("integer: negative integers are not allowed");let n=zx(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Ip;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Nw(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Ip,s=ru("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Ip,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function ok(e,t){return F8(RC(e,t))}const Dp=BigInt(0),ui=BigInt(1);BigInt(2);const ak=BigInt(3),uWe=BigInt(4);function dWe(e){const t=cWe(e),{Fp:n}=t,r=uW(t.n,t.nBitLength),s=t.toBytes||((E,b,S)=>{const v=b.toAffine();return u9(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const b=E.subarray(1),S=n.fromBytes(b.subarray(0,n.BYTES)),v=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:S,y:v}});function o(E){const{a:b,b:S}=t,v=n.sqr(E),x=n.mul(v,E);return n.add(n.add(x,n.mul(E,b)),S)}function a(E,b){const S=n.sqr(b),v=o(E);return n.eql(S,v)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,ak),uWe),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(E){return aW(E,ui,t.n)}function d(E){const{allowedPrivateKeyLengths:b,nByteLength:S,wrapPrivateKey:v,n:x}=t;if(b&&typeof E!="bigint"){if(kC(E)&&(E=F8(E)),typeof E!="string"||!b.includes(E.length))throw new Error("invalid private key");E=E.padStart(S*2,"0")}let A;try{A=typeof E=="bigint"?E:Nw(ru("private key",E,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof E)}return v&&(A=Ka(A,x)),Dv("private key",A,ui,x),A}function h(E){if(!(E instanceof p))throw new Error("ProjectivePoint expected")}const f=rQ((E,b)=>{const{px:S,py:v,pz:x}=E;if(n.eql(x,n.ONE))return{x:S,y:v};const A=E.is0();b==null&&(b=A?n.ONE:n.inv(x));const I=n.mul(S,b),O=n.mul(v,b),N=n.mul(x,b);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:I,y:O}}),g=rQ(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:b,y:S}=E.toAffine();if(!n.isValid(b)||!n.isValid(S))throw new Error("bad point: x or y not FE");if(!a(b,S))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(b,S,v){if(b==null||!n.isValid(b))throw new Error("x required");if(S==null||!n.isValid(S)||n.is0(S))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=b,this.py=S,this.pz=v,Object.freeze(this)}static fromAffine(b){const{x:S,y:v}=b||{};if(!b||!n.isValid(S)||!n.isValid(v))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const x=A=>n.eql(A,n.ZERO);return x(S)&&x(v)?p.ZERO:new p(S,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const S=tfe(n,b.map(v=>v.pz));return b.map((v,x)=>v.toAffine(S[x])).map(p.fromAffine)}static fromHex(b){const S=p.fromAffine(i(ru("pointHex",b)));return S.assertValidity(),S}static fromPrivateKey(b){return p.BASE.multiply(d(b))}static msm(b,S){return aWe(p,r,b,S)}_setWindowSize(b){C.setWindowSize(this,b)}assertValidity(){g(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b,N=n.eql(n.mul(S,O),n.mul(A,x)),T=n.eql(n.mul(v,O),n.mul(I,x));return N&&T}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:S}=t,v=n.mul(S,ak),{px:x,py:A,pz:I}=this;let O=n.ZERO,N=n.ZERO,T=n.ZERO,P=n.mul(x,x),_=n.mul(A,A),y=n.mul(I,I),$=n.mul(x,A);return $=n.add($,$),T=n.mul(x,I),T=n.add(T,T),O=n.mul(b,T),N=n.mul(v,y),N=n.add(O,N),O=n.sub(_,N),N=n.add(_,N),N=n.mul(O,N),O=n.mul($,O),T=n.mul(v,T),y=n.mul(b,y),$=n.sub(P,y),$=n.mul(b,$),$=n.add($,T),T=n.add(P,P),P=n.add(T,P),P=n.add(P,y),P=n.mul(P,$),N=n.add(N,P),y=n.mul(A,I),y=n.add(y,y),P=n.mul(y,$),O=n.sub(O,P),T=n.mul(y,_),T=n.add(T,T),T=n.add(T,T),new p(O,N,T)}add(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b;let N=n.ZERO,T=n.ZERO,P=n.ZERO;const _=t.a,y=n.mul(t.b,ak);let $=n.mul(S,A),R=n.mul(v,I),B=n.mul(x,O),k=n.add(S,v),D=n.add(A,I);k=n.mul(k,D),D=n.add($,R),k=n.sub(k,D),D=n.add(S,x);let U=n.add(A,O);return D=n.mul(D,U),U=n.add($,B),D=n.sub(D,U),U=n.add(v,x),N=n.add(I,O),U=n.mul(U,N),N=n.add(R,B),U=n.sub(U,N),P=n.mul(_,D),N=n.mul(y,B),P=n.add(N,P),N=n.sub(R,P),P=n.add(R,P),T=n.mul(N,P),R=n.add($,$),R=n.add(R,$),B=n.mul(_,B),D=n.mul(y,D),R=n.add(R,B),B=n.sub($,B),B=n.mul(_,B),D=n.add(D,B),$=n.mul(R,D),T=n.add(T,$),$=n.mul(U,D),N=n.mul(k,N),N=n.sub(N,$),$=n.mul(k,R),P=n.mul(U,P),P=n.add(P,$),new p(N,T,P)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return C.wNAFCached(this,b,p.normalizeZ)}multiplyUnsafe(b){const{endo:S,n:v}=t;Dv("scalar",b,Dp,v);const x=p.ZERO;if(b===Dp)return x;if(this.is0()||b===ui)return this;if(!S||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,b,p.normalizeZ);let{k1neg:A,k1:I,k2neg:O,k2:N}=S.splitScalar(b),T=x,P=x,_=this;for(;I>Dp||N>Dp;)I&ui&&(T=T.add(_)),N&ui&&(P=P.add(_)),_=_.double(),I>>=ui,N>>=ui;return A&&(T=T.negate()),O&&(P=P.negate()),P=new p(n.mul(P.px,S.beta),P.py,P.pz),T.add(P)}multiply(b){const{endo:S,n:v}=t;Dv("scalar",b,ui,v);let x,A;if(S){const{k1neg:I,k1:O,k2neg:N,k2:T}=S.splitScalar(b);let{p:P,f:_}=this.wNAF(O),{p:y,f:$}=this.wNAF(T);P=C.constTimeNegate(I,P),y=C.constTimeNegate(N,y),y=new p(n.mul(y.px,S.beta),y.py,y.pz),x=P.add(y),A=_.add($)}else{const{p:I,f:O}=this.wNAF(b);x=I,A=O}return p.normalizeZ([x,A])[0]}multiplyAndAddUnsafe(b,S,v){const x=p.BASE,A=(O,N)=>N===Dp||N===ui||!O.equals(x)?O.multiplyUnsafe(N):O.multiply(N),I=A(this,S).add(A(b,v));return I.is0()?void 0:I}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:S}=t;if(b===ui)return!0;if(S)return S(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:S}=t;return b===ui?this:S?S(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return j8("isCompressed",b),this.assertValidity(),s(p,this,b)}toHex(b=!0){return j8("isCompressed",b),F8(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,C=oWe(p,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:u}}function hWe(e){const t=afe(e);return x7(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function fWe(e){const t=hWe(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(y){return Ka(y,r)}function l(y){return OL(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:h,isWithinCurveOrder:f}=dWe({...t,toBytes(y,$,R){const B=$.toAffine(),k=n.toBytes(B.x),D=u9;return j8("isCompressed",R),R?D(Uint8Array.from([$.hasEvenY()?2:3]),k):D(Uint8Array.from([4]),k,n.toBytes(B.y))},fromBytes(y){const $=y.length,R=y[0],B=y.subarray(1);if($===o&&(R===2||R===3)){const k=Nw(B);if(!aW(k,ui,n.ORDER))throw new Error("Point is not on curve");const D=h(k);let U;try{U=n.sqrt(D)}catch(q){const H=q instanceof Error?": "+q.message:"";throw new Error("Point is not on curve"+H)}const F=(U&ui)===ui;return(R&1)===1!==F&&(U=n.neg(U)),{x:k,y:U}}else if($===a&&R===4){const k=n.fromBytes(B.subarray(0,n.BYTES)),D=n.fromBytes(B.subarray(n.BYTES,2*n.BYTES));return{x:k,y:D}}else{const k=o,D=a;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+D+", got "+$)}}});function g(y){const $=r>>ui;return y>$}function p(y){return g(y)?c(-y):y}const m=(y,$,R)=>Nw(y.slice($,R));class w{constructor($,R,B){Dv("r",$,ui,r),Dv("s",R,ui,r),this.r=$,this.s=R,B!=null&&(this.recovery=B),Object.freeze(this)}static fromCompact($){const R=s;return $=ru("compactSignature",$,R*2),new w(m($,0,R),m($,R,2*R))}static fromDER($){const{r:R,s:B}=Ip.toSig(ru("DER",$));return new w(R,B)}assertValidity(){}addRecoveryBit($){return new w(this.r,this.s,$)}recoverPublicKey($){const{r:R,s:B,recovery:k}=this,D=x(ru("msgHash",$));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const U=k===2||k===3?R+t.n:R;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=(k&1)===0?"02":"03",K=u.fromHex(F+ok(U,n.BYTES)),q=l(U),H=c(-D*q),Z=c(B*q),ee=u.BASE.multiplyAndAddUnsafe(K,H,Z);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return l9(this.toDERHex())}toDERHex(){return Ip.hexFromSig(this)}toCompactRawBytes(){return l9(this.toCompactHex())}toCompactHex(){const $=s;return ok(this.r,$)+ok(this.s,$)}}const C={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=sfe(t.n);return rWe(t.randomBytes(y),t.n)},precompute(y=8,$=u.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}};function E(y,$=!0){return u.fromPrivateKey(y).toRawBytes($)}function b(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const R=ru("key",y).length,B=n.BYTES,k=B+1,D=2*B+1;if(!(t.allowedPrivateKeyLengths||s===k))return R===k||R===D}function S(y,$,R=!0){if(b(y)===!0)throw new Error("first arg must be private key");if(b($)===!1)throw new Error("second arg must be public key");return u.fromHex($).multiply(d(y)).toRawBytes(R)}const v=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const $=Nw(y),R=y.length*8-i;return R>0?$>>BigInt(R):$},x=t.bits2int_modN||function(y){return c(v(y))},A=$7(i);function I(y){return Dv("num < 2^"+i,y,Dp,A),RC(y,s)}function O(y,$,R=N){if(["recovered","canonical"].some(X=>X in R))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:k}=t;let{lowS:D,prehash:U,extraEntropy:F}=R;D==null&&(D=!0),y=ru("msgHash",y),fQ(R),U&&(y=ru("prehashed msgHash",B(y)));const K=x(y),q=d($),H=[I(q),I(K)];if(F!=null&&F!==!1){const X=F===!0?k(n.BYTES):F;H.push(ru("extraEntropy",X))}const Z=u9(...H),ee=K;function ie(X){const le=v(X);if(!f(le))return;const _e=l(le),Ne=u.BASE.multiply(le).toAffine(),be=c(Ne.x);if(be===Dp)return;const Me=c(_e*c(ee+be*q));if(Me===Dp)return;let Ct=(Ne.x===be?0:2)|Number(Ne.y&ui),Wt=Me;return D&&g(Me)&&(Wt=p(Me),Ct^=1),new w(be,Wt,Ct)}return{seed:Z,k2sig:ie}}const N={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(y,$,R=N){const{seed:B,k2sig:k}=O(y,$,R),D=t;return dqe(D.hash.outputLen,D.nByteLength,D.hmac)(B,k)}u.BASE._setWindowSize(8);function _(y,$,R,B=T){var Ct;const k=y;$=ru("msgHash",$),R=ru("publicKey",R);const{lowS:D,prehash:U,format:F}=B;if(fQ(B),"strict"in B)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw new Error("format must be compact or der");const K=typeof k=="string"||kC(k),q=!K&&!F&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!K&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,Z;try{if(q&&(H=new w(k.r,k.s)),K){try{F!=="compact"&&(H=w.fromDER(k))}catch(Wt){if(!(Wt instanceof Ip.Err))throw Wt}!H&&F!=="der"&&(H=w.fromCompact(k))}Z=u.fromHex(R)}catch{return!1}if(!H||D&&H.hasHighS())return!1;U&&($=t.hash($));const{r:ee,s:ie}=H,X=x($),le=l(ie),_e=c(X*le),Ne=c(ee*le),be=(Ct=u.BASE.multiplyAndAddUnsafe(Z,_e,Ne))==null?void 0:Ct.toAffine();return be?c(be.x)===ee:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:S,sign:P,verify:_,ProjectivePoint:u,Signature:w,utils:C}}function pWe(e){return{hash:e,hmac:(t,...n)=>m6(e,t,w6(...n)),randomBytes:g6}}function gWe(e,t){const n=r=>fWe({...e,...pWe(r)});return{...n(t),create:n}}const cfe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),pQ=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),mWe=BigInt(0),wWe=BigInt(1),RL=BigInt(2),gQ=(e,t)=>(e+t/RL)/t;function yWe(e){const t=cfe,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Rl(u,n,t)*u%t,h=Rl(d,n,t)*u%t,f=Rl(h,RL,t)*l%t,g=Rl(f,s,t)*f%t,p=Rl(g,i,t)*g%t,m=Rl(p,a,t)*p%t,w=Rl(m,c,t)*m%t,C=Rl(w,a,t)*p%t,E=Rl(C,n,t)*u%t,b=Rl(E,o,t)*g%t,S=Rl(b,r,t)*l%t,v=Rl(S,RL,t);if(!BL.eql(BL.sqr(v),e))throw new Error("Cannot find square root");return v}const BL=uW(cfe,void 0,void 0,{sqrt:yWe}),bWe=gWe({a:mWe,b:BigInt(7),Fp:BL,n:pQ,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=pQ,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-wWe*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=gQ(i*e,t),c=gQ(-r*e,t);let l=Ka(e-a*n-c*s,t),u=Ka(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},y6);function vWe(e){if(e.length!==130&&e.length!==132)throw new CWe({signature:e});const t=BigInt(bp(e,0,32)),n=BigInt(bp(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return EWe(s)}catch{throw new $We({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function EWe(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new xWe({value:e})}let CWe=class extends Es{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${zm(lW(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},$We=class extends Es{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},xWe=class extends Es{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function IWe(e){return Kqe(SWe(e))}function SWe(e){const{payload:t,signature:n}=e,{r,s,yParity:i}=n,a=new bWe.Signature(BigInt(r),BigInt(s)).addRecoveryBit(i).recoverPublicKey(lW(t).substring(2));return Lqe(a)}function AWe(e){const t=e.length;let n=0,r=0;for(;r<t;){let s=e.charCodeAt(r++);if((s&4294967168)===0){n++;continue}else if((s&4294965248)===0)n+=2;else{if(s>=55296&&s<=56319&&r<t){const i=e.charCodeAt(r);(i&64512)===56320&&(++r,s=((s&1023)<<10)+(i&1023)+65536)}(s&4294901760)===0?n+=3:n+=4}}return n}function _We(e,t,n){const r=e.length;let s=n,i=0;for(;i<r;){let o=e.charCodeAt(i++);if((o&4294967168)===0){t[s++]=o;continue}else if((o&4294965248)===0)t[s++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&i<r){const a=e.charCodeAt(i);(a&64512)===56320&&(++i,o=((o&1023)<<10)+(a&1023)+65536)}(o&4294901760)===0?(t[s++]=o>>12&15|224,t[s++]=o>>6&63|128):(t[s++]=o>>18&7|240,t[s++]=o>>12&63|128,t[s++]=o>>6&63|128)}t[s++]=o&63|128}}const NWe=new TextEncoder,TWe=50;function PWe(e,t,n){NWe.encodeInto(e,t.subarray(n))}function OWe(e,t,n){e.length>TWe?PWe(e,t,n):_We(e,t,n)}const kWe=4096;function lfe(e,t,n){let r=t;const s=r+n,i=[];let o="";for(;r<s;){const a=e[r++];if((a&128)===0)i.push(a);else if((a&224)===192){const c=e[r++]&63;i.push((a&31)<<6|c)}else if((a&240)===224){const c=e[r++]&63,l=e[r++]&63;i.push((a&31)<<12|c<<6|l)}else if((a&248)===240){const c=e[r++]&63,l=e[r++]&63,u=e[r++]&63;let d=(a&7)<<18|c<<12|l<<6|u;d>65535&&(d-=65536,i.push(d>>>10&1023|55296),d=56320|d&1023),i.push(d)}else i.push(a);i.length>=kWe&&(o+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(o+=String.fromCharCode(...i)),o}const RWe=new TextDecoder,BWe=200;function DWe(e,t,n){const r=e.subarray(t,t+n);return RWe.decode(r)}function UWe(e,t,n){return n>BWe?DWe(e,t,n):lfe(e,t,n)}class Wx{constructor(t,n){Lt(this,"type");Lt(this,"data");this.type=t,this.data=n}}class Zc extends Error{constructor(t){super(t);const n=Object.create(Zc.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Zc.name})}}const U3=4294967295;function LWe(e,t,n){const r=n/4294967296,s=n;e.setUint32(t,r),e.setUint32(t+4,s)}function ufe(e,t,n){const r=Math.floor(n/4294967296),s=n;e.setUint32(t,r),e.setUint32(t+4,s)}function dfe(e,t){const n=e.getInt32(t),r=e.getUint32(t+4);return n*4294967296+r}function MWe(e,t){const n=e.getUint32(t),r=e.getUint32(t+4);return n*4294967296+r}const jWe=-1,FWe=4294967296-1,zWe=17179869184-1;function qWe({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=zWe)if(t===0&&e<=FWe){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e),n}else{const n=e/4294967296,r=e&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|n&3),i.setUint32(4,r),s}else{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,t),ufe(r,4,e),n}}function WWe(e){const t=e.getTime(),n=Math.floor(t/1e3),r=(t-n*1e3)*1e6,s=Math.floor(r/1e9);return{sec:n+s,nsec:r-s*1e9}}function HWe(e){if(e instanceof Date){const t=WWe(e);return qWe(t)}else return null}function VWe(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const n=t.getUint32(0),r=t.getUint32(4),s=(n&3)*4294967296+r,i=n>>>2;return{sec:s,nsec:i}}case 12:{const n=dfe(t,4),r=t.getUint32(0);return{sec:n,nsec:r}}default:throw new Zc(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}function KWe(e){const t=VWe(e);return new Date(t.sec*1e3+t.nsec/1e6)}const GWe={type:jWe,encode:HWe,decode:KWe},LN=class LN{constructor(){Lt(this,"__brand");Lt(this,"builtInEncoders",[]);Lt(this,"builtInDecoders",[]);Lt(this,"encoders",[]);Lt(this,"decoders",[]);this.register(GWe)}register({type:t,encode:n,decode:r}){if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{const s=-1-t;this.builtInEncoders[s]=n,this.builtInDecoders[s]=r}}tryToEncode(t,n){for(let r=0;r<this.builtInEncoders.length;r++){const s=this.builtInEncoders[r];if(s!=null){const i=s(t,n);if(i!=null){const o=-1-r;return new Wx(o,i)}}}for(let r=0;r<this.encoders.length;r++){const s=this.encoders[r];if(s!=null){const i=s(t,n);if(i!=null){const o=r;return new Wx(o,i)}}}return t instanceof Wx?t:null}decode(t,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(t,n,r):new Wx(n,t)}};Lt(LN,"defaultCodec",new LN);let h9=LN;function ZWe(e){return e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function DL(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):ZWe(e)?new Uint8Array(e):Uint8Array.from(e)}const YWe=100,JWe=2048;class dW{constructor(t){Lt(this,"extensionCodec");Lt(this,"context");Lt(this,"useBigInt64");Lt(this,"maxDepth");Lt(this,"initialBufferSize");Lt(this,"sortKeys");Lt(this,"forceFloat32");Lt(this,"ignoreUndefined");Lt(this,"forceIntegerToFloat");Lt(this,"pos");Lt(this,"view");Lt(this,"bytes");Lt(this,"entered",!1);this.extensionCodec=(t==null?void 0:t.extensionCodec)??h9.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??YWe,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??JWe,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new dW({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,n)}ensureBufferSizeToWrite(t){const n=this.pos+t;this.view.byteLength<n&&this.resizeBuffer(n*2)}resizeBuffer(t){const n=new ArrayBuffer(t),r=new Uint8Array(n),s=new DataView(n);r.set(this.bytes),this.view=s,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>
vendor: 17,326 bytes, line 17
17=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=AWe(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),OWe(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,n){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,n);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,n);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const n=t.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else if(n<4294967296)this.writeU8(198),this.writeU32(n);else throw new Error(`Too large binary: ${n}`);const r=DL(t);this.writeU8a(r)}encodeArray(t,n){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const s of t)this.doEncode(s,n+1)}countWithoutUndefined(t,n){let r=0;for(const s of n)t[s]!==void 0&&r++;return r}encodeMap(t,n){const r=Object.keys(t);this.sortKeys&&r.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else if(s<4294967296)this.writeU8(223),this.writeU32(s);else throw new Error(`Too large map object: ${s}`);for(const i of r){const o=t[i];this.ignoreUndefined&&o===void 0||(this.encodeString(i),this.doEncode(o,n+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),s=r.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);this.writeU8(201),this.writeU32(s),this.writeI8(t.type),this.writeU8a(r);return}const n=t.data.length;if(n===1)this.writeU8(212);else if(n===2)this.writeU8(213);else if(n===4)this.writeU8(214);else if(n===8)this.writeU8(215);else if(n===16)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else if(n<4294967296)this.writeU8(201),this.writeU32(n);else throw new Error(`Too large extension object: ${n}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const n=t.length;this.ensureBufferSizeToWrite(n),this.bytes.set(t,this.pos),this.pos+=n}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),LWe(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),ufe(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function hfe(e,t){return new dW(t).encodeSharedRef(e)}function ck(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}const XWe=16,QWe=16;class eHe{constructor(t=XWe,n=QWe){Lt(this,"hit",0);Lt(this,"miss",0);Lt(this,"caches");Lt(this,"maxKeyLength");Lt(this,"maxLengthPerKey");this.maxKeyLength=t,this.maxLengthPerKey=n,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,n,r){const s=this.caches[r-1];e:for(const i of s){const o=i.bytes;for(let a=0;a<r;a++)if(o[a]!==t[n+a])continue e;return i.str}return null}store(t,n){const r=this.caches[t.length-1],s={bytes:t,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=s:r.push(s)}decode(t,n,r){const s=this.find(t,n,r);if(s!=null)return this.hit++,s;this.miss++;const i=lfe(t,n,r),o=Uint8Array.prototype.slice.call(t,n,n+r);return this.store(o,i),i}}const UL="array",i8="map_key",ffe="map_value",tHe=e=>{if(typeof e=="string"||typeof e=="number")return e;throw new Zc("The type of key must be string or number but "+typeof e)};class nHe{constructor(){Lt(this,"stack",[]);Lt(this,"stackHeadPosition",-1)}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const n=this.getUninitializedStateFromPool();n.type=UL,n.position=0,n.size=t,n.array=new Array(t)}pushMapState(t){const n=this.getUninitializedStateFromPool();n.type=i8,n.readCount=0,n.size=t,n.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===UL){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===i8||t.type===ffe){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const L3=-1,hW=new DataView(new ArrayBuffer(0)),rHe=new Uint8Array(hW.buffer);try{hW.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const mQ=new RangeError("Insufficient data"),sHe=new eHe;class fW{constructor(t){Lt(this,"extensionCodec");Lt(this,"context");Lt(this,"useBigInt64");Lt(this,"rawStrings");Lt(this,"maxStrLength");Lt(this,"maxBinLength");Lt(this,"maxArrayLength");Lt(this,"maxMapLength");Lt(this,"maxExtLength");Lt(this,"keyDecoder");Lt(this,"mapKeyConverter");Lt(this,"totalPos",0);Lt(this,"pos",0);Lt(this,"view",hW);Lt(this,"bytes",rHe);Lt(this,"headByte",L3);Lt(this,"stack",new nHe);Lt(this,"entered",!1);this.extensionCodec=(t==null?void 0:t.extensionCodec)??h9.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??U3,this.maxBinLength=(t==null?void 0:t.maxBinLength)??U3,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??U3,this.maxMapLength=(t==null?void 0:t.maxMapLength)??U3,this.maxExtLength=(t==null?void 0:t.maxExtLength)??U3,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:sHe,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??tHe}clone(){return new fW({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=L3,this.stack.reset()}setBuffer(t){const n=DL(t);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===L3&&!this.hasRemaining(1))this.setBuffer(t);else{const n=this.bytes.subarray(this.pos),r=DL(t),s=new Uint8Array(n.length+r.length);s.set(n),s.set(r,n.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:n,pos:r}=this;return new RangeError(`Extra ${n.byteLength-r} of ${n.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let n=!1,r;for await(const a of t){if(n)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{r=this.doDecodeSync(),n=!0}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}if(n){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:s,pos:i,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${ck(s)} at ${o} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,n){if(this.entered){yield*this.clone().decodeMultiAsync(t,n);return}try{this.entered=!0;let r=n,s=-1;for await(const i of t){if(n&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),r&&(s=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let n;if(t>=224)n=t-256;else if(t<192)if(t<128)n=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else{const s=t-160;n=this.decodeString(s,0)}else if(t===192)n=null;else if(t===194)n=!1;else if(t===195)n=!0;else if(t===202)n=this.readF32();else if(t===203)n=this.readF64();else if(t===204)n=this.readU8();else if(t===205)n=this.readU16();else if(t===206)n=this.readU32();else if(t===207)this.useBigInt64?n=this.readU64AsBigInt():n=this.readU64();else if(t===208)n=this.readI8();else if(t===209)n=this.readI16();else if(t===210)n=this.readI32();else if(t===211)this.useBigInt64?n=this.readI64AsBigInt():n=this.readI64();else if(t===217){const s=this.lookU8();n=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();n=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();n=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue e}else n=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue e}else n={}}else if(t===196){const s=this.lookU8();n=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();n=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();n=this.decodeBinary(s,4)}else if(t===212)n=this.decodeExtension(1,0);else if(t===213)n=this.decodeExtension(2,0);else if(t===214)n=this.decodeExtension(4,0);else if(t===215)n=this.decodeExtension(8,0);else if(t===216)n=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();n=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();n=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();n=this.decodeExtension(s,4)}else throw new Zc(`Unrecognized type byte: ${ck(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const s=r.top();if(s.type===UL)if(s.array[s.position]=n,s.position++,s.position===s.size)n=s.array,r.release(s);else continue e;else if(s.type===i8){if(n==="__proto__")throw new Zc("The key __proto__ is not allowed");s.key=this.mapKeyConverter(n),s.type=ffe;continue e}else if(s.map[s.key]=n,s.readCount++,s.readCount===s.size)n=s.map,r.release(s);else{s.key=null,s.type=i8;continue e}}return n}}readHeadByte(){return this.headByte===L3&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=L3}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new Zc(`Unrecognized array type byte: ${ck(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new Zc(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new Zc(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,n):this.decodeBinary(t,n)}decodeUtf8String(t,n){var i;if(t>this.maxStrLength)throw new Zc(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+n+t)throw mQ;const r=this.pos+n;let s;return this.stateIsMapKey()&&((i=this.keyDecoder)!=null&&i.canBeCached(t))?s=this.keyDecoder.decode(this.bytes,r,t):s=UWe(this.bytes,r,t),this.pos+=n+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===i8:!1}decodeBinary(t,n){if(t>this.maxBinLength)throw new Zc(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+n))throw mQ;const r=this.pos+n,s=this.bytes.subarray(r,r+t);return this.pos+=n+t,s}decodeExtension(t,n){if(t>this.maxExtLength)throw new Zc(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+n),s=this.decodeBinary(t,n+1);return this.extensionCodec.decode(s,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=MWe(this.view,this.pos);return this.pos+=8,t}readI64(){const t=dfe(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function pfe(e,t){return new fW(t).decode(e)}var iHe={};const oHe=":";function e0(e){const[t,n]=e.split(oHe);return{namespace:t,reference:n}}function gfe(e,t){return e.includes(":")?[e]:t.chains||[]}const aHe={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},cHe={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};
vendor: 17,656 bytes, line 17
17function je(e,t){const{message:n,code:r}=cHe[e];return{message:t?`${n} ${t}`:n,code:r}}function Yr(e,t){const{message:n,code:r}=aHe[e];return{message:t?`${n} ${t}`:n,code:r}}const lHe="ReactNative",ol={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},uHe="js";function f9(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function d1(){return!cn.getDocument()&&!!cn.getNavigator()&&navigator.product===lHe}function dHe(){return d1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="android"}function hHe(){return d1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="ios"}function A6(){return!f9()&&!!cn.getNavigator()&&!!cn.getDocument()}function BC(){return d1()?ol.reactNative:f9()?ol.node:A6()?ol.browser:ol.unknown}function wQ(){var e;try{return d1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Application)<"u"?(e=globalThis.Application)==null?void 0:e.applicationId:void 0}catch{return}}function fHe(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(([r],[s])=>r.localeCompare(s)).forEach(([r,s])=>{s!=null&&n.set(r,String(s))}),n.toString()}function pHe(e){var n,r;const t=mfe();try{return e!=null&&e.url&&t.url&&new URL(e.url).host!==new URL(t.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${t.url}. This is probably unintended and can lead to issues.`),e.url=t.url),(n=e==null?void 0:e.icons)!=null&&n.length&&e.icons.length>0&&(e.icons=e.icons.filter(s=>s!=="")),{...t,...e,url:(e==null?void 0:e.url)||t.url,name:(e==null?void 0:e.name)||t.name,description:(e==null?void 0:e.description)||t.description,icons:(r=e==null?void 0:e.icons)!=null&&r.length&&e.icons.length>0?e.icons:t.icons}}catch(s){return console.warn("Error populating app metadata",s),e||t}}function mfe(){return gC.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function gHe(){if(BC()===ol.reactNative&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"){const{OS:n,Version:r}=globalThis.Platform;return[n,r].join("-")}const e=MN();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function mHe(){var t;const e=BC();return e===ol.browser?[e,((t=cn.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function wfe(e,t,n){const r=gHe(),s=mHe();return[[e,t].join("-"),[uHe,n].join("-"),r,s].join("/")}function wHe({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:s,projectId:i,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=n.split("?"),u=wfe(e,t,r),d={auth:s,ua:u,projectId:i,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=fHe(l[1]||"",d);return l[0]+"?"+h}function dw(e,t){return e.filter(n=>t.includes(n)).length===e.length}function LL(e){return Object.fromEntries(e.entries())}function ML(e){return new Map(Object.entries(e))}function q1(e=V.FIVE_MINUTES,t){const n=V.toMiliseconds(e||V.FIVE_MINUTES);let r,s,i,o;return{resolve:a=>{i&&r&&(clearTimeout(i),r(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const l=je("EXPIRED"),u=new Error(t||l.message);u.code=l.code,c(u)},n),r=a,s=c})}}function Uh(e,t,n){return new Promise(async(r,s)=>{const i=setTimeout(()=>s(new Error(n)),t);try{const o=await e;r(o)}catch(o){s(o)}clearTimeout(i)})}function yfe(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function yHe(e){return yfe("topic",e)}function bHe(e){return yfe("id",e)}function bfe(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function Ss(e,t){return V.fromMiliseconds(Date.now()+V.toMiliseconds(e))}function kh(e){return Date.now()>=V.toMiliseconds(e)}function lr(e,t){return`${e}${t?`:${t}`:""}`}function Wh(e=[],t=[]){return[...new Set([...e,...t])]}async function vHe({id:e,topic:t,wcDeepLink:n}){var r,s;try{if(!n)return;const i=(r=typeof n=="string"?JSON.parse(n):n)==null?void 0:r.href;if(typeof i!="string")return;const o=EHe(i,e,t),a=BC();if(a===ol.browser){if(!((s=cn.getDocument())!=null&&s.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}CHe(o)}else a===ol.reactNative&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"&&await globalThis.Linking.openURL(o)}catch(i){console.error(i)}}function EHe(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let s=`${e}`;if(e.startsWith("https://t.me")){const i=e.includes("?")?"&startapp=":"?startapp=";s=`${s}${i}${SHe(r,!0)}`}else s=`${s}/wc?${r}`;return s}function CHe(e){let t="_self";IHe()?t="_top":(xHe()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function $He(e,t){let n="";try{if(A6()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function yQ(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function bQ(){return typeof crypto<"u"&&(crypto!=null&&crypto.randomUUID)?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function pW(){return typeof process<"u"&&iHe.IS_VITEST==="true"}function xHe(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function IHe(){try{return window.self!==window.top}catch{return!1}}function SHe(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function vfe(e){return Buffer.from(e,"base64").toString("utf-8")}function AHe(e){return new Promise(t=>setTimeout(t,e))}let _He=class{constructor({limit:t}){this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}};const Hx=BigInt(2**32-1),vQ=BigInt(32);function Efe(e,t=!1){return t?{h:Number(e&Hx),l:Number(e>>vQ&Hx)}:{h:Number(e>>vQ&Hx)|0,l:Number(e&Hx)|0}}function Cfe(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:o,l:a}=Efe(e[i],t);[r[i],s[i]]=[o,a]}return[r,s]}const EQ=(e,t,n)=>e>>>n,CQ=(e,t,n)=>e<<32-n|t>>>n,qg=(e,t,n)=>e>>>n|t<<32-n,Wg=(e,t,n)=>e<<32-n|t>>>n,SE=(e,t,n)=>e<<64-n|t>>>n-32,AE=(e,t,n)=>e>>>n-32|t<<64-n,NHe=(e,t)=>t,THe=(e,t)=>e,PHe=(e,t,n)=>e<<n|t>>>32-n,OHe=(e,t,n)=>t<<n|e>>>32-n,kHe=(e,t,n)=>t<<n-32|e>>>64-n,RHe=(e,t,n)=>e<<n-32|t>>>64-n;function pd(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const gW=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),mW=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,BHe=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),DHe=(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,UHe=(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0),LHe=(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0,i2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function I7(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function b0(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Pd(e,...t){if(!I7(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function S7(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");b0(e.outputLen),b0(e.blockLen)}function qm(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function wW(e,t){Pd(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function z8(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Eu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function lk(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function gh(e,t){return e<<32-t|e>>>t}const $fe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function xfe(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const up=$fe?e=>e:e=>xfe(e);function MHe(e){for(let t=0;t<e.length;t++)e[t]=xfe(e[t]);return e}const Hg=$fe?e=>e:MHe,Ife=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",jHe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Uv(e){if(Pd(e),Ife)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=jHe[e[n]];return t}const Lf={_0:48,_9:57,A:65,F:70,a:97,f:102};function $Q(e){if(e>=Lf._0&&e<=Lf._9)return e-Lf._0;if(e>=Lf.A&&e<=Lf.F)return e-(Lf.A-10);if(e>=Lf.a&&e<=Lf.f)return e-(Lf.a-10)}function p9(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ife)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=$Q(e.charCodeAt(i)),a=$Q(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Sfe(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Nd(e){return typeof e=="string"&&(e=Sfe(e)),Pd(e),e}function em(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];Pd(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}let A7=class{};function DC(e){const t=r=>e().update(Nd(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function FHe(e){const t=(r,s)=>e(s).update(Nd(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function ib(e=32){if(i2&&typeof i2.getRandomValues=="function")return i2.getRandomValues(new Uint8Array(e));if(i2&&typeof i2.randomBytes=="function")return Uint8Array.from(i2.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const zHe=BigInt(0),M3=BigInt(1),qHe=BigInt(2),WHe=BigInt(7),HHe=BigInt(256),VHe=BigInt(113),Afe=[],_fe=[],Nfe=[];for(let e=0,t=M3,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Afe.push(2*(5*r+n)),_fe.push((e+1)*(e+2)/2%64);let s=zHe;for(let i=0;i<7;i++)t=(t<<M3^(t>>WHe)*VHe)%HHe,t&qHe&&(s^=M3<<(M3<<BigInt(i))-M3);Nfe.push(s)}const Tfe=Cfe(Nfe,!0),KHe=Tfe[0],GHe=Tfe[1],xQ=(e,t,n)=>n>32?kHe(e,t,n):PHe(e,t,n),IQ=(e,t,n)=>n>32?RHe(e,t,n):OHe(e,t,n);function ZHe(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=xQ(l,u,1)^n[a],h=IQ(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=_fe[o],c=xQ(s,i,a),l=IQ(s,i,a),u=Afe[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=KHe[r],e[1]^=GHe[r]}Eu(n)}let YHe=class Pfe extends A7{constructor(t,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,b0(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=z8(this.state)}clone(){return this._cloneInto()}keccak(){Hg(this.state32),ZHe(this.state32,this.rounds),Hg(this.state32),this.posOut=0,this.pos=0}update(t){qm(this),t=Nd(t),Pd(t);const{blockLen:n,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){qm(this,!1),Pd(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return b0(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(wW(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Eu(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new Pfe(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}};const JHe=(e,t,n)=>DC(()=>new YHe(t,e,n)),XHe=JHe(1,136,256/8);function QHe(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}function eVe(e,t,n){return e&t^~e&n}function tVe(e,t,n){return e&t^e&n^t&n}let Ofe=class extends A7{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=lk(this.buffer)}update(t){qm(this),t=Nd(t),Pd(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=lk(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){qm(this),wW(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,Eu(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;QHe(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=lk(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=i,t.length=s,t.pos=a,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const ag=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),po=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),go=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),nVe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),cg=new Uint32Array(64);let rVe=class extends Ofe{constructor(t=32){super(64,t,8,!1),this.A=ag[0]|0,this.B=ag[1]|0,this.C=ag[2]|0,this.D=ag[3]|0,this.E=ag[4]|0,this.F=ag[5]|0,this.G=ag[6]|0,this.H=ag[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)cg[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=cg[d-15],f=cg[d-2],g=gh(h,7)^gh(h,18)^h>>>3,p=gh(f,17)^gh(f,19)^f>>>10;cg[d]=p+cg[d-7]+g+cg[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=gh(a,6)^gh(a,11)^gh(a,25),f=u+h+eVe(a,c,l)+nVe[d]+cg[d]|0,g=(gh(r,2)^gh(r,13)^gh(r,22))+tVe(r,s,i)|0;u=l,l=c,c=a,a=o+f|0,o=i,i=s,s=r,r=f+g|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,c,l,u)}roundClean(){Eu(cg)}
17destroy(){this.set(0,0,0,0,0,0,0,0),Eu(this.buffer)}};const kfe=Cfe(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
175771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),sVe=kfe[0],iVe=kfe[1],lg=new Uint32Array(80),ug=new Uint32Array(80);let yW=class extends Ofe{constructor(t=64){super(128,t,16,!1),this.Ah=go[0]|0,this.Al=go[1]|0,this.Bh=go[2]|0,this.Bl=go[3]|0,this.Ch=go[4]|0,this.Cl=go[5]|0,this.Dh=go[6]|0,this.Dl=go[7]|0,this.Eh=go[8]|0,this.El=go[9]|0,this.Fh=go[10]|0,this.Fl=go[11]|0,this.Gh=go[12]|0,this.Gl=go[13]|0,this.Hh=go[14]|0,this.Hl=go[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:p,Hl:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=f|0,this.Gl=g|0,this.Hh=p|0,this.Hl=m|0}process(t,n){for(let E=0;E<16;E++,n+=4)lg[E]=t.getUint32(n),ug[E]=t.getUint32(n+=4);for(let E=16;E<80;E++){const b=lg[E-15]|0,S=ug[E-15]|0,v=qg(b,S,1)^qg(b,S,8)^EQ(b,S,7),x=Wg(b,S,1)^Wg(b,S,8)^CQ(b,S,7),A=lg[E-2]|0,I=ug[E-2]|0,O=qg(A,I,19)^SE(A,I,61)^EQ(A,I,6),N=Wg(A,I,19)^AE(A,I,61)^CQ(A,I,6),T=BHe(x,N,ug[E-7],ug[E-16]),P=DHe(T,v,O,lg[E-7],lg[E-16]);lg[E]=P|0,ug[E]=T|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:p,Gl:m,Hh:w,Hl:C}=this;for(let E=0;E<80;E++){const b=qg(d,h,14)^qg(d,h,18)^SE(d,h,41),S=Wg(d,h,14)^Wg(d,h,18)^AE(d,h,41),v=d&f^~d&p,x=h&g^~h&m,A=UHe(C,S,x,iVe[E],ug[E]),I=LHe(A,w,b,v,sVe[E],lg[E]),O=A|0,N=qg(r,s,28)^SE(r,s,34)^SE(r,s,39),T=Wg(r,s,28)^AE(r,s,34)^AE(r,s,39),P=r&i^r&a^i&a,_=s&o^s&c^o&c;w=p|0,C=m|0,p=f|0,m=g|0,f=d|0,g=h|0,{h:d,l:h}=pd(l|0,u|0,I|0,O|0),l=a|0,u=c|0,a=i|0,c=o|0,i=r|0,o=s|0;const y=gW(O,T,_);r=mW(y,I,N,P),s=y|0}({h:r,l:s}=pd(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=pd(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=pd(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=pd(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:h}=pd(this.Eh|0,this.El|0,d|0,h|0),{h:f,l:g}=pd(this.Fh|0,this.Fl|0,f|0,g|0),{h:p,l:m}=pd(this.Gh|0,this.Gl|0,p|0,m|0),{h:w,l:C}=pd(this.Hh|0,this.Hl|0,w|0,C|0),this.set(r,s,i,o,a,c,l,u,d,h,f,g,p,m,w,C)}roundClean(){Eu(lg,ug)}destroy(){Eu(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},oVe=class extends yW{constructor(){super(48),this.Ah=po[0]|0,this.Al=po[1]|0,this.Bh=po[2]|0,this.Bl=po[3]|0,this.Ch=po[4]|0,this.Cl=po[5]|0,this.Dh=po[6]|0,this.Dl=po[7]|0,this.Eh=po[8]|0,this.El=po[9]|0,this.Fh=po[10]|0,this.Fl=po[11]|0,this.Gh=po[12]|0,this.Gl=po[13]|0,this.Hh=po[14]|0,this.Hl=po[15]|0}};const mo=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);let aVe=class extends yW{constructor(){super(32),this.Ah=mo[0]|0,this.Al=mo[1]|0,this.Bh=mo[2]|0,this.Bl=mo[3]|0,this.Ch=mo[4]|0,this.Cl=mo[5]|0,this.Dh=mo[6]|0,this.Dl=mo[7]|0,this.Eh=mo[8]|0,this.El=mo[9]|0,this.Fh=mo[10]|0,this.Fl=mo[11]|0,this.Gh=mo[12]|0,this.Gl=mo[13]|0,this.Hh=mo[14]|0,this.Hl=mo[15]|0}};const _7=DC(()=>new rVe),cVe=DC(()=>new yW),lVe=DC(()=>new oVe),uVe=DC(()=>new aVe),dVe=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),Fs=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),nt=new Uint32Array(32);function dg(e,t,n,r,s,i){const o=s[i],a=s[i+1];let c=nt[2*e],l=nt[2*e+1],u=nt[2*t],d=nt[2*t+1],h=nt[2*n],f=nt[2*n+1],g=nt[2*r],p=nt[2*r+1],m=gW(c,u,o);l=mW(m,l,d,a),c=m|0,{Dh:p,Dl:g}={Dh:p^l,Dl:g^c},{Dh:p,Dl:g}={Dh:NHe(p,g),Dl:THe(p)},{h:f,l:h}=pd(f,h,p,g),{Bh:d,Bl:u}={Bh:d^f,Bl:u^h},{Bh:d,Bl:u}={Bh:qg(d,u,24),Bl:Wg(d,u,24)},nt[2*e]=c,nt[2*e+1]=l,nt[2*t]=u,nt[2*t+1]=d,nt[2*n]=h,nt[2*n+1]=f,nt[2*r]=g,nt[2*r+1]=p}function hg(e,t,n,r,s,i){const o=s[i],a=s[i+1];let c=nt[2*e],l=nt[2*e+1],u=nt[2*t],d=nt[2*t+1],h=nt[2*n],f=nt[2*n+1],g=nt[2*r],p=nt[2*r+1],m=gW(c,u,o);l=mW(m,l,d,a),c=m|0,{Dh:p,Dl:g}={Dh:p^l,Dl:g^c},{Dh:p,Dl:g}={Dh:qg(p,g,16),Dl:Wg(p,g,16)},{h:f,l:h}=pd(f,h,p,g),{Bh:d,Bl:u}={Bh:d^f,Bl:u^h},{Bh:d,Bl:u}={Bh:SE(d,u,63),Bl:AE(d,u,63)},nt[2*e]=c,nt[2*e+1]=l,nt[2*t]=u,nt[2*t+1]=d,nt[2*n]=h,nt[2*n+1]=f,nt[2*r]=g,nt[2*r+1]=p}function hVe(e,t={},n,r,s){if(b0(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:i,salt:o,personalization:a}=t;if(i!==void 0&&(i.length<1||i.length>n))throw new Error("key length must be undefined or 1.."+n);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(a!==void 0&&a.length!==s)throw new Error("personalization must be undefined or "+s)}let fVe=class extends A7{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,b0(t),b0(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=z8(this.buffer)}update(t){qm(this),t=Nd(t),Pd(t);const{blockLen:n,buffer:r,buffer32:s}=this,i=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<i;){this.pos===n&&(Hg(s),this.compress(s,0,!1),Hg(s),this.pos=0);const l=Math.min(n-this.pos,i-c),u=o+c;if(l===n&&!(u%4)&&c+l<i){const d=new Uint32Array(a,u,Math.floor((i-c)/4));Hg(d);for(let h=0;c+n<i;h+=s.length,c+=n)this.length+=n,this.compress(d,h,!1);Hg(d);continue}r.set(t.subarray(c,c+l),this.pos),this.pos+=l,this.length+=l,c+=l}return this}digestInto(t){qm(this),wW(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,Eu(this.buffer.subarray(n)),Hg(r),this.compress(r,0,!0),Hg(r);const s=z8(t);
vendor: 59,962 bytes, lines 17-20
17this.get().forEach((i,o)=>s[o]=up(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:i,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(n),t.destroyed=i,t.finished=s,t.length=r,t.pos=a,t.outputLen=o,t}clone(){return this._cloneInto()}},pVe=class extends fVe{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=Fs[0]|0,this.v0h=Fs[1]|0,this.v1l=Fs[2]|0,this.v1h=Fs[3]|0,this.v2l=Fs[4]|0,this.v2h=Fs[5]|0,this.v3l=Fs[6]|0,this.v3h=Fs[7]|0,this.v4l=Fs[8]|0,this.v4h=Fs[9]|0,this.v5l=Fs[10]|0,this.v5h=Fs[11]|0,this.v6l=Fs[12]|0,this.v6h=Fs[13]|0,this.v7l=Fs[14]|0,this.v7h=Fs[15]|0,hVe(n,t,64,16,16);let{key:r,personalization:s,salt:i}=t,o=0;if(r!==void 0&&(r=Nd(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,i!==void 0){i=Nd(i);const a=z8(i);this.v4l^=up(a[0]),this.v4h^=up(a[1]),this.v5l^=up(a[2]),this.v5h^=up(a[3])}if(s!==void 0){s=Nd(s);const a=z8(s);this.v6l^=up(a[0]),this.v6h^=up(a[1]),this.v7l^=up(a[2]),this.v7h^=up(a[3])}if(r!==void 0){const a=new Uint8Array(this.blockLen);a.set(r),this.update(a)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:i,v2h:o,v3l:a,v3h:c,v4l:l,v4h:u,v5l:d,v5h:h,v6l:f,v6h:g,v7l:p,v7h:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=i|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=l|0,this.v4h=u|0,this.v5l=d|0,this.v5h=h|0,this.v6l=f|0,this.v6h=g|0,this.v7l=p|0,this.v7h=m|0}compress(t,n,r){this.get().forEach((c,l)=>nt[l]=c),nt.set(Fs,16);let{h:s,l:i}=Efe(BigInt(this.length));nt[24]=Fs[8]^i,nt[25]=Fs[9]^s,r&&(nt[28]=~nt[28],nt[29]=~nt[29]);let o=0;const a=dVe;for(let c=0;c<12;c++)dg(0,4,8,12,t,n+2*a[o++]),hg(0,4,8,12,t,n+2*a[o++]),dg(1,5,9,13,t,n+2*a[o++]),hg(1,5,9,13,t,n+2*a[o++]),dg(2,6,10,14,t,n+2*a[o++]),hg(2,6,10,14,t,n+2*a[o++]),dg(3,7,11,15,t,n+2*a[o++]),hg(3,7,11,15,t,n+2*a[o++]),dg(0,5,10,15,t,n+2*a[o++]),hg(0,5,10,15,t,n+2*a[o++]),dg(1,6,11,12,t,n+2*a[o++]),hg(1,6,11,12,t,n+2*a[o++]),dg(2,7,8,13,t,n+2*a[o++]),hg(2,7,8,13,t,n+2*a[o++]),dg(3,4,9,14,t,n+2*a[o++]),hg(3,4,9,14,t,n+2*a[o++]);this.v0l^=nt[0]^nt[16],this.v0h^=nt[1]^nt[17],this.v1l^=nt[2]^nt[18],this.v1h^=nt[3]^nt[19],this.v2l^=nt[4]^nt[20],this.v2h^=nt[5]^nt[21],this.v3l^=nt[6]^nt[22],this.v3h^=nt[7]^nt[23],this.v4l^=nt[8]^nt[24],this.v4h^=nt[9]^nt[25],this.v5l^=nt[10]^nt[26],this.v5h^=nt[11]^nt[27],this.v6l^=nt[12]^nt[28],this.v6h^=nt[13]^nt[29],this.v7l^=nt[14]^nt[30],this.v7h^=nt[15]^nt[31],Eu(nt)}destroy(){this.destroyed=!0,Eu(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const gVe=FHe(e=>new pVe(e)),mVe="https://rpc.walletconnect.org/v1";function Rfe(e){const t=`�Ethereum Signed Message: 18${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(XHe(n)).toString("hex")}async function wVe(e,t,n,r,s,i){switch(n.t){case"eip191":return await yVe(e,t,n.s);case"eip1271":return await bVe(e,t,n.s,r,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function yVe(e,t,n){const r=vWe(n);return IWe({payload:Rfe(t),signature:r}).toLowerCase()===e.toLowerCase()}async function bVe(e,t,n,r,s,i){const o=e0(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l=n.substring(2),u=(l.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Rfe(t)).substring(2),h=a+d+c+u+l,f=await fetch(`${i||mVe}/?chainId=${r}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:vVe(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:h},"latest"]})}),{result:g}=await f.json();return g?g.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function vVe(){return Date.now()+Math.floor(Math.random()*1e3)}function EVe(e){const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);const r=n[0];if(r===0)throw new Error("No signatures found");const s=1+r*64;if(n.length<s)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const i=Buffer.from(e,"base64").slice(1,65);return wf.encode(i)}function CVe(e){const t=new Uint8Array(Buffer.from(e,"base64")),n=Array.from("TransactionData::").map(i=>i.charCodeAt(0)),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const s=gVe(r,{dkLen:32});return wf.encode(s)}function SQ(e){const t=new Uint8Array(_7($Ve(e)));return wf.encode(t)}function $Ve(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="object"&&(e!=null&&e.data))return new Uint8Array(Object.values(e.data));if(typeof e=="object"&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function AQ(e){const t=Buffer.from(e,"base64"),n=pfe(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=hfe(n),s=Buffer.from("TX"),i=Buffer.concat([s,Buffer.from(r)]),o=uVe(i);return wq.encode(o).replace(/=+$/,"")}function uk(e){const t=[];let n=BigInt(e);for(;n>=0x80n;)t.push(Number(n&0x7fn|0x80n)),n>>=7n;return t.push(Number(n)),Buffer.from(t)}function xVe(e){const t=Buffer.from(e.signed.bodyBytes,"base64"),n=Buffer.from(e.signed.authInfoBytes,"base64"),r=Buffer.from(e.signature.signature,"base64"),s=[];s.push(Buffer.from([10])),s.push(uk(t.length)),s.push(t),s.push(Buffer.from([18])),s.push(uk(n.length)),s.push(n),s.push(Buffer.from([26])),s.push(uk(r.length)),s.push(r);const i=Buffer.concat(s),o=_7(i);return Buffer.from(o).toString("hex").toUpperCase()}function IVe(e){var n,r;const t=[];try{if(typeof e=="string")return t.push(e),t;if(typeof e!="object")return t;e!=null&&e.id&&t.push(e.id);const s=(r=(n=e==null?void 0:e.capabilities)==null?void 0:n.caip345)==null?void 0:r.transactionHashes;s&&t.push(...s)}catch(s){console.warn("getWalletSendCallsHashes failed: ",s)}return t}const Bfe="did:pkh:",SVe={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},AVe=e=>e?SVe[e]||e:"",N7=e=>e==null?void 0:e.split(":"),_Ve=e=>{const t=e&&N7(e);if(t)return e.includes(Bfe)?t[3]:t[1]},NVe=e=>{const t=e&&N7(e);if(t)return e.includes(Bfe)?t[2]:t[0]},jL=e=>{const t=e&&N7(e);if(t)return t[2]+":"+t[3]},g9=e=>{const t=e&&N7(e);if(t)return t.pop()};async function _Q(e){const{cacao:t,projectId:n}=e,{s:r,p:s}=t,i=Dfe(s,s.iss),o=g9(s.iss);return await wVe(o,i,r,jL(s.iss),n)}const Dfe=(e,t)=>{const n=NVe(t);if(!n)throw new Error("Invalid issuer: "+t);const r=`${e.domain} wants you to sign in with your ${AVe(n)} account:`,s=g9(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0;const o=`URI: ${e.aud||e.uri}`,a=`Version: ${e.version}`,c=`Chain ID: ${_Ve(t)}`,l=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,d=e.exp?`Expiration Time: ${e.exp}`:void 0,h=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(m=>` 19- ${m}`).join("")}`:void 0,p=bS(e.resources);if(p){const m=q8(p);i=LVe(i,m)}return[r,s,"",i,"",o,a,c,l,u,d,h,f,g].filter(m=>m!=null).join(` 20`)};function TVe(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function PVe(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function Hw(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(s=>{const i=r[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);i.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function OVe(e,t,n,r={}){return n==null||n.sort((s,i)=>s.localeCompare(i)),{att:{[e]:kVe(t,n,r)}}}function kVe(e,t,n={}){t=t==null?void 0:t.sort((s,i)=>s.localeCompare(i));const r=t.map(s=>({[`${e}/${s}`]:[n]}));return Object.assign({},...r)}function Ufe(e){return Hw(e),`urn:recap:${TVe(e).replace(/=/g,"")}`}function q8(e){const t=PVe(e.replace("urn:recap:",""));return Hw(t),t}function RVe(e,t,n){const r=OVe(e,t,n);return Ufe(r)}function BVe(e){return e&&e.includes("urn:recap:")}function DVe(e,t){const n=q8(e),r=q8(t),s=UVe(n,r);return Ufe(s)}function UVe(e,t){Hw(e),Hw(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((s,i)=>s.localeCompare(i)),r={att:{}};return n.forEach(s=>{var i,o;Object.keys(((i=e.att)==null?void 0:i[s])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;r.att[s]={...r.att[s],[a]:((c=e.att[s])==null?void 0:c[a])||((l=t.att[s])==null?void 0:l[a])}})}),r}function LVe(e="",t){Hw(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let s=0;Object.keys(t.att).forEach(a=>{const c=Object.keys(t.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));c.sort((d,h)=>d.action.localeCompare(h.action));const l={};c.forEach(d=>{l[d.ability]||(l[d.ability]=[]),l[d.ability].push(d.action)});const u=Object.keys(l).map(d=>(s++,`(${s}) '${d}': '${l[d].join("', '")}' for '${a}'.`));r.push(u.join(", ").replace(".,","."))});const i=r.join(" "),o=`${n}${i}`;return`${e?e+" ":""}${o}`}function NQ(e){var r;const t=q8(e);Hw(t);const n=(r=t.att)==null?void 0:r.eip155;return n?Object.keys(n).map(s=>s.split("/")[1]):[]}function TQ(e){const t=q8(e);Hw(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(s=>{var i;(i=s==null?void 0:s[0])!=null&&i.chains&&n.push(s[0].chains)})}),[...new Set(n.flat())]}function bS(e){if(!e)return;const t=e==null?void 0:e[e.length-1];return BVe(t)?t:void 0}function Lfe(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function FL(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function dk(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ga(e,...t){if(!Lfe(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function PQ(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function MVe(e,t){Ga(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function bm(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function l5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function jVe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const FVe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function zVe(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function zL(e){if(typeof e=="string")e=zVe(e);else if(Lfe(e))e=qL(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function qVe(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function WVe(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const HVe=(e,t)=>{function n(r,...s){if(Ga(r),!FVe)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?Ga(l):Ga(l,e.nonceLength)}const i=e.tagLength;i&&s[1]!==void 0&&Ga(s[1]);const o=t(r,...s),a=(l,u)=>{if(u!==void 0){if(l!==2)throw new Error("cipher output not supported");Ga(u)}};let c=!1;return{encrypt(l,u){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Ga(l),a(o.encrypt.length,u),o.encrypt(l,u)},decrypt(l,u){if(Ga(l),i&&l.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,u),o.decrypt(l,u)}}}return Object.assign(n,e),n};function OQ(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!KVe(t))throw new Error("invalid output, must be aligned");return t}function kQ(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i);e.setUint32(t+4,o,r),e.setUint32(t+0,a,r)}function VVe(e,t,n){FL(n);const r=new Uint8Array(16),s=jVe(r);return kQ(s,0,BigInt(t),n),kQ(s,8,BigInt(e),n),r}function KVe(e){return e.byteOffset%4===0}function qL(e){return Uint8Array.from(e)}const Mfe=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),GVe=Mfe("expand 16-byte k"),ZVe=Mfe("expand 32-byte k"),YVe=bm(GVe),JVe=bm(ZVe);function zn(e,t){return e<<t|e>>>32-t}function WL(e){return e.byteOffset%4===0}const Vx=64,XVe=16,jfe=2**32-1,RQ=new Uint32Array;function QVe(e,t,n,r,s,i,o,a){const c=s.length,l=new Uint8Array(Vx),u=bm(l),d=WL(s)&&WL(i),h=d?bm(s):RQ,f=d?bm(i):RQ;for(let g=0;g<c;o++){if(e(t,n,r,u,o,a),o>=jfe)throw new Error("arx: counter overflow");const p=Math.min(Vx,c-g);if(d&&p===Vx){const m=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let w=0,C;w<XVe;w++)C=m+w,f[C]=h[C]^u[w];g+=Vx;continue}for(let m=0,w;m<p;m++)w=g+m,i[w]=s[w]^l[m];g+=p}}function eKe(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:s,counterRight:i,rounds:o}=qVe({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return dk(s),dk(o),FL(i),FL(n),(a,c,l,u,d=0)=>{Ga(a),Ga(c),Ga(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),Ga(u),dk(d),d<0||d>=jfe)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g=a.length,p,m;if(g===32)f.push(p=qL(a)),m=JVe;else if(g===16&&n)p=new Uint8Array(32),p.set(a),p.set(a,16),m=YVe,f.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${g}`);WL(c)||f.push(c=qL(c));const w=bm(p);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,w,bm(c.subarray(0,16)),w),c=c.subarray(16)}const C=16-s;if(C!==c.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const b=new Uint8Array(12);b.set(c,i?0:12-c.length),c=b,f.push(c)}const E=bm(c);return QVe(e,m,w,E,l,u,d,o),l5(...f),u}}const Di=(e,t)=>e[t++]&255|(e[t++]&255)<<8;let tKe=class{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=zL(t),Ga(t,32);const n=Di(t,0),r=Di(t,2),s=Di(t,4),i=Di(t,6),o=Di(t,8),a=Di(t,10),c=Di(t,12),l=Di(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Di(t,16+2*u)}process(t,n,r=!1){const s=r?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],l=o[2],u=o[3],d=o[4],h=o[5],f=o[6],g=o[7],p=o[8],m=o[9],w=Di(t,n+0),C=Di(t,n+2),E=Di(t,n+4),b=Di(t,n+6),S=Di(t,n+8),v=Di(t,n+10),x=Di(t,n+12),A=Di(t,n+14);let I=i[0]+(w&8191),O=i[1]+((w>>>13|C<<3)&8191),N=i[2]+((C>>>10|E<<6)&8191),T=i[3]+((E>>>7|b<<9)&8191),P=i[4]+((b>>>4|S<<12)&8191),_=i[5]+(S>>>1&8191),y=i[6]+((S>>>14|v<<2)&8191),$=i[7]+((v>>>11|x<<5)&8191),R=i[8]+((x>>>8|A<<8)&8191),B=i[9]+(A>>>5|s),k=0,D=k+I*a+O*(5*m)+N*(5*p)+T*(5*g)+P*(5*f);k=D>>>13,D&=8191,D+=_*(5*h)+y*(5*d)+$*(5*u)+R*(5*l)+B*(5*c),k+=D>>>13,D&=8191;let U=k+I*c+O*a+N*(5*m)+T*(5*p)+P*(5*g);k=U>>>13,U&=8191,U+=_*(5*f)+y*(5*h)+$*(5*d)+R*(5*u)+B*(5*l),k+=U>>>13,U&=8191;let F=k+I*l+O*c+N*a+T*(5*m)+P*(5*p);k=F>>>13,F&=8191,F+=_*(5*g)+y*(5*f)+$*(5*h)+R*(5*d)+B*(5*u),k+=F>>>13,F&=8191;let K=k+I*u+O*l+N*c+T*a+P*(5*m);k=K>>>13,K&=8191,K+=_*(5*p)+y*(5*g)+$*(5*f)+R*(5*h)+B*(5*d),k+=K>>>13,K&=8191;let q=k+I*d+O*u+N*l+T*c+P*a;k=q>>>13,q&=8191,q+=_*(5*m)+y*(5*p)+$*(5*g)+R*(5*f)+B*(5*h),k+=q>>>13,q&=8191;let H=k+I*h+O*d+N*u+T*l+P*c;k=H>>>13,H&=8191,H+=_*a+y*(5*m)+$*(5*p)+R*(5*g)+B*(5*f),k+=H>>>13,H&=8191;let Z=k+I*f+O*h+N*d+T*u+P*l;k=Z>>>13,Z&=8191,Z+=_*c+y*a+$*(5*m)+R*(5*p)+B*(5*g),k+=Z>>>13,Z&=8191;let ee=k+I*g+O*f+N*h+T*d+P*u;k=ee>>>13,ee&=8191,ee+=_*l+y*c+$*a+R*(5*m)+B*(5*p),k+=ee>>>13,ee&=8191;let ie=k+I*p+O*g+N*f+T*h+P*d;k=ie>>>13,ie&=8191,ie+=_*u+y*l+$*c+R*a+B*(5*m),k+=ie>>>13,ie&=8191;let X=k+I*m+O*p+N*g+T*f+P*h;k=X>>>13,X&=8191,X+=_*d+y*u+$*l+R*c+B*a,k+=X>>>13,X&=8191,k=(k<<2)+k|0,k=k+D|0,D=k&8191,k=k>>>13,U+=k,i[0]=D,i[1]=U,i[2]=F,i[3]=K,i[4]=q,i[5]=H,i[6]=Z,i[7]=ee,i[8]=ie,i[9]=X}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let s=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=s,s=t[a]>>>13,t[a]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,r[0]=t[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+n[0];t[0]=o&65535;for(let a=1;a<8;a++)o=(t[a]+n[a]|0)+(o>>>16)|0,t[a]=o&65535;l5(r)}update(t){PQ(this),t=zL(t),Ga(t);const{buffer:n,blockLen:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o===r){for(;r<=s-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){l5(this.h,this.r,this.buffer,this.pad)}digestInto(t){PQ(this),MVe(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)t[i++]=r[o]>>>0,t[i++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}};function nKe(e){const t=(r,s)=>e(s).update(zL(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const rKe=nKe(e=>new tKe(e));function sKe(e,t,n,r,s,i=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],d=t[1],h=t[2],f=t[3],g=t[4],p=t[5],m=t[6],w=t[7],C=s,E=n[0],b=n[1],S=n[2],v=o,x=a,A=c,I=l,O=u,N=d,T=h,P=f,_=g,y=p,$=m,R=w,B=C,k=E,D=b,U=S;for(let K=0;K<i;K+=2)v=v+O|0,B=zn(B^v,16),_=_+B|0,O=zn(O^_,12),v=v+O|0,B=zn(B^v,8),_=_+B|0,O=zn(O^_,7),x=x+N|0,k=zn(k^x,16),y=y+k|0,N=zn(N^y,12),x=x+N|0,k=zn(k^x,8),y=y+k|0,N=zn(N^y,7),A=A+T|0,D=zn(D^A,16),$=$+D|0,T=zn(T^$,12),A=A+T|0,D=zn(D^A,8),$=$+D|0,T=zn(T^$,7),I=I+P|0,U=zn(U^I,16),R=R+U|0,P=zn(P^R,12),I=I+P|0,U=zn(U^I,8),R=R+U|0,P=zn(P^R,7),v=v+N|0,U=zn(U^v,16),$=$+U|0,N=zn(N^$,12),v=v+N|0,U=zn(U^v,8),$=$+U|0,N=zn(N^$,7),x=x+T|0,B=zn(B^x,16),R=R+B|0,T=zn(T^R,12),x=x+T|0,B=zn(B^x,8),R=R+B|0,T=zn(T^R,7),A=A+P|0,k=zn(k^A,16),_=_+k|0,P=zn(P^_,12),A=A+P|0,k=zn(k^A,8),_=_+k|0,P=zn(P^_,7),I=I+O|0,D=zn(D^I,16),y=y+D|0,O=zn(O^y,12),I=I+O|0,D=zn(D^I,8),y=y+D|0,O=zn(O^y,7);let F=0;r[F++]=o+v|0,r[F++]=a+x|0,r[F++]=c+A|0,r[F++]=l+I|0,r[F++]=u+O|0,r[F++]=d+N|0,r[F++]=h+T|0,r[F++]=f+P|0,r[F++]=g+_|0,r[F++]=p+y|0,r[F++]=m+$|0,r[F++]=w+R|0,r[F++]=C+B|0,r[F++]=E+k|0,r[F++]=b+D|0,r[F++]=S+U|0}const iKe=eKe(sKe,{counterRight:!1,counterLength:4,allowShortKeys:!1}),oKe=new Uint8Array(16),BQ=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(oKe.subarray(n))},aKe=new Uint8Array(32);function DQ(e,t,n,r,s){const i=e(t,n,aKe),o=rKe.create(i);s&&BQ(o,s),BQ(o,r);const a=VVe(r.length,s?s.length:0,!0);o.update(a);const c=o.digest();return l5(i,a),c}const cKe=e=>(t,n,r)=>({encrypt(s,i){const o=s.length;i=OQ(o+16,i,!1),i.set(s);const a=i.subarray(0,-16);e(t,n,a,a,1);const c=DQ(e,t,n,a,r);return i.set(c,o),l5(c),i},decrypt(s,i){i=OQ(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=DQ(e,t,n,o,r);if(!WVe(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),l5(c),i}}),Ffe=HVe({blockSize:64,nonceLength:12,tagLength:16},cKe(iKe));let zfe=class extends A7{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,S7(t);const r=Nd(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),Eu(i)}update(t){return qm(this),this.iHash.update(t),this}digestInto(t){qm(this),Pd(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const T7=(e,t,n)=>new zfe(e,t).update(n).digest();T7.create=(e,t)=>new zfe(e,t);function lKe(e,t,n){return S7(e),n===void 0&&(n=new Uint8Array(e.outputLen)),T7(e,Nd(n),Nd(t))}const hk=Uint8Array.from([0]),UQ=Uint8Array.of();function uKe(e,t,n,r=32){S7(e),b0(r);const s=e.outputLen;if(r>255*s)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/s);n===void 0&&(n=UQ);const o=new Uint8Array(i*s),a=T7.create(e,t),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let u=0;u<i;u++)hk[0]=u+1,c.update(u===0?UQ:l).update(n).update(hk).digestInto(l),o.set(l,s*u),a._cloneInto(c);return a.destroy(),c.destroy(),Eu(l,hk),o.slice(0,r)}const dKe=(e,t,n,r,s)=>uKe(e,lKe(e,t,n),r,s),P7=_7;const bW=BigInt(0),HL=BigInt(1);function m9(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function hw(e,t,n=""){const r=I7(e),s=e==null?void 0:e.length,i=t!==void 0;if(!r||i&&s!==t){const o=n&&`"${n}" `,a=i?` of length ${t}`:"",c=r?`length=${s}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+a+", got "+c)}return e}function Kx(e){const t=e.toString(16);return t.length&1?"0"+t:t}function qfe(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?bW:BigInt("0x"+e)}function O7(e){return qfe(Uv(e))}function w9(e){return Pd(e),qfe(Uv(Uint8Array.from(e).reverse()))}function vW(e,t){return p9(e.toString(16).padStart(t*2,"0"))}function EW(e,t){return vW(e,t).reverse()}function $o(e,t,n){let r;if(typeof t=="string")try{r=p9(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(I7(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}const fk=e=>typeof e=="bigint"&&bW<=e;function hKe(e,t,n){return fk(e)&&fk(t)&&fk(n)&&t<=e&&e<n}function VL(e,t,n,r){if(!hKe(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Wfe(e){let t;for(t=0;e>bW;e>>=HL,t+=1);return t}const UC=e=>(HL<<BigInt(e))-HL;function fKe(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=h=>new Uint8Array(h),s=h=>Uint8Array.of(h);let i=r(e),o=r(e),a=0;const c=()=>{i.fill(1),o.fill(0),a=0},l=(...h)=>n(o,i,...h),u=(h=r(0))=>{o=l(s(0),h),i=l(),h.length!==0&&(o=l(s(1),h),i=l())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const f=[];for(;h<t;){i=l();const g=i.slice();f.push(g),h+=i.length}return em(...f)};return(h,f)=>{c(),u(h);let g;for(;!(g=f(d()));)u();return c(),g}}function k7(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(s,i,o){const a=e[s];if(o&&a===void 0)return;const c=typeof a;if(c!==i||a===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${c}`)}Object.entries(t).forEach(([s,i])=>r(s,i,!1)),Object.entries(n).forEach(([s,i])=>r(s,i,!0))}function LQ(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const uc=BigInt(0),ea=BigInt(1),fw=BigInt(2),Hfe=BigInt(3),Vfe=BigInt(4),Kfe=BigInt(5),pKe=BigInt(7),Gfe=BigInt(8),gKe=BigInt(9),Zfe=BigInt(16);function Yc(e,t){const n=e%t;return n>=uc?n:t+n}function ld(e,t,n){let r=e;for(;t-- >uc;)r*=r,r%=n;return r}function MQ(e,t){if(e===uc)throw new Error("invert: expected non-zero number");if(t<=uc)throw new Error("invert: expected positive modulus, got "+t);let n=Yc(e,t),r=t,s=uc,i=ea;for(;n!==uc;){const o=r/n,a=r%n,c=s-i*o;r=n,n=a,s=i,i=c}if(r!==ea)throw new Error("invert: does not exist");return Yc(s,t)}function CW(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function Yfe(e,t){const n=(e.ORDER+ea)/Vfe,r=e.pow(t,n);return CW(e,r,t),r}function mKe(e,t){const n=(e.ORDER-Kfe)/Gfe,r=e.mul(t,fw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,fw),s),a=e.mul(i,e.sub(o,e.ONE));return CW(e,a,t),a}function wKe(e){const t=h1(e),n=Jfe(e),r=n(t,t.neg(t.ONE)),s=n(t,r),i=n(t,t.neg(r)),o=(e+pKe)/Zfe;return(a,c)=>{let l=a.pow(c,o),u=a.mul(l,r);const d=a.mul(l,s),h=a.mul(l,i),f=a.eql(a.sqr(u),c),g=a.eql(a.sqr(d),c);l=a.cmov(l,u,f),u=a.cmov(h,d,g);const p=a.eql(a.sqr(u),c),m=a.cmov(l,u,p);return CW(a,m,c),m}}function Jfe(e){if(e<Hfe)throw new Error("sqrt is not defined for small field");let t=e-ea,n=0;for(;t%fw===uc;)t/=fw,n++;let r=fw;const s=h1(e);for(;jQ(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Yfe;let i=s.pow(r,t);const o=(t+ea)/fw;return function(a,c){if(a.is0(c))return c;if(jQ(a,c)!==1)throw new Error("Cannot find square root");let l=n,u=a.mul(a.ONE,i),d=a.pow(c,t),h=a.pow(c,o);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let f=1,g=a.sqr(d);for(;!a.eql(g,a.ONE);)if(f++,g=a.sqr(g),f===l)throw new Error("Cannot find square root");const p=ea<<BigInt(l-f-1),m=a.pow(u,p);l=f,u=a.sqr(m),d=a.mul(d,u),h=a.mul(h,m)}return h}}function yKe(e){return e%Vfe===Hfe?Yfe:e%Gfe===Kfe?mKe:e%Zfe===gKe?wKe(e):Jfe(e)}const bKe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vKe(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=bKe.reduce((r,s)=>(r[s]="function",r),t);return k7(e,n),e}function EKe(e,t,n){if(n<uc)throw new Error("invalid exponent, negatives unsupported");if(n===uc)return e.ONE;if(n===ea)return t;let r=e.ONE,s=t;for(;n>uc;)n&ea&&(r=e.mul(r,s)),s=e.sqr(s),n>>=ea;return r}function Xfe(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function jQ(e,t){const n=(e.ORDER-ea)/fw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Qfe(e,t){t!==void 0&&b0(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function h1(e,t,n=!1,r={}){if(e<=uc)throw new Error("invalid field: expected ORDER > 0, got "+e);let s,i,o=!1,a;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(s=h.BITS),h.sqrt&&(i=h.sqrt),typeof h.isLE=="boolean"&&(n=h.isLE),typeof h.modFromBytes=="boolean"&&(o=h.modFromBytes),a=h.allowedLengths}else typeof t=="number"&&(s=t),r.sqrt&&(i=r.sqrt);const{nBitLength:c,nByteLength:l}=Qfe(e,s);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:l,MASK:UC(c),ZERO:uc,ONE:ea,allowedLengths:a,create:h=>Yc(h,e),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return uc<=h&&h<e},is0:h=>h===uc,isValidNot0:h=>!d.is0(h)&&d.isValid(h),isOdd:h=>(h&ea)===ea,neg:h=>Yc(-h,e),eql:(h,f)=>h===f,sqr:h=>Yc(h*h,e),add:(h,f)=>Yc(h+f,e),sub:(h,f)=>Yc(h-f,e),mul:(h,f)=>Yc(h*f,e),pow:(h,f)=>EKe(d,h,f),div:(h,f)=>Yc(h*MQ(f,e),e),sqrN:h=>h*h,addN:(h,f)=>h+f,subN:(h,f)=>h-f,mulN:(h,f)=>h*f,inv:h=>MQ(h,e),sqrt:i||(h=>(u||(u=yKe(e)),u(d,h))),toBytes:h=>n?EW(h,l):vW(h,l),fromBytes:(h,f=!0)=>{if(a){if(!a.includes(h.length)||h.length>l)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+h.length);const p=new Uint8Array(l);p.set(h,n?0:p.length-h.length),h=p}if(h.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+h.length);let g=n?w9(h):O7(h);if(o&&(g=Yc(g,e)),!f&&!d.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g},invertBatch:h=>Xfe(d,h),cmov:(h,f,g)=>g?f:h});return Object.freeze(d)}function epe(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function tpe(e){const t=epe(e);return t+Math.ceil(t/2)}function CKe(e,t,n=!1){const r=e.length,s=epe(t),i=tpe(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?w9(e):O7(e),a=Yc(o,t-ea)+ea;return n?EW(a,s):vW(a,s)}const u5=BigInt(0),pw=BigInt(1);function y9(e,t){const n=t.negate();return e?n:t}function pk(e,t){const n=Xfe(e.Fp,t.map(r=>r.Z));return t.map((r,s)=>e.fromAffine(r.toAffine(n[s])))}function npe(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function gk(e,t){npe(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=UC(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function FQ(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=pw);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function $Ke(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function xKe(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const mk=new WeakMap,rpe=new WeakMap;function wk(e){return rpe.get(e)||1}function zQ(e){if(e!==u5)throw new Error("invalid wNAF")}let IKe=class{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let s=t;for(;n>u5;)n&pw&&(r=r.add(s)),s=s.double(),n>>=pw;return r}precomputeWindow(t,n){const{windows:r,windowSize:s}=gk(n,this.bits),i=[];let o=t,a=o;for(let c=0;c<r;c++){a=o,i.push(a);for(let l=1;l<s;l++)a=a.add(o),i.push(a);o=a.double()}return i}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let s=this.ZERO,i=this.BASE;const o=gk(t,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:l,isZero:u,isNeg:d,isNegF:h,offsetF:f}=FQ(r,a,o);r=c,u?i=i.add(y9(h,n[f])):s=s.add(y9(d,n[l]))}return zQ(r),{p:s,f:i}}wNAFUnsafe(t,n,r,s=this.ZERO){const i=gk(t,this.bits);for(let o=0;o<i.windows&&r!==u5;o++){const{nextN:a,offset:c,isZero:l,isNeg:u}=FQ(r,o,i);if(r=a,!l){const d=n[c];s=s.add(u?d.negate():d)}}return zQ(r),s}getPrecomputes(t,n,r){let s=mk.get(n);return s||(s=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(s=r(s)),mk.set(n,s))),s}cached(t,n,r){const s=wk(t);return this.wNAF(s,this.getPrecomputes(s,t,r),n)}unsafe(t,n,r,s){const i=wk(t);return i===1?this._unsafeLadder(t,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),n,s)}createCache(t,n){npe(n,this.bits),rpe.set(t,n),mk.delete(t)}hasCache(t){return wk(t)!==1}};function SKe(e,t,n,r){let s=t,i=e.ZERO,o=e.ZERO;for(;n>u5||r>u5;)n&pw&&(i=i.add(s)),r&pw&&(o=o.add(s)),s=s.double(),n>>=pw,r>>=pw;return{p1:i,p2:o}}function AKe(e,t,n,r){$Ke(n,e),xKe(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=Wfe(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=UC(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function qQ(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return vKe(t),t}else return h1(e,{isLE:n})}function _Ke(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const c=t[a];if(!(typeof c=="bigint"&&c>u5))throw new Error(`CURVE.${a} must be positive bigint`)}const s=qQ(t.p,n.Fp,r),i=qQ(t.n,n.Fn,r),o=["Gx","Gy","a","b"];for(const a of o)if(!s.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8),Sfe("HashToScalar-");const j3=BigInt(0),o2=BigInt(1),Gx=BigInt(2);function NKe(e){return k7(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function TKe(e){const t=NKe(e),{P:n,type:r,adjustScalarBytes:s,powPminus2:i,randomBytes:o}=t,a=r==="x25519";if(!a&&r!=="x448")throw new Error("invalid type");const c=o||ib,l=a?255:448,u=a?32:56,d=BigInt(a?9:5),h=BigInt(a?121665:39081),f=a?Gx**BigInt(254):Gx**BigInt(447),g=a?BigInt(8)*Gx**BigInt(251)-o2:BigInt(4)*Gx**BigInt(445)-o2,p=f+g+o2,m=T=>Yc(T,n),w=C(d);function C(T){return EW(m(T),u)}function E(T){const P=$o("u coordinate",T,u);return a&&(P[31]&=127),m(w9(P))}function b(T){return w9(s($o("scalar",T,u)))}function S(T,P){const _=A(E(P),b(T));if(_===j3)throw new Error("invalid private or public key received");return C(_)}function v(T){return S(T,w)}function x(T,P,_){const y=m(T*(P-_));return P=m(P-y),_=m(_+y),{x_2:P,x_3:_}}function A(T,P){VL("u",T,j3,n),VL("scalar",P,f,p);const _=P,y=T;let $=o2,R=j3,B=T,k=o2,D=j3;for(let F=BigInt(l-1);F>=j3;F--){const K=_>>F&o2;D^=K,{x_2:$,x_3:B}=x(D,$,B),{x_2:R,x_3:k}=x(D,R,k),D=K;const q=$+R,H=m(q*q),Z=$-R,ee=m(Z*Z),ie=H-ee,X=B+k,le=B-k,_e=m(le*q),Ne=m(X*Z),be=_e+Ne,Me=_e-Ne;B=m(be*be),k=m(y*m(Me*Me)),$=m(H*ee),R=m(ie*(H+m(h*ie)))}({x_2:$,x_3:B}=x(D,$,B)),{x_2:R,x_3:k}=x(D,R,k);const U=i(R);return m($*U)}const I={secretKey:u,publicKey:u,seed:u},O=(T=c(u))=>(Pd(T,I.seed),T);function N(T){const P=O(T);return{secretKey:P,publicKey:v(P)}}return{keygen:N,getSharedSecret:(T,P)=>S(T,P),getPublicKey:T=>v(T),scalarMult:S,scalarMultBase:v,utils:{randomSecretKey:O,randomPrivateKey:O},GuBytes:w.slice(),lengths:I}}const PKe=BigInt(1),WQ=BigInt(2),OKe=BigInt(3),kKe=BigInt(5);BigInt(8);const spe=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),RKe={p:spe,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function BKe(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=spe,o=e*e%i*e%i,a=ld(o,WQ,i)*o%i,c=ld(a,PKe,i)*e%i,l=ld(c,kKe,i)*c%i,u=ld(l,t,i)*l%i,d=ld(u,n,i)*u%i,h=ld(d,r,i)*d%i,f=ld(h,s,i)*h%i,g=ld(f,s,i)*h%i,p=ld(g,t,i)*l%i;return{pow_p_5_8:ld(p,WQ,i)*e%i,b2:o}}function DKe(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const UKe=h1(RKe.p,{isLE:!0}),KL=(()=>{const e=UKe.ORDER;return TKe({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=BKe(t);return Yc(ld(n,OKe,e)*r,e)},adjustScalarBytes:DKe})})();const HQ=(e,t)=>(e+(e>=0?t:-t)/ipe)/t;function LKe(e,t,n){const[[r,s],[i,o]]=t,a=HQ(o*e,n),c=HQ(-s*e,n);let l=e-a*r-c*i,u=-a*s-c*o;const d=l<Kp,h=u<Kp;d&&(l=-l),h&&(u=-u);const f=UC(Math.ceil(Wfe(n)/2))+Lv;if(l<Kp||l>=f||u<Kp||u>=f)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}function GL(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function yk(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return m9(n.lowS,"lowS"),m9(n.prehash,"prehash"),n.format!==void 0&&GL(n.format),n}let MKe=class extends Error{constructor(t=""){super(t)}};const Sp={Err:MKe,_tlv:{encode:(e,t)=>{const{Err:n}=Sp;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=Kx(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?Kx(s.length/2|128):"";return Kx(e)+i+s+t},decode(e,t){const{Err:n}=Sp;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Sp;if(e<Kp)throw new t("integer: negative integers are not allowed");let n=Kx(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Sp;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return O7(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Sp,s=$o("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Sp,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}},Kp=BigInt(0),Lv=BigInt(1),ipe=BigInt(2),Zx=BigInt(3),jKe=BigInt(4);function hv(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let s=$o("private key",t);try{r=e.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function FKe(e,t={}){const n=_Ke("weierstrass",e,t),{Fp:r,Fn:s}=n;let i=n.CURVE;const{h:o,n:a}=i;k7(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!r.is0(i.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=ape(r,s);function u(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(T,P,_){const{x:y,y:$}=P.toAffine(),R=r.toBytes(y);if(m9(_,"isCompressed"),_){u();const B=!r.isOdd($);return em(ope(B),R)}else return em(Uint8Array.of(4),R,r.toBytes($))}function h(T){hw(T,void 0,"Point");const{publicKey:P,publicKeyUncompressed:_}=l,y=T.length,$=T[0],R=T.subarray(1);if(y===P&&($===2||$===3)){const B=r.fromBytes(R);if(!r.isValid(B))throw new Error("bad point: is not on curve, wrong x");const k=p(B);let D;try{D=r.sqrt(k)}catch(F){const K=F instanceof Error?": "+F.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}u();const U=r.isOdd(D);return($&1)===1!==U&&(D=r.neg(D)),{x:B,y:D}}else if(y===_&&$===4){const B=r.BYTES,k=r.fromBytes(R.subarray(0,B)),D=r.fromBytes(R.subarray(B,B*2));if(!m(k,D))throw new Error("bad point: is not on curve");return{x:k,y:D}}else throw new Error(`bad point: got length ${y}, expected compressed=${P} or uncompressed=${_}`)}const f=t.toBytes||d,g=t.fromBytes||h;function p(T){const P=r.sqr(T),_=r.mul(P,T);return r.add(r.add(_,r.mul(T,i.a)),i.b)}function m(T,P){const _=r.sqr(P),y=p(T);return r.eql(_,y)}if(!m(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const w=r.mul(r.pow(i.a,Zx),jKe),C=r.mul(r.sqr(i.b),BigInt(27));if(r.is0(r.add(w,C)))throw new Error("bad curve params: a or b");function E(T,P,_=!1){if(!r.isValid(P)||_&&r.is0(P))throw new Error(`bad point coordinate ${T}`);return P}function b(T){if(!(T instanceof I))throw new Error("ProjectivePoint expected")}function S(T){if(!c||!c.basises)throw new Error("no endo");return LKe(T,c.basises,s.ORDER)}const v=LQ((T,P)=>{const{X:_,Y:y,Z:$}=T;if(r.eql($,r.ONE))return{x:_,y};const R=T.is0();P==null&&(P=R?r.ONE:r.inv($));const B=r.mul(_,P),k=r.mul(y,P),D=r.mul($,P);if(R)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:B,y:k}}),x=LQ(T=>{if(T.is0()){if(t.allowInfinityPoint&&!r.is0(T.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:_}=T.toAffine();if(!r.isValid(P)||!r.isValid(_))throw new Error("bad point: x or y not field elements");if(!m(P,_))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function A(T,P,_,y,$){return _=new I(r.mul(_.X,T),_.Y,_.Z),P=y9(y,P),_=y9($,_),P.add(_)}class I{constructor(P,_,y){this.X=E("x",P),this.Y=E("y",_,!0),this.Z=E("z",y),Object.freeze(this)}static CURVE(){return i}static fromAffine(P){const{x:_,y}=P||{};if(!P||!r.isValid(_)||!r.isValid(y))throw new Error("invalid affine point");if(P instanceof I)throw new Error("projective point not allowed");return r.is0(_)&&r.is0(y)?I.ZERO:new I(_,y,r.ONE)}static fromBytes(P){const _=I.fromAffine(g(hw(P,void 0,"point")));return _.assertValidity(),_}static fromHex(P){return I.fromBytes($o("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,_=!0){return N.createCache(this,P),_||this.multiply(Zx),this}assertValidity(){x(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){b(P);const{X:_,Y:y,Z:$}=this,{X:R,Y:B,Z:k}=P,D=r.eql(r.mul(_,k),r.mul(R,$)),U=r.eql(r.mul(y,k),r.mul(B,$));return D&&U}negate(){return new I(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:_}=i,y=r.mul(_,Zx),{X:$,Y:R,Z:B}=this;let k=r.ZERO,D=r.ZERO,U=r.ZERO,F=r.mul($,$),K=r.mul(R,R),q=r.mul(B,B),H=r.mul($,R);return H=r.add(H,H),U=r.mul($,B),U=r.add(U,U),k=r.mul(P,U),D=r.mul(y,q),D=r.add(k,D),k=r.sub(K,D),D=r.add(K,D),D=r.mul(k,D),k=r.mul(H,k),U=r.mul(y,U),q=r.mul(P,q),H=r.sub(F,q),H=r.mul(P,H),H=r.add(H,U),U=r.add(F,F),F=r.add(U,F),F=r.add(F,q),F=r.mul(F,H),D=r.add(D,F),q=r.mul(R,B),q=r.add(q,q),F=r.mul(q,H),k=r.sub(k,F),U=r.mul(q,K),U=r.add(U,U),U=r.add(U,U),new I(k,D,U)}add(P){b(P);const{X:_,Y:y,Z:$}=this,{X:R,Y:B,Z:k}=P;let D=r.ZERO,U=r.ZERO,F=r.ZERO;const K=i.a,q=r.mul(i.b,Zx);let H=r.mul(_,R),Z=r.mul(y,B),ee=r.mul($,k),ie=r.add(_,y),X=r.add(R,B);ie=r.mul(ie,X),X=r.add(H,Z),ie=r.sub(ie,X),X=r.add(_,$);let le=r.add(R,k);return X=r.mul(X,le),le=r.add(H,ee),X=r.sub(X,le),le=r.add(y,$),D=r.add(B,k),le=r.mul(le,D),D=r.add(Z,ee),le=r.sub(le,D),F=r.mul(K,X),D=r.mul(q,ee),F=r.add(D,F),D=r.sub(Z,F),F=r.add(Z,F),U=r.mul(D,F),Z=r.add(H,H),Z=r.add(Z,H),ee=r.mul(K,ee),X=r.mul(q,X),Z=r.add(Z,ee),ee=r.sub(H,ee),ee=r.mul(K,ee),X=r.add(X,ee),H=r.mul(Z,X),U=r.add(U,H),H=r.mul(le,X),D=r.mul(ie,D),D=r.sub(D,H),H=r.mul(ie,Z),F=r.mul(le,F),F=r.add(F,H),new I(D,U,F)}subtract(P){return this.add(P.negate())}is0(){return this.equals(I.ZERO)}multiply(P){const{endo:_}=t;if(!s.isValidNot0(P))throw new Error("invalid scalar: out of range");let y,$;const R=B=>N.cached(this,B,k=>pk(I,k));if(_){const{k1neg:B,k1:k,k2neg:D,k2:U}=S(P),{p:F,f:K}=R(k),{p:q,f:H}=R(U);$=K.add(H),y=A(_.beta,F,q,B,D)}else{const{p:B,f:k}=R(P);y=B,$=k}return pk(I,[y,$])[0]}multiplyUnsafe(P){const{endo:_}=t,y=this;if(!s.isValid(P))throw new Error("invalid scalar: out of range");if(P===Kp||y.is0())return I.ZERO;if(P===Lv)return y;if(N.hasCache(this))return this.multiply(P);if(_){const{k1neg:$,k1:R,k2neg:B,k2:k}=S(P),{p1:D,p2:U}=SKe(I,y,R,k);return A(_.beta,D,U,$,B)}else return N.unsafe(y,P)}multiplyAndAddUnsafe(P,_,y){const $=this.multiplyUnsafe(_).add(P.multiplyUnsafe(y));return $.is0()?void 0:$}toAffine(P){return v(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return o===Lv?!0:P?P(I,this):N.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:P}=t;return o===Lv?this:P?P(I,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(P=!0){return m9(P,"isCompressed"),this.assertValidity(),f(I,this,P)}toHex(P=!0){return Uv(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return pk(I,P)}static msm(P,_){return AKe(I,s,P,_)}static fromPrivateKey(P){return I.BASE.multiply(hv(s,P))}}I.BASE=new I(i.Gx,i.Gy,r.ONE),I.ZERO=new I(r.ZERO,r.ONE,r.ZERO),I.Fp=r,I.Fn=s;const O=s.BITS,N=new IKe(I,t.endo?Math.ceil(O/2):O);return I.BASE.precompute(8),I}function ope(e){return Uint8Array.of(e?2:3)}function ape(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function zKe(e,t={}){const{Fn:n}=e,r=t.randomBytes||ib,s=Object.assign(ape(e.Fp,n),{seed:tpe(n.ORDER)});function i(h){try{return!!hv(n,h)}catch{return!1}}function o(h,f){const{publicKey:g,publicKeyUncompressed:p}=s;try{const m=h.length;return f===!0&&m!==g||f===!1&&m!==p?!1:!!e.fromBytes(h)}catch{return!1}}function a(h=r(s.seed)){return CKe(hw(h,s.seed,"seed"),n.ORDER)}function c(h,f=!0){return e.BASE.multiply(hv(n,h)).toBytes(f)}function l(h){const f=a(h);return{secretKey:f,publicKey:c(f)}}function u(h){if(typeof h=="bigint")return!1;if(h instanceof e)return!0;const{secretKey:f,publicKey:g,publicKeyUncompressed:p}=s;if(n.allowedLengths||f===g)return;const m=$o("key",h).length;return m===g||m===p}function d(h,f,g=!0){if(u(h)===!0)throw new Error("first arg must be private key");if(u(f)===!1)throw new Error("second arg must be public key");const p=hv(n,h);return e.fromHex(f).multiply(p).toBytes(g)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:l,Point:e,utils:{isValidSecretKey:i,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:i,randomPrivateKey:a,normPrivateKeyToScalar:h=>hv(n,h),precompute(h=8,f=e.BASE){return f.precompute(h,!1)}},lengths:s})}function qKe(e,t,n={}){S7(t),k7(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||ib,s=n.hmac||((_,...y)=>T7(t,_,em(...y))),{Fp:i,Fn:o}=e,{ORDER:a,BITS:c}=o,{keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:f}=zKe(e,n),g={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},p="compact";function m(_){const y=a>>Lv;return _>y}function w(_,y){if(!o.isValidNot0(y))throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);return y}function C(_,y){GL(y);const $=f.signature,R=y==="compact"?$:y==="recovered"?$+1:void 0;return hw(_,R,`${y} signature`)}class E{constructor(y,$,R){this.r=w("r",y),this.s=w("s",$),R!=null&&(this.recovery=R),Object.freeze(this)}static fromBytes(y,$=p){C(y,$);let R;if($==="der"){const{r:U,s:F}=Sp.toSig(hw(y));return new E(U,F)}$==="recovered"&&(R=y[0],$="compact",y=y.subarray(1));const B=o.BYTES,k=y.subarray(0,B),D=y.subarray(B,B*2);return new E(o.fromBytes(k),o.fromBytes(D),R)}static fromHex(y,$){return this.fromBytes(p9(y),$)}addRecoveryBit(y){return new E(this.r,this.s,y)}recoverPublicKey(y){const $=i.ORDER,{r:R,s:B,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(a*ipe<$&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const D=k===2||k===3?R+a:R;if(!i.isValid(D))throw new Error("recovery id 2 or 3 invalid");const U=i.toBytes(D),F=e.fromBytes(em(ope((k&1)===0),U)),K=o.inv(D),q=S($o("msgHash",y)),H=o.create(-q*K),Z=o.create(B*K),ee=e.BASE.multiplyUnsafe(H).add(F.multiplyUnsafe(Z));if(ee.is0())throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return m(this.s)}toBytes(y=p){if(GL(y),y==="der")return p9(Sp.hexFromSig(this));const $=o.toBytes(this.r),R=o.toBytes(this.s);if(y==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return em(Uint8Array.of(this.recovery),$,R)}return em($,R)}toHex(y){return Uv(this.toBytes(y))}assertValidity(){}static fromCompact(y){return E.fromBytes($o("sig",y),"compact")}static fromDER(y){return E.fromBytes($o("sig",y),"der")}normalizeS(){return this.hasHighS()?new E(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Uv(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Uv(this.toBytes("compact"))}}const b=n.bits2int||function(_){if(_.length>8192)throw new Error("input is too large");const y=O7(_),$=_.length*8-c;return $>0?y>>BigInt($):y},S=n.bits2int_modN||function(_){return o.create(b(_))},v=UC(c);function x(_){return VL("num < 2^"+c,_,Kp,v),o.toBytes(_)}function A(_,y){return hw(_,void 0,"message"),y?hw(t(_),void 0,"prehashed message"):_}function I(_,y,$){if(["recovered","canonical"].some(Z=>Z in $))throw new Error("sign() legacy options not supported");const{lowS:R,prehash:B,extraEntropy:k}=yk($,g);_=A(_,B);const D=S(_),U=hv(o,y),F=[x(U),x(D)];if(k!=null&&k!==!1){const Z=k===!0?r(f.secretKey):k;F.push($o("extraEntropy",Z))}const K=em(...F),q=D;function H(Z){const ee=b(Z);if(!o.isValidNot0(ee))return;const ie=o.inv(ee),X=e.BASE.multiply(ee).toAffine(),le=o.create(X.x);if(le===Kp)return;const _e=o.create(ie*o.create(q+le*U));if(_e===Kp)return;let Ne=(X.x===le?0:2)|Number(X.y&Lv),be=_e;return R&&m(_e)&&(be=o.neg(_e),Ne^=1),new E(le,be,Ne)}return{seed:K,k2sig:H}}function O(_,y,$={}){_=$o("message",_);const{seed:R,k2sig:B}=I(_,y,$);return fKe(t.outputLen,o.BYTES,s)(R,B)}function N(_){let y;const $=typeof _=="string"||I7(_),R=!$&&_!==null&&typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint";if(!$&&!R)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(R)y=new E(_.r,_.s);else if($){try{y=E.fromBytes($o("sig",_),"der")}catch(B){if(!(B instanceof Sp.Err))throw B}if(!y)try{y=E.fromBytes($o("sig",_),"compact")}catch{return!1}}return y||!1}function T(_,y,$,R={}){const{lowS:B,prehash:k,format:D}=yk(R,g);if($=$o("publicKey",$),y=A($o("message",y),k),"strict"in R)throw new Error("options.strict was renamed to lowS");const U=D===void 0?N(_):E.fromBytes($o("sig",_),D);if(U===!1)return!1;try{const F=e.fromBytes($);if(B&&U.hasHighS())return!1;const{r:K,s:q}=U,H=S(y),Z=o.inv(q),ee=o.create(H*Z),ie=o.create(K*Z),X=e.BASE.multiplyUnsafe(ee).add(F.multiplyUnsafe(ie));return X.is0()?!1:o.create(X.x)===K}catch{return!1}}function P(_,y,$={}){const{prehash:R}=yk($,g);return y=A(y,R),E.fromBytes(_,"recovered").recoverPublicKey(y).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:f,Point:e,sign:O,verify:T,recoverPublicKey:P,Signature:E,hash:t})}function WKe(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=h1(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),i={Fp:n,Fn:s,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:i}}function HKe(e){const{CURVE:t,curveOpts:n}=WKe(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function VKe(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Qfe(n.Fn.ORDER,n.Fn.BITS))})}function KKe(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:s}=HKe(e),i=FKe(t,n),o=qKe(i,r,s);return VKe(e,o)}function ZL(e,t){const n=r=>KKe({...e,hash:r});return{...n(t),create:n}}const cpe={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},lpe={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},upe={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},GKe=h1(cpe.p),ZKe=h1(lpe.p),YKe=h1(upe.p),JKe=ZL({...cpe,Fp:GKe,lowS:!1},_7);ZL({...lpe,Fp:ZKe,lowS:!1},lVe),ZL({...upe,Fp:YKe,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},cVe);const XKe=JKe,dpe="base10",ta="base16",Za="base64pad",tm="base64url",LC="utf8",hpe=0,t0=1,MC=2,QKe=0,VQ=1,o8=12,$W=32;function eGe(){const e=KL.utils.randomPrivateKey(),t=KL.getPublicKey(e);return{privateKey:rn(e,ta),publicKey:rn(t,ta)}}function YL(){const e=ib($W);return rn(e,ta)}function tGe(e,t){const n=KL.getSharedSecret(vn(e,ta),vn(t,ta)),r=dKe(P7,n,void 0,void 0,$W);return rn(r,ta)}function vS(e){const t=P7(vn(e,ta));return rn(t,ta)}function cu(e){const t=P7(vn(e,LC));return rn(t,ta)}function fpe(e){return vn(`${e}`,dpe)}function Vw(e){return Number(rn(e,dpe))}function ppe(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function gpe(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}function nGe(e){const t=fpe(typeof e.type<"u"?e.type:hpe);if(Vw(t)===t0&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?vn(e.senderPublicKey,ta):void 0,r=typeof e.iv<"u"?vn(e.iv,ta):ib(o8),s=vn(e.symKey,ta),i=Ffe(s,r).encrypt(vn(e.message,LC)),o=mpe({type:t,sealed:i,iv:r,senderPublicKey:n});return e.encoding===tm?ppe(o):o}function rGe(e){const t=vn(e.symKey,ta),{sealed:n,iv:r}=W8({encoded:e.encoded,encoding:e.encoding}),s=Ffe(t,r).decrypt(n);if(s===null)throw new Error("Failed to decrypt");return rn(s,LC)}function sGe(e,t){const n=fpe(MC),r=ib(o8),s=vn(e,LC),i=mpe({type:n,sealed:s,iv:r});return t===tm?ppe(i):i}function iGe(e,t){const{sealed:n}=W8({encoded:e,encoding:t});return rn(n,LC)}function mpe(e){if(Vw(e.type)===MC)return rn(Yo([e.type,e.sealed]),Za);if(Vw(e.type)===t0){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return rn(Yo([e.type,e.senderPublicKey,e.iv,e.sealed]),Za)}return rn(Yo([e.type,e.iv,e.sealed]),Za)}function W8(e){const t=(e.encoding||Za)===tm?gpe(e.encoded):e.encoded,n=vn(t,Za),r=n.slice(QKe,VQ),s=VQ;if(Vw(r)===t0){const c=s+$W,l=c+o8,u=n.slice(s,c),d=n.slice(c,l),h=n.slice(l);return{type:r,sealed:h,iv:d,senderPublicKey:u}}if(Vw(r)===MC){const c=n.slice(s),l=ib(o8);return{type:r,sealed:c,iv:l}}const i=s+o8,o=n.slice(s,i),a=n.slice(i);return{type:r,sealed:a,iv:o}}function oGe(e,t){const n=W8({encoded:e,encoding:t==null?void 0:t.encoding});return wpe({type:Vw(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?rn(n.senderPublicKey,ta):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function wpe(e){const t=(e==null?void 0:e.type)||hpe;if(t===t0){if(typeof(e==null?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(e==null?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e==null?void 0:e.senderPublicKey,receiverPublicKey:e==null?void 0:e.receiverPublicKey}}function KQ(e){return e.type===t0&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function GQ(e){return e.type===MC}function aGe(e){const t=Buffer.from(e.x,"base64"),n=Buffer.from(e.y,"base64");return Yo([new Uint8Array([4]),t,n])}function cGe(e,t){const[n,r,s]=e.split("."),i=Buffer.from(gpe(s),"base64");if(i.length!==64)throw new Error("Invalid signature length");const o=i.slice(0,32),a=i.slice(32,64),c=`${n}.${r}`,l=P7(c),u=aGe(t);if(!XKe.verify(Yo([o,a]),l,u))throw new Error("Invalid signature");return wu(e).payload}const lGe="irn";function b9(e){return(e==null?void 0:e.relay)||{protocol:lGe}}function fv(e){const t=ZN[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}function uGe(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(s=>{if(s.startsWith(r)){const i=s.replace(r,""),o=e[s];n[i]=o}}),n}function ZQ(e){if(!e.includes("wc:")){const l=vfe(e);l!=null&&l.includes("wc:")&&(e=l)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),s=e.substring(t+1,n).split("@"),i=typeof n<"u"?e.substring(n):"",o=new URLSearchParams(i),a=Object.fromEntries(o.entries()),c=typeof a.methods=="str
20ing"?a.methods.split(","):void 0;return{protocol:r,topic:dGe(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:uGe(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function dGe(e){return e.startsWith("//")?e.substring(2):e}function hGe(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(s=>{const i=s,o=n+t+i;e[i]&&(r[o]=e[i])}),r}function YQ(e){const t=new URLSearchParams,n={...hGe(e.relay),symKey:e.symKey,...e.expiryTimestamp&&{expiryTimestamp:e.expiryTimestamp.toString()},...e.methods&&{methods:e.methods.join(",")}};return Object.entries(n).sort(([r],[s])=>r.localeCompare(s)).forEach(([r,s])=>{s!==void 0&&t.append(r,String(s))}),`${e.protocol}:${e.topic}@${e.version}?${t}`}function Yx(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}function _6(e){const t=[];return e.forEach(n=>{const[r,s]=n.split(":");t.push(`${r}:${s}`)}),t}function ype(e){const t=[];return Object.values(e).forEach(n=>{t.push(..._6(n.accounts))}),[...new Set(t)]}function fGe(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.methods)}),[...new Set(t)]}function pGe(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.events)}),[...new Set(t)]}function gGe(e,t){const n=[];return Object.values(e).forEach(r=>{_6(r.accounts).includes(t)&&n.push(...r.methods)}),n}function mGe(e,t){const n=[];return Object.values(e).forEach(r=>{_6(r.accounts).includes(t)&&n.push(...r.events)}),n}function R7(e){return e.includes(":")}function pv(e){return R7(e)?e.split(":")[0]:e}function JQ(e){var n,r,s;const t={};if(!Hh(e))return t;for(const[i,o]of Object.entries(e)){const a=R7(i)?[i]:o.chains,c=o.methods||[],l=o.events||[],u=pv(i);t[u]={...t[u],chains:Wh(a,(n=t[u])==null?void 0:n.chains),methods:Wh(c,(r=t[u])==null?void 0:r.methods),events:Wh(l,(s=t[u])==null?void 0:s.events)}}return t}function wGe(e){const t={};return e==null||e.forEach(n=>{var i;const[r,s]=n.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[],methods:[]}),t[r].accounts.push(n),(i=t[r].chains)==null||i.push(`${r}:${s}`)}),t}function XQ(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=wGe(t);for(const[r,s]of Object.entries(n))s.methods?s.methods=Wh(s.methods,e):s.methods=e,s.events=["chainChanged","accountsChanged"];return n}function yGe(e,t){var o,a,c,l,u,d;const n=JQ(e),r=JQ(t),s={},i=Object.keys(n).concat(Object.keys(r));for(const h of i)s[h]={chains:Wh((o=n[h])==null?void 0:o.chains,(a=r[h])==null?void 0:a.chains),methods:Wh((c=n[h])==null?void 0:c.methods,(l=r[h])==null?void 0:l.methods),events:Wh((u=n[h])==null?void 0:u.events,(d=r[h])==null?void 0:d.events)};return s}function n0(e,t){return!!Array.isArray(e)}function Hh(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Qs(e){return typeof e>"u"}function Ns(e,t){return t&&Qs(e)?!0:typeof e=="string"&&!!e.trim().length}function xW(e,t){return t&&Qs(e)?!0:typeof e=="number"&&!isNaN(e)}function bGe(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),s=Object.keys(n);let i=!0;return dw(s,r)?(r.forEach(o=>{const{accounts:a,methods:c,events:l}=e.namespaces[o],u=_6(a),d=n[o];(!dw(gfe(o,d),u)||!dw(d.methods,c)||!dw(d.events,l))&&(i=!1)}),i):!1}function v9(e){return Ns(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function vGe(e){if(Ns(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&v9(n)}}return!1}function EGe(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(Ns(e,!1)){if(t(e))return!0;const n=vfe(e);return t(n)}}catch{}return!1}function CGe(e){var t;return(t=e==null?void 0:e.proposer)==null?void 0:t.publicKey}function $Ge(e){return e==null?void 0:e.topic}function xGe(e,t){let n=null;return Ns(e==null?void 0:e.publicKey,!1)||(n=je("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function QQ(e){let t=!0;return n0(e)?e.length&&(t=e.every(n=>Ns(n,!1))):t=!1,t}function IGe(e,t,n){let r=null;return n0(t)&&t.length?t.forEach(s=>{r||v9(s)||(r=Yr("UNSUPPORTED_CHAINS",`${n}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):v9(e)||(r=Yr("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:
205"] }`)),r}function SGe(e,t,n){let r=null;return Object.entries(e).forEach(([s,i])=>{if(r)return;const o=IGe(s,gfe(s,i),`${t} ${n}`);o&&(r=o)}),r}function AGe(e,t){let n=null;return n0(e)?e.forEach(r=>{n||vGe(r)||(n=Yr("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=Yr("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function _Ge(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=AGe(r==null?void 0:r.accounts,`${t} namespace`);s&&(n=s)}),n}function NGe(e,t){let n=null;return QQ(e==null?void 0:e.methods)?QQ(e==null?void 0:e.events)||(n=Yr("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=Yr("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function bpe(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=NGe(r,`${t}, namespace`);s&&(n=s)}),n}function TGe(e,t,n){let r=null;if(e&&Hh(e)){const s=bpe(e,t);s&&(r=s);const i=SGe(e,t,n);i&&(r=i)}else r=je("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function bk(e,t){let n=null;if(e&&Hh(e)){const r=bpe(e,t);r&&(n=r);const s=_Ge(e,t);s&&(n=s)}else n=je("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function vpe(e){return Ns(e.protocol,!0)}function PGe(e,t){let n=!1;return e?e&&n0(e)&&e.length&&e.forEach(r=>{n=vpe(r)}):n=!0,n}function OGe(e){return typeof e=="number"}function Fa(e){return typeof e<"u"&&typeof e!==null}function kGe(e){return!(!e||typeof e!="object"||!e.code||!xW(e.code,!1)||!e.message||!Ns(e.message,!1))}function RGe(e){return!(Qs(e)||!Ns(e.method,!1))}function BGe(e){return!(Qs(e)||Qs(e.result)&&Qs(e.error)||!xW(e.id,!1)||!Ns(e.jsonrpc,!1))}function DGe(e){return!(Qs(e)||!Ns(e.name,!1))}function eee(e,t){return!(!v9(t)||!ype(e).includes(t))}function UGe(e,t,n){return Ns(n,!1)?gGe(e,t).includes(n):!1}function LGe(e,t,n){return Ns(n,!1)?mGe(e,t).includes(n):!1}function tee(e,t,n){let r=null;const s=MGe(e),i=jGe(t),o=Object.keys(s),a=Object.keys(i),c=nee(Object.keys(e)),l=nee(Object.keys(t)),u=c.filter(d=>!l.includes(d));return u.length&&(r=je("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces. 21 Required: ${u.toString()} 22 Received: ${Object.keys(t).toString()}`)),dw(o,a)||(r=je("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces. 23 Required: ${o.toString()} 24 Approved: ${a.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const h=_6(t[d].accounts);h.includes(d)||(r=je("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${d} 25 Required: ${d} 26 Approved: ${h.toString()}`))}),o.forEach(d=>{r||(dw(s[d].methods,i[d].methods)?dw(s[d].events,i[d].events)||(r=je("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${d}`)):r=je("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function MGe(e){const t={};return Object.keys(e).forEach(n=>{var r;n.includes(":")?t[n]=e[n]:(r=e[n].chains)==null||r.forEach(s=>{t[s]={methods:e[n].methods,events:e[n].events}})}),t}function nee(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function jGe(e){const t={};return Object.keys(e).forEach(n=>{var r;n.includes(":")?t[n]=e[n]:(r=_6(e[n].accounts))==null||r.forEach(s=>{t[s]={accounts:e[n].accounts.filter(i=>i.includes(`${s}:`)),methods:e[n].methods,events:e[n].events}})}),t}function FGe(e,t){return xW(e,!1)&&e<=t.max&&e>=t.min}function ree(){const e=BC();return new Promise(t=>{switch(e){case ol.browser:t(zGe());break;case ol.reactNative:t(qGe());break;case ol.node:t(WGe());break;default:t(!0)}})}function zGe(){return A6()&&(navigator==null?void 0:navigator.onLine)}async function qGe(){var e;return d1()&&typeof globalThis<"u"&&(globalThis!=null&&globalThis.NetInfo)?(e=await(globalThis==null?void 0:globalThis.NetInfo.fetch()))==null?void 0:e.isConnected:!0}function WGe(){return!0}function HGe(e){switch(BC()){case ol.browser:VGe(e);break;case ol.reactNative:KGe(e);break}}function VGe(e){!d1()&&A6()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function KGe(e){d1()&&typeof globalThis<"u"&&(globalThis!=null&&globalThis.NetInfo)&&(globalThis==null||globalThis.NetInfo.addEventListener(t=>e(t==null?void 0:t.isConnected)))}function GGe(){var e;return A6()&&cn.getDocument()?((e=cn.getDocument())==null?void 0:e.visibilityState)==="visible":!0}const vk={};let F3=class{static get(t){return vk[t]}static set(t,n){vk[t]=n}static delete(t){delete vk[t]}};function ZGe(e){const t=wf.decode(e);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function YGe({publicKey:e,signature:t,payload:n}){var f;const r=JL(n.method),s=128|parseInt(((f=n.version)==null?void 0:f.toString())||"4"),i=QGe(n.address),o=n.era==="00"?new Uint8Array([0]):JL(n.era);if(o.length!==1&&o.length!==2)throw new Error("Invalid era length");const a=parseInt(n.nonce,16),c=new Uint8Array([a&255,a>>8&255]),l=BigInt(`0x${XGe(n.tip)}`),u=tZe(l),d=new Uint8Array([0,...e,i,...t,...o,...c,...u,...r]),h=eZe(d.length+1);return new Uint8Array([...h,s,...d])}function JGe(e){const t=JL(e),n=Oq.blake2b(t,void 0,32);return"0x"+Buffer.from(n).toString("hex")}function JL(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map(t=>
vendor: 150,764 bytes, line 26
26parseInt(t,16)))}function XGe(e){return e.startsWith("0x")?e.slice(2):e}function QGe(e){const t=wf.decode(e)[0];return t===42?0:t===60?2:1}function eZe(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){const t=e<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(e<1<<30){const t=e<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function tZe(e){if(e<1n<<6n)return new Uint8Array([Number(e<<2n)]);if(e<1n<<14n){const t=e<<2n|0x01n;return new Uint8Array([Number(t&0xffn),Number(t>>8n&0xffn)])}else if(e<1n<<30n){const t=e<<2n|0x02n;return new Uint8Array([Number(t&0xffn),Number(t>>8n&0xffn),Number(t>>16n&0xffn),Number(t>>24n&0xffn)])}else throw new Error("BigInt compact encoding not supported > 2^30")}function nZe(e){const t=Uint8Array.from(Buffer.from(e.signature,"hex")),n=ZGe(e.transaction.address),r=YGe({publicKey:n,signature:t,payload:e.transaction}),s=Buffer.from(r).toString("hex");return JGe(s)}function IW({logger:e,name:t}){const n=typeof e=="string"?OC({opts:{level:e,name:t}}).logger:e;return n.level=typeof e=="string"?e:e.level,n}var rZe={};const Epe="wc",Cpe=2,XL="core",rf=`${Epe}@2:${XL}:`,sZe={logger:"error"},iZe={database:":memory:"},oZe="crypto",see="client_ed25519_seed",aZe=V.ONE_DAY,cZe="keychain",lZe="0.3",uZe="messages",dZe="0.3",hZe=V.SIX_HOURS,fZe="publisher",$pe="irn",pZe="error",xpe="wss://relay.walletconnect.org",gZe="relayer",fs={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},mZe="_subscription",Bl={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},wZe=.1,QL="2.23.8",Ur={link_mode:"link_mode",relay:"relay"},ES={inbound:"inbound",outbound:"outbound"},yZe="0.3",bZe="WALLETCONNECT_CLIENT_ID",iee="WALLETCONNECT_LINK_MODE_APPS",Hc={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},vZe="subscription",EZe="0.3",CZe="pairing",$Ze="0.3",z3={wc_pairingDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:V.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:V.ONE_DAY,prompt:!1,tag:0},res:{ttl:V.ONE_DAY,prompt:!1,tag:0}}},X1={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Yu={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},xZe="history",IZe="0.3",SZe="expirer",Ql={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},AZe="0.3",_Ze="verify-api",NZe="https://verify.walletconnect.com",Ipe="https://verify.walletconnect.org",a8=Ipe,TZe=`${a8}/v3`,PZe=[NZe,Ipe],OZe="echo",kZe="https://echo.walletconnect.com",Ah={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},dp={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Ju={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},T1={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},P1={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},q3={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},RZe=.1,BZe="event-client",DZe=86400,UZe="https://pulse.walletconnect.org/batch";function LZe(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),o=i.charCodeAt(0);if(n[o]!==255)throw new TypeError(i+" is ambiguous");n[o]=s}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var p=0,m=0,w=0,C=g.length;w!==C&&g[w]===0;)w++,p++;for(var E=(C-w)*u+1>>>0,b=new Uint8Array(E);w!==C;){for(var S=g[w],v=0,x=E-1;(S!==0||v<m)&&x!==-1;x--,v++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");m=v,w++}for(var A=E-m;A!==E&&b[A]===0;)A++;for(var I=c.repeat(p);A<E;++A)I+=e.charAt(b[A]);return I}function h(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var p=0;if(g[p]!==" "){for(var m=0,w=0;g[p]===c;)m++,p++;for(var C=(g.length-p)*l+1>>>0,E=new Uint8Array(C);g[p];){var b=n[g.charCodeAt(p)];if(b===255)return;for(var S=0,v=C-1;(b!==0||S<w)&&v!==-1;v--,S++)b+=a*E[v]>>>0,E[v]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");w=S,p++}if(g[p]!==" "){for(var x=C-w;x!==C&&E[x]===0;)x++;for(var A=new Uint8Array(m+(C-x)),I=m;x!==C;)A[I++]=E[x++];return A}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var MZe=LZe,jZe=MZe;const FZe=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},zZe=e=>new TextEncoder().encode(e),qZe=e=>new TextDecoder().decode(e);let WZe=class{constructor(t,n,r){this.name=t,this.prefix=n,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},HZe=class{constructor(t,n,r){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Spe(this,t)}},VZe=class{constructor(t){this.decoders=t}or(t){return Spe(this,t)}decode(t){const n=t[0],r=this.decoders[n];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Spe=(e,t)=>new VZe({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let KZe=class{constructor(t,n,r,s){this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new WZe(t,n,r),this.decoder=new HZe(t,n,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};const B7=({name:e,prefix:t,encode:n,decode:r})=>new KZe(e,t,n,r),jC=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:s}=jZe(n,t);return B7({prefix:e,name:t,encode:r,decode:i=>FZe(s(i))})},GZe=(e,t,n,r)=>{const s={};for(let u=0;u<t.length;++u)s[t[u]]=u;let i=e.length;for(;e[i-1]==="=";)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,l=0;for(let u=0;u<i;++u){const d=s[e[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<n|d,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},ZZe=(e,t,n)=>{const r=t[t.length-1]==="=",s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>n;)o-=n,i+=t[s&a>>o];if(o&&(i+=t[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i},no=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>B7({prefix:t,name:e,encode(s){return ZZe(s,r,n)},decode(s){return GZe(s,r,n,e)}}),YZe=B7({prefix:"\0",name:"identity",encode:e=>qZe(e),decode:e=>zZe(e)});var JZe=Object.freeze({__proto__:null,identity:YZe});const XZe=no({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var QZe=Object.freeze({__proto__:null,base2:XZe});const eYe=no({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var tYe=Object.freeze({__proto__:null,base8:eYe});const nYe=jC({prefix:"9",name:"base10",alphabet:"0123456789"});var rYe=Object.freeze({__proto__:null,base10:nYe});const sYe=no({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),iYe=no({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var oYe=Object.freeze({__proto__:null,base16:sYe,base16upper:iYe});const aYe=no({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cYe=no({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),lYe=no({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),uYe=no({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),dYe=no({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hYe=no({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),fYe=no({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pYe=no({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),gYe=no({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var mYe=Object.freeze({__proto__:null,base32:aYe,base32hex:dYe,base32hexpad:fYe,base32hexpadupper:pYe,base32hexupper:hYe,base32pad:lYe,base32padupper:uYe,base32upper:cYe,base32z:gYe});const wYe=jC({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yYe=jC({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var bYe=Object.freeze({__proto__:null,base36:wYe,base36upper:yYe});const vYe=jC({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),EYe=jC({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var CYe=Object.freeze({__proto__:null,base58btc:vYe,base58flickr:EYe});const $Ye=no({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xYe=no({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),IYe=no({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),SYe=no({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var AYe=Object.freeze({__proto__:null,base64:$Ye,base64pad:xYe,base64url:IYe,base64urlpad:SYe});const Ape=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),_Ye=Ape.reduce((e,t,n)=>(e[n]=t,e),[]),NYe=Ape.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function TYe(e){return e.reduce((t,n)=>(t+=_Ye[n],t),"")}function PYe(e){const t=[];for(const n of e){const r=NYe[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);t.push(r)}return new Uint8Array(t)}const OYe=B7({prefix:"ð",name:"base256emoji",encode:TYe,decode:PYe});var kYe=Object.freeze({__proto__:null,base256emoji:OYe});new TextEncoder,new TextDecoder;const oee={...JZe,...QZe,...tYe,...rYe,...oYe,...mYe,...bYe,...CYe,...AYe,...kYe};function _pe(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function RYe(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?_pe(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function Npe(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const aee=Npe("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),Ek=Npe("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=RYe(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),BYe={utf8:aee,"utf-8":aee,hex:oee.base16,latin1:Ek,ascii:Ek,binary:Ek,...oee};function DYe(e,t="utf8"){const n=BYe[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?_pe(globalThis.Buffer.from(e,"utf-8")):n.decoder.decode(`${n.prefix}${e}`)}let UYe=class{constructor(t,n){this.core=t,this.logger=n,this.keychain=new Map,this.name=cZe,this.version=lZe,this.initialized=!1,this.storagePrefix=rf,this.init=async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}},this.has=r=>(this.isInitialized(),this.keychain.has(r)),this.set=async(r,s)=>{this.isInitialized(),this.keychain.set(r,s),await this.persist()},this.get=r=>{this.isInitialized();const s=this.keychain.get(r);if(typeof s>"u"){const{message:i}=je("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(i)}return s},this.del=async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()},this.core=t,this.logger=kr(n,this.name)}get context(){return Sr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,LL(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?ML(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}},LYe=class{constructor(t,n,r){this.core=t,this.logger=n,this.name=oZe,this.randomSessionIdentifier=YL(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=s=>(this.isInitialized(),this.keychain.has(s)),this.getClientId=async()=>{if(this.isInitialized(),this.clientId)return this.clientId;const s=await this.getClientSeed(),i=jm(s),o=bC(i.publicKey);return this.clientId=o,o},this.generateKeyPair=()=>{this.isInitialized();const s=eGe();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const i=await this.getClientSeed(),o=jm(i),a=this.randomSessionIdentifier;return await KN(a,s,aZe,o)},this.generateSharedKey=(s,i,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=tGe(a,i);return this.setSymKey(c,o)},this.setSymKey=async(s,i)=>{this.isInitialized();const o=i||vS(s);return await this.keychain.set(o,s),o},this.deleteKeyPair=async s=>{this.isInitialized(),await this.keychain.del(s)},this.deleteSymKey=async s=>{this.isInitialized(),await this.keychain.del(s)},this.encode=async(s,i,o)=>{this.isInitialized();const a=wpe(o),c=Ao(i);if(GQ(a))return sGe(c,o==null?void 0:o.encoding);if(KQ(a)){const h=a.senderPublicKey,f=a.receiverPublicKey;s=await this.generateSharedKey(h,f)}const l=this.getSymKey(s),{type:u,senderPublicKey:d}=a;return nGe({type:u,symKey:l,message:c,senderPublicKey:d,encoding:o==null?void 0:o.encoding})},this.decode=async(s,i,o)=>{this.isInitialized();const a=oGe(i,o);if(GQ(a)){const c=iGe(i,o==null?void 0:o.encoding);return ul(c)}if(KQ(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(s),l=rGe({symKey:c,encoded:i,encoding:o==null?void 0:o.encoding});return ul(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}},this.getPayloadType=(s,i=Za)=>{const o=W8({encoded:s,encoding:i});return Vw(o.type)},this.getPayloadSenderPublicKey=(s,i=Za)=>{const o=W8({encoded:s,encoding:i});return o.senderPublicKey?rn(o.senderPublicKey,ta):void 0},this.core=t,this.logger=kr(n,this.name),this.keychain=r||new UYe(this.core,this.logger)}get context(){return Sr(this.logger)}async setPrivateKey(t,n){return await this.keychain.set(t,n),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(see)}catch{t=YL(),await this.keychain.set(see,t)}return DYe(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}},MYe=class extends Yze{constructor(t,n){super(t,n),this.logger=t,this.core=n,this.messages=new Map,this.messagesWithoutClientAck=new Map,this.name=uZe,this.version=dZe,this.initialized=!1,this.storagePrefix=rf,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}},this.set=async(r,s,i)=>{this.isInitialized();const o=cu(s);let a=this.messages.get(r);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(r,a),i===ES.inbound){const c=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,{...c,[o]:s})}return await this.persist(),o},this.get=r=>{this.isInitialized();let s=this.messages.get(r);return typeof s>"u"&&(s={}),s},this.getWithoutAck=r=>{this.isInitialized();const s={};for(const i of r){const o=this.messagesWithoutClientAck.get(i)||{};s[i]=Object.values(o)}return s},this.has=(r,s)=>{this.isInitialized();const i=this.get(r),o=cu(s);return typeof i[o]<"u"},this.ack=async(r,s)=>{this.isInitialized();const i=this.messagesWithoutClientAck.get(r);if(typeof i>"u")return;const o=cu(s);delete i[o],Object.keys(i).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,i),await this.persist()},this.del=async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()},this.logger=kr(t,this.name),this.core=n}get context(){return Sr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,LL(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,LL(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?ML(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?ML(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}},jYe=class extends Jze{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,this.events=new Dn.EventEmitter,this.name=fZe,this.queue=new Map,this.publishTimeout=V.toMiliseconds(V.ONE_MINUTE),this.initialPublishTimeout=V.toMiliseconds(V.ONE_SECOND*15),this.needsTransportRestart=!1,this.publish=async(r,s,i)=>{var f,g,p,m,w;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:s,opts:i}});const o=(i==null?void 0:i.ttl)||hZe,a=(i==null?void 0:i.prompt)||!1,c=(i==null?void 0:i.tag)||0,l=(i==null?void 0:i.id)||Ir().toString(),u=fv(b9().protocol),d={id:l,method:(i==null?void 0:i.publishMethod)||u.publish,params:{topic:r,message:s,ttl:o,prompt:a,tag:c,attestation:i==null?void 0:i.attestation,...i==null?void 0:i.tvf}},h=`Failed to publish payload, please try again. id:${l} tag:${c}`;try{Qs((f=d.params)==null?void 0:f.prompt)&&((g=d.params)==null||delete g.prompt),Qs((p=d.params)==null?void 0:p.tag)&&((m=d.params)==null||delete m.tag);const C=new Promise(async E=>{const b=({id:v})=>{var x;((x=d.id)==null?void 0:x.toString())===v.toString()&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(fs.publish,b),E())};this.relayer.events.on(fs.publish,b);const S=Uh(new Promise((v,x)=>{this.rpcPublish(d,i).then(v).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),x(A)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${l} tag:${c}`);try{await S,this.events.removeListener(fs.publish,b)}catch(v){this.queue.set(l,{request:d,opts:i,attempt:1}),this.logger.warn(v,v==null?void 0:v.message)}});this.logger.trace({type:"method",method:"publish",params:{id:l,topic:r,message:s,opts:i}}),await Uh(C,this.publishTimeout,h)}catch(C){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(C),(w=i==null?void 0:i.internal)==null?void 0:w.throwOnFailedPublish)throw C}finally{this.queue.delete(l)}},this.publishCustom=async r=>{var w,C,E,b,S;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:s,opts:i={}}=r,{attestation:o,tvf:a,publishMethod:c,prompt:l,tag:u,ttl:d=V.FIVE_MINUTES}=i,h=i.id||Ir().toString(),f=fv(b9().protocol),g=c||f.publish,p={id:h,method:g,params:{...s,ttl:d,prompt:l,tag:u,attestation:o,...a}},m=`Failed to publish custom payload, please try again. id:${h} tag:${u}`;try{Qs((w=p.params)==null?void 0:w.prompt)&&((C=p.params)==null||delete C.prompt),Qs((E=p.params)==null?void 0:E.tag)&&((b=p.params)==null||delete b.tag);const v=new Promise(async x=>{const A=({id:O})=>{var N;((N=p.id)==null?void 0:N.toString())===O.toString()&&(this.removeRequestFromQueue(O),this.relayer.events.removeListener(fs.publish,A),x())};this.relayer.events.on(fs.publish,A);const I=Uh(new Promise((O,N)=>{this.rpcPublish(p,i).then(O).catch(T=>{this.logger.warn(T,T==null?void 0:T.message),N(T)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${g} id:${h} tag:${u}`);try{await I,this.events.removeListener(fs.publish,A)}catch(O){this.queue.set(h,{request:p,opts:i,attempt:1}),this.logger.warn(O,O==null?void 0:O.message)}});this.logger.trace({type:"method",method:"publish",params:{id:h,payload:s,opts:i}}),await Uh(v,this.publishTimeout,m)}catch(v){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(v),(S=i==null?void 0:i.internal)==null?void 0:S.throwOnFailedPublish)throw v}finally{this.queue.delete(h)}},this.on=(r,s)=>{this.events.on(r,s)},this.once=(r,s)=>{this.events.once(r,s)},this.off=(r,s)=>{this.events.off(r,s)},this.removeListener=(r,s)=>{this.events.removeListener(r,s)},this.relayer=t,this.logger=kr(n,this.name),this.registerEventListeners()}get context(){return Sr(this.logger)}async rpcPublish(t,n){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const r=await this.relayer.request(t);return this.relayer.events.emit(fs.publish,{...t,...n}),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,n)=>{var s;const r=t.attempt+1;this.queue.set(n,{...t,attempt:r}),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(s=t.request.params)==null?void 0:s.tag}, attempt: ${r}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Hr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(fs.connection_stalled);return}this.checkQueue()}),this.relayer.on(fs.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}},FYe=class{constructor(){this.map=new Map,this.set=(t,n)=>{const r=this.get(t);this.exists(t,n)||this.map.set(t,[...r,n])},this.get=t=>this.map.get(t)||[],this.exists=(t,n)=>this.get(t).includes(n),this.delete=(t,n)=>{if(typeof n>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,n))return;const s=r.filter(i=>i!==n);if(!s.length){this.map.delete(t);return}this.map.set(t,s)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},zYe=class extends eqe{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,this.subscriptions=new Map,this.topicMap=new FYe,this.events=new Dn.EventEmitter,this.name=vZe,this.version=EZe,this.pending=new Map,this.cached=[],this.initialized=!1,this.storagePrefix=rf,this.subscribeTimeout=V.toMiliseconds(V.ONE_MINUTE),this.initialSubscribeTimeout=V.toMiliseconds(V.ONE_SECOND*15),this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0},this.subscribe=async(r,s)=>{var i;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}});try{const o=b9(s),a={topic:r,relay:o,transportType:s==null?void 0:s.transportType};(i=s==null?void 0:s.internal)!=null&&i.skipSubscribe||this.pending.set(r,a);const c=await this.rpcSubscribe(r,o,s);return typeof c=="string"&&(this.onSubscribe(c,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}})),c}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}},this.unsubscribe=async(r,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(r,s.id,s):await this.unsubscribeByTopic(r,s)},this.isSubscribed=r=>new Promise(s=>{s(this.topicMap.topics.includes(r))}),this.isKnownTopic=r=>new Promise(s=>{s(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(i=>i.topic===r))}),this.on=(r,s)=>{this.events.on(r,s)},this.once=(r,s)=>{this.events.once(r,s)},this.off=(r,s)=>{this.events.off(r,s)},this.removeListener=(r,s)=>{this.events.removeListener(r,s)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{await this.restore(),await this.onRestart()},this.checkPending=async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(s=>{r.push(s)}),await this.batchSubscribe(r)},this.registerEventListeners=()=>{this.relayer.core.heartbeat.on(Hr.pulse,async()=>{await this.checkPending()}),this.events.on(Hc.created,async r=>{const s=Hc.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()}),this.events.on(Hc.deleted,async r=>{const s=Hc.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()})},this.relayer=t,this.logger=kr(n,this.name),this.clientId=""}get context(){return Sr(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}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,n){let r=!1;try{r=this.getSubscription(t).topic===n}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,n){const r=this.topicMap.get(t);await Promise.all(r.map(async s=>await this.unsubscribeById(t,s,n)))}async unsubscribeById(t,n,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}});try{const s=b9(r);await this.restartToComplete({topic:t,id:n,relay:s}),await this.rpcUnsubscribe(t,n,s);const i=Yr("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,n,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(t,n,r){var a,c;const s=await this.getSubscriptionId(t);if((a=r==null?void 0:r.internal)!=null&&a.skipSubscribe)return s;(!r||(r==null?void 0:r.transportType)===Ur.relay)&&await this.restartToComplete({topic:t,id:t,relay:n});const i={method:fv(n.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});const o=(c=r==null?void 0:r.internal)==null?void 0:c.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===Ur.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch(d=>this.logger.warn(d))},V.toMiliseconds(V.ONE_SECOND)),s;const l=new Promise(async d=>{const h=f=>{f.topic===t&&(this.events.removeListener(Hc.created,h),d(f.id))};this.events.on(Hc.created,h);try{const f=await Uh(new Promise((g,p)=>{this.relayer.request(i).catch(m=>{this.logger.warn(m,m==null?void 0:m.message),p(m)}).then(g)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(Hc.created,h),d(f)}catch{}}),u=await Uh(l,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!u&&o)throw new Error(`Subscribing to ${t} failed, please try again`);return u?s:null}catch(l){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(fs.connection_stalled),o)throw l}return null}async rpcBatchSubscribe(t){if(!t.length)return!0;const n=t[0].relay,r={method:fv(n.protocol).batchSubscribe,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{return await Uh(new Promise((s,i)=>{this.relayer.request(r).then(s).catch(o=>{this.logger.warn(o),i(o)})}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again"),!0}catch{return this.relayer.events.emit(fs.connection_stalled),!1}}async rpcBatchFetchMessages(t){if(!t.length)return;const n=t[0].relay,r={method:fv(n.protocol).batchFetchMessages,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let s;try{s=await await Uh(new Promise((i,o)=>{this.relayer.request(r).catch(a=>{this.logger.warn(a),o(a)}).then(i)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(fs.connection_stalled)}return s}rpcUnsubscribe(t,n,r){const s={method:fv(r.protocol).unsubscribe,params:{topic:t,id:n}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(t,n){this.setSubscription(t,{...n,id:t}),this.pending.delete(n.topic)}onBatchSubscribe(t){t.length&&t.forEach(n=>{this.setSubscription(n.id,{...n}),this.pending.delete(n.topic)})}async onUnsubscribe(t,n,r){this.events.removeAllListeners(n),this.hasSubscription(n,t)&&this.deleteSubscription(n,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,n){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:n}),this.addSubscription(t,n)}addSubscription(t,n){this.subscriptions.set(t,{...n}),this.topicMap.set(n.topic,t),this.events.emit(Hc.created,n)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const n=this.subscriptions.get(t);if(!n){const{message:r}=je("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}deleteSubscription(t,n){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:n});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(Hc.deleted,{...r,reason:n})}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Hc.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],n=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<n;r++){const s=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(Hc.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(n=>{var r;return n.topic===((r=this.subscriptions.get(n.id))==null?void 0:r.topic)})){const{message:n}=je("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){if(t.length){if(!await this.rpcBatchSubscribe(t)){this.logger.warn(`Batch subscribe failed for ${t.length} topics, adding to pending for retry`),t.forEach(n=>{this.pending.set(n.topic,n)});return}this.onBatchSubscribe(await Promise.all(t.map(async n=>({...n,id:await this.getSubscriptionId(n.topic)}))))}}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const n=await this.rpcBatchFetchMessages(t);n&&n.messages&&(await AHe(V.toMiliseconds(V.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(n.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return cu(t+await this.getClientId())}},qYe=class extends Xze{constructor(t){super(t),this.protocol="wc",this.version=2,this.events=new Dn.EventEmitter,this.name=gZe,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1,this.heartBeatTimeout=V.toMiliseconds(V.THIRTY_SECONDS+V.FIVE_SECONDS),this.reconnectInProgress=!1,this.requestsInFlight=[],this.connectTimeout=V.toMiliseconds(V.ONE_SECOND*15),this.stalledRestartInProgress=!1,this.stalledRestartBackoff=0,this.stalledRestartBaseInterval=V.toMiliseconds(V.ONE_SECOND*2),this.stalledRestartMaxInterval=V.toMiliseconds(V.THIRTY_SECONDS),this.request=async n=>{var s,i;this.logger.debug("Publishing Request Payload");const r=n.id||Ir().toString();await this.toEstablishConnection();try{this.logger.trace({id:r,method:n.method,topic:(s=n.params)==null?void 0:s.topic},"relayer.request - publishing...");const o=`${r}:${((i=n.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(n);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${r}`),o}},this.resetPingTimeout=()=>{f9()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var n,r,s,i;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(i=(s=(r=(n=this.provider)==null?void 0:n.connection)==null?void 0:r.socket)==null?void 0:s.terminate)==null||i.call(s)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))},this.onPayloadHandler=n=>{this.onProviderPayload(n),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.warn({},"Relayer connected ð"),this.startPingTimeout(),this.events.emit(fs.connect)},this.onDisconnectHandler=()=>{this.logger.warn({},"Relayer disconnected ð"),this.requestsInFlight=[],this.onProviderDisconnect()},this.onProviderErrorHandler=n=>{this.logger.fatal(`Fatal socket error: ${n.message}`),this.events.emit(fs.error,n),this.logger.fatal("Fatal socket error received, closing transport"),this.transportExplicitlyClosed=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.reconnectInProgress=!1,this.transportClose().catch(r=>this.logger.warn(r))},this.registerProviderListeners=()=>{this.provider.on(Bl.payload,this.onPayloadHandler),this.provider.on(Bl.connect,this.onConnectHandler),this.provider.on(Bl.disconnect,this.onDisconnectHandler),this.provider.on(Bl.error,this.onProviderErrorHandler)},this.core=t.core,this.logger=IW({logger:t.logger??pZe,name:this.name}),this.messages=new MYe(this.logger,t.core),this.subscriber=new zYe(this,this.logger),this.publisher=new jYe(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||xpe,dHe()?this.packageName=wQ():hHe()&&(this.bundleId=wQ()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Sr(this.logger)}get connected(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,n,r){this.isInitialized(),await this.publisher.publish(t,n,r),await this.recordMessageEvent({topic:t,message:n,publishedAt:Date.now(),transportType:Ur.relay},ES.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,n){var a,c,l;this.isInitialized(),(!(n!=null&&n.transportType)||(n==null?void 0:n.transportType)==="relay")&&await this.toEstablishConnection();const r=typeof((a=n==null?void 0:n.internal)==null?void 0:a.throwOnFailedPublish)>"u"?!0:(c=n==null?void 0:n.internal)==null?void 0:c.throwOnFailedPublish;let s=((l=this.subscriber.topicMap.get(t))==null?void 0:l[0])||"",i;const o=u=>{u.topic===t&&(this.subscriber.off(Hc.created,o),i())};return await Promise.all([new Promise(u=>{i=u,this.subscriber.on(Hc.created,o)}),new Promise(async(u,d)=>{s=await this.subscriber.subscribe(t,{internal:{throwOnFailedPublish:r},...n}).catch(h=>{r&&d(h)})||s,u()})]),s}async unsubscribe(t,n){this.isInitialized(),await this.subscriber.unsubscribe(t,n)}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Uh(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,clearTimeout(this.stalledRestartTimeout),this.stalledRestartInProgress=!1,this.stalledRestartBackoff=0,await this.resetTransport()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(n,r)=>{await this.connect(t).then(n).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.resetTransport(),await this.transportOpen())}async resetTransport(){this.reconnectInProgress=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,await this.transportDisconnect(),await this.subscriber.stop(),this.reconnectInProgress=!1}async confirmOnlineStateOrThrow(){if(!await ree())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const n=t.sort((r,s)=>r.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${n.length} message events sorted`);for(const r of n)try{await this.onMessageEvent(r)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${n.length} message events processed`)}async onLinkMessageEvent(t,n){const{topic:r}=t;if(!n.sessionExists){const s=Ss(V.FIVE_MINUTES),i={topic:r,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,i)}this.events.emit(fs.message,t),await this.recordMessageEvent(t,ES.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let n=1;for(;n<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${n}...`),await this.createProvider(),await new Promise(async(r,s)=>{const i=()=>{s(new Error("Connection interrupted while trying to connect"))};this.provider.once(Bl.disconnect,i),await Uh(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(Bl.disconnect,i),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Bl.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(Bl.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const s=r;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${n}`);break}await new Promise(r=>setTimeout(r,V.toMiliseconds(n*1))),n++}}startPingTimeout(){var t,n,r,s,i;if(f9())try{(n=(t=this.provider)==null?void 0:t.connection)!=null&&n.socket&&((i=(s=(r=this.provider)==null?void 0:r.connection)==null?void 0:s.socket)==null||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new or(new o7(wHe({sdkVersion:QL,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,n){const{topic:r,message:s}=t;await this.messages.set(r,s,n)}async shouldIgnoreMessageEvent(t){const{topic:n,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(n))return this.logger.warn(`Ignoring message for unknown topic ${n}`),!0;const s=this.messages.has(n,r);return s&&this.logger.warn(`Ignoring duplicate message: ${r}`),s}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Du(t)){if(!t.method.endsWith(mZe))return;const n=t.params,{topic:r,message:s,publishedAt:i,attestation:o}=n.data,a={topic:r,message:s,publishedAt:i,transportType:Ur.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace({type:"event",event:n.id,...a}),this.events.emit(n.id,a),await this.acknowledgePayload(t),await this.onMessageEvent(a)}else Sl(t)&&this.events.emit(fs.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,ES.inbound),this.events.emit(fs.message,t))}async acknowledgePayload(t){const n=Pi(t.id,!0);await this.provider.connection.send(n)}unregisterProviderListeners(){this.provider.off(Bl.payload,this.onPayloadHandler),this.provider.off(Bl.connect,this.onConnectHandler),this.provider.off(Bl.disconnect,this.onDisconnectHandler),this.provider.off(Bl.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await ree();HGe(async n=>{t!==n&&(t=n,n?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Hr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&GGe())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(n){this.logger.warn(n,n==null?void 0:n.message)}}),this.events.on(fs.connection_stalled,()=>{if(this.transportExplicitlyClosed||this.stalledRestartInProgress)return;this.stalledRestartInProgress=!0;const n=this.stalledRestartBackoff===0?0:Math.min(Math.pow(2,this.stalledRestartBackoff-1)*this.stalledRestartBaseInterval,this.stalledRestartMaxInterval);this.stalledRestartBackoff++,this.logger.warn(`Connection stalled, restarting transport${n?` in ${n}ms`:""}...`),this.stalledRestartTimeout=setTimeout(async()=>{try{if(this.transportExplicitlyClosed)return;await this.restartTransport()}catch(r){this.logger.error(r,r==null?void 0:r.message)}finally{this.stalledRestartInProgress=!1}},n)})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(fs.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},V.toMiliseconds(wZe)))))}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}};function WYe(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function cee(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function lee(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const HYe="[object RegExp]",VYe="[object String]",KYe="[object Number]",GYe="[object Boolean]",uee="[object Arguments]",ZYe="[object Symbol]",YYe="[object Date]",JYe="[object Map]",XYe="[object Set]",QYe="[object Array]",eJe="[object Function]",tJe="[object ArrayBuffer]",Ck="[object Object]",nJe="[object Error]",rJe="[object DataView]",sJe="[object Uint8Array]",iJe="[object Uint8ClampedArray]",oJe="[object Uint16Array]",aJe="[object Uint32Array]",cJe="[object BigUint64Array]",lJe="[object Int8Array]",uJe="[object Int16Array]",dJe="[object Int32Array]",hJe="[object BigInt64Array]",fJe="[object Float32Array]",pJe="[object Float64Array]";function dee(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)==="[object Object]":!1}function gJe(e,t,n){return _E(e,t,void 0,void 0,void 0,void 0,n)}function _E(e,t,n,r,s,i,o){const a=o(e,t,n,r,s,i);if(a!==void 0)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return e===t;case"number":return e===t||Object.is(e,t);case"function":return e===t;case"object":return c8(e,t,i,o)}return c8(e,t,i,o)}function c8(e,t,n,r){if(Object.is(e,t))return!0;let s=lee(e),i=lee(t);if(s===uee&&(s=Ck),i===uee&&(i=Ck),s!==i)return!1;switch(s){case VYe:return e.toString()===t.toString();case KYe:{const c=e.valueOf(),l=t.valueOf();return WYe(c,l)}case GYe:case YYe:case ZYe:return Object.is(e.valueOf(),t.valueOf());case HYe:return e.source===t.source&&e.flags===t.flags;case eJe:return e===t}n=n??new Map;const o=n.get(e),a=n.get(t);if(o!=null&&a!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(s){case JYe:{if(e.size!==t.size)return!1;for(const[c,l]of e.entries())if(!t.has(c)||!_E(l,t.get(c),c,e,t,n,r))return!1;return!0}case XYe:{if(e.size!==t.size)return!1;const c=Array.from(e.values()),l=Array.from(t.values());for(let u=0;u<c.length;u++){const d=c[u],h=l.findIndex(f=>_E(d,f,void 0,e,t,n,r));if(h===-1)return!1;l.splice(h,1)}return!0}case QYe:case sJe:case iJe:case oJe:case aJe:case cJe:case lJe:case uJe:case dJe:case hJe:case fJe:case pJe:{if(typeof Buffer<"u"&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let c=0;c<e.length;c++)if(!_E(e[c],t[c],c,e,t,n,r))return!1;return!0}case tJe:return e.byteLength!==t.byteLength?!1:c8(new Uint8Array(e),new Uint8Array(t),n,r);case rJe:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:c8(new Uint8Array(e),new Uint8Array(t),n,r);case nJe:return e.name===t.name&&e.message===t.message;case Ck:{if(!(c8(e.constructor,t.constructor,n,r)||dee(e)&&dee(t)))return!1;const c=[...Object.keys(e),...cee(e)],l=[...Object.keys(t),...cee(t)];if(c.length!==l.length)return!1;for(let u=0;u<c.length;u++){const d=c[u],h=e[d];if(!Object.hasOwn(t,d))return!1;const f=t[d];if(!_E(h,f,d,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function mJe(){}function wJe(e,t){return gJe(e,t,mJe)}let ob=class extends Qze{constructor(t,n,r,s=rf,i=void 0){super(t,n,r,s),this.core=t,this.logger=n,this.name=r,this.map=new Map,this.version=yZe,this.cached=[],this.initialized=!1,this.storagePrefix=rf,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Qs(o)?this.map.set(this.getKey(o),o):CGe(o)?this.map.set(o.id,o):$Ge(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>wJe(a[c],o[c]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c={...this.getData(o),...a};this.map.set(o,c),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=kr(n,this.name),this.storagePrefix=s,this.getKey=i}get context(){return Sr(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const n=this.map.get(t);if(!n){if(this.recentlyDeleted.includes(t)){const{message:s}=je("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}const{message:r}=je("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return n}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:n}=je("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}},yJe=class{constructor(t,n){this.core=t,this.logger=n,this.name=CZe,this.version=$Ze,this.events=new Bu,this.initialized=!1,this.storagePrefix=rf,this.ignoredPayloadTypes=[t0],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:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]},this.create=async r=>{this.isInitialized();const s=YL(),i=await this.core.crypto.setSymKey(s),o=Ss(V.FIVE_MINUTES),a={protocol:$pe},c={topic:i,expiry:o,relay:a,active:!1,methods:r==null?void 0:r.methods},l=YQ({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:s,relay:a,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(X1.create,c),this.core.expirer.set(i,o),await this.pairings.set(i,c),await this.core.relayer.subscribe(i,{transportType:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:i,uri:l}},this.pair=async r=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[Ah.pairing_started]}});this.isValidPair(r,s);const{topic:i,symKey:o,relay:a,expiryTimestamp:c,methods:l}=ZQ(r.uri);s.props.properties.topic=i,s.addTrace(Ah.pairing_uri_validation_success),s.addTrace(Ah.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(i)){if(u=this.pairings.get(i),s.addTrace(Ah.existing_pairing),u.active)throw s.setError(dp.active_pairing_already_exists),new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);s.addTrace(Ah.pairing_not_expired)}const d=c||Ss(V.FIVE_MINUTES),h={topic:i,relay:a,expiry:d,active:!1,methods:l};this.core.expirer.set(i,d),await this.pairings.set(i,h),s.addTrace(Ah.store_new_pairing),r.activatePairing&&await this.activate({topic:i}),this.events.emit(X1.create,h),s.addTrace(Ah.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(o,i),s.addTrace(Ah.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(dp.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:a})}catch(f){throw s.setError(dp.subscribe_pairing_topic_failure),f}return s.addTrace(Ah.subscribe_pairing_topic_success),h},this.activate=async({topic:r})=>{this.isInitialized();const s=Ss(V.FIVE_MINUTES);this.core.expirer.set(r,s),await this.pairings.update(r,{active:!0,expiry:s})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=r;if(this.pairings.keys.includes(s)){const i=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=q1();this.events.once(lr("pairing_ping",i),({error:l})=>{l?c(l):a()}),await o()}},this.updateExpiry=async({topic:r,expiry:s})=>{this.isInitialized(),await this.pairings.update(r,{expiry:s})},this.updateMetadata=async({topic:r,metadata:s})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:s})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:s}=r;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",Yr("USER_DISCONNECTED")),await this.deletePairing(s))},this.formatUriFromPairing=r=>{this.isInitialized();const{topic:s,relay:i,expiry:o,methods:a}=r,c=this.core.crypto.keychain.get(s);return YQ({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:i,expiryTimestamp:o,methods:a})},this.sendRequest=async(r,s,i)=>{const o=_n(s,i),a=await this.core.crypto.encode(r,o),c=z3[s].req;return this.core.history.set(r,o),this.core.relayer.publish(r,a,c),o.id},this.sendResult=async(r,s,i)=>{const o=Pi(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=z3[c].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)},this.sendError=async(r,s,i)=>{const o=yf(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=z3[c]?z3[c].res:z3.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)},this.deletePairing=async(r,s)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,Yr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),s?Promise.resolve():this.core.expirer.del(r)])},this.cleanup=async()=>{const r=this.pairings.getAll().filter(s=>kh(s.expiry));await Promise.all(r.map(s=>this.deletePairing(s.topic)))},this.onRelayEventRequest=async r=>{const{topic:s,payload:i}=r;switch(i.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,i);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,i);default:return await this.onUnknownRpcMethodRequest(s,i)}},this.onRelayEventResponse=async r=>{const{topic:s,payload:i}=r,o=(await this.core.history.get(s,i.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,i);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(r,s)=>{const{id:i}=s;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.events.emit(X1.ping,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}},this.onPairingPingResponse=(r,s)=>{const{id:i}=s;setTimeout(()=>{wn(s)?this.events.emit(lr("pairing_ping",i),{}):nn(s)&&this.events.emit(lr("pairing_ping",i),{error:s.error})},500)},this.onPairingDeleteRequest=async(r,s)=>{const{id:i}=s;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(X1.delete,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(r,s)=>{const{id:i,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=Yr("WC_METHOD_UNSUPPORTED",o);await this.sendError(i,r,a),this.logger.error(a)}catch(a){await this.sendError(i,r,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=r=>{this.registeredMethods.includes(r)||this.logger.error(Yr("WC_METHOD_UNSUPPORTED",r))},this.isValidPair=(r,s)=>{var o;if(!Fa(r)){const{message:a}=je("MISSING_OR_INVALID",`pair() params: ${r}`);throw s.setError(dp.malformed_pairing_uri),new Error(a)}if(!EGe(r.uri)){const{message:a}=je("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw s.setError(dp.malformed_pairing_uri),new Error(a)}const i=ZQ(r==null?void 0:r.uri);if(!((o=i==null?void 0:i.relay)!=null&&o.protocol)){const{message:a}=je("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(dp.malformed_pairing_uri),new Error(a)}if(!(i!=null&&i.symKey)){const{message:a}=je("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(dp.malformed_pairing_uri),new Error(a)}if(i!=null&&i.expiryTimestamp&&V.toMiliseconds(i==null?void 0:i.expiryTimestamp)<Date.now()){s.setError(dp.pairing_expired);const{message:a}=je("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}},this.isValidPing=async r=>{if(!Fa(r)){const{message:i}=je("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)},this.isValidDisconnect=async r=>{if(!Fa(r)){const{message:i}=je("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)},this.isValidPairingTopic=async r=>{if(!Ns(r,!1)){const{message:s}=je("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(s)}if(!this.pairings.keys.includes(r)){const{message:s}=je("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(s)}if(kh(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:s}=je("EXPIRED",`pairing topic: ${r}`);throw new Error(s)}},this.core=t,this.logger=kr(n,this.name),this.pairings=new ob(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Sr(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(fs.message,async t=>{const{topic:n,message:r,transportType:s}=t;if(this.pairings.keys.includes(n)&&s!==Ur.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const i=await this.core.crypto.decode(n,r);Du(i)?(this.core.history.set(n,i),await this.onRelayEventRequest({topic:n,payload:i})):Sl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:n,payload:i}),this.core.history.delete(n,i.id)),await this.core.relayer.messages.ack(n,r)}catch(i){this.logger.error(i)}})}registerExpirerEvents(){this.core.expirer.on(Ql.expired,async t=>{const{topic:n}=bfe(t.target);n&&this.pairings.keys.includes(n)&&(await this.deletePairing(n,!0),this.events.emit(X1.expire,{topic:n}))})}},bJe=class extends Zze{constructor(t,n){super(t,n),this.core=t,this.logger=n,this.records=new Map,this.events=new Dn.EventEmitter,this.name=xZe,this.version=IZe,this.cached=[],this.initialized=!1,this.storagePrefix=rf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(r,s,i)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:s,chainId:i}),this.records.has(s.id))return;const o={id:s.id,topic:r,request:{method:s.method,params:s.params||null},chainId:i,expiry:Ss(V.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Yu.created,o)},this.resolve=async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const s=await this.getRecord(r.id);typeof s.response<"u"||(s.response=nn(r)?{error:r.error}:{result:r.result},this.records.set(s.id,s),this.persist(),this.events.emit(Yu.updated,s))},this.get=async(r,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:s}),await this.getRecord(s)),this.delete=(r,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(i=>{if(i.topic===r){if(typeof s<"u"&&i.id!==s)return;this.records.delete(i.id),this.events.emit(Yu.deleted,i)}}),this.persist()},this.exists=async(r,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===r:!1),this.on=(r,s)=>{this.events.on(r,s)},this.once=(r,s)=>{this.events.once(r,s)},this.off=(r,s)=>{this.events.off(r,s)},this.removeListener=(r,s)=>{this.events.removeListener(r,s)},this.logger=kr(n,this.name)}get context(){return Sr(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(){const t=[];return this.values.forEach(n=>{if(typeof n.response<"u")return;const r={topic:n.topic,request:_n(n.request.method,n.request.params,n.id),chainId:n.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const n=this.records.get(t);if(!n){const{message:r}=je("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Yu.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:n}=je("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(Yu.created,t=>{const n=Yu.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(Yu.updated,t=>{const n=Yu.updated;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(Yu.deleted,t=>{const n=Yu.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.core.heartbeat.on(Hr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(n=>{V.toMiliseconds(n.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${n.id}`),this.records.delete(n.id),this.events.emit(Yu.deleted,n,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}},vJe=class extends tqe{constructor(t,n){super(t,n),this.core=t,this.logger=n,this.expirations=new Map,this.events=new Dn.EventEmitter,this.name=SZe,this.version=AZe,this.cached=[],this.initialized=!1,this.storagePrefix=rf,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=r=>{try{const s=this.formatTarget(r);return typeof this.getExpiration(s)<"u"}catch{return!1}},this.set=(r,s)=>{this.isInitialized();const i=this.formatTarget(r),o={target:i,expiry:s};this.expirations.set(i,o),this.checkExpiry(i,o),this.events.emit(Ql.created,{target:i,expiration:o})},this.get=r=>{this.isInitialized();const s=this.formatTarget(r);return this.getExpiration(s)},this.del=r=>{if(this.isInitialized(),this.has(r)){const s=this.formatTarget(r),i=this.getExpiration(s);this.expirations.delete(s),this.events.emit(Ql.deleted,{target:s,expiration:i})}},this.on=(r,s)=>{this.events.on(r,s)},this.once=(r,s)=>{this.events.once(r,s)},this.off=(r,s)=>{this.events.off(r,s)},this.removeListener=(r,s)=>{this.events.removeListener(r,s)},this.logger=kr(n,this.name)}get context(){return Sr(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(t){if(typeof t=="string")return yHe(t);if(typeof t=="number")return bHe(t);const{message:n}=je("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(n)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ql.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:n}=je("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const n=this.expirations.get(t);if(!n){const{message:r}=je("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return n}checkExpiry(t,n){const{expiry:r}=n;V.toMiliseconds(r)-Date.now()<=0&&this.expire(t,n)}expire(t,n){this.expirations.delete(t),this.events.emit(Ql.expired,{target:t,expiration:n})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,n)=>this.checkExpiry(n,t))}registerEventListeners(){this.core.heartbeat.on(Hr.pulse,()=>this.checkExpirations()),this.events.on(Ql.created,t=>{const n=Ql.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(Ql.expired,t=>{const n=Ql.expired;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(Ql.deleted,t=>{const n=Ql.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}},EJe=class extends nqe{constructor(t,n,r){super(t,n,r),this.core=t,this.logger=n,this.store=r,this.name=_Ze,this.verifyUrlV3=TZe,this.storagePrefix=rf,this.version=Cpe,this.init=async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&V.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async s=>{if(!A6()||this.isDevEnv)return;const i=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${i}&id=${o}&decryptedId=${a}`;try{const l=cn.getDocument(),u=this.startAbortTimer(V.ONE_SECOND*5),d=await new Promise((h,f)=>{const g=()=>{window.removeEventListener("message",m),l.body.removeChild(p),f("attestation aborted")};this.abortController.signal.addEventListener("abort",g);const p=l.createElement("iframe");p.src=c,p.style.display="none",p.addEventListener("error",g,{signal:this.abortController.signal});const m=w=>{if(w.data&&typeof w.data=="string")try{const C=JSON.parse(w.data);if(C.type==="verify_attestation"){if(wu(C.attestation).payload.id!==o)return;clearInterval(u),l.body.removeChild(p),this.abortController.signal.removeEventListener("abort",g),window.removeEventListener("message",m),h(C.attestation===null?"":C.attestation)}}catch(C){this.logger.warn(C)}};l.body.appendChild(p),window.addEventListener("message",m,{signal:this.abortController.signal})});return this.logger.debug(d,"jwt attestation"),d}catch(l){this.logger.warn(l)}return""},this.resolve=async s=>{if(this.isDevEnv)return"";const{attestationId:i,hash:o,encryptedId:a}=s;if(i===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(i){if(wu(i).payload.id!==a)return;const l=await this.isValidJwtAttestation(i);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)},this.fetchAttestation=async(s,i)=>{this.logger.debug(`resolving attestation: ${s} from url: ${i}`);const o=this.startAbortTimer(V.ONE_SECOND*5),a=await fetch(`${i}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=s=>{let i=s||a8;return PZe.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${a8}`),i=a8),i},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(V.FIVE_SECONDS),i=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await i.json()}catch(s){this.logger.warn(s)}},this.persistPublicKey=async s=>{this.logger.debug(s,"persisting public key to local storage"),await this.store.setItem(this.storeKey,s),this.publicKey=s},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 s=>{const i=await this.getPublicKey();try{if(i)return this.validateAttestation(s,i)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),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 i=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),i(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s},this.validateAttestation=(s,i)=>{const o=cGe(s,i.publicKey),a={hasExpired:V.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}},this.logger=kr(n,this.name),this.abortController=new AbortController,this.isDevEnv=pW(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Sr(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),V.toMiliseconds(t))}},CJe=class extends rqe{constructor(t,n){super(t,n),this.projectId=t,this.logger=n,this.context=OZe,this.registerDeviceToken=async r=>{const{clientId:s,token:i,notificationType:o,enableEncrypted:a=!1}=r,c=`${kZe}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:i,always_raw:a})})},this.logger=kr(n,this.context)}},$Je=class extends sqe{constructor(t,n,r=!0){super(t,n,r),this.core=t,this.logger=n,this.context=BZe,this.storagePrefix=rf,this.storageVersion=RZe,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!pW())try{const s={eventId:bQ(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:wfe(this.core.relayer.protocol,this.core.relayer.version,QL)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}},this.createEvent=s=>{const{event:i="ERROR",type:o="",properties:{topic:a,trace:c}}=s,l=bQ(),u=this.core.projectId||"",d=Date.now(),h={eventId:l,timestamp:d,props:{event:i,type:o,properties:{topic:a,trace:c}},bundleId:u,domain:this.getAppDomain(),...this.setMethods(l)};return this.telemetryEnabled&&(this.events.set(l,h),this.shouldPersist=!0),h},this.getEvent=s=>{const{eventId:i,topic:o}=s;if(i)return this.events.get(i);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return{...a,...this.setMethods(a.eventId)}},this.deleteEvent=s=>{const{eventId:i}=s;this.events.delete(i),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(Hr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{V.fromMiliseconds(Date.now())-V.fromMiliseconds(s.timestamp)>DZe&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})},this.setMethods=s=>({addTrace:i=>this.addTrace(s,i),setError:i=>this.setError(s,i)}),this.addTrace=(s,i)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(i),this.events.set(s,o),this.shouldPersist=!0)},this.setError=(s,i)=>{const o=this.events.get(s);o&&(o.props.type=i,o.timestamp=Date.now(),this.events.set(s,o),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{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(i=>{this.events.set(i.eventId,{...i,...this.setMethods(i.eventId)})})}catch(s){this.logger.warn(s)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[i,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const i of s)this.events.delete(i.eventId),this.shouldPersist=!0}catch(i){this.logger.warn(i)}},this.sendEvent=async s=>{const i=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${UZe}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${QL}${i}`,{method:"POST",body:JSON.stringify(s)})},this.getAppDomain=()=>mfe().url,this.logger=kr(n,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}},xJe=class Tpe extends Gze{constructor(t){var o;super(t),this.protocol=Epe,this.version=Cpe,this.name=XL,this.events=new Dn.EventEmitter,this.initialized=!1,this.on=(a,c)=>this.events.on(a,c),this.once=(a,c)=>this.events.once(a,c),this.off=(a,c)=>this.events.off(a,c),this.removeListener=(a,c)=>this.events.removeListener(a,c),this.dispatchEnvelope=({topic:a,message:c,sessionExists:l})=>{if(!a||!c)return;const u={topic:a,message:c,publishedAt:Date.now(),transportType:Ur.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:l})};const n=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(a){console.warn("Failed to copy global core",a)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||xpe,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const r=sW({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:sZe.logger,name:XL}),{logger:s,chunkLoggerController:i}=OC({opts:r,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=i,(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=kr(s,this.name),this.heartbeat=new s7,this.crypto=new LYe(this,this.logger,t==null?void 0:t.keychain),this.history=new bJe(this,this.logger),this.expirer=new vJe(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new i7({...iZe,...t==null?void 0:t.storageOptions}),this.relayer=new qYe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new yJe(this,this.logger),this.verify=new EJe(this,this.logger,this.storage),this.echoClient=new CJe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new $Je(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const n=new Tpe(t);await n.initialize();const r=await n.crypto.getClientId();return await n.storage.setItem(bZe,r),n}get context(){return Sr(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(iee,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(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(iee)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(t,`Core Initialization Failure at epoch ${Date.now()}`),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${t}`,r=`${n}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[n]}catch(n){console.warn("Failed to get global WalletConnect core",n);return}}setGlobalCore(t){var n;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((n=t.opts)==null?void 0:n.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&rZe.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const IJe=xJe,Ppe="wc",Ope=2,kpe="client",SW=`${Ppe}@${Ope}:${kpe}:`,$k={name:kpe,logger:"error"},hee="WALLETCONNECT_DEEPLINK_CHOICE",SJe="proposal",fee="Proposal expired",AJe="session",a2=V.SEVEN_DAYS,_Je="engine",Ui={wc_sessionPropose:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1104},res:{ttl:V.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1106},res:{ttl:V.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:V.FIVE_MINUTES*3,prompt:!0,tag:1108},res:{ttl:V.FIVE_MINUTES*3,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1112},res:{ttl:V.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1114},res:{ttl:V.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:V.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:V.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1119}}},xk={min:V.FIVE_MINUTES,max:V.SEVEN_DAYS},mh={idle:"IDLE",active:"ACTIVE"},NJe={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},TJe="request",PJe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],OJe="wc",kJe="auth",RJe="authKeys",BJe="pairingTopics",DJe="requests",D7=`${OJe}@${1.5}:${kJe}:`,CS=`${D7}:PUB_KEY`;let UJe=class extends oqe{constructor(t){super(t),this.name=_Je,this.events=new Bu,this.initialized=!1,this.requestQueue={state:mh.idle,queue:[]},this.sessionRequestQueue={state:mh.idle,queue:[]},this.emittedSessionRequests=new _He({limit:500}),this.requestQueueDelay=V.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.pendingSessions=new Map,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(Ui)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay)))},this.connect=async n=>{var A;this.isInitialized(),await this.confirmOnlineStateOrThrow();const r={...n,requiredNamespaces:n.requiredNamespaces||{},optionalNamespaces:n.optionalNamespaces||{}};await this.isValidConnect(r),r.optionalNamespaces=yGe(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:s,requiredNamespaces:i,optionalNamespaces:o,sessionProperties:a,scopedProperties:c,relays:l,authentication:u,walletPay:d}=r,h=((A=u==null?void 0:u[0])==null?void 0:A.ttl)||Ui.wc_sessionPropose.req.ttl||V.FIVE_MINUTES;this.validateRequestExpiry(h);let f=s,g,p=!1;try{if(f){const I=this.client.core.pairing.pairings.get(f);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=I.active}}catch(I){throw this.client.logger.error(`connect() -> pairing.get(${f}) failed`),I}if(!f||!p){const{topic:I,uri:O}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});f=I,g=O}if(!f){const{message:I}=je("NO_MATCHING_KEY",`connect() pairing topic: ${f}`);throw new Error(I)}const m=await this.client.core.crypto.generateKeyPair(),w=Ss(h),C={requiredNamespaces:i,optionalNamespaces:o,relays:l??[{protocol:$pe}],proposer:{publicKey:m,metadata:this.client.metadata},expiryTimestamp:w,pairingTopic:f,...a&&{sessionProperties:a},...c&&{scopedProperties:c},id:Bn(),...(u||d)&&{requests:{authentication:u==null?void 0:u.map(I=>{const{domain:O,chains:N,nonce:T,uri:P,exp:_,nbf:y,type:$,statement:R,requestId:B,resources:k,signatureTypes:D}=I;return{domain:O,chains:N,nonce:T,type:$??"caip122",aud:P,version:"1",iat:new Date().toISOString(),exp:_,nbf:y,statement:R,requestId:B,resources:k,signatureTypes:D}}),walletPay:d}}},E=lr("session_connect",C.id),{reject:b,resolve:S,done:v}=q1(h,fee),x=({id:I})=>{I===C.id&&(this.client.events.off("proposal_expire",x),this.pendingSessions.delete(C.id),this.events.emit(E,{error:{message:fee,code:0}}))};return this.client.events.on("proposal_expire",x),this.events.once(E,({error:I,session:O})=>{this.client.events.off("proposal_expire",x),I?b(I):O&&S(O)}),await this.setProposal(C.id,C),await this.sendProposeSession({proposal:C,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:C.id}}}).catch(I=>{throw this.deleteProposal(C.id),I}),{uri:g,approval:v}},this.pair=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(n)}catch(r){throw this.client.logger.error("pair() failed"),r}},this.approve=async n=>{var x,A,I;const r=this.client.core.eventClient.createEvent({properties:{topic:(x=n==null?void 0:n.id)==null?void 0:x.toString(),trace:[Ju.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(O){throw r.setError(T1.no_internet_connection),O}try{await this.isValidProposalId(n==null?void 0:n.id)}catch(O){throw this.client.logger.error(`approve() -> proposal.get(${n==null?void 0:n.id}) failed`),r.setError(T1.proposal_not_found),O}try{await this.isValidApprove(n)}catch(O){throw this.client.logger.error("approve() -> isValidApprove() failed"),r.setError(T1.session_approve_namespace_validation_failure),O}const{id:s,relayProtocol:i,namespaces:o,sessionProperties:a,scopedProperties:c,sessionConfig:l,proposalRequestsResponses:u}=n,d=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:r.eventId});const{pairingTopic:h,proposer:f,requiredNamespaces:g,optionalNamespaces:p}=d;let m=(A=this.client.core.eventClient)==null?void 0:A.getEvent({topic:h});m||(m=(I=this.client.core.eventClient)==null?void 0:I.createEvent({type:Ju.session_approve_started,properties:{topic:h,trace:[Ju.session_approve_started,Ju.session_namespaces_validation_success]}}));const w=await this.client.core.crypto.generateKeyPair(),C=f.publicKey,E=await this.client.core.crypto.generateSharedKey(w,C),b={relay:{protocol:i??"irn"},namespaces:o,controller:{publicKey:w,metadata:this.client.metadata},expiry:Ss(a2),...a&&{sessionProperties:a},...c&&{scopedProperties:c},...l&&{sessionConfig:l},proposalRequestsResponses:u},S=Ur.relay;m.addTrace(Ju.subscribing_session_topic);try{await this.client.core.relayer.subscribe(E,{transportType:S,internal:{skipSubscribe:!0}})}catch(O){throw m.setError(T1.subscribe_session_topic_failure),O}m.addTrace(Ju.subscribe_session_topic_success);const v={...b,topic:E,requiredNamespaces:g,optionalNamespaces:p,pairingTopic:h,acknowledged:!1,self:b.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:w,transportType:Ur.relay,authentication:u==null?void 0:u.authentication,walletPayResult:u==null?void 0:u.walletPay};await this.client.session.set(E,v),m.addTrace(Ju.store_session);try{await this.sendApproveSession({sessionTopic:E,proposal:d,pairingProposalResponse:{relay:{protocol:i??"irn"},responderPublicKey:w},sessionSettleRequest:b,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:s,...this.getTVFApproveParams(v)}}}),m.addTrace(Ju.session_approve_publish_success)}catch(O){throw this.client.logger.error(O),this.client.session.delete(E,Yr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(E),O}return this.client.core.eventClient.deleteEvent({eventId:m.eventId}),await this.client.core.pairing.updateMetadata({topic:h,metadata:f.metadata}),await this.deleteProposal(s),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(E,Ss(a2)),{topic:E,acknowledged:()=>Promise.resolve(this.client.session.get(E))}},this.reject=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(n)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:s}=n;let i;try{i=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}i&&await this.sendError({id:r,topic:i,error:s,rpcOpts:Ui.wc_sessionPropose.reject}),await this.deleteProposal(r)},this.update=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(n)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:s}=n,{done:i,resolve:o,reject:a}=q1(V.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),c=Bn(),l=Ir().toString(),u=this.client.session.get(r).namespaces;return this.events.once(lr("session_update",c),({error:d})=>{d?a(d):o()}),await this.client.session.update(r,{namespaces:s}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:u}),a(d)}),{acknowledged:i}},this.extend=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(n)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:r}=n,s=Bn(),{done:i,resolve:o,reject:a}=q1(V.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return this.events.once(lr("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(r,Ss(a2)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:i}},this.request=async n=>{this.isInitialized();try{await this.isValidRequest(n)}catch(m){throw this.client.logger.error("request() -> isValidRequest() failed"),m}const{chainId:r,request:s,topic:i,expiry:o=Ui.wc_sessionRequest.req.ttl}=n,a=this.client.session.get(i);(a==null?void 0:a.transportType)===Ur.relay&&await this.confirmOnlineStateOrThrow();const c=Bn(),l=Ir().toString(),{done:u,resolve:d,reject:h}=q1(o,"Request expired. Please try again.");this.events.once(lr("session_request",c),({error:m,result:w})=>{m?h(m):d(w)});const f="wc_sessionRequest",g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(g)return await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:{request:{...s,expiryTimestamp:Ss(o)},chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(m=>h(m)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),await u();const p={request:{...s,expiryTimestamp:Ss(o)},chainId:r};return await Promise.all([new Promise(async m=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:p,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(c,p)}).catch(w=>h(w)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),m()}),new Promise(async m=>{var w;if(!((w=a.sessionConfig)!=null&&w.disableDeepLink)){const C=await $He(this.client.core.storage,hee);await vHe({id:c,topic:i,wcDeepLink:C})}m()}),u()]).then(m=>m[2])},this.respond=async n=>{var l,u;this.isInitialized();const r=this.client.core.eventClient.createEvent({properties:{topic:(n==null?void 0:n.topic)||((u=(l=n==null?void 0:n.response)==null?void 0:l.id)==null?void 0:u.toString()),trace:[Ju.session_request_response_started]}});try{await this.isValidRespond(n)}catch(d){throw r.addTrace(d==null?void 0:d.message),r.setError(T1.session_request_response_validation_failure),d}r.addTrace(Ju.session_request_response_validation_success);const{topic:s,response:i}=n,{id:o}=i,a=this.client.session.get(s);a.transportType===Ur.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);try{r.addTrace(Ju.session_request_response_publish_started),wn(i)?await this.sendResult({id:o,topic:s,result:i.result,throwOnFailedPublish:!0,appLink:c}):nn(i)&&await this.sendError({id:o,topic:s,error:i.error,appLink:c}),this.cleanupAfterResponse(n)}catch(d){throw r.addTrace(d==null?void 0:d.message),r.setError(T1.session_request_response_publish_failure),d}},this.ping=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(n)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:r}=n;if(this.client.session.keys.includes(r)){const s=Bn(),i=Ir().toString(),{done:o,resolve:a,reject:c}=q1(V.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");this.events.once(lr("session_ping",s),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:i}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))},this.emit=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(n);const{topic:r,event:s,chainId:i}=n,o=Ir().toString(),a=Bn();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:s,chainId:i},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})},this.disconnect=async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(n);const{topic:r}=n;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:Yr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:s}=je("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(s)}},this.find=n=>(this.isInitialized(),this.client.session.getAll().filter(r=>bGe(r,n))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(n,r)=>{var B;this.isInitialized(),this.isValidAuthenticate(n);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((B=this.client.metadata.redirect)==null?void 0:B.linkMode),i=s?Ur.link_mode:Ur.relay;i===Ur.relay&&await this.confirmOnlineStateOrThrow();const{chains:o,statement:a="",uri:c,domain:l,nonce:u,type:d,exp:h,nbf:f,methods:g=[],expiry:p}=n,m=[...n.resources||[]],{topic:w,uri:C}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:i});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:C}});const E=await this.client.core.crypto.generateKeyPair(),b=vS(E);if(await Promise.all([this.client.auth.authKeys.set(CS,{responseTopic:b,publicKey:E}),this.client.auth.pairingTopics.set(b,{topic:b,pairingTopic:w})]),await this.client.core.relayer.subscribe(b,{transportType:i}),this.client.logger.info(`sending request to new pairing topic: ${w}`),g.length>0){const{namespace:k}=e0(o[0]);let D=RVe(k,"request",g);bS(m)&&(D=DVe(D,m.pop())),m.push(D)}const S=p&&p>Ui.wc_sessionAuthenticate.req.ttl?p:Ui.wc_sessionAuthenticate.req.ttl,v={authPayload:{type:d??"caip122",chains:o,statement:a,aud:c,domain:l,version:"1",nonce:u,iat:new Date().toISOString(),exp:h,nbf:f,resources:m},requester:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:Ss(S)},x={eip155:{chains:o,methods:[...new Set(["personal_sign",...g])],events:["chainChanged","accountsChanged"]}},A={requiredNamespaces:{},optionalNamespaces:x,relays:[{protocol:"irn"}],pairingTopic:w,proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:Ss(Ui.wc_sessionPropose.req.ttl),id:Bn()},{done:I,resolve:O,reject:N}=q1(S,"Request expired"),T=Bn(),P=lr("session_connect",A.id),_=lr("session_request",T),y=async({error:k,session:D})=>{this.events.off(_,$),k?N(k):D&&O({session:D})},$=async k=>{var Z,ee,ie;if(await this.deletePendingAuthRequest(T,{message:"fulfilled",code:0}),k.error){const X=Yr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return k.error.code===X.code?void 0:(this.events.off(P,y),N(k.error.message))}await this.deleteProposal(A.id),this.events.off(P,y);const{cacaos:D,responder:U}=k.result,F=[],K=[];for(const X of D){await _Q({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),N(Yr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:le}=X,_e=bS(le.resources),Ne=[jL(le.iss)],be=g9(le.iss);if(_e){const Me=NQ(_e),Ct=TQ(_e);F.push(...Me),Ne.push(...Ct)}for(const Me of Ne)K.push(`${Me}:${be}`)}const q=await this.client.core.crypto.generateSharedKey(E,U.publicKey);let H;F.length>0&&(H={topic:q,acknowledged:!0,self:{publicKey:E,metadata:this.client.metadata},peer:U,controller:U.publicKey,expiry:Ss(a2),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:XQ([...new Set(F)],[...new Set(K)]),transportType:i},await this.client.core.relayer.subscribe(q,{transportType:i}),await this.client.session.set(q,H),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:U.metadata}),H=this.client.session.get(q)),(Z=this.client.metadata.redirect)!=null&&Z.linkMode&&((ee=U.metadata.redirect)!=null&&ee.linkMode)&&((ie=U.metadata.redirect)!=null&&ie.universal)&&r&&(this.client.core.addLinkModeSupportedApp(U.metadata.redirect.universal),this.client.session.update(q,{transportType:Ur.link_mode})),O({auths:D,session:H})};this.events.once(P,y),this.events.once(_,$);let R;try{if(s){const k=_n("wc_sessionAuthenticate",v,T);this.client.core.history.set(w,k);const D=await this.client.core.crypto.encode("",k,{type:MC,encoding:tm});R=Yx(r,w,D)}else await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:v,expiry:n.expiry,throwOnFailedPublish:!0,clientRpcId:T}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:A,expiry:Ui.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:A.id})])}catch(k){throw this.events.off(P,y),this.events.off(_,$),k}return await this.setProposal(A.id,A),await this.setAuthRequest(T,{request:{...v,verifyContext:{}},pairingTopic:w,transportType:i}),{uri:R??C,response:I}},this.approveSessionAuthenticate=async n=>{const{id:r,auths:s}=n,i=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[P1.authenticated_session_approve_started]}});try{this.isInitialized()}catch(m){throw i.setError(q3.no_internet_connection),m}const o=this.getPendingAuthRequest(r);if(!o)throw i.setError(q3.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const a=o.transportType||Ur.relay;a===Ur.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),u=vS(c),d={type:t0,receiverPublicKey:c,senderPublicKey:l},h=[],f=[];for(const m of s){if(!await _Q({cacao:m,projectId:this.client.core.projectId})){i.setError(q3.invalid_cacao);const S=Yr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:u,error:S,encodeOpts:d}),new Error(S.message)}i.addTrace(P1.cacaos_verified);const{p:w}=m,C=bS(w.resources),E=[jL(w.iss)],b=g9(w.iss);if(C){const S=NQ(C),v=TQ(C);h.push(...S),E.push(...v)}for(const S of E)f.push(`${S}:${b}`)}const g=await this.client.core.crypto.generateSharedKey(l,c);i.addTrace(P1.create_authenticated_session_topic);let p;if((h==null?void 0:h.length)>0){p={topic:g,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:Ss(a2),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:XQ([...new Set(h)],[...new Set(f)]),transportType:a},i.addTrace(P1.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(g,{transportType:a})}catch(m){throw i.setError(q3.subscribe_authenticated_session_topic_failure),m}i.addTrace(P1.subscribe_authenticated_session_topic_success),await this.client.session.set(g,p),i.addTrace(P1.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}i.addTrace(P1.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:r,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(m){throw i.setError(q3.authenticated_session_approve_publish_failure),m}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:p}},this.rejectSessionAuthenticate=async n=>{this.isInitialized();const{id:r,reason:s}=n,i=this.getPendingAuthRequest(r);if(!i)throw new Error(`Could not find pending auth request with id ${r}`);i.transportType===Ur.relay&&await this.confirmOnlineStateOrThrow();const o=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=vS(o),l={type:t0,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:r,topic:c,error:s,encodeOpts:l,rpcOpts:Ui.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)},this.formatAuthMessage=n=>{this.isInitialized();const{request:r,iss:s}=n;return Dfe(r,s)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const n=this.relayMessageCache.shift();n&&await this.onRelayMessage(n)}catch(n){this.client.logger.error(n)}},50)},this.cleanupDuplicatePairings=async n=>{if(n.pairingTopic)try{const r=this.client.core.pairing.pairings.get(n.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(i=>{var o,a;return((o=i.peerMetadata)==null?void 0:o.url)&&((a=i.peerMetadata)==null?void 0:a.url)===n.peer.metadata.url&&i.topic&&i.topic!==r.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(i=>this.client.core.pairing.disconnect({topic:i.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}},this.deleteSession=async n=>{var c;const{topic:r,expirerHasDeleted:s=!1,emitEvent:i=!0,id:o=0}=n,{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,Yr("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),s||this.client.core.expirer.del(r),this.client.core.storage.removeItem(hee).catch(l=>this.client.logger.warn(l)),r===((c=this.sessionRequestQueue.queue[0])==null?void 0:c.topic)&&(this.sessionRequestQueue.state=mh.idle),await Promise.all(this.getPendingSessionRequests().filter(l=>l.topic===r).map(l=>this.deletePendingSessionRequest(l.id,Yr("USER_DISCONNECTED")))),i&&this.client.events.emit("session_delete",{id:o,topic:r})},this.deleteProposal=async(n,r)=>{var s;if(r)try{const i=this.client.proposal.get(n);(s=this.client.core.eventClient.getEvent({topic:i.pairingTopic}))==null||s.setError(T1.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(n,Yr("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"proposal")},this.deletePendingSessionRequest=async(n,r,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==n),s&&(this.sessionRequestQueue.state=mh.idle,this.client.events.emit("session_request_expire",{id:n}))},this.deletePendingAuthRequest=async(n,r,s=!1)=>{await Promise.all([this.client.auth.requests.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)])},this.setExpiry=async(n,r)=>{this.client.session.keys.includes(n)&&(this.client.core.expirer.set(n,r),await this.client.session.update(n,{expiry:r}))},this.setProposal=async(n,r)=>{this.client.core.expirer.set(n,Ss(Ui.wc_sessionPropose.req.ttl)),await this.client.proposal.set(n,r)},this.setAuthRequest=async(n,r)=>{const{request:s,pairingTopic:i,transportType:o=Ur.relay}=r;this.client.core.expirer.set(n,s.expiryTimestamp),await this.client.auth.requests.set(n,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:n,pairingTopic:i,verifyContext:s.verifyContext,transportType:o})},this.setPendingSessionRequest=async n=>{const{id:r,topic:s,params:i,verifyContext:o}=n,a=i.request.expiryTimestamp||Ss(Ui.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,a),await this.client.pendingRequest.set(r,{id:r,topic:s,params:i,verifyContext:o})},this.sendRequest=async n=>{const{topic:r,method:s,params:i,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:u,tvf:d,publishOpts:h={}}=n,f=_n(s,i,c);let g;const p=!!u;try{const C=p?tm:Za;g=await this.client.core.crypto.encode(r,f,{encoding:C})}catch(C){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),C}let m;if(PJe.includes(s)){const C=cu(JSON.stringify(f)),E=cu(g);m=await this.client.core.verify.register({id:E,decryptedId:C})}const w={...Ui[s].req,...h};if(w.attestation=m,o&&(w.ttl=o),a&&(w.id=a),this.client.core.history.set(r,f),p){const C=Yx(u,r,g);await globalThis.Linking.openURL(C,this.client.name)}else w.tvf={...d,correlationId:f.id},l?(w.internal={...w.internal,throwOnFailedPublish:!0},await this.client.core.relayer.publish(r,g,w)):this.client.core.relayer.publish(r,g,w).catch(C=>this.client.logger.error(C));return f.id},this.sendProposeSession=async n=>{const{proposal:r,publishOpts:s}=n,i=_n("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,i);const o=await this.client.core.crypto.encode(r.pairingTopic,i,{encoding:Za}),a=cu(JSON.stringify(i)),c=cu(o),l=await this.client.core.verify.register({id:c,decryptedId:a});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:{...s,publishMethod:"wc_proposeSession",attestation:l}})},this.sendApproveSession=async n=>{const{sessionTopic:r,pairingProposalResponse:s,proposal:i,sessionSettleRequest:o,publishOpts:a}=n,c=Pi(i.id,s),l=await this.client.core.crypto.encode(i.pairingTopic,c,{encoding:Za}),u=_n("wc_sessionSettle",o,a==null?void 0:a.id),d=await this.client.core.crypto.encode(r,u,{encoding:Za});this.client.core.history.set(r,u),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:i.pairingTopic,sessionProposalResponse:l,sessionSettlementRequest:d},opts:{...a,publishMethod:"wc_approveSession"}})},this.sendResult=async n=>{const{id:r,topic:s,result:i,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=n,l=Pi(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const g=d?tm:Za;u=await this.client.core.crypto.encode(s,l,{...a||{},encoding:g})}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),g}let h,f;try{h=await this.client.core.history.get(s,r);const g=h.request;try{f=this.getTVFParams(r,g.params,i)}catch(p){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${p==null?void 0:p.message}`)}}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${r}) failed`),g}if(d){const g=Yx(c,s,u);await globalThis.Linking.openURL(g,this.client.name)}else{const g=h.request.method,p=Ui[g].res;p.tvf={...f,correlationId:r},o?(p.internal={...p.internal,throwOnFailedPublish:!0},await this.client.core.relayer.publish(s,u,p)):this.client.core.relayer.publish(s,u,p).catch(m=>this.client.logger.error(m))}await this.client.core.history.resolve(l)},this.sendError=async n=>{const{id:r,topic:s,error:i,encodeOpts:o,rpcOpts:a,appLink:c}=n,l=yf(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const f=d?tm:Za;u=await this.client.core.crypto.encode(s,l,{...o||{},encoding:f})}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),f}let h;try{h=await this.client.core.history.get(s,r)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${s}, ${r}) failed`),f}if(d){const f=Yx(c,s,u);await globalThis.Linking.openURL(f,this.client.name)}else{const f=h.request.method,g=a||Ui[f].res;this.client.core.relayer.publish(s,u,g)}await this.client.core.history.resolve(l)},this.cleanup=async()=>{const n=[],r=[];this.client.session.getAll().forEach(s=>{let i=!1;kh(s.expiry)&&(i=!0),this.client.core.crypto.keychain.has(s.topic)||(i=!0),i&&n.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{kh(s.expiryTimestamp)&&r.push(s.id)}),await Promise.all([...n.map(s=>this.deleteSession({topic:s})),...r.map(s=>this.deleteProposal(s))])},this.onProviderMessageEvent=async n=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(n):await this.onRelayMessage(n)},this.onRelayEventRequest=async n=>{this.requestQueue.queue.push(n),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===mh.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=mh.active;const n=this.requestQueue.queue.shift();if(n)try{await this.processRequest(n)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=mh.idle},this.processRequest=async n=>{const{topic:r,payload:s,attestation:i,transportType:o,encryptedId:a}=n,c=s.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:s,attestation:i,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,s);case"wc_sessionPing":return await this.onSessionPingRequest(r,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}},this.onRelayEventResponse=async n=>{const{topic:r,payload:s,transportType:i}=n,o=(await this.client.core.history.get(r,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,s,i);case"wc_sessionSettle":return this.onSessionSettleResponse(r,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,s);case"wc_sessionExtend":return this.onSessionExtendResponse(r,s);case"wc_sessionPing":return this.onSessionPingResponse(r,s);case"wc_sessionRequest":return this.onSessionRequestResponse(r,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=n=>{const{topic:r}=n,{message:s}=je("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)},this.shouldIgnorePairingRequest=n=>{const{topic:r,requestMethod:s}=n,i=this.expectedPairingMethodMap.get(r);return!i||i.includes(s)?!1:!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async n=>{const{topic:r,payload:s,attestation:i,encryptedId:o}=n,{params:a,id:c}=s;try{const l=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(dp.proposal_listener_not_found)),this.isValidConnect({...s.params});const u=a.expiryTimestamp||Ss(Ui.wc_sessionPropose.req.ttl),d={id:c,pairingTopic:r,expiryTimestamp:u,attestation:i,encryptedId:o,...a};await this.setProposal(c,d);const h=await this.getVerifyContext({attestationId:i,hash:cu(JSON.stringify(s)),encryptedId:o,metadata:d.proposer.metadata});l==null||l.addTrace(Ah.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:d,verifyContext:h})}catch(l){await this.sendError({id:c,topic:r,error:l,rpcOpts:Ui.wc_sessionPropose.autoReject}),this.client.logger.error(l)}},this.onSessionProposeResponse=async(n,r,s)=>{const{id:i}=r;if(wn(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const u=await this.client.core.crypto.generateSharedKey(c,l);this.pendingSessions.set(i,{sessionTopic:u,pairingTopic:n,proposalId:i,publicKey:c});const d=await this.client.core.relayer.subscribe(u,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:n})}else if(nn(r)){await this.deleteProposal(i);const o=lr("session_connect",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}},this.onSessionSettleRequest=async(n,r)=>{const{id:s,params:i}=r;try{this.isValidSessionSettleRequest(i);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h,proposalRequestsResponses:f}=r.params,g=[...this.pendingSessions.values()].find(w=>w.sessionTopic===n);if(!g)return this.client.logger.error(`Pending session not found for topic ${n}`);const p=this.client.proposal.get(g.proposalId),m={topic:n,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:g.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,controller:a.publicKey,self:{publicKey:g.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata},...u&&{sessionProperties:u},...d&&{scopedProperties:d},...h&&{sessionConfig:h},transportType:Ur.relay,authentication:f==null?void 0:f.authentication,walletPayResult:f==null?void 0:f.walletPay};await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:g.pairingTopic,metadata:m.peer.metadata}),this.pendingSessions.delete(g.proposalId),this.deleteProposal(g.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:r.id,topic:n,throwOnFailedPublish:!0,result:!0}),this.client.events.emit("session_connect",{session:m}),this.events.emit(lr("session_connect",g.proposalId),{session:m})}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(n,r)=>{const{id:s}=r;wn(r)?(await this.client.session.update(n,{acknowledged:!0}),this.events.emit(lr("session_approve",s),{})):nn(r)&&(await this.client.session.delete(n,Yr("USER_DISCONNECTED")),this.events.emit(lr("session_approve",s),{error:r.error}))},this.onSessionUpdateRequest=async(n,r)=>{const{params:s,id:i}=r;try{const o=`${n}_session_update`,a=F3.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:n,error:Yr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate({topic:n,...s});try{F3.set(o,i),await this.client.session.update(n,{namespaces:s.namespaces}),await this.sendResult({id:i,topic:n,result:!0})}catch(c){throw F3.delete(o),c}this.client.events.emit("session_update",{id:i,topic:n,params:s})}catch(o){await this.sendError({id:i,topic:n,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(n,r)=>r.toString().slice(0,-3)<n.toString().slice(0,-3),this.onSessionUpdateResponse=(n,r)=>{const{id:s}=r,i=lr("session_update",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(lr("session_update",s),{}):nn(r)&&this.events.emit(lr("session_update",s),{error:r.error})},this.onSessionExtendRequest=async(n,r)=>{const{id:s}=r;try{this.isValidExtend({topic:n}),await this.setExpiry(n,Ss(a2)),await this.sendResult({id:s,topic:n,result:!0}),this.client.events.emit("session_extend",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}},this.onSessionExtendResponse=(n,r)=>{const{id:s}=r,i=lr("session_extend",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(lr("session_extend",s),{}):nn(r)&&this.events.emit(lr("session_extend",s),{error:r.error})},this.onSessionPingRequest=async(n,r)=>{const{id:s}=r;try{this.isValidPing({topic:n}),await this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}},this.onSessionPingResponse=(n,r)=>{const{id:s}=r,i=lr("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners 2176`);wn(r)?this.events.emit(lr("session_ping",s),{}):nn(r)&&this.events.emit(lr("session_ping",s),{error:r.error})},500)},this.onSessionDeleteRequest=async(n,r)=>{const{id:s}=r;try{await this.isValidDisconnect({topic:n,reason:r.params}),this.cleanupPendingSentRequestsForTopic({topic:n,error:Yr("USER_DISCONNECTED")}),await this.deleteSession({topic:n,id:s})}catch(i){this.client.logger.error(i)}},this.onSessionRequest=async n=>{var u,d,h;const{topic:r,payload:s,attestation:i,encryptedId:o,transportType:a}=n,{id:c,params:l}=s;try{await this.isValidRequest({topic:r,...l});const f=this.client.session.get(r),g=await this.getVerifyContext({attestationId:i,hash:cu(JSON.stringify(_n("wc_sessionRequest",l,c))),encryptedId:o,metadata:f.peer.metadata,transportType:a}),p={id:c,topic:r,params:l,verifyContext:g};await this.setPendingSessionRequest(p),a===Ur.link_mode&&((u=f.peer.metadata.redirect)!=null&&u.universal)&&this.client.core.addLinkModeSupportedApp((d=f.peer.metadata.redirect)==null?void 0:d.universal),(h=this.client.signConfig)!=null&&h.disableRequestQueue?this.emitSessionRequest(p):(this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue())}catch(f){await this.sendError({id:c,topic:r,error:f}),this.client.logger.error(f)}},this.onSessionRequestResponse=(n,r)=>{const{id:s}=r,i=lr("session_request",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(lr("session_request",s),{result:r.result}):nn(r)&&this.events.emit(lr("session_request",s),{error:r.error})},this.onSessionEventRequest=async(n,r)=>{const{id:s,params:i}=r;try{const o=`${n}_session_event_${i.event.name}`,a=F3.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit({topic:n,...i}),this.client.events.emit("session_event",{id:s,topic:n,params:i}),F3.set(o,s)}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(n,r)=>{const{id:s}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:n,payload:r}),wn(r)?this.events.emit(lr("session_request",s),{result:r.result}):nn(r)&&this.events.emit(lr("session_request",s),{error:r.error})},this.onSessionAuthenticateRequest=async n=>{var c;const{topic:r,payload:s,attestation:i,encryptedId:o,transportType:a}=n;try{const{requester:l,authPayload:u,expiryTimestamp:d}=s.params,h=await this.getVerifyContext({attestationId:i,hash:cu(JSON.stringify(s)),encryptedId:o,metadata:l.metadata,transportType:a}),f={requester:l,pairingTopic:r,id:s.id,authPayload:u,verifyContext:h,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:f,pairingTopic:r,transportType:a}),a===Ur.link_mode&&((c=l.metadata.redirect)!=null&&c.universal)&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:s.params,id:s.id,verifyContext:h})}catch(l){this.client.logger.error(l);const u=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(s.params.requester.metadata,a),f={type:t0,receiverPublicKey:u,senderPublicKey:d};await this.sendError({id:s.id,topic:r,error:l,encodeOpts:f,rpcOpts:Ui.wc_sessionAuthenticate.autoReject,appLink:h})}},this.addSessionRequestToSessionRequestQueue=n=>{this.sessionRequestQueue.queue.push(n)},this.cleanupAfterResponse=n=>{this.deletePendingSessionRequest(n.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=mh.idle,this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:n,error:r})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(i=>i.topic===n&&i.request.method==="wc_sessionRequest").forEach(i=>{this.events.emit(lr("session_request",i.request.id),{error:r})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===mh.active){this.client.logger.info("session request queue is already active.");return}const n=this.sessionRequestQueue.queue[0];if(!n){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(n)}catch(r){this.client.logger.error(r)}},this.emitSessionRequest=n=>{if(this.emittedSessionRequests.has(n.id)){this.client.logger.warn({id:n.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${n.id}`);return}this.sessionRequestQueue.state=mh.active,this.emittedSessionRequests.add(n.id),this.client.events.emit("session_request",n)},this.onPairingCreated=n=>{if(n.methods&&this.expectedPairingMethodMap.set(n.topic,n.methods),n.active)return;const r=this.client.proposal.getAll().find(s=>s.pairingTopic===n.topic);r&&this.onSessionProposeRequest({topic:n.topic,payload:_n("wc_sessionPropose",{...r,requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties},r.id),attestation:r.attestation,encryptedId:r.encryptedId})},this.isValidConnect=async n=>{if(!Fa(n)){const{message:l}=je("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(n)}`);throw new Error(l)}const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:i,sessionProperties:o,scopedProperties:a,relays:c}=n;if(Qs(r)||await this.isValidPairingTopic(r),!PGe(c)){const{message:l}=je("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(l)}if(s&&!Qs(s)&&Hh(s)!==0){const l="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(l):this.client.logger.warn(l),this.validateNamespaces(s,"requiredNamespaces")}if(i&&!Qs(i)&&Hh(i)!==0&&this.validateNamespaces(i,"optionalNamespaces"),o&&!Qs(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!Qs(a)){this.validateSessionProps(a,"scopedProperties");const l=Object.keys(s||{}).concat(Object.keys(i||{}));if(!Object.keys(a).every(u=>l.includes(u.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(l)}`)}},this.validateNamespaces=(n,r)=>{const s=TGe(n,"connect()",r);if(s)throw new Error(s.message)},this.isValidApprove=async n=>{if(!Fa(n))throw new Error(je("MISSING_OR_INVALID",`approve() params: ${n}`).message);const{id:r,namespaces:s,relayProtocol:i,sessionProperties:o,scopedProperties:a}=n;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const c=this.client.proposal.get(r),l=bk(s,"approve()");if(l)throw new Error(l.message);const u=tee(c.requiredNamespaces,s,"approve()");if(u)throw new Error(u.message);if(!Ns(i,!0)){const{message:d}=je("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(d)}if(o&&!Qs(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!Qs(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(s));if(!Object.keys(a).every(h=>d.has(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}},this.isValidReject=async n=>{if(!Fa(n)){const{message:i}=je("MISSING_OR_INVALID",`reject() params: ${n}`);throw new Error(i)}const{id:r,reason:s}=n;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!kGe(s)){const{message:i}=je("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(i)}},this.isValidSessionSettleRequest=n=>{if(!Fa(n)){const{message:l}=je("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${n}`);throw new Error(l)}const{relay:r,controller:s,namespaces:i,expiry:o}=n;if(!vpe(r)){const{message:l}=je("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=xGe(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=bk(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(kh(o)){const{message:l}=je("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async n=>{if(!Fa(n)){const{message:c}=je("MISSING_OR_INVALID",`update() params: ${n}`);throw new Error(c)}const{topic:r,namespaces:s}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const i=this.client.session.get(r),o=bk(s,"update()");if(o)throw new Error(o.message);const a=tee(i.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async n=>{if(!Fa(n)){const{message:s}=je("MISSING_OR_INVALID",`extend() params: ${n}`);throw new Error(s)}const{topic:r}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)},this.isValidRequest=async n=>{if(!Fa(n)){const{message:c}=je("MISSING_OR_INVALID",`request() params: ${n}`);throw new Error(c)}const{topic:r,request:s,chainId:i,expiry:o}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:a}=this.client.session.get(r);if(!eee(a,i)){const{message:c}=je("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(c)}if(!RGe(s)){const{message:c}=je("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!UGe(a,i,s.method)){const{message:c}=je("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}this.validateRequestExpiry(o)},this.isValidRespond=async n=>{var o;if(!Fa(n)){const{message:a}=je("MISSING_OR_INVALID",`respond() params: ${n}`);throw new Error(a)}const{topic:r,response:s}=n;try{await this.isValidSessionTopic(r)}catch(a){throw(o=n==null?void 0:n.response)!=null&&o.id&&this.cleanupAfterResponse(n),a}if(!BGe(s)){const{message:a}=je("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}const i=this.client.pendingRequest.get(s.id);if(i.topic!==r){const{message:a}=je("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${s.id}, expected topic: ${i.topic}, received topic: ${r}`);throw new Error(a)}},this.isValidPing=async n=>{if(!Fa(n)){const{message:s}=je("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)},this.isValidEmit=async n=>{if(!Fa(n)){const{message:a}=je("MISSING_OR_INVALID",`emit() params: ${n}`);throw new Error(a)}const{topic:r,event:s,chainId:i}=n;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!eee(o,i)){const{message:a}=je("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(a)}if(!DGe(s)){const{message:a}=je("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!LGe(o,i,s.name)){const{message:a}=je("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidDisconnect=async n=>{if(!Fa(n)){const{message:s}=je("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)},this.isValidAuthenticate=n=>{const{chains:r,uri:s,domain:i,nonce:o}=n;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!Ns(s,!1))throw new Error("uri is required parameter");if(!Ns(i,!1))throw new Error("domain is required parameter");if(!Ns(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(c=>e0(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=e0(r[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async n=>{const{attestationId:r,hash:s,encryptedId:i,metadata:o,transportType:a}=n,c={verified:{verifyUrl:o.verifyUrl||a8,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Ur.link_mode){const u=this.getAppLinkIfEnabled(o,a);return c.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:r,hash:s,encryptedId:i,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c},this.validateSessionProps=(n,r)=>{Object.values(n).forEach((s,i)=>{if(s==null){const{message:o}=je("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${s} for key ${Object.keys(n)[i]}`);throw new Error(o)}})},this.getPendingAuthRequest=n=>{const r=this.client.auth.requests.get(n);return typeof r=="object"?r:void 0},this.addToRecentlyDeleted=(n,r)=>{if(this.recentlyDeletedMap.set(n,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const i=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=i)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=n=>{const r=this.recentlyDeletedMap.get(n);if(r){const{message:s}=je("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${n}`);throw new Error(s)}},this.isLinkModeEnabled=(n,r)=>{var s,i,o,a,c,l,u,d,h;return!n||r!==Ur.link_mode?!1:((i=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:i.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((u=n==null?void 0:n.redirect)==null?void 0:u.universal)!==void 0&&((d=n==null?void 0:n.redirect)==null?void 0:d.universal)!==""&&((h=n==null?void 0:n.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(n.redirect.universal)&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"},this.getAppLinkIfEnabled=(n,r)=>{var s;return this.isLinkModeEnabled(n,r)?(s=n==null?void 0:n.redirect)==null?void 0:s.universal:void 0},this.handleLinkModeMessage=({url:n})=>{if(!n||!n.includes("wc_ev")||!n.includes("topic"))return;const r=yQ(n,"topic")||"",s=decodeURIComponent(yQ(n,"wc_ev")||""),i=this.client.session.keys.includes(r);i&&this.client.session.update(r,{transportType:Ur.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:s,sessionExists:i})},this.registerLinkModeListeners=async()=>{var n;if(pW()||d1()&&((n=this.client.metadata.redirect)!=null&&n.linkMode)){const r=globalThis==null?void 0:globalThis.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await r.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}},this.getTVFApproveParams=n=>{try{const r=ype(n.namespaces),s=fGe(n.namespaces),i=pGe(n.namespaces),o=n.sessionProperties,a=n.scopedProperties;return{approvedChains:r,approvedMethods:s,approvedEvents:i,sessionProperties:o,scopedProperties:a}}catch(r){return this.client.logger.warn(r,"Error getting TVF approve params"),{}}},this.getTVFParams=(n,r,s)=>{var o,a,c;if(!((o=r.request)!=null&&o.method))return{};const i={correlationId:n,rpcMethods:[r.request.method],chainId:r.chainId};try{const l=this.extractTxHashesFromResult(r.request,s);i.txHashes=l,i.contractAddresses=this.isValidContractData(r.request.params)?[(c=(a=r.request.params)==null?void 0:a[0])==null?void 0:c.to]:[]}catch(l){this.client.logger.warn(l,"Error getting TVF params")}return i},this.isValidContractData=n=>{var r;if(!n)return!1;try{const s=(n==null?void 0:n.data)||((r=n==null?void 0:n[0])==null?void 0:r.data);if(!s.startsWith("0x"))return!1;const i=s.slice(2);return/^[0-9a-fA-F]*$/.test(i)?i.length%2===0:!1}catch{}return!1},this.extractTxHashesFromResult=(n,r)=>{var s;try{if(!r)return[];const i=n.method,o=NJe[i];if(i==="sui_signTransaction")return[CVe(r.transactionBytes)];if(i==="near_signTransaction")return[SQ(r)];if(i==="near_signTransactions")return r.map(c=>SQ(c));if(i==="xrpl_signTransactionFor"||i==="xrpl_signTransaction")return[(s=r.tx_json)==null?void 0:s.hash];if(i==="polkadot_signTransaction")return[nZe({transaction:n.params.transactionPayload,signature:r.signature})];if(i==="algo_signTxn")return n0(r)?r.map(c=>AQ(c)):[AQ(r)];if(i==="cosmos_signDirect")return[xVe(r)];if(i==="wallet_sendCalls")return IVe(r);if(typeof r=="string")return[r];const a=r[o.key];if(n0(a))return i==="solana_signAllTransactions"?a.map(c=>EVe(c)):a;if(typeof a=="string")return[a]}catch(i){this.client.logger.warn(i,"Error extracting tx hashes from result")}return[]}}async processPendingMessageEvents(){try{const t=this.client.session.keys,n=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,s]of Object.entries(n))for(const i of s)try{await this.onProviderMessageEvent({topic:r,message:i,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${i}`)}}catch(t){this.client.logger.warn(t,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){const{message:t}=je("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(fs.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:n,message:r,attestation:s,transportType:i}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(CS)?this.client.auth.authKeys.get(CS):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(n,r,{receiverPublicKey:o,encoding:i===Ur.link_mode?tm:Za});Du(a)?(this.client.core.history.set(n,a),await this.onRelayEventRequest({topic:n,payload:a,attestation:s,transportType:i,encryptedId:cu(r)})):Sl(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:n,payload:a,transportType:i}),this.client.core.history.delete(n,a.id)):(this.client.logger.error(`onRelayMessage() -> unknown payload: ${JSON.stringify(a)}`),await this.onRelayEventUnknownPayload({topic:n,payload:a,transportType:i})),await this.client.core.relayer.messages.ack(n,r)}catch(a){this.client.logger.error(`onRelayMessage() -> failed to process an inbound message: ${r}`),this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(Ql.expired,async t=>{const{topic:n,id:r}=bfe(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,je("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,je("EXPIRED"),!0);n?this.client.session.keys.includes(n)&&(await this.deleteSession({topic:n,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:n})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(X1.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(X1.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!Ns(t,!1)){const{message:n}=je("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(n)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:n}=je("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(n)}if(kh(this.client.core.pairing.pairings.get(t).expiry)){const{message:n}=je("EXPIRED",`pairing topic: ${t}`);throw new Error(n)}}async isValidSessionTopic(t){if(!Ns(t,!1)){const{message:n}=je("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(n)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:n}=je("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(n)}if(kh(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:n}=je("EXPIRED",`session topic: ${t}`);throw new Error(n)}if(!this.client.core.crypto.keychain.has(t)){const{message:n}=je("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(n)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(Ns(t,!1)){const{message:n}=je("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(n)}else{const{message:n}=je("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(n)}}async isValidProposalId(t){if(!OGe(t)){const{message:n}=je("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(n)}if(!this.client.proposal.keys.includes(t)){const{message:n}=je("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(n)}if(kh(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:n}=je("EXPIRED",`proposal id: ${t}`);throw new Error(n)}}validateRequestExpiry(t){if(t&&!FGe(t,xk)){const{message:n}=je("MISSING_OR_INVALID",`request() expiry: ${t}. Expiry must be a number (in seconds) between ${xk.min} and ${xk.max}`);throw new Error(n)}}},LJe=class extends ob{constructor(t,n){super(t,n,SJe,SW),this.core=t,this.logger=n}},MJe=class extends ob{constructor(t,n){super(t,n,AJe,SW),this.core=t,this.logger=n}},jJe=class extends ob{constructor(t,n){super(t,n,TJe,SW,r=>r.id),this.core=t,this.logger=n}},FJe=class extends ob{constructor(t,n){super(t,n,RJe,D7,()=>CS),this.core=t,this.logger=n}},zJe=class extends ob{constructor(t,n){super(t,n,BJe,D7),this.core=t,this.logger=n}},qJe=class extends ob{constructor(t,n){super(t,n,DJe,D7,r=>r.id),this.core=t,this.logger=n}},WJe=class{constructor(t,n){this.core=t,this.logger=n,this.authKeys=new FJe(this.core,this.logger),this.pairingTopics=new zJe(this.core,this.logger),this.requests=new qJe(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}},HJe=class Rpe extends iqe{constructor(t){super(t),this.protocol=Ppe,this.version=Ope,this.name=$k.name,this.events=new Dn.EventEmitter,this.on=(r,s)=>this.events.on(r,s),this.once=(r,s)=>this.events.once(r,s),this.off=(r,s)=>this.events.off(r,s),this.removeListener=(r,s)=>this.events.removeListener(r,s),this.removeAllListeners=r=>this.events.removeAllListeners(r),this.connect=async r=>{try{return await this.engine.connect(r)}catch(s){throw this.logger.error(s.message),s}},this.pair=async r=>{try{return await this.engine.pair(r)}catch(s){throw this.logger.error(s.message),s}},this.approve=async r=>{try{return await this.engine.approve(r)}catch(s){throw this.logger.error(s.message),s}},this.reject=async r=>{try{return await this.engine.reject(r)}catch(s){throw this.logger.error(s.message),s}},this.update=async r=>{try{return await this.engine.update(r)}catch(s){throw this.logger.error(s.message),s}},this.extend=async r=>{try{return await this.engine.extend(r)}catch(s){throw this.logger.error(s.message),s}},this.request=async r=>{try{return await this.engine.request(r)}catch(s){throw this.logger.error(s.message),s}},this.respond=async r=>{try{return await this.engine.respond(r)}catch(s){throw this.logger.error(s.message),s}},this.ping=async r=>{try{return await this.engine.ping(r)}catch(s){throw this.logger.error(s.message),s}},this.emit=async r=>{try{return await this.engine.emit(r)}catch(s){throw this.logger.error(s.message),s}},this.disconnect=async r=>{try{return await this.engine.disconnect(r)}catch(s){throw this.logger.error(s.message),s}},this.find=r=>{try{return this.engine.find(r)}catch(s){throw this.logger.error(s.message),s}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}},this.authenticate=async(r,s)=>{try{return await this.engine.authenticate(r,s)}catch(i){throw this.logger.error(i.message),i}},this.formatAuthMessage=r=>{try{return this.engine.formatAuthMessage(r)}catch(s){throw this.logger.error(s.message),s}},this.approveSessionAuthenticate=async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}},this.rejectSessionAuthenticate=async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}},this.name=(t==null?void 0:t.name)||$k.name,this.metadata=pHe(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const n=IW({logger:(t==null?void 0:t.logger)||$k.logger,name:this.name});this.logger=n,this.core=(t==null?void 0:t.core)||new IJe(t),this.session=new MJe(this.core,this.logger),this.proposal=new LJe(this.core,this.logger),this.pendingRequest=new jJe(this.core,this.logger),this.engine=new UJe(this),this.auth=new WJe(this.core,this.logger)}static async init(t){const n=new Rpe(t);return await n.initialize(),n}get context(){return Sr(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")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}};const VJe=HJe;function KJe(e){return Number.isSafeInteger(e)&&e>=0}function GJe(e){return e!=null&&typeof e!="function"&&KJe(e.length)}function ZJe(e){return e==="__proto__"}function AW(e){return e==null||typeof e!="object"&&typeof e!="function"}function Bpe(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function _W(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const YJe="[object RegExp]",Dpe="[object String]",Upe="[object Number]",Lpe="[object Boolean]",Mpe="[object Arguments]",JJe="[object Symbol]",XJe="[object Date]",QJe="[object Map]",eXe="[object Set]",tXe="[object Array]",nXe="[object ArrayBuffer]",jpe="[object Object]",rXe="[object DataView]",sXe="[object Uint8Array]",iXe="[object Uint8ClampedArray]",oXe="[object Uint16Array]",aXe="[object Uint32Array]",cXe="[object Int8Array]",lXe="[object Int16Array]",uXe="[object Int32Array]",dXe="[object Float32Array]",hXe="[object Float64Array
26]";function NW(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fXe(e,t){return gv(e,void 0,e,new Map,t)}function gv(e,t,n,r=new Map,s=void 0){const i=s==null?void 0:s(e,t,n,r);if(i!==void 0)return i;if(AW(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const o=new Array(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=gv(e[a],a,n,r,s);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;r.set(e,o);for(const[a,c]of e)o.set(a,gv(c,a,n,r,s));return o}if(e instanceof Set){const o=new Set;r.set(e,o);for(const a of e)o.add(gv(a,void 0,n,r,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(NW(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=gv(e[a],a,n,r,s);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,o),md(o,e,n,r,s),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return r.set(e,o),md(o,e,n,r,s),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return r.set(e,o),md(o,e,n,r,s),o}if(e instanceof Error){const o=new e.constructor;return r.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,md(o,e,n,r,s),o}if(e instanceof Boolean){const o=new Boolean(e.valueOf());return r.set(e,o),md(o,e,n,r,s),o}if(e instanceof Number){const o=new Number(e.valueOf());return r.set(e,o),md(o,e,n,r,s),o}if(e instanceof String){const o=new String(e.valueOf());return r.set(e,o),md(o,e,n,r,s),o}if(typeof e=="object"&&pXe(e)){const o=Object.create(Object.getPrototypeOf(e));return r.set(e,o),md(o,e,n,r,s),o}return e}function md(e,t,n=e,r,s){const i=[...Object.keys(t),...Bpe(t)];for(let o=0;o<i.length;o++){const a=i[o],c=Object.getOwnPropertyDescriptor(e,a);(c==null||c.writable)&&(e[a]=gv(t[a],a,n,r,s))}}function pXe(e){switch(_W(e)){case Mpe:case tXe:case nXe:case rXe:case Lpe:case XJe:case dXe:case hXe:case cXe:case lXe:case uXe:case QJe:case Upe:case jpe:case YJe:case eXe:case Dpe:case JJe:case sXe:case iXe:case oXe:case aXe:return!0;default:return!1}}function gXe(e,t){return fXe(e,(n,r,s,i)=>{if(typeof e=="object"){if(_W(e)===jpe&&typeof e.constructor!="function"){const o={};return i.set(e,o),md(o,e,s,i),o}switch(Object.prototype.toString.call(e)){case Upe:case Dpe:case Lpe:{const o=new e.constructor(e==null?void 0:e.valueOf());return md(o,e),o}case Mpe:{const o={};return md(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}function pee(e){return gXe(e)}function gee(e){return e!==null&&typeof e=="object"&&_W(e)==="[object Arguments]"}function eM(e){return typeof e=="object"&&e!==null}function mXe(e){return eM(e)&&GJe(e)}function wXe(){}function Ik(e){return NW(e)}function Sk(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){const r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function yXe(e){if(AW(e))return e;if(Array.isArray(e)||NW(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);const n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){const r=new n(e);return r.lastIndex=e.lastIndex,r}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let r;return e instanceof AggregateError?r=new n(e.errors,e.message,{cause:e.cause}):r=new n(e.message,{cause:e.cause}),r.stack=e.stack,Object.assign(r,e),r}if(typeof File<"u"&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e=="object"){const r=Object.create(t);return Object.assign(r,e)}return e}function bXe(e,...t){const n=t.slice(0,-1),r=t[t.length-1];let s=e;for(let i=0;i<n.length;i++){const o=n[i];s=tM(s,o,r,new Map)}return s}function tM(e,t,n,r){if(AW(e)&&(e=Object(e)),t==null||typeof t!="object")return e;if(r.has(t))return yXe(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let i=0;i<t.length;i++)t[i]=t[i]??void 0}const s=[...Object.keys(t),...Bpe(t)];for(let i=0;i<s.length;i++){const o=s[i];if(ZJe(o))continue;let a=t[o],c=e[o];if(gee(a)&&(a={...a}),gee(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=pee(a)),Array.isArray(a))if(Array.isArray(c)){const u=[],d=Reflect.ownKeys(c);for(let h=0;h<d.length;h++){const f=d[h];u[f]=c[f]}c=u}else if(mXe(c)){const u=[];for(let d=0;d<c.length;d++)u[d]=c[d];c=u}else c=[];const l=n(c,a,o,e,t,r);l!==void 0?e[o]=l:Array.isArray(a)||eM(c)&&eM(a)&&(Sk(c)||Sk(a)||Ik(c)||Ik(a))?e[o]=tM(c,a,n,r):c==null&&Sk(a)?e[o]=tM({},a,n,r):c==null&&Ik(a)?e[o]=pee(a):(c===void 0||a!==void 0)&&(e[o]=a)}return e}function vXe(e,...t){return bXe(e,...t,wXe)}const mee="error",EXe="wss://relay.walletconnect.org",CXe="wc",Fpe="universal_provider",Jx=`${CXe}@2:${Fpe}:`,zpe="https://rpc.walletconnect.org/v1/",qpe="generic",$Xe=`${zpe}bundler`,Mv="call_status",xXe=86400,TW={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function Wpe(e,t,n){var s;const r=e0(e);return((s=t.rpcMap)==null?void 0:s[r.reference])||`${zpe}?chainId=${r.namespace}:${r.reference}&projectId=${n}`}function IXe(e){return e.includes(":")?e.split(":")[1]:e}function Hpe(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function SXe(e,t){const n=Object.keys(t.namespaces).filter(s=>s.includes(e));if(!n.length)return[];const r=[];
vendor: 22,272 bytes, line 26
26return n.forEach(s=>{const i=t.namespaces[s].accounts;r.push(...i)}),r}function wee(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>{var r,s;return((r=n==null?void 0:n.chains)==null?void 0:r.length)&&((s=n==null?void 0:n.chains)==null?void 0:s.length)>0}))}function Xx(e={},t={}){const n=wee(yee(e)),r=wee(yee(t));return vXe(n,r)}function yee(e){var n,r,s,i,o;const t={};if(!Hh(e))return t;for(const[a,c]of Object.entries(e)){const l=R7(a)?[a]:c.chains,u=c.methods||[],d=c.events||[],h=c.rpcMap||{},f=pv(a);t[f]={...t[f],...c,chains:Wh(l,(n=t[f])==null?void 0:n.chains),methods:Wh(u,(r=t[f])==null?void 0:r.methods),events:Wh(d,(s=t[f])==null?void 0:s.events)},(Hh(h)||Hh(((i=t[f])==null?void 0:i.rpcMap)||{}))&&(t[f].rpcMap={...h,...(o=t[f])==null?void 0:o.rpcMap})}return t}function bee(e){return e.includes(":")?e.split(":")[2]:e}function vee(e){const t={};for(const[n,r]of Object.entries(e)){const s=r.methods||[],i=r.events||[],o=r.accounts||[],a=R7(n)?[n]:r.chains?r.chains:Hpe(r.accounts);t[n]={chains:a,methods:s,events:i,accounts:o}}return t}function Ak(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}function AXe(e){try{const t=JSON.parse(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const Vpe={},jv=e=>Vpe[e],_k=(e,t)=>{Vpe[e]=t},Eee="eip155",_Xe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],NXe=e=>e&&e.startsWith("0x")?BigInt(e).toString(10):e,Nk=e=>e&&e.startsWith("0x")?e:`0x${BigInt(e).toString(16)}`,Cee=e=>Object.keys(e).filter(t=>_Xe.includes(t)).reduce((t,n)=>(t[n]=TXe(e[n]),t),{}),TXe=e=>typeof e=="string"&&AXe(e)?JSON.parse(e):e,PXe=(e,t,n)=>{const{sessionProperties:r={},scopedProperties:s={}}=e,i={};if(!Hh(s)&&!Hh(r))return;const o=Cee(r);for(const a of n){const c=NXe(a);if(!c)continue;i[Nk(c)]=o;const l=s==null?void 0:s[`${Eee}:${c}`];if(l){const u=l==null?void 0:l[`${Eee}:${c}:${t}`];i[Nk(c)]={...i[Nk(c)],...Cee(u||l)}}}for(const[a,c]of Object.entries(i))Object.keys(c).length===0&&delete i[a];return Object.keys(i).length>0?i:void 0};let Tk,OXe=class Kpe{constructor(t){this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,n){return await this.storage.setItem(t,n)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return Tk||(Tk=new Kpe(t)),Tk}};async function kXe(e,t){const n=e0(e.result.capabilities.caip345.caip2),r=e.result.capabilities.caip345.transactionHashes,s=await Promise.allSettled(r.map(d=>RXe(n.reference,d,t))),i=s.filter(d=>d.status==="fulfilled").map(d=>d.value).filter(d=>d);s.filter(d=>d.status==="rejected").forEach(d=>console.warn("Failed to fetch transaction receipt:",d.reason));const o=!i.length||i.some(d=>!d),a=i.every(d=>(d==null?void 0:d.status)==="0x1"),c=i.every(d=>(d==null?void 0:d.status)==="0x0"),l=i.some(d=>(d==null?void 0:d.status)==="0x0");let u;return o?u=100:a?u=200:c?u=500:l&&(u=600),{id:e.result.id,version:e.request.version,atomic:e.request.atomicRequired,chainId:e.request.chainId,capabilities:e.result.capabilities,receipts:i,status:u}}async function RXe(e,t,n){return await n(parseInt(e)).request(_n("eth_getTransactionReceipt",[t]))}async function BXe({sendCalls:e,storage:t}){const n=await t.getItem(Mv);await t.setItem(Mv,{...n,[e.result.id]:{request:e.request,result:e.result,expiry:Ss(xXe)}})}async function DXe({resultId:e,storage:t}){const n=await t.getItem(Mv);if(n){delete n[e],await t.setItem(Mv,n);for(const r in n)kh(n[r].expiry)&&delete n[r];await t.setItem(Mv,n)}}async function UXe({resultId:e,storage:t}){var r;const n=(r=await t.getItem(Mv))==null?void 0:r[e];if(n&&!kh(n.expiry))return n;await DXe({resultId:e,storage:t})}let LXe=class{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=jv("events"),this.client=jv("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=OXe.getStorage(this.client.core.storage)}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(parseInt(t),n);const r=this.chainId;this.chainId=parseInt(t),this.events.emit(TW.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${t}`,previousCaipChainId:`${this.name}:${r}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,n){const r=n||Wpe(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,jv("disableProviderPing")))}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var s;const r=parseInt(IXe(n));t[r]=this.createHttpProvider(r,(s=this.namespace.rpcMap)==null?void 0:s[n])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}getHttpProvider(t){const n=t||this.chainId;return this.httpProviders[n]||(this.httpProviders={...this.httpProviders,[n]:this.createHttpProvider(n)},this.httpProviders[n])}async handleSwitchChain(t){var s,i;let n=t.request.params?(s=t.request.params[0])==null?void 0:s.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const r=parseInt(n,16);if(this.isChainApproved(r))this.setDefaultChain(`${r}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${r}`);else throw new Error(`Failed to switch to chain 'eip155:${r}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var d,h,f,g,p;const n=(h=(d=t.request)==null?void 0:d.params)==null?void 0:h[0],r=((g=(f=t.request)==null?void 0:f.params)==null?void 0:g[1])||[];if(!n)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const s=this.client.session.get(t.topic),i=((p=s==null?void 0:s.sessionProperties)==null?void 0:p.capabilities)||{},o=r.length>0?r.join(","):`0x${this.chainId.toString(16)}`,a=`${n}${o}`,c=i==null?void 0:i[a];if(c)return c;let l;try{l=PXe(s,n,r)}catch(m){console.warn("Failed to extract capabilities from session",m)}if(l)return l;const u=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:{...s.sessionProperties||{},capabilities:{...i||{},[a]:u}}})}catch(m){console.warn("Failed to update session with capabilities",m)}return u}async getCallStatus(t){var o,a,c;const n=this.client.session.get(t.topic),r=(o=n.sessionProperties)==null?void 0:o.bundler_name;if(r){const l=this.getBundlerUrl(t.chainId,r);try{return await this.getUserOperationReceipt(l,t)}catch(u){console.warn("Failed to fetch call status from bundler",u,l)}}const s=(a=n.sessionProperties)==null?void 0:a.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,t)}catch(l){console.warn("Failed to fetch call status from custom bundler",l,s)}const i=await UXe({resultId:(c=t.request.params)==null?void 0:c[0],storage:this.storage});if(i)try{return await kXe(i,this.getHttpProvider.bind(this))}catch(l){console.warn("Failed to fetch call status from stored send calls",l,i)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,n){var i;const r=new URL(t),s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_n("eth_getUserOperationReceipt",[(i=n.request.params)==null?void 0:i[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(t,n){return`${$Xe}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${n}`}async sendCalls(t){var c,l,u;const n=await this.client.request(t),r=(c=t.request.params)==null?void 0:c[0],s=n==null?void 0:n.id,i=(n==null?void 0:n.capabilities)||{},o=(l=i==null?void 0:i.caip345)==null?void 0:l.caip2,a=(u=i==null?void 0:i.caip345)==null?void 0:u.transactionHashes;return!s||!o||!(a!=null&&a.length)||await BXe({sendCalls:{request:r,result:n},storage:this.storage}),n}},MXe=class{constructor(t){this.name=qpe,this.namespace=t.namespace,this.events=jv("events"),this.client=jv("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n);const r=this.chainId;this.chainId=t,this.events.emit(TW.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${t}`,previousCaipChainId:`${this.name}:${r}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return e0(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){var n,r;const t={};return(r=(n=this.namespace)==null?void 0:n.accounts)==null||r.forEach(s=>{var a,c;const i=e0(s),o=(c=(a=this.namespace)==null?void 0:a.rpcMap)==null?void 0:c[`${i.namespace}:${i.reference}`];t[i.reference]=this.createHttpProvider(s,o)}),t}getHttpProvider(t){const n=e0(t).reference,r=this.httpProviders[n];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||Wpe(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,jv("disableProviderPing")))}},bVt=class Gpe{constructor(t){this.events=new Bu,this.rpcProviders={},this.disableProviderPing=!1,this.providerOpts=t,this.logger=IW({logger:t.logger??mee,name:this.providerOpts.name??Fpe}),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const n=new Gpe(t);return await n.initialize(),n}async request(t,n,r){const[s,i]=this.validateChain(n);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:{...t},chainId:`${s}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(t,n,r,s){const i=new Date().getTime();this.request(t,r,s).then(o=>n(null,Pi(i,o))).catch(o=>n(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Yr("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=t,this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,n){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:r,response:s}=await this.client.authenticate(t,n);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await s();if(this.session=i.session,this.session){const o=vee(this.session.namespaces);this.namespaces=Xx(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}removeListener(t,n){this.events.removeListener(t,n)}off(t,n){this.events.off(t,n)}get isWalletConnect(){return!0}async pair(t){var o,a;const{uri:n,approval:r}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:(o=this.connectParams)==null?void 0:o.authentication,walletPay:(a=this.connectParams)==null?void 0:a.walletPay});n&&(this.uri=n,this.events.emit("display_uri",n));const s=await r();this.session=s;const i=vee(s.namespaces);return this.namespaces=Xx(this.namespaces,i),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,n){try{if(!this.session)return;const[r,s]=this.validateChain(t),i=this.getProvider(r);i?i.setDefaultChain(s,n):this.session&&this.logger.warn(`Provider for namespace '${r}' not found in setDefaultChain`)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const n=this.client.pairing.getAll();if(!n0(n))return;for(const r of n)t.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${n.length}`)}catch(n){this.logger.warn(n,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,n;if(this.client=this.providerOpts.client||await VJe.init({core:this.providerOpts.core,logger:this.providerOpts.logger||mee,relayUrl:this.providerOpts.relayUrl||EXe,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.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error(r,"Failed to get session"),new Error(`The provided session: ${(n=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:n.topic} doesn't exist in the Sign client`)}else{const r=this.client.session.getAll();this.session=r[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(n=>pv(n)))];_k("client",this.client),_k("events",this.events),_k("disableProviderPing",this.disableProviderPing),t.forEach(n=>{if(!this.session)return;const r=SXe(n,this.session);if((r==null?void 0:r.length)===0)return;const s=Hpe(r),i={...Xx(this.namespaces,this.optionalNamespaces)[n],accounts:r,chains:s};switch(n){case"eip155":this.rpcProviders[n]=new LXe({namespace:i});break;default:this.rpcProviders[n]=new MXe({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var r;const{topic:n}=t;n===((r=this.session)==null?void 0:r.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var i;const{params:n,topic:r}=t;if(r!==((i=this.session)==null?void 0:i.topic))return;const{event:s}=n;if(s.name==="accountsChanged"){const o=s.data;o&&n0(o)&&this.events.emit("accountsChanged",o.map(bee))}else if(s.name==="chainChanged"){const o=n.chainId,a=n.event.data,c=pv(o),l=Ak(o)!==Ak(a)?`${c}:${Ak(a)}`:o;this.onChainChanged({currentCaipChainId:l})}else this.events.emit(s.name,s.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:n})=>{var i,o;if(t!==((i=this.session)==null?void 0:i.topic))return;const{namespaces:r}=n,s=(o=this.client)==null?void 0:o.session.get(t);this.session={...s,namespaces:r},this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:n})}),this.client.on("session_delete",async t=>{var n;t.topic===((n=this.session)==null?void 0:n.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",{...Yr("USER_DISCONNECTED"),data:t.topic}))}),this.on(TW.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged({...t,internal:!0})})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[qpe]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var n;this.getProvider(t).updateNamespace((n=this.session)==null?void 0:n.namespaces[t])})}setNamespaces(t){const{namespaces:n={},optionalNamespaces:r={},sessionProperties:s,scopedProperties:i}=t;this.optionalNamespaces=Xx(n,r),this.sessionProperties=s,this.scopedProperties=i}validateChain(t){const[n,r]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[n,r];if(n&&!Object.keys(this.namespaces||{}).map(o=>pv(o)).includes(n))throw new Error(`Namespace '${n}' is not configured. Please call connect() first with namespace config.`);if(n&&r)return[n,r];const s=pv(Object.keys(this.namespaces)[0]),i=this.rpcProviders[s].getDefaultChain();return[s,i]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged({currentCaipChainId:t,previousCaipChainId:n,internal:r=!1}){if(!this.namespaces)return;const[s,i]=this.validateChain(t);if(i){if(this.updateNamespaceChain(s,i),r)this.events.emit("chainChanged",i),this.emitAccountsChangedOnChainChange({namespace:s,currentCaipChainId:t,previousCaipChainId:n});else{const o=this.getProvider(s);o?o.setDefaultChain(i):this.session&&this.logger.warn(`Provider for namespace '${s}' not found during chain change`)}await this.persist("namespaces",this.namespaces)}}emitAccountsChangedOnChainChange({namespace:t,currentCaipChainId:n,previousCaipChainId:r}){var s,i;try{if(r===n)return;const o=(i=(s=this.session)==null?void 0:s.namespaces[t])==null?void 0:i.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${n}:`)).map(bee);if(!n0(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn(o,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(t,n){if(!this.namespaces)return;const r=this.namespaces[t]?t:`${t}:${n}`,s={chains:[],methods:[],events:[],defaultChain:n};this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=n):this.namespaces[r]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,n){var s;const r=((s=this.session)==null?void 0:s.topic)||"";await this.client.core.storage.setItem(`${Jx}/${t}${r}`,n)}async getFromStore(t){var r;const n=((r=this.session)==null?void 0:r.topic)||"";return await this.client.core.storage.getItem(`${Jx}/${t}${n}`)}async deleteFromStore(t){var r;const n=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.removeItem(`${Jx}/${t}${n}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const n=await this.client.core.storage.getKeys();for(const r of n)r.startsWith(Jx)&&await this.client.core.storage.removeItem(r)}catch(n){this.logger.warn(n,"Failed to cleanup storage")}}};const Zpe={isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}};var $ee={};const he={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",BASE_ACCOUNT:"baseAccount",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122",TON:"ton",TRON:"tron"}
26,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos",sui:"Sui",stacks:"Stacks",ton:"TON",tron:"TRON"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",TON:"ton",TRON:"tron"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],SOLANA_SPL_TOKEN_ADDRESSES:{SOL:"So11111111111111111111111111111111111111112"},NATIVE_IMAGE_IDS_BY_NAMESPACE:{eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"3e8119e5-2a6f-4818-c50c-1937011d5900",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},TOKEN_SYMBOLS_BY_ADDRESS:{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"USDC","0x833589fcd6edb6e08f4c7c32d4f71b54bda02913":"USDC","0x0b2c639c533813f4aa9d7837caf62653d097ff85":"USDC","0xaf88d065e77c8cc2239327c5edb3a432268e5831":"USDC","0x3c499c542cef5e3811e1192ce70d8cc03d5c3359":"USDC","0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"USDC",EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:"USDC","0xdac17f958d2ee523a2206206994597c13d831ec7":"USDT","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58":"USDT","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9":"USDT","0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"USDT",Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:"USDT"},HTTP_STATUS_CODES:{SERVER_ERROR:500,TOO_MANY_REQUESTS:429,SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof process<"u"&&typeof $ee<"u"?$ee.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",REMOTE_FEATURES_ALERTS:{MULTI_WALLET_NOT_ENABLED:{DEFAULT:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com."},CONNECTIONS_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnections hook."},CONNECTION_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnection hook."}},HEADLESS_NOT_ENABLED:{DEFAULT:{displayMessage:"",debugMessage:"Headless support is not enabled. Please enable it with the features.headless option in the AppKit configuration and make sure your current plan supports it."}}},IS_DEVELOPMENT:typeof process<"u"&&!1,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://localhost:*","http://127.0.0.1:*","https://127.0.0.1:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"],METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH"},PW={caipNetworkIdToNumber(e){return e?Number(e.split(":")[1]):void 0},parseEvmChainId(e){return typeof e=="string"?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace(e,t){return(e==null?void 0:e.filter(n=>n.chainNamespace===t))||[]},getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]},getNetworkNameByCaipNetworkId(e,t){var s;if(!t)return;const n=e.find(i=>i.caipNetworkId===t);if(n)return n.name;const[r]=t.split(":");return((s=he.CHAIN_NAME_MAP)==null?void 0:s[r])||void 0}},Ype=["eip155","solana","polkadot","bip122","cosmos","sui","stacks"];var jXe=20,FXe=1,Kw=1e6,xee=1e6,zXe=-7,qXe=21,WXe=!1,FC="[big.js] ",ab=FC+"Invalid ",U7=ab+"decimal places",HXe=ab+"rounding mode",Jpe=FC+"Division by zero",hr={},Vh=void 0,VXe=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function Xpe(){function e(t){var n=this;if(!(n instanceof e))return t===Vh?Xpe():new e(t);if(t instanceof e)n.s=t.s,n.e=t.e,n.c=t.c.slice();else{if(typeof t!="string"){if(e.strict===!0&&typeof t!="bigint")throw TypeError(ab+"value");t=t===0&&1/t<0?"-0":String(t)}KXe(n,t)}n.constructor=e}return e.prototype=hr,e.DP=jXe,e.RM=FXe,e.NE=zXe,e.PE=qXe,e.strict=WXe,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}function KXe(e,t){var n,r,s;if(!VXe.test(t))throw Error(ab+"number");for(e.s=t.charAt(0)=="-"?(t=t.slice(1),-1):1,(n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),s=t.length,r=0;r<s&&t.charAt(r)=="0";)++r;if(r==s)e.c=[e.e=0];else{for(;s>0&&t.charAt(--s)=="0";);for(e.e=n-r-1,e.c=[],n=0;r<=s;)e.c[n++]=+t.charAt(r++)}return e}function cb(e,t,n,r){var s=e.c;if(n===Vh&&(n=e.constructor.RM),n!==0&&n!==1&&n!==2&&n!==3)throw Error(HXe);if(t<1)r=n===3&&(r||!!s[0])||t===0&&(n===1&&s[0]>=5||n===2&&(s[0]>5||s[0]===5&&(r||s[1]!==Vh))),s.length=1,r?(e.e=e.e-t+1,s[0]=1):s[0]=e.e=0;else if(t<s.length){if(r=n===1&&s[t]>=5||n===2&&(s[t]>5||s[t]===5&&(r||s[t+1]!==Vh||s[t-1]&1))||n===3&&(r||!!s[0]),s.length=t,r){for(;++s[--t]>9;)if(s[t]=0,t===0){++e.e,s.unshift(1);break}}for(t=s.length;!s[--t];)s.pop()}return e}function lb(e,t,n){var r=e.e,s=e.c.join(""),i=s.length;if(t)s=s.charAt(0)+(i>1?"."+s.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)s="0"+s;s="0."+s}else if(r>0)if(++r>i)for(r-=i;r--;)s+="0";else r<i&&(s=s.slice(0,r)+"."+s.slice(r));else i>1&&(s=s.charAt(0)+"."+s.slice(1));return e.s<0&&n?"-"+s:s}hr.abs=function(){var e=new this.constructor(this);return e.s=1,e};hr.cmp=function(e){var t,n=this,r=n.c,s=(e=new n.constructor(e)).c,i=n.s,o=e.s,a=n.e,c=e.e;if(!r[0]||!s[0])return r[0]?i:s[0]?-o:0;if(i!=o)return i;if(t=i<0,a!=c)return a>c^t?1:-1;for(o=(a=r.length)<(c=s.length)?a:c,i=-1;++i<o;)if(r[i]!=s[i])return r[i]>s[i]^t?1:-1;return a==c?0:a>c^t?1:-1};hr.div=function(e){var t=this,n=t.constructor,r=t.c,s=(e=new n(e)).c,i=t.s==e.s?1:-1,o=n.DP;if(o!==~~o||o<0||o>Kw)throw Error(U7);if(!s[0])throw Error(Jpe);if(!r[0])return e.s=i,e.c=[e.e=0],e;var a,c,l,u,d,h=s.slice(),f=a=s.length,g=r.length,p=r.slice(0,a),m=p.length,w=e,C=w.c=[],E=0,b=o+(w.e=t.e-e.e)+1;for(w.s=i,i=b<0?0:b,h.unshift(0);m++<a;)p.push(0);do{for(l=0;l<10;l++){if(a!=(m=p.length))u=a>
26m?1:-1;else for(d=-1,u=0;++d<a;)if(s[d]!=p[d]){u=s[d]>p[d]?1:-1;break}if(u<0){for(c=m==a?s:h;m;){if(p[--m]<c[m]){for(d=m;d&&!p[--d];)p[d]=9;--p[d],p[m]+=10}p[m]-=c[m]}for(;!p[0];)p.shift()}else break}C[E++]=u?l:++l,p[0]&&u?p[m]=r[f]||0:p=[r[f]]}while((f++<g||p[0]!==Vh)&&i--);return!C[0]&&E!=1&&(C.shift(),w.e--,b--),E>b&&cb(w,b,n.RM,p[0]!==Vh),w};hr.eq=function(e){return this.cmp(e)===0};hr.gt=function(e){return this.cmp(e)>0};hr.gte=function(e){return this.cmp(e)>-1};hr.lt=function(e){return this.cmp(e)<0};hr.lte=function(e){return this.cmp(e)<1};hr.minus=hr.sub=function(e){var t,n,r,s,i=this,o=i.constructor,a=i.s,c=(e=new o(e)).s;if(a!=c)return e.s=-c,i.plus(e);var l=i.c.slice(),u=i.e,d=e.c,h=e.e;if(!l[0]||!d[0])return d[0]?e.s=-c:l[0]?e=new o(i):e.s=1,e;if(a=u-h){for((s=a<0)?(a=-a,r=l):(h=u,r=d),r.reverse(),c=a;c--;)r.push(0);r.reverse()}else for(n=((s=l.length<d.length)?l:d).length,a=c=0;c<n;c++)if(l[c]!=d[c]){s=l[c]<d[c];break}if(s&&(r=l,l=d,d=r,e.s=-e.s),(c=(n=d.length)-(t=l.length))>0)for(;c--;)l[t++]=0;for(c=t;n>a;){if(l[--n]<d[n]){for(t=n;t&&!l[--t];)l[t]=9;--l[t],l[n]+=10}l[n]-=d[n]}for(;l[--c]===0;)l.pop();for(;l[0]===0;)l.shift(),--h;return l[0]||(e.s=1,l=[h=0]),e.c=l,e.e=h,e};hr.mod=function(e){var t,n=this,r=n.constructor,s=n.s,i=(e=new r(e)).s;if(!e.c[0])throw Error(Jpe);return n.s=e.s=1,t=e.cmp(n)==1,n.s=s,e.s=i,t?new r(n):(s=r.DP,i=r.RM,r.DP=r.RM=0,n=n.div(e),r.DP=s,r.RM=i,this.minus(n.times(e)))};hr.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e};hr.plus=hr.add=function(e){var t,n,r,s=this,i=s.constructor;if(e=new i(e),s.s!=e.s)return e.s=-e.s,s.minus(e);var o=s.e,a=s.c,c=e.e,l=e.c;if(!a[0]||!l[0])return l[0]||(a[0]?e=new i(s):e.s=s.s),e;if(a=a.slice(),t=o-c){for(t>0?(c=o,r=l):(t=-t,r=a),r.reverse();t--;)r.push(0);r.reverse()}for(a.length-l.length<0&&(r=l,l=a,a=r),t=l.length,n=0;t;a[t]%=10)n=(a[--t]=a[t]+l[t]+n)/10|0;for(n&&(a.unshift(n),++c),t=a.length;a[--t]===0;)a.pop();return e.c=a,e.e=c,e};hr.pow=function(e){var t=this,n=new t.constructor("1"),r=n,s=e<0;if(e!==~~e||e<-xee||e>xee)throw Error(ab+"exponent");for(s&&(e=-e);e&1&&(r=r.times(t)),e>>=1,!!e;)t=t.times(t);return s?n.div(r):r};hr.prec=function(e,t){if(e!==~~e||e<1||e>Kw)throw Error(ab+"precision");return cb(new this.constructor(this),e,t)};hr.round=function(e,t){if(e===Vh)e=0;else if(e!==~~e||e<-Kw||e>Kw)throw Error(U7);return cb(new this.constructor(this),e+this.e+1,t)};hr.sqrt=function(){var e,t,n,r=this,s=r.constructor,i=r.s,o=r.e,a=new s("0.5");if(!r.c[0])return new s(r);if(i<0)throw Error(FC+"No square root");i=Math.sqrt(+lb(r,!0,!0)),i===0||i===1/0?(t=r.c.join(""),t.length+o&1||(t+="0"),i=Math.sqrt(t),o=((o+1)/2|0)-(o<0||o&1),e=new s((i==1/0?"5e":(i=i.toExponential()).slice(0,i.indexOf("e")+1))+o)):e=new s(i+""),o=e.e+(s.DP+=4);do n=e,e=a.times(n.plus(r.div(n)));while(n.c.slice(0,o).join("")!==e.c.slice(0,o).join(""));return cb(e,(s.DP-=4)+e.e+1,s.RM)};hr.times=hr.mul=function(e){var t,n=this,r=n.constructor,s=n.c,i=(e=new r(e)).c,o=s.length,a=i.length,c=n.e,l=e.e;if(e.s=n.s==e.s?1:-1,!s[0]||!i[0])return e.c=[e.e=0],e;for(e.e=c+l,o<a&&(t=s,s=i,i=t,l=o,o=a,a=l),t=new Array(l=o+a);l--;)t[l]=0;for(c=a;c--;){for(a=0,l=o+c;l>c;)a=t[l]+i[c]*s[l-c-1]+a,t[l--]=a%10,a=a/10|0;t[l]=a}for(a?++e.e:t.shift(),c=t.length;!t[--c];)t.pop();return e.c=t,e};hr.toExponential=function(e,t){var n=this,r=n.c[0];if(e!==Vh){if(e!==~~e||e<0||e>Kw)throw Error(U7);for(n=cb(new n.constructor(n),++e,t);n.c.length<e;)n.c.push(0)}return lb(n,!0,!!r)};hr.toFixed=function(e,t){var n=this,r=n.c[0];if(e!==Vh){if(e!==~~e||e<0||e>Kw)throw Error(U7);for(n=cb(new n.constructor(n),e+n.e+1,t),e=e+n.e+1;n.c.length<e;)n.c.push(0)}return lb(n,!1,!!r)};hr[Symbol.for("nodejs.util.inspect.custom")]=hr.toJSON=hr.toString=function(){var e=this,t=e.constructor;return lb(e,e.e<=t.NE||e.e>=t.PE,!!e.c[0])};hr.toNumber=function(){var e=+lb(this,!0,!0);if(this.constructor.strict===!0&&!this.eq(e.toString()))throw Error(FC+"Imprecise conversion");return e};hr.toPrecision=function(e,t){var n=this,r=n.constructor,s=n.c[0];if(e!==Vh){if(e!==~~e||e<1||e>Kw)throw Error(ab+"precision");for(n=cb(new r(n),e,t);n.c.length<e;)n.c.push(0)}return lb(n,e<=n.e||n.e<=r.NE||n.e>=r.PE,!!s)};hr.valueOf=function(){var e=this,t=e.constructor;if(t.strict===!0)throw Error(FC+"valueOf disallowed");return lb(e,e.e<=t.NE||e.e>=t.PE,!0)};var An=Xpe();const Qpe={bigNumber(e,t={safe:!1}){try{return e?new An(e):new An(0)}catch(n){if(t.safe)return new An(0);throw n}},formatNumber(e,t){const{decimals:n,round:r=8,safe:s=!0}=t;return Qpe.bigNumber(e,{safe:s}).div(new An(10).pow(n)).round(r)},multiply(e,t){if(e===void 0||t===void 0)return new An(0);const n=new An(e),r=new An(t);return n.times(r)},toFixed(e,t=2){return e===void 0||e===""?new An(0).toFixed(t):new An(e).toFixed(t)},formatNumberToLocalString(e,t=2){return e===void 0||e===""?"0.00":typeof e=="number"?e.toLocaleStr
vendor: 4,570 bytes, line 26
26ing("en-US",{maximumFractionDigits:t,minimumFractionDigits:t,roundingMode:"floor"}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t,roundingMode:"floor"})},parseLocalStringToNumber(e){if(e===void 0||e==="")return 0;const t=e.replace(/,/gu,"");return new An(t).toNumber()}},GXe=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],ZXe=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],YXe=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],JXe={getERC20Abi:e=>he.USDT_CONTRACT_ADDRESSES.includes(e)?YXe:GXe,getSwapAbi:()=>ZXe},c2={ConnectorExplorerIds:{[he.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[he.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[he.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[he.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[he.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[he.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[he.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[he.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[he.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[he.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[he.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[he.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[he.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[he.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[he.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[he.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[he.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[he.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[he.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"}},Ci={validateCaipAddress(e){var t;if(((t=e.split(":"))==null?void 0:t.length)!==3)throw new Error("Invalid CAIP Address");return e},parseCaipAddress(e){const t=e.split(":");if(t.length!==3)throw new Error(`Invalid CAIP-10 address: ${e}`);const[n,r,s]=t;if(!n||!r||!s)throw new Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:n,chainId:r,address:s}},parseCaipNetworkId(e){const t=e.split(":");if(t.length!==2)throw new Error(`Invalid CAIP-2 network id: ${e}`);const[n,r]=t;if(!n||!r)throw new Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:n,chainId:r}}},Up={RPC_ERROR_CODE:{USER_REJECTED_REQUEST:4001,USER_REJECTED_METHODS:5002,USER_REJECTED:5e3,SEND_TRANSACTION_ERROR:5001},PROVIDER_RPC_ERROR_NAME:{PROVIDER_RPC:"ProviderRpcError",USER_REJECTED_REQUEST:"UserRejectedRequestError",SEND_TRANSACTION_ERROR:"SendTransactionError"},isRpcProviderError(e){try{if(typeof e=="object"&&e!==null){const t=e,n=typeof t.message=="string",r=typeof t.code=="number";return n&&r}return!1}catch{return!1}},isUserRejectedMessage(e){return e.toLowerCase().includes("user rejected")||e.toLowerCase().includes("user cancelled")||e.toLowerCase().includes("user canceled")},isUserRejectedRequestError(e){if(Up.isRpcProviderError(e)){const t=e.code===Up.RPC_ERROR_CODE.USER_REJECTED_REQUEST,n=e.code===Up.RPC_ERROR_CODE.USER_REJECTED_METHODS;return t||n||Up.isUserRejectedMessage(e.message)}return e instanceof Error?Up.isUserRejectedMessage(e.message):!1}};
26let XXe=class extends Error{constructor(t,n){super(n.message,{cause:t}),this.name=Up.PROVIDER_RPC_ERROR_NAME.PROVIDER_RPC,this.code=n.code}},e0e=class extends XXe{constructor(t){super(t,{code:Up.RPC_ERROR_CODE.USER_REJECTED_REQUEST,message:"User rejected the request"}),this.name=Up.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST}};const ft={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",RECENT_WALLET:"@appkit/recent_wallet",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections",DISCONNECTED_CONNECTOR_IDS:"@appkit/disconnected_connector_ids",HISTORY_TRANSACTIONS_CACHE:"@appkit/history_transactions_cache",TOKEN_PRICE_CACHE:"@appkit/token_price_cache",RECENT_EMAILS:"@appkit/recent_emails",LATEST_APPKIT_VERSION:"@appkit/latest_version",TON_WALLETS_CACHE:"@appkit/ton_wallets_cache"};function Pk(e){if(!e)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}const at={setItem(e,t){NE()&&t!==void 0&&localStorage.setItem(e,t)},getItem(e){if(NE())return localStorage.getItem(e)||void 0},removeItem(e){NE()&&localStorage.removeItem(e)},clear(){NE()&&localStorage.clear()}};function NE(){return typeof window<"u"&&typeof localStorage<"u"}function E9(e,t){const n=(e==null?void 0:e["--apkt-accent"])??(e==null?void 0:e["--w3m-accent"]);return t==="light"?{"--w3m-accent":n||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":n||"hsla(230, 100%, 67%, 1)","--w3m-background":"#202020"}}const QXe=Symbol(),Iee=Object.getPrototypeOf,nM=new WeakMap,eQe=e=>e&&(nM.has(e)?nM.get(e):Iee(e)===Object.prototype||Iee(e)===Array.prototype),tQe=e=>eQe(e)&&e[QXe]||null,See=(e,t=!0)=>{nM.set(e,t)},C9={},OW=e=>typeof e=="object"&&e!==null,nQe=e=>OW(e)&&!zC.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise),t0e=(e,t)=>{const n=rM.get(e);if((n==null?void 0:n[0])===t)return n[1];const r=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return See(r,!0),rM.set(e,[t,r]),Reflect.ownKeys(e).forEach(s=>{if(Object.getOwnPropertyDescriptor(r,s))return;const i=Reflect.get(e,s),{enumerable:o}=Reflect.getOwnPropertyDescriptor(e,s),a={value:i,enumerable:o,configurable:!0};if(zC.has(i))See(i,!1);else if(Wm.has(i)){const[c,l]=Wm.get(i);a.value=t0e(c,l())}Object.defineProperty(r,s,a)}),Object.preventExtensions(r)},rQe=(e,t,n,r)=>({deleteProperty(s,i){const o=Reflect.get(s,i);n(i);const a=Reflect.deleteProperty(s,i);return a&&r(["delete",[i],o]),a},set(s,i,o,a){const c=!e()&&Reflect.has(s,i),l=Reflect.get(s,i,a);if(c&&(Aee(l,o)||H8.has(o)&&Aee(l,H8.get(o))))return!0;n(i),OW(o)&&(o=tQe(o)||o);const u=!Wm.has(o)&&iQe(o)?zr(o):o;return t(i,u),Reflect.set(s,i,u,a),r(["set",[i],o,l]),!0}}),Wm=new WeakMap,zC=new WeakSet,rM=new WeakMap,$S=[1],H8=new WeakMap;let Aee=Object.is,sQe=(e,t)=>new Proxy(e,t),iQe=nQe,oQe=t0e,aQe=rQe;function zr(e={}){if(!OW(e))throw new Error("object required");const t=H8.get(e);if(t)return t;let n=$S[0];const r=new Set,s=(m,w=++$S[0])=>{n!==w&&(i=n=w,r.forEach(C=>C(m,w)))};let i=n;const o=(m=$S[0])=>(i!==m&&(i=m,c.forEach(([w])=>{const C=w[1](m);C>n&&(n=C)})),n),a=m=>(w,C)=>{const E=[...w];E[1]=[m,...E[1]],s(E,C)},c=new Map,l=(m,w)=>{const C=!zC.has(w)&&Wm.get(w);if(C){if((C9?"production":void 0)!=="production"&&c.has(m))throw new Error("prop listener already exists");if(r.size){const E=C[2](a(m));c.set(m,[C,E])}else c.set(m,[C])}},u=m=>{var w;const C=c.get(m);C&&(c.delete(m),(w=C[1])==null||w.call(C))},d=m=>
26(r.add(m),r.size===1&&c.forEach(([C,E],b)=>{if((C9?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const S=C[2](a(b));c.set(b,[C,S])}),()=>{r.delete(m),r.size===0&&c.forEach(([C,E],b)=>{E&&(E(),c.set(b,[C]))})});let h=!0;const f=aQe(()=>h,l,u,s),g=sQe(e,f);H8.set(e,g);const p=[e,o,d];return Wm.set(g,p),Reflect.ownKeys(e).forEach(m=>{const w=Object.getOwnPropertyDescriptor(e,m);"value"in w&&w.writable&&(g[m]=e[m])}),h=!1,g}function Gi(e,t,n){const r=Wm.get(e);(C9?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let s;const i=[],o=r[2];let a=!1;const l=o(u=>{i.push(u),s||(s=Promise.resolve().then(()=>{s=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,l()}}function V8(e){const t=Wm.get(e);(C9?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[n,r]=t;return oQe(n,r())}function K8(e){return zC.add(e),e}function cQe(){return{proxyStateMap:Wm,refSet:zC,snapCache:rM,versionHolder:$S,proxyCache:H8}}function Zi(e,t,n,r){let s=e[t];return Gi(e,()=>{const i=e[t];Object.is(s,i)||n(s=i)})}const{proxyStateMap:lQe,snapCache:uQe}=cQe(),Qx=e=>lQe.has(e);function dQe(e){const t=[];let n=0;const r=new Map,s=new WeakMap,i=()=>{const l=uQe.get(a),u=l==null?void 0:l[1];if(u&&!s.has(u)){const d=new Map(r);s.set(u,d)}},o=l=>s.get(l)||r,a={data:t,index:n,epoch:0,get size(){return Qx(this)||i(),o(this).size},get(l){const d=o(this).get(l);if(d===void 0){this.epoch;return}return this.data[d]},has(l){const u=o(this);return this.epoch,u.has(l)},set(l,u){if(!Qx(this))throw new Error("Cannot perform mutations on a snapshot");const d=r.get(l);return d===void 0?(r.set(l,this.index),this.data[this.index++]=u):this.data[d]=u,this.epoch++,this},delete(l){if(!Qx(this))throw new Error("Cannot perform mutations on a snapshot");const u=r.get(l);return u===void 0?!1:(delete this.data[u],r.delete(l),this.epoch++,!0)},clear(){if(!Qx(this))throw new Error("Cannot perform mutations on a snapshot");this.data.length=0,this.index=0,this.epoch++,r.clear()},forEach(l){this.epoch,o(this).forEach((d,h)=>{l(this.data[d],h,this)})},*entries(){this.epoch;const l=o(this);for(const[u,d]of l)yield[u,this.data[d]]},*keys(){this.epoch;const l=o(this);for(const u of l.keys())yield u},*values(){this.epoch;const l=o(this);for(const u of l.values())yield this.data[u]},[Symbol.iterator](){return this.entries()},get[Symbol.toStringTag](){return"Map"},toJSON(){return new Map(this.entries())}},c=zr(a);return Object.defineProperties(c,{size:{enumerable:!1},index:{enumerable:!1},epoch:{enumerable:!1},data:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(c),c}const n0e=[{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],hQe="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",mn={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,SOLANA_NATIVE_TOKEN_ADDRESS:"So11111111111111111111111111111111111111111",BALANCE_SUPPORTED_CHAINS:[he.CHAIN.EVM,he.CHAIN.SOLANA],NAMES_SUPPORTED_CHAIN_NAMESPACES:[he.CHAIN.EVM],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x",sui:"0x",stacks:"0x",ton:"0x",tron:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,SEND_SUPPORTED_NAMESPACES:[he.CHAIN.EVM,he.CHAIN.SOLANA],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0,multiWallet:!1,emailCapture:!1,payWithExchange:!1,payments:!1,reownAuthentication:!1,headless:!1},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1,emailCapture:!1,reownAuthentication:!1,headless:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1,reownAuthentication:!1,headless:!1}
vendor: 12,188 bytes, line 26
26,DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa",ton:"eoa",tron:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal"},SIWX_DEFAULTS:{signOutOnDisconnect:!0},MANDATORY_WALLET_IDS_ON_MOBILE:[c2.ConnectorExplorerIds[he.CONNECTOR_ID.COINBASE],c2.ConnectorExplorerIds[he.CONNECTOR_ID.COINBASE_SDK],c2.ConnectorExplorerIds[he.CONNECTOR_ID.BASE_ACCOUNT],c2.ConnectorExplorerIds[he.SOLFLARE_CONNECTOR_NAME],c2.ConnectorExplorerIds[he.PHANTOM_CONNECTOR_NAME],c2.ConnectorExplorerIds[he.BINANCE_CONNECTOR_NAME]],DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"]},xe={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5,transactionsHistory:15e3,tokenPrice:15e3,latestAppKitVersion:6048e5,tonWallets:864e5},isCacheExpired(e,t){return Date.now()-e>t},getActiveNetworkProps(){const e=xe.getActiveNamespace(),t=xe.getActiveCaipNetworkId(),n=t?t.split(":")[1]:void 0,r=n?isNaN(Number(n))?n:Number(n):void 0;return{namespace:e,caipNetworkId:t,chainId:r}},setWalletConnectDeepLink({name:e,href:t}){try{at.setItem(ft.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const e=at.getItem(ft.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{at.removeItem(ft.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{at.setItem(ft.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{at.setItem(ft.ACTIVE_CAIP_NETWORK_ID,e),xe.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return at.getItem(ft.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{at.removeItem(ft.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{const t=Pk(e);at.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{const t=xe.getRecentWallets();t.find(r=>r.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),at.setItem(ft.RECENT_WALLETS,JSON.stringify(t)),at.setItem(ft.RECENT_WALLET,JSON.stringify(e)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const e=at.getItem(ft.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},getRecentWallet(){try{const e=at.getItem(ft.RECENT_WALLET);return e?JSON.parse(e):null}catch{console.info("Unable to get AppKit recent")}return null},deleteRecentWallet(){try{at.removeItem(ft.RECENT_WALLET)}catch{console.info("Unable to delete AppKit recent")}},setConnectedConnectorId(e,t){try{const n=Pk(e);at.setItem(n,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return at.getItem(ft.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{const t=Pk(e);return at.getItem(t)}catch{console.info("Unable to get connected connector id in namespace",e)}},setConnectedSocialProvider(e){try{at.setItem(ft.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return at.getItem(ft.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{at.removeItem(ft.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return at.getItem(ft.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var n;const e=at.getItem(ft.ACTIVE_CAIP_NETWORK_ID);return(n=e==null?void 0:e.split(":"))==null?void 0:n[1]},setConnectionStatus(e){try{at.setItem(ft.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return at.getItem(ft.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const e=at.getItem(ft.CONNECTED_NAMESPACES);return e!=null&&e.length?e.split(","):[]}catch{return[]}},setConnectedNamespaces(e){try{const t=Array.from(new Set(e));at.setItem(ft.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{const t=xe.getConnectedNamespaces();t.includes(e)||(t.push(e),xe.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{const t=xe.getConnectedNamespaces(),n=t.indexOf(e);n>-1&&(t.splice(n,1),xe.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return at.getItem(ft.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{at.setItem(ft.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{at.removeItem(ft.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{const t=at.getItem(ft.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{const t=xe.getBalanceCache();at.setItem(ft.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{const n=xe.getBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.portfolio))return n.balance;xe.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{const t=xe.getBalanceCache();t[e.caipAddress]=e,at.setItem(ft.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{const t=at.getItem(ft.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{const t=xe.getBalanceCache();at.setItem(ft.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{const n=xe.getNativeBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.nativeBalance))return n;console.info("Discarding cache for address",e),xe.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{const t=xe.getNativeBalanceCache();t[e.caipAddress]=e,at.setItem(ft.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{const t=at.getItem(ft.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e},getEnsFromCacheForAddress(e){try{const n=xe.getEnsCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.ens))return n.ens;xe.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{const t=xe.getEnsCache();t[e.address]=e,at.setItem(ft.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{const t=xe.getEnsCache();at.setItem(ft.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{const t=at.getItem(ft.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{const n=xe.getIdentityCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.identity))return n.identity;xe.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{const t=xe.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},at.setItem(ft.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{const t=xe.getIdentityCache();at.setItem(ft.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},getTonWalletsCache(){try{const e=at.getItem(ft.TON_WALLETS_CACHE),t=e?JSON.parse(e):void 0;if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.tonWallets))return t;xe.removeTonWalletsCache()}catch{console.info("Unable to get ton wallets cache")}},updateTonWalletsCache(e){try{const t=xe.getTonWalletsCache()||{timestamp:0,wallets:[]};t.timestamp=new Date().getTime(),t.wallets=e,at.setItem(ft.TON_WALLETS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ton wallets cache",e)}},removeTonWalletsCache(){try{at.removeItem(ft.TON_WALLETS_CACHE)}catch{console.info("Unable to remove ton wallets cache")}},clearAddressCache(){try{at.removeItem(ft.PORTFOLIO_CACHE),at.removeItem(ft.NATIVE_BALANCE_CACHE),at.removeItem(ft.ENS_CACHE),at.removeItem(ft.IDENTITY_CACHE),at.removeItem(ft.HISTORY_TRANSACTIONS_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(e){try{at.setItem(ft.PREFERRED_ACCOUNT_TYPES,JSON.stringify(e))}catch{console.info("Unable to set preferred account types",e)}},getPreferredAccountTypes(){try{const e=at.getItem(ft.PREFERRED_ACCOUNT_TYPES);return e?JSON.parse(e):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(e,t){try{const n=xe.getConnections(),r=n[t]??[],s=new Map;for(const o of r)s.set(o.connectorId,{...o});for(const o of e){const a=s.get(o.connectorId),c=o.connectorId===he.CONNECTOR_ID.AUTH;if(a&&!c){const l=new Set(a.accounts.map(d=>d.address.toLowerCase())),u=o.accounts.filter(d=>!l.has(d.address.toLowerCase()));a.accounts.push(...u)}else s.set(o.connectorId,{...o})}const i={...n,[t]:Array.from(s.values())};at.setItem(ft.CONNECTIONS,JSON.stringify(i))}catch(n){console.error("Unable to sync connections to storage",n)}},getConnections(){try{const e=at.getItem(ft.CONNECTIONS);return e?JSON.parse(e):{}}catch(e){return console.error("Unable to get connections from storage",e),{}}},deleteAddressFromConnection({connectorId:e,address:t,namespace:n}){try{const r=xe.getConnections(),s=r[n]??[],i=new Map(s.map(a=>[a.connectorId,a])),o=i.get(e);o&&(o.accounts.filter(c=>c.address.toLowerCase()!==t.toLowerCase()).length===0?i.delete(e):i.set(e,{...o,accounts:o.accounts.filter(c=>c.address.toLowerCase()!==t.toLowerCase())})),at.setItem(ft.CONNECTIONS,JSON.stringify({...r,[n]:Array.from(i.values())}))}catch{console.error(`Unable to remove address "${t}" from connector "${e}" in namespace "${n}"`)}},getDisconnectedConnectorIds(){try{const e=at.getItem(ft.DISCONNECTED_CONNECTOR_IDS);return e?JSON.parse(e):{}}catch{console.info("Unable to get disconnected connector ids")}return{}},addDisconnectedConnectorId(e,t){try{const n=xe.getDisconnectedConnectorIds(),r=n[t]??[];r.push(e),at.setItem(ft.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[t]:Array.from(new Set(r))}))}catch{console.error(`Unable to set disconnected connector id "${e}" for namespace "${t}"`)}},removeDisconnectedConnectorId(e,t){try{const n=xe.getDisconnectedConnectorIds();let r=n[t]??[];r=r.filter(s=>s.toLowerCase()!==e.toLowerCase()),at.setItem(ft.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[t]:Array.from(new Set(r))}))}catch{console.error(`Unable to remove disconnected connector id "${e}" for namespace "${t}"`)}},isConnectorDisconnected(e,t){try{return(xe.getDisconnectedConnectorIds()[t]??[]).some(s=>s.toLowerCase()===e.toLowerCase())}catch{console.info(`Unable to get disconnected connector id "${e}" for namespace "${t}"`)}return!1},getTransactionsCache(){try{const e=at.getItem(ft.HISTORY_TRANSACTIONS_CACHE);return e?JSON.parse(e):{}}catch{console.info("Unable to get transactions cache")}return{}},getTransactionsCacheForAddress({address:e,chainId:t=""}){var n;try{const s=(n=xe.getTransactionsCache()[e])==null?void 0:n[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.transactionsHistory)
26)return s.transactions;xe.removeTransactionsCache({address:e,chainId:t})}catch{console.info("Unable to get transactions cache")}},updateTransactionsCache({address:e,chainId:t="",timestamp:n,transactions:r}){try{const s=xe.getTransactionsCache();s[e]={...s[e],[t]:{timestamp:n,transactions:r}},at.setItem(ft.HISTORY_TRANSACTIONS_CACHE,JSON.stringify(s))}catch{console.info("Unable to update transactions cache",{address:e,chainId:t,timestamp:n,transactions:r})}},removeTransactionsCache({address:e,chainId:t}){try{const n=xe.getTransactionsCache(),r=(n==null?void 0:n[e])||{},{[t]:s,...i}=r;at.setItem(ft.HISTORY_TRANSACTIONS_CACHE,JSON.stringify({...n,[e]:i}))}catch{console.info("Unable to remove transactions cache",{address:e,chainId:t})}},getTokenPriceCache(){try{const e=at.getItem(ft.TOKEN_PRICE_CACHE);return e?JSON.parse(e):{}}catch{console.info("Unable to get token price cache")}return{}},getTokenPriceCacheForAddresses(e){try{const n=xe.getTokenPriceCache()[e.join(",")];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.tokenPrice))return n.tokenPrice;xe.removeTokenPriceCache(e)}catch{console.info("Unable to get token price cache for addresses",e)}},updateTokenPriceCache(e){try{const t=xe.getTokenPriceCache();t[e.addresses.join(",")]={timestamp:e.timestamp,tokenPrice:e.tokenPrice},at.setItem(ft.TOKEN_PRICE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update token price cache",e)}},removeTokenPriceCache(e){try{const t=xe.getTokenPriceCache();at.setItem(ft.TOKEN_PRICE_CACHE,JSON.stringify({...t,[e.join(",")]:void 0}))}catch{console.info("Unable to remove token price cache",e)}},getLatestAppKitVersion(){try{const e=this.getLatestAppKitVersionCache(),t=e==null?void 0:e.version;return t&&!this.isCacheExpired(e.timestamp,this.cacheExpiry.latestAppKitVersion)?t:void 0}catch{console.info("Unable to get latest AppKit version")}},getLatestAppKitVersionCache(){try{const e=at.getItem(ft.LATEST_APPKIT_VERSION);return e?JSON.parse(e):{}}catch{console.info("Unable to get latest AppKit version cache")}return{}},updateLatestAppKitVersion(e){try{const t=xe.getLatestAppKitVersionCache();t.timestamp=e.timestamp,t.version=e.version,at.setItem(ft.LATEST_APPKIT_VERSION,JSON.stringify(t))}catch{console.info("Unable to update latest AppKit version on local storage",e)}}},Je={getWindow(){if(!(typeof window>"u"))return window},isMobile(){var e;return this.isClient()?!!(window!=null&&window.matchMedia&&typeof window.matchMedia=="function"&&((e=window.matchMedia("(pointer:coarse)"))!=null&&e.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(e,t=""){return e==null?void 0:e.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return Je.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(e){return e?e-Date.now()<=mn.TEN_SEC_MS:!0},isAllowedRetry(e,t=mn.ONE_SEC_MS){return Date.now()-e>=t},copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var e,t;if(Je.isClient()&&window.self!==window.top)try{const n=(t=(e=window==null?void 0:window.location)==null?void 0:e.ancestorOrigins)==null?void 0:t[0],r="https://app.safe.global";if(n){const s=new URL(n),i=new URL(r);return s.hostname===i.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+mn.FOUR_MINUTES_MS},getNetworkId(e){return e==null?void 0:e.split(":")[1]},getPlainAddress(e){return e==null?void 0:e.split(":")[2]},async wait(e){return new Promise(t=>{setTimeout(t,e)})},debounce(e,t=500){let n;return(...r)=>{function s(){e(...r)}n&&clearTimeout(n),n=setTimeout(s,t)}},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},formatNativeUrl(e,t,n=null){if(Je.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e,s=n;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),s&&!(s!=null&&s.endsWith("/"))&&(s=`${s}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));const i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,redirectUniversalLink:s?`${s}wc?uri=${i}`:void 0,href:r}},formatUniversalUrl(e,t){if(!Je.isHttpUrl(e))return this.formatNativeUrl(e,t);let n=e;n.endsWith("/")||(n=`${n}/`);const r=encodeURIComponent(t);return{redirect:`${n}wc?uri=${r}`,href:n}},getOpenTargetForPlatform(e){return e==="popupWindow"?e:this.isTelegram()?xe.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,n){window==null||window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},returnOpenHref(e,t,n){return window==null?void 0:window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var n,r;if(typeof window>"u")return!1;const e=window!=null&&window.matchMedia&&typeof window.matchMedia=="function"?(n=window.matchMedia("(display-mode: standalone)"))==null?void 0:n.matches:!1,t=(r=window==null?void 0:window.navigator)==null?void 0:r.standalone;return!!(e||t)},async preloadImage(e){const t=new Promise((n,r)=>{const s=new Image;s.onload=n,s.onerror=r,s.crossOrigin="anonymous",s.src=e});return Promise.race([t,Je.wait(2e3)])},parseBalance(e,t){let n="0.000";if(typeof e=="string"){const c=Number(e);if(!isNaN(c)){const l=(Math.floor(c*1e3)/1e3).toFixed(3);l&&(n=l)}}const[r,s]=n.split("."),i=r||"0",o=s||"000";return{formattedText:`${i}.${o}${t?` ${t}`:""}`,value:i,decimals:o,symbol:t}},getApiUrl(){return he.W3M_API_URL},getBlockchainApiUrl(){return he.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return he.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},parseError(e){var t,n;return typeof e=="string"?e:typeof((n=(t=e==null?void 0:e.issues)==null?void 0:t[0])==null?void 0:n.message)=="str
26ing"?e.issues[0].message:e instanceof Error?e.message:"Unknown error"},sortRequestedNetworks(e,t=[]){const n={};return t&&e&&(e.forEach((r,s)=>{n[r]=s}),t.sort((r,s)=>{const i=n[r.id],o=n[s.id];return i!==void 0&&o!==void 0?i-o:i!==void 0?-1:o!==void 0?1:0})),t},calculateBalance(e){let t=0;for(const n of e)t+=n.value??0;return t},formatTokenBalance(e){const t=e.toFixed(2),[n,r]=t.split(".");return{dollars:n,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);case"bip122":{const n=/^[1][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(e),r=/^[3][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(e),s=/^bc1[a-z0-9]{39,87}$/u.test(e),i=/^bc1p[a-z0-9]{58}$/u.test(e);return n||r||s||i}default:return!1}},uniqueBy(e,t){const n=new Set;return e.filter(r=>{const s=r[t];return n.has(s)?!1:(n.add(s),!0)})},generateSdkVersion(e,t,n){const s=e.length===0?mn.ADAPTER_TYPES.UNIVERSAL:e.map(i=>i.adapterType).join(",");return`${t}-${s}-${n}`},createAccount(e){const{chainNamespace:t,chainId:n,address:r}=Ci.parseCaipAddress(e.caipAddress);return{namespace:t,address:r,chainId:n,caipAddress:e.caipAddress,type:e.type,publicKey:e.publicKey,path:e.path}},isCaipAddress(e){if(typeof e!="string")return!1;const t=e.split(":"),n=t[0];return t.filter(Boolean).length===3&&n in he.CHAIN_NAME_MAP},getAccount(e){return e?typeof e=="string"?{address:e,chainId:void 0}:{address:e.address,chainId:e.chainId}:{address:void 0,chainId:void 0}},isMac(){const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){const t=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,n="state=";if(new URL(e).host==="auth.magic.link"){const s="provider_authorization_url=",i=e.substring(e.indexOf(s)+s.length),o=this.injectIntoUrl(decodeURIComponent(i),n,t);return e.replace(i,encodeURIComponent(o))}return this.injectIntoUrl(e,n,t)},injectIntoUrl(e,t,n){const r=e.indexOf(t);if(r===-1)throw new Error(`${t} parameter not found in the URL: ${e}`);const s=e.indexOf("&",r),i=t.length,o=s!==-1?s:e.length,a=e.substring(0,r+i),c=e.substring(r+i,o),l=e.substring(s),u=c+n;return a+u+l},isNumber(e){return typeof e!="number"&&typeof e!="string"?!1:!isNaN(Number(e))},appendPayToUri(e,t){return t?`${e}&pay=${encodeURIComponent(t)}`:e}},xS={STORAGE_KEY:"@appkit-wallet/",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS"},Lp={ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}},fQe={set(e,t){Ok.isClient&&localStorage.setItem(`${xS.STORAGE_KEY}${e}`,t)},get(e){return Ok.isClient?localStorage.getItem(`${xS.STORAGE_KEY}${e}`):null},delete(e,t){Ok.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${xS.STORAGE_KEY}${e}`))}},Ok={isClient:typeof window<"u"};function St(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:i=>t(e,i)}function Od(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new m0e(e.type);return`${e.name}(${L7(e.inputs,{includeName:t})})`}function L7(e,{includeName:t=!1}={}){return e?e.map(n=>pQe(n,{includeName:t})).join(t?", ":","):""}function pQe(e,{includeName:t}){return e.type.startsWith("tuple")?`(${L7(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Cu(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Qr(e){return Cu(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const r0e="2.47.6";let W3={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${r0e}`},ve=class sM extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof sM?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof sM&&n.cause.docsPath||n.docsPath,i=(a=W3.getDocsUrl)==null?void 0:a.call(W3,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...W3.version?[`Version: ${W3.version}`]:[]].join(` 27`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=r0e}walk(t){return s0e(this,t)}};function s0e(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?s0e(e.cause,t):t?null:e}let i0e=class extends ve{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` 28`),{docsPath:t,name:"AbiConstructorNotFoundError"})}},iM=class extends ve{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` 29`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}},kW=class extends ve{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(` 30`),{metaMessages:[`Params: (${L7(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}},N6=class extends ve{constructor({cause:t}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:t})}},o0e=class extends ve{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
31`),{name:"AbiEncodingArrayLengthMismatchError"})}},a0e=class extends ve{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${Qr(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},c0e=class extends ve{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(` 32`),{name:"AbiEncodingLengthMismatchError"})}},l0e=class extends ve{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(` 33`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}},oM=class extends ve{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(` 34`),{docsPath:n,name:"AbiErrorNotFoundError"})}},RW=class extends ve{constructor(t,{docsPath:n,cause:r}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 35`),{docsPath:n,name:"AbiErrorSignatureNotFoundError",cause:r}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}},u0e=class extends ve{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}},d0e=class extends ve{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 36`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}},aM=class extends ve{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(` 37`),{docsPath:n,name:"AbiEventNotFoundError"})}},Gw=class extends ve{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` 38`),{docsPath:n,name:"AbiFunctionNotFoundError"})}},BW=class extends ve{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(` 39`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}},h0e=class extends ve{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 40`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}},gQe=class extends ve{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Od(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Od(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}},f0e=class extends ve{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}},G8=class extends ve{constructor({abiItem:t,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(` 41`),{metaMessages:[`Params: (${L7(r,{includeName:!0})})`,`Data: ${n} (${s} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=s}},M7=class extends ve{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Od(t,{includeName:!0})}".`].join(` 42`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}},p0e=class extends ve{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` 43`),{docsPath:n,name:"InvalidAbiEncodingType"})}},g0e=class extends ve{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` 44`),{docsPath:n,name:"InvalidAbiDecodingType"})}},DW=class extends ve{constructor(t){super([`Value "${t}" is not a valid array.`].join(` 45`),{name:"InvalidArrayError"})}},m0e=class extends ve{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` 46`),{name:"InvalidDefinitionTypeError"})}},w0e=class extends ve{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}},UW=class extends ve{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},LW=class extends ve{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}},_ee=class extends ve{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}};function ub(e,{dir:t,size:n=32}={}){return typeof e=="string"?r0(e,{dir:t,size:n}):y0e(e,{dir:t,size:n})}function r0(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new LW({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function y0e(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new LW({size:e.length,targetSize:n,type:"bytes"});
46const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let j7=class extends ve{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},b0e=class extends ve{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}},v0e=class extends ve{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}},E0e=class extends ve{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function vm(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function sh(e,{size:t}){if(Qr(e)>t)throw new E0e({givenSize:Qr(e),maxSize:t})}function kd(e,t={}){const{signed:n}=t;t.size&&sh(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function C0e(e,t={}){let n=e;if(t.size&&(sh(n,{size:t.size}),n=vm(n)),vm(n)==="0x00")return!1;if(vm(n)==="0x01")return!0;throw new v0e(n)}function sf(e,t={}){const n=kd(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new j7({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const mQe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Rd(e,t={}){return typeof e=="number"||typeof e=="bigint"?kt(e,t):typeof e=="string"?d5(e,t):typeof e=="boolean"?MW(e,t):Rs(e,t)}function MW(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(sh(n,{size:t.size}),ub(n,{size:t.size})):n}function Rs(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=mQe[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(sh(r,{size:t.size}),ub(r,{dir:"right",size:t.size})):r}function kt(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new j7({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?ub(a,{size:r}):a}const wQe=new TextEncoder;function d5(e,t={}){const n=wQe.encode(e);return Rs(n,t)}const yQe=new TextEncoder;function db(e,t={}){return typeof e=="number"||typeof e=="bigint"?x0e(e,t):typeof e=="boolean"?$0e(e,t):Cu(e)?Bd(e,t):Em(e,t)}function $0e(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(sh(n,{size:t.size}),ub(n,{size:t.size})):n}const Mf={zero:48,nine:57,A:65,F:70,a:97,f:102};function Nee(e){if(e>=Mf.zero&&e<=Mf.nine)return e-Mf.zero;if(e>=Mf.A&&e<=Mf.F)return e-(Mf.A-10);if(e>=Mf.a&&e<=Mf.f)return e-(Mf.a-10)}function Bd(e,t={}){let n=e;t.size&&(sh(n,{size:t.size}),n=ub(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=Nee(r.charCodeAt(a++)),l=Nee(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new ve(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[o]=c*16+l}return i}function x0e(e,t){const n=kt(e,t);return Bd(n)}function Em(e,t={}){const n=yQe.encode(e);return typeof t.size=="number"?(sh(n,{size:t.size}),ub(n,{dir:"right",size:t.size})):n}function Ii(e,t){const n=t||"hex",r=U0(Cu(e,{strict:!1})?db(e):e);return n==="bytes"?r:Rd(r)}const bQe=e=>Ii(db(e));function vQe(e){return bQe(e)}function EQe(e){let t=!0,n="",r=0,s="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new ve("Unable to normalize signature.");return s}const TE=e=>{const t=typeof e=="string"?e:vu(e);return EQe(t)};function $9(e){return vQe(TE(e))}const h5=$9;let v0=class extends ve{constructor({address:t}){super(`Address "${t}
46" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},F7=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,n)),n}set(t,n){if(super.has(t)&&super.delete(t),super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=super.keys().next().value;r!==void 0&&super.delete(r)}return this}};const kk=new F7(8192);function qC(e,t){if(kk.has(`${e}.${t}`))return kk.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ii(Em(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const i=`0x${s.join("")}`;return kk.set(`${e}.${t}`,i),i}function Z8(e,t){if(!hl(e,{strict:!1}))throw new v0({address:e});return qC(e,t)}const CQe=/^0x[a-fA-F0-9]{40}$/,Rk=new F7(8192);function hl(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Rk.has(r))return Rk.get(r);const s=CQe.test(e)?e.toLowerCase()===e?!0:n?qC(e)===e:!0:!1;return Rk.set(r,s),s}function $u(e){return typeof e[0]=="string"?hb(e):I0e(e)}function I0e(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function hb(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Hm(e,t,n,{strict:r}={}){return Cu(e,{strict:!1})?_0e(e,t,n,{strict:r}):jW(e,t,n,{strict:r})}function S0e(e,t){if(typeof t=="number"&&t>0&&t>Qr(e)-1)throw new UW({offset:t,position:"start",size:Qr(e)})}function A0e(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Qr(e)!==n-t)throw new UW({offset:n,position:"end",size:Qr(e)})}function jW(e,t,n,{strict:r}={}){S0e(e,t);const s=e.slice(t,n);return r&&A0e(s,t,n),s}function _0e(e,t,n,{strict:r}={}){S0e(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&A0e(s,t,n),s}const $Qe=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,N0e=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function F0(e,t){if(e.length!==t.length)throw new c0e({expectedLength:e.length,givenLength:t.length});const n=xQe({params:e,values:t}),r=zW(n);return r.length===0?"0x":r}function xQe({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(FW({param:e[r],value:t[r]}));return n}function FW({param:e,value:t}){const n=qW(e.type);if(n){const[r,s]=n;return SQe(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return PQe(t,{param:e});if(e.type==="address")return IQe(t);if(e.type==="bool")return _Qe(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=N0e.exec(e.type)??[];return NQe(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return AQe(t,{param:e});if(e.type==="string")return TQe(t);throw new p0e(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function zW(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=Qr(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(kt(t+s,{size:32})),r.push(a),s+=Qr(a)):n.push(a)}return $u([...n,...r])}function IQe(e){if(!hl(e))throw new v0({address:e});return{dynamic:!1,encoded:r0(e.toLowerCase())}}function SQe(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new DW(e);if(!r&&e.length!==t)throw new o0e({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const i=[];for(let o=0;o<e.length;o++){const a=FW({param:n,value:e[o]});a.dynamic&&(s=!0),i.push(a)}if(r||s){const o=zW(i);if(r){const a=kt(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?$u([a,o]):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:$u(i.map(({encoded:o})=>o))}}function AQe(e,{param:t}){const[,n]=t.type.split("bytes"),r=Qr(e);if(!n){let s=e;return r%32!==0&&(s=r0(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:$u([r0(kt(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new a0e({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:r0(e,{dir:"right"})}}function _Qe(e){if(typeof e!="boolean")throw new ve(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:r0(MW(e))}}function NQe(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new j7({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:kt(e,{size:32,signed:t})}}function TQe(e){const t=d5(e),n=Math.ceil(Qr(t)/32),r=[];for(let s=0;s<n;s++)r.push(r0(Hm(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:$u([r0(kt(Qr(t),{size:32})),...r])}}function PQe(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;
46s++){const i=t.components[s],o=Array.isArray(e)?s:i.name,a=FW({param:i,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?zW(r):$u(r.map(({encoded:s})=>s))}}function qW(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Zw=e=>Hm($9(e),0,4);function f1(e){const{abi:t,args:n=[],name:r}=e,s=Cu(r,{strict:!1}),i=t.filter(a=>s?a.type==="function"?Zw(a)===r:a.type==="event"?h5(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let o;for(const a of i){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((l,u)=>{const d="inputs"in a&&a.inputs[u];return d?cM(l,d):!1})){if(o&&"inputs"in o&&o.inputs){const l=T0e(a.inputs,o.inputs,n);if(l)throw new gQe({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||i[0]}function cM(e,t){const n=typeof e,r=t.type;switch(r){case"address":return hl(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>n==="object"&&cM(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>cM(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function T0e(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return T0e(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?hl(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?hl(n[r],{strict:!1}):!1)return o}}const Tee="/docs/contract/encodeEventTopics";function T6(e){var c;const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const l=f1({abi:t,name:n});if(!l)throw new aM(n,{docsPath:Tee});s=l}if(s.type!=="event")throw new aM(void 0,{docsPath:Tee});const i=Od(s),o=h5(i);let a=[];if(r&&"inputs"in s){const l=(c=s.inputs)==null?void 0:c.filter(d=>"indexed"in d&&d.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(d=>r[d.name]))??[]:[];u.length>0&&(a=(l==null?void 0:l.map((d,h)=>Array.isArray(u[h])?u[h].map((f,g)=>Pee({param:d,value:u[h][g]})):typeof u[h]<"u"&&u[h]!==null?Pee({param:d,value:u[h]}):null))??[])}return[o,...a]}function Pee({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ii(db(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new w0e(e.type);return F0([e],[t])}function z7(e,{method:t}){var r,s;const n={};return e.transport.type==="fallback"&&((s=(r=e.transport).onResponse)==null||s.call(r,({method:i,response:o,status:a,transport:c})=>{a==="success"&&t===i&&(n[o]=c.request)})),(i=>n[i]||e.request)}async function P0e(e,t){const{address:n,abi:r,args:s,eventName:i,fromBlock:o,strict:a,toBlock:c}=t,l=z7(e,{method:"eth_newFilter"}),u=i?T6({abi:r,args:s,eventName:i}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?kt(o):o,toBlock:typeof c=="bigint"?kt(c):c,topics:u}]});return{abi:r,args:s,eventName:i,id:d,request:l(d),strict:!!a,type:"event"}}function fl(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Oee="/docs/contract/encodeFunctionData";function O0e(e){const{abi:t,args:n,functionName:r}=e;let s=t[0];if(r){const i=f1({abi:t,args:n,name:r});if(!i)throw new Gw(r,{docsPath:Oee});s=i}if(s.type!=="function")throw new Gw(void 0,{docsPath:Oee});return{abi:[s],functionName:Zw(Od(s))}}function Al(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var a;return e.abi.length===1&&((a=e.functionName)!=null&&a.startsWith("0x"))?e:O0e(e)})(),s=n[0],i=r,o="inputs"in s&&s.inputs?F0(s.inputs,t??[]):void 0;return hb([i,o??"0x"])}
46const OQe={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},k0e={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},kQe={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let kee=class extends ve{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},R0e=class extends ve{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},RQe=class extends ve{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const BQe={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new RQe({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new R0e({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new kee({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new kee({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function WW(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(BQe);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function B0e(e,t={}){typeof t.size<"u"&&sh(e,{size:t.size});const n=Rs(e,t);return kd(n,t)}function D0e(e,t={}){let n=e;if(typeof t.size<"u"&&(sh(n,{size:t.size}),n=vm(n)),n.length>1||n[0]>1)throw new b0e(n);return!!n[0]}function Kh(e,t={}){typeof t.size<"u"&&sh(e,{size:t.size});const n=Rs(e,t);return sf(n,t)}function U0e(e,t={}){let n=e;return typeof t.size<"u"&&(sh(n,{size:t.size}),n=vm(n,{dir:"right"})),new TextDecoder().decode(n)}function P6(e,t){const n=typeof t=="string"?Bd(t):t,r=WW(n);if(Qr(n)===0&&e.length>0)throw new N6;if(Qr(t)&&Qr(t)<32)throw new kW({data:typeof t=="string"?t:Rs(t),params:e,size:Qr(t)});let s=0;const i=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(s);const[c,l]=Fv(r,a,{staticPosition:0});s+=l,i.push(c)}return i}function Fv(e,t,{staticPosition:n}){const r=qW(t.type);if(r){const[s,i]=r;return UQe(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return FQe(e,t,{staticPosition:n});if(t.type==="address")return DQe(e);if(t.type==="bool")return LQe(e);if(t.type.startsWith("bytes"))return MQe(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return jQe(e,t);if(t.type==="string")return zQe(e,{staticPosition:n});throw new g0e(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Ree=32,lM=32;function DQe(e){const t=e.readBytes(32);return[qC(Rs(jW(t,-20))),32]}function UQe(e,t,{length:n,staticPosition:r}){if(!n){const o=Kh(e.readBytes(lM)),a=r+o,c=a+Ree;e.setPosition(a);const l=Kh(e.readBytes(Ree)),u=Y8(t);let d=0;const h=[];for(let f=0;f<l;++f){e.setPosition(c+(u?f*32:d));const[g,p]=Fv(e,t,{staticPosition:c});d+=p,h.push(g)}return e.setPosition(r+32),[h,32]}if(Y8(t)){const o=Kh(e.readBytes(lM)),a=r+o,c=[];for(let l=0;l<n;++l){e.setPosition(a+l*32);const[u]=Fv(e,t,{staticPosition:a});c.push(u)}return e.setPosition(r+32),[c,32]}let s=0;const i=[];for(let o=0;o<n;++o){const[a,c]=Fv(e,t,{staticPosition:r+s});s+=c,i.push(a)}return[i,s]}function LQe(e){return[D0e(e.readBytes(32),{size:32}),32]}function MQe(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=Kh(e.readBytes(32));e.setPosition(n+o);const a=Kh(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Rs(c),32]}return[Rs(e.readBytes(Number.parseInt(s,10),32)),32]}function jQe(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?B0e(s,{signed:n}):Kh(s,{signed:n}),32]}function FQe(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),s=r?[]:{};let i=0;if(Y8(t)){const o=Kh(e.readBytes(lM)),a=n+o;for(let c=0;c<t.components.length;++c){const l=t.components[c];e.setPosition(a+i);const[u,d]=Fv(e,l,{staticPosition:a});i+=d,s[r?c:l==null?void 0:l.name]=u}return e.setPosition(n+32),[s,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,l]=Fv(e,a,{staticPosition:n});s[r?o:a==null?void 0:a.name]=c,i+=l}return[s,i]}function zQe(e,{staticPosition:t}){const n=Kh(e.readBytes(32)),r=t+n;e.setPosition(r);const s=Kh(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=U0e(vm(i));return e.setPosition(t+32),[o,32]}function Y8(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;
46if(t==="tuple")return(r=e.components)==null?void 0:r.some(Y8);const n=qW(e.type);return!!(n&&Y8({...e,type:n[1]}))}function HW(e){const{abi:t,data:n,cause:r}=e,s=Hm(n,0,4);if(s==="0x")throw new N6({cause:r});const o=[...t||[],k0e,kQe].find(a=>a.type==="error"&&s===Zw(Od(a)));if(!o)throw new RW(s,{docsPath:"/docs/contract/decodeErrorResult",cause:r});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?P6(o.inputs,Hm(n,4)):void 0,errorName:o.name}}const Ps=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n);function L0e({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((s,i)=>`${r&&s.name?`${s.name}: `:""}${typeof t[i]=="object"?Ps(t[i]):t[i]}`).join(", ")})`}const M0e={gwei:9,wei:18},j0e={ether:-9,wei:9};function WC(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${i?`.${i}`:""}`}function q7(e,t="wei"){return WC(e,M0e[t])}function na(e,t="wei"){return WC(e,j0e[t])}let F0e=class extends ve{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}},z0e=class extends ve{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}};function Bee(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r} 47`,"")}function qQe(e){return e.reduce((t,{address:n,...r})=>{let s=`${t} ${n}: 48`;return r.nonce&&(s+=` nonce: ${r.nonce} 49`),r.balance&&(s+=` balance: ${r.balance} 50`),r.code&&(s+=` code: ${r.code} 51`),r.state&&(s+=` state: 52`,s+=Bee(r.state)),r.stateDiff&&(s+=` stateDiff: 53`,s+=Bee(r.stateDiff)),s},` State Override: 54`).slice(0,-1)}function HC(e){const t=Object.entries(e).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=t.reduce((r,[s])=>Math.max(r,s.length),0);return t.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(` 55`)}let q0e=class extends ve{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",HC(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}},W0e=class extends ve{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h}){var g;const f=HC({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${q7(h)} ${((g=s==null?void 0:s.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${na(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${na(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${na(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",f].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},VW=class extends ve{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i}){let o="Transaction";r&&i!==void 0&&(o=`Transaction at block time "${r}" at index "${i}"`),t&&i!==void 0&&(o=`Transaction at block hash "${t}" at index "${i}"`),n&&i!==void 0&&(o=`Transaction at block number "${n}" at index "${i}"`),s&&(o=`Transaction with hash "${s}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}},KW=class extends ve{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}},WQe=class extends ve{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}},H0e=class extends ve{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}};const HQe=e=>e,VC=e=>e;let GW=class extends ve{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h,stateOverride:f}){var m;const g=n?fl(n):void 0;let p=HC({from:g==null?void 0:g.address,to:d,value:typeof h<"u"&&`${q7(h)} ${((m=s==null?void 0:s.nativeCurrency)==null?void 0:m.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${na(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${na(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${na(l)} gwei`,nonce:u});f&&(p+=` 56${qQe(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",p].filter(
56Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},ZW=class extends ve{constructor(t,{abi:n,args:r,contractAddress:s,docsPath:i,functionName:o,sender:a}){const c=f1({abi:n,args:r,name:o}),l=c?L0e({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=c?Od(c,{includeName:!0}):void 0,d=HC({address:s&&HQe(s),function:u,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=s,this.functionName=o,this.sender=a}},x9=class extends ve{constructor({abi:t,data:n,functionName:r,message:s,cause:i}){let o,a,c,l;if(n&&n!=="0x")try{a=HW({abi:t,data:n,cause:i});const{abiItem:d,errorName:h,args:f}=a;if(h==="Error")l=f[0];else if(h==="Panic"){const[g]=f;l=OQe[g]}else{const g=d?Od(d,{includeName:!0}):void 0,p=d&&f?L0e({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[g?`Error: ${g}`:"",p&&p!=="()"?` ${[...Array((h==null?void 0:h.length)??0).keys()].map(()=>" ").join("")}${p}`:""]}}catch(d){o=d}else s&&(l=s);let u;o instanceof RW&&(u=o.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${u}.`]),super(l&&l!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,l||u].join(` 57`):`The contract function "${r}" reverted.`,{cause:o??i,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=n,this.reason=l,this.signature=u}},V0e=class extends ve{constructor({functionName:t,cause:n}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:n})}},K0e=class extends ve{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}},KC=class extends ve{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}},Cm=class extends ve{constructor({body:t,cause:n,details:r,headers:s,status:i,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${VC(o)}`,t&&`Request body: ${Ps(t)}
57`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=s,this.status=i,this.url=o}},W7=class extends ve{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${VC(r)}`,`Request body: ${Ps(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}},uM=class extends ve{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${VC(n)}`,`Request body: ${Ps(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}};const VQe=-1;let ga=class extends ve{constructor(t,{code:n,docsPath:r,metaMessages:s,name:i,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:s||(t==null?void 0:t.metaMessages),name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||t.name,this.code=t instanceof W7?t.code:n??VQe}},ma=class extends ga{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}},I9=class G0e extends ga{constructor(t){super(t,{code:G0e.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}};Object.defineProperty(I9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let S9=class Z0e extends ga{constructor(t){super(t,{code:Z0e.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}};Object.defineProperty(S9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let A9=class Y0e extends ga{constructor(t,{method:n}={}){super(t,{code:Y0e.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}};Object.defineProperty(A9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let _9=class J0e extends ga{constructor(t){super(t,{code:J0e.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` 58`)})}};Object.defineProperty(_9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let f5=class X0e extends ga{constructor(t){super(t,{code:X0e.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}};Object.defineProperty(f5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let Yw=class Q0e extends ga{constructor(t){super(t,{code:Q0e.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` 59`)})}};Object.defineProperty(Yw,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let N9=class ege extends ga{constructor(t){super(t,{code:ege.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(N9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let T9=class tge extends ga{constructor(t){super(t,{code:tge.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}};Object.defineProperty(T9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let J8=class nge extends ga{constructor(t){super(t,{code:nge.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}};Object.defineProperty(J8,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let mv=class rge extends ga{constructor(t,{method:n}={}){super(t,{code:rge.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}};Object.defineProperty(mv,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let X8=class sge extends ga{constructor(t){super(t,{code:sge.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}};Object.defineProperty(X8,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let P9=class ige extends ga{constructor(t){super(t,{code:ige.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}};Object.defineProperty(P9,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let zv=class oge extends ma{constructor(t){super(t,{code:oge.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(zv,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let O9=class age extends ma{constructor(t){super(t,{code:age.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}};Object.defineProperty(O9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let k9=class cge extends ma{constructor(t,{method:n}={}){super(t,{code:cge.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}};Object.defineProperty(k9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let R9=class lge extends ma{constructor(t){super(t,{code:lge.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}};Object.defineProperty(R9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let B9=class uge extends ma{constructor(t){super(t,{code:uge.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}};Object.defineProperty(B9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});let D9=class dge extends ma{constructor(t){super(t,{code:dge.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}};Object.defineProperty(D9,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let U9=class hge extends ma{constructor(t){super(t,{code:hge.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}};Object.defineProperty(U9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});let L9=class fge extends ma{constructor(t){super(t,{code:fge.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}};Object.defineProperty(L9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});let M9=class pge extends ma{constructor(t){super(t,{code:pge.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}};Object.defineProperty(M9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});let j9=class gge extends ma{constructor(t){super(t,{code:gge.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}};Object.defineProperty(j9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});let F9=class mge extends ma{constructor(t){super(t,{code:mge.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}};Object.defineProperty(F9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});let z9=class wge extends ma{constructor(t){super(t,{code:wge.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}};Object.defineProperty(z9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
59);let q9=class yge extends ma{constructor(t){super(t,{code:yge.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}};Object.defineProperty(q9,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});let W9=class bge extends ma{constructor(t){super(t,{code:bge.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}};Object.defineProperty(W9,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});let vge=class extends ga{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}};const KQe=3;function Jw(e,{abi:t,address:n,args:r,docsPath:s,functionName:i,sender:o}){const a=e instanceof KC?e:e instanceof ve?e.walk(g=>"data"in g)||e.walk():{},{code:c,data:l,details:u,message:d,shortMessage:h}=a,f=e instanceof N6?new V0e({functionName:i,cause:e}):[KQe,f5.code].includes(c)&&(l||u||d||h)||c===Yw.code&&u==="execution reverted"&&l?new x9({abi:t,data:typeof l=="object"?l.data:l,functionName:i,message:a instanceof W7?u:h??d,cause:e}):e;return new ZW(f,{abi:t,args:r,contractAddress:n,docsPath:s,functionName:i,sender:o})}function GQe(e){const t=Ii(`0x${e.substring(4)}`).substring(26);return qC(`0x${t}`)}async function Ege({hash:e,signature:t}){const n=Cu(e)?e:Rd(e),{secp256k1:r}=await te(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>Znt);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:d,yParity:h}=t,f=Number(h??d),g=Dee(f);return new r.Signature(kd(l),kd(u)).addRecoveryBit(g)}const o=Cu(t)?t:Rd(t);if(Qr(o)!==65)throw new Error("invalid signature length");const a=sf(`0x${o.slice(130)}`),c=Dee(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Dee(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function H9({hash:e,signature:t}){return GQe(await Ege({hash:e,signature:t}))}function Cge(e,t="hex"){const n=$ge(e),r=WW(new Uint8Array(n.length));return n.encode(r),t==="hex"?Rs(r.bytes):r.bytes}function $ge(e){return Array.isArray(e)?ZQe(e.map(t=>$ge(t))):YQe(e)}function ZQe(e){const t=e.reduce((s,i)=>s+i.length,0),n=xge(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:i}of e)i(s)}}}function YQe(e){const t=typeof e=="string"?Bd(e):e,n=xge(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function xge(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new ve("Length is too large.")}function JQe(e){const{chainId:t,nonce:n,to:r}=e,s=e.contractAddress??e.address,i=Ii(hb(["0x05",Cge([t?kt(t):"0x",s,n?kt(n):"0x"])]));return r==="bytes"?Bd(i):i}async function Ige(e){const{authorization:t,signature:n}=e;return H9({hash:JQe(t),signature:n??t})}let Sge=class extends ve{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h}){var g;const f=HC({from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${q7(h)} ${((g=s==null?void 0:s.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${na(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${na(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${na(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},cm=class extends ve{constructor({cause:t,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(cm,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(cm,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});let Q8=class extends ve{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${na(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(Q8,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});let V9=class extends ve{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${na(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}};Object.defineProperty(V9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});let K9=class extends ve{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}};Object.defineProperty(K9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});let G9=class extends ve{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` 60`),{cause:t,name:"NonceTooLowError"})}};
60Object.defineProperty(G9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});let Z9=class extends ve{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}};Object.defineProperty(Z9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let Y9=class extends ve{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` 61`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(Y9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});let J9=class extends ve{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(J9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});let X9=class extends ve{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(X9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});let Q9=class extends ve{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(Q9,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});let e4=class extends ve{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${na(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${na(r)} gwei`:""}).`].join(` 62`),{cause:t,name:"TipAboveFeeCapError"})}};Object.defineProperty(e4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});let O6=class extends ve{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}};function H7(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof ve?e.walk(s=>(s==null?void 0:s.code)===cm.code):e;return r instanceof ve?new cm({cause:e,message:r.details}):cm.nodeMessage.test(n)?new cm({cause:e,message:e.details}):Q8.nodeMessage.test(n)?new Q8({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):V9.nodeMessage.test(n)?new V9({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):K9.nodeMessage.test(n)?new K9({cause:e,nonce:t==null?void 0:t.nonce}):G9.nodeMessage.test(n)?new G9({cause:e,nonce:t==null?void 0:t.nonce}):Z9.nodeMessage.test(n)?new Z9({cause:e,nonce:t==null?void 0:t.nonce}):Y9.nodeMessage.test(n)?new Y9({cause:e}):J9.nodeMessage.test(n)?new J9({cause:e,gas:t==null?void 0:t.gas}):X9.nodeMessage.test(n)?new X9({cause:e,gas:t==null?void 0:t.gas}):Q9.nodeMessage.test(n)?new Q9({cause:e}):e4.nodeMessage.test(n)?new e4({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new O6({cause:e})}function XQe(e,{docsPath:t,...n}){const r=(()=>{const s=H7(e,n);return s instanceof O6?e:s})();return new Sge(r,{docsPath:t,...n})}function V7(e,{format:t}){if(!t)return{};const n={};function r(i){const o=Object.keys(i);for(const a of o)a in e&&(n[a]=e[a]),i[a]&&typeof i[a]=="object"&&!Array.isArray(i[a])&&r(i[a])}const s=t(e||{});return r(s),n}const Age={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function k6(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=QQe(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="str
62ing"?n.blobs=e.blobs.map(r=>Rs(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=kt(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=kt(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=kt(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=kt(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=kt(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=kt(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Age[e.type]),typeof e.value<"u"&&(n.value=kt(e.value)),n}function QQe(e){return e.map(t=>({address:t.address,r:t.r?kt(BigInt(t.r)):t.r,s:t.s?kt(BigInt(t.s)):t.s,chainId:kt(t.chainId),nonce:kt(t.nonce),...typeof t.yParity<"u"?{yParity:kt(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:kt(t.v)}:{}}))}function Uee(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new _ee({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new _ee({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function eet(e){const{balance:t,nonce:n,state:r,stateDiff:s,code:i}=e,o={};if(i!==void 0&&(o.code=i),t!==void 0&&(o.balance=kt(t)),n!==void 0&&(o.nonce=kt(n)),r!==void 0&&(o.state=Uee(r)),s!==void 0){if(o.state)throw new z0e;o.stateDiff=Uee(s)}return o}function YW(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!hl(n,{strict:!1}))throw new v0({address:n});if(t[n])throw new F0e({address:n});t[n]=eet(r)}return t}const _ge=2n**256n-1n;function fb(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:s}=e,i=t?fl(t):void 0;if(i&&!hl(i.address))throw new v0({address:i.address});if(s&&!hl(s))throw new v0({address:s});if(n&&n>_ge)throw new Q8({maxFeePerGas:n});if(r&&n&&r>n)throw new e4({maxFeePerGas:n,maxPriorityFeePerGas:r})}let JW=class extends ve{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}},K7=class extends ve{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}},Nge=class extends ve{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${na(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}},XW=class extends ve{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}};const QW={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function G7(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?sf(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?sf(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?QW[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=tet(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function tet(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function eH(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:G7(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLim
62it?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function $d(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:s}={}){var l,u,d;const i=s??!1,o=n!==void 0?kt(n):void 0;let a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,i]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[o||r,i]},{dedupe:!!o}),!a)throw new XW({blockHash:t,blockNumber:n});return(((d=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:d.format)||eH)(a,"getBlock")}async function tH(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function net(e,t){return Tge(e,t)}async function Tge(e,t){var i,o;const{block:n,chain:r=e.chain,request:s}=t||{};try{const a=((i=r==null?void 0:r.fees)==null?void 0:i.maxPriorityFeePerGas)??((o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=n||await St(e,$d,"getBlock")({}),u=await a({block:l,client:e,request:s});if(u===null)throw new Error;return u}if(typeof a<"u")return a;const c=await e.request({method:"eth_maxPriorityFeePerGas"});return kd(c)}catch{const[a,c]=await Promise.all([n?Promise.resolve(n):St(e,$d,"getBlock")({}),St(e,tH,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new K7;const l=c-a.baseFeePerGas;return l<0n?0n:l}}async function ret(e,t){return dM(e,t)}async function dM(e,t){var h,f;const{block:n,chain:r=e.chain,request:s,type:i="eip1559"}=t||{},o=await(async()=>{var g,p;return typeof((g=r==null?void 0:r.fees)==null?void 0:g.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:s}):((p=r==null?void 0:r.fees)==null?void 0:p.baseFeeMultiplier)??1.2})();if(o<1)throw new JW;const c=10**(((h=o.toString().split(".")[1])==null?void 0:h.length)??0),l=g=>g*BigInt(Math.ceil(o*c))/BigInt(c),u=n||await St(e,$d,"getBlock")({});if(typeof((f=r==null?void 0:r.fees)==null?void 0:f.estimateFeesPerGas)=="function"){const g=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:s,type:i});if(g!==null)return g}if(i==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new K7;const g=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await Tge(e,{block:u,chain:r,request:s}),p=l(u.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??p+g,maxPriorityFeePerGas:g}}return{gasPrice:(s==null?void 0:s.gasPrice)??l(await St(e,tH,"getGasPrice")({}))}}async function Pge(e,{address:t,blockTag:n="latest",blockNumber:r}){const s=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?kt(r):n]},{dedupe:!!r});return sf(s)}function nH(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>Bd(i)):e.blobs,s=[];for(const i of r)s.push(Uint8Array.from(t.blobToKzgCommitment(i)));return n==="bytes"?s:s.map(i=>Rs(i))}function rH(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(o=>Bd(o)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(o=>Bd(o)):e.commitments,i=[];for(let o=0;o<r.length;o++){const a=r[o],c=s[o];i.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return n==="bytes"?i:i.map(o=>Rs(o))}function Oge(e,t){return yq(Cu(e,{strict:!1})?db(e):e)}function kge(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),s=Oge(t);return s.set([n],0),r==="bytes"?s:Rs(s)}function Rge(e){const{commitments:t,version:n}=e,r=e.to,s=[];for(const i of t)s.push(kge({commitment:i,to:r,version:n}));return s}const Lee=6,Bge=32,sH=4096,Dge=Bge*sH,Mee=Dge*Lee-1-1*sH*Lee;let set=class extends ve{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}},iet=class extends ve{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}};
62function Uge(e){const t=typeof e.data=="string"?Bd(e.data):e.data,n=Qr(t);if(!n)throw new iet;if(n>Mee)throw new set({maxSize:Mee,size:n});const r=[];let s=!0,i=0;for(;s;){const o=WW(new Uint8Array(Dge));let a=0;for(;a<sH;){const c=t.slice(i,i+(Bge-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),s=!1;break}a++,i+=31}r.push(o)}return r.map(o=>Rs(o.bytes))}function Lge(e){const{data:t,kzg:n,to:r}=e,s=e.blobs??Uge({data:t}),i=e.commitments??nH({blobs:s,kzg:n,to:r}),o=e.proofs??rH({blobs:s,commitments:i,kzg:n,to:r}),a=[];for(let c=0;c<s.length;c++)a.push({blob:s[c],commitment:i[c],proof:o[c]});return a}function Mge(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new q0e({transaction:e})}function oet(e,{docsPath:t,...n}){const r=(()=>{const s=H7(e,n);return s instanceof O6?e:s})();return new W0e(r,{docsPath:t,...n})}async function iH(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return sf(t)}async function jge(e,t){var A,I,O,N,T;const{account:n=e.account,accessList:r,authorizationList:s,chain:i=e.chain,blobVersionedHashes:o,blobs:a,data:c,gas:l,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:f,nonce:g,nonceManager:p,to:m,type:w,value:C,...E}=t,b=await(async()=>{if(!n||!p||typeof g<"u")return g;const P=fl(n),_=i?i.id:await St(e,iH,"getChainId")({});return await p.consume({address:P.address,chainId:_,client:e})})();fb(t);const S=(I=(A=i==null?void 0:i.formatters)==null?void 0:A.transactionRequest)==null?void 0:I.format,x=(S||k6)({...V7(E,{format:S}),account:n?fl(n):void 0,accessList:r,authorizationList:s,blobs:a,blobVersionedHashes:o,data:c,gas:l,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:f,nonce:b,to:m,type:w,value:C},"fillTransaction");try{const P=await e.request({method:"eth_fillTransaction",params:[x]}),y=(((N=(O=i==null?void 0:i.formatters)==null?void 0:O.transaction)==null?void 0:N.format)||G7)(P.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const $=await(async()=>{var D,U;if(typeof((D=i==null?void 0:i.fees)==null?void 0:D.baseFeeMultiplier)=="function"){const F=await St(e,$d,"getBlock")({});return i.fees.baseFeeMultiplier({block:F,client:e,request:t})}return((U=i==null?void 0:i.fees)==null?void 0:U.baseFeeMultiplier)??1.2})();if($<1)throw new JW;const B=10**(((T=$.toString().split(".")[1])==null?void 0:T.length)??0),k=D=>D*BigInt(Math.ceil($*B))/BigInt(B);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=k(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=k(y.gasPrice)),{raw:P.raw,transaction:{from:x.from,...y}}}catch(P){throw oet(P,{...t,chain:e.chain})}}const aet=["blobVersionedHashes","chainId","fees","gas","nonce","type"],jee=new Map,Bk=new F7(128);async function Fge(e,t){var b,S,v;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=aet);const{account:r,chain:s=e.chain,nonceManager:i,parameters:o}=n,a=(()=>{if(typeof(s==null?void 0:s.prepareTransactionRequest)=="function")return{fn:s.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(s==null?void 0:s.prepareTransactionRequest))return{fn:s.prepareTransactionRequest[0],runAt:s.prepareTransactionRequest[1].runAt}})();let c;async function l(){return c||(typeof n.chainId<"u"?n.chainId:s?s.id:(c=await St(e,iH,"getChainId")({}),c))}const u=r&&fl(r);let d=n.nonce;if(o.includes("nonce")&&typeof d>"u"&&u&&i){const x=await l();d=await i.consume({address:u.address,chainId:x,client:e})}a!=null&&a.fn&&((b=a.runAt)!=null&&b.includes("beforeFillTransaction"))&&(n=await a.fn({...n,chain:s},{phase:"beforeFillTransaction"}),d??(d=n.nonce));const f=((o.includes("blobVersionedHashes")||o.includes("sidecars"))&&n.kzg&&n.blobs||Bk.get(e.uid)===!1||!["fees","gas"].some(A=>o.includes(A))?!1:!!(o.includes("chainId")&&typeof n.chainId!="number"||o.includes("nonce")&&typeof d!="number"||o.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||o.includes("gas")&&typeof n.gas!="bigint"))?await St(e,jge,"fillTransaction")({...n,nonce:
62d}).then(x=>{const{chainId:A,from:I,gas:O,gasPrice:N,nonce:T,maxFeePerBlobGas:P,maxFeePerGas:_,maxPriorityFeePerGas:y,type:$,...R}=x.transaction;return Bk.set(e.uid,!0),{...n,...I?{from:I}:{},...$&&!n.type?{type:$}:{},...typeof A<"u"?{chainId:A}:{},...typeof O<"u"?{gas:O}:{},...typeof N<"u"?{gasPrice:N}:{},...typeof T<"u"?{nonce:T}:{},...typeof P<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:P}:{},...typeof _<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:_}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in R&&typeof R.nonceKey<"u"?{nonceKey:R.nonceKey}:{}}}).catch(x=>{var O;const A=x;return A.name!=="TransactionExecutionError"||((O=A.walk)==null?void 0:O.call(A,N=>{var P;const T=N;return T.name==="MethodNotFoundRpcError"||T.name==="MethodNotSupportedRpcError"||((P=T.message)==null?void 0:P.includes("eth_fillTransaction is not available"))}))&&Bk.set(e.uid,!1),n}):n;d??(d=f.nonce),n={...f,...u?{from:u==null?void 0:u.address}:{},...d?{nonce:d}:{}};const{blobs:g,gas:p,kzg:m,type:w}=n;a!=null&&a.fn&&((S=a.runAt)!=null&&S.includes("beforeFillParameters"))&&(n=await a.fn({...n,chain:s},{phase:"beforeFillParameters"}));let C;async function E(){return C||(C=await St(e,$d,"getBlock")({blockTag:"latest"}),C)}if(o.includes("nonce")&&typeof d>"u"&&u&&!i&&(n.nonce=await St(e,Pge,"getTransactionCount")({address:u.address,blockTag:"pending"})),(o.includes("blobVersionedHashes")||o.includes("sidecars"))&&g&&m){const x=nH({blobs:g,kzg:m});if(o.includes("blobVersionedHashes")){const A=Rge({commitments:x,to:"hex"});n.blobVersionedHashes=A}if(o.includes("sidecars")){const A=rH({blobs:g,commitments:x,kzg:m}),I=Lge({blobs:g,commitments:x,proofs:A,to:"hex"});n.sidecars=I}}if(o.includes("chainId")&&(n.chainId=await l()),(o.includes("fees")||o.includes("type"))&&typeof w>"u")try{n.type=Mge(n)}catch{let x=jee.get(e.uid);if(typeof x>"u"){const A=await E();x=typeof(A==null?void 0:A.baseFeePerGas)=="bigint",jee.set(e.uid,x)}n.type=x?"eip1559":"legacy"}
62if(o.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const x=await E(),{maxFeePerGas:A,maxPriorityFeePerGas:I}=await dM(e,{block:x,chain:s,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<I)throw new Nge({maxPriorityFeePerGas:I});n.maxPriorityFeePerGas=I,n.maxFeePerGas=A}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new K7;if(typeof n.gasPrice>"u"){const x=await E(),{gasPrice:A}=await dM(e,{block:x,chain:s,request:n,type:"legacy"});n.gasPrice=A}}return o.includes("gas")&&typeof p>"u"&&(n.gas=await St(e,oH,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),a!=null&&a.fn&&((v=a.runAt)!=null&&v.includes("afterFillParameters"))&&(n=await a.fn({...n,chain:s},{phase:"afterFillParameters"})),fb(n),delete n.parameters,n}async function oH(e,t){var o,a,c;const{account:n=e.account,prepare:r=!0}=t,s=n?fl(n):void 0,i=(()=>{if(Array.isArray(r))return r;if((s==null?void 0:s.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Ige({authorization:t.authorizationList[0]}).catch(()=>{throw new ve("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:d,blobs:h,blobVersionedHashes:f,blockNumber:g,blockTag:p,data:m,gas:w,gasPrice:C,maxFeePerBlobGas:E,maxFeePerGas:b,maxPriorityFeePerGas:S,nonce:v,value:x,stateOverride:A,...I}=r?await Fge(e,{...t,parameters:i,to:l}):t;if(w&&t.gas!==w)return w;const N=(typeof g=="bigint"?kt(g):void 0)||p,T=YW(A);fb(t);const P=(c=(a=(o=e.chain)==null?void 0:o.formatters)==null?void 0:a.transactionRequest)==null?void 0:c.format,y=(P||k6)({...V7(I,{format:P}),account:s,accessList:u,authorizationList:d,blobs:h,blobVersionedHashes:f,data:m,gasPrice:C,maxFeePerBlobGas:E,maxFeePerGas:b,maxPriorityFeePerGas:S,nonce:v,to:l,value:x},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:T?[y,N??e.experimental_blockTag??"latest",T]:N?[y,N]:[y]}))}catch(l){throw XQe(l,{...t,account:s,chain:e.chain})}}async function cet(e,t){var l;const{abi:n,address:r,args:s,functionName:i,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(l=e.dataSuffix)==null?void 0:l.value,...a}=t,c=Al({abi:n,args:s,functionName:i});try{return await St(e,oH,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...a})}catch(u){const d=a.account?fl(a.account):void 0;throw Jw(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:d==null?void 0:d.address})}}function Xw(e,t){if(!hl(e,{strict:!1}))throw new v0({address:e});if(!hl(t,{strict:!1}))throw new v0({address:t});return e.toLowerCase()===t.toLowerCase()}function Dd(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Fee="/docs/contract/decodeEventLog";function t4(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[o,...a]=s;if(!o)throw new u0e({docsPath:Fee});const c=t.find(w=>w.type==="event"&&o===h5(Od(w)));if(!(c&&"name"in c)||c.type!=="event")throw new d0e(o,{docsPath:Fee});const{name:l,inputs:u}=c,d=u==null?void 0:u.some(w=>!("name"in w&&w.name)),h=d?[]:{},f=u.map((w,C)=>[w,C]).filter(([w])=>"indexed"in w&&w.indexed),g=[];for(let w=0;w<f.length;w++){const[C,E]=f[w],b=a[w];if(!b){if(i)throw new M7({abiItem:c,param:C});g.push([C,E]);continue}h[d?E:C.name||E]=uet({param:C,value:b})}const p=u.filter(w=>!("indexed"in w&&w.indexed)),m=i?p:[...g.map(([w])=>w),...p];if(m.length>0){if(n&&n!=="0x")try{const w=P6(m,n);if(w){let C=0;if(!i)for(const[E,b]of g)h[d?b:E.name||b]=w[C++];if(d)for(let E=0;E<u.length;E++)h[E]===void 0&&C<w.length&&(h[E]=w[C++]);else for(let E=0;E<p.length;
62E++)h[p[E].name]=w[C++]}}catch(w){if(i)throw w instanceof kW||w instanceof R0e?new G8({abiItem:c,data:n,params:m,size:Qr(n)}):w}else if(i)throw new G8({abiItem:c,data:"0x",params:m,size:0})}return{eventName:l,args:Object.values(h).length>0?h:void 0}}function uet({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(P6([e],t)||[])[0]}function Z7(e){const{abi:t,args:n,logs:r,strict:s=!0}=e,i=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),o=t.filter(a=>a.type==="event").map(a=>({abi:a,selector:h5(a)}));return r.map(a=>{var h;const c=typeof a.blockNumber=="string"?Dd(a):a,l=o.filter(f=>c.topics[0]===f.selector);if(l.length===0)return null;let u,d;for(const f of l)try{u=t4({...c,abi:[f.abi],strict:!0}),d=f;break}catch{}if(!u&&!s){d=l[0];try{u=t4({data:c.data,topics:c.topics,abi:[d.abi],strict:!1})}catch{const f=(h=d.abi.inputs)==null?void 0:h.some(g=>!("name"in g&&g.name));return{...c,args:f?[]:{},eventName:d.abi.name}}}return!u||!d||i&&!i.includes(u.eventName)||!det({args:u.args,inputs:d.abi.inputs,matchArgs:n})?null:{...u,...c}}).filter(Boolean)}function det(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function s(i,o,a){try{return i.type==="address"?Xw(o,a):i.type==="string"||i.type==="bytes"?Ii(db(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((i,o)=>{if(i==null)return!0;const a=n[o];return a?(Array.isArray(i)?i:[i]).some(l=>s(a,l,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([i,o])=>{if(o==null)return!0;const a=n.find(l=>l.name===i);return a?(Array.isArray(o)?o:[o]).some(l=>s(a,l,t[i])):!1}):!1}async function aH(e,{address:t,blockHash:n,fromBlock:r,toBlock:s,event:i,events:o,args:a,strict:c}={}){const l=c??!1,u=o??(i?[i]:void 0);let d=[];u&&(d=[u.flatMap(p=>T6({abi:[p],eventName:p.name,args:o?void 0:a}))],i&&(d=d[0]));let h;n?h=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):h=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?kt(r):r,toBlock:typeof s=="bigint"?kt(s):s}]});const f=h.map(g=>Dd(g));return u?Z7({abi:u,args:a,logs:f,strict:l}):f}async function zge(e,t){const{abi:n,address:r,args:s,blockHash:i,eventName:o,fromBlock:a,toBlock:c,strict:l}=t,u=o?f1({abi:n,name:o}):void 0,d=u?void 0:n.filter(h=>h.type==="event");return St(e,aH,"getLogs")({address:r,args:s,blockHash:i,event:u,events:d,fromBlock:a,toBlock:c,strict:l})}const Dk="/docs/contract/decodeFunctionResult";function z0(e){const{abi:t,args:n,functionName:r,data:s}=e;let i=t[0];if(r){const a=f1({abi:t,args:n,name:r});if(!a)throw new Gw(r,{docsPath:Dk});i=a}if(i.type!=="function")throw new Gw(void 0,{docsPath:Dk});if(!i.outputs)throw new BW(i.name,{docsPath:Dk});const o=P6(i.outputs,s);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}const cH=BigInt(0),hM=BigInt(1);function GC(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function lH(e){if(!GC(e))throw new Error("Uint8Array expected")}function n4(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function eI(e){const t=e.toString(16);return t.length&1?"0"+t:t}function qge(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?cH:BigInt("0x"+e)}const Wge=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",het=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r4(e){if(lH(e),Wge)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=het[e[n]];return t}const jf={_0:48,_9:57,A:65,F:70,a:97,f:102};function zee(e){if(e>=jf._0&&e<=jf._9)return e-jf._0;if(e>=jf.A&&e<=jf.F)return e-(jf.A-10);if(e>=jf.a&&e<=jf.f)return e-(jf.a-10)}function eA(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Wge)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);
vendor: 5,185 bytes, lines 62-63
62const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=zee(e.charCodeAt(i)),a=zee(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Tw(e){return qge(r4(e))}function Hge(e){return lH(e),qge(r4(Uint8Array.from(e).reverse()))}function ZC(e,t){return eA(e.toString(16).padStart(t*2,"0"))}function Vge(e,t){return ZC(e,t).reverse()}function su(e,t,n){let r;if(typeof t=="string")try{r=eA(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(GC(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function tA(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];lH(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const Uk=e=>typeof e=="bigint"&&cH<=e;function uH(e,t,n){return Uk(e)&&Uk(t)&&Uk(n)&&t<=e&&e<n}function qv(e,t,n,r){if(!uH(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function fet(e){let t;for(t=0;e>cH;e>>=hM,t+=1);return t}const Y7=e=>(hM<<BigInt(e))-hM,Lk=e=>new Uint8Array(e),qee=e=>Uint8Array.from(e);function pet(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Lk(e),s=Lk(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=Lk(0))=>{s=a(qee([0]),d),r=a(),d.length!==0&&(s=a(qee([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return tA(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const get={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||GC(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function J7(e,t,n={}){const r=(s,i,o)=>{const a=get[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function Wee(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const met="0.1.1";function wet(){return met}let hn=class hp extends Error{static setStaticOptions(t){hp.prototype.docsOrigin=t.docsOrigin,hp.prototype.showVersion=t.showVersion,hp.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof hp){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),s=n.cause instanceof hp&&n.cause.docsPath||n.docsPath,i=n.docsOrigin??hp.prototype.docsOrigin,o=`${i}${s??""}`,a=!!(n.version??hp.prototype.showVersion),c=n.version??hp.prototype.version,l=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s||a?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(u=>typeof u=="string").join(` 63`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=i,this.docsPath=s,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return Kge(this,t)}};Object.defineProperty(hn,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${wet()}`}});hn.setStaticOptions(hn.defaultStaticOptions);function Kge(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Kge(e.cause,t):t?null:e}function YC(e,t){if(wv(e)>t)throw new Bet({givenSize:wv(e),maxSize:t})}const Ff={zero:48,nine:57,A:65,F:70,a:97,f:102};function Hee(e){if(e>
63=Ff.zero&&e<=Ff.nine)return e-Ff.zero;if(e>=Ff.A&&e<=Ff.F)return e-(Ff.A-10);if(e>=Ff.a&&e<=Ff.f)return e-(Ff.a-10)}function yet(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Det({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o=n==="right";s[o?i:r-i-1]=e[o?i:e.length-i-1]}return s}function Gge(e,t={}){const{dir:n="left"}=t;let r=e,s=0;for(let i=0;i<r.length-1&&r[n==="left"?i:r.length-i-1].toString()==="0";i++)s++;return r=n==="left"?r.slice(s):r.slice(0,r.length-s),r}function X7(e,t){if(pl(e)>t)throw new zet({givenSize:pl(e),maxSize:t})}function bet(e,t){if(typeof t=="number"&&t>0&&t>pl(e)-1)throw new rme({offset:t,position:"start",size:pl(e)})}function vet(e,t,n){if(typeof t=="number"&&typeof n=="number"&&pl(e)!==n-t)throw new rme({offset:n,position:"end",size:pl(e)})}function Zge(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new qet({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const Eet="#__bigint";function Yge(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+Eet:s,n)}const Cet=new TextDecoder,$et=new TextEncoder;function xet(e){return e instanceof Uint8Array?e:typeof e=="string"?Jge(e):Iet(e)}function Iet(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Jge(e,t={}){const{size:n}=t;let r=e;n&&(X7(e,n),r=ey(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const l=Hee(s.charCodeAt(c++)),u=Hee(s.charCodeAt(c++));if(l===void 0||u===void 0)throw new hn(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l<<4|u}return o}function Aet(e,t={}){const{size:n}=t,r=$et.encode(e);return typeof n=="number"?(YC(r,n),_et(r,n)):r}function _et(e,t){return yet(e,{dir:"right",size:t})}function wv(e){return e.length}function Net(e,t,n,r={}){const{strict:s}=r;return e.slice(t,n)}function Tet(e,t={}){const{size:n}=t;typeof n<"u"&&YC(e,n);const r=Ld(e,t);return eme(r,t)}function Pet(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(YC(r,n),r=Xge(r)),r.length>1||r[0]>1)throw new Ret(r);return!!r[0]}function s0(e,t={}){const{size:n}=t;typeof n<"u"&&YC(e,n);const r=Ld(e,t);return tme(r,t)}function Oet(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(YC(r,n),r=ket(r)),Cet.decode(r)}function Xge(e){return Gge(e,{dir:"left"})}function ket(e){return Gge(e,{dir:"right"})}let Ret=class extends hn{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}},Bet=class extends hn{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Det=class extends hn{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const Uet=new TextEncoder,Let=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Met(e,t={}){const{strict:n=!1}=t;if(!e)throw new Vee(e);if(typeof e!="string")throw new Vee(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Kee(e);if(!e.startsWith("0x"))throw new Kee(e)}function Ud(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function jet(e){return e instanceof Uint8Array?Ld(e):Array.isArray(e)?Ld(new Uint8Array(e)):e}function Qge(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(X7(n,t.size),Qw(n,t.size)):n}function Ld(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=Let[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(X7(r,t.size),ey(r,t.size)):r}function Vo(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const l=typeof e=="bigint"?"n":"";throw new nme({max:i?`${i}${l}`:void 0,min:`${o}${l}`,signed:n,size:r,value:`${e}${l}`})}
63const c=`0x${(n&&s<0?BigInt.asUintN(r*8,BigInt(s)):s).toString(16)}`;return r?Qw(c,r):c}function dH(e,t={}){return Ld(Uet.encode(e),t)}function Qw(e,t){return Zge(e,{dir:"left",size:t})}function ey(e,t){return Zge(e,{dir:"right",size:t})}function Gh(e,t,n,r={}){const{strict:s}=r;bet(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&vet(i,t,n),i}function pl(e){return Math.ceil((e.length-2)/2)}function eme(e,t={}){const{signed:n}=t;t.size&&X7(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,o=i>>1n;return r<=o?r:r-i-1n}function tme(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:eme(e,t))}function Fet(e,t={}){const{strict:n=!1}=t;try{return Met(e,{strict:n}),!0}catch{return!1}}let nme=class extends hn{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Vee=class extends hn{constructor(t){super(`Value \`${typeof t=="object"?Yge(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},Kee=class extends hn{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},zet=class extends hn{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},rme=class extends hn{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},qet=class extends hn{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};function Wet(e){return{address:e.address,amount:Vo(e.amount),index:Vo(e.index),validatorIndex:Vo(e.validatorIndex)}}function sme(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Vo(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Vo(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Vo(e.gasLimit)},...typeof e.number=="bigint"&&{number:Vo(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Vo(e.prevRandao)},...typeof e.time=="bigint"&&{time:Vo(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(Wet)}}}const ty=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],fM=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],ime=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"}
vendor: 4,296 bytes, line 63
63,{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],ome=[...ime,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Het=[...ime,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Gee=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Zee=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],ame=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],nA=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],PE=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Vet="0x82ad56cb",hH="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b
63602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",cme="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",pM="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848
63603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",fH="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9
63150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";let rA=class extends ve{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}},pH=class extends ve{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}};const Mk="/docs/contract/encodeDeployData";function Q7(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const s=t.find(o=>"type"in o&&o.type==="constructor");if(!s)throw new i0e({docsPath:Mk});if(!("inputs"in s))throw new iM({docsPath:Mk});if(!s.inputs||s.inputs.length===0)throw new iM({docsPath:Mk});const i=F0(s.inputs,n);return hb([r,i])}function pb({blockNumber:e,chain:t,contract:n}){var s;const r=(s=t==null?void 0:t.contracts)==null?void 0:s[n];if(!r)throw new rA({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new rA({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function lme(e,{docsPath:t,...n}){const r=(()=>{const s=H7(e,n);return s instanceof O6?e:s})();return new GW(r,{docsPath:t,...n})}function ume(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}const jk=new Map;function dme({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:s}){const i=async()=>{const u=c();o();const d=u.map(({args:h})=>h);d.length!==0&&e(d).then(h=>{s&&Array.isArray(h)&&h.sort(s);for(let f=0;f<u.length;f++){const{resolve:g}=u[f];g==null||g([h[f],h])}}).catch(h=>{for(let f=0;f<u.length;f++){const{reject:g}=u[f];g==null||g(h)}})},o=()=>jk.delete(t),a=()=>c().map(({args:u})=>u),c=()=>jk.get(t)||[],l=u=>jk.set(t,[...c(),u]);return{flush:o,async schedule(u){const{promise:d,resolve:h,reject:f}=ume();return(n==null?void 0:n([...a(),u]))&&i(),c().length>0?(l({args:u,resolve:h,reject:f}),d):(l({args:u,resolve:h,reject:f}),setTimeout(i,r),d)}}}async function R6(e,t){var P,_,y,$;const{account:n=e.account,authorizationList:r,batch:s=!!((P=e.batch)!=null&&P.multicall),blockNumber:i,blockTag:o=e.experimental_blockTag??"latest",accessList:a,blobs:c,blockOverrides:l,code:u,data:d,factory:h,factoryData:f,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:C,nonce:E,to:b,value:S,stateOverride:v,...x}=t,A=n?fl(n):void 0;if(u&&(h||f))throw new ve("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&b)throw new ve("Cannot provide both `code` & `to` as parameters.");const I=u&&d,O=h&&f&&b&&d,N=I||O,T=I?hme({code:u,data:d}):O?Zet({data:d,factory:h,factoryData:f,to:b}):d;try{fb(t);const B=(typeof i=="bigint"?kt(i):void 0)||o,k=l?sme(l):void 0,D=YW(v),U=($=(y=(_=e.chain)==null?void 0:_.formatters)==null?void 0:y.transactionRequest)==null?void 0:$.format,K=(U||k6)({...V7(x,{format:U}),accessList:a,account:A,authorizationList:r,blobs:c,data:T,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:C,nonce:E,to:N?void 0:b,value:S},"call");if(s&&Ket({request:K}
63)&&!D&&!k)try{return await Get(e,{...K,blockNumber:i,blockTag:o})}catch(Z){if(!(Z instanceof pH)&&!(Z instanceof rA))throw Z}const q=(()=>{const Z=[K,B];return D&&k?[...Z,D,k]:D?[...Z,D]:k?[...Z,{},k]:Z})(),H=await e.request({method:"eth_call",params:q});return H==="0x"?{data:void 0}:{data:H}}catch(R){const B=Yet(R),{offchainLookup:k,offchainLookupSignature:D}=await te(async()=>{const{offchainLookup:U,offchainLookupSignature:F}=await Promise.resolve().then(()=>Ftt);return{offchainLookup:U,offchainLookupSignature:F}},void 0);if(e.ccipRead!==!1&&(B==null?void 0:B.slice(0,10))===D&&b)return{data:await k(e,{data:B,to:b})};throw N&&(B==null?void 0:B.slice(0,10))==="0x101bb98d"?new K0e({factory:h}):lme(R,{...t,account:A,chain:e.chain})}}function Ket({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(Vet)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function Get(e,t){var p;const{batchSize:n=1024,deployless:r=!1,wait:s=0}=typeof((p=e.batch)==null?void 0:p.multicall)=="object"?e.batch.multicall:{},{blockNumber:i,blockTag:o=e.experimental_blockTag??"latest",data:a,to:c}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return pb({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new pH})(),d=(typeof i=="bigint"?kt(i):void 0)||o,{schedule:h}=dme({id:`${e.uid}.${d}`,wait:s,shouldSplitBatch(m){return m.reduce((C,{data:E})=>C+(E.length-2),0)>n*2},fn:async m=>{const w=m.map(b=>({allowFailure:!0,callData:b.data,target:b.to})),C=Al({abi:ty,args:[w],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...l===null?{data:hme({code:fH,data:C})}:{to:l,data:C}
63},d]});return z0({abi:ty,args:[w],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:f,success:g}]=await h({data:a,to:c});if(!g)throw new KC({data:f});return f==="0x"?{data:void 0}:{data:f}}function hme(e){const{code:t,data:n}=e;return Q7({abi:j0(["constructor(bytes, bytes)"]),bytecode:hH,args:[t,n]})}function Zet(e){const{data:t,factory:n,factoryData:r,to:s}=e;return Q7({abi:j0(["constructor(address, bytes, address, bytes)"]),bytecode:cme,args:[s,t,n,r]})}function Yet(e){var n;if(!(e instanceof ve))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function Md(e,t){const{abi:n,address:r,args:s,functionName:i,...o}=t,a=Al({abi:n,args:s,functionName:i});try{const{data:c}=await St(e,R6,"call")({...o,data:a,to:r});return z0({abi:n,args:s,functionName:i,data:c||"0x"})}catch(c){throw Jw(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:i})}}async function Jet(e,t){var u;const{abi:n,address:r,args:s,functionName:i,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...a}=t,c=a.account?fl(a.account):e.account,l=Al({abi:n,args:s,functionName:i});try{const{data:d}=await St(e,R6,"call")({batch:!1,data:`${l}${o?o.replace("0x",""):""}`,to:r,...a,account:c}),h=z0({abi:n,args:s,functionName:i,data:d||"0x"}),f=n.filter(g=>"name"in g&&g.name===t.functionName);return{result:h,request:{abi:f,address:r,args:s,dataSuffix:o,functionName:i,...a,account:c}}}catch(d){throw Jw(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:i,sender:c==null?void 0:c.address})}}const Fk=new Map,Yee=new Map;let Xet=0;function Vm(e,t,n){const r=++Xet,s=()=>Fk.get(e)||[],i=()=>{const u=s();Fk.set(e,u.filter(d=>d.id!==r))},o=()=>{const u=s();if(!u.some(h=>h.id===r))return;const d=Yee.get(e);if(u.length===1&&d){const h=d();h instanceof Promise&&h.catch(()=>{})}i()},a=s();if(Fk.set(e,[...a,{id:r,fns:t}]),a&&a.length>0)return o;const c={};for(const u in t)c[u]=((...d)=>{var f,g;const h=s();if(h.length!==0)for(const p of h)(g=(f=p.fns)[u])==null||g.call(f,...d)});const l=n(c);return typeof l=="function"&&Yee.set(e,l),o}async function sA(e){return new Promise(t=>setTimeout(t,e))}function JC(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let s=!0;const i=()=>s=!1;return(async()=>{let a;t&&(a=await e({unpoll:i}));const c=await(n==null?void 0:n(a))??r;await sA(c);const l=async()=>{s&&(await e({unpoll:i}),await sA(r),l())};l()})(),i}const Qet=new Map,ett=new Map;function ttt(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:o=>i.set(s,o)}),n=t(e,Qet),r=t(e,ett);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function fme(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=ttt(t),s=r.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let i=r.promise.get();i||(i=e(),r.promise.set(i));try{const o=await i;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const ntt=e=>`blockNumber.${e}`;async function XC(e,{cacheTime:t=e.cacheTime}={}){const n=await fme(()=>e.request({method:"eth_blockNumber"}),{cacheKey:ntt(e.uid),cacheTime:t});return BigInt(n)}async function eT(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const s=r.map(i=>Dd(i));return!("abi"in t)||!t.abi?s:Z7({abi:t.abi,logs:s,strict:n})}async function tT(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function rtt(e,t){const{abi:n,address:r,args:s,batch:i=!0,eventName:o,fromBlock:a,onError:c,onLogs:l,poll:u,pollingInterval:d=e.pollingInterval,strict:h}=t;return(typeof u<"u"?u:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
63onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const m=h??!1,w=Ps(["watchContractEvent",r,s,i,e.uid,o,d,m,a]);return Vm(w,{onLogs:l,onError:c},C=>{let E;a!==void 0&&(E=a-1n);let b,S=!1;const v=JC(async()=>{var x;if(!S){try{b=await St(e,P0e,"createContractEventFilter")({abi:n,address:r,args:s,eventName:o,strict:m,fromBlock:a})}catch{}S=!0;return}try{let A;if(b)A=await St(e,eT,"getFilterChanges")({filter:b});else{const I=await St(e,XC,"getBlockNumber")({});E&&E<I?A=await St(e,zge,"getContractEvents")({abi:n,address:r,args:s,eventName:o,fromBlock:E+1n,toBlock:I,strict:m}):A=[],E=I}if(A.length===0)return;if(i)C.onLogs(A);else for(const I of A)C.onLogs([I])}catch(A){b&&A instanceof Yw&&(S=!1),(x=C.onError)==null||x.call(C,A)}},{emitOnBegin:!0,interval:d});return async()=>{b&&await St(e,tT,"uninstallFilter")({filter:b}),v()}})})():(()=>{const m=h??!1,w=Ps(["watchContractEvent",r,s,i,e.uid,o,d,m]);let C=!0,E=()=>C=!1;return Vm(w,{onLogs:l,onError:c},b=>((async()=>{try{const S=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(I=>I.config.type==="webSocket"||I.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),v=o?T6({abi:n,eventName:o,args:s}):[],{unsubscribe:x}=await S.subscribe({params:["logs",{address:r,topics:v}],onData(A){var O;if(!C)return;const I=A.result;try{const{eventName:N,args:T}=t4({abi:n,data:I.data,topics:I.topics,strict:h}),P=Dd(I,{args:T,eventName:N});b.onLogs([P])}catch(N){let T,P;if(N instanceof G8||N instanceof M7){if(h)return;T=N.abiItem.name,P=(O=N.abiItem.inputs)==null?void 0:O.some(y=>!("name"in y&&y.name))}const _=Dd(I,{args:P?[]:{},eventName:T});b.onLogs([_])}},onError(A){var I;(I=b.onError)==null||I.call(b,A)}});E=x,C||E()}catch(S){c==null||c(S)}})(),()=>E()))})()}async function stt(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function iA(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,i)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const u=typeof t=="function"?t({count:a,error:l}):t;u&&await sA(u),o({count:a+1})};try{const l=await e();s(l)}catch(l){if(a<n&&await r({count:a,error:l}))return c({error:l});i(l)}};o()})}const itt={"0x0":"reverted","0x1":"success"};function gH(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Dd(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?sf(e.transactionIndex):null,status:e.status?itt[e.status]:null,type:e.type?QW[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const gM=256;let tI=gM,nI;function pme(e=11){if(!nI||tI+e>gM*2){nI="",tI=0;for(let t=0;t<gM;t++)nI+=(256+Math.random()*256|0).toString(16).substring(1)}return nI.substring(tI,tI+++e)}function gme(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:s,key:i="base",name:o="Base Client",type:a="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),l=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),d=e.pollingInterval??u,h=e.cacheTime??d,f=e.account?fl(e.account):void 0,{config:g,request:p,value:m}=e.transport({account:f,chain:n,pollingInterval:d}),w={...g,...m},C={account:f,batch:t,cacheTime:h,ccipRead:r,chain:n,dataSuffix:s,key:i,name:o,pollingInterval:d,request:p,transport:w,type:a,uid:pme(),...c?{experimental_blockTag:c}:{}};function E(b){return S=>{const v=S(b);for(const A in C)delete v[A];const x={...b,...v};return Object.assign(x,{extend:E(x)})}}return Object.assign(C,{extend:E(C)})}function mH(e){var n,r,s,i,o,a;if(!(e instanceof ve))return!1;const t=e.walk(c=>c instanceof x9);return t instanceof x9?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=t.data)==null?void 0:i.errorName)==="ResolverNotFound"||((o=t.data)==null?void 0:o.errorName)==="ReverseAddressMismatch"||((a=t.data)==null?void 0:a.errorName)==="UnsupportedResolverProfile":!1}function mme(e){const{abi:t,data:n}=e,r=Hm(n,0,4),s=t.find(i=>
63i.type==="function"&&r===Zw(Od(i)));if(!s)throw new h0e(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?P6(s.inputs,Hm(n,4)):void 0}}const zk="/docs/contract/encodeErrorResult";function mM(e){const{abi:t,errorName:n,args:r}=e;let s=t[0];if(n){const c=f1({abi:t,args:r,name:n});if(!c)throw new oM(n,{docsPath:zk});s=c}if(s.type!=="error")throw new oM(void 0,{docsPath:zk});const i=Od(s),o=Zw(i);let a="0x";if(r&&r.length>0){if(!s.inputs)throw new l0e(s.name,{docsPath:zk});a=F0(s.inputs,r)}return hb([o,a])}const qk="/docs/contract/encodeFunctionResult";function wme(e){const{abi:t,functionName:n,result:r}=e;let s=t[0];if(n){const o=f1({abi:t,name:n});if(!o)throw new Gw(n,{docsPath:qk});s=o}if(s.type!=="function")throw new Gw(void 0,{docsPath:qk});if(!s.outputs)throw new BW(s.name,{docsPath:qk});const i=(()=>{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new DW(r)})();return F0(s.outputs,i)}const QC="x-batch-gateway:true";async function yme(e){const{data:t,ccipRequest:n}=e,{args:[r]}=mme({abi:fM,data:t}),s=[],i=[];return await Promise.all(r.map(async(o,a)=>{try{i[a]=o.urls.includes(QC)?await yme({data:o.data,ccipRequest:n}):await n(o),s[a]=!1}catch(c){s[a]=!0,i[a]=ott(c)}})),wme({abi:fM,functionName:"query",result:[s,i]})}function ott(e){return e.name==="HttpRequestError"&&e.status?mM({abi:fM,errorName:"HttpError",args:[e.status,e.shortMessage]}):mM({abi:[k0e],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function bme(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Cu(t)?t:null}function oA(e){let t=new Uint8Array(32).fill(0);if(!e)return Rs(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=bme(n[r]),i=s?db(s):Ii(Em(n[r]),"bytes");t=Ii($u([t,i]),"bytes")}return Rs(t)}function att(e){return`[${e.slice(2)}]`}function vme(e){const t=new Uint8Array(32).fill(0);return e?bme(e)||Ii(Em(e)):Rs(t)}function wH(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Em(t).byteLength+2);let r=0;const s=t.split(".");for(let i=0;i<s.length;i++){let o=Em(s[i]);o.byteLength>255&&(o=Em(att(vme(s[i])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function ctt(e,t){const{blockNumber:n,blockTag:r,coinType:s,name:i,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return pb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c==null?void 0:c.ensTlds;if(u&&!u.some(h=>i.endsWith(h)))return null;const d=s!=null?[oA(i),BigInt(s)]:[oA(i)];try{const h=Al({abi:Zee,functionName:"addr",args:d}),f={address:l,abi:ome,functionName:"resolveWithGateways",args:[Rd(wH(i)),h,o??[QC]],blockNumber:n,blockTag:r},p=await St(e,Md,"readContract")(f);if(p[0]==="0x")return null;const m=z0({abi:Zee,args:d,functionName:"addr",data:p[0]});return m==="0x"||vm(m)==="0x00"?null:m}catch(h){if(a)throw h;if(mH(h))return null;throw h}}let ltt=class extends ve{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}},Q2=class extends ve{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}},nT=class extends ve{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}},Eme=class extends ve{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}};const utt=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,dtt=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,htt=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,ftt=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function ptt(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Jee(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Cme({uri:e,gatewayUrls:t}){const n=htt.test(e);
63if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Jee(t==null?void 0:t.ipfs,"https://ipfs.io"),s=Jee(t==null?void 0:t.arweave,"https://arweave.net"),i=e.match(utt),{protocol:o,subpath:a,target:c,subtarget:l=""}=(i==null?void 0:i.groups)||{},u=o==="ipns:/"||a==="ipns/",d=o==="ipfs:/"||a==="ipfs/"||dtt.test(e);if(e.startsWith("http")&&!u&&!d){let f=e;return t!=null&&t.arweave&&(f=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((u||d)&&c)return{uri:`${r}/${u?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${s}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let h=e.replace(ftt,"");if(h.startsWith("<svg")&&(h=`data:image/svg+xml;base64,${btoa(h)}`),h.startsWith("data:")||h.startsWith("{"))return{uri:h,isOnChain:!0,isEncoded:!1};throw new nT({uri:e})}function $me(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new ltt({data:e});return e.image||e.image_url||e.image_data}async function gtt({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await yH({gatewayUrls:e,uri:$me(n)})}catch{throw new nT({uri:t})}}async function yH({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Cme({uri:t,gatewayUrls:e});if(r||await ptt(n))return n;throw new nT({uri:t})}function mtt(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[i,o]=n.split(":"),[a,c]=r.split(":");if(!i||i.toLowerCase()!=="eip155")throw new Q2({reason:"Only EIP-155 supported"});if(!o)throw new Q2({reason:"Chain ID not found"});if(!c)throw new Q2({reason:"Contract address not found"});if(!s)throw new Q2({reason:"Token ID not found"});if(!a)throw new Q2({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:s}}async function wtt(e,{nft:t}){if(t.namespace==="erc721")return Md(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return Md(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Eme({namespace:t.namespace})}async function ytt(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?btt(e,{gatewayUrls:t,record:n}):yH({uri:n,gatewayUrls:t})}async function btt(e,{gatewayUrls:t,record:n}){const r=mtt(n),s=await wtt(e,{nft:r}),{uri:i,isOnChain:o,isEncoded:a}=Cme({uri:s,gatewayUrls:t});if(o&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=a?atob(i.replace("data:application/json;base64,","")):i,u=JSON.parse(l);return yH({uri:$me(u),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),gtt({gatewayUrls:t,uri:i.replace(/(?:0x)?{id}/,c)})}async function xme(e,t){const{blockNumber:n,blockTag:r,key:s,name:i,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return pb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c==null?void 0:c.ensTlds;if(u&&!u.some(d=>i.endsWith(d)))return null;try{const d={address:l,abi:ome,args:[Rd(wH(i)),Al({abi:Gee,functionName:"text",args:[oA(i),s]}),o??[QC]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},f=await St(e,Md,"readContract")(d);if(f[0]==="0x")return null;const g=z0({abi:Gee,functionName:"text",data:f[0]});return g===""?null:g}catch(d){if(a)throw d;if(mH(d))return null;throw d}}async function vtt(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:i,strict:o,universalResolverAddress:a}){const c=await St(e,xme,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:a,gatewayUrls:i,strict:o});if(!c)return null;try{return await ytt(e,{record:c,gatewayUrls:r})}catch{return null}}async function Ett(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:i=60n,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>
63{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return pb({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:Het,args:[n,i,o??[QC]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},d=St(e,Md,"readContract"),[h]=await d(u);return h||null}catch(u){if(a)throw u;if(mH(u))return null;throw u}}async function Ctt(e,t){const{blockNumber:n,blockTag:r,name:s}=t,{chain:i}=e,o=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!i)throw new Error("client chain not configured. universalResolverAddress is required.");return pb({blockNumber:n,chain:i,contract:"ensUniversalResolver"})})(),a=i==null?void 0:i.ensTlds;if(a&&!a.some(l=>s.endsWith(l)))throw new Error(`${s} is not a valid ENS TLD (${a==null?void 0:a.join(", ")}) for chain "${i.name}" (id: ${i.id}).`);const[c]=await St(e,Md,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Rd(wH(s))],blockNumber:n,blockTag:r});return c}async function Ime(e,t){var m,w,C;const{account:n=e.account,blockNumber:r,blockTag:s="latest",blobs:i,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:d,to:h,value:f,...g}=t,p=n?fl(n):void 0;try{fb(t);const b=(typeof r=="bigint"?kt(r):void 0)||s,S=(C=(w=(m=e.chain)==null?void 0:m.formatters)==null?void 0:w.transactionRequest)==null?void 0:C.format,x=(S||k6)({...V7(g,{format:S}),account:p,blobs:i,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:d,to:h,value:f},"createAccessList"),A=await e.request({method:"eth_createAccessList",params:[x,b]});return{accessList:A.accessList,gasUsed:BigInt(A.gasUsed)}}catch(E){throw lme(E,{...t,account:p,chain:e.chain})}}async function $tt(e){const t=z7(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Sme(e,{address:t,args:n,event:r,events:s,fromBlock:i,strict:o,toBlock:a}={}){const c=s??(r?[r]:void 0),l=z7(e,{method:"eth_newFilter"});let u=[];c&&(u=[c.flatMap(f=>T6({abi:[f],eventName:f.name,args:n}))],r&&(u=u[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof i=="bigint"?kt(i):i,toBlock:typeof a=="bigint"?kt(a):a,...u.length?{topics:u}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:i,id:d,request:l(d),strict:!!o,toBlock:a,type:"event"}}async function Ame(e){const t=z7(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function xtt(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var o,a,c;if((o=e.batch)!=null&&o.multicall&&((c=(a=e.chain)==null?void 0:a.contracts)!=null&&c.multicall3)){const l=e.chain.contracts.multicall3.address,u=Al({abi:ty,functionName:"getEthBalance",args:[t]}),{data:d}=await St(e,R6,"call")({to:l,data:u,blockNumber:n,blockTag:r});return z0({abi:ty,functionName:"getEthBalance",args:[t],data:d||"0x"})}const s=typeof n=="bigint"?kt(n):void 0,i=await e.request({method:"eth_getBalance",params:[t,s||r]});return BigInt(i)}async function Itt(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function Stt(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?kt(n):void 0;let i;return t?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),sf(i)}async function aA(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?kt(n):void 0,i=await e.request({method:"eth_getCode",params:[t,s||r]},{dedupe:!!s});if(i!=="0x")return i}async function Att(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=await aA(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(s&&Qr(s)===23&&s.startsWith("0xef0100"))return Z8(Hm(s,3,23))}let _tt=class extends ve{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}};async function Ntt(e,t){const{address:n,factory:r,factoryData:s}=t;try{const[i,o,a,c,l,u,d]=await St(e,Md,"readContract")({abi:Ttt,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:o,version:a,chainId:Number(c),verifyingContract:l,salt:u},extensions:d,fields:i}}catch(i){const o=i;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new _tt({address:n}):o}}const Ttt=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function Ptt(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.olde
63stBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function Ott(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const i=typeof n=="bigint"?kt(n):void 0,o=await e.request({method:"eth_feeHistory",params:[kt(t),i||r,s]},{dedupe:!!i});return Ptt(o)}async function ktt(e,{filter:t}){const n=t.strict??!1,s=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(i=>Dd(i));return t.abi?Z7({abi:t.abi,logs:s,strict:n}):s}async function Rtt({address:e,authorization:t,signature:n}){return Xw(Z8(e),await Ige({authorization:t,signature:n}))}const rI=new F7(8192);function Btt(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(rI.get(n))return rI.get(n);const r=e().finally(()=>rI.delete(n));return rI.set(n,r),r}function Dtt(e,t={}){return async(n,r={})=>{var d;const{dedupe:s=!1,methods:i,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...r},{method:l}=n;if((d=i==null?void 0:i.exclude)!=null&&d.includes(l))throw new mv(new Error("method not supported"),{method:l});if(i!=null&&i.include&&!i.include.includes(l))throw new mv(new Error("method not supported"),{method:l});const u=s?d5(`${c}.${Ps(n)}`):void 0;return Btt(()=>iA(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case I9.code:throw new I9(f);case S9.code:throw new S9(f);case A9.code:throw new A9(f,{method:n.method});case _9.code:throw new _9(f);case f5.code:throw new f5(f);case Yw.code:throw new Yw(f);case N9.code:throw new N9(f);case T9.code:throw new T9(f);case J8.code:throw new J8(f);case mv.code:throw new mv(f,{method:n.method});case X8.code:throw new X8(f);case P9.code:throw new P9(f);case zv.code:throw new zv(f);case O9.code:throw new O9(f);case k9.code:throw new k9(f);case R9.code:throw new R9(f);case B9.code:throw new B9(f);case D9.code:throw new D9(f);case U9.code:throw new U9(f);case L9.code:throw new L9(f);case M9.code:throw new M9(f);case j9.code:throw new j9(f);case F9.code:throw new F9(f);case z9.code:throw new z9(f);case q9.code:throw new q9(f);case 5e3:throw new zv(f);case W9.code:throw new W9(f);default:throw h instanceof ve?h:new vge(f)}}},{delay:({count:h,error:f})=>{var g;if(f&&f instanceof Cm){const p=(g=f==null?void 0:f.headers)==null?void 0:g.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*o},retryCount:a,shouldRetry:({error:h})=>Utt(h)}),{enabled:s,id:u})}}function Utt(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===X8.code||e.code===f5.code:e instanceof Cm&&e.status?e.status===403||e.status===408||e.status===4
6313||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}let Ltt=class extends ve{constructor({callbackSelector:t,cause:n,data:r,extraData:s,sender:i,urls:o}){var a;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(a=n.metaMessages)!=null&&a.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(c=>` ${VC(c)}`)],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${s}`].flat(),name:"OffchainLookupError"})}},Mtt=class extends ve{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${VC(n)}`,`Response: ${Ps(t)}`],name:"OffchainLookupResponseMalformedError"})}},jtt=class extends ve{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}};const _me="0x556f1830",bH={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function Nme(e,{blockNumber:t,blockTag:n,data:r,to:s}){const{args:i}=HW({data:r,abi:[bH]}),[o,a,c,l,u]=i,{ccipRead:d}=e,h=d&&typeof(d==null?void 0:d.request)=="function"?d.request:cA;try{if(!Xw(s,o))throw new jtt({sender:o,to:s});const f=a.includes(QC)?await yme({data:c,ccipRequest:h}):await h({data:c,sender:o,urls:a}),{data:g}=await R6(e,{blockNumber:t,blockTag:n,data:$u([l,F0([{type:"bytes"},{type:"bytes"}],[f,u])]),to:s});return g}catch(f){throw new Ltt({callbackSelector:l,cause:f,data:r,extraData:u,sender:o,urls:a})}}async function cA({data:e,sender:t,urls:n}){var s;let r=new Error("An unknown error occurred.");for(let i=0;i<n.length;i++){const o=n[i],a=o.includes("{data}")?"GET":"POST",c=a==="POST"?{data:e,sender:t}:void 0,l=a==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(o.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:l,method:a});let d;if((s=u.headers.get("Content-Type"))!=null&&s.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){r=new Cm({body:c,details:d!=null&&d.error?Ps(d.error):u.statusText,headers:u.headers,status:u.status,url:o});continue}if(!Cu(d)){r=new Mtt({result:d,url:o});continue}return d}catch(u){r=new Cm({body:c,details:u.message,url:o})}}throw r}const Ftt=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:cA,offchainLookup:Nme,offchainLookupAbiItem:bH,offchainLookupSignature:_me},Symbol.toStringTag,{value:"Module"}));function ztt(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return s=>{const i=typeof s=="function"?s(r):s,o={...r,...i};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}function Tme(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,i)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{r&&a.abort()},n)),s(await e({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&i(t),i(a)}finally{clearTimeout(o)}})()})}function qtt(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Xee=qtt();function Wtt(e,t={}){const{url:n,headers:r}=Htt(e);return{async request(s){var g,p,m;const{body:i,fetchFn:o=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:c=t.onResponse,timeout:l=t.timeout??1e4}=s,u={...t.fetchOptions??{},...s.fetchOptions??{}},{headers:d,method:h,signal:f}=u;try{const w=await Tme(async({signal:E})=>{const b={...u,body:Array.isArray(i)?Ps(i.map(A=>({jsonrpc:"2.0",id:A.id??Xee.take(),...A}))):Ps({jsonrpc:"2.0",id:i.id??Xee.take(),...i}),headers:{...r,"Content-Type":"application/json",...d},method:h||"POST",signal:f||(l>0?E:null)},S=new Request(n,b),v=await(a==null?void 0:a(S,b))??{...b,url:n};return await o(v.url??n,v)},{errorInstance:new uM({body:i,url:n}),timeout:l,signal:!0});c&&await c(w);let C;if((g=w.headers.get("Content-Type"))!=null&&g.startsWith("application/json"))C=await w.json();else{C=await w.text();try{C=JSON.parse(C||"{}")}
63catch(E){if(w.ok)throw E;C={error:C}}}if(!w.ok){if(typeof((p=C.error)==null?void 0:p.code)=="number"&&typeof((m=C.error)==null?void 0:m.message)=="string")return C;throw new Cm({body:i,details:Ps(C.error)||w.statusText,headers:w.headers,status:w.status,url:n})}return C}catch(w){throw w instanceof Cm||w instanceof uM?w:new Cm({body:i,cause:w,url:n})}}}}function Htt(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const Pme=`�Ethereum Signed Message: 64`;function Ome(e){const t=typeof e=="string"?d5(e):typeof e.raw=="string"?e.raw:Rs(e.raw),n=d5(`${Pme}${Qr(t)}`);return $u([n,t])}function vH(e,t){return Ii(Ome(e),t)}let kme=class extends ve{constructor({domain:t}){super(`Invalid domain "${Ps(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}},Rme=class extends ve{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}},Bme=class extends ve{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}};function Dme(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(o,a)=>{for(const c of o){const{name:l,type:u}=c,d=a[l],h=u.match(N0e);if(h&&(typeof d=="number"||typeof d=="bigint")){const[p,m,w]=h;kt(d,{signed:m==="int",size:Number.parseInt(w,10)/8})}if(u==="address"&&typeof d=="string"&&!hl(d))throw new v0({address:d});const f=u.match($Qe);if(f){const[p,m]=f;if(m&&Qr(d)!==Number.parseInt(m,10))throw new f0e({expectedSize:Number.parseInt(m,10),givenSize:Qr(d)})}const g=s[u];g&&(Vtt(u),i(g,d))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new kme({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new Rme({primaryType:r,types:s})}function Ume({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Vtt(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Bme({type:e})}function Lme(e){const{domain:t={},message:n,primaryType:r}=e,s={EIP712Domain:Ume({domain:t}),...e.types};Dme({domain:t,message:n,primaryType:r,types:s});const i=["0x1901"];return t&&i.push(Mme({domain:t,types:s})),r!=="EIP712Domain"&&i.push(EH({data:n,primaryType:r,types:s})),Ii($u(i))}function Mme({domain:e,types:t}){return EH({data:e,primaryType:"EIP712Domain",types:t})}function EH({data:e,primaryType:t,types:n}){const r=jme({data:e,primaryType:t,types:n});return Ii(r)}function jme({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],s=[Ktt({primaryType:t,types:n})];for(const i of n[t]){const[o,a]=zme({types:n,name:i.name,type:i.type,value:e[i.name]});r.push(o),s.push(a)}return F0(r,s)}function Ktt({primaryType:e,types:t}){const n=Rd(Gtt({primaryType:e,types:t}));return Ii(n)}function Gtt({primaryType:e,types:t}){let n="";const r=Fme({primaryType:e,types:t});r.delete(e);const s=[e,...Array.from(r).sort()];for(const i of s)n+=`${i}(${t[i].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function Fme({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),s=r==null?void 0:r[0];if(n.has(s)||t[s]===void 0)return n;n.add(s);for(const i of t[s])Fme({primaryType:i.type,types:t},n);return n}function zme({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ii(jme({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Ii(r)];if(n==="string")return[{type:"bytes32"},Ii(Rd(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(o=>zme({name:t,type:s,types:e,value:o}));return[{type:"bytes32"},Ii(F0(i.map(([o])=>o),i.map(([,o])=>o)))]}return[{type:n},r]}let Ztt=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const Ytt={checksum:new Ztt(8192)},Wk=Ytt.checksum;function qme(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=U0(xet(e));return n==="Bytes"?r:Ld(r)}const Jtt=/^0x[a-fA-F0-9]{40}$/;function rT(e,t={}){const{strict:n=!0}=t;if(!Jtt.test(e))throw new Qee({address:e,cause:new Xtt});if(n){if(e.toLowerCase()===e)return;if(Wme(e)!==e)throw new Qee({address:e,cause:new Qtt})}}function Wme(e){if(Wk.has(e))return Wk.get(e);rT(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=qme(Aet(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return Wk.set(e,s),s}function wM(e,t={}){const{strict:n=!0}=t??{};try{return rT(e,{strict:n}),!0}catch{return!1}}let Qee=class extends hn{constructor({address:t,cause:n}){super(`Address "${t}
64" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},Xtt=class extends hn{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},Qtt=class extends hn{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}};const ent=/^(.*)\[([0-9]*)\]$/,tnt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Hme=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,ete=2n**256n-1n;function Wv(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=xH(t.type);if(i){const[o,a]=i;return rnt(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:s})}if(t.type==="tuple")return ant(e,t,{checksumAddress:r,staticPosition:s});if(t.type==="address")return nnt(e,{checksum:r});if(t.type==="bool")return snt(e);if(t.type.startsWith("bytes"))return int(e,t,{staticPosition:s});if(t.type.startsWith("uint")||t.type.startsWith("int"))return ont(e,t);if(t.type==="string")return cnt(e,{staticPosition:s});throw new SH(t.type)}const tte=32,yM=32;function nnt(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(i=>n?Wme(i):i)(Ld(Net(r,-20))),32]}function rnt(e,t,n){const{checksumAddress:r,length:s,staticPosition:i}=n;if(!s){const c=s0(e.readBytes(yM)),l=i+c,u=l+tte;e.setPosition(l);const d=s0(e.readBytes(tte)),h=s4(t);let f=0;const g=[];for(let p=0;p<d;++p){e.setPosition(u+(h?p*32:f));const[m,w]=Wv(e,t,{checksumAddress:r,staticPosition:u});f+=w,g.push(m)}return e.setPosition(i+32),[g,32]}if(s4(t)){const c=s0(e.readBytes(yM)),l=i+c,u=[];for(let d=0;d<s;++d){e.setPosition(l+d*32);const[h]=Wv(e,t,{checksumAddress:r,staticPosition:l});u.push(h)}return e.setPosition(i+32),[u,32]}let o=0;const a=[];for(let c=0;c<s;++c){const[l,u]=Wv(e,t,{checksumAddress:r,staticPosition:i+o});o+=u,a.push(l)}return[a,o]}function snt(e){return[Pet(e.readBytes(32),{size:32}),32]}function int(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=s0(e.readBytes(32));e.setPosition(n+o);const a=s0(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Ld(c),32]}return[Ld(e.readBytes(Number.parseInt(s,10),32)),32]}function ont(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?Tet(s,{signed:n}):s0(s,{signed:n}),32]}function ant(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=t.components.length===0||t.components.some(({name:c})=>!c),o=i?[]:{};let a=0;if(s4(t)){const c=s0(e.readBytes(yM)),l=s+c;for(let u=0;u<t.components.length;++u){const d=t.components[u];e.setPosition(l+a);const[h,f]=Wv(e,d,{checksumAddress:r,staticPosition:l});a+=f,o[i?u:d==null?void 0:d.name]=h}return e.setPosition(s+32),[o,32]}for(let c=0;c<t.components.length;++c){const l=t.components[c],[u,d]=Wv(e,l,{checksumAddress:r,staticPosition:s});o[i?c:l==null?void 0:l.name]=u,a+=d}return[o,a]}function cnt(e,{staticPosition:t}){const n=s0(e.readBytes(32)),r=t+n;e.setPosition(r);const s=s0(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=Oet(Xge(i));return e.setPosition(t+32),[o,32]}function lnt({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(CH({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function CH({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=xH(r.type);if(s){const[i,o]=s;return dnt(n,{checksumAddress:e,length:i,parameter:{...r,type:o}})}if(r.type==="tuple")return mnt(n,{checksumAddress:e,parameter:r});if(r.type==="address")return unt(n,{checksum:e});if(r.type==="bool")return fnt(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,o="256"]=Hme.exec(r.type)??[];return pnt(n,{signed:i,size:Number(o)})}if(r.type.startsWith("bytes"))return hnt(n,{type:r.type});if(r.type==="string")return gnt(n);throw new SH(r.type)}function $H(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=pl(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(Vo(t+s,{size:32}
vendor: 5,941 bytes, line 64
64)),r.push(a),s+=pl(a)):n.push(a)}return Ud(...n,...r)}function unt(e,t){const{checksum:n=!1}=t;return rT(e,{strict:n}),{dynamic:!1,encoded:Qw(e.toLowerCase())}}function dnt(e,t){const{checksumAddress:n,length:r,parameter:s}=t,i=r===null;if(!Array.isArray(e))throw new Int(e);if(!i&&e.length!==r)throw new xnt({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const l=CH({checksumAddress:n,parameter:s,value:e[c]});l.dynamic&&(o=!0),a.push(l)}if(i||o){const c=$H(a);if(i){const l=Vo(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Ud(l,c):l}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Ud(...a.map(({encoded:c})=>c))}}function hnt(e,{type:t}){const[,n]=t.split("bytes"),r=pl(e);if(!n){let s=e;return r%32!==0&&(s=ey(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Ud(Qw(Vo(r,{size:32})),s)}}if(r!==Number.parseInt(n,10))throw new Kme({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:ey(e)}}function fnt(e){if(typeof e!="boolean")throw new hn(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Qw(Qge(e))}}function pnt(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new nme({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Vo(e,{size:32,signed:t})}}function gnt(e){const t=dH(e),n=Math.ceil(pl(t)/32),r=[];for(let s=0;s<n;s++)r.push(ey(Gh(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:Ud(ey(Vo(pl(t),{size:32})),...r)}}function mnt(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,l=CH({checksumAddress:n,parameter:a,value:e[c]});i.push(l),l.dynamic&&(s=!0)}return{dynamic:s,encoded:s?$H(i):Ud(...i.map(({encoded:o})=>o))}}function xH(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function s4(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(s4);const n=xH(e.type);return!!(n&&s4({...e,type:n[1]}))}const wnt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new vnt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new bnt({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new nte({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new nte({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function ynt(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(wnt);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}let nte=class extends hn{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}},bnt=class extends hn{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}},vnt=class extends hn{constructor({count:t,limit:n}
64){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}};function Ent(e,t,n={}){const{as:r="Array",checksumAddress:s=!1}=n,i=typeof t=="string"?Jge(t):t,o=ynt(i);if(wv(i)===0&&e.length>0)throw new $nt;if(wv(i)&&wv(i)<32)throw new Cnt({data:typeof t=="string"?t:Ld(t),parameters:e,size:wv(i)});let a=0;const c=r==="Array"?[]:{};for(let l=0;l<e.length;++l){const u=e[l];o.setPosition(a);const[d,h]=Wv(o,u,{checksumAddress:s,staticPosition:0});a+=h,r==="Array"?c.push(d):c[u.name??l]=d}return c}function IH(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Gme({expectedLength:e.length,givenLength:t.length});const s=lnt({checksumAddress:r,parameters:e,values:t}),i=$H(s);return i.length===0?"0x":i}function bM(e,t){if(e.length!==t.length)throw new Gme({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(bM.encode(s,i))}return Ud(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return rT(c),Qw(c.toLowerCase(),s?32:0)}if(n==="string")return dH(r);if(n==="bytes")return r;if(n==="bool")return Qw(Qge(r),s?32:1);const i=n.match(Hme);if(i){const[c,l,u="256"]=i,d=Number.parseInt(u,10)/8;return Vo(r,{size:s?32:d,signed:l==="int"})}const o=n.match(tnt);if(o){const[c,l]=o;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new Kme({expectedSize:Number.parseInt(l,10),value:r});return ey(r,s?32:0)}const a=n.match(ent);if(a&&Array.isArray(r)){const[c,l]=a,u=[];for(let d=0;d<r.length;d++)u.push(t(l,r[d],!0));return u.length===0?"0x":Ud(...u)}throw new SH(n)}e.encode=t})(bM||(bM={}));function Vme(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?y0(e):e}let Cnt=class extends hn{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Xg(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}},$nt=class extends hn{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}},xnt=class extends hn{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}},Kme=class extends hn{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${pl(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}},Gme=class extends hn{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(` 65`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},Int=class extends hn{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}},SH=class extends hn{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}};const dc=BigInt(0),ra=BigInt(1),gw=BigInt(2),Snt=BigInt(3),Zme=BigInt(4),Yme=BigInt(5),Jme=BigInt(8);function Ya(e,t){const n=e%t;return n>=dc?n:t+n}function Dl(e,t,n){let r=e;for(;t-- >dc;)r*=r,r%=n;return r}function vM(e,t){if(e===dc)throw new Error("invert: expected non-zero number");if(t<=dc)throw new Error("invert: expected positive modulus, got "+t);let n=Ya(e,t),r=t,s=dc,i=ra;for(;n!==dc;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==ra)throw new Error("invert: does not exist");return Ya(s,t)}function Xme(e,t){const n=(e.ORDER+ra)/Zme,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Ant(e,t){const n=(e.ORDER-Yme)/Jme,r=e.mul(t,gw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,gw),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function _nt(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-ra,n=0;for(;t%gw===dc;)t/=gw,n++;let r=gw;const s=AH(e);for(;rte(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Xme;let i=s.pow(r,t);const o=(t+ra)/gw;return function(c,l){if(c.is0(l))return l;if(rte(c,l)!==1)throw new Error("Cannot find square root");let u=n,d=c.mul(c.ONE,i),h=c.pow(l,t),f=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let g=1,p=c.sqr(h);for(;!c.eql(p,c.ONE);)if(g++,p=c.sqr(p),g===u)throw new Error("Cannot find square root");const m=ra<<BigInt(u-g-1),w=c.pow(d,m);u=g,d=c.sqr(w),h=c.mul(h,d),f=c.mul(f,w)}return f}}function Nnt(e){return e%Zme===Snt?Xme:e%Jme===Yme?Ant:_nt(e)}const Tnt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pnt(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Tnt.reduce((r,s)=>(r[s]="function",r),t);return J7(e,n)}function Ont(e,t,n){if(n<dc)throw new Error("invalid exponent, negatives unsupported");if(n===dc)return e.ONE;if(n===ra)return t;let r=e.ONE,s=t;for(;n>dc;)n&ra&&(r=e.mul(r,s)),s=e.sqr(s),n>>=ra;return r}function Qme(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function rte(e,t){const n=(e.ORDER-ra)/gw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function e1e(e,t){t!==void 0&&Mm(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function AH(e,t,n=!1,r={}){if(e<=dc)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=e1e(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:Y7(s),ZERO:dc,ONE:ra,create:c=>Ya(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return dc<=c&&c<e},is0:c=>c===dc,isOdd:c=>(c&ra)===ra,neg:c=>Ya(-c,e),eql:(c,l)=>c===l,sqr:c=>Ya(c*c,e),add:(c,l)=>Ya(c+l,e),sub:(c,l)=>Ya(c-l,e),mul:(c,l)=>Ya(c*l,e),pow:(c,l)=>Ont(a,c,l),div:(c,l)=>Ya(c*vM(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>vM(c,e),sqrt:r.sqrt||(c=>(o||(o=Nnt(e)),o(a,c))),toBytes:c=>n?Vge(c,i):ZC(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" b
65ytes, got "+c.length);return n?Hge(c):Tw(c)},invertBatch:c=>Qme(a,c),cmov:(c,l,u)=>u?l:c});return Object.freeze(a)}function t1e(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function n1e(e){const t=t1e(e);return t+Math.ceil(t/2)}function knt(e,t,n=!1){const r=e.length,s=t1e(t),i=n1e(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?Hge(e):Tw(e),a=Ya(o,t-ra)+ra;return n?Vge(a,s):ZC(a,s)}const ste=BigInt(0),EM=BigInt(1);function Hk(e,t){const n=t.negate();return e?n:t}function r1e(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Vk(e,t){r1e(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=Y7(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function ite(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=EM);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function Rnt(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function Bnt(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Kk=new WeakMap,s1e=new WeakMap;function Gk(e){return s1e.get(e)||1}function Dnt(e,t){return{constTimeNegate:Hk,hasPrecomputes(n){return Gk(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>ste;)r&EM&&(s=s.add(i)),i=i.double(),r>>=EM;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=Vk(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=Vk(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=ite(s,c,a);s=l,d?o=o.add(Hk(f,r[g])):i=i.add(Hk(h,r[u]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=Vk(n,t);for(let a=0;a<o.windows&&s!==ste;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=ite(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return i},getPrecomputes(n,r,s){let i=Kk.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&Kk.set(r,s(i))),i},wNAFCached(n,r,s){const i=Gk(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=Gk(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){r1e(r,t),s1e.set(n,r),Kk.delete(n)}}}function Unt(e,t,n,r){Rnt(n,e),Bnt(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=fet(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=Y7(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function i1e(e){return Pnt(e.Fp),J7(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...e1e(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function ote(e){e.lowS!==void 0&&n4("lowS",e.lowS),e.prehash!==void 0&&n4("prehash",e.prehash)}function Lnt(e){const t=i1e(e);J7(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}let Mnt=class extends Error{constructor(t=""){super(t)}};const Ap={Err:Mnt,_tlv:{encode:(e,t)=>{const{Err:n}=Ap;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=eI(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?eI(s.length/2|128):"";return eI(e)+i+s+t},decode(e,t){const{Err:n}=Ap;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);
vendor: 10,478 bytes, line 65
65if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Ap;if(e<Mp)throw new t("integer: negative integers are not allowed");let n=eI(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Ap;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Tw(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Ap,s=su("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Ap,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function Zk(e,t){return r4(ZC(e,t))}const Mp=BigInt(0),di=BigInt(1);BigInt(2);const Yk=BigInt(3),jnt=BigInt(4);function Fnt(e){const t=Lnt(e),{Fp:n}=t,r=AH(t.n,t.nBitLength),s=t.toBytes||((E,b,S)=>{const v=b.toAffine();return tA(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const b=E.subarray(1),S=n.fromBytes(b.subarray(0,n.BYTES)),v=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:S,y:v}});function o(E){const{a:b,b:S}=t,v=n.sqr(E),x=n.mul(v,E);return n.add(n.add(x,n.mul(E,b)),S)}function a(E,b){const S=n.sqr(b),v=o(E);return n.eql(S,v)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,Yk),jnt),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(E){return uH(E,di,t.n)}function d(E){const{allowedPrivateKeyLengths:b,nByteLength:S,wrapPrivateKey:v,n:x}=t;if(b&&typeof E!="bigint"){if(GC(E)&&(E=r4(E)),typeof E!="string"||!b.includes(E.length))throw new Error("invalid private key");E=E.padStart(S*2,"0")}let A;try{A=typeof E=="bigint"?E:Tw(su("private key",E,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof E)}return v&&(A=Ya(A,x)),qv("private key",A,di,x),A}function h(E){if(!(E instanceof p))throw new Error("ProjectivePoint expected")}const f=Wee((E,b)=>{const{px:S,py:v,pz:x}=E;if(n.eql(x,n.ONE))return{x:S,y:v};const A=E.is0();b==null&&(b=A?n.ONE:n.inv(x));const I=n.mul(S,b),O=n.mul(v,b),N=n.mul(x,b);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:I,y:O}}),g=Wee(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:b,y:S}=E.toAffine();if(!n.isValid(b)||!n.isValid(S))throw new Error("bad point: x or y not FE");if(!a(b,S))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(b,S,v){if(b==null||!n.isValid(b))throw new Error("x required");if(S==null||!n.isValid(S)||n.is0(S))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=b,this.py=S,this.pz=v,Object.freeze(this)}static fromAffine(b){const{x:S,y:v}=b||{};if(!b||!n.isValid(S)||!n.isValid(v))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const x=A=>n.eql(A,n.ZERO);return x(S)&&x(v)?p.ZERO:new p(S,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const S=Qme(n,b.map(v=>v.pz));return b.map((v,x)=>v.toAffine(S[x])).map(p.fromAffine)}static fromHex(b){const S=p.fromAffine(i(su("pointHex",b)));return S.assertValidity(),S}static fromPrivateKey(b){return p.BASE.multiply(d(b))}static msm(b,S){return Unt(p,r,b,S)}_setWindowSize(b){C.setWindowSize(this,b)}assertValidity(){g(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b,N=n.eql(n.mul(S,O),n.mul(A,x)),T=n.eql(n.mul(v,O),n.mul(I,x));return N&&T}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:S}=t,v=n.mul(S,Yk),{px:x,py:A,pz:I}=this;let O=n.ZERO,N=n.ZERO,T=n.ZERO,P=n.mul(x,x),_=n.mul(A,A),y=n.mul(I,I),$=n.mul(x,A);return $=n.add($,$),T=n.mul(x,I),T=n.add(T,T),O=n.mul(b,T),N=n.mul(v,y),N=n.add(O,N),O=n.sub(_,N),N=n.add(_,N),N=n.mul(O,N),O=n.mul($,O),T=n.mul(v,T),y=n.mul(b,y),$=n.sub(P,y),$=n.mul(b,$),$=n.add($,T),T=n.add(P,P),P=n.add(T,P),P=n.add(P,y),P=n.mul(P,$),N=n.add(N,P),y=n.mul(A,I),y=n.add(y,y),P=n.mul(y,$),O=n.sub(O,P),T=n.mul(y,_),T=n.add(T,T),T=n.add(T,T),new p(O,N,T)}add(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b;let N=n.ZERO,T=n.ZERO,P=n.ZERO;const _=t.a,y=n.mul(t.b,Yk);let $=n.mul(S,A),R=n.mul(v,I),B=n.mul(x,O),k=n.add(S,v),D=n.add(A,I);k=n.mul(k,D),D=n.add($,R),k=n.sub(k,D),D=n.add(S,x);let U=n.add(A,O);return D=n.mul(D,U),U=n.add($,B),D=n.sub(D,U),U=n.add(v,x),N=n.add(I,O),U=n.mul(U,N),N=n.add(R,B),U=n.sub(U,N),P=n.mul(_,D),N=n.mul(y,B),P=n.add(N,P),N=n.sub(R,P),P=n.add(R,P),T=n.mul(N,P),R=n.add($,$),R=n.add(R,$),B=n.mul(_,B),D=n.mul(y,D),R=n.add(R,B),B=n.sub($,B),B=n.mul(_,B),D=n.add(D,B),$=n.mul(R,D),T=n.add(T,$),$=n.mul(U,D),N=n.mul(k,N),N=n.sub(N,$),$=n.mul(k,R),P=n.mul(U,P),P=n.add(P,$),new p(N,T,P)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return C.wNAFCached(this,b,p.normalizeZ)}multiplyUnsafe(b){const{endo:S,n:v}=t;qv("scalar",b,Mp,v);const x=p.ZERO;if(b===Mp)return x;if(this.is0()||b===di)return this;if(!S||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,b,p.normalizeZ);let{k1neg:A,k1:I,k2neg:O,k2:N}=S.splitScalar(b),T=x,P=x,_=this;for(;I>Mp||N>Mp;)I&di&&(T=T.add(_)),N&di&&(P=P.add(_)),_=_.double(),I>>=di,N>>=di;return A&&(T=T.negate()),O&&(P=P.negate()),P=new p(n.mul(P.px,S.beta),P.py,P.pz),T.add(P)}multiply(b){const{endo:S,n:v}=t;qv("scalar",b,di,v);let x,A;if(S){const{k1neg:I,k1:O,k2neg:N,k2:T}=S.splitScalar(b);let{p:P,f:_}=this.wNAF(O),{p:y,f:$}=this.wNAF(T);P=C.constTimeNegate(I,P),y=C.constTimeNegate(N,y),y=new p(n.mul(y.px,S.beta),y.py,y.pz),x=P.add(y),A=_.add($)}else{const{p:I,f:O}=this.wNAF(b);x=I,A=O}return p.normalizeZ([x,A])[0]}multiplyAndAddUnsafe(b,S,v){const x=p.BASE,A=(O,N)=>N===Mp||N===di||!O.equals(x)?O.multiplyUnsafe(N):O.multiply(N),I=A(this,S).add(A(b,v));return I.is0()?void 0:I}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:S}=t;if(b===di)return!0;if(S)return S(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:S}=t;return b===di?this:S?S(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return n4("isCompressed",b),this.assertValidity(),s(p,this,b)}toHex(b=!0){return n4("isCompressed",b),r4(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,C=Dnt(p,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:u}}function znt(e){const t=i1e(e);return J7(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function qnt(e){const t=znt(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(y){return Ya(y,r)}function l(y){return vM(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:h,isWithinCurveOrder:f}=Fnt({...t,toBytes(y,$,R){const B=$.toAffine(),k=n.toBytes(B.x),D=tA;return n4("isCompressed",R),R?D(Uint8Array.from([$.hasEvenY()?2:3]),k):D(Uint8Array.from([4]),k,n.toBytes(B.y))},fromBytes(y){const $=y.length,R=y[0],B=y.subarray(1);if($===o&&(R===2||R===3)){const k=Tw(B);if(!uH(k,di,n.ORDER))throw new Error("Point is not on curve");const D=h(k);let U;try{U=n.sqrt(D)}catch(q){const H=q instanceof Error?": "+q.message:"";throw new Error("Point is not on curve"+H)}const F=(U&di)===di;return(R&1)===1!==F&&(U=n.neg(U)),{x:k,y:U}}else if($===a&&R===4){const k=n.fromBytes(B.subarray(0,n.BYTES)),D=n.fromBytes(B.subarray(n.BYTES,2*n.BYTES));return{x:k,y:D}}else{const k=o,D=a;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+D+", got "+$)}}});function g(y){const $=r>>di;return y>$}function p(y){return g(y)?c(-y):y}const m=(y,$,R)=>Tw(y.slice($,R));class w{constructor($,R,B){qv("r",$,di,r),qv("s",R,di,r),this.r=$,this.s=R,B!=null&&(this.recovery=B),Object.freeze(this)}static fromCompact($){const R=s;return $=su("compactSignature",$,R*2),new w(m($,0,R),m($,R,2*R))}static fromDER($){const{r:R,s:B}=Ap.toSig(su("DER",$));return new w(R,B)}assertValidity(){}addRecoveryBit($){return new w(this.r,this.s,$)}recoverPublicKey($){const{r:R,s:B,recovery:k}=this,D=x(su("msgHash",$));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const U=k===2||k===3?R+t.n:R;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=(k&1)===0?"02":"03",K=u.fromHex(F+Zk(U,n.BYTES)),q=l(U),H=c(-D*q),Z=c(B*q),ee=u.BASE.multiplyAndAddUnsafe(K,H,Z);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return eA(this.toDERHex())}toDERHex(){return Ap.hexFromSig(this)}toCompactRawBytes(){return eA(this.toCompactHex())}toCompactHex(){const $=s;return Zk(this.r,$)+Zk(this.s,$)}}const C={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=n1e(t.n);return knt(t.randomBytes(y),t.n)},precompute(y=8,$=u.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}};function E(y,$=!0){return u.fromPrivateKey(y).toRawBytes($)}function b(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const R=su("key",y).length,B=n.BYTES,k=B+1,D=2*B+1;if(!(t.allowedPrivateKeyLengths||s===k))return R===k||R===D}function S(y,$,R=!0){if(b(y)===!0)throw new Error("first arg must be private key");if(b($)===!1)throw new Error("second arg must be public key");return u.fromHex($).multiply(d(y)).toRawBytes(R)}const v=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");
65const $=Tw(y),R=y.length*8-i;return R>0?$>>BigInt(R):$},x=t.bits2int_modN||function(y){return c(v(y))},A=Y7(i);function I(y){return qv("num < 2^"+i,y,Mp,A),ZC(y,s)}function O(y,$,R=N){if(["recovered","canonical"].some(X=>X in R))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:k}=t;let{lowS:D,prehash:U,extraEntropy:F}=R;D==null&&(D=!0),y=su("msgHash",y),ote(R),U&&(y=su("prehashed msgHash",B(y)));const K=x(y),q=d($),H=[I(q),I(K)];if(F!=null&&F!==!1){const X=F===!0?k(n.BYTES):F;H.push(su("extraEntropy",X))}const Z=tA(...H),ee=K;function ie(X){const le=v(X);if(!f(le))return;const _e=l(le),Ne=u.BASE.multiply(le).toAffine(),be=c(Ne.x);if(be===Mp)return;const Me=c(_e*c(ee+be*q));if(Me===Mp)return;let Ct=(Ne.x===be?0:2)|Number(Ne.y&di),Wt=Me;return D&&g(Me)&&(Wt=p(Me),Ct^=1),new w(be,Wt,Ct)}return{seed:Z,k2sig:ie}}const N={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(y,$,R=N){const{seed:B,k2sig:k}=O(y,$,R),D=t;return pet(D.hash.outputLen,D.nByteLength,D.hmac)(B,k)}u.BASE._setWindowSize(8);function _(y,$,R,B=T){var Ct;const k=y;$=su("msgHash",$),R=su("publicKey",R);const{lowS:D,prehash:U,format:F}=B;if(ote(B),"strict"in B)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw new Error("format must be compact or der");const K=typeof k=="string"||GC(k),q=!K&&!F&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!K&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,Z;try{if(q&&(H=new w(k.r,k.s)),K){try{F!=="compact"&&(H=w.fromDER(k))}catch(Wt){if(!(Wt instanceof Ap.Err))throw Wt}!H&&F!=="der"&&(H=w.fromCompact(k))}Z=u.fromHex(R)}catch{return!1}if(!H||D&&H.hasHighS())return!1;U&&($=t.hash($));const{r:ee,s:ie}=H,X=x($),le=l(ie),_e=c(X*le),Ne=c(ee*le),be=(Ct=u.BASE.multiplyAndAddUnsafe(Z,_e,Ne))==null?void 0:Ct.toAffine();return be?c(be.x)===ee:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:S,sign:P,verify:_,ProjectivePoint:u,Signature:w,utils:C}}function Wnt(e){return{hash:e,hmac:(t,...n)=>m6(e,t,w6(...n)),randomBytes:g6}}function Hnt(e,t){const n=r=>qnt({...e,...Wnt(r)});return{...n(t),create:n}}const o1e=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ate=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Vnt=BigInt(0),Knt=BigInt(1),CM=BigInt(2),cte=(e,t)=>(e+t/CM)/t;function Gnt(e){const t=o1e,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Dl(u,n,t)*u%t,h=Dl(d,n,t)*u%t,f=Dl(h,CM,t)*l%t,g=Dl(f,s,t)*f%t,p=Dl(g,i,t)*g%t,m=Dl(p,a,t)*p%t,w=Dl(m,c,t)*m%t,C=Dl(w,a,t)*p%t,E=Dl(C,n,t)*u%t,b=Dl(E,o,t)*g%t,S=Dl(b,r,t)*l%t,v=Dl(S,CM,t);if(!$M.eql($M.sqr(v),e))throw new Error("Cannot find square root");return v}const $M=AH(o1e,void 0,void 0,{sqrt:Gnt}),a1e=Hnt({a:Vnt,b:BigInt(7),Fp:$M,n:ate,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=ate,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Knt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=cte(i*e,t),c=cte(-r*e,t);let l=Ya(e-a*n-c*s,t),u=Ya(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},y6),Znt=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:a1e},Symbol.toStringTag,{value:"Module"}));function c1e(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Jk({signature:e});if(typeof e.s>"u")throw new Jk({signature:e});if(n&&typeof e.yParity>"u")throw new Jk({signature:e});if(e.r<0n||e.r>ete)throw new nrt({value:e.r});if(e.s<0n||e.s>ete)throw new rrt({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new NH({value:e.yParity})}function Ynt(e){return l1e(Ld(e))}function l1e(e){if(e.length!==130&&e.length!==132)throw new trt({signature:e});const t=BigInt(Gh(e,0,32)),n=BigInt(Gh(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return _H(s)}catch{throw new NH({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function Jnt(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return Xnt(e)}function Xnt(e){const t=typeof e=="string"?l1e(e):e instanceof Uint8Array?Ynt(e):typeof e.r=="string"?ert(e):e.v?Qnt(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return c1e(t),t}function Qnt(e){return{r:e.r,s:e.s,yParity:_H(e.v)}}function ert(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=_H(n)),typeof r!="number")throw new NH({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function _H(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new srt({value:e})}let trt=class extends hn{constructor({signature:t}){super(`Value \`${t}
65\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${pl(jet(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},Jk=class extends hn{constructor({signature:t}){super(`Signature \`${Yge(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},nrt=class extends hn{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},rrt=class extends hn{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},NH=class extends hn{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},srt=class extends hn{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function irt(e,t={}){return typeof e.chainId=="string"?ort(e):{...e,...t.signature}}function ort(e){const{address:t,chainId:n,nonce:r}=e,s=Jnt(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...s}}const art="0x8010801080108010801080108010801080108010801080108010801080108010",crt=Vme("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function u1e(e){if(typeof e=="string"){if(Gh(e,-32)!==art)throw new drt(e)}else c1e(e.authorization)}function lrt(e){u1e(e);const t=tme(Gh(e,-64,-32)),n=Gh(e,-t-64,-64),r=Gh(e,0,-t-64),[s,i,o]=Ent(crt,n);return{authorization:irt({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:r,...o&&o!=="0x"?{data:o,to:i}:{}}}function urt(e){try{return u1e(e),!0}catch{return!1}}let drt=class extends hn{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};function hrt(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function frt(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?sf(e.nonce):void 0,storageProof:e.storageProof?hrt(e.storageProof):void 0}}async function prt(e,{address:t,blockNumber:n,blockTag:r,storageKeys:s}){const i=r??"latest",o=n!==void 0?kt(n):void 0,a=await e.request({method:"eth_getProof",params:[t,s,o||i]});return frt(a)}async function grt(e,{address:t,blockNumber:n,blockTag:r="latest",slot:s}){const i=n!==void 0?kt(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,s,i||r]})}async function TH(e,{blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i,sender:o,nonce:a}){var h,f,g;const c=r||"latest",l=n!==void 0?kt(n):void 0;let u=null;if(s?u=await e.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,kt(i)]},{dedupe:!0}):typeof i=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||c,kt(i)]},{dedupe:!!l}):o&&typeof a=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[o,kt(a)]},{dedupe:!0})),!u)throw new VW({blockHash:t,blockNumber:n,blockTag:c,hash:s,index:i});return(((g=(f=(h=e.chain)==null?void 0:h.formatters)==null?void 0:f.transaction)==null?void 0:g.format)||G7)(u,"getTransaction")}async function mrt(e,{hash:t,transactionReceipt:n}){const[r,s]=await Promise.all([St(e,XC,"getBlockNumber")({}),t?St(e,TH,"getTransaction")({hash:t}):void 0]),i=(n==null?void 0:n.blockNumber)||(s==null?void 0:s.blockNumber);return i?r-i+1n:0n}async function IS(e,{hash:t}){var s,i,o;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new KW({hash:t});return(((o=(i=(s=e.chain)==null?void 0:s.formatters)==null?void 0:i.transactionReceipt)==null?void 0:o.format)||gH)(n,"getTransactionReceipt")}
65async function wrt(e,t){var C;const{account:n,authorizationList:r,allowFailure:s=!0,blockNumber:i,blockOverrides:o,blockTag:a,stateOverride:c}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof((C=e.batch)==null?void 0:C.multicall)=="object"?e.batch.multicall:{},h=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return pb({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),f=[[]];let g=0,p=0;for(let E=0;E<l.length;E++){const{abi:b,address:S,args:v,functionName:x}=l[E];try{const A=Al({abi:b,args:v,functionName:x});p+=(A.length-2)/2,u>0&&p>u&&f[g].length>0&&(g++,p=(A.length-2)/2,f[g]=[]),f[g]=[...f[g],{allowFailure:!0,callData:A,target:S}]}catch(A){const I=Jw(A,{abi:b,address:S,args:v,docsPath:"/docs/contract/multicall",functionName:x,sender:n});if(!s)throw I;f[g]=[...f[g],{allowFailure:!0,callData:"0x",target:S}]}}const m=await Promise.allSettled(f.map(E=>St(e,Md,"readContract")({...h===null?{code:fH}:{address:h},abi:ty,account:n,args:[E],authorizationList:r,blockNumber:i,blockOverrides:o,blockTag:a,functionName:"aggregate3",stateOverride:c}))),w=[];for(let E=0;E<m.length;E++){const b=m[E];if(b.status==="rejected"){if(!s)throw b.reason;for(let v=0;v<f[E].length;v++)w.push({status:"failure",error:b.reason,result:void 0});continue}const S=b.value;for(let v=0;v<S.length;v++){const{returnData:x,success:A}=S[v],{callData:I}=f[E][v],{abi:O,address:N,functionName:T,args:P}=l[w.length];try{if(I==="0x")throw new N6;if(!A)throw new KC({data:x});const _=z0({abi:O,args:P,data:x,functionName:T});w.push(s?{result:_,status:"success"}:_)}catch(_){const y=Jw(_,{abi:O,address:N,args:P,docsPath:"/docs/contract/multicall",functionName:T});if(!s)throw y;w.push({error:y,result:void 0,status:"failure"})}}}if(w.length!==l.length)throw new ve("multicall results mismatch");return w}async function xM(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:s,returnFullTransactions:i,traceTransfers:o,validation:a}=t;try{const c=[];for(const h of s){const f=h.blockOverrides?sme(h.blockOverrides):void 0,g=h.calls.map(m=>{const w=m,C=w.account?fl(w.account):void 0,E=w.abi?Al(w):w.data,b={...w,account:C,data:w.dataSuffix?$u([E||"0x",w.dataSuffix]):E,from:w.from??(C==null?void 0:C.address)};return fb(b),k6(b)}),p=h.stateOverrides?YW(h.stateOverrides):void 0;c.push({blockOverrides:f,calls:g,stateOverrides:p})}const u=(typeof n=="bigint"?kt(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:i,traceTransfers:o,validation:a},u]})).map((h,f)=>({...eH(h),calls:h.calls.map((g,p)=>{var O,N;const{abi:m,args:w,functionName:C,to:E}=s[f].calls[p],b=((O=g.error)==null?void 0:O.data)??g.returnData,S=BigInt(g.gasUsed),v=(N=g.logs)==null?void 0:N.map(T=>Dd(T)),x=g.status==="0x1"?"success":"failure",A=m&&x==="success"&&b!=="0x"?z0({abi:m,data:b,functionName:C}):null,I=(()=>{if(x==="success")return;let T;if(b==="0x"?T=new N6:b&&(T=new KC({data:b})),!!T)return Jw(T,{abi:m??[],address:E??"0x",args:w,functionName:C??"<unknown>"})})();return{data:b,gasUsed:S,logs:v,status:x,...x==="success"?{result:A}:{error:I}}})}))}catch(c){const l=c,u=H7(l,{});throw u instanceof O6?l:u}}function IM(e){let t=!0,n="",r=0,s="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new hn("Unable to normalize signature.");return s}function SM(e,t){const n=typeof e,r=t.type;switch(r){case"address":return wM(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>SM(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="str
65ing"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>SM(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function d1e(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return d1e(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?wM(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?wM(n[r],{strict:!1}):!1)return o}}function h1e(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?w0(e):e;return{...r,...n?{hash:yv(r)}:{}}}function sT(e,t,n){const{args:r=[],prepare:s=!0}=n??{},i=Fet(t,{strict:!1}),o=e.filter(l=>i?l.type==="function"||l.type==="error"?f1e(l)===Gh(t,0,4):l.type==="event"?yv(l)===t:!1:"name"in l&&l.name===t);if(o.length===0)throw new lA({name:t});if(o.length===1)return{...o[0],...s?{hash:yv(o[0])}:{}};let a;for(const l of o){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...s?{hash:yv(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((d,h)=>{const f="inputs"in l&&l.inputs[h];return f?SM(d,f):!1}
65)){if(a&&"inputs"in a&&a.inputs){const d=d1e(l.inputs,a.inputs,r);if(d)throw new brt({abiItem:l,type:d[0]},{abiItem:a,type:d[1]})}a=l}}const c=(()=>{if(a)return a;const[l,...u]=o;return{...l,overloads:u}})();if(!c)throw new lA({name:t});return{...c,...s?{hash:yv(c)}:{}}}function f1e(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return sT(n,r)}return e[0]})();return Gh(yv(t),0,4)}function yrt(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,s]=e;return sT(r,s)}return e[0]})(),n=typeof t=="string"?t:vu(t);return IM(n)}function yv(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return sT(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:qme(dH(yrt(t)))}let brt=class extends hn{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${IM(vu(t.abiItem))}\`, and`,`\`${n.type}\` in \`${IM(vu(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}},lA=class extends hn{constructor({name:t,data:n,type:r="item"}){const s=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}};function vrt(...e){var i;const[t,n]=(()=>{if(Array.isArray(e[0])){const[o,a]=e;return[Crt(o),a]}return e})(),{bytecode:r,args:s}=n;return Ud(r,(i=t.inputs)!=null&&i.length&&(s!=null&&s.length)?IH(t.inputs,s):"0x")}function Ert(e){return h1e(e)}function Crt(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new lA({name:"constructor"});return t}function $rt(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,d]=e;return[lte(l,u,{args:d}),d]}const[a,c]=e;return[a,c]})(),{overloads:r}=t,s=r?lte([t,...r],t.name,{args:n}):t,i=xrt(s),o=n.length>0?IH(s.inputs,n):void 0;return o?Ud(i,o):i}function l2(e,t={}){return h1e(e,t)}function lte(e,t,n){const r=sT(e,t,n);if(r.type!=="function")throw new lA({name:t,type:"function"});return r}function xrt(e){return f1e(e)}const p1e="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Gl="0x0000000000000000000000000000000000000000",Irt="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function Srt(e,t){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:i,traceAssetChanges:o,traceTransfers:a,validation:c}=t,l=t.account?fl(t.account):void 0;if(o&&!l)throw new ve("`account` is required when `traceAssetChanges` is true");const u=l?vrt(Ert("constructor(bytes, bytes)"),{bytecode:hH,args:[Irt,$rt(l2("function getBalance(address)"),[l.address])]}):void 0,d=o?await Promise.all(t.calls.map(async B=>{if(!B.data&&!B.abi)return;const{accessList:k}=await Ime(e,{account:l.address,...B,data:B.abi?Al(B):B.data});return k.map(({address:D,storageKeys:U})=>U.length>0?D:null)})).then(B=>B.flat().filter(Boolean)):[],h=await xM(e,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:u}],stateOverrides:i},{calls:d.map((B,k)=>({abi:[l2("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:B,from:Gl,nonce:k})),stateOverrides:[{address:Gl,nonce:0}]}]:[],{calls:[...s,{to:Gl}].map(B=>({...B,from:l==null?void 0:l.address})),stateOverrides:i},...o?[{calls:[{data:u}]},{calls:d.map((B,k)=>({abi:[l2("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:B,from:Gl,nonce:k})),stateOverrides:[{address:Gl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[l2("function decimals() returns (uint256)")],functionName:"decimals",from:Gl,nonce:k})),stateOverrides:[{address:Gl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[l2("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Gl,nonce:k})),stateOverrides:[{address:Gl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[l2("function symbol() returns (string)")],functionName:"symbol",from:Gl,nonce:k})),stateOverrides:[{address:Gl,nonce:0}]}]:[]],traceTransfers:a,validation:c}),f=o?h[2]:h[0],[g,p,,m,w,C,E,b]=o?h:[],{calls:S,...v}=f,x=S.slice(0,-1)??[],A=(g==null?void 0:g.calls)??[],I=(p==null?void 0:p.calls)??[],O=[...A,...I].map(B=>
65B.status==="success"?kd(B.data):null),N=(m==null?void 0:m.calls)??[],T=(w==null?void 0:w.calls)??[],P=[...N,...T].map(B=>B.status==="success"?kd(B.data):null),_=((C==null?void 0:C.calls)??[]).map(B=>B.status==="success"?B.result:null),y=((b==null?void 0:b.calls)??[]).map(B=>B.status==="success"?B.result:null),$=((E==null?void 0:E.calls)??[]).map(B=>B.status==="success"?B.result:null),R=[];for(const[B,k]of P.entries()){const D=O[B];if(typeof k!="bigint"||typeof D!="bigint")continue;const U=_[B-1],F=y[B-1],K=$[B-1],q=B===0?{address:p1e,decimals:18,symbol:"ETH"}:{address:d[B-1],decimals:K||U?Number(U??1):void 0,symbol:F??void 0};R.some(H=>H.token.address===q.address)||R.push({token:q,value:{pre:D,post:k,diff:k-D}})}return{assetChanges:R,block:v,results:x}}const g1e="0x6492649264926492649264926492649264926492649264926492649264926492";function Art(e){if(Gh(e,-32)!==g1e)throw new Trt(e)}function _rt(e){const{data:t,signature:n,to:r}=e;return Ud(IH(Vme("address, bytes, bytes"),[r,t,n]),g1e)}function Nrt(e){try{return Art(e),!0}catch{return!1}}let Trt=class extends hn{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}};function AM({r:e,s:t,to:n="hex",v:r,yParity:s}){const i=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new a1e.Signature(kd(e),kd(t)).toCompactHex()}${i===0?"1b":"1c"}`;return n==="hex"?o:Bd(o)}async function iT(e,t){var l,u,d,h;const{address:n,chain:r=e.chain,hash:s,erc6492VerifierAddress:i=t.universalSignatureVerifierAddress??((u=(l=r==null?void 0:r.contracts)==null?void 0:l.erc6492Verifier)==null?void 0:u.address),multicallAddress:o=t.multicallAddress??((h=(d=r==null?void 0:r.contracts)==null?void 0:d.multicall3)==null?void 0:h.address),mode:a="auto"}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const c=(()=>{const f=t.signature;return Cu(f)?f:typeof f=="object"&&"r"in f&&"s"in f?AM(f):Rs(f)})();try{if(a==="eoa")try{if(Xw(Z8(n),await H9({hash:s,signature:c})))return!0}catch{}return urt(c)?await Prt(e,{...t,multicallAddress:o,signature:c}):await Ort(e,{...t,verifierAddress:i,signature:c})}catch(f){if(a!=="eoa")try{if(Xw(Z8(n),await H9({hash:s,signature:c})))return!0}catch{}if(f instanceof ny)return!1;throw f}}async function Prt(e,t){var m;const{address:n,blockNumber:r,blockTag:s,hash:i,multicallAddress:o}=t,{authorization:a,data:c,signature:l,to:u}=lrt(t.signature);if(await aA(e,{address:n,blockNumber:r,blockTag:s})===hb(["0xef0100",a.address]))return await krt(e,{address:n,blockNumber:r,blockTag:s,hash:i,signature:l});const h={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:kt(a.r,{size:32}),s:kt(a.s,{size:32}),yParity:a.yParity};if(!await Rtt({address:n,authorization:h}))throw new ny;const g=await St(e,Md,"readContract")({...o?{address:o}:{code:fH},authorizationList:[h],abi:ty,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:u??n,callData:c}]:[],{allowFailure:!0,target:n,callData:Al({abi:ame,functionName:"isValidSignature",args:[i,l]})}]]}),p=(m=g[g.length-1])==null?void 0:m.returnData;if(p!=null&&p.startsWith("0x1626ba7e"))return!0;throw new ny}async function Ort(e,t){const{address:n,factory:r,factoryData:s,hash:i,signature:o,verifierAddress:a,...c}=t,l=await(async()=>!r&&!s||Nrt(o)?o:_rt({data:s,signature:o,to:r}))(),u=a?{to:a,data:Al({abi:nA,functionName:"isValidSig",args:[n,i,l]}),...c}:{data:Q7({abi:nA,args:[n,i,l],bytecode:pM}),...c},{data:d}=await St(e,R6,"call")(u).catch(h=>{throw h instanceof GW?new ny:h});if(C0e(d??"0x0"))return!0;throw new ny}async function krt(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,signature:o}=t;if((await St(e,Md,"readContract")({address:n,abi:ame,args:[i,o],blockNumber:r,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof ZW?new ny:c})).startsWith("0x1626ba7e"))return!0;throw new ny}let ny=class extends Error{};async function Rrt(e,{address:t,message:n,factory:r,factoryData:s,signature:i,...o}){const a=vH(n);return St(e,iT,"verifyHash")({address:t,factory:r,factoryData:s,hash:a,signature:i,...o})}async function Brt(e,t){const{address:n,factory:r,factoryData:s,signature:i,message:o,primaryType:a,types:c,domain:l,...u}=t,d=Lme({message:o,primaryType:a,types:c,domain:l});return St(e,iT,"verifyHash")({address:n,factory:r,factoryData:s,hash:d,signature:i,...u})}function m1e(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:s,poll:i,pollingInterval:o=e.pollingInterval}){const a=typeof i<"u"?i:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
65onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let c;return a?(()=>{const d=Ps(["watchBlockNumber",e.uid,t,n,o]);return Vm(d,{onBlockNumber:r,onError:s},h=>JC(async()=>{var f;try{const g=await St(e,XC,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(g===c)return;if(g-c>1&&n)for(let p=c+1n;p<g;p++)h.onBlockNumber(p,c),c=p}(c===void 0||g>c)&&(h.onBlockNumber(g,c),c=g)}catch(g){(f=h.onError)==null||f.call(h,g)}},{emitOnBegin:t,interval:o}))})():(()=>{const d=Ps(["watchBlockNumber",e.uid,t,n]);return Vm(d,{onBlockNumber:r,onError:s},h=>{let f=!0,g=()=>f=!1;return(async()=>{try{const p=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find(C=>C.config.type==="webSocket"||C.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:m}=await p.subscribe({params:["newHeads"],onData(w){var E;if(!f)return;const C=kd((E=w.result)==null?void 0:E.number);h.onBlockNumber(C,c),c=C},onError(w){var C;(C=h.onError)==null||C.call(h,w)}});g=m,f||g()}catch(p){s==null||s(p)}})(),()=>g()})})()}async function Drt(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:s,onReplaced:i,retryCount:o=6,retryDelay:a=({count:S})=>~~(1<<S)*200,timeout:c=18e4}=t,l=Ps(["waitForTransactionReceipt",e.uid,s]),u=(()=>{var S;return t.pollingInterval?t.pollingInterval:(S=e.chain)!=null&&S.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let d,h,f,g=!1,p,m;const{promise:w,resolve:C,reject:E}=ume(),b=c?setTimeout(()=>{m==null||m(),p==null||p(),E(new H0e({hash:s}))},c):void 0;return p=Vm(l,{onReplaced:i,resolve:C,reject:E},async S=>{if(f=await St(e,IS,"getTransactionReceipt")({hash:s}).catch(()=>{}),f&&r<=1){clearTimeout(b),S.resolve(f),p==null||p();return}m=St(e,m1e,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(v){const x=I=>{clearTimeout(b),m==null||m(),I(),p==null||p()};let A=v;if(!g)try{if(f){if(r>1&&(!f.blockNumber||A-f.blockNumber+1n<r))return;x(()=>S.resolve(f));return}if(n&&!d&&(g=!0,await iA(async()=>{d=await St(e,TH,"getTransaction")({hash:s}),d.blockNumber&&(A=d.blockNumber)},{delay:a,retryCount:o}),g=!1),f=await St(e,IS,"getTransactionReceipt")({hash:s}),r>1&&(!f.blockNumber||A-f.blockNumber+1n<r))return;x(()=>S.resolve(f))}catch(I){if(I instanceof VW||I instanceof KW){if(!d){g=!1;return}try{h=d,g=!0;const O=await iA(()=>St(e,$d,"getBlock")({blockNumber:A,includeTransactions:!0}),{delay:a,retryCount:o,shouldRetry:({error:P})=>P instanceof XW});g=!1;const N=O.transactions.find(({from:P,nonce:_})=>P===h.from&&_===h.nonce);if(!N||(f=await St(e,IS,"getTransactionReceipt")({hash:N.hash}),r>1&&(!f.blockNumber||A-f.blockNumber+1n<r)))return;let T="replaced";N.to===h.to&&N.value===h.value&&N.input===h.input?T="repriced":N.from===N.to&&N.value===0n&&(T="cancelled"),x(()=>{var P;(P=S.onReplaced)==null||P.call(S,{reason:T,replacedTransaction:h,transaction:N,transactionReceipt:f}),S.resolve(f)})}catch(O){x(()=>S.reject(O))}}else x(()=>S.reject(I))}}})}),w}function Urt(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:i,includeTransactions:o,poll:a,pollingInterval:c=e.pollingInterval}){const l=typeof a<"u"?a:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
65onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=o??!1;let d;return l?(()=>{const g=Ps(["watchBlocks",e.uid,t,n,r,u,c]);return Vm(g,{onBlock:s,onError:i},p=>JC(async()=>{var m;try{const w=await St(e,$d,"getBlock")({blockTag:t,includeTransactions:u});if(w.number!==null&&(d==null?void 0:d.number)!=null){if(w.number===d.number)return;if(w.number-d.number>1&&n)for(let C=(d==null?void 0:d.number)+1n;C<w.number;C++){const E=await St(e,$d,"getBlock")({blockNumber:C,includeTransactions:u});p.onBlock(E,d),d=E}}((d==null?void 0:d.number)==null||t==="pending"&&(w==null?void 0:w.number)==null||w.number!==null&&w.number>d.number)&&(p.onBlock(w,d),d=w)}catch(w){(m=p.onError)==null||m.call(p,w)}},{emitOnBegin:r,interval:c}))})():(()=>{let g=!0,p=!0,m=()=>g=!1;return(async()=>{try{r&&St(e,$d,"getBlock")({blockTag:t,includeTransactions:u}).then(E=>{g&&p&&(s(E,void 0),p=!1)}).catch(i);const w=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),{unsubscribe:C}=await w.subscribe({params:["newHeads"],async onData(E){var S;if(!g)return;const b=await St(e,$d,"getBlock")({blockNumber:(S=E.result)==null?void 0:S.number,includeTransactions:u}).catch(()=>{});g&&(s(b,d),p=!1,d=b)},onError(E){i==null||i(E)}});m=C,g||m()}catch(w){i==null||i(w)}})(),()=>m()})()}function Lrt(e,{address:t,args:n,batch:r=!0,event:s,events:i,fromBlock:o,onError:a,onLogs:c,poll:l,pollingInterval:u=e.pollingInterval,strict:d}){const h=typeof l<"u"?l:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
65onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=d??!1;return h?(()=>{const m=Ps(["watchEvent",t,n,r,e.uid,s,u,o]);return Vm(m,{onLogs:c,onError:a},w=>{let C;o!==void 0&&(C=o-1n);let E,b=!1;const S=JC(async()=>{var v;if(!b){try{E=await St(e,Sme,"createEventFilter")({address:t,args:n,event:s,events:i,strict:f,fromBlock:o})}catch{}b=!0;return}try{let x;if(E)x=await St(e,eT,"getFilterChanges")({filter:E});else{const A=await St(e,XC,"getBlockNumber")({});C&&C!==A?x=await St(e,aH,"getLogs")({address:t,args:n,event:s,events:i,fromBlock:C+1n,toBlock:A}):x=[],C=A}if(x.length===0)return;if(r)w.onLogs(x);else for(const A of x)w.onLogs([A])}catch(x){E&&x instanceof Yw&&(b=!1),(v=w.onError)==null||v.call(w,x)}},{emitOnBegin:!0,interval:u});return async()=>{E&&await St(e,tT,"uninstallFilter")({filter:E}),S()}})})():(()=>{let m=!0,w=()=>m=!1;return(async()=>{try{const C=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),E=i??(s?[s]:void 0);let b=[];E&&(b=[E.flatMap(x=>T6({abi:[x],eventName:x.name,args:n}))],s&&(b=b[0]));const{unsubscribe:S}=await C.subscribe({params:["logs",{address:t,topics:b}],onData(v){var A;if(!m)return;const x=v.result;try{const{eventName:I,args:O}=t4({abi:E??[],data:x.data,topics:x.topics,strict:f}),N=Dd(x,{args:O,eventName:I});c([N])}catch(I){let O,N;if(I instanceof G8||I instanceof M7){if(d)return;O=I.abiItem.name,N=(A=I.abiItem.inputs)==null?void 0:A.some(P=>!("name"in P&&P.name))}const T=Dd(x,{args:N?[]:{},eventName:O});c([T])}},onError(v){a==null||a(v)}});w=S,m||w()}catch(C){a==null||a(C)}})(),()=>w()})()}function Mrt(e,{batch:t=!0,onError:n,onTransactions:r,poll:s,pollingInterval:i=e.pollingInterval}){return(typeof s<"u"?s:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const l=Ps(["watchPendingTransactions",e.uid,t,i]);return Vm(l,{onTransactions:r,onError:n},u=>{let d;const h=JC(async()=>{var f;try{if(!d)try{d=await St(e,Ame,"createPendingTransactionFilter")({});return}catch(p){throw h(),p}const g=await St(e,eT,"getFilterChanges")({filter:d});if(g.length===0)return;if(t)u.onTransactions(g);else for(const p of g)u.onTransactions([p])}catch(g){(f=u.onError)==null||f.call(u,g)}},{emitOnBegin:!0,interval:i});return async()=>{d&&await St(e,tT,"uninstallFilter")({filter:d}),h()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(h){if(!l)return;const f=h.result;r([f])},onError(h){n==null||n(h)}});u=d,l||u()}catch(d){n==null||n(d)}})(),()=>u()})()}function jrt(e){var d,h,f;const{scheme:t,statement:n,...r}=((d=e.match(Frt))==null?void 0:d.groups)??{},{chainId:s,expirationTime:i,issuedAt:o,notBefore:a,requestId:c,...l}=((h=e.match(zrt))==null?void 0:h.groups)??{},u=(f=e.split("Resources:")[1])==null?void 0:f.split(` 66- `).slice(1);return{...r,...l,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const Frt=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,zrt=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function qrt(e){const{address:t,domain:n,message:r,nonce:s,scheme:i,time:o=new Date}=e;if(n&&r.domain!==n||s&&r.nonce!==s||i&&r.scheme!==i||r.expirationTime&&o>=r.expirationTime||r.notBefore&&o<r.notBefore)return!1;try{if(!r.address||!hl(r.address,{strict:!1})||t&&!Xw(r.address,t))return!1}catch{return!1}return!0}async function Wrt(e,t){const{address:n,domain:r,message:s,nonce:i,scheme:o,signature:a,time:c=new Date,...l}=t,u=jrt(s);
66if(!u.address||!qrt({address:n,domain:r,message:u,nonce:i,scheme:o,time:c}))return!1;const h=vH(s);return iT(e,{address:u.address,hash:h,signature:a,...l})}async function Hrt(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var a,c,l;const s=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),o=(((l=(c=(a=e.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:l.format)||gH)(s);if(o.status==="reverted"&&n)throw new WQe({receipt:o});return o}function w1e(e){return{call:t=>R6(e,t),createAccessList:t=>Ime(e,t),createBlockFilter:()=>$tt(e),createContractEventFilter:t=>P0e(e,t),createEventFilter:t=>Sme(e,t),createPendingTransactionFilter:()=>Ame(e),estimateContractGas:t=>cet(e,t),estimateGas:t=>oH(e,t),getBalance:t=>xtt(e,t),getBlobBaseFee:()=>Itt(e),getBlock:t=>$d(e,t),getBlockNumber:t=>XC(e,t),getBlockTransactionCount:t=>Stt(e,t),getBytecode:t=>aA(e,t),getChainId:()=>iH(e),getCode:t=>aA(e,t),getContractEvents:t=>zge(e,t),getDelegation:t=>Att(e,t),getEip712Domain:t=>Ntt(e,t),getEnsAddress:t=>ctt(e,t),getEnsAvatar:t=>vtt(e,t),getEnsName:t=>Ett(e,t),getEnsResolver:t=>Ctt(e,t),getEnsText:t=>xme(e,t),getFeeHistory:t=>Ott(e,t),estimateFeesPerGas:t=>ret(e,t),getFilterChanges:t=>eT(e,t),getFilterLogs:t=>ktt(e,t),getGasPrice:()=>tH(e),getLogs:t=>aH(e,t),getProof:t=>prt(e,t),estimateMaxPriorityFeePerGas:t=>net(e,t),fillTransaction:t=>jge(e,t),getStorageAt:t=>grt(e,t),getTransaction:t=>TH(e,t),getTransactionConfirmations:t=>mrt(e,t),getTransactionCount:t=>Pge(e,t),getTransactionReceipt:t=>IS(e,t),multicall:t=>wrt(e,t),prepareTransactionRequest:t=>Fge(e,t),readContract:t=>Md(e,t),sendRawTransaction:t=>stt(e,t),sendRawTransactionSync:t=>Hrt(e,t),simulate:t=>xM(e,t),simulateBlocks:t=>xM(e,t),simulateCalls:t=>Srt(e,t),simulateContract:t=>Jet(e,t),verifyHash:t=>iT(e,t),verifyMessage:t=>Rrt(e,t),verifySiweMessage:t=>Wrt(e,t),verifyTypedData:t=>Brt(e,t),uninstallFilter:t=>tT(e,t),waitForTransactionReceipt:t=>Drt(e,t),watchBlocks:t=>Urt(e,t),watchBlockNumber:t=>m1e(e,t),watchContractEvent:t=>rtt(e,t),watchEvent:t=>Lrt(e,t),watchPendingTransactions:t=>Mrt(e,t)}}function Vrt(e){const{key:t="public",name:n="Public Client"}=e;return gme({...e,key:t,name:n,type:"publicClient"}).extend(w1e)}function PH({key:e,methods:t,name:n,request:r,retryCount:s=3,retryDelay:i=150,timeout:o,type:a},c){const l=pme();return{config:{key:e,methods:t,name:n,request:r,retryCount:s,retryDelay:i,timeout:o,type:a},request:Dtt(r,{methods:t,retryCount:s,retryDelay:i,uid:l}),value:c}}function _M(e,t={}){const{key:n="fallback",name:r="Fallback",rank:s=!1,shouldThrow:i=y1e,retryCount:o,retryDelay:a}=t;return(({chain:c,pollingInterval:l=4e3,timeout:u,...d})=>{let h=e,f=()=>{};const g=PH({key:n,name:r,async request({method:p,params:m}){let w;const C=async(E=0)=>{const b=h[E]({...d,chain:c,retryCount:0,timeout:u});try{const S=await b.request({method:p,params:m});return f({method:p,params:m,response:S,transport:b,status:"success"}),S}catch(S){if(f({error:S,method:p,params:m,transport:b,status:"error"}),i(S)||E===h.length-1||(w??(w=h.slice(E+1).some(v=>{const{include:x,exclude:A}=v({chain:c}).config.methods||{};return x?x.includes(p):A?!A.includes(p):!0})),!w))throw S;return C(E+1)}};return C()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:p=>f=p,transports:h.map(p=>p({chain:c,retryCount:0}))});if(s){const p=typeof s=="object"?s:{};Krt({chain:c,interval:p.interval??l,onTransports:m=>h=m,ping:p.ping,sampleCount:p.sampleCount,timeout:p.timeout,transports:h,weights:p.weights})}return g})}function y1e(e){return!!("code"in e&&typeof e.code=="number"&&(e.code===J8.code||e.code===zv.code||e.code===W9.code||cm.nodeMessage.test(e.message)||e.code===5e3))}function Krt({chain:e,interval:t=4e3,onTransports:n,ping:r,sampleCount:s=10,timeout:i=1e3,transports:o,weights:a={}}){const{stability:c=.7,latency:l=.3}=a,u=[],d=async()=>{const h=await Promise.all(o.map(async p=>{const m=p({chain:e,retryCount:0,timeout:i}),w=Date.now();let C,E;try{await(r?r({transport:m}):m.request({method:"net_listening"})),E=1}catch{E=0}finally{C=Date.now()}return{latency:C-w,success:E}}));u.push(h),u.length>s&&u.shift();const f=Math.max(...u.map(p=>Math.max(...p.map(({latency:m})=>m)))),g=o.map((p,m)=>{const w=u.map(v=>v[m].latency),E=1-w.reduce((v,x)=>v+x,0)/w.length/f,b=u.map(v=>v[m].success),S=b.reduce((v,x)=>v+x,0)/b.length;return S===0?[0,m]:[l*E+c*S,m]}).sort((p,m)=>m[0]-p[0]);n(g.map(([,p])=>o[p])),await sA(t),d()};d()}let b1e=class extends ve{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}};function OE(e,t={}){const{batch:n,fetchFn:r,fetchOptions:s,key:i="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:u,raw:d}=t;return({chain:h,retryCount:f,timeout:g})=>{const{batchSize:p=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??f,C=g??t.timeout??1e4,E=e||(h==null?void 0:h.rpcUrls.default.http[0]);if(!E)throw new b1e;const b=Wtt(E,{fetchFn:r,fetchOptions:s,onRequest:c,onResponse:l,timeout:C});return PH({key:i,methods:o,name:a,async request({method:S,params:v}){const x={method:S,params:v},{schedule:A}=dme({id:E,wait:m,shouldSplitBatch(T){return T.length>p},fn:T=>b.request({body:T}),sort:(T,P)=>T.id-P.id}),I=async T=>n?A(T):[await b.request({body:T})],[{error:O,result:N}]=await I(x);if(d)return{error:O,result:N};if(O)throw new W7({body:x,error:O,url:E});return N},retryCount:w,retryDelay:u,timeout:C,type:"http"},{fetchOptions:s,url:E})}}const Grt=Object.freeze(Object.defineProperty({__proto__:null,AbiConstructorNotFoundError:i0e,AbiConstructorParamsNotFoundError:iM,AbiDecodingDataSizeTooSmallError:kW,AbiDecodingZeroDataError:N6,AbiEncodingArrayLe
66ngthMismatchError:o0e,AbiEncodingBytesSizeMismatchError:a0e,AbiEncodingLengthMismatchError:c0e,AbiErrorInputsNotFoundError:l0e,AbiErrorNotFoundError:oM,AbiErrorSignatureNotFoundError:RW,AbiEventNotFoundError:aM,AbiEventSignatureEmptyTopicsError:u0e,AbiEventSignatureNotFoundError:d0e,AbiFunctionNotFoundError:Gw,AbiFunctionOutputsNotFoundError:BW,AbiFunctionSignatureNotFoundError:h0e,AccountStateConflictError:F0e,AtomicReadyWalletRejectedUpgradeError:z9,AtomicityNotSupportedError:q9,BaseError:ve,BaseFeeScalarError:JW,BlockNotFoundError:XW,BundleTooLargeError:F9,BytesSizeMismatchError:f0e,CallExecutionError:GW,ChainDisconnectedError:B9,ChainDoesNotSupportContract:rA,CircularReferenceError:v7,ClientChainNotConfiguredError:pH,ContractFunctionExecutionError:ZW,ContractFunctionRevertedError:x9,ContractFunctionZeroDataError:V0e,CounterfactualDeploymentFailedError:K0e,DecodeLogDataMismatch:G8,DecodeLogTopicsMismatch:M7,DuplicateIdError:M9,Eip1559FeesNotSupportedError:K7,EnsAvatarInvalidNftUriError:Q2,EnsAvatarUnsupportedNamespaceError:Eme,EnsAvatarUriResolutionError:nT,EstimateGasExecutionError:Sge,ExecutionRevertedError:cm,FeeCapTooHighError:Q8,FeeCapTooLowError:V9,FilterTypeNotSupportedError:w0e,HttpRequestError:Cm,InsufficientFundsError:Y9,IntegerOutOfRangeError:j7,InternalRpcError:f5,IntrinsicGasTooHighError:J9,IntrinsicGasTooLowError:X9,InvalidAbiDecodingTypeError:g0e,InvalidAbiEncodingTypeError:p0e,InvalidAbiItemError:u7,InvalidAbiParametersError:h7,InvalidAbiTypeParameterError:w7,InvalidAddressError:v0,InvalidArrayError:DW,InvalidBytesBooleanError:b0e,InvalidDefinitionTypeError:m0e,InvalidDomainError:kme,InvalidFunctionModifierError:m7,InvalidHexBooleanError:v0e,InvalidInputRpcError:Yw,InvalidModifierError:g7,InvalidParameterError:f7,InvalidParamsRpcError:_9,InvalidParenthesisError:E7,InvalidPrimaryTypeError:Rme,InvalidRequestRpcError:S9,InvalidSerializableTransactionError:q0e,InvalidSignatureError:M0,InvalidStructSignatureError:b7,InvalidStructTypeError:Bme,JsonRpcVersionUnsupportedError:P9,LimitExceededRpcError:X8,MaxFeePerGasTooLowError:Nge,MethodNotFoundRpcError:A9,MethodNotSupportedRpcError:mv,NonceMaxValueError:Z9,NonceTooHighError:K9,NonceTooLowError:G9,ParseRpcError:I9,ProviderDisconnectedError:R9,ProviderRpcError:ma,RawContractError:KC,ResourceNotFoundRpcError:N9,ResourceUnavailableRpcError:T9,RpcError:ga,RpcRequestError:W7,SizeExceedsPaddingSizeError:LW,SizeOverflowError:E0e,SliceOffsetOutOfBoundsError:UW,SolidityProtectedKeywordError:p7,StateAssignmentConflictError:z0e,SwitchChainError:D9,TimeoutError:uM,TipAboveFeeCapError:e4,TransactionExecutionError:W0e,TransactionNotFoundError:VW,TransactionReceiptNotFoundError:KW,TransactionRejectedRpcError:J8,TransactionTypeNotSupportedError:Q9,UnauthorizedProviderError:O9,UnknownBundleIdError:j9,UnknownNodeError:O6,UnknownRpcError:vge,UnknownSignatureError:y7,UnknownTypeError:d7,UnsupportedChainIdError:L9,UnsupportedNonOptionalCapabilityError:U9,UnsupportedProviderMethodError:k9,UrlRequiredError:b1e,UserRejectedRequestError:zv,WaitForTransactionReceiptTimeoutError:H0e,assertRequest:fb,blobsToCommitments:nH,blobsToProofs:rH,boolToBytes:$0e,boolToHex:MW,bytesToBigInt:B0e,bytesToBool:D0e,bytesToHex:Rs,bytesToNumber:Kh,bytesToString:U0e,ccipFetch:cA,ccipRequest:cA,checksumAddress:qC,commitmentToVersionedHash:kge,commitmentsToVersionedHashes:Rge,concat:$u,concatBytes:I0e,concatHex:hb,createClient:gme,createPublicClient:Vrt,createTransport:PH,decodeAbiParameters:P6,decodeErrorResult:HW,decodeEventLog:t4,decodeFunctionData:mme,decodeFunctionResult:z0,defineChain:ztt,deploylessCallViaBytecodeBytecode:hH,deploylessCallViaFactoryBytecode:cme,encodeAbiParameters:F0,encodeDeployData:Q7,encodeErrorResult:mM,encodeEventTopics:T6,encodeFunctionData:Al,encodeFunctionResult:wme,erc20Abi:PE,erc6492SignatureValidatorAbi:nA,erc6492SignatureValidatorByteCode:pM,ethAddress:p1e,etherUnits:M0e,fallback:_M,formatBlock:eH,formatEther:q7,formatGwei:na,formatLog:Dd,formatTransaction:G7,formatTransactionReceipt:gH,formatTransactionRequest:k6,formatUnits:WC,getAbiItem:f1,getAddress:Z8,getChainContractAddress:pb,getContractError:Jw,getEventSelector:h5,getEventSignature:TE,getFunctionSelector:Zw,getFunctionSignature:TE,getTransactionType:Mge,getTypesForEIP712Domain:Ume,gweiUnits:j0e,hashDomain:Mme,hashMessage:vH,hashStruct:EH,hashTypedData:Lme,hexToBigInt:kd,hexToBool:C0e,hexToBytes:Bd,hexToNumber:sf,http:OE,isAddress:hl,isAddressEqual:Xw,isHex:Cu,keccak256:Ii,labelhash:vme,maxUint256:_ge,multicall3Abi:ty,namehash:oA,numberToBytes:x0e,numberToHex:kt,offchainLookup:Nme,offchainLookupAbiItem:bH,offchainLookupSignature:_me,pad:ub,padBytes:y0e,padHex:r0,parseAbi:j0,parseAbiItem:w0,parseAbiParameters:y0,parseEventLogs:Z7,prepareEncodeFunctionData:O0e,presignMessagePrefix:Pme,publicActions:w1e,recoverAddress:H9,recoverPublicKey:Ege,rpcTransactionType:Age,serializeSignature:AM,sha256:Oge,shouldThrow:y1e,signatureToHex:AM,size:Qr,slice:Hm,sliceBytes:jW,sliceHex:_0e,stringToBytes:Em,stringToHex:d5,stringify:Ps,toBlobSidecars:Lge,toBlobs:Uge,toBytes:db,toEventHash:$9,toEventSelector:h5,toEventSignature:TE,toFunctionHash:$9,toFunctionSelector:Zw,toFunctionSignature:TE,toHex:Rd,toPrefixedMessage:Ome,toRlp:Cge,transactionType:QW,trim:vm,universalSignatureValidatorAbi:nA,universalSignatureValidatorByteCode:pM,validateTypedData:Dme,withCache:fme,withRetry:iA,withTimeout:Tme,zeroAddress:Gl},Symbol.toStringTag,{value:"Module"}));async function H3(...e){const t=await fetch(...e);if(!t.ok)throw new Error(`HTTP status code: ${t.status}`,{cause:t});return t}let e$=class{constructor({baseUrl:t,clientId:n}
66){this.baseUrl=t,this.clientId=n}async get({headers:t,signal:n,cache:r,...s}){const i=this.createUrl(s);return(await H3(i,{method:"GET",headers:t,signal:n,cache:r})).json()}async getBlob({headers:t,signal:n,...r}){const s=this.createUrl(r);return(await H3(s,{method:"GET",headers:t,signal:n})).blob()}async post({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await H3(i,{method:"POST",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async put({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await H3(i,{method:"PUT",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async delete({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await H3(i,{method:"DELETE",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}createUrl({path:t,params:n}){const r=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,i])=>{i&&r.searchParams.append(s,i)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}sendBeacon({body:t,...n}){const r=this.createUrl(n);return navigator.sendBeacon(r.toString(),t?JSON.stringify(t):void 0)}};const NM={getFeatureValue(e,t){const n=t==null?void 0:t[e];return n===void 0?mn.DEFAULT_FEATURES[e]:n},filterSocialsByPlatform(e){if(!e||!e.length)return e;let t=e;return Je.isTelegram()&&(Je.isIos()&&(t=t.filter(n=>n!=="google")),Je.isMac()&&(t=t.filter(n=>n!=="x")),Je.isAndroid()&&(t=t.filter(n=>!["facebook","x"].includes(n)))),Je.isMobile()&&(t=t.filter(n=>n!=="facebook")),t},isSocialsEnabled(){var e,t,n,r;return Array.isArray((e=pe.state.features)==null?void 0:e.socials)&&((t=pe.state.features)==null?void 0:t.socials.length)>0||Array.isArray((n=pe.state.remoteFeatures)==null?void 0:n.socials)&&((r=pe.state.remoteFeatures)==null?void 0:r.socials.length)>0},isEmailEnabled(){var e,t;return!!((e=pe.state.features)!=null&&e.email||(t=pe.state.remoteFeatures)!=null&&t.email)}},mt=zr({features:mn.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:mn.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{},enableMobileFullScreen:!1,coinbasePreference:"all"}),pe={state:mt,subscribeKey(e,t){return Zi(mt,e,t)},setOptions(e){Object.assign(mt,e)},setRemoteFeatures(e){var n,r;if(!e)return;const t={...mt.remoteFeatures,...e};mt.remoteFeatures=t,(n=mt.remoteFeatures)!=null&&n.socials&&(mt.remoteFeatures.socials=NM.filterSocialsByPlatform(mt.remoteFeatures.socials)),(r=mt.features)!=null&&r.pay&&(mt.remoteFeatures.email=!1,mt.remoteFeatures.socials=!1)},setFeatures(e){var n;if(!e)return;mt.features||(mt.features=mn.DEFAULT_FEATURES);const t={...mt.features,...e};mt.features=t,(n=mt.features)!=null&&n.pay&&mt.remoteFeatures&&(mt.remoteFeatures.email=!1,mt.remoteFeatures.socials=!1)},setProjectId(e){mt.projectId=e},setCustomRpcUrls(e){mt.customRpcUrls=e},setAllWallets(e){mt.allWallets=e},setIncludeWalletIds(e){mt.includeWalletIds=e},setExcludeWalletIds(e){mt.excludeWalletIds=e},setFeaturedWalletIds(e){mt.featuredWalletIds=e},setTokens(e){mt.tokens=e},setTermsConditionsUrl(e){mt.termsConditionsUrl=e},setPrivacyPolicyUrl(e){mt.privacyPolicyUrl=e},setCustomWallets(e){mt.customWallets=e},setIsSiweEnabled(e){mt.isSiweEnabled=e},setIsUniversalProvider(e){mt.isUniversalProvider=e},setSdkVersion(e){mt.sdkVersion=e},setMetadata(e){mt.metadata=e},setDisableAppend(e){mt.disableAppend=e},setEIP6963Enabled(e){mt.enableEIP6963=e},setEnableCoinbase(e){mt.enableCoinbase=e},setDebug(e){mt.debug=e},setEnableWalletGuide(e){mt.enableWalletGuide=e},setEnableAuthLogger(e){mt.enableAuthLogger=e},setEnableWallets(e){mt.enableWallets=e},setPreferUniversalLinks(e){mt.experimental_preferUniversalLinks=e},setSIWX(e){if(e)for(const[t,n]of Object.entries(mn.SIWX_DEFAULTS))e[t]??(e[t]=n);mt.siwx=e},setConnectMethodsOrder(e){mt.features={...mt.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){mt.features={...mt.features,walletFeaturesOrder:e}},setSocialsOrder(e){mt.remoteFeatures={...mt.remoteFeatures,socials:e}},setCollapseWallets(e){mt.features={...mt.features,collapseWallets:e}},setEnableEmbedded(e){mt.enableEmbedded=e},setAllowUnsupportedChain(e){mt.allowUnsupportedChain=e},setManualWCControl(e){mt.manualWCControl=e},setEnableNetworkSwitch(e){mt.enableNetworkSwitch=e},setEnableMobileFullScreen(e){mt.enableMobileFullScreen=Je.isMobile()&&e},setEnableReconnect(e){mt.enableReconnect=e},setCoinbasePreference(e){mt.coinbasePreference=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([t,n])=>{n&&(mt.defaultAccountTypes[t]=n)})},setUniversalProviderConfigOverride(e){mt.universalProviderConfigOverride=e},getUniversalProviderConfigOverride(){return mt.universalProviderConfigOverride}
vendor: 4,158 bytes, line 66
66,getSnapshot(){return V8(mt)}},W1=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),zs=zr({...W1}),Zrt={state:zs,subscribeKey(e,t){return Zi(zs,e,t)},showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){const t=Je.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){zs.message=W1.message,zs.variant=W1.variant,zs.svg=W1.svg,zs.open=W1.open,zs.autoClose=W1.autoClose},_showMessage({message:e,svg:t,variant:n="success",autoClose:r=W1.autoClose}){zs.open?(zs.open=!1,setTimeout(()=>{zs.message=e,zs.variant=n,zs.svg=t,zs.open=!0,zs.autoClose=r},150)):(zs.message=e,zs.variant=n,zs.svg=t,zs.open=!0,zs.autoClose=r)}},Lh=Zrt,Yrt={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},v1e=Je.getBlockchainApiUrl(),Do=zr({clientId:null,api:new e$({baseUrl:v1e,clientId:null}),supportedChains:{http:[],ws:[]}}),Pt={state:Do,async get(e){const{st:t,sv:n}=Pt.getSdkProperties(),r=pe.state.projectId,s={...e.params||{},st:t,sv:n,projectId:r};return Do.api.get({...e,params:s})},getSdkProperties(){const{sdkType:e,sdkVersion:t}=pe.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{Do.supportedChains.http.length||await Pt.getSupportedNetworks()}catch{return!1}return Do.supportedChains.http.includes(e)},async getSupportedNetworks(){try{const e=await Pt.get({path:"v1/supported-chains"});return Do.supportedChains=e,e}catch{return Do.supportedChains}},async fetchIdentity({address:e}){const t=xe.getIdentityFromCacheForAddress(e);if(t)return t;const n=await Pt.get({path:`/v1/identity/${e}`,params:{sender:G.state.activeCaipAddress?Je.getPlainAddress(G.state.activeCaipAddress):void 0}});return xe.updateIdentityCache({address:e,identity:n,timestamp:Date.now()}),n},async fetchTransactions({account:e,cursor:t,signal:n,cache:r,chainId:s}){var c;if(!await Pt.isNetworkSupported((c=G.state.activeCaipNetwork)==null?void 0:c.caipNetworkId))return{data:[],next:void 0};const o=xe.getTransactionsCacheForAddress({address:e,chainId:s});if(o)return o;const a=await Pt.get({path:`/v1/account/${e}/history`,params:{cursor:t,chainId:s},signal:n,cache:r});return xe.updateTransactionsCache({address:e,chainId:s,timestamp:Date.now(),transactions:a}),a},async fetchSwapQuote({amount:e,userAddress:t,from:n,to:r,gasPrice:s}){var o;return await Pt.isNetworkSupported((o=G.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?Pt.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:n,to:r,gasPrice:s}}):{quotes:[]}},async fetchSwapTokens({chainId:e}){var n;return await Pt.isNetworkSupported((n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Pt.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]}},async getAddressBalance({caipNetworkId:e,address:t,method:n="getAddressBalance",params:r}){return Do.api.post({path:`/v1?chainId=${e}&projectId=${pe.state.projectId}`,body:{id:"1",jsonrpc:"2.0",method:n,params:r??{address:t}}}).then(s=>s.result)},async fetchTokenPrice({addresses:e,caipNetworkId:t=(n=>(n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)()}
66){if(!await Pt.isNetworkSupported(t))return{fungibles:[]};const s=xe.getTokenPriceCacheForAddresses(e);if(s)return s;const i=await Do.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:pe.state.projectId},headers:{"Content-Type":"application/json"}});return xe.updateTokenPriceCache({addresses:e,timestamp:Date.now(),tokenPrice:i}),i},async fetchSwapAllowance({tokenAddress:e,userAddress:t}){var r;return await Pt.isNetworkSupported((r=G.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Pt.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:e}){var s;const{st:t,sv:n}=Pt.getSdkProperties();if(!await Pt.isNetworkSupported((s=G.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))throw new Error("Network not supported for Gas Price");return Pt.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:n}})},async generateSwapCalldata({amount:e,from:t,to:n,userAddress:r,disableEstimate:s}){var o;if(!await Pt.isNetworkSupported((o=G.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Do.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:mn.CONVERT_SLIPPAGE_TOLERANCE},projectId:pe.state.projectId,from:t,to:n,userAddress:r,disableEstimate:s}})},async generateApproveCalldata({from:e,to:t,userAddress:n}){var o;const{st:r,sv:s}=Pt.getSdkProperties();if(!await Pt.isNetworkSupported((o=G.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Pt.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:n,from:e,to:t,st:r,sv:s}})},async getBalance(e,t,n){var l;const{st:r,sv:s}=Pt.getSdkProperties();if(!await Pt.isNetworkSupported((l=G.state.activeCaipNetwork)==null?void 0:l.caipNetworkId))return Lh.showError("Token Balance Unavailable"),{balances:[]};const o=`${t}:${e}`,a=xe.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await Pt.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:n,st:r,sv:s}});return xe.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(e){var n;return await Pt.isNetworkSupported((n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Pt.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:e}){var r,s;if(!await Pt.isNetworkSupported((r=G.state.activeCaipNetwork)==null?void 0:r.caipNetworkId))return[];const n=(s=G.getAccountData())==null?void 0:s.address;return Pt.get({path:`/v1/profile/reverse/${e}`,params:{sender:n,apiVersion:"2"}})},async getEnsNameSuggestions(e){var n;return await Pt.isNetworkSupported((n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Pt.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:e,address:t,message:n,signature:r}){var i;return await Pt.isNetworkSupported((i=G.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?Do.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:n,signature:r},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:e,partnerUserId:t,defaultNetwork:n,purchaseAmount:r,paymentAmount:s}){var a;return await Pt.isNetworkSupported((a=G.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await Do.api.post({path:"/v1/generators/onrampurl",params:{projectId:pe.state.projectId},body:{destinationWallets:e,defaultNetwork:n,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:r,presetFiatAmount:s}})).url:""},async getOnrampOptions(){var t;if(!await Pt.isNetworkSupported((t=G.state.activeCaipNetwork)==null?void 0:t.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await Pt.get({path:"/v1/onramp/options"})}catch{return Yrt}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}){var s;try{return await Pt.isNetworkSupported((s=G.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?await Do.api.post({path:"/v1/onramp/quote",params:{projectId:pe.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}}):null}catch{return{networkFee:{amount:n,currency:t.id},paymentSubtotal:{amount:n,currency:t.id},paymentTotal:{amount:n,currency:t.id},purchaseAmount:{amount:n,currency:t.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(e){var n;return await Pt.isNetworkSupported((n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Pt.get({path:`/v1/sessions/${e}`}):[]},async revokeSmartSession(e,t,n){var s;return await Pt.isNetworkSupported((s=G.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?Do.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:pe.state.projectId},body:{pci:t,signature:n}}):{success:!1}},setClientId(e){Do.clientId=e,Do.api=new e$({baseUrl:v1e,clientId:e})}},Jrt=Object.freeze({enabled:!0,events:[]}),Xrt=new e$({baseUrl:Je.getAnalyticsUrl(),clientId:null}),Qrt=5,est=60*1e3,fg=zr({...Jrt}),tst={state:fg,subscribeKey(e,t){return Zi(fg,e,t)},async sendError(e,t){if(!fg.enabled)return;const n=Date.now();if(fg.events.filter(i=>{const o=new Date(i.properties.timestamp||"").getTime();return n-o<est}).length>=Qrt)return;const s={type:"error",event:t,properties:{errorType:e.name,errorMessage:e.message,stackTrace:e.stack,timestamp:new Date().toISOString()}};fg.events.push(s);try{if(typeof window>"u")return;const{projectId:i,sdkType:o,sdkVersion:a}=pe.state;await Xrt.post({path:"/e",params:{projectId:i,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:Je.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:t,errorType:e.name,errorMessage:e.message,stackTrace:e.stack}}})}catch{}},enable(){fg.enabled=!0},disable(){fg.enabled=!1},clearEvents(){fg.events=[]}};
vendor: 5,117 bytes, lines 66-68
66let uA=class TM extends Error{constructor(t,n,r){super(t),this.originalName="AppKitError",this.name="AppKitError",this.category=n,this.originalError=r,r&&r instanceof Error&&(this.originalName=r.name),Object.setPrototypeOf(this,TM.prototype);let s=!1;if(r instanceof Error&&typeof r.stack=="string"&&r.stack){const i=r.stack,o=i.indexOf(` 67`);if(o>-1){const a=i.substring(o+1);this.stack=`${this.name}: ${this.message} 68${a}`,s=!0}}s||(Error.captureStackTrace?Error.captureStackTrace(this,TM):this.stack||(this.stack=`${this.name}: ${this.message}`))}};function ute(e,t){let n="";try{e instanceof Error?n=e.message:typeof e=="string"?n=e:typeof e=="object"&&e!==null?Object.keys(e).length===0?n="Unknown error":n=(e==null?void 0:e.message)||JSON.stringify(e):n=String(e)}catch(s){n="Unknown error",console.error("Error parsing error message",s)}const r=e instanceof uA?e:new uA(n,t,e);throw tst.sendError(r,r.category),r}function Lu(e,t="INTERNAL_SDK_ERROR"){const n={};return Object.keys(e).forEach(r=>{const s=e[r];if(typeof s=="function"){let i=s;s.constructor.name==="AsyncFunction"?i=async(...o)=>{try{return await s(...o)}catch(a){return ute(a,t)}}:i=(...o)=>{try{return s(...o)}catch(a){return ute(a,t)}},n[r]=i}else n[r]=s}),n}const Dc=zr({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),nst={state:Dc,subscribeNetworkImages(e){return Gi(Dc.networkImages,()=>e(Dc.networkImages))},subscribeKey(e,t){return Zi(Dc,e,t)},subscribe(e){return Gi(Dc,()=>e(Dc))},setWalletImage(e,t){Dc.walletImages[e]=t},setNetworkImage(e,t){Dc.networkImages[e]=t},setChainImage(e,t){Dc.chainImages[e]=t},setConnectorImage(e,t){Dc.connectorImages={...Dc.connectorImages,[e]:t}},setTokenImage(e,t){Dc.tokenImages[e]=t},setCurrencyImage(e,t){Dc.currencyImages[e]=t}},du=Lu(nst),dte={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:"",sui:"",stacks:"",ton:"20f673c0-095e-49b2-07cf-eb5049dcf600",tron:"3502bb86-cc4e-420f-a387-59ea63a28b00"},u2=zr({networkImagePromises:{},tokenImagePromises:{}}),dA={async fetchWalletImage(e){if(e)return await it._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(!e)return;const t=this.getNetworkImageById(e);return t||(u2.networkImagePromises[e]||(u2.networkImagePromises[e]=it._fetchNetworkImage(e)),await u2.networkImagePromises[e],this.getNetworkImageById(e))},async fetchTokenImage(e){if(e)return u2.tokenImagePromises[e]||(u2.tokenImagePromises[e]=it._fetchTokenImage(e)),await u2.tokenImagePromises[e],this.getTokenImage(e)},getWalletImageById(e){if(e)return du.state.walletImages[e]},getWalletImage(e){if(e!=null&&e.image_url)return e==null?void 0:e.image_url;if(e!=null&&e.image_id)return du.state.walletImages[e.image_id]},getNetworkImage(e){var t,n,r;if((t=e==null?void 0:e.assets)!=null&&t.imageUrl)return(n=e==null?void 0:e.assets)==null?void 0:n.imageUrl;if((r=e==null?void 0:e.assets)!=null&&r.imageId)return du.state.networkImages[e.assets.imageId]},getNetworkImageById(e){if(e)return du.state.networkImages[e]},getConnectorImage(e){var t;if(e!=null&&e.imageUrl)return e.imageUrl;if((t=e==null?void 0:e.info)!=null&&t.icon)return e.info.icon;if(e!=null&&e.imageId)return du.state.connectorImages[e.imageId]},getChainImage(e){return du.state.networkImages[dte[e]]},getTokenImage(e){if(e)return du.state.tokenImages[e]},getWalletImageUrl(e){if(!e)return"";const{projectId:t,sdkType:n,sdkVersion:r}=pe.state,s=new URL(`${he.W3M_API_URL}/getWalletImage/${e}`);return s.searchParams.set("projectId",t),s.searchParams.set("st",n),s.searchParams.set("sv",r),s.toString()},getAssetImageUrl(e){if(!e)return"";const{projectId:t,sdkType:n,sdkVersion:r}=pe.state,s=new URL(`${he.W3M_API_URL}/public/getAssetImage/${e}`);return s.searchParams.set("projectId",t),s.searchParams.set("st",n),s.searchParams.set("sv",r),s.toString()},getChainNamespaceImageUrl(e){return this.getAssetImageUrl(dte[e])},async getImageByToken(e,t){if(e==="native"){const r=he.NATIVE_IMAGE_IDS_BY_NAMESPACE[t]??null;return r?dA.fetchNetworkImage(r):void 0}const[,n]=Object.entries(he.TOKEN_SYMBOLS_BY_ADDRESS).find(([r])=>r.toLowerCase()===e.toLowerCase())??[];if(n)return dA.fetchTokenImage(n)}},Ks={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app",androidPackage:"app.phantom"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com",evmDeeplink:"cbwallet://miniapp"},BINANCE:{id:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25",appId:"yFK5FCqYprrXDiVFbhyRx7",deeplink:"bnc://app.binance.com/mp/app",url:"https://app.binance.com/en/download"}},rst={isCustomDeeplinkWallet(e,t){return e===Ks.PHANTOM.id?t===he.CHAIN.SOLANA||t===he.CHAIN.EVM||t===he.CHAIN.BITCOIN:e===Ks.SOLFLARE.id?t===he.CHAIN.SOLANA:e===Ks.COINBASE.id?t===he.CHAIN.SOLANA||t===he.CHAIN.EVM:e===Ks.BINANCE.id?t===he.CHAIN.BITCOIN:!1}
68,handleMobileDeeplinkRedirect(e,t,n){const r=window.location.href,s=encodeURIComponent(r),i=(n==null?void 0:n.isCoinbaseDisabled)??!1;if(e===Ks.PHANTOM.id&&!("phantom"in window)){const o=r.startsWith("https")?"https":"http",a=r.split("/")[2],c=encodeURIComponent(`${o}://${a}`),l=`${Ks.PHANTOM.url}/ul/browse/${s}?ref=${c}`;if(Je.isAndroid()){const u=`intent://browse/${s}?ref=${c}#Intent;scheme=phantom;package=${Ks.PHANTOM.androidPackage};end`;window.location.href=u}else window.location.href=l}if(e===Ks.SOLFLARE.id&&t===he.CHAIN.SOLANA&&!("solflare"in window)&&(window.location.href=`${Ks.SOLFLARE.url}/ul/v1/browse/${s}?ref=${s}`),t===he.CHAIN.SOLANA&&e===Ks.COINBASE.id&&(i||!("coinbaseSolana"in window))&&(window.location.href=`${Ks.COINBASE.url}/dapp?cb_url=${s}`),t===he.CHAIN.EVM&&e===Ks.COINBASE.id&&(i||!("coinbaseWalletExtension"in window))&&(window.location.href=`${Ks.COINBASE.evmDeeplink}?url=${s}`),t===he.CHAIN.BITCOIN&&e===Ks.BINANCE.id&&!("binancew3w"in window)){const o=G.state.activeCaipNetwork,a=window.btoa("/pages/browser/index"),c=window.btoa(`url=${s}&defaultChainId=${(o==null?void 0:o.id)??1}`),l=new URL(Ks.BINANCE.deeplink);l.searchParams.set("appId",Ks.BINANCE.appId),l.searchParams.set("startPagePath",a),l.searchParams.set("startPageQuery",c);const u=new URL(Ks.BINANCE.url);u.searchParams.set("_dp",window.btoa(l.toString())),window.location.href=u.toString()}}},sst=Je.getAnalyticsUrl(),ist=new e$({baseUrl:sst,clientId:null}),ost=["MODAL_CREATED"],ast=45,hte=1e3*10,ls=zr({timestamp:Date.now(),lastFlush:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"},pendingEvents:[],subscribedToVisibilityChange:!1,walletImpressions:[]}),sn={state:ls,subscribe(e){return Gi(ls,()=>e(ls))},getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=pe.state;return{projectId:e,st:t,sv:n||"html-wagmi-4.2.2"}},shouldFlushEvents(){const e=JSON.stringify(ls.pendingEvents).length/1024>ast,t=ls.lastFlush+hte<Date.now();return e||t},_setPendingEvent(e){var t,n;try{let r=(t=G.getAccountData())==null?void 0:t.address;if("address"in e.data&&e.data.address&&(r=e.data.address),ost.includes(e.data.event)||typeof window>"u")return;const s=(n=G.getActiveCaipNetwork())==null?void 0:n.caipNetworkId;this.state.pendingEvents.push({eventId:Je.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:r,properties:{..."properties"in e.data?e.data.properties:{},caipNetworkId:s}}}),ls.reportedErrors.FORBIDDEN=!1,sn.shouldFlushEvents()&&sn._submitPendingEvents()}catch(r){console.warn("_setPendingEvent",r)}},sendEvent(e){var n;ls.timestamp=Date.now(),ls.data=e;const t=["INITIALIZE","CONNECT_SUCCESS","SOCIAL_LOGIN_SUCCESS"];((n=pe.state.features)!=null&&n.analytics||t.includes(e.event))&&sn._setPendingEvent(ls),this.subscribeToFlushTriggers()},sendWalletImpressionEvent(e){ls.walletImpressions.push(e)},_transformPendingEventsForBatch(e){try{return e.filter(t=>t.props.event!=="WALLET_IMPRESSION_V2")}catch{return e}},_submitPendingEvents(){if(ls.lastFlush=Date.now(),!(ls.pendingEvents.length===0&&ls.walletImpressions.length===0))try{const e=sn._transformPendingEventsForBatch(ls.pendingEvents);ls.walletImpressions.length&&e.push({eventId:Je.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:Date.now(),props:{type:"track",event:"WALLET_IMPRESSION_V2",items:[...ls.walletImpressions]}}),ist.sendBeacon({path:"/batch",params:sn.getSdkProperties(),body:e}),ls.reportedErrors.FORBIDDEN=!1,ls.pendingEvents=[],ls.walletImpressions=[]}catch{ls.reportedErrors.FORBIDDEN=!0}},subscribeToFlushTriggers(){var e,t,n;ls.subscribedToVisibilityChange||typeof document>"u"||(ls.subscribedToVisibilityChange=!0,(e=document==null?void 0:document.addEventListener)==null||e.call(document,"visibilitychange",()=>{document.visibilityState==="hidden"&&sn._submitPendingEvents()}),(t=document==null?void 0:document.addEventListener)==null||t.call(document,"freeze",()=>{sn._submitPendingEvents()}),(n=window==null?void 0:window.addEventListener)==null||n.call(window,"pagehide",()=>{sn._submitPendingEvents()}),setInterval(()=>{sn._submitPendingEvents()},hte))}},cst=Je.getApiUrl(),Uo=new e$({baseUrl:cst,clientId:null}),lst=40,fte=4,ust=20,Ft=zr({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1,explorerWallets:[],explorerFilteredWallets:[],plan:{tier:"none",hasExceededUsageLimit:!1,limits:{isAboveRpcLim
vendor: 7,312 bytes, line 68
68it:!1,isAboveMauLimit:!1}}}),it={state:Ft,subscribeKey(e,t){return Zi(Ft,e,t)},_getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=pe.state;return{projectId:e,st:t||"appkit",sv:n||"html-wagmi-4.2.2"}},_filterOutExtensions(e){return pe.state.isUniversalProvider?e.filter(t=>!!(t.mobile_link||t.desktop_link||t.webapp_link)):e},async _fetchWalletImage(e){const t=`${Uo.baseUrl}/getWalletImage/${e}`,n=await Uo.getBlob({path:t,params:it._getSdkProperties()});du.setWalletImage(e,URL.createObjectURL(n))},async _fetchNetworkImage(e){const t=`${Uo.baseUrl}/public/getAssetImage/${e}`,n=await Uo.getBlob({path:t,params:it._getSdkProperties()});du.setNetworkImage(e,URL.createObjectURL(n))},async _fetchConnectorImage(e){const t=`${Uo.baseUrl}/public/getAssetImage/${e}`,n=await Uo.getBlob({path:t,params:it._getSdkProperties()});du.setConnectorImage(e,URL.createObjectURL(n))},async _fetchCurrencyImage(e){const t=`${Uo.baseUrl}/public/getCurrencyImage/${e}`,n=await Uo.getBlob({path:t,params:it._getSdkProperties()});du.setCurrencyImage(e,URL.createObjectURL(n))},async _fetchTokenImage(e){const t=`${Uo.baseUrl}/public/getTokenImage/${e}`,n=await Uo.getBlob({path:t,params:it._getSdkProperties()});du.setTokenImage(e,URL.createObjectURL(n))},_filterWalletsByPlatform(e){const t=e.length,n=Je.isMobile()?e==null?void 0:e.filter(s=>s.mobile_link||s.webapp_link?!0:Object.values(Ks).map(o=>o.id).includes(s.id)):e,r=t-n.length;return{filteredWallets:n,mobileFilteredOutWalletsLength:r}},async fetchProjectConfig(){return(await Uo.get({path:"/appkit/v1/config",params:it._getSdkProperties()})).features},async fetchUsage(){try{const e=await Uo.get({path:"/appkit/v1/project-limits",params:it._getSdkProperties()}),{tier:t,isAboveMauLimit:n,isAboveRpcLimit:r}=e.planLimits,s=t==="starter",i=n||r;it.state.plan={tier:t,hasExceededUsageLimit:s&&i,limits:{isAboveRpcLimit:r,isAboveMauLimit:n}}}catch(e){console.warn("Failed to fetch usage",e)}},async fetchAllowedOrigins(){try{const{allowedOrigins:e}=await Uo.get({path:"/projects/v1/origins",params:it._getSdkProperties()});return e}catch(e){if(e instanceof Error&&e.cause instanceof Response){const t=e.cause.status;if(t===he.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)throw new Error("RATE_LIMITED",{cause:e});if(t>=he.HTTP_STATUS_CODES.SERVER_ERROR&&t<600)throw new Error("SERVER_ERROR",{cause:e});return[]}return[]}},async fetchNetworkImages(){const e=G.getAllRequestedCaipNetworks(),t=e==null?void 0:e.map(({assets:n})=>n==null?void 0:n.imageId).filter(Boolean).filter(n=>!dA.getNetworkImageById(n));t&&await Promise.allSettled(t.map(n=>it._fetchNetworkImage(n)))},async fetchConnectorImages(){const{connectors:e}=Te.state,t=e.map(({imageId:n})=>n).filter(Boolean);await Promise.allSettled(t.map(n=>it._fetchConnectorImage(n)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(t=>it._fetchCurrencyImage(t)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(t=>it._fetchTokenImage(t)))},async fetchWallets(e){var o;const t=e.exclude??[];it._getSdkProperties().sv.startsWith("html-core-")&&t.push(...Object.values(Ks).map(a=>a.id));const r=await Uo.get({path:"/getWallets",params:{...it._getSdkProperties(),...e,page:String(e.page),entries:String(e.entries),include:(o=e.include)==null?void 0:o.join(","),exclude:t.join(",")}}),{filteredWallets:s,mobileFilteredOutWalletsLength:i}=it._filterWalletsByPlatform(r==null?void 0:r.data);return{data:s||[],count:r==null?void 0:r.count,mobileFilteredOutWalletsLength:i}},async prefetchWalletRanks(){const e=Te.state.connectors;if(!(e!=null&&e.length))return;const t={page:1,entries:20,badge:"certified"};if(t.names=e.map(s=>s.name).join(","),G.state.activeChain===he.CHAIN.EVM){const s=[...e.flatMap(i=>{var o;return((o=i.connectors)==null?void 0:o.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}))||[]}),...e.map(i=>{var o;return(o=i.info)==null?void 0:o.rdns})].filter(i=>typeof i=="string"&&i.length>0);s.length&&(t.rdns=s.join(","))}const{data:n}=await it.fetchWallets(t);Ft.explorerWallets=n,Te.extendConnectorsWithExplorerWallets(n);const r=G.getRequestedCaipNetworkIds().join(",");Ft.explorerFilteredWallets=n.filter(s=>{var i;return(i=s.chains)==null?void 0:i.some(o=>r.includes(o))})},async fetchFeaturedWallets(){const{featuredWalletIds:e}=pe.state;if(e!=null&&e.length){const t={...it._getSdkProperties(),page:1,entries:(e==null?void 0:e.length)??fte,include:e},{data:n}=await it.fetchWallets(t),r=[...n].sort((i,o)=>e.indexOf(i.id)-e.indexOf(o.id)),s=r.map(i=>i.image_id).filter(Boolean);await Promise.allSettled(s.map(i=>it._fetchWalletImage(i))),Ft.featured=r,Ft.allFeatured=r}},async fetchRecommendedWallets(){try{Ft.isFetchingRecommendedWallets=!0;const{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:n}=pe.state,r=[...t??[],...n??[]].filter(Boolean),s=G.getRequestedCaipNetworkIds().join(","),i={page:1,entries:fte,include:e,exclude:r,chains:s},{data:o,count:a}=await it.fetchWallets(i),c=xe.getRecentWallets(),l=o.map(d=>d.image_id).filter(Boolean),u=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...l,...u].map(d=>it._fetchWalletImage(d))),Ft.recommended=o,Ft.allRecommended=o,Ft.count=a??0}catch{}finally{Ft.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:e,entries:t,badge:n,include:r,exclude:s}){const{includeWalletIds:i,excludeWalletIds:o,featuredWalletIds:a}=pe.state,c=G.getRequestedCaipNetworkIds().join(","),l=[...Ft.recommended.map(({id:p})=>p),...o??[],...a??[]].filter(Boolean),u={page:e,entries:t??lst,include:r??i,exclude:s??l,badge_type:n,chains:c},{data:d,count:h,mobileFilteredOutWalletsLength:f}=await it.fetchWallets(u);Ft.mobileFilteredOutWalletsLength=f+(Ft.mobileFilteredOutWalletsLength??0);const g=d.slice(0,ust).map(p=>p.image_id).filter(Boolean);await Promise.allSettled(g.map(p=>it._fetchWalletImage(p))),Ft.wallets=Je.uniqueBy([...Ft.wallets,...it._filterOutExtensions(d)],"id").filter(p=>{var m;return(m=p.chains)==null?void 0:m.some(w=>c.includes(w))}),Ft.count=h>Ft.count?h:Ft.count,Ft.page=e},async initializeExcludedWallets({ids:e}){const t={page:1,entries:e.length,include:e},{data:n}=await it.fetchWallets(t);n&&n.forEach(r=>{Ft.excludedWallets.push({rdns:r.rdns,name:r.name})})},async searchWallet({search:e,badge:t,entries:n,page:r,include:s,exclude:i}){const{includeWalletIds:o,excludeWalletIds:a}=pe.state,c=G.getRequestedCaipNetworkIds().join(",");Ft.search=[];const l={page:r??1,entries:n??100,search:e==null?void 0:e.trim(),badge_type:t,include:s??o,exclude:i??a,chains:c},{data:u}=await it.fetchWallets(l);sn.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});const d=u.map(h=>h.image_id).filter(Boolean);await Promise.allSettled([...d.map(h=>it._fetchWalletImage(h)),Je.wait(300)]),Ft.search=it._filterOutExtensions(u)},initPromise(e,t){const n=Ft.promises[e];return n||(Ft.promises[e]=t())},prefetch({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:n=!0,fetchNetworkImages:r=!0,fetchWalletRanks:s=!0}={}){const i=[e&&it.initPromise("connectorImages",it.fetchConnectorImages),t&&it.initPromise("featuredWallets",it.fetchFeaturedWallets),n&&it.initPromise("recommendedWallets",it.fetchRecommendedWallets),r&&it.initPromise("networkImages",it.fetchNetworkImages),s&&it.initPromise("walletRanks",it.prefetchWalletRanks)].filter(
68Boolean);return Promise.allSettled(i)},prefetchAnalyticsConfig(){var e;(e=pe.state.features)!=null&&e.analytics&&it.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:e}=await Uo.get({path:"/getAnalyticsConfig",params:it._getSdkProperties()});pe.setFeatures({analytics:e})}catch{pe.setFeatures({analytics:!1})}},filterByNamespaces(e){if(!(e!=null&&e.length)){Ft.featured=Ft.allFeatured,Ft.recommended=Ft.allRecommended;return}const t=G.getRequestedCaipNetworkIds().join(",");Ft.featured=Ft.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Ft.recommended=Ft.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Ft.filteredWallets=Ft.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})},clearFilterByNamespaces(){Ft.filteredWallets=[]},setFilterByNamespace(e){if(!e){Ft.featured=Ft.allFeatured,Ft.recommended=Ft.allRecommended;return}const t=G.getRequestedCaipNetworkIds().join(",");Ft.featured=Ft.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Ft.recommended=Ft.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Ft.filteredWallets=Ft.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})}},lm={filterOutDuplicatesByRDNS(e){const t=pe.state.enableEIP6963?Te.state.connectors:[],n=xe.getRecentWallets(),r=t.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),s=n.map(a=>a.rdns).filter(Boolean),i=r.concat(s);if(i.includes("io.metamask.mobile")&&Je.isMobile()){const a=i.indexOf("io.metamask.mobile");i[a]="io.metamask"}return e.filter(a=>!(a!=null&&a.rdns&&i.includes(String(a.rdns))||!(a!=null&&a.rdns)&&t.some(l=>l.name===a.name)))},filterOutDuplicatesByIds(e){const t=Te.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"||a.type==="MULTI_CHAIN"),n=xe.getRecentWallets(),r=t.map(a=>{var c;return a.explorerId||((c=a.explorerWallet)==null?void 0:c.id)||a.id}),s=n.map(a=>a.id),i=r.concat(s);return e.filter(a=>!i.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(e){const t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){const{connectors:t}=Te.state,{featuredWalletIds:n}=pe.state,r=t.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return e.map(o=>({...o,installed:!!o.rdns&&!!r[o.rdns??""]})).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(n!=null&&n.length){const l=n.indexOf(o.id),u=n.indexOf(a.id);if(l!==-1&&u!==-1)return l-u;if(l!==-1)return-1;if(u!==-1)return 1}return 0})},getConnectOrderMethod(e,t){var c;const n=(e==null?void 0:e.connectMethodsOrder)||((c=pe.state.features)==null?void 0:c.connectMethodsOrder),r=t||Te.state.connectors;if(n)return n;const{injected:s,announced:i}=qo.getConnectorsByType(r,it.state.recommended,it.state.featured),o=s.filter(qo.showConnector),a=i.filter(qo.showConnector);return o.length||a.length?["wallet","email","social"]:mn.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(e){const t=!!e.rdns&&it.state.excludedWallets.some(r=>r.rdns===e.rdns),n=!!e.name&&it.state.excludedWallets.some(r=>Zpe.isLowerCaseMatch(r.name,e.name));return t||n},markWalletsWithDisplayIndex(e){return e.map((t,n)=>({...t,display_index:n}))},filterWalletsByWcSupport(e){return Ue.state.wcBasic?e.filter(t=>t.supports_wc):Je.isMobile()?e.filter(t=>t.supports_wc||mn.MANDATORY_WALLET_IDS_ON_MOBILE.includes(t.id)):e},getWalletConnectWallets(e){var i;const t=[...it.state.featured,...it.state.recommended];((i=it.state.filteredWallets)==null?void 0:i.length)>0?t.push(...it.state.filteredWallets):t.push(...e);const n=Je.uniqueBy(t,"id"),r=lm.markWalletsAsInstalled(n),s=lm.filterWalletsByWcSupport(r);return lm.markWalletsWithDisplayIndex(s)}},qo={getConnectorsByType(e,t,n){const{customWallets:r}=pe.state,s=xe.getRecentWallets(),i=lm.filterOutDuplicateWallets(t),o=lm.filterOutDuplicateWallets(n),a=e.filter(d=>d.type==="MULTI_CHAIN"),c=e.filter(d=>d.type==="ANNOUNCED"),l=e.filter(d=>d.type==="INJECTED"),u=e.filter(d=>d.type==="EXTERNAL");return{custom:r,recent:s,external:u,multiChain:a,announced:c,injected:l,recommended:i,featured:o}},showConnector(e){var s;const t=(s=e.info)==null?void 0:s.rdns,n=!!t&&it.state.excludedWallets.some(i=>!!i.rdns&&i.rdns===t),r=!!e.name&&it.state.excludedWallets.some(i=>Zpe.isLowerCaseMatch(i.name,e.name));return!(e.type==="INJECTED"&&(e.name==="Browser Wallet"&&(!Je.isMobile()||Je.isMobile()&&!t&&!Ue.checkInstalled())||n||r)||(e.type==="ANNOUNCED"||e.type==="EXTERNAL")&&(n||r))},getIsConnectedWithWC(){return Array.from(G.state.chains.values()).some(n=>Te.getConnectorId(n.namespace)===he.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:e,featured:t,custom:n,recent:r,announced:s,injected:i,multiChain:o,external:a,overriddenConnectors:c=(l=>(l=pe.state.features)==null?void 0:l.connectorTypeOrder)()??[]}){const d=[{type:"walletConnect",isEnabled:!0},{type:"recent",isEnabled:r.length>0},{type:"injected",isEnabled:[...i,...s,...o].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:n&&n.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:e.length>0}].filter(p=>p.isEnabled),h=new Set(d.map(p=>p.type)),f=c.filter(p=>
vendor: 3,864 bytes, line 68
68h.has(p)).map(p=>({type:p,isEnabled:!0})),g=d.filter(({type:p})=>!f.some(({type:w})=>w===p));return Array.from(new Set([...f,...g].map(({type:p})=>p)))},sortConnectorsByExplorerWallet(e){return[...e].sort((t,n)=>t.explorerWallet&&n.explorerWallet?(t.explorerWallet.order??0)-(n.explorerWallet.order??0):t.explorerWallet?-1:n.explorerWallet?1:0)},getPriority(e){return e.id===he.CONNECTOR_ID.BASE_ACCOUNT?0:e.id===he.CONNECTOR_ID.COINBASE||e.id===he.CONNECTOR_ID.COINBASE_SDK?1:2},sortConnectorsByPriority(e){return[...e].sort((t,n)=>qo.getPriority(t)-qo.getPriority(n))},getAuthName({email:e,socialUsername:t,socialProvider:n}){return t?n&&n==="discord"&&t.endsWith("0")?t.slice(0,-1):t:e.length>30?`${e.slice(0,-3)}...`:e},async fetchProviderData(e){var t,n;try{if(e.name==="Browser Wallet"&&!Je.isMobile())return{accounts:[],chainId:void 0};if(e.id===he.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};const[r,s]=await Promise.all([(t=e.provider)==null?void 0:t.request({method:"eth_accounts"}),(n=e.provider)==null?void 0:n.request({method:"eth_chainId"}).then(i=>Number(i))]);return{accounts:r,chainId:s}}catch(r){return console.warn(`Failed to fetch provider data for ${e.name}`,r),{accounts:[],chainId:void 0}}},getFilteredCustomWallets(e){const t=xe.getRecentWallets(),n=Te.state.connectors.map(o=>{var a;return(a=o.info)==null?void 0:a.rdns}).filter(Boolean),r=t.map(o=>o.rdns).filter(Boolean),s=n.concat(r);if(s.includes("io.metamask.mobile")&&Je.isMobile()){const o=s.indexOf("io.metamask.mobile");s[o]="io.metamask"}return e.filter(o=>!s.includes(String(o==null?void 0:o.rdns)))},hasWalletConnector(e){return Te.state.connectors.some(t=>t.id===e.id||t.name===e.name)},isWalletCompatibleWithCurrentChain(e){const t=G.state.activeChain;return t&&e.chains?e.chains.some(n=>{const r=n.split(":")[0];return t===r}):!0},getFilteredRecentWallets(){return xe.getRecentWallets().filter(n=>!lm.isExcluded(n)).filter(n=>!this.hasWalletConnector(n)).filter(n=>this.isWalletCompatibleWithCurrentChain(n))},getCappedRecommendedWallets(e){const{connectors:t}=Te.state,{customWallets:n,featuredWalletIds:r}=pe.state,s=t.find(C=>C.id==="walletConnect"),i=t.filter(C=>C.type==="INJECTED"||C.type==="ANNOUNCED"||C.type==="MULTI_CHAIN");if(!s&&!i.length&&!(n!=null&&n.length))return[];const o=NM.isEmailEnabled(),a=NM.isSocialsEnabled(),c=i.filter(C=>C.name!=="Browser Wallet"&&C.name!=="WalletConnect"),l=(r==null?void 0:r.length)||0,u=(n==null?void 0:n.length)||0,d=c.length||0,h=o?1:0,f=a?1:0,g=l+u+d+h+f,m=Math.max(0,4-g);return m<=0?[]:lm.filterOutDuplicateWallets(e).slice(0,m)},processConnectorsByType(e,t=!0){const n=qo.sortConnectorsByExplorerWallet([...e]);return t?n.filter(qo.showConnector):n},connectorList(){const e=qo.getConnectorsByType(Te.state.connectors,it.state.recommended,it.state.featured),t=this.processConnectorsByType(e.announced.filter(f=>f.id!=="walletConnect")),n=this.processConnectorsByType(e.injected),r=this.processConnectorsByType(e.multiChain.filter(f=>f.name!=="WalletConnect"),!1),s=e.custom,i=e.recent,o=this.processConnectorsByType(e.external.filter(f=>f.id!==he.CONNECTOR_ID.COINBASE_SDK&&f.id!==he.CONNECTOR_ID.BASE_ACCOUNT)),a=e.recommended,c=e.featured,l=qo.getConnectorTypeOrder({custom:s,recent:i,announced:t,injected:n,multiChain:r,recommended:a,featured:c,external:o}),u=Te.state.connectors.find(f=>f.id==="walletConnect"),d=Je.isMobile(),h=[];for(const f of l)switch(f){case"walletConnect":{!d&&u&&h.push({kind:"connector",subtype:"walletConnect",connector:u});break}case"recent":{qo.getFilteredRecentWallets().forEach(p=>h.push({kind:"wallet",subtype:"recent",wallet:p}));break}case"injected":{r.forEach(g=>h.push({kind:"connector",subtype:"multiChain",connector:g})),t.forEach(g=>h.push({kind:"connector",subtype:"announced",connector:g})),n.forEach(g=>h.push({kind:"connector",subtype:"injected",connector:g}));break}
68case"featured":{c.forEach(g=>h.push({kind:"wallet",subtype:"featured",wallet:g}));break}case"custom":{qo.getFilteredCustomWallets(s??[]).forEach(p=>h.push({kind:"wallet",subtype:"custom",wallet:p}));break}case"external":{o.forEach(g=>h.push({kind:"connector",subtype:"external",connector:g}));break}case"recommended":{qo.getCappedRecommendedWallets(a).forEach(p=>h.push({kind:"wallet",subtype:"recommended",wallet:p}));break}default:console.warn(`Unknown connector type: ${f}`)}return h},hasInjectedConnectors(){return Te.state.connectors.filter(e=>(e.type==="INJECTED"||e.type==="ANNOUNCED"||e.type==="MULTI_CHAIN")&&e.name!=="Browser Wallet"&&e.name!=="WalletConnect").length}},dst=["ConnectingExternal","ConnectingMultiChain","ConnectingSocial","ConnectingFarcaster"],er=zr({view:"Connect",history:["Connect"],transactionStack:[]}),hst={state:er,subscribeKey(e,t){return Zi(er,e,t)},pushTransactionStack(e){er.transactionStack.push(e)},popTransactionStack(e){const t=er.transactionStack.pop();if(!t)return;const{onSuccess:n,onError:r,onCancel:s}=t;switch(e){case"success":n==null||n();break;case"error":r==null||r(),xt.goBack();break;case"cancel":s==null||s(),xt.goBack();break}},push(e,t){let n=e,r=t;it.state.plan.hasExceededUsageLimit&&dst.includes(e)&&(n="UsageExceeded",r=void 0),n!==er.view&&(er.view=n,er.history.push(n),er.data=r)},reset(e,t){er.view=e,er.history=[e],er.data=t},replace(e,t){er.history.at(-1)===e||(er.view=e,er.history[er.history.length-1]=e,er.data=t)},goBack(){var r,s;const e=G.state.activeCaipAddress,t=xt.state.view==="ConnectingFarcaster",n=!e&&t;if(er.history.length>1){er.history.pop();const[i]=er.history.slice(-1);i&&(e&&i==="Connect"?er.view="Account":er.view=i)}else dn.close();(r=er.data)!=null&&r.wallet&&(er.data.wallet=void 0),(s=er.data)!=null&&s.redirectView&&(er.data.redirectView=void 0),setTimeout(()=>{var i,o,a;if(n){G.setAccountProp("farcasterUrl",void 0,G.state.activeChain);const c=Te.getAuthConnector();(i=c==null?void 0:c.provider)==null||i.reload();const l=V8(pe.state);(a=(o=c==null?void 0:c.provider)==null?void 0:o.syncDappData)==null||a.call(o,{metadata:l.metadata,sdkVersion:l.sdkVersion,projectId:l.projectId,sdkType:l.sdkType})}},100)},goBackToIndex(e){if(er.history.length>1){er.history=er.history.slice(0,e+1);const[t]=er.history.slice(-1);t&&(er.view=t)}},goBackOrCloseModal(){xt.state.history.length>1?xt.goBack():dn.close()}},xt=Lu(hst),zf=zr({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),PM={state:zf,subscribe(e){return Gi(zf,()=>e(zf))},setThemeMode(e){zf.themeMode=e;try{const t=Te.getAuthConnector();if(t){const n=PM.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:n,w3mThemeVariables:E9(n,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){zf.themeVariables={...zf.themeVariables,...e};try{const t=Te.getAuthConnector();if(t){const n=PM.getSnapshot().themeVariables;t.provider.syncTheme({themeVariables:n,w3mThemeVariables:E9(zf.themeVariables,zf.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return V8(zf)}},Gc=Lu(PM),E1e=Object.fromEntries(Ype.map(e=>[e,void 0])),fst=Object.fromEntries(Ype.map(e=>[e,!0])),Nn=zr({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:E1e,filterByNamespaceMap:fst}),pst={state:Nn,subscribe(e){return Gi(Nn,()=>{e(Nn)})},subscribeKey(e,t){return Zi(Nn,e,t)},initialize(e){e.forEach(t=>{const n=xe.getConnectedConnectorId(t);n&&Te.setConnectorId(n,t)})},setActiveConnector(e){e&&(Nn.activeConnector=K8(e))},setConnectors(e){e.filter(s=>!Nn.allConnectors.some(i=>i.id===s.id&&Te.getConnectorName(i.name)===Te.getConnectorName(s.name)&&i.chain===s.chain)).forEach(s=>{s.type!=="MULTI_CHAIN"&&Nn.allConnectors.push(K8(s))});const n=Te.getEnabledNamespaces(),r=Te.getEnabledConnectors(n);Nn.connectors=Te.mergeMultiChainConnectors(r)},filterByNamespaces(e){Object.keys(Nn.filterByNamespaceMap).forEach(t=>{Nn.filterByNamespaceMap[t]=!1}),e.forEach(t=>{Nn.filterByNamespaceMap[t]=!0}),Te.updateConnectorsForEnabledNamespaces()},filterByNamespace(e,t){Nn.filterByNamespaceMap[e]=t,Te.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const e=Te.getEnabledNamespaces(),t=Te.getEnabledConnectors(e),n=Te.areAllNamespacesEnabled();Nn.connectors=Te.mergeMultiChainConnectors(t),n?it.clearFilterByNamespaces():it.filterByNamespaces(e)},getEnabledNamespaces(){return Object.entries(Nn.filterByNamespaceMap).filter(([e,t])=>t).map(([e])=>e)}
68,getEnabledConnectors(e){return Nn.allConnectors.filter(t=>e.includes(t.chain))},areAllNamespacesEnabled(){return Object.values(Nn.filterByNamespaceMap).every(e=>e)},mergeMultiChainConnectors(e){const t=Te.generateConnectorMapByName(e),n=[];return t.forEach(r=>{const s=r[0],i=(s==null?void 0:s.id)===he.CONNECTOR_ID.AUTH;r.length>1&&s?n.push({name:s.name,imageUrl:s.imageUrl,imageId:s.imageId,connectors:[...r],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(s==null?void 0:s.id)||""}):s&&n.push(s)}),n},generateConnectorMapByName(e){const t=new Map;return e.forEach(n=>{const{name:r}=n,s=Te.getConnectorName(r);if(!s)return;const i=t.get(s)||[];i.find(a=>a.chain===n.chain)||i.push(n),t.set(s,i)}),t},getConnectorName(e){return e&&({"Trust Wallet":"Trust"}[e]||e)},getUniqueConnectorsByName(e){const t=[];return e.forEach(n=>{t.find(r=>r.chain===n.chain)||t.push(n)}),t},addConnector(e){var t,n,r;if(e.id===he.CONNECTOR_ID.AUTH){const s=e,i=V8(pe.state),o=Gc.getSnapshot().themeMode,a=Gc.getSnapshot().themeVariables;(n=(t=s==null?void 0:s.provider)==null?void 0:t.syncDappData)==null||n.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),(r=s==null?void 0:s.provider)==null||r.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:E9(a,o)}),Te.setConnectors([e])}else Te.setConnectors([e])},getAuthConnector(e){var r;const t=e||G.state.activeChain,n=Nn.connectors.find(s=>s.id===he.CONNECTOR_ID.AUTH);if(n)return(r=n==null?void 0:n.connectors)!=null&&r.length?n.connectors.find(i=>i.chain===t):n},getAnnouncedConnectorRdns(){return Nn.connectors.filter(e=>e.type==="ANNOUNCED").map(e=>{var t;return(t=e.info)==null?void 0:t.rdns})},getConnectorById(e){return qo.sortConnectorsByPriority(Nn.allConnectors).find(n=>n.id===e)},getConnector({id:e,namespace:t}){const n=t||G.state.activeChain,r=Nn.allConnectors.filter(o=>o.chain===n);return qo.sortConnectorsByPriority(r).find(o=>o.id===e||o.explorerId===e)},syncIfAuthConnector(e){var i,o;if(e.id!=="AUTH")return;const t=e,n=V8(pe.state),r=Gc.getSnapshot().themeMode,s=Gc.getSnapshot().themeVariables;(o=(i=t==null?void 0:t.provider)==null?void 0:i.syncDappData)==null||o.call(i,{metadata:n.metadata,sdkVersion:n.sdkVersion,sdkType:n.sdkType,projectId:n.projectId}),t.provider.syncTheme({themeMode:r,themeVariables:s,w3mThemeVariables:E9(s,r)})},getConnectorsByNamespace(e){const t=Nn.allConnectors.filter(n=>n.chain===e);return Te.mergeMultiChainConnectors(t)},canSwitchToSmartAccount(e){return G.checkIfSmartAccountEnabled()&&pu(e)===Lp.ACCOUNT_TYPES.EOA},selectWalletConnector(e){var s;const t=(s=xt.state.data)==null?void 0:s.redirectView,n=G.state.activeChain,r=n?Te.getConnector({id:e.id,namespace:n}):void 0;rst.handleMobileDeeplinkRedirect((r==null?void 0:r.explorerId)||e.id,G.state.activeChain,{isCoinbaseDisabled:pe.state.enableCoinbase===!1}),r?xt.push("ConnectingExternal",{connector:r,wallet:e,redirectView:t}):xt.push("ConnectingWalletConnect",{wallet:e,redirectView:t})},getConnectors(e){return e?Te.getConnectorsByNamespace(e):Te.mergeMultiChainConnectors(Nn.allConnectors)},setFilterByNamespace(e){Nn.filterByNamespace=e,Nn.connectors=Te.getConnectors(e),it.setFilterByNamespace(e)},setConnectorId(e,t){e&&(Nn.activeConnectorIds={...Nn.activeConnectorIds,[t]:e},xe.setConnectedConnectorId(t,e))},removeConnectorId(e){Nn.activeConnectorIds={...Nn.activeConnectorIds,[e]:void 0},xe.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return Nn.activeConnectorIds[e]},isConnected(e){return e?!!Nn.activeConnectorIds[e]:Object.values(Nn.activeConnectorIds).some(t=>!!t)},resetConnectorIds(){Nn.activeConnectorIds={...E1e}},extendConnectorsWithExplorerWallets(e){Nn.allConnectors.forEach(r=>{const s=e.find(i=>{var o;return i.id===r.id||i.rdns&&i.rdns===((o=r.info)==null?void 0:o.rdns)});s&&(r.explorerWallet=s)});const t=Te.getEnabledNamespaces(),n=Te.getEnabledConnectors(t);Nn.connectors=Te.mergeMultiChainConnectors(n)},async connect(e={}){const{namespace:t}=e;return Te.setFilterByNamespace(t),xt.push("Connect",{addWalletForNamespace:t}),new Promise((n,r)=>{if(t){const s=G.subscribeChainProp("accountState",o=>{o!=null&&o.caipAddress&&(n({caipAddress:o==null?void 0:o.caipAddress}),s())},t),i=dn.subscribeKey("open",o=>{o||(r(new Error("Modal closed")),i())})}else{const s=G.subscribeKey("activeCaipAddress",o=>{o&&(n({caipAddress:o}),s())}),i=dn.subscribeKey("open",o=>{o||(r(new Error("Modal closed")),i())})}})}},Te=Lu(pst),gst=1e3,V3={checkNamespaceConnectorId(e,t){return Te.getConnectorId(e)===t},isSocialProvider(e){return mn.DEFAULT_REMOTE_FEATURES.socials.includes(e)},connectWalletConnect({walletConnect:e,connector:t,closeModalOnConnect:n=!0,redirectViewOnModalClose:r="Connect",onOpen:s,onConnect:i}){return new Promise((o,a)=>
vendor: 5,069 bytes, line 68
68{if(e&&Te.setActiveConnector(t),s==null||s(Je.isMobile()&&e),r){const l=dn.subscribeKey("open",u=>{u||(xt.state.view!==r&&xt.replace(r),l(),a(new Error("Modal closed")))})}const c=G.subscribeKey("activeCaipAddress",l=>{l&&(i==null||i(),n&&dn.close(),c(),o(Ci.parseCaipAddress(l)))})})},connectExternal(e){return new Promise((t,n)=>{const r=G.subscribeKey("activeCaipAddress",s=>{s&&(dn.close(),r(),t(Ci.parseCaipAddress(s)))});Ue.connectExternal(e,e.chain).catch(()=>{r(),n(new Error("Connection rejected"))})})},connectSocial({social:e,namespace:t,closeModalOnConnect:n=!0,onOpenFarcaster:r,onConnect:s}){let i,o=!1,a=null;const c=t||G.state.activeChain,l=G.subscribeKey("activeCaipAddress",u=>{u&&(n&&dn.close(),l())});return new Promise((u,d)=>{async function h(g){var p;if((p=g.data)!=null&&p.resultUri)if(g.origin===he.SECURE_SITE_SDK_ORIGIN){window.removeEventListener("message",h,!1);try{const m=Te.getAuthConnector(c);if(m&&!o){i&&i.close(),o=!0;const w=g.data.resultUri;sn.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:e}}),xe.setConnectedSocialProvider(e),await Ue.connectExternal({id:m.id,type:m.type,socialUri:w},m.chain);const C=G.state.activeCaipAddress;if(!C){d(new Error("Failed to connect"));return}u(Ci.parseCaipAddress(C)),sn.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:e}})}}catch(m){sn.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:e,message:Je.parseError(m)}}),d(new Error("Failed to connect"))}}else sn.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:e,message:"Untrusted Origin"}})}async function f(){if(sn.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:e}}),e==="farcaster"){r==null||r();const g=dn.subscribeKey("open",m=>{!m&&e==="farcaster"&&(d(new Error("Popup closed")),s==null||s(),g())}),p=Te.getAuthConnector();if(p){const m=G.getAccountData(c);if(!(m!=null&&m.farcasterUrl))try{const{url:w}=await p.provider.getFarcasterUri();G.setAccountProp("farcasterUrl",w,c)}catch{d(new Error("Failed to connect to farcaster"))}}}else{const g=Te.getAuthConnector();a=Je.returnOpenHref(`${he.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes");try{if(g){const{uri:p}=await g.provider.getSocialRedirectUri({provider:e});if(a&&p){a.location.href=p,i=a;const m=setInterval(()=>{i!=null&&i.closed&&!o&&(d(new Error("Popup closed")),clearInterval(m))},1e3);window.addEventListener("message",h,!1)}else a==null||a.close(),d(new Error("Failed to initiate social connection"))}}catch{d(new Error("Failed to initiate social connection")),a==null||a.close()}}}f()})},connectEmail({closeModalOnConnect:e=!0,redirectViewOnModalClose:t="Connect",onOpen:n,onConnect:r}){return new Promise((s,i)=>{if(n==null||n(),t){const a=dn.subscribeKey("open",c=>{c||(xt.state.view!==t&&xt.replace(t),a(),i(new Error("Modal closed")))})}const o=G.subscribeKey("activeCaipAddress",a=>{a&&(r==null||r(),e&&dn.close(),o(),s(Ci.parseCaipAddress(a)))})})},async updateEmail(){const e=xe.getConnectedConnectorId(G.state.activeChain),t=Te.getAuthConnector();if(!t)throw new Error("No auth connector found");if(e!==he.CONNECTOR_ID.AUTH)throw new Error("Not connected to email or social");const n=t.provider.getEmail()??"";return await dn.open({view:"UpdateEmailWallet",data:{email:n,redirectView:void 0}}),new Promise((r,s)=>{const i=setInterval(()=>{const a=t.provider.getEmail()??"";a!==n&&(dn.close(),clearInterval(i),o(),r({email:a}))},gst),o=dn.subscribeKey("open",a=>{a||(xt.state.view!=="Connect"&&xt.push("Connect"),clearInterval(i),o(),s(new Error("Modal closed")))})})},canSwitchToSmartAccount(e){return G.checkIfSmartAccountEnabled()&&pu(e)===Lp.ACCOUNT_TYPES.EOA}};function C1e(){var r,s;const e=((r=G.state.activeCaipNetwork)==null?void 0:r.chainNamespace)||"eip155",t=((s=G.state.activeCaipNetwork)==null?void 0:s.id)||1,n=mn.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${n}`}function pu(e){var n;return(n=G.getAccountData(e))==null?void 0:n.preferredAccountType}function kE(e){return G.state.activeCaipNetwork}const hA={getConnectionStatus(e,t){const n=Te.state.activeConnectorIds[t],r=Ue.getConnections(t);return!!n&&e.connectorId===n?"connected":r.some(o=>o.connectorId.toLowerCase()===e.connectorId.toLowerCase())?"active":"disconnected"},excludeConnectorAddressFromConnections({connections:e,connectorId:t,addresses:n}){return e.map(r=>{if((t?r.connectorId.toLowerCase()===t.toLowerCase():!1)&&n){const i=r.accounts.filter(o=>!n.some(c=>c.toLowerCase()===o.address.toLowerCase()));return{...r,accounts:i}}return r})},excludeExistingConnections(e,t){const n=new Set(e);return t.filter(r=>!n.has(r.connectorId))},getConnectionsByConnectorId(e,t){return e.filter(n=>n.connectorId.toLowerCase()===t.toLowerCase())},getConnectionsData(e){var a;const t=!!((a=pe.state.remoteFeatures)!=null&&a.multiWallet),n=Te.state.activeConnectorIds[e],r=Ue.getConnections(e),i=(Ue.state.recentConnections.get(e)??[]).filter(c=>Te.getConnectorById(c.connectorId)),o=hA.excludeExistingConnections([...r.map(c=>
68c.connectorId),...n?[n]:[]],i);return t?{connections:r,recentConnections:o}:{connections:r.filter(c=>c.connectorId.toLowerCase()===(n==null?void 0:n.toLowerCase())),recentConnections:[]}},onConnectMobile(e,t){const n=Ue.state.wcUri;if(e!=null&&e.mobile_link&&n)try{Ue.setWcError(!1);const{mobile_link:r,link_mode:s,name:i}=e,o=Je.appendPayToUri(n,t),{redirect:a,redirectUniversalLink:c,href:l}=Je.formatNativeUrl(r,o,s),u=a,d=c,h=Je.isIframe()?"_top":"_self";Ue.setWcLinking({name:i,href:l}),Ue.setRecentWallet(e),pe.state.experimental_preferUniversalLinks&&d?Je.openHref(d,h):Je.openHref(u,h)}catch(r){sn.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:r instanceof Error?r.message:"Error parsing the deep link",uri:n,mobile_link:e.mobile_link,name:e.name}}),Ue.setWcError(!0)}}},d2=zr({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1,connectingWallet:void 0}),xd={state:d2,subscribe(e){return Gi(d2,()=>e(d2))},subscribeOpen(e){return Zi(d2,"open",e)},set(e){Object.assign(d2,{...d2,...e})}},Kr=zr({transactions:[],transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),mst={state:Kr,subscribe(e){return Gi(Kr,()=>e(Kr))},setLastNetworkInView(e){Kr.lastNetworkInView=e},async fetchTransactions(e){var t;if(!e)throw new Error("Transactions can't be fetched without an accountAddress");Kr.loading=!0;try{const n=await Pt.fetchTransactions({account:e,cursor:Kr.next,chainId:(t=G.state.activeCaipNetwork)==null?void 0:t.caipNetworkId}),r=SS.filterSpamTransactions(n.data),s=SS.filterByConnectedChain(r),i=[...Kr.transactions,...s];Kr.loading=!1,Kr.transactions=i,Kr.transactionsByYear=SS.groupTransactionsByYearAndMonth(Kr.transactionsByYear,s),Kr.empty=i.length===0,Kr.next=n.next?n.next:void 0}catch{const r=G.state.activeChain;sn.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:pe.state.projectId,cursor:Kr.next,isSmartAccount:pu(r)===Lp.ACCOUNT_TYPES.SMART_ACCOUNT}}),Lh.showError("Failed to fetch transactions"),Kr.loading=!1,Kr.empty=!0,Kr.next=void 0}},groupTransactionsByYearAndMonth(e={},t=[]){const n=e;return t.forEach(r=>{const s=new Date(r.metadata.minedAt).getFullYear(),i=new Date(r.metadata.minedAt).getMonth(),o=n[s]??{},c=(o[i]??[]).filter(l=>l.id!==r.id);n[s]={...o,[i]:[...c,r].sort((l,u)=>new Date(u.metadata.minedAt).getTime()-new Date(l.metadata.minedAt).getTime())}}),n},filterSpamTransactions(e){return e.filter(t=>{var r;return!((r=t.transfers)==null?void 0:r.every(s=>{var i;return((i=s.nft_info)==null?void 0:i.flags.is_spam)===!0}))})},filterByConnectedChain(e){var r;const t=(r=G.state.activeCaipNetwork)==null?void 0:r.caipNetworkId;return e.filter(s=>s.metadata.chain===t)},clearCursor(){Kr.next=void 0},resetTransactions(){Kr.transactions=[],Kr.transactionsByYear={},Kr.lastNetworkInView=void 0,Kr.loading=!1,Kr.empty=!1,Kr.next=void 0}},SS=Lu(mst,"API_ERROR"),Yt=zr({connections:new Map,recentConnections:new Map,isSwitchingConnection:!1,wcError:!1,wcFetchingUri:!1,buffering:!1,status:"disconnected"});let pg;const wst={state:Yt,subscribe(e){return Gi(Yt,()=>e(Yt))},subscribeKey(e,t){return Zi(Yt,e,t)},_getClient(){return Yt._client},setClient(e){Yt._client=K8(e)},initialize(e){const t=e.filter(n=>!!n.namespace).map(n=>n.namespace);Ue.syncStorageConnections(t)},syncStorageConnections(e){const t=xe.getConnections(),n=e??Array.from(G.state.chains.keys());for(const r of n){const s=t[r]??[],i=new Map(Yt.recentConnections);i.set(r,s),Yt.recentConnections=i}},getConnections(e){return e?Yt.connections.get(e)??[]:[]},hasAnyConnection(e){const t=Ue.state.connections;return Array.from(t.values()).flatMap(n=>n).some(({connectorId:n})=>n===e)},async connectWalletConnect({cache:e="auto"}={}){var n,r,s,i;Yt.wcFetchingUri=!0;const t=Je.isTelegram()||Je.isSafari()&&Je.isIos();try{if(e==="always"||e==="auto"&&t){if(pg){await pg,pg=void 0;return}if(!Je.isPairingExpired(Yt==null?void 0:Yt.wcPairingExpiry)){const o=Yt.wcUri;Yt.wcUri=o;return}pg=(r=(n=Ue._getClient())==null?void 0:n.connectWalletConnect)==null?void 0:r.call(n),Ue.state.status="connecting",await pg,pg=void 0,Yt.wcPairingExpiry=void 0,Ue.state.status="connected"}else await((i=(s=Ue._getClient())==null?void 0:s.connectWalletConnect)==null?void 0:i.call(s))}catch(o){throw Yt.wcError=!0,Yt.wcFetchingUri=!1,Yt.status="disconnected",pg=void 0,o}},async connectExternal(e,t,n=!0){var o,a,c;const r=await((a=(o=Ue._getClient())==null?void 0:o.connectExternal)==null?void 0:a.call(o,e));n&&G.setActiveNamespace(t);const s=Te.state.allConnectors.find(l=>l.id===(e==null?void 0:e.id)),i=e.type==="AUTH"?"email":"browser";return sn.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:i,name:(s==null?void 0:s.name)||"Unknown",view:xt.state.view,walletRank:(c=s==null?void 0:s.explorerWallet)==null?void 0:c.order}}),r},async reconnectExternal(e){var n,r;await((r=(n=Ue._getClient())==null?void 0:n.reconnectExternal)==null?void 0:r.call(n,e));const t=e.chain||G.state.activeChain;t&&Te.setConnectorId(e.id,t)},async setPreferredAccountType(e,t){var r;if(!t)return;dn.setLoading(!0,G.state.activeChain);const n=Te.getAuthConnector();n&&(G.setAccountProp("preferredAccountType",e,t),await n.provider.setPreferredAccount(e),xe.setPreferredAccountTypes(Object.entries(G.state.chains).reduce((s,[i,o])=>{const a=i,c=pu(a);return c!==void 0&&(s[a]=c),s},{})),await Ue.reconnectExternal(n),dn.setLoading(!1,G.state.activeChain),sn.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:((r=G.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}}))},async signMessage(e){var t;return(t=Ue._getClient())==null?void 0:t.signMessage(e)},parseUnits(e,t){var n;return(n=Ue._getClient())==null?void 0:n.parseUnits(e,t)},formatUnits(e,t){var n;return(n=Ue._getClient())==null?void 0:n.formatUnits(e,t)},updateBalance(e){var t;return(t=Ue._getClient())==null?void 0:t.updateBalance(e)},async sendTransaction(e){var t;return(t=Ue._getClient())==null?void 0:t.sendTransaction(e)},async getCapabilities(e){var t;return(t=Ue._getClient())==null?void 0:t.getCapabilities(e)},async grantPermissions(e){var t;return(t=Ue._getClient())==null?void 0:t.grantPermissions(e)},async walletGetAssets(e){var t;return((t=Ue._getClient())==null?void 0:t.walletGetAssets(e))??{}},async estimateGas(e){var t;return(t=Ue._getClient())==null?void 0:t.estimateGas(e)},async writeContract(e){var t;return(t=Ue._getClient())==null?void 0:t.writeContract(e)},async writeSolanaTransaction(e){var t;return(t=Ue._getClient())==null?void 0:t.writeSolanaTransaction(e)},async getEnsAddress(e){var t;return(t=Ue._getClient())==null?void 0:t.getEnsAddress(e)},async getEnsAvatar(e){var t;return(t=Ue._getClient())==null?void 0:t.getEnsAvatar(e)},checkInstalled(e){var t,n;return((n=(t=Ue._getClient())==null?void 0:t.checkInstalled)==null?void 0:n.call(t,e))||!1},resetWcConnection(){Yt.wcUri=void 0,Yt.wcPairingExpiry=void 0,Yt.wcLinking=void 0,Yt.recentWallet=void 0,Yt.wcFetchingUri=!1,Yt.status="disconnected",SS.resetTransactions(),xe.deleteWalletConnectDeepLink(),xe.deleteRecentWallet(),xd.set({connectingWallet:void 0})},resetUri(){Yt.wcUri=void 0,Yt.wcPairingExpiry=void 0,pg=void 0,Yt.wcFetchingUri=!1,xd.set({connectingWallet:void 0})},finalizeWcConnection(e){var r,s;const{wcLinking:t,recentWallet:n}=Ue.state;t&&xe.setWalletConnectDeepLink(t),n&&xe.setAppKitRecent(n),e&&sn.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:e,properties:{method:t?"mobile":"qrcode",name:((s=(r=xt.state.data)==null?void 0:r.wallet)==null?void 0:s.name)||"Unknown",view:xt.state.view,walletRank:n==null?void 0:n.order}})},setWcBasic(e){Yt.wcBasic=e},setUri(e){Yt.wcUri=e,Yt.wcFetchingUri=!1,Yt.wcPairingExpiry=Je.getPairingExpiry()},setWcLinking(e){Yt.wcLinking=e},setWcError(e){Yt.wcError=e,Yt.wcFetchingUri=!1,Yt.buffering=!1},setRecentWallet(e){Yt.recentWallet=e},setBuffering(e){Yt.buffering=e},setStatus(e){Yt.status=e},setIsSwitchingConnection(e){Yt.isSwitchingConnection=e},async disconnect({id:e,namespace:t,initialDisconnect:n}={}){var r;try{await((r=Ue._getClient())==null?void 0:r.disconnect({id:e,chainNamespace:t,initialDisconnect:n}))}catch(s){throw new uA("Failed to disconnect","INTERNAL_SDK_ERROR",s)}},async disconnectConnector({id:e,namespace:t}){var n;try{await((n=Ue._getClient())==null?void 0:n.disconnectConnector({id:e,namespace:t}))}catch(r){throw new uA("Failed to disconnect connector","INTERNAL_SDK_ERROR",r)}},setConnections(e,t){const n=new Map(Yt.connections);n.set(t,e),Yt.connections=n},async handleAuthAccountSwitch({address:e,namespace:t}){var i,o;const n=G.getAccountData(t),r=(o=(i=n==null?void 0:n.user)==null?void 0:i.accounts)==null?void 0:o.find(a=>a.type==="smartAccount"),s=r&&r.address.toLowerCase()===e.toLowerCase()&&V3.canSwitchToSmartAccount(t)?"smartAccount":"eoa";await Ue.setPreferredAccountType(s,t)},async handleActiveConnection({connection:e,namespace:t,address:n}){const r=Te.getConnectorById(e.connectorId),s=e.connectorId===he.CONNECTOR_ID.AUTH;if(!r)throw new Error(`No connector found for connection: ${e.connectorId}`);if(s)n&&await Ue.handleAuthAccountSwitch({address:n,namespace:t});else{const i=await Ue.connectExternal({id:r.id,type:r.type,provider:r.provider,address:n,chain:t},t);return i==null?void 0:i.address}return n},async handleDisconnectedConnection({connection:e,namespace:t,address:n,closeModalOnConnect:r}){var l,u;const s=Te.getConnectorById(e.connectorId),i=(u=(l=e.auth)==null?void 0:l.name)==null?void 0:u.toLowerCase(),o=e.connectorId===he.CONNECTOR_ID.AUTH,a=e.connectorId===he.CONNECTOR_ID.WALLET_CONNECT;if(!s)throw new Error(`No connector found for connection: ${e.connectorId}`);let c;if(o)if(i&&V3.isSocialProvider(i)){const{address:d}=await V3.connectSocial({social:i,closeModalOnConnect:r,onOpenFarcaster(){dn.open({view:"ConnectingFarcaster"})},onConnect(){xt.replace("ProfileWallets")}});c=d}else{const{address:d}=await V3.connectEmail({closeModalOnConnect:r,onOpen(){dn.open({view:"EmailLogin"})},onConnect(){xt.replace("ProfileWallets")}});c=d}else if(a){const{address:d}=await V3.connectWalletConnect({walletConnect:!0,connector:s,closeModalOnConnect:r,onOpen(h){const f=h?"AllWallets":"ConnectingWalletConnect";dn.state.open?xt.push(f):dn.open({view:f})},onConnect(){xt.replace("ProfileWallets")}});c=d}else{const d=await Ue.connectExternal({id:s.id,type:s.type,provider:s.provider,chain:t},t);d&&(c=d.address)}return o&&n&&await Ue.handleAuthAccountSwitch({address:n,namespace:t}),c},async switchConnection({connection:e,address:t,namespace:n,closeModalOnConnect:r,onChange:s}){var c;let i;const o=(c=G.getAccountData(n))==null?void 0:c.caipAddress;if(o){const{address:l}=Ci.parseCaipAddress(o);i=l}
68const a=hA.getConnectionStatus(e,n);switch(a){case"connected":case"active":{const l=await Ue.handleActiveConnection({connection:e,namespace:n,address:t});if(i&&l){const u=l.toLowerCase()!==i.toLowerCase();s==null||s({address:l,namespace:n,hasSwitchedAccount:u,hasSwitchedWallet:a==="active"})}break}case"disconnected":{const l=await Ue.handleDisconnectedConnection({connection:e,namespace:n,address:t,closeModalOnConnect:r});l&&(s==null||s({address:l,namespace:n,hasSwitchedAccount:!0,hasSwitchedWallet:!0}));break}default:throw new Error(`Invalid connection status: ${a}`)}}},Ue=Lu(wst),Xk={createBalance(e,t){const n={name:e.metadata.name||"",symbol:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:n.name,symbol:n.symbol,chainId:t,address:e.address==="native"?void 0:this.convertAddressToCAIP10Address(e.address,t),value:n.value,price:n.price,quantity:{decimals:n.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:n.decimals})},iconUrl:n.iconUrl}},convertHexToBalance({hex:e,decimals:t}){return WC(BigInt(e),t)},convertAddressToCAIP10Address(e,t){return`${t}:${e}`},createCAIP2ChainId(e,t){return`${t}:${parseInt(e,16)}`},getChainIdHexFromCAIP2ChainId(e){const t=e.split(":");if(t.length<2||!t[1])return"0x0";const n=t[1],r=parseInt(n,10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return typeof e!="object"||e===null?!1:Object.values(e).every(t=>Array.isArray(t)&&t.every(n=>this.isValidAsset(n)))},isValidAsset(e){return typeof e=="object"&&e!==null&&typeof e.address=="string"&&typeof e.balance=="string"&&(e.type==="ERC20"||e.type==="NATIVE")&&typeof e.metadata=="object"&&e.metadata!==null&&typeof e.metadata.name=="string"&&typeof e.metadata.symbol=="string"&&typeof e.metadata.decimals=="number"&&typeof e.metadata.price=="number"&&typeof e.metadata.iconUrl=="string"}};let Qk;async function pte(){if(!Qk){const{createPublicClient:e,http:t,defineChain:n}=await te(async()=>{const{createPublicClient:r,http:s,defineChain:i}=await Promise.resolve().then(()=>Grt);return{createPublicClient:r,http:s,defineChain:i}},void 0);Qk={createPublicClient:e,http:t,defineChain:n}}return Qk}const OM={getBlockchainApiRpcUrl(e,t){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",e),n.searchParams.set("projectId",t),n.toString()},async getViemChain(e){const{defineChain:t}=await pte(),{chainId:n}=Ci.parseCaipNetworkId(e.caipNetworkId);return t({...e,id:Number(n)})},async createViemPublicClient(e){const{createPublicClient:t,http:n}=await pte(),r=pe.state.projectId,s=await OM.getViemChain(e);if(!s)throw new Error(`Chain ${e.caipNetworkId} not found in viem/chains`);return t({chain:s,transport:n(OM.getBlockchainApiRpcUrl(e.caipNetworkId,r))})}},OH={async getMyTokensWithBalance(e={forceUpdate:void 0,caipNetwork:G.state.activeCaipNetwork,address:(t=>(t=G.getAccountData())==null?void 0:t.address)()}){const{forceUpdate:n,caipNetwork:r,address:s}=e,i=Te.getConnectorId("eip155")===he.CONNECTOR_ID.AUTH;if(!s)return[];const o=r?`${r.caipNetworkId}:${s}`:s,a=xe.getBalanceCacheForCaipAddress(o);if(a)return a.balances;if(r&&r.chainNamespace===he.CHAIN.EVM&&i){const l=await this.getEIP155Balances(s,r);if(l)return this.filterLowQualityTokens(l)}const c=await Pt.getBalance(s,r==null?void 0:r.caipNetworkId,n);return this.filterLowQualityTokens(c.balances)},async getEIP155Balances(e,t){var n,r;try{const s=Xk.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await Ue.getCapabilities(e);if(!((r=(n=i==null?void 0:i[s])==null?void 0:n.assetDiscovery)!=null&&r.supported))return null;const o=await Ue.walletGetAssets({account:e,chainFilter:[s]});if(!Xk.isWalletGetAssetsResponse(o))return null;const c=(o[s]||[]).map(l=>Xk.createBalance(l,t.caipNetworkId));return xe.updateBalanceCache({caipAddress:`${t.caipNetworkId}:${e}`,balance:{balances:c},timestamp:Date.now()}),c}catch{return null}},filterLowQualityTokens(e){return e.filter(t=>t.quantity.decimals!=="0")},async fetchERC20Balance({caipAddress:e,assetAddress:t,caipNetwork:n}){const r=await OM.createViemPublicClient(n),{address:s}=Ci.parseCaipAddress(e),[{result:i},{result:o},{result:a},{result:c}]=await r.multicall({contracts:[{address:t,functionName:"name",args:[],abi:PE},{address:t,functionName:"symbol",args:[],abi:PE},{address:t,functionName:"balanceOf",args:[s],abi:PE},{address:t,functionName:"decimals",args:[],abi:PE}]});return{name:i,symbol:o,decimals:c,balance:a&&c?WC(a,c):"0"}}},eR={adapters:{}},$1e={state:eR,initialize(e){eR.adapters={...e}},get(e){return eR.adapters[e]}},fA={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:void 0,tron:void 0},Sa=zr({providers:{...fA},providerIds:{...fA}}),Br={state:Sa,subscribeKey(e,t){return Zi(Sa,e,t)},subscribe(e){return Gi(Sa,()=>{e(Sa)})},subscribeProviders(e){return Gi(Sa.providers,()=>e(Sa.providers))},setProvider(e,t){e&&t&&(Sa.providers[e]=K8(t))},getProvider(e){if(e)return Sa.providers[e]},setProviderId(e,t){t&&(Sa.providerIds[e]=t)},getProviderId(e){if(e)return Sa.providerIds[e]},reset(){Sa.providers={...fA},Sa.providerIds={...fA}},resetChain(e){Sa.providers[e]=void 0,Sa.providerIds[e]=void 0}},yst={async getTokenList(e){var r;const t=await Pt.fetchSwapTokens({chainId:e});return((r=t==null?void 0:t.tokens)==null?void 0:r.map(s=>({...s,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){var t;const e=G.state.activeCaipNetwork;if(!e)return null;try{switch(e.chainNamespace){case"solana":const n=(t=await(Ue==null?void 0:Ue.estimateGas({chainNamespace:"solana"})))==null?void 0:t.toString();return{standard:n,fast:n,instant:n};case"eip155":default:return await Pt.fetchGasPrice({chainId:e.caipNetworkId})}}catch{return null}},async fetchSwapAllowance({tokenAddress:e,userAddress:t,sourceTokenAmount:n,sourceTokenDecimals:r}){const s=await Pt.fetchSwapAllowance({tokenAddress:e,userAddress:t});if(s!=null&&s.allowance&&n&&r){const i=Ue.parseUnits(n,r)||0;return BigInt(s.allowance)>=i}return!1},async getMyTokensWithBalance(e){var n;const t=await OH.getMyTokensWithBalance({forceUpdate:e,caipNetwork:G.state.activeCaipNetwork,address:(n=G.getAccountData())==null?void 0:n.address});return G.setAccountProp("tokenBalance",t,G.state.activeChain),this.mapBalancesToSwapTokens(t)},mapBalancesToSwapTokens(e){return(e==null?void 0:e.map(t=>({...t,address:t!=null&&t.address?t.address:C1e(),decimals:parseInt(t.quantity.decimals,10),logoUri:t.iconUrl,eip2612:!1})))||[]},async handleSwapError(e){var t,n;try{const r=e==null?void 0:e.cause;if(!(r!=null&&r.json))return;const s=await r.json(),i=(n=(t=s==null?void 0:s.reasons)==null?void 0:t[0])==null?void 0:n.description;return i!=null&&i.includes("insufficient liquidity")?"Insufficient liquidity":void 0}catch{return}}},Tn=zr({tokenBalances:[],loading:!1}),bst={state:Tn,subscribe(e){return Gi(Tn,()=>e(Tn))},subscribeKey(e,t){return Zi(Tn,e,t)},setToken(e){e&&(Tn.token=K8(e))},setTokenAmount(e){Tn.sendTokenAmount=e},setReceiverAddress(e){Tn.receiverAddress=e},setReceiverProfileImageUrl(e){Tn.receiverProfileImageUrl=e},setReceiverProfileName(e){Tn.receiverProfileName=e},setNetworkBalanceInUsd(e){Tn.networkBalanceInUSD=e},setLoading(e){Tn.loading=e},getSdkEventProperties(e){var t,n;return{message:Je.parseError(e),isSmartAccount:pu(G.state.activeChain)===Lp.ACCOUNT_TYPES.SMART_ACCOUNT,token:((t=Tn.token)==null?void 0:t.symbol)||"",amount:Tn.sendTokenAmount??0,network:((n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}},async sendToken(){var e;try{switch(an.setLoading(!0),(e=G.state.activeCaipNetwork)==null?void 0:e.chainNamespace){case"eip155":await an.sendEvmToken();return;case"solana":await an.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}catch(t){throw Up.isUserRejectedRequestError(t)?new e0e(t):t}finally{an.setLoading(!1)}},async sendEvmToken(){var n,r,s;const e=G.state.activeChain;if(!e)throw new Error("SendController:sendEvmToken - activeChainNamespace is required");const t=pu(e);if(!an.state.sendTokenAmount||!an.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!an.state.token)throw new Error("A token is required");if((n=an.state.token)!=null&&n.address){sn.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===Lp.ACCOUNT_TYPES.SMART_ACCOUNT,token:an.state.token.address,amount:an.state.sendTokenAmount,network:((r=G.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}});const{hash:i}=await an.sendERC20Token({receiverAddress:an.state.receiverAddress,tokenAddress:an.state.token.address,sendTokenAmount:an.state.sendTokenAmount,decimals:an.state.token.quantity.decimals});i&&(Tn.hash=i)}else{sn.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===Lp.ACCOUNT_TYPES.SMART_ACCOUNT,token:an.state.token.symbol||"",amount:an.state.sendTokenAmount,network:((s=G.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}});const{hash:i}=await an.sendNativeToken({receiverAddress:an.state.receiverAddress,sendTokenAmount:an.state.sendTokenAmount,decimals:an.state.token.quantity.decimals});i&&(Tn.hash=i)}},async fetchTokenBalance(e){var o,a,c;Tn.loading=!0;const t=G.state.activeChain,n=(o=G.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,r=(a=G.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=((c=G.getAccountData(t))==null?void 0:c.caipAddress)??G.state.activeCaipAddress,i=s?Je.getPlainAddress(s):void 0;if(Tn.lastRetry&&!Je.isAllowedRetry(Tn.lastRetry,30*mn.ONE_SEC_MS))return Tn.loading=!1,[];try{if(i&&n&&r){const l=await OH.getMyTokensWithBalance();return Tn.tokenBalances=l,Tn.lastRetry=void 0,l}}catch(l){Tn.lastRetry=Date.now(),e==null||e(l),Lh.showError("Token Balance Unavailable")}finally{Tn.loading=!1}return[]},fetchNetworkBalance(){if(Tn.tokenBalances.length===0)return;const e=yst.mapBalancesToSwapTokens(Tn.tokenBalances);if(!e)return;const t=e.find(n=>n.address===C1e());t&&(Tn.networkBalanceInUSD=t?Qpe.multiply(t.quantity.numeric,t.price).toString():"0")},async sendNativeToken(e){var o,a,c,l;xt.pushTransactionStack({});const t=e.receiverAddress,n=(o=G.getAccountData())==null?void 0:o.address,r=Ue.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals)),i=await Ue.sendTransaction({chainNamespace:he.CHAIN.EVM,to:t,address:n,data:"0x",value:r??BigInt(0)});return sn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:pu("eip155")===Lp.ACCOUNT_TYPES.SMART_ACCOUNT,token:((a=an.state.token)==null?void 0:a.symbol)||"",amount:e.sendTokenAmount,network:((c=G.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",hash:i||""}}),(l=Ue._getClient())==null||l.updateBalance("eip155"),an.resetSend(),{hash:i}},async sendERC20Token(e){var r,s,i;xt.pushTransactionStack({onSuccess(){xt.replace("Account")}});const t=Ue.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals)),n=(r=G.getAccountData())==null?void 0:r.address;if(n&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){const o=Je.getPlainAddress(e.tokenAddress);if(!o)throw new Error("SendController:sendERC20Token - tokenAddress is required");const a=await Ue.writeContract({fromAddress:n,tokenAddress:o,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:JXe.getERC20Abi(o),chainNamespace:he.CHAIN.EVM});return sn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:pu("eip155")===Lp.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=an.state.token)==null?void 0:s.symbol)||"",amount:e.sendTokenAmount,network:((i=G.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||"",hash:a||""}}),an.resetSend(),{hash:a}}return{hash:void 0}},async sendSolanaToken(){var n,r,s;if(!an.state.sendTokenAmount||!an.state.receiverAddress)throw new Error("An amount and receiver address are required");xt.pushTransactionStack({onSuccess(){xt.replace("Account")}});let e;an.state.token&&an.state.token.address!==mn.SOLANA_NATIVE_TOKEN_ADDRESS&&(Je.isCaipAddress(an.state.token.address)?e=Je.getPlainAddress(an.state.token.address):e=an.state.token.address);const t=await Ue.sendTransaction({chainNamespace:"solana",tokenMint:e,to:an.state.receiverAddress,value:an.state.sendTokenAmount});t&&(Tn.hash=t),(n=Ue._getClient())==null||n.updateBalance("solana"),sn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:!1,token:((r=an.state.token)==null?void 0:r.symbol)||"",amount:an.state.sendTokenAmount,network:((s=G.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||"",hash:t||""}}),an.resetSend()},resetSend(){Tn.token=void 0,Tn.sendTokenAmount=void 0,Tn.receiverAddress=void 0,Tn.receiverProfileImageUrl=void 0,Tn.receiverProfileName=void 0,Tn.loading=!1,Tn.tokenBalances=[]}},an=Lu(bst),tR={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,user:void 0,preferredAccountType:void 0},sI={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},Ke=zr({chains:dQe(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter
68:{connectionControllerClient:void 0},isSwitchingNamespace:!1}),x1e={state:Ke,subscribe(e){return Gi(Ke,()=>{e(Ke)})},subscribeKey(e,t){return Zi(Ke,e,t)},subscribeAccountStateProp(e,t,n){var s;const r=n||Ke.activeChain;return r?Zi(((s=Ke.chains.get(r))==null?void 0:s.accountState)||{},e,t):()=>{}},subscribeChainProp(e,t,n){let r;return Gi(Ke.chains,()=>{var i;const s=n||Ke.activeChain;if(s){const o=(i=Ke.chains.get(s))==null?void 0:i[e];r!==o&&(r=o,t(o))}})},initialize(e,t,n){const{chainId:r,namespace:s}=xe.getActiveNetworkProps(),i=t==null?void 0:t.find(u=>u.id.toString()===(r==null?void 0:r.toString())),a=e.find(u=>(u==null?void 0:u.namespace)===s)||(e==null?void 0:e[0]),c=e.map(u=>u.namespace).filter(u=>u!==void 0),l=pe.state.enableEmbedded?new Set([...c]):new Set([...(t==null?void 0:t.map(u=>u.chainNamespace))??[]]);((e==null?void 0:e.length)===0||!a)&&(Ke.noAdapters=!0),Ke.noAdapters||(Ke.activeChain=a==null?void 0:a.namespace,Ke.activeCaipNetwork=i,G.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:i}),Ke.activeChain&&xd.set({activeChain:a==null?void 0:a.namespace})),l.forEach(u=>{const d=t==null?void 0:t.filter(g=>g.chainNamespace===u),h=xe.getPreferredAccountTypes()||{},f={...pe.state.defaultAccountTypes,...h};G.state.chains.set(u,{namespace:u,networkState:zr({...sI,caipNetwork:d==null?void 0:d[0]}),accountState:zr({...tR,preferredAccountType:f[u]}),caipNetworks:d??[],...n}),G.setRequestedCaipNetworks(d??[],u)})},removeAdapter(e){var t,n;if(Ke.activeChain===e){const r=Array.from(Ke.chains.entries()).find(([s])=>s!==e);if(r){const s=(n=(t=r[1])==null?void 0:t.caipNetworks)==null?void 0:n[0];s&&G.setActiveCaipNetwork(s)}}Ke.chains.delete(e)},addAdapter(e,{connectionControllerClient:t},n){if(!e.namespace)throw new Error("ChainController:addAdapter - adapter must have a namespace");Ke.chains.set(e.namespace,{namespace:e.namespace,networkState:{...sI,caipNetwork:n[0]},accountState:{...tR},caipNetworks:n,connectionControllerClient:t}),G.setRequestedCaipNetworks((n==null?void 0:n.filter(r=>r.chainNamespace===e.namespace))??[],e.namespace)},addNetwork(e){var n;const t=Ke.chains.get(e.chainNamespace);if(t){const r=[...t.caipNetworks||[]];(n=t.caipNetworks)!=null&&n.find(s=>s.id===e.id)||r.push(e),Ke.chains.set(e.chainNamespace,{...t,caipNetworks:r}),G.setRequestedCaipNetworks(r,e.chainNamespace),Te.filterByNamespace(e.chainNamespace,!0)}},removeNetwork(e,t){var r,s,i;const n=Ke.chains.get(e);if(n){const o=((r=Ke.activeCaipNetwork)==null?void 0:r.id)===t,a=[...((s=n.caipNetworks)==null?void 0:s.filter(c=>c.id!==t))||[]];o&&((i=n==null?void 0:n.caipNetworks)!=null&&i[0])&&G.setActiveCaipNetwork(n.caipNetworks[0]),Ke.chains.set(e,{...n,caipNetworks:a}),G.setRequestedCaipNetworks(a||[],e),a.length===0&&Te.filterByNamespace(e,!1)}},setAdapterNetworkState(e,t){const n=Ke.chains.get(e);n&&(n.networkState={...n.networkState||sI,...t},Ke.chains.set(e,n))},setChainAccountData(e,t,n=!0){if(!e)throw new Error("Chain is required to update chain account data");const r=Ke.chains.get(e);if(r){const s={...r.accountState||tR,...t};Ke.chains.set(e,{...r,accountState:s}),(Ke.chains.size===1||Ke.activeChain===e)&&t.caipAddress&&(Ke.activeCaipAddress=t.caipAddress)}},setChainNetworkData(e,t){if(!e)return;const n=Ke.chains.get(e);if(n){const r={...n.networkState||sI,...t};Ke.chains.set(e,{...n,networkState:r})}},setAccountProp(e,t,n,r=!0){G.setChainAccountData(n,{[e]:t},r)},setActiveNamespace(e){var r,s;Ke.activeChain=e;const t=e?Ke.chains.get(e):void 0,n=(r=t==null?void 0:t.networkState)==null?void 0:r.caipNetwork;n!=null&&n.id&&e&&(Ke.activeCaipAddress=(s=t==null?void 0:t.accountState)==null?void 0:s.caipAddress,Ke.activeCaipNetwork=n,G.setChainNetworkData(e,{caipNetwork:n}),xe.setActiveCaipNetworkId(n==null?void 0:n.caipNetworkId),xd.set({activeChain:e,selectedNetworkId:n==null?void 0:n.caipNetworkId}))},setActiveCaipNetwork(e){var i,o;if(!e)return;const t=Ke.activeChain===e.chainNamespace;t||G.setIsSwitchingNamespace(!0);const n=Ke.chains.get(e.chainNamespace);Ke.activeChain=e.chainNamespace,Ke.activeCaipNetwork=e,G.setChainNetworkData(e.chainNamespace,{caipNetwork:e});let r=(i=n==null?void 0:n.accountState)==null?void 0:i.address;if(r)Ke.activeCaipAddress=`${e.chainNamespace}:${e.id}:${r}`;else if(t&&Ke.activeCaipAddress){const{address:a}=Ci.parseCaipAddress(Ke.activeCaipAddress);r=a,Ke.activeCaipAddress=`${e.caipNetworkId}:${r}`}else Ke.activeCaipAddress=void 0;G.setChainAccountData(e.chainNamespace,{address:r,caipAddress:Ke.activeCaipAddress}),an.resetSend(),xd.set({activeChain:Ke.activeChain,selectedNetworkId:(o=Ke.activeCaipNetwork)==null?void 0:o.caipNetworkId}),xe.setActiveCaipNetworkId(e.caipNetworkId),!G.checkIfSupportedNetwork(e.chainNamespace)&&pe.state.enableNetworkSwitch&&!pe.state.allowUnsupportedChain&&!Ue.state.wcBasic&&G.showUnsupportedChainUI()},addCaipNetwork(e){var n;if(!e)return;const t=Ke.chains.get(e.chainNamespace);t&&((n=t==null?void 0:t.caipNetworks)==null||n.push(e))},async switchActiveNamespace(e){var s;if(!e)return;const t=e!==G.state.activeChain,n=(s=G.getNetworkData(e))==null?void 0:s.caipNetwork,r=G.getCaipNetworkByNamespace(e,n==null?void 0:n.id);t&&r&&await G.switchActiveNetwork(r)},async switchActiveNetwork(e,{throwOnFailure:t=!1}={}){var o;const n=G.state.activeChain;if(!n)throw new Error("ChainController:switchActiveNetwork - namespace is required");const r=Br.getProviderId(Ke.activeChain)==="AUTH",s=(o=G.getAccountData(n))==null?void 0:o.address,i=he.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e.chainNamespace);try{if(s&&e.chainNamespace===n||r&&i){const a=$1e.get(e.chainNamespace);if(!a)throw new Error("Adapter not found");await a.switchNetwork({caipNetwork:e})}G.setActiveCaipNetwork(e)}catch(a){if(t)throw a}sn.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}})},getConnectionControllerClient(e){const t=e||Ke.activeChain;if(!t)throw new Error("Chain is required to get connection controller client");const n=Ke.chains.get(t);if(!(n!=null&&n.connectionControllerClient))throw new Error("ConnectionController client not set");return n.connectionControllerClient},getNetworkProp(e,t){var r;const n=(r=Ke.chains.get(t))==null?void 0:r.networkState;if(n)return n[e]},getRequestedCaipNetworks(e){const t=Ke.chains.get(e),{approvedCaipNetworkIds:n=[],requestedCaipNetworks:r=[]}=(t==null?void 0:t.networkState)||{};return Je.sortRequestedNetworks(n,r).filter(o=>o==null?void 0:o.id)},getAllRequestedCaipNetworks(){const e=[];return Ke.chains.forEach(t=>{if(!t.namespace)throw new Error("ChainController:getAllRequestedCaipNetworks - chainAdapter must have a namespace");const n=G.getRequestedCaipNetworks(t.namespace);e.push(...n)}),e},setRequestedCaipNetworks(e,t){G.setAdapterNetworkState(t,{requestedCaipNetworks:e});const r=G.getAllRequestedCaipNetworks().map(i=>i.chainNamespace),s=Array.from(new Set(r));Te.filterByNamespaces(s)},getAllApprovedCaipNetworkIds(){const e=[];return Ke.chains.forEach(t=>{if(!t.namespace)throw new Error("ChainController:getAllApprovedCaipNetworkIds - chainAdapter must have a namespace");const n=G.getApprovedCaipNetworkIds(t.namespace);e.push(...n)}),e},getActiveCaipNetwork(e){var t,n;return e?(n=(t=Ke.chains.get(e))==null?void 0:t.networkState)==null?void 0:n.caipNetwork:Ke.activeCaipNetwork},getActiveCaipAddress(){return Ke.activeCaipAddress},getApprovedCaipNetworkIds(e){var r;const t=Ke.chains.get(e);return((r=t==null?void 0:t.networkState)==null?void 0:r.approvedCaipNetworkIds)||[]},setApprovedCaipNetworksData(e,t){G.setAdapterNetworkState(e,t)},checkIfSupportedNetwork(e,t){var s;const n=t||((s=Ke.activeCaipNetwork)==null?void 0:s.caipNetworkId),r=G.getRequestedCaipNetworks(e);return r.length?r==null?void 0:r.some(i=>i.caipNetworkId===n):!0},checkIfSupportedChainId(e){if(!Ke.activeChain)return!0;const t=G.getRequestedCaipNetworks(Ke.activeChain);return t==null?void 0:t.some(n=>n.id===e)},checkIfSmartAccountEnabled(){var r,s;const e=PW.caipNetworkIdToNumber((r=Ke.activeCaipNetwork)==null?void 0:r.caipNetworkId);if(!Ke.activeChain||!e)return!1;const n=((s=fQe.get(xS.SMART_ACCOUNT_ENABLED_NETWORKS))==null?void 0:s.split(","))||[];return!!(n!=null&&n.includes(e.toString()))},showUnsupportedChainUI(){dn.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const e=Ke.activeCaipNetwork;return!!(e!=null&&e.chainNamespace&&mn.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){G.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})},resetAccount(e){var s,i;const t=e;if(!t)throw new Error("Chain is required to set account prop");const n=(i=(s=G.state.chains.get(t))==null?void 0:s.accountState)==null?void 0:i.preferredAccountType,r=pe.state.defaultAccountTypes[t];Ke.activeCaipAddress=void 0,G.setChainAccountData(t,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol
68:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:r||n,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,user:void 0,status:"disconnected"}),Te.removeConnectorId(t)},setIsSwitchingNamespace(e){Ke.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){var n,r;const e=[];let t;if(Ke.chains.forEach(s=>{he.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(i=>i===s.namespace)&&s.namespace&&e.push(s.namespace)}),e.length>0){const s=e[0];return t=s?(r=(n=Ke.chains.get(s))==null?void 0:n.caipNetworks)==null?void 0:r[0]:void 0,t}},getAccountData(e){var n;const t=e||Ke.activeChain;if(t)return(n=G.state.chains.get(t))==null?void 0:n.accountState},getNetworkData(e){var n;const t=e||Ke.activeChain;if(t)return(n=G.state.chains.get(t))==null?void 0:n.networkState},getCaipNetworkByNamespace(e,t){var s,i,o;if(!e)return;const n=G.state.chains.get(e),r=(s=n==null?void 0:n.caipNetworks)==null?void 0:s.find(a=>a.id.toString()===(t==null?void 0:t.toString()));return r||((i=n==null?void 0:n.networkState)==null?void 0:i.caipNetwork)||((o=n==null?void 0:n.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const e=Te.state.filterByNamespace;return(e?[Ke.chains.get(e)]:Array.from(Ke.chains.values())).flatMap(n=>(n==null?void 0:n.caipNetworks)||[]).map(n=>n.caipNetworkId)},getCaipNetworks(e){return e?G.getRequestedCaipNetworks(e):G.getAllRequestedCaipNetworks()},getCaipNetworkById(e,t){return x1e.getCaipNetworks(t).find(n=>n.id.toString()===e.toString()||n.caipNetworkId.toString()===e.toString())},setLastConnectedSIWECaipNetwork(e){Ke.lastConnectedSIWECaipNetwork=e},getLastConnectedSIWECaipNetwork(){return Ke.lastConnectedSIWECaipNetwork},async fetchTokenBalance(e){var o,a;const t=G.getAccountData();if(!t)return[];const n=(o=G.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,r=(a=G.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=G.state.activeCaipAddress,i=s?Je.getPlainAddress(s):void 0;if(G.setAccountProp("balanceLoading",!0,r),t.lastRetry&&!Je.isAllowedRetry(t.lastRetry,30*mn.ONE_SEC_MS))return G.setAccountProp("balanceLoading",!1,r),[];try{if(i&&n&&r){const c=await OH.getMyTokensWithBalance();return G.setAccountProp("tokenBalance",c,r),G.setAccountProp("lastRetry",void 0,r),G.setAccountProp("balanceLoading",!1,r),c}}catch(c){G.setAccountProp("lastRetry",Date.now(),r),e==null||e(c),Lh.showError("Token Balance Unavailable")}finally{G.setAccountProp("balanceLoading",!1,r)}return[]},isCaipNetworkDisabled(e){var c;const t=e.chainNamespace,n=!!((c=G.getAccountData(t))!=null&&c.caipAddress),r=G.getAllApprovedCaipNetworkIds(),s=G.getNetworkProp("supportsAllNetworks",t)!==!1,i=Te.getConnectorId(t),o=Te.getAuthConnector(),a=i===he.CONNECTOR_ID.AUTH&&o;return!n||s||a?!1:!(r!=null&&r.includes(e.caipNetworkId))}},G=Lu(x1e),vst={onSwitchNetwork({network:e,ignoreSwitchConfirmation:t=!1}){var h,f;const n=G.state.activeCaipNetwork,r=G.state.activeChain,s=xt.state.data;if(e.id===(n==null?void 0:n.id))return;const o=!!((h=G.getAccountData(r))!=null&&h.address),a=!!((f=G.getAccountData(e.chainNamespace))!=null&&f.address),c=e.chainNamespace!==r,u=Te.getConnectorId(r)===he.CONNECTOR_ID.AUTH,d=he.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(g=>g===e.chainNamespace);t||u&&d?xt.push("SwitchNetwork",{...s,network:e}):o&&c&&!a?xt.push("SwitchActiveChain",{switchToChain:e.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:e}):xt.push("SwitchNetwork",{...s,network:e})}},Aa=zr({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),Est={state:Aa,subscribe(e){return Gi(Aa,()=>e(Aa))},subscribeKey(e,t){return Zi(Aa,e,t)},async open(e){var o,a;const t=e==null?void 0:e.namespace,n=G.state.activeChain,r=t&&t!==n,s=(o=G.getAccountData(e==null?void 0:e.namespace))==null?void 0:o.caipAddress,i=G.state.noAdapters;if(Ue.state.wcBasic?it.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1}):await it.prefetch(),Te.setFilterByNamespace(e==null?void 0:e.namespace),dn.setLoading(!0,t),t&&r){const c=((a=G.getNetworkData(t))==null?void 0:a.caipNetwork)||G.getRequestedCaipNetworks(t)[0];c&&(i?(await G.switchActiveNetwork(c),xt.push("ConnectingWalletConnectBasic")):vst.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0}))}else pe.state.manualWCControl||i&&!s?Je.isMobile()?xt.reset("AllWallets"):xt.reset("ConnectingWalletConnectBasic"):e!=null&&e.view?xt.reset(e.view,e.data):s?xt.reset("Account"):xt.reset("Connect");Aa.open=!0,xd.set({open:!0}),sn.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!s}})},close(){const e=pe.state.enableEmbedded,t=!!G.state.activeCaipAddress;Aa.open&&sn.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),Aa.open=!1,xt.reset("Connect"),dn.clearLoading(),e?t?xt.replace("Account"):xt.push("Connect"):xd.set({open:!1}),Ue.resetUri()}
68,setLoading(e,t){t&&Aa.loadingNamespaceMap.set(t,e),Aa.loading=e,xd.set({loading:e})},clearLoading(){Aa.loadingNamespaceMap.clear(),Aa.loading=!1,xd.set({loading:!1})},shake(){Aa.shake||(Aa.shake=!0,setTimeout(()=>{Aa.shake=!1},500))}},dn=Lu(Est),l8={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},kM={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},Cst={providers:n0e,selectedProvider:null,error:null,purchaseCurrency:l8,paymentCurrency:kM,purchaseCurrencies:[l8],paymentCurrencies:[],quotesLoading:!1},Un=zr(Cst),$st={state:Un,subscribe(e){return Gi(Un,()=>e(Un))},subscribeKey(e,t){return Zi(Un,e,t)},setSelectedProvider(e){var t,n;if(e&&e.name==="meld"){const r=G.state.activeChain,s=r===he.CHAIN.SOLANA?"SOL":"USDC",i=r?((n=(t=G.state.chains.get(r))==null?void 0:t.accountState)==null?void 0:n.address)??"":"",o=new URL(e.url);o.searchParams.append("publicKey",hQe),o.searchParams.append("destinationCurrencyCode",s),o.searchParams.append("walletAddress",i),o.searchParams.append("externalCustomerId",pe.state.projectId),Un.selectedProvider={...e,url:o.toString()}}else Un.selectedProvider=e},setOnrampProviders(e){if(Array.isArray(e)&&e.every(t=>typeof t=="string")){const t=e,n=n0e.filter(r=>t.includes(r.name));Un.providers=n}else Un.providers=[]},setPurchaseCurrency(e){Un.purchaseCurrency=e},setPaymentCurrency(e){Un.paymentCurrency=e},setPurchaseAmount(e){RM.state.purchaseAmount=e},setPaymentAmount(e){RM.state.paymentAmount=e},async getAvailableCurrencies(){const e=await Pt.getOnrampOptions();Un.purchaseCurrencies=e.purchaseCurrencies,Un.paymentCurrencies=e.paymentCurrencies,Un.paymentCurrency=e.paymentCurrencies[0]||kM,Un.purchaseCurrency=e.purchaseCurrencies[0]||l8,await it.fetchCurrencyImages(e.paymentCurrencies.map(t=>t.id)),await it.fetchTokenImages(e.purchaseCurrencies.map(t=>t.symbol))},async getQuote(){var e,t;Un.quotesLoading=!0;try{const n=await Pt.getOnrampQuote({purchaseCurrency:Un.purchaseCurrency,paymentCurrency:Un.paymentCurrency,amount:((e=Un.paymentAmount)==null?void 0:e.toString())||"0",network:(t=Un.purchaseCurrency)==null?void 0:t.symbol});return Un.quotesLoading=!1,Un.purchaseAmount=Number(n==null?void 0:n.purchaseAmount.amount),n}catch(n){return Un.error=n.message,Un.quotesLoading=!1,null}finally{Un.quotesLoading=!1}},resetState(){Un.selectedProvider=null,Un.error=null,Un.purchaseCurrency=l8,Un.paymentCurrency=kM,Un.purchaseCurrencies=[l8],Un.paymentCurrencies=[],Un.paymentAmount=void 0,Un.purchaseAmount=void 0,Un.quotesLoading=!1}},RM=Lu($st);var xst=Object.defineProperty,Ist=(e,t,n)=>t in e?xst(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gte=(e,t,n)=>Ist(e,typeof t!="symbol"?t+"":t,n);let Sst=class extends Wr{constructor(t){super(),this.opts=t,gte(this,"protocol","wc"),gte(this,"version",2)}};var Ast=Object.defineProperty,_st=(e,t,n)=>t in e?Ast(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nst=(e,t,n)=>_st(e,t+"",n);let Tst=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n,Nst(this,"records",new Map)}},Pst=class{constructor(t,n){this.logger=t,this.core=n}},Ost=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},kst=class extends Wr{constructor(t){super()}},Rst=class{constructor(t,n,r,s){this.core=t,this.logger=n,this.name=r}},Bst=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},Dst=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n}},Ust=class{constructor(t,n,r){this.core=t,this.logger=n,this.store=r}},Lst=class{constructor(t,n){this.projectId=t,this.logger=n}},Mst=class{constructor(t,n,r){this.core=t,this.logger=n,this.telemetryEnabled=r}};var jst=Object.defineProperty,Fst=(e,t,n)=>t in e?jst(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
vendor: 61,296 bytes, lines 68-69
68):e[t]=n,mte=(e,t,n)=>Fst(e,typeof t!="symbol"?t+"":t,n);let zst=class{constructor(t){this.opts=t,mte(this,"protocol","wc"),mte(this,"version",2)}},qst=class{constructor(t){this.client=t}};const Wst="0.1.1";function Hst(){return Wst}let Cs=class BM extends Error{constructor(t,n={}){const r=(()=>{var c;if(n.cause instanceof BM){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof BM&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,a=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(` 69`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Hst()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=t}walk(t){return I1e(this,t)}};function I1e(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?I1e(e.cause,t):t?null:e}const kH=BigInt(0),DM=BigInt(1);function t$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function RH(e){if(!t$(e))throw new Error("Uint8Array expected")}function i4(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function iI(e){const t=e.toString(16);return t.length&1?"0"+t:t}function S1e(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?kH:BigInt("0x"+e)}const A1e=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Vst=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function o4(e){if(RH(e),A1e)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Vst[e[n]];return t}const qf={_0:48,_9:57,A:65,F:70,a:97,f:102};function wte(e){if(e>=qf._0&&e<=qf._9)return e-qf._0;if(e>=qf.A&&e<=qf.F)return e-(qf.A-10);if(e>=qf.a&&e<=qf.f)return e-(qf.a-10)}function pA(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(A1e)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=wte(e.charCodeAt(i)),a=wte(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Pw(e){return S1e(o4(e))}function _1e(e){return RH(e),S1e(o4(Uint8Array.from(e).reverse()))}function n$(e,t){return pA(e.toString(16).padStart(t*2,"0"))}function N1e(e,t){return n$(e,t).reverse()}function iu(e,t,n){let r;if(typeof t=="string")try{r=pA(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(t$(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function gA(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];RH(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const nR=e=>typeof e=="bigint"&&kH<=e;function BH(e,t,n){return nR(e)&&nR(t)&&nR(n)&&t<=e&&e<n}function Hv(e,t,n,r){if(!BH(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Kst(e){let t;for(t=0;e>kH;e>>=DM,t+=1);return t}const oT=e=>(DM<<BigInt(e))-DM,rR=e=>new Uint8Array(e),yte=e=>Uint8Array.from(e);function Gst(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=rR(e),s=rR(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=rR(0))=>{s=a(yte([0]),d),r=a(),d.length!==0&&(s=a(yte([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return gA(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const Zst={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||t$(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function aT(e,t,n={}){const r=(s,i,o)=>{const a=Zst[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function bte(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}function Yst(e,t){if($te(e)>t)throw new wit({givenSize:$te(e),maxSize:t})}const Wf={zero:48,nine:57,A:65,F:70,a:97,f:102};function vte(e){if(e>=Wf.zero&&e<=Wf.nine)return e-Wf.zero;if(e>=Wf.A&&e<=Wf.F)return e-(Wf.A-10);if(e>=Wf.a&&e<=Wf.f)return e-(Wf.a-10)}function Jst(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new yit({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o=n==="right";s[o?i:r-i-1]=e[o?i:e.length-i-1]}return s}function T1e(e,t){if(Km(e)>t)throw new ait({givenSize:Km(e),maxSize:t})}function Xst(e,t){if(typeof t=="number"&&t>0&&t>Km(e)-1)throw new k1e({offset:t,position:"start",size:Km(e)})}function Qst(e,t,n){if(typeof t=="number"&&typeof n=="number"&&Km(e)!==n-t)throw new k1e({offset:n,position:"end",size:Km(e)})}function P1e(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new cit({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const eit="#__bigint";function DH(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+eit:s,n)}const tit=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nit(e,t={}){const{strict:n=!1}=t;if(!e)throw new Ete(e);if(typeof e!="string")throw new Ete(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Cte(e);if(!e.startsWith("0x"))throw new Cte(e)}function rit(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function UH(e){return e instanceof Uint8Array?mA(e):Array.isArray(e)?mA(new Uint8Array(e)):e}function mA(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=tit[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(T1e(r,t.size),O1e(r,t.size)):r}function sR(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const l=typeof e=="bigint"?"n":"";throw new oit({max:i?`${i}${l}`:void 0,min:`${o}${l}`,signed:n,size:r,value:`${e}${l}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?sit(c,r):c}function sit(e,t){return P1e(e,{dir:"left",size:t})}function O1e(e,t){return P1e(e,{dir:"right",size:t})}function vp(e,t,n,r={}){const{strict:s}=r;Xst(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Qst(i,t,n),i}function Km(e){return Math.ceil((e.length-2)/2)}function iit(e,t={}){const{strict:n=!1}=t;try{return nit(e,{strict:n}),!0}catch{return!1}}let oit=class extends Cs{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Ete=class extends Cs{constructor(t){super(`Value \`${typeof t=="object"?DH(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},Cte=class extends Cs{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},ait=class extends Cs{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},k1e=class extends Cs{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},cit=class extends Cs{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};const lit=new TextEncoder;function uit(e){if(!(e instanceof Uint8Array)){if(!e)throw new oI(e);if(typeof e!="object")throw new oI(e);if(!("BYTES_PER_ELEMENT"in e))throw new oI(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new oI(e)}}function dit(e){return e instanceof Uint8Array?e:typeof e=="string"?fit(e):hit(e)}function hit(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function fit(e,t={}){const{size:n}=t;let r=e;n&&(T1e(e,n),r=O1e(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const l=vte(s.charCodeAt(c++)),u=vte(s.charCodeAt(c++));if(l===void 0||u===void 0)throw new Cs(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l*16+u}return o}function pit(e,t={}){const{size:n}=t,r=lit.encode(e);return typeof n=="number"?(Yst(r,n),git(r,n)):r}function git(e,t){return Jst(e,{dir:"right",size:t})}function $te(e){return e.length}function mit(e){try{return uit(e),!0}catch{return!1}}class oI extends Cs{constructor(t){super(`Value \`${typeof t=="object"?DH(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}let wit=class extends Cs{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},yit=class extends Cs{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};function R1e(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=U0(dit(e));return n==="Bytes"?r:mA(r)}let bit=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const vit={checksum:new bit(8192)},iR=vit.checksum;function B1e(e,t={}){const{compressed:n}=t,{prefix:r,x:s,y:i}=e;if(n===!1||typeof s=="bigint"&&typeof i=="bigint"){if(r!==4)throw new xte({prefix:r,cause:new Sit});return}if(n===!0||typeof s=="bigint"&&typeof i>"u"){if(r!==3&&r!==2)throw new xte({prefix:r,cause:new Iit});return}throw new xit({publicKey:e})}function Eit(e){const t=(()=>{if(iit(e))return D1e(e);if(mit(e))return Cit(e);const{prefix:n,x:r,y:s}=e;return typeof r=="bigint"&&typeof s=="bigint"?{prefix:n??4,x:r,y:s}:{prefix:n,x:r}})();return B1e(t),t}function Cit(e){return D1e(mA(e))}function D1e(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new Ait({publicKey:e});if(e.length===130){const r=BigInt(vp(e,0,32)),s=BigInt(vp(e,32,64));return{prefix:4,x:r,y:s}}if(e.length===132){const r=Number(vp(e,0,1)),s=BigInt(vp(e,1,33)),i=BigInt(vp(e,33,65));return{prefix:r,x:s,y:i}}const t=Number(vp(e,0,1)),n=BigInt(vp(e,1,33));return{prefix:t,x:n}}function $it(e,t={}){B1e(e);const{prefix:n,x:r,y:s}=e,{includePrefix:i=!0}=t;return rit(i?sR(n,{size:1}):"0x",sR(r,{size:32}),typeof s=="bigint"?sR(s,{size:32}):"0x")}class xit extends Cs{constructor({publicKey:t}){super(`Value \`${DH(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class xte extends Cs{constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class Iit extends Cs{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class Sit extends Cs{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let Ait=class extends Cs{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${Km(UH(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const _it=/^0x[a-fA-F0-9]{40}$/;function U1e(e,t={}){const{strict:n=!0}=t;if(!_it.test(e))throw new Ite({address:e,cause:new Pit});if(n){if(e.toLowerCase()===e)return;if(L1e(e)!==e)throw new Ite({address:e,cause:new Oit})}}function L1e(e){if(iR.has(e))return iR.get(e);U1e(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=R1e(pit(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return iR.set(e,s),s}function Nit(e,t={}){const{checksum:n=!1}=t;return U1e(e),n?L1e(e):e}function Tit(e,t={}){const n=R1e(`0x${$it(e).slice(4)}`).substring(26);return Nit(`0x${n}`,t)}let Ite=class extends Cs{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},Pit=class extends Cs{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},Oit=class extends Cs{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}};const hc=BigInt(0),sa=BigInt(1),mw=BigInt(2),kit=BigInt(3),M1e=BigInt(4),j1e=BigInt(5),F1e=BigInt(8);function Ja(e,t){const n=e%t;return n>=hc?n:t+n}function Ul(e,t,n){let r=e;for(;t-- >hc;)r*=r,r%=n;return r}function UM(e,t){if(e===hc)throw new Error("invert: expected non-zero number");if(t<=hc)throw new Error("invert: expected positive modulus, got "+t);let n=Ja(e,t),r=t,s=hc,i=sa;for(;n!==hc;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==sa)throw new Error("invert: does not exist");return Ja(s,t)}function z1e(e,t){const n=(e.ORDER+sa)/M1e,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function Rit(e,t){const n=(e.ORDER-j1e)/F1e,r=e.mul(t,mw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,mw),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function Bit(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-sa,n=0;for(;t%mw===hc;)t/=mw,n++;let r=mw;const s=LH(e);for(;Ste(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return z1e;let i=s.pow(r,t);const o=(t+sa)/mw;return function(c,l){if(c.is0(l))return l;if(Ste(c,l)!==1)throw new Error("Cannot find square root");let u=n,d=c.mul(c.ONE,i),h=c.pow(l,t),f=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let g=1,p=c.sqr(h);for(;!c.eql(p,c.ONE);)if(g++,p=c.sqr(p),g===u)throw new Error("Cannot find square root");const m=sa<<BigInt(u-g-1),w=c.pow(d,m);u=g,d=c.sqr(w),h=c.mul(h,d),f=c.mul(f,w)}return f}}function Dit(e){return e%M1e===kit?z1e:e%F1e===j1e?Rit:Bit(e)}const Uit=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Lit(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Uit.reduce((r,s)=>(r[s]="function",r),t);return aT(e,n)}function Mit(e,t,n){if(n<hc)throw new Error("invalid exponent, negatives unsupported");if(n===hc)return e.ONE;if(n===sa)return t;let r=e.ONE,s=t;for(;n>hc;)n&sa&&(r=e.mul(r,s)),s=e.sqr(s),n>>=sa;return r}function q1e(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function Ste(e,t){const n=(e.ORDER-sa)/mw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function W1e(e,t){t!==void 0&&Mm(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function LH(e,t,n=!1,r={}){if(e<=hc)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=W1e(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:oT(s),ZERO:hc,ONE:sa,create:c=>Ja(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return hc<=c&&c<e},is0:c=>c===hc,isOdd:c=>(c&sa)===sa,neg:c=>Ja(-c,e),eql:(c,l)=>c===l,sqr:c=>Ja(c*c,e),add:(c,l)=>Ja(c+l,e),sub:(c,l)=>Ja(c-l,e),mul:(c,l)=>Ja(c*l,e),pow:(c,l)=>Mit(a,c,l),div:(c,l)=>Ja(c*UM(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>UM(c,e),sqrt:r.sqrt||(c=>(o||(o=Dit(e)),o(a,c))),toBytes:c=>n?N1e(c,i):n$(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?_1e(c):Pw(c)},invertBatch:c=>q1e(a,c),cmov:(c,l,u)=>u?l:c});return Object.freeze(a)}function H1e(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function V1e(e){const t=H1e(e);return t+Math.ceil(t/2)}function jit(e,t,n=!1){const r=e.length,s=H1e(t),i=V1e(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?_1e(e):Pw(e),a=Ja(o,t-sa)+sa;return n?N1e(a,s):n$(a,s)}const Ate=BigInt(0),LM=BigInt(1);function oR(e,t){const n=t.negate();return e?n:t}function K1e(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function aR(e,t){K1e(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=oT(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function _te(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=LM);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function Fit(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function zit(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const cR=new WeakMap,G1e=new WeakMap;function lR(e){return G1e.get(e)||1}function qit(e,t){return{constTimeNegate:oR,hasPrecomputes(n){return lR(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>Ate;)r&LM&&(s=s.add(i)),i=i.double(),r>>=LM;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=aR(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=aR(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=_te(s,c,a);s=l,d?o=o.add(oR(f,r[g])):i=i.add(oR(h,r[u]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=aR(n,t);for(let a=0;a<o.windows&&s!==Ate;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=_te(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return i},getPrecomputes(n,r,s){let i=cR.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&cR.set(r,s(i))),i},wNAFCached(n,r,s){const i=lR(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=lR(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){K1e(r,t),G1e.set(n,r),cR.delete(n)}}}function Wit(e,t,n,r){Fit(n,e),zit(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=Kst(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=oT(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function Z1e(e){return Lit(e.Fp),aT(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...W1e(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function Nte(e){e.lowS!==void 0&&i4("lowS",e.lowS),e.prehash!==void 0&&i4("prehash",e.prehash)}function Hit(e){const t=Z1e(e);aT(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}let Vit=class extends Error{constructor(t=""){super(t)}};const _p={Err:Vit,_tlv:{encode:(e,t)=>{const{Err:n}=_p;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=iI(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?iI(s.length/2|128):"";return iI(e)+i+s+t},decode(e,t){const{Err:n}=_p;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=_p;if(e<jp)throw new t("integer: negative integers are not allowed");let n=iI(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=_p;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Pw(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=_p,s=iu("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=_p,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function uR(e,t){return o4(n$(e,t))}const jp=BigInt(0),hi=BigInt(1);BigInt(2);const dR=BigInt(3),Kit=BigInt(4);function Git(e){const t=Hit(e),{Fp:n}=t,r=LH(t.n,t.nBitLength),s=t.toBytes||((E,b,S)=>{const v=b.toAffine();return gA(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const b=E.subarray(1),S=n.fromBytes(b.subarray(0,n.BYTES)),v=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:S,y:v}});function o(E){const{a:b,b:S}=t,v=n.sqr(E),x=n.mul(v,E);return n.add(n.add(x,n.mul(E,b)),S)}function a(E,b){const S=n.sqr(b),v=o(E);return n.eql(S,v)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,dR),Kit),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(E){return BH(E,hi,t.n)}function d(E){const{allowedPrivateKeyLengths:b,nByteLength:S,wrapPrivateKey:v,n:x}=t;if(b&&typeof E!="bigint"){if(t$(E)&&(E=o4(E)),typeof E!="string"||!b.includes(E.length))throw new Error("invalid private key");E=E.padStart(S*2,"0")}let A;try{A=typeof E=="bigint"?E:Pw(iu("private key",E,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof E)}return v&&(A=Ja(A,x)),Hv("private key",A,hi,x),A}function h(E){if(!(E instanceof p))throw new Error("ProjectivePoint expected")}const f=bte((E,b)=>{const{px:S,py:v,pz:x}=E;if(n.eql(x,n.ONE))return{x:S,y:v};const A=E.is0();b==null&&(b=A?n.ONE:n.inv(x));const I=n.mul(S,b),O=n.mul(v,b),N=n.mul(x,b);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:I,y:O}}),g=bte(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:b,y:S}=E.toAffine();if(!n.isValid(b)||!n.isValid(S))throw new Error("bad point: x or y not FE");if(!a(b,S))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(b,S,v){if(b==null||!n.isValid(b))throw new Error("x required");if(S==null||!n.isValid(S)||n.is0(S))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=b,this.py=S,this.pz=v,Object.freeze(this)}static fromAffine(b){const{x:S,y:v}=b||{};if(!b||!n.isValid(S)||!n.isValid(v))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const x=A=>n.eql(A,n.ZERO);return x(S)&&x(v)?p.ZERO:new p(S,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const S=q1e(n,b.map(v=>v.pz));return b.map((v,x)=>v.toAffine(S[x])).map(p.fromAffine)}static fromHex(b){const S=p.fromAffine(i(iu("pointHex",b)));return S.assertValidity(),S}static fromPrivateKey(b){return p.BASE.multiply(d(b))}static msm(b,S){return Wit(p,r,b,S)}_setWindowSize(b){C.setWindowSize(this,b)}assertValidity(){g(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b,N=n.eql(n.mul(S,O),n.mul(A,x)),T=n.eql(n.mul(v,O),n.mul(I,x));return N&&T}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:S}=t,v=n.mul(S,dR),{px:x,py:A,pz:I}=this;let O=n.ZERO,N=n.ZERO,T=n.ZERO,P=n.mul(x,x),_=n.mul(A,A),y=n.mul(I,I),$=n.mul(x,A);return $=n.add($,$),T=n.mul(x,I),T=n.add(T,T),O=n.mul(b,T),N=n.mul(v,y),N=n.add(O,N),O=n.sub(_,N),N=n.add(_,N),N=n.mul(O,N),O=n.mul($,O),T=n.mul(v,T),y=n.mul(b,y),$=n.sub(P,y),$=n.mul(b,$),$=n.add($,T),T=n.add(P,P),P=n.add(T,P),P=n.add(P,y),P=n.mul(P,$),N=n.add(N,P),y=n.mul(A,I),y=n.add(y,y),P=n.mul(y,$),O=n.sub(O,P),T=n.mul(y,_),T=n.add(T,T),T=n.add(T,T),new p(O,N,T)}add(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b;let N=n.ZERO,T=n.ZERO,P=n.ZERO;const _=t.a,y=n.mul(t.b,dR);let $=n.mul(S,A),R=n.mul(v,I),B=n.mul(x,O),k=n.add(S,v),D=n.add(A,I);k=n.mul(k,D),D=n.add($,R),k=n.sub(k,D),D=n.add(S,x);let U=n.add(A,O);return D=n.mul(D,U),U=n.add($,B),D=n.sub(D,U),U=n.add(v,x),N=n.add(I,O),U=n.mul(U,N),N=n.add(R,B),U=n.sub(U,N),P=n.mul(_,D),N=n.mul(y,B),P=n.add(N,P),N=n.sub(R,P),P=n.add(R,P),T=n.mul(N,P),R=n.add($,$),R=n.add(R,$),B=n.mul(_,B),D=n.mul(y,D),R=n.add(R,B),B=n.sub($,B),B=n.mul(_,B),D=n.add(D,B),$=n.mul(R,D),T=n.add(T,$),$=n.mul(U,D),N=n.mul(k,N),N=n.sub(N,$),$=n.mul(k,R),P=n.mul(U,P),P=n.add(P,$),new p(N,T,P)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return C.wNAFCached(this,b,p.normalizeZ)}multiplyUnsafe(b){const{endo:S,n:v}=t;Hv("scalar",b,jp,v);const x=p.ZERO;if(b===jp)return x;if(this.is0()||b===hi)return this;if(!S||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,b,p.normalizeZ);let{k1neg:A,k1:I,k2neg:O,k2:N}=S.splitScalar(b),T=x,P=x,_=this;for(;I>jp||N>jp;)I&hi&&(T=T.add(_)),N&hi&&(P=P.add(_)),_=_.double(),I>>=hi,N>>=hi;return A&&(T=T.negate()),O&&(P=P.negate()),P=new p(n.mul(P.px,S.beta),P.py,P.pz),T.add(P)}multiply(b){const{endo:S,n:v}=t;Hv("scalar",b,hi,v);let x,A;if(S){const{k1neg:I,k1:O,k2neg:N,k2:T}=S.splitScalar(b);let{p:P,f:_}=this.wNAF(O),{p:y,f:$}=this.wNAF(T);P=C.constTimeNegate(I,P),y=C.constTimeNegate(N,y),y=new p(n.mul(y.px,S.beta),y.py,y.pz),x=P.add(y),A=_.add($)}else{const{p:I,f:O}=this.wNAF(b);x=I,A=O}return p.normalizeZ([x,A])[0]}multiplyAndAddUnsafe(b,S,v){const x=p.BASE,A=(O,N)=>N===jp||N===hi||!O.equals(x)?O.multiplyUnsafe(N):O.multiply(N),I=A(this,S).add(A(b,v));return I.is0()?void 0:I}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:S}=t;if(b===hi)return!0;if(S)return S(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:S}=t;return b===hi?this:S?S(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return i4("isCompressed",b),this.assertValidity(),s(p,this,b)}toHex(b=!0){return i4("isCompressed",b),o4(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,C=qit(p,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:u}}function Zit(e){const t=Z1e(e);return aT(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Yit(e){const t=Zit(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(y){return Ja(y,r)}function l(y){return UM(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:h,isWithinCurveOrder:f}=Git({...t,toBytes(y,$,R){const B=$.toAffine(),k=n.toBytes(B.x),D=gA;return i4("isCompressed",R),R?D(Uint8Array.from([$.hasEvenY()?2:3]),k):D(Uint8Array.from([4]),k,n.toBytes(B.y))},fromBytes(y){const $=y.length,R=y[0],B=y.subarray(1);if($===o&&(R===2||R===3)){const k=Pw(B);if(!BH(k,hi,n.ORDER))throw new Error("Point is not on curve");const D=h(k);let U;try{U=n.sqrt(D)}catch(q){const H=q instanceof Error?": "+q.message:"";throw new Error("Point is not on curve"+H)}const F=(U&hi)===hi;return(R&1)===1!==F&&(U=n.neg(U)),{x:k,y:U}}else if($===a&&R===4){const k=n.fromBytes(B.subarray(0,n.BYTES)),D=n.fromBytes(B.subarray(n.BYTES,2*n.BYTES));return{x:k,y:D}}else{const k=o,D=a;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+D+", got "+$)}}});function g(y){const $=r>>hi;return y>$}function p(y){return g(y)?c(-y):y}const m=(y,$,R)=>Pw(y.slice($,R));class w{constructor($,R,B){Hv("r",$,hi,r),Hv("s",R,hi,r),this.r=$,this.s=R,B!=null&&(this.recovery=B),Object.freeze(this)}static fromCompact($){const R=s;return $=iu("compactSignature",$,R*2),new w(m($,0,R),m($,R,2*R))}static fromDER($){const{r:R,s:B}=_p.toSig(iu("DER",$));return new w(R,B)}assertValidity(){}addRecoveryBit($){return new w(this.r,this.s,$)}recoverPublicKey($){const{r:R,s:B,recovery:k}=this,D=x(iu("msgHash",$));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const U=k===2||k===3?R+t.n:R;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=(k&1)===0?"02":"03",K=u.fromHex(F+uR(U,n.BYTES)),q=l(U),H=c(-D*q),Z=c(B*q),ee=u.BASE.multiplyAndAddUnsafe(K,H,Z);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return pA(this.toDERHex())}toDERHex(){return _p.hexFromSig(this)}toCompactRawBytes(){return pA(this.toCompactHex())}toCompactHex(){const $=s;return uR(this.r,$)+uR(this.s,$)}}const C={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=V1e(t.n);return jit(t.randomBytes(y),t.n)},precompute(y=8,$=u.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}};function E(y,$=!0){return u.fromPrivateKey(y).toRawBytes($)}function b(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const R=iu("key",y).length,B=n.BYTES,k=B+1,D=2*B+1;if(!(t.allowedPrivateKeyLengths||s===k))return R===k||R===D}function S(y,$,R=!0){if(b(y)===!0)throw new Error("first arg must be private key");if(b($)===!1)throw new Error("second arg must be public key");return u.fromHex($).multiply(d(y)).toRawBytes(R)}const v=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const $=Pw(y),R=y.length*8-i;return R>0?$>>BigInt(R):$},x=t.bits2int_modN||function(y){return c(v(y))},A=oT(i);function I(y){return Hv("num < 2^"+i,y,jp,A),n$(y,s)}function O(y,$,R=N){if(["recovered","canonical"].some(X=>X in R))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:k}=t;let{lowS:D,prehash:U,extraEntropy:F}=R;D==null&&(D=!0),y=iu("msgHash",y),Nte(R),U&&(y=iu("prehashed msgHash",B(y)));const K=x(y),q=d($),H=[I(q),I(K)];if(F!=null&&F!==!1){const X=F===!0?k(n.BYTES):F;H.push(iu("extraEntropy",X))}const Z=gA(...H),ee=K;function ie(X){const le=v(X);if(!f(le))return;const _e=l(le),Ne=u.BASE.multiply(le).toAffine(),be=c(Ne.x);if(be===jp)return;const Me=c(_e*c(ee+be*q));if(Me===jp)return;let Ct=(Ne.x===be?0:2)|Number(Ne.y&hi),Wt=Me;return D&&g(Me)&&(Wt=p(Me),Ct^=1),new w(be,Wt,Ct)}return{seed:Z,k2sig:ie}}const N={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(y,$,R=N){const{seed:B,k2sig:k}=O(y,$,R),D=t;return Gst(D.hash.outputLen,D.nByteLength,D.hmac)(B,k)}u.BASE._setWindowSize(8);function _(y,$,R,B=T){var Ct;const k=y;$=iu("msgHash",$),R=iu("publicKey",R);const{lowS:D,prehash:U,format:F}=B;if(Nte(B),"strict"in B)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw new Error("format must be compact or der");const K=typeof k=="string"||t$(k),q=!K&&!F&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!K&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,Z;try{if(q&&(H=new w(k.r,k.s)),K){try{F!=="compact"&&(H=w.fromDER(k))}catch(Wt){if(!(Wt instanceof _p.Err))throw Wt}!H&&F!=="der"&&(H=w.fromCompact(k))}Z=u.fromHex(R)}catch{return!1}if(!H||D&&H.hasHighS())return!1;U&&($=t.hash($));const{r:ee,s:ie}=H,X=x($),le=l(ie),_e=c(X*le),Ne=c(ee*le),be=(Ct=u.BASE.multiplyAndAddUnsafe(Z,_e,Ne))==null?void 0:Ct.toAffine();return be?c(be.x)===ee:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:S,sign:P,verify:_,ProjectivePoint:u,Signature:w,utils:C}}function Jit(e){return{hash:e,hmac:(t,...n)=>m6(e,t,w6(...n)),randomBytes:g6}}function Xit(e,t){const n=r=>Yit({...e,...Jit(r)});return{...n(t),create:n}}const Y1e=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Tte=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Qit=BigInt(0),eot=BigInt(1),MM=BigInt(2),Pte=(e,t)=>(e+t/MM)/t;function tot(e){const t=Y1e,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Ul(u,n,t)*u%t,h=Ul(d,n,t)*u%t,f=Ul(h,MM,t)*l%t,g=Ul(f,s,t)*f%t,p=Ul(g,i,t)*g%t,m=Ul(p,a,t)*p%t,w=Ul(m,c,t)*m%t,C=Ul(w,a,t)*p%t,E=Ul(C,n,t)*u%t,b=Ul(E,o,t)*g%t,S=Ul(b,r,t)*l%t,v=Ul(S,MM,t);if(!jM.eql(jM.sqr(v),e))throw new Error("Cannot find square root");return v}const jM=LH(Y1e,void 0,void 0,{sqrt:tot}),not=Xit({a:Qit,b:BigInt(7),Fp:jM,n:Tte,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Tte,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-eot*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=Pte(i*e,t),c=Pte(-r*e,t);let l=Ja(e-a*n-c*s,t),u=Ja(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},y6);function rot(e){if(e.length!==130&&e.length!==132)throw new iot({signature:e});const t=BigInt(vp(e,0,32)),n=BigInt(vp(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return sot(s)}catch{throw new oot({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function sot(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new aot({value:e})}let iot=class extends Cs{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Km(UH(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},oot=class extends Cs{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},aot=class extends Cs{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function cot(e){return Tit(lot(e))}function lot(e){const{payload:t,signature:n}=e,{r,s,yParity:i}=n,a=new not.Signature(BigInt(r),BigInt(s)).addRecoveryBit(i).recoverPublicKey(UH(t).substring(2));return Eit(a)}var uot={};const dot=":";function i0(e){const[t,n]=e.split(dot);return{namespace:t,reference:n}}function J1e(e,t){return e.includes(":")?[e]:t.chains||[]}const hot={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},fot={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Fe(e,t){const{message:n,code:r}=fot[e];return{message:t?`${n} ${t}`:n,code:r}}function Jr(e,t){const{message:n,code:r}=hot[e];return{message:t?`${n} ${t}`:n,code:r}}var pot=Object.defineProperty,got=Object.defineProperties,mot=Object.getOwnPropertyDescriptors,Ote=Object.getOwnPropertySymbols,wot=Object.prototype.hasOwnProperty,yot=Object.prototype.propertyIsEnumerable,FM=(e,t,n)=>t in e?pot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kte=(e,t)=>{for(var n in t||(t={}))wot.call(t,n)&&FM(e,n,t[n]);if(Ote)for(var n of Ote(t))yot.call(t,n)&&FM(e,n,t[n]);return e},bot=(e,t)=>got(e,mot(t)),Rte=(e,t,n)=>FM(e,typeof t!="symbol"?t+"":t,n);const vot="ReactNative",al={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Eot="js";function wA(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function p1(){return!cn.getDocument()&&!!cn.getNavigator()&&navigator.product===vot}function Cot(){return p1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="android"}function $ot(){return p1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="ios"}function B6(){return!wA()&&!!cn.getNavigator()&&!!cn.getDocument()}function r$(){return p1()?al.reactNative:wA()?al.node:B6()?al.browser:al.unknown}function Bte(){var e;try{return p1()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Application)<"u"?(e=globalThis.Application)==null?void 0:e.applicationId:void 0}catch{return}}function xot(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(([r],[s])=>r.localeCompare(s)).forEach(([r,s])=>{s!=null&&n.set(r,String(s))}),n.toString()}function Iot(e){var t,n;const r=X1e();try{return e!=null&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),e.url=r.url),(t=e==null?void 0:e.icons)!=null&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(s=>s!=="")),bot(kte(kte({},r),e),{url:(e==null?void 0:e.url)||r.url,name:(e==null?void 0:e.name)||r.name,description:(e==null?void 0:e.description)||r.description,icons:(n=e==null?void 0:e.icons)!=null&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(s){return console.warn("Error populating app metadata",s),e||r}}function X1e(){return gC.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Sot(){if(r$()===al.reactNative&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"){const{OS:n,Version:r}=globalThis.Platform;return[n,r].join("-")}const e=MN();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Aot(){var e;const t=r$();return t===al.browser?[t,((e=cn.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function Q1e(e,t,n){const r=Sot(),s=Aot();return[[e,t].join("-"),[Eot,n].join("-"),r,s].join("/")}function _ot({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:s,projectId:i,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=n.split("?"),u=Q1e(e,t,r),d={auth:s,ua:u,projectId:i,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=xot(l[1]||"",d);return l[0]+"?"+h}function ww(e,t){return e.filter(n=>t.includes(n)).length===e.length}function zM(e){return Object.fromEntries(e.entries())}function qM(e){return new Map(Object.entries(e))}function H1(e=V.FIVE_MINUTES,t){const n=V.toMiliseconds(e||V.FIVE_MINUTES);let r,s,i,o;return{resolve:a=>{i&&r&&(clearTimeout(i),r(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const l=Fe("EXPIRED"),u=new Error(t||l.message);u.code=l.code,c(u)},n),r=a,s=c})}}function Mh(e,t,n){return new Promise(async(r,s)=>{const i=setTimeout(()=>s(new Error(n)),t);try{const o=await e;r(o)}catch(o){s(o)}clearTimeout(i)})}function ewe(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Not(e){return ewe("topic",e)}function Tot(e){return ewe("id",e)}function twe(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function As(e,t){return V.fromMiliseconds(Date.now()+V.toMiliseconds(e))}function Rh(e){return Date.now()>=V.toMiliseconds(e)}function ur(e,t){return`${e}${t?`:${t}`:""}`}function Zh(e=[],t=[]){return[...new Set([...e,...t])]}async function Pot({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const s=typeof n=="string"?JSON.parse(n):n,i=s==null?void 0:s.href;if(typeof i!="string")return;const o=Oot(i,e,t),a=r$();if(a===al.browser){if(!((r=cn.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}kot(o)}else a===al.reactNative&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"&&await globalThis.Linking.openURL(o)}catch(s){console.error(s)}}function Oot(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let s=`${e}`;if(e.startsWith("https://t.me")){const i=e.includes("?")?"&startapp=":"?startapp=";s=`${s}${i}${Uot(r,!0)}`}else s=`${s}/wc?${r}`;return s}function kot(e){let t="_self";Dot()?t="_top":(Bot()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function Rot(e,t){let n="";try{if(B6()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function Dte(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function Ute(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function MH(){return typeof process<"u"&&uot.IS_VITEST==="true"}function Bot(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Dot(){try{return window.self!==window.top}catch{return!1}}function Uot(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function nwe(e){return Buffer.from(e,"base64").toString("utf-8")}function Lot(e){return new Promise(t=>setTimeout(t,e))}let Mot=class{constructor({limit:t}){Rte(this,"limit"),Rte(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}};const aI=BigInt(2**32-1),Lte=BigInt(32);function rwe(e,t=!1){return t?{h:Number(e&aI),l:Number(e>>Lte&aI)}:{h:Number(e>>Lte&aI)|0,l:Number(e&aI)|0}}function swe(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:o,l:a}=rwe(e[i],t);[r[i],s[i]]=[o,a]}return[r,s]}const Mte=(e,t,n)=>e>>>n,jte=(e,t,n)=>e<<32-n|t>>>n,Vg=(e,t,n)=>e>>>n|t<<32-n,Kg=(e,t,n)=>e<<32-n|t>>>n,RE=(e,t,n)=>e<<64-n|t>>>n-32,BE=(e,t,n)=>e>>>n-32|t<<64-n,jot=(e,t)=>t,Fot=(e,t)=>e,zot=(e,t,n)=>e<<n|t>>>32-n,qot=(e,t,n)=>t<<n|e>>>32-n,Wot=(e,t,n)=>t<<n-32|e>>>64-n,Hot=(e,t,n)=>e<<n-32|t>>>64-n;function gd(e,t,n,r){const s=(t>>>0)+(r>>>0);return{h:e+n+(s/2**32|0)|0,l:s|0}}const jH=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),FH=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Vot=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),Kot=(e,t,n,r,s)=>t+n+r+s+(e/2**32|0)|0,Got=(e,t,n,r,s)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(s>>>0),Zot=(e,t,n,r,s,i)=>t+n+r+s+i+(e/2**32|0)|0,h2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function cT(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function E0(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function jd(e,...t){if(!cT(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function lT(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");E0(e.outputLen),E0(e.blockLen)}function Gm(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function zH(e,t){jd(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function a4(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function xu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function hR(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function wh(e,t){return e<<32-t|e>>>t}const iwe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function owe(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const fp=iwe?e=>e:e=>owe(e);function Yot(e){for(let t=0;t<e.length;t++)e[t]=owe(e[t]);return e}const Gg=iwe?e=>e:Yot,awe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Jot=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Vv(e){if(jd(e),awe)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Jot[e[n]];return t}const Hf={_0:48,_9:57,A:65,F:70,a:97,f:102};function Fte(e){if(e>=Hf._0&&e<=Hf._9)return e-Hf._0;if(e>=Hf.A&&e<=Hf.F)return e-(Hf.A-10);if(e>=Hf.a&&e<=Hf.f)return e-(Hf.a-10)}function yA(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(awe)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Fte(e.charCodeAt(i)),a=Fte(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function cwe(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Td(e){return typeof e=="string"&&(e=cwe(e)),jd(e),e}function nm(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];jd(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}let uT=class{};function s$(e){const t=r=>e().update(Td(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Xot(e){const t=(r,s)=>e(s).update(Td(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function gb(e=32){if(h2&&typeof h2.getRandomValues=="function")return h2.getRandomValues(new Uint8Array(e));if(h2&&typeof h2.randomBytes=="function")return Uint8Array.from(h2.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Qot=BigInt(0),K3=BigInt(1),eat=BigInt(2),tat=BigInt(7),nat=BigInt(256),rat=BigInt(113),lwe=[],uwe=[],dwe=[];for(let e=0,t=K3,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],lwe.push(2*(5*r+n)),uwe.push((e+1)*(e+2)/2%64);let s=Qot;for(let i=0;i<7;i++)t=(t<<K3^(t>>tat)*rat)%nat,t&eat&&(s^=K3<<(K3<<BigInt(i))-K3);dwe.push(s)}const hwe=swe(dwe,!0),sat=hwe[0],iat=hwe[1],zte=(e,t,n)=>n>32?Wot(e,t,n):zot(e,t,n),qte=(e,t,n)=>n>32?Hot(e,t,n):qot(e,t,n);function oat(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=zte(l,u,1)^n[a],h=qte(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=uwe[o],c=zte(s,i,a),l=qte(s,i,a),u=lwe[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=sat[r],e[1]^=iat[r]}xu(n)}let aat=class fwe extends uT{constructor(t,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,E0(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=a4(this.state)}clone(){return this._cloneInto()}keccak(){Gg(this.state32),oat(this.state32,this.rounds),Gg(this.state32),this.posOut=0,this.pos=0}update(t){Gm(this),t=Td(t),jd(t);const{blockLen:n,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Gm(this,!1),jd(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return E0(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(zH(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,xu(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new fwe(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}};const cat=(e,t,n)=>s$(()=>new aat(t,e,n)),lat=cat(1,136,256/8);function uat(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}function dat(e,t,n){return e&t^~e&n}function hat(e,t,n){return e&t^e&n^t&n}let pwe=class extends uT{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=hR(this.buffer)}update(t){Gm(this),t=Td(t),jd(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=hR(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Gm(this),zH(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,xu(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;uat(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=hR(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=i,t.length=s,t.pos=a,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const gg=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),wo=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),yo=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),fat=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),mg=new Uint32Array(64);let pat=class extends pwe{constructor(t=32){super(64,t,8,!1),this.A=gg[0]|0,this.B=gg[1]|0,this.C=gg[2]|0,this.D=gg[3]|0,this.E=gg[4]|0,this.F=gg[5]|0,this.G=gg[6]|0,this.H=gg[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)mg[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=mg[d-15],f=mg[d-2],g=wh(h,7)^wh(h,18)^h>>>3,p=wh(f,17)^wh(f,19)^f>>>10;mg[d]=p+mg[d-7]+g+mg[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=wh(a,6)^wh(a,11)^wh(a,25),f=u+h+dat(a,c,l)+fat[d]+mg[d]|0,g=(wh(r,2)^wh(r,13)^wh(r,22))+hat(r,s,i)|0;u=l,l=c,c=a,a=o+f|0,o=i,i=s,s=r,r=f+g|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,c,l,u)}roundClean(){xu(mg)}destroy(){this.set(0,0,0,0,0,0,0,0),xu(this.buffer)}};const gwe=swe(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
695771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),gat=gwe[0],mat=gwe[1],wg=new Uint32Array(80),yg=new Uint32Array(80);let qH=class extends pwe{constructor(t=64){super(128,t,16,!1),this.Ah=yo[0]|0,this.Al=yo[1]|0,this.Bh=yo[2]|0,this.Bl=yo[3]|0,this.Ch=yo[4]|0,this.Cl=yo[5]|0,this.Dh=yo[6]|0,this.Dl=yo[7]|0,this.Eh=yo[8]|0,this.El=yo[9]|0,this.Fh=yo[10]|0,this.Fl=yo[11]|0,this.Gh=yo[12]|0,this.Gl=yo[13]|0,this.Hh=yo[14]|0,this.Hl=yo[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:p,Hl:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=f|0,this.Gl=g|0,this.Hh=p|0,this.Hl=m|0}process(t,n){for(let E=0;E<16;E++,n+=4)wg[E]=t.getUint32(n),yg[E]=t.getUint32(n+=4);for(let E=16;E<80;E++){const b=wg[E-15]|0,S=yg[E-15]|0,v=Vg(b,S,1)^Vg(b,S,8)^Mte(b,S,7),x=Kg(b,S,1)^Kg(b,S,8)^jte(b,S,7),A=wg[E-2]|0,I=yg[E-2]|0,O=Vg(A,I,19)^RE(A,I,61)^Mte(A,I,6),N=Kg(A,I,19)^BE(A,I,61)^jte(A,I,6),T=Vot(x,N,yg[E-7],yg[E-16]),P=Kot(T,v,O,wg[E-7],wg[E-16]);wg[E]=P|0,yg[E]=T|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:p,Gl:m,Hh:w,Hl:C}=this;for(let E=0;E<80;E++){const b=Vg(d,h,14)^Vg(d,h,18)^RE(d,h,41),S=Kg(d,h,14)^Kg(d,h,18)^BE(d,h,41),v=d&f^~d&p,x=h&g^~h&m,A=Got(C,S,x,mat[E],yg[E]),I=Zot(A,w,b,v,gat[E],wg[E]),O=A|0,N=Vg(r,s,28)^RE(r,s,34)^RE(r,s,39),T=Kg(r,s,28)^BE(r,s,34)^BE(r,s,39),P=r&i^r&a^i&a,_=s&o^s&c^o&c;w=p|0,C=m|0,p=f|0,m=g|0,f=d|0,g=h|0,{h:d,l:h}=gd(l|0,u|0,I|0,O|0),l=a|0,u=c|0,a=i|0,c=o|0,i=r|0,o=s|0;const y=jH(O,T,_);r=FH(y,I,N,P),s=y|0}({h:r,l:s}=gd(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=gd(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l:c}=gd(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=gd(this.Dh|0,this.Dl|0,l|0,u|0),{h:d,l:h}=gd(this.Eh|0,this.El|0,d|0,h|0),{h:f,l:g}=gd(this.Fh|0,this.Fl|0,f|0,g|0),{h:p,l:m}=gd(this.Gh|0,this.Gl|0,p|0,m|0),{h:w,l:C}=gd(this.Hh|0,this.Hl|0,w|0,C|0),this.set(r,s,i,o,a,c,l,u,d,h,f,g,p,m,w,C)}roundClean(){xu(wg,yg)}destroy(){xu(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},wat=class extends qH{constructor(){super(48),this.Ah=wo[0]|0,this.Al=wo[1]|0,this.Bh=wo[2]|0,this.Bl=wo[3]|0,this.Ch=wo[4]|0,this.Cl=wo[5]|0,this.Dh=wo[6]|0,this.Dl=wo[7]|0,this.Eh=wo[8]|0,this.El=wo[9]|0,this.Fh=wo[10]|0,this.Fl=wo[11]|0,this.Gh=wo[12]|0,this.Gl=wo[13]|0,this.Hh=wo[14]|0,this.Hl=wo[15]|0}};const bo=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);let yat=class extends qH{constructor(){super(32),this.Ah=bo[0]|0,this.Al=bo[1]|0,this.Bh=bo[2]|0,this.Bl=bo[3]|0,this.Ch=bo[4]|0,this.Cl=bo[5]|0,this.Dh=bo[6]|0,this.Dl=bo[7]|0,this.Eh=bo[8]|0,this.El=bo[9]|0,this.Fh=bo[10]|0,this.Fl=bo[11]|0,this.Gh=bo[12]|0,this.Gl=bo[13]|0,this.Hh=bo[14]|0,this.Hl=bo[15]|0}};const dT=s$(()=>new pat),bat=s$(()=>new qH),vat=s$(()=>new wat),Eat=s$(()=>new yat),Cat=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),qs=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),rt=new Uint32Array(32);function bg(e,t,n,r,s,i){const o=s[i],a=s[i+1];
vendor: 62,950 bytes, lines 69-72
69let c=rt[2*e],l=rt[2*e+1],u=rt[2*t],d=rt[2*t+1],h=rt[2*n],f=rt[2*n+1],g=rt[2*r],p=rt[2*r+1],m=jH(c,u,o);l=FH(m,l,d,a),c=m|0,{Dh:p,Dl:g}={Dh:p^l,Dl:g^c},{Dh:p,Dl:g}={Dh:jot(p,g),Dl:Fot(p)},{h:f,l:h}=gd(f,h,p,g),{Bh:d,Bl:u}={Bh:d^f,Bl:u^h},{Bh:d,Bl:u}={Bh:Vg(d,u,24),Bl:Kg(d,u,24)},rt[2*e]=c,rt[2*e+1]=l,rt[2*t]=u,rt[2*t+1]=d,rt[2*n]=h,rt[2*n+1]=f,rt[2*r]=g,rt[2*r+1]=p}function vg(e,t,n,r,s,i){const o=s[i],a=s[i+1];let c=rt[2*e],l=rt[2*e+1],u=rt[2*t],d=rt[2*t+1],h=rt[2*n],f=rt[2*n+1],g=rt[2*r],p=rt[2*r+1],m=jH(c,u,o);l=FH(m,l,d,a),c=m|0,{Dh:p,Dl:g}={Dh:p^l,Dl:g^c},{Dh:p,Dl:g}={Dh:Vg(p,g,16),Dl:Kg(p,g,16)},{h:f,l:h}=gd(f,h,p,g),{Bh:d,Bl:u}={Bh:d^f,Bl:u^h},{Bh:d,Bl:u}={Bh:RE(d,u,63),Bl:BE(d,u,63)},rt[2*e]=c,rt[2*e+1]=l,rt[2*t]=u,rt[2*t+1]=d,rt[2*n]=h,rt[2*n+1]=f,rt[2*r]=g,rt[2*r+1]=p}function $at(e,t={},n,r,s){if(E0(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:i,salt:o,personalization:a}=t;if(i!==void 0&&(i.length<1||i.length>n))throw new Error("key length must be undefined or 1.."+n);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(a!==void 0&&a.length!==s)throw new Error("personalization must be undefined or "+s)}let xat=class extends uT{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,E0(t),E0(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=a4(this.buffer)}update(t){Gm(this),t=Td(t),jd(t);const{blockLen:n,buffer:r,buffer32:s}=this,i=t.length,o=t.byteOffset,a=t.buffer;for(let c=0;c<i;){this.pos===n&&(Gg(s),this.compress(s,0,!1),Gg(s),this.pos=0);const l=Math.min(n-this.pos,i-c),u=o+c;if(l===n&&!(u%4)&&c+l<i){const d=new Uint32Array(a,u,Math.floor((i-c)/4));Gg(d);for(let h=0;c+n<i;h+=s.length,c+=n)this.length+=n,this.compress(d,h,!1);Gg(d);continue}r.set(t.subarray(c,c+l),this.pos),this.pos+=l,this.length+=l,c+=l}return this}digestInto(t){Gm(this),zH(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,xu(this.buffer.subarray(n)),Gg(r),this.compress(r,0,!0),Gg(r);const s=a4(t);this.get().forEach((i,o)=>s[o]=fp(i))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:s,destroyed:i,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(n),t.destroyed=i,t.finished=s,t.length=r,t.pos=a,t.outputLen=o,t}clone(){return this._cloneInto()}},Iat=class extends xat{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=qs[0]|0,this.v0h=qs[1]|0,this.v1l=qs[2]|0,this.v1h=qs[3]|0,this.v2l=qs[4]|0,this.v2h=qs[5]|0,this.v3l=qs[6]|0,this.v3h=qs[7]|0,this.v4l=qs[8]|0,this.v4h=qs[9]|0,this.v5l=qs[10]|0,this.v5h=qs[11]|0,this.v6l=qs[12]|0,this.v6h=qs[13]|0,this.v7l=qs[14]|0,this.v7h=qs[15]|0,$at(n,t,64,16,16);let{key:r,personalization:s,salt:i}=t,o=0;if(r!==void 0&&(r=Td(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,i!==void 0){i=Td(i);const a=a4(i);this.v4l^=fp(a[0]),this.v4h^=fp(a[1]),this.v5l^=fp(a[2]),this.v5h^=fp(a[3])}if(s!==void 0){s=Td(s);const a=a4(s);this.v6l^=fp(a[0]),this.v6h^=fp(a[1]),this.v7l^=fp(a[2]),this.v7h^=fp(a[3])}if(r!==void 0){const a=new Uint8Array(this.blockLen);a.set(r),this.update(a)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:s,v2l:i,v2h:o,v3l:a,v3h:c,v4l:l,v4h:u,v5l:d,v5h:h,v6l:f,v6h:g,v7l:p,v7h:m}=this;return[t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m]}set(t,n,r,s,i,o,a,c,l,u,d,h,f,g,p,m){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=s|0,this.v2l=i|0,this.v2h=o|0,this.v3l=a|0,this.v3h=c|0,this.v4l=l|0,this.v4h=u|0,this.v5l=d|0,this.v5h=h|0,this.v6l=f|0,this.v6h=g|0,this.v7l=p|0,this.v7h=m|0}compress(t,n,r){this.get().forEach((c,l)=>rt[l]=c),rt.set(qs,16);let{h:s,l:i}=rwe(BigInt(this.length));rt[24]=qs[8]^i,rt[25]=qs[9]^s,r&&(rt[28]=~rt[28],rt[29]=~rt[29]);let o=0;const a=Cat;for(let c=0;c<12;c++)bg(0,4,8,12,t,n+2*a[o++]),vg(0,4,8,12,t,n+2*a[o++]),bg(1,5,9,13,t,n+2*a[o++]),vg(1,5,9,13,t,n+2*a[o++]),bg(2,6,10,14,t,n+2*a[o++]),vg(2,6,10,14,t,n+2*a[o++]),bg(3,7,11,15,t,n+2*a[o++]),vg(3,7,11,15,t,n+2*a[o++]),bg(0,5,10,15,t,n+2*a[o++]),vg(0,5,10,15,t,n+2*a[o++]),bg(1,6,11,12,t,n+2*a[o++]),vg(1,6,11,12,t,n+2*a[o++]),bg(2,7,8,13,t,n+2*a[o++]),vg(2,7,8,13,t,n+2*a[o++]),bg(3,4,9,14,t,n+2*a[o++]),vg(3,4,9,14,t,n+2*a[o++]);this.v0l^=rt[0]^rt[16],this.v0h^=rt[1]^rt[17],this.v1l^=rt[2]^rt[18],this.v1h^=rt[3]^rt[19],this.v2l^=rt[4]^rt[20],this.v2h^=rt[5]^rt[21],this.v3l^=rt[6]^rt[22],this.v3h^=rt[7]^rt[23],this.v4l^=rt[8]^rt[24],this.v4h^=rt[9]^rt[25],this.v5l^=rt[10]^rt[26],this.v5h^=rt[11]^rt[27],this.v6l^=rt[12]^rt[28],this.v6h^=rt[13]^rt[29],this.v7l^=rt[14]^rt[30],this.v7h^=rt[15]^rt[31],xu(rt)}destroy(){this.destroyed=!0,xu(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const Sat=Xot(e=>new Iat(e)),Aat="https://rpc.walletconnect.org/v1";function mwe(e){const t=`�Ethereum Signed Message: 70${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(lat(n)).toString("hex")}async function _at(e,t,n,r,s,i){switch(n.t){case"eip191":return await Nat(e,t,n.s);case"eip1271":return await Tat(e,t,n.s,r,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function Nat(e,t,n){const r=rot(n);return cot({payload:mwe(t),signature:r}).toLowerCase()===e.toLowerCase()}async function Tat(e,t,n,r,s,i){const o=i0(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l=n.substring(2),u=(l.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:mwe(t)).substring(2),h=a+d+c+u+l,f=await fetch(`${i||Aat}/?chainId=${r}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Pat(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:h},"latest"]})}),{result:g}=await f.json();return g?g.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Pat(){return Date.now()+Math.floor(Math.random()*1e3)}function Oat(e){const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);const r=n[0];if(r===0)throw new Error("No signatures found");const s=1+r*64;if(n.length<s)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const i=Buffer.from(e,"base64").slice(1,65);return wf.encode(i)}function kat(e){const t=new Uint8Array(Buffer.from(e,"base64")),n=Array.from("TransactionData::").map(i=>i.charCodeAt(0)),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const s=Sat(r,{dkLen:32});return wf.encode(s)}function Wte(e){const t=new Uint8Array(dT(Rat(e)));return wf.encode(t)}function Rat(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="object"&&e!=null&&e.data)return new Uint8Array(Object.values(e.data));if(typeof e=="object"&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function Hte(e){const t=Buffer.from(e,"base64"),n=pfe(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=hfe(n),s=Buffer.from("TX"),i=Buffer.concat([s,Buffer.from(r)]),o=Eat(i);return wq.encode(o).replace(/=+$/,"")}function fR(e){const t=[];let n=BigInt(e);for(;n>=BigInt(128);)t.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return t.push(Number(n)),Buffer.from(t)}function Bat(e){const t=Buffer.from(e.signed.bodyBytes,"base64"),n=Buffer.from(e.signed.authInfoBytes,"base64"),r=Buffer.from(e.signature.signature,"base64"),s=[];s.push(Buffer.from([10])),s.push(fR(t.length)),s.push(t),s.push(Buffer.from([18])),s.push(fR(n.length)),s.push(n),s.push(Buffer.from([26])),s.push(fR(r.length)),s.push(r);const i=Buffer.concat(s),o=dT(i);return Buffer.from(o).toString("hex").toUpperCase()}function Dat(e){var t,n;const r=[];try{if(typeof e=="string")return r.push(e),r;if(typeof e!="object")return r;e!=null&&e.id&&r.push(e.id);const s=(n=(t=e==null?void 0:e.capabilities)==null?void 0:t.caip345)==null?void 0:n.transactionHashes;s&&r.push(...s)}catch(s){console.warn("getWalletSendCallsHashes failed: ",s)}return r}var Uat=Object.defineProperty,Lat=Object.defineProperties,Mat=Object.getOwnPropertyDescriptors,Vte=Object.getOwnPropertySymbols,jat=Object.prototype.hasOwnProperty,Fat=Object.prototype.propertyIsEnumerable,Kte=(e,t,n)=>t in e?Uat(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zat=(e,t)=>{for(var n in t||(t={}))jat.call(t,n)&&Kte(e,n,t[n]);if(Vte)for(var n of Vte(t))Fat.call(t,n)&&Kte(e,n,t[n]);return e},qat=(e,t)=>Lat(e,Mat(t));const wwe="did:pkh:",Wat={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},Hat=e=>e?Wat[e]||e:"",hT=e=>e==null?void 0:e.split(":"),Vat=e=>{const t=e&&hT(e);if(t)return e.includes(wwe)?t[3]:t[1]},Kat=e=>{const t=e&&hT(e);if(t)return e.includes(wwe)?t[2]:t[0]},WM=e=>{const t=e&&hT(e);if(t)return t[2]+":"+t[3]},bA=e=>{const t=e&&hT(e);if(t)return t.pop()};async function Gte(e){const{cacao:t,projectId:n}=e,{s:r,p:s}=t,i=ywe(s,s.iss),o=bA(s.iss);return await _at(o,i,r,WM(s.iss),n)}const ywe=(e,t)=>{const n=Kat(t);if(!n)throw new Error("Invalid issuer: "+t);const r=`${e.domain} wants you to sign in with your ${Hat(n)} account:`,s=bA(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0;const o=`URI: ${e.aud||e.uri}`,a=`Version: ${e.version}`,c=`Chain ID: ${Vat(t)}`,l=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,d=e.exp?`Expiration Time: ${e.exp}`:void 0,h=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(m=>` 71- ${m}`).join("")}`:void 0,p=AS(e.resources);if(p){const m=c4(p);i=nct(i,m)}return[r,s,"",i,"",o,a,c,l,u,d,h,f,g].filter(m=>m!=null).join(` 72`)};function Gat(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function Zat(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function ry(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(s=>{const i=r[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);i.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function Yat(e,t,n,r={}){return n==null||n.sort((s,i)=>s.localeCompare(i)),{att:{[e]:Jat(t,n,r)}}}function Jat(e,t,n={}){t=t==null?void 0:t.sort((s,i)=>s.localeCompare(i));const r=t.map(s=>({[`${e}/${s}`]:[n]}));return Object.assign({},...r)}function bwe(e){return ry(e),`urn:recap:${Gat(e).replace(/=/g,"")}`}function c4(e){const t=Zat(e.replace("urn:recap:",""));return ry(t),t}function Xat(e,t,n){const r=Yat(e,t,n);return bwe(r)}function Qat(e){return e&&e.includes("urn:recap:")}function ect(e,t){const n=c4(e),r=c4(t),s=tct(n,r);return bwe(s)}function tct(e,t){ry(e),ry(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((s,i)=>s.localeCompare(i)),r={att:{}};return n.forEach(s=>{var i,o;Object.keys(((i=e.att)==null?void 0:i[s])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;r.att[s]=qat(zat({},r.att[s]),{[a]:((c=e.att[s])==null?void 0:c[a])||((l=t.att[s])==null?void 0:l[a])})})}),r}function nct(e="",t){ry(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let s=0;Object.keys(t.att).forEach(a=>{const c=Object.keys(t.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));c.sort((d,h)=>d.action.localeCompare(h.action));const l={};c.forEach(d=>{l[d.ability]||(l[d.ability]=[]),l[d.ability].push(d.action)});const u=Object.keys(l).map(d=>(s++,`(${s}) '${d}': '${l[d].join("', '")}' for '${a}'.`));r.push(u.join(", ").replace(".,","."))});const i=r.join(" "),o=`${n}${i}`;return`${e?e+" ":""}${o}`}function Zte(e){var t;const n=c4(e);ry(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(s=>s.split("/")[1]):[]}function Yte(e){const t=c4(e);ry(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(s=>{var i;(i=s==null?void 0:s[0])!=null&&i.chains&&n.push(s[0].chains)})}),[...new Set(n.flat())]}function AS(e){if(!e)return;const t=e==null?void 0:e[e.length-1];return Qat(t)?t:void 0}function vwe(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function HM(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function pR(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xa(e,...t){if(!vwe(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Jte(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function rct(e,t){Xa(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function $m(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function p5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function sct(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const ict=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oct(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function VM(e){if(typeof e=="string")e=oct(e);else if(vwe(e))e=KM(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function act(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function cct(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const lct=(e,t)=>{function n(r,...s){if(Xa(r),!ict)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?Xa(l):Xa(l,e.nonceLength)}const i=e.tagLength;i&&s[1]!==void 0&&Xa(s[1]);const o=t(r,...s),a=(l,u)=>{if(u!==void 0){if(l!==2)throw new Error("cipher output not supported");Xa(u)}};let c=!1;return{encrypt(l,u){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Xa(l),a(o.encrypt.length,u),o.encrypt(l,u)},decrypt(l,u){if(Xa(l),i&&l.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,u),o.decrypt(l,u)}}}return Object.assign(n,e),n};function Xte(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!dct(t))throw new Error("invalid output, must be aligned");return t}function Qte(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i);e.setUint32(t+4,o,r),e.setUint32(t+0,a,r)}function uct(e,t,n){HM(n);const r=new Uint8Array(16),s=sct(r);return Qte(s,0,BigInt(t),n),Qte(s,8,BigInt(e),n),r}function dct(e){return e.byteOffset%4===0}function KM(e){return Uint8Array.from(e)}const Ewe=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),hct=Ewe("expand 16-byte k"),fct=Ewe("expand 32-byte k"),pct=$m(hct),gct=$m(fct);function qn(e,t){return e<<t|e>>>32-t}function GM(e){return e.byteOffset%4===0}const cI=64,mct=16,Cwe=2**32-1,ene=new Uint32Array;function wct(e,t,n,r,s,i,o,a){const c=s.length,l=new Uint8Array(cI),u=$m(l),d=GM(s)&&GM(i),h=d?$m(s):ene,f=d?$m(i):ene;for(let g=0;g<c;o++){if(e(t,n,r,u,o,a),o>=Cwe)throw new Error("arx: counter overflow");const p=Math.min(cI,c-g);if(d&&p===cI){const m=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let w=0,C;w<mct;w++)C=m+w,f[C]=h[C]^u[w];g+=cI;continue}for(let m=0,w;m<p;m++)w=g+m,i[w]=s[w]^l[m];g+=p}}function yct(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:s,counterRight:i,rounds:o}=act({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return pR(s),pR(o),HM(i),HM(n),(a,c,l,u,d=0)=>{Xa(a),Xa(c),Xa(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),Xa(u),pR(d),d<0||d>=Cwe)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g=a.length,p,m;if(g===32)f.push(p=KM(a)),m=gct;else if(g===16&&n)p=new Uint8Array(32),p.set(a),p.set(a,16),m=pct,f.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${g}`);GM(c)||f.push(c=KM(c));const w=$m(p);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,w,$m(c.subarray(0,16)),w),c=c.subarray(16)}const C=16-s;if(C!==c.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const b=new Uint8Array(12);b.set(c,i?0:12-c.length),c=b,f.push(c)}const E=$m(c);return wct(e,m,w,E,l,u,d,o),p5(...f),u}}const Li=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class bct{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=VM(t),Xa(t,32);const n=Li(t,0),r=Li(t,2),s=Li(t,4),i=Li(t,6),o=Li(t,8),a=Li(t,10),c=Li(t,12),l=Li(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Li(t,16+2*u)}process(t,n,r=!1){const s=r?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],l=o[2],u=o[3],d=o[4],h=o[5],f=o[6],g=o[7],p=o[8],m=o[9],w=Li(t,n+0),C=Li(t,n+2),E=Li(t,n+4),b=Li(t,n+6),S=Li(t,n+8),v=Li(t,n+10),x=Li(t,n+12),A=Li(t,n+14);let I=i[0]+(w&8191),O=i[1]+((w>>>13|C<<3)&8191),N=i[2]+((C>>>10|E<<6)&8191),T=i[3]+((E>>>7|b<<9)&8191),P=i[4]+((b>>>4|S<<12)&8191),_=i[5]+(S>>>1&8191),y=i[6]+((S>>>14|v<<2)&8191),$=i[7]+((v>>>11|x<<5)&8191),R=i[8]+((x>>>8|A<<8)&8191),B=i[9]+(A>>>5|s),k=0,D=k+I*a+O*(5*m)+N*(5*p)+T*(5*g)+P*(5*f);k=D>>>13,D&=8191,D+=_*(5*h)+y*(5*d)+$*(5*u)+R*(5*l)+B*(5*c),k+=D>>>13,D&=8191;let U=k+I*c+O*a+N*(5*m)+T*(5*p)+P*(5*g);k=U>>>13,U&=8191,U+=_*(5*f)+y*(5*h)+$*(5*d)+R*(5*u)+B*(5*l),k+=U>>>13,U&=8191;let F=k+I*l+O*c+N*a+T*(5*m)+P*(5*p);k=F>>>13,F&=8191,F+=_*(5*g)+y*(5*f)+$*(5*h)+R*(5*d)+B*(5*u),k+=F>>>13,F&=8191;let K=k+I*u+O*l+N*c+T*a+P*(5*m);k=K>>>13,K&=8191,K+=_*(5*p)+y*(5*g)+$*(5*f)+R*(5*h)+B*(5*d),k+=K>>>13,K&=8191;let q=k+I*d+O*u+N*l+T*c+P*a;k=q>>>13,q&=8191,q+=_*(5*m)+y*(5*p)+$*(5*g)+R*(5*f)+B*(5*h),k+=q>>>13,q&=8191;let H=k+I*h+O*d+N*u+T*l+P*c;k=H>>>13,H&=8191,H+=_*a+y*(5*m)+$*(5*p)+R*(5*g)+B*(5*f),k+=H>>>13,H&=8191;let Z=k+I*f+O*h+N*d+T*u+P*l;k=Z>>>13,Z&=8191,Z+=_*c+y*a+$*(5*m)+R*(5*p)+B*(5*g),k+=Z>>>13,Z&=8191;let ee=k+I*g+O*f+N*h+T*d+P*u;k=ee>>>13,ee&=8191,ee+=_*l+y*c+$*a+R*(5*m)+B*(5*p),k+=ee>>>13,ee&=8191;let ie=k+I*p+O*g+N*f+T*h+P*d;k=ie>>>13,ie&=8191,ie+=_*u+y*l+$*c+R*a+B*(5*m),k+=ie>>>13,ie&=8191;let X=k+I*m+O*p+N*g+T*f+P*h;k=X>>>13,X&=8191,X+=_*d+y*u+$*l+R*c+B*a,k+=X>>>13,X&=8191,k=(k<<2)+k|0,k=k+D|0,D=k&8191,k=k>>>13,U+=k,i[0]=D,i[1]=U,i[2]=F,i[3]=K,i[4]=q,i[5]=H,i[6]=Z,i[7]=ee,i[8]=ie,i[9]=X}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let s=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=s,s=t[a]>>>13,t[a]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,r[0]=t[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+n[0];t[0]=o&65535;for(let a=1;a<8;a++)o=(t[a]+n[a]|0)+(o>>>16)|0,t[a]=o&65535;p5(r)}update(t){Jte(this),t=VM(t),Xa(t);const{buffer:n,blockLen:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o===r){for(;r<=s-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){p5(this.h,this.r,this.buffer,this.pad)}digestInto(t){Jte(this),rct(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)t[i++]=r[o]>>>0,t[i++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function vct(e){const t=(r,s)=>e(s).update(VM(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Ect=vct(e=>new bct(e));function Cct(e,t,n,r,s,i=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],d=t[1],h=t[2],f=t[3],g=t[4],p=t[5],m=t[6],w=t[7],C=s,E=n[0],b=n[1],S=n[2],v=o,x=a,A=c,I=l,O=u,N=d,T=h,P=f,_=g,y=p,$=m,R=w,B=C,k=E,D=b,U=S;for(let K=0;K<i;K+=2)v=v+O|0,B=qn(B^v,16),_=_+B|0,O=qn(O^_,12),v=v+O|0,B=qn(B^v,8),_=_+B|0,O=qn(O^_,7),x=x+N|0,k=qn(k^x,16),y=y+k|0,N=qn(N^y,12),x=x+N|0,k=qn(k^x,8),y=y+k|0,N=qn(N^y,7),A=A+T|0,D=qn(D^A,16),$=$+D|0,T=qn(T^$,12),A=A+T|0,D=qn(D^A,8),$=$+D|0,T=qn(T^$,7),I=I+P|0,U=qn(U^I,16),R=R+U|0,P=qn(P^R,12),I=I+P|0,U=qn(U^I,8),R=R+U|0,P=qn(P^R,7),v=v+N|0,U=qn(U^v,16),$=$+U|0,N=qn(N^$,12),v=v+N|0,U=qn(U^v,8),$=$+U|0,N=qn(N^$,7),x=x+T|0,B=qn(B^x,16),R=R+B|0,T=qn(T^R,12),x=x+T|0,B=qn(B^x,8),R=R+B|0,T=qn(T^R,7),A=A+P|0,k=qn(k^A,16),_=_+k|0,P=qn(P^_,12),A=A+P|0,k=qn(k^A,8),_=_+k|0,P=qn(P^_,7),I=I+O|0,D=qn(D^I,16),y=y+D|0,O=qn(O^y,12),I=I+O|0,D=qn(D^I,8),y=y+D|0,O=qn(O^y,7);let F=0;r[F++]=o+v|0,r[F++]=a+x|0,r[F++]=c+A|0,r[F++]=l+I|0,r[F++]=u+O|0,r[F++]=d+N|0,r[F++]=h+T|0,r[F++]=f+P|0,r[F++]=g+_|0,r[F++]=p+y|0,r[F++]=m+$|0,r[F++]=w+R|0,r[F++]=C+B|0,r[F++]=E+k|0,r[F++]=b+D|0,r[F++]=S+U|0}const $ct=yct(Cct,{counterRight:!1,counterLength:4,allowShortKeys:!1}),xct=new Uint8Array(16),tne=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(xct.subarray(n))},Ict=new Uint8Array(32);function nne(e,t,n,r,s){const i=e(t,n,Ict),o=Ect.create(i);s&&tne(o,s),tne(o,r);const a=uct(r.length,s?s.length:0,!0);o.update(a);const c=o.digest();return p5(i,a),c}const Sct=e=>(t,n,r)=>({encrypt(s,i){const o=s.length;i=Xte(o+16,i,!1),i.set(s);const a=i.subarray(0,-16);e(t,n,a,a,1);const c=nne(e,t,n,a,r);return i.set(c,o),p5(c),i},decrypt(s,i){i=Xte(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=nne(e,t,n,o,r);if(!cct(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),p5(c),i}}),$we=lct({blockSize:64,nonceLength:12,tagLength:16},Sct($ct));let xwe=class extends uT{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,lT(t);const r=Td(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),xu(i)}update(t){return Gm(this),this.iHash.update(t),this}digestInto(t){Gm(this),jd(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const fT=(e,t,n)=>new xwe(e,t).update(n).digest();fT.create=(e,t)=>new xwe(e,t);function Act(e,t,n){return lT(e),n===void 0&&(n=new Uint8Array(e.outputLen)),fT(e,Td(n),Td(t))}const gR=Uint8Array.from([0]),rne=Uint8Array.of();function _ct(e,t,n,r=32){lT(e),E0(r);const s=e.outputLen;if(r>255*s)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/s);n===void 0&&(n=rne);const o=new Uint8Array(i*s),a=fT.create(e,t),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let u=0;u<i;u++)gR[0]=u+1,c.update(u===0?rne:l).update(n).update(gR).digestInto(l),o.set(l,s*u),a._cloneInto(c);return a.destroy(),c.destroy(),xu(l,gR),o.slice(0,r)}const Nct=(e,t,n,r,s)=>_ct(e,Act(e,t,n),r,s),pT=dT,WH=BigInt(0),ZM=BigInt(1);function vA(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function yw(e,t,n=""){const r=cT(e),s=e==null?void 0:e.length,i=t!==void 0;if(!r||i&&s!==t){const o=n&&`"${n}" `,a=i?` of length ${t}`:"",c=r?`length=${s}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+a+", got "+c)}return e}function lI(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Iwe(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?WH:BigInt("0x"+e)}function gT(e){return Iwe(Vv(e))}function EA(e){return jd(e),Iwe(Vv(Uint8Array.from(e).reverse()))}function HH(e,t){return yA(e.toString(16).padStart(t*2,"0"))}function VH(e,t){return HH(e,t).reverse()}function xo(e,t,n){let r;if(typeof t=="string")try{r=yA(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(cT(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}const mR=e=>typeof e=="bigint"&&WH<=e;function Tct(e,t,n){return mR(e)&&mR(t)&&mR(n)&&t<=e&&e<n}function YM(e,t,n,r){if(!Tct(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Swe(e){let t;for(t=0;e>WH;e>>=ZM,t+=1);return t}const i$=e=>(ZM<<BigInt(e))-ZM;function Pct(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=h=>new Uint8Array(h),s=h=>Uint8Array.of(h);let i=r(e),o=r(e),a=0;const c=()=>{i.fill(1),o.fill(0),a=0},l=(...h)=>n(o,i,...h),u=(h=r(0))=>{o=l(s(0),h),i=l(),h.length!==0&&(o=l(s(1),h),i=l())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const f=[];for(;h<t;){i=l();const g=i.slice();f.push(g),h+=i.length}return nm(...f)};return(h,f)=>{c(),u(h);let g;for(;!(g=f(d()));)u();return c(),g}}function mT(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(s,i,o){const a=e[s];if(o&&a===void 0)return;const c=typeof a;if(c!==i||a===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${c}`)}Object.entries(t).forEach(([s,i])=>r(s,i,!1)),Object.entries(n).forEach(([s,i])=>r(s,i,!0))}function sne(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const fc=BigInt(0),ia=BigInt(1),bw=BigInt(2),Awe=BigInt(3),_we=BigInt(4),Nwe=BigInt(5),Oct=BigInt(7),Twe=BigInt(8),kct=BigInt(9),Pwe=BigInt(16);function Jc(e,t){const n=e%t;return n>=fc?n:t+n}function ud(e,t,n){let r=e;for(;t-- >fc;)r*=r,r%=n;return r}function ine(e,t){if(e===fc)throw new Error("invert: expected non-zero number");if(t<=fc)throw new Error("invert: expected positive modulus, got "+t);let n=Jc(e,t),r=t,s=fc,i=ia;for(;n!==fc;){const o=r/n,a=r%n,c=s-i*o;r=n,n=a,s=i,i=c}if(r!==ia)throw new Error("invert: does not exist");return Jc(s,t)}function KH(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function Owe(e,t){const n=(e.ORDER+ia)/_we,r=e.pow(t,n);return KH(e,r,t),r}function Rct(e,t){const n=(e.ORDER-Nwe)/Twe,r=e.mul(t,bw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,bw),s),a=e.mul(i,e.sub(o,e.ONE));return KH(e,a,t),a}function Bct(e){const t=g1(e),n=kwe(e),r=n(t,t.neg(t.ONE)),s=n(t,r),i=n(t,t.neg(r)),o=(e+Oct)/Pwe;return(a,c)=>{let l=a.pow(c,o),u=a.mul(l,r);const d=a.mul(l,s),h=a.mul(l,i),f=a.eql(a.sqr(u),c),g=a.eql(a.sqr(d),c);l=a.cmov(l,u,f),u=a.cmov(h,d,g);const p=a.eql(a.sqr(u),c),m=a.cmov(l,u,p);return KH(a,m,c),m}}function kwe(e){if(e<Awe)throw new Error("sqrt is not defined for small field");let t=e-ia,n=0;for(;t%bw===fc;)t/=bw,n++;let r=bw;const s=g1(e);for(;one(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Owe;let i=s.pow(r,t);const o=(t+ia)/bw;return function(a,c){if(a.is0(c))return c;if(one(a,c)!==1)throw new Error("Cannot find square root");let l=n,u=a.mul(a.ONE,i),d=a.pow(c,t),h=a.pow(c,o);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let f=1,g=a.sqr(d);for(;!a.eql(g,a.ONE);)if(f++,g=a.sqr(g),f===l)throw new Error("Cannot find square root");const p=ia<<BigInt(l-f-1),m=a.pow(u,p);l=f,u=a.sqr(m),d=a.mul(d,u),h=a.mul(h,m)}return h}}function Dct(e){return e%_we===Awe?Owe:e%Twe===Nwe?Rct:e%Pwe===kct?Bct(e):kwe(e)}const Uct=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Lct(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=Uct.reduce((r,s)=>(r[s]="function",r),t);return mT(e,n),e}function Mct(e,t,n){if(n<fc)throw new Error("invalid exponent, negatives unsupported");if(n===fc)return e.ONE;if(n===ia)return t;let r=e.ONE,s=t;for(;n>fc;)n&ia&&(r=e.mul(r,s)),s=e.sqr(s),n>>=ia;return r}function Rwe(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function one(e,t){const n=(e.ORDER-ia)/bw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Bwe(e,t){t!==void 0&&E0(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function g1(e,t,n=!1,r={}){if(e<=fc)throw new Error("invalid field: expected ORDER > 0, got "+e);let s,i,o=!1,a;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(s=h.BITS),h.sqrt&&(i=h.sqrt),typeof h.isLE=="boolean"&&(n=h.isLE),typeof h.modFromBytes=="boolean"&&(o=h.modFromBytes),a=h.allowedLengths}else typeof t=="number"&&(s=t),r.sqrt&&(i=r.sqrt);const{nBitLength:c,nByteLength:l}=Bwe(e,s);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:l,MASK:i$(c),ZERO:fc,ONE:ia,allowedLengths:a,create:h=>Jc(h,e),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return fc<=h&&h<e},is0:h=>h===fc,isValidNot0:h=>!d.is0(h)&&d.isValid(h),isOdd:h=>(h&ia)===ia,neg:h=>Jc(-h,e),eql:(h,f)=>h===f,sqr:h=>Jc(h*h,e),add:(h,f)=>Jc(h+f,e),sub:(h,f)=>Jc(h-f,e),mul:(h,f)=>Jc(h*f,e),pow:(h,f)=>Mct(d,h,f),div:(h,f)=>Jc(h*ine(f,e),e),sqrN:h=>h*h,addN:(h,f)=>h+f,subN:(h,f)=>h-f,mulN:(h,f)=>h*f,inv:h=>ine(h,e),sqrt:i||(h=>(u||(u=Dct(e)),u(d,h))),toBytes:h=>n?VH(h,l):HH(h,l),fromBytes:(h,f=!0)=>{if(a){if(!a.includes(h.length)||h.length>l)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+h.length);const p=new Uint8Array(l);p.set(h,n?0:p.length-h.length),h=p}if(h.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+h.length);let g=n?EA(h):gT(h);if(o&&(g=Jc(g,e)),!f&&!d.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g},invertBatch:h=>Rwe(d,h),cmov:(h,f,g)=>g?f:h});return Object.freeze(d)}function Dwe(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Uwe(e){const t=Dwe(e);return t+Math.ceil(t/2)}function jct(e,t,n=!1){const r=e.length,s=Dwe(t),i=Uwe(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?EA(e):gT(e),a=Jc(o,t-ia)+ia;return n?VH(a,s):HH(a,s)}const g5=BigInt(0),vw=BigInt(1);function CA(e,t){const n=t.negate();return e?n:t}function wR(e,t){const n=Rwe(e.Fp,t.map(r=>r.Z));return t.map((r,s)=>e.fromAffine(r.toAffine(n[s])))}function Lwe(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function yR(e,t){Lwe(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=i$(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function ane(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=vw);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function Fct(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function zct(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const bR=new WeakMap,Mwe=new WeakMap;function vR(e){return Mwe.get(e)||1}function cne(e){if(e!==g5)throw new Error("invalid wNAF")}class qct{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let s=t;for(;n>g5;)n&vw&&(r=r.add(s)),s=s.double(),n>>=vw;return r}precomputeWindow(t,n){const{windows:r,windowSize:s}=yR(n,this.bits),i=[];let o=t,a=o;for(let c=0;c<r;c++){a=o,i.push(a);for(let l=1;l<s;l++)a=a.add(o),i.push(a);o=a.double()}return i}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let s=this.ZERO,i=this.BASE;const o=yR(t,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:l,isZero:u,isNeg:d,isNegF:h,offsetF:f}=ane(r,a,o);r=c,u?i=i.add(CA(h,n[f])):s=s.add(CA(d,n[l]))}return cne(r),{p:s,f:i}}wNAFUnsafe(t,n,r,s=this.ZERO){const i=yR(t,this.bits);for(let o=0;o<i.windows&&r!==g5;o++){const{nextN:a,offset:c,isZero:l,isNeg:u}=ane(r,o,i);if(r=a,!l){const d=n[c];s=s.add(u?d.negate():d)}}return cne(r),s}getPrecomputes(t,n,r){let s=bR.get(n);return s||(s=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(s=r(s)),bR.set(n,s))),s}cached(t,n,r){const s=vR(t);return this.wNAF(s,this.getPrecomputes(s,t,r),n)}unsafe(t,n,r,s){const i=vR(t);return i===1?this._unsafeLadder(t,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),n,s)}createCache(t,n){Lwe(n,this.bits),Mwe.set(t,n),bR.delete(t)}hasCache(t){return vR(t)!==1}}function Wct(e,t,n,r){let s=t,i=e.ZERO,o=e.ZERO;for(;n>g5||r>g5;)n&vw&&(i=i.add(s)),r&vw&&(o=o.add(s)),s=s.double(),n>>=vw,r>>=vw;return{p1:i,p2:o}}function Hct(e,t,n,r){Fct(n,e),zct(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=Swe(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=i$(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function lne(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Lct(t),t}else return g1(e,{isLE:n})}function Vct(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const a of["p","n","h"]){const c=t[a];if(!(typeof c=="bigint"&&c>g5))throw new Error(`CURVE.${a} must be positive bigint`)}const s=lne(t.p,n.Fp,r),i=lne(t.n,n.Fn,r),o=["Gx","Gy","a","b"];for(const a of o)if(!s.isValid(t[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8),cwe("HashToScalar-");const G3=BigInt(0),f2=BigInt(1),uI=BigInt(2);function Kct(e){return mT(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function Gct(e){const t=Kct(e),{P:n,type:r,adjustScalarBytes:s,powPminus2:i,randomBytes:o}=t,a=r==="x25519";if(!a&&r!=="x448")throw new Error("invalid type");const c=o||gb,l=a?255:448,u=a?32:56,d=BigInt(a?9:5),h=BigInt(a?121665:39081),f=a?uI**BigInt(254):uI**BigInt(447),g=a?BigInt(8)*uI**BigInt(251)-f2:BigInt(4)*uI**BigInt(445)-f2,p=f+g+f2,m=T=>Jc(T,n),w=C(d);function C(T){return VH(m(T),u)}function E(T){const P=xo("u coordinate",T,u);return a&&(P[31]&=127),m(EA(P))}function b(T){return EA(s(xo("scalar",T,u)))}function S(T,P){const _=A(E(P),b(T));if(_===G3)throw new Error("invalid private or public key received");return C(_)}function v(T){return S(T,w)}function x(T,P,_){const y=m(T*(P-_));return P=m(P-y),_=m(_+y),{x_2:P,x_3:_}}function A(T,P){YM("u",T,G3,n),YM("scalar",P,f,p);const _=P,y=T;let $=f2,R=G3,B=T,k=f2,D=G3;for(let F=BigInt(l-1);F>=G3;F--){const K=_>>F&f2;D^=K,{x_2:$,x_3:B}=x(D,$,B),{x_2:R,x_3:k}=x(D,R,k),D=K;const q=$+R,H=m(q*q),Z=$-R,ee=m(Z*Z),ie=H-ee,X=B+k,le=B-k,_e=m(le*q),Ne=m(X*Z),be=_e+Ne,Me=_e-Ne;B=m(be*be),k=m(y*m(Me*Me)),$=m(H*ee),R=m(ie*(H+m(h*ie)))}({x_2:$,x_3:B}=x(D,$,B)),{x_2:R,x_3:k}=x(D,R,k);const U=i(R);return m($*U)}const I={secretKey:u,publicKey:u,seed:u},O=(T=c(u))=>(jd(T,I.seed),T);function N(T){const P=O(T);return{secretKey:P,publicKey:v(P)}}return{keygen:N,getSharedSecret:(T,P)=>S(T,P),getPublicKey:T=>v(T),scalarMult:S,scalarMultBase:v,utils:{randomSecretKey:O,randomPrivateKey:O},GuBytes:w.slice(),lengths:I}}const Zct=BigInt(1),une=BigInt(2),Yct=BigInt(3),Jct=BigInt(5);BigInt(8);const jwe=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Xct={p:jwe,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Qct(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=jwe,o=e*e%i*e%i,a=ud(o,une,i)*o%i,c=ud(a,Zct,i)*e%i,l=ud(c,Jct,i)*c%i,u=ud(l,t,i)*l%i,d=ud(u,n,i)*u%i,h=ud(d,r,i)*d%i,f=ud(h,s,i)*h%i,g=ud(f,s,i)*h%i,p=ud(g,t,i)*l%i;return{pow_p_5_8:ud(p,une,i)*e%i,b2:o}}function elt(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const tlt=g1(Xct.p,{isLE:!0}),JM=(()=>{const e=tlt.ORDER;return Gct({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=Qct(t);return Jc(ud(n,Yct,e)*r,e)},adjustScalarBytes:elt})})(),dne=(e,t)=>(e+(e>=0?t:-t)/Fwe)/t;function nlt(e,t,n){const[[r,s],[i,o]]=t,a=dne(o*e,n),c=dne(-s*e,n);let l=e-a*r-c*i,u=-a*s-c*o;const d=l<Gp,h=u<Gp;d&&(l=-l),h&&(u=-u);const f=i$(Math.ceil(Swe(n)/2))+Kv;if(l<Gp||l>=f||u<Gp||u>=f)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}function XM(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ER(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return vA(n.lowS,"lowS"),vA(n.prehash,"prehash"),n.format!==void 0&&XM(n.format),n}class rlt extends Error{constructor(t=""){super(t)}}const Np={Err:rlt,_tlv:{encode:(e,t)=>{const{Err:n}=Np;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=lI(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?lI(s.length/2|128):"";return lI(e)+i+s+t},decode(e,t){const{Err:n}=Np;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Np;if(e<Gp)throw new t("integer: negative integers are not allowed");let n=lI(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Np;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return gT(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Np,s=xo("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Np,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}},Gp=BigInt(0),Kv=BigInt(1),Fwe=BigInt(2),dI=BigInt(3),slt=BigInt(4);function bv(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let s=xo("private key",t);try{r=e.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function ilt(e,t={}){const n=Vct("weierstrass",e,t),{Fp:r,Fn:s}=n;let i=n.CURVE;const{h:o,n:a}=i;mT(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!r.is0(i.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=qwe(r,s);function u(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function d(T,P,_){const{x:y,y:$}=P.toAffine(),R=r.toBytes(y);if(vA(_,"isCompressed"),_){u();const B=!r.isOdd($);return nm(zwe(B),R)}else return nm(Uint8Array.of(4),R,r.toBytes($))}function h(T){yw(T,void 0,"Point");const{publicKey:P,publicKeyUncompressed:_}=l,y=T.length,$=T[0],R=T.subarray(1);if(y===P&&($===2||$===3)){const B=r.fromBytes(R);if(!r.isValid(B))throw new Error("bad point: is not on curve, wrong x");const k=p(B);let D;try{D=r.sqrt(k)}catch(F){const K=F instanceof Error?": "+F.message:"";throw new Error("bad point: is not on curve, sqrt error"+K)}u();const U=r.isOdd(D);return($&1)===1!==U&&(D=r.neg(D)),{x:B,y:D}}else if(y===_&&$===4){const B=r.BYTES,k=r.fromBytes(R.subarray(0,B)),D=r.fromBytes(R.subarray(B,B*2));if(!m(k,D))throw new Error("bad point: is not on curve");return{x:k,y:D}}else throw new Error(`bad point: got length ${y}, expected compressed=${P} or uncompressed=${_}`)}const f=t.toBytes||d,g=t.fromBytes||h;function p(T){const P=r.sqr(T),_=r.mul(P,T);return r.add(r.add(_,r.mul(T,i.a)),i.b)}function m(T,P){const _=r.sqr(P),y=p(T);return r.eql(_,y)}if(!m(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const w=r.mul(r.pow(i.a,dI),slt),C=r.mul(r.sqr(i.b),BigInt(27));if(r.is0(r.add(w,C)))throw new Error("bad curve params: a or b");function E(T,P,_=!1){if(!r.isValid(P)||_&&r.is0(P))throw new Error(`bad point coordinate ${T}`);return P}function b(T){if(!(T instanceof I))throw new Error("ProjectivePoint expected")}function S(T){if(!c||!c.basises)throw new Error("no endo");return nlt(T,c.basises,s.ORDER)}const v=sne((T,P)=>{const{X:_,Y:y,Z:$}=T;if(r.eql($,r.ONE))return{x:_,y};const R=T.is0();P==null&&(P=R?r.ONE:r.inv($));const B=r.mul(_,P),k=r.mul(y,P),D=r.mul($,P);if(R)return{x:r.ZERO,y:r.ZERO};if(!r.eql(D,r.ONE))throw new Error("invZ was invalid");return{x:B,y:k}}),x=sne(T=>{if(T.is0()){if(t.allowInfinityPoint&&!r.is0(T.Y))return;throw new Error("bad point: ZERO")}const{x:P,y:_}=T.toAffine();if(!r.isValid(P)||!r.isValid(_))throw new Error("bad point: x or y not field elements");if(!m(P,_))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function A(T,P,_,y,$){return _=new I(r.mul(_.X,T),_.Y,_.Z),P=CA(y,P),_=CA($,_),P.add(_)}class I{constructor(P,_,y){this.X=E("x",P),this.Y=E("y",_,!0),this.Z=E("z",y),Object.freeze(this)}static CURVE(){return i}static fromAffine(P){const{x:_,y}=P||{};if(!P||!r.isValid(_)||!r.isValid(y))throw new Error("invalid affine point");if(P instanceof I)throw new Error("projective point not allowed");return r.is0(_)&&r.is0(y)?I.ZERO:new I(_,y,r.ONE)}static fromBytes(P){const _=I.fromAffine(g(yw(P,void 0,"point")));return _.assertValidity(),_}static fromHex(P){return I.fromBytes(xo("pointHex",P))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,_=!0){return N.createCache(this,P),_||this.multiply(dI),this}assertValidity(){x(this)}hasEvenY(){const{y:P}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(P)}equals(P){b(P);const{X:_,Y:y,Z:$}=this,{X:R,Y:B,Z:k}=P,D=r.eql(r.mul(_,k),r.mul(R,$)),U=r.eql(r.mul(y,k),r.mul(B,$));return D&&U}negate(){return new I(this.X,r.neg(this.Y),this.Z)}double(){const{a:P,b:_}=i,y=r.mul(_,dI),{X:$,Y:R,Z:B}=this;let k=r.ZERO,D=r.ZERO,U=r.ZERO,F=r.mul($,$),K=r.mul(R,R),q=r.mul(B,B),H=r.mul($,R);return H=r.add(H,H),U=r.mul($,B),U=r.add(U,U),k=r.mul(P,U),D=r.mul(y,q),D=r.add(k,D),k=r.sub(K,D),D=r.add(K,D),D=r.mul(k,D),k=r.mul(H,k),U=r.mul(y,U),q=r.mul(P,q),H=r.sub(F,q),H=r.mul(P,H),H=r.add(H,U),U=r.add(F,F),F=r.add(U,F),F=r.add(F,q),F=r.mul(F,H),D=r.add(D,F),q=r.mul(R,B),q=r.add(q,q),F=r.mul(q,H),k=r.sub(k,F),U=r.mul(q,K),U=r.add(U,U),U=r.add(U,U),new I(k,D,U)}add(P){b(P);const{X:_,Y:y,Z:$}=this,{X:R,Y:B,Z:k}=P;let D=r.ZERO,U=r.ZERO,F=r.ZERO;const K=i.a,q=r.mul(i.b,dI);let H=r.mul(_,R),Z=r.mul(y,B),ee=r.mul($,k),ie=r.add(_,y),X=r.add(R,B);ie=r.mul(ie,X),X=r.add(H,Z),ie=r.sub(ie,X),X=r.add(_,$);let le=r.add(R,k);return X=r.mul(X,le),le=r.add(H,ee),X=r.sub(X,le),le=r.add(y,$),D=r.add(B,k),le=r.mul(le,D),D=r.add(Z,ee),le=r.sub(le,D),F=r.mul(K,X),D=r.mul(q,ee),F=r.add(D,F),D=r.sub(Z,F),F=r.add(Z,F),U=r.mul(D,F),Z=r.add(H,H),Z=r.add(Z,H),ee=r.mul(K,ee),X=r.mul(q,X),Z=r.add(Z,ee),ee=r.sub(H,ee),ee=r.mul(K,ee),X=r.add(X,ee),H=r.mul(Z,X),U=r.add(U,H),H=r.mul(le,X),D=r.mul(ie,D),D=r.sub(D,H),H=r.mul(ie,Z),F=r.mul(le,F),F=r.add(F,H),new I(D,U,F)}subtract(P){return this.add(P.negate())}is0(){return this.equals(I.ZERO)}multiply(P){const{endo:_}=t;if(!s.isValidNot0(P))throw new Error("invalid scalar: out of range");let y,$;const R=B=>N.cached(this,B,k=>wR(I,k));if(_){const{k1neg:B,k1:k,k2neg:D,k2:U}=S(P),{p:F,f:K}=R(k),{p:q,f:H}=R(U);$=K.add(H),y=A(_.beta,F,q,B,D)}else{const{p:B,f:k}=R(P);y=B,$=k}return wR(I,[y,$])[0]}multiplyUnsafe(P){const{endo:_}=t,y=this;if(!s.isValid(P))throw new Error("invalid scalar: out of range");if(P===Gp||y.is0())return I.ZERO;if(P===Kv)return y;if(N.hasCache(this))return this.multiply(P);if(_){const{k1neg:$,k1:R,k2neg:B,k2:k}=S(P),{p1:D,p2:U}=Wct(I,y,R,k);return A(_.beta,D,U,$,B)}else return N.unsafe(y,P)}multiplyAndAddUnsafe(P,_,y){const $=this.multiplyUnsafe(_).add(P.multiplyUnsafe(y));return $.is0()?void 0:$}toAffine(P){return v(this,P)}isTorsionFree(){const{isTorsionFree:P}=t;return o===Kv?!0:P?P(I,this):N.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:P}=t;return o===Kv?this:P?P(I,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(P=!0){return vA(P,"isCompressed"),this.assertValidity(),f(I,this,P)}toHex(P=!0){return Vv(this.toBytes(P))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(P=!0){return this.toBytes(P)}_setWindowSize(P){this.precompute(P)}static normalizeZ(P){return wR(I,P)}static msm(P,_){return Hct(I,s,P,_)}static fromPrivateKey(P){return I.BASE.multiply(bv(s,P))}}I.BASE=new I(i.Gx,i.Gy,r.ONE),I.ZERO=new I(r.ZERO,r.ONE,r.ZERO),I.Fp=r,I.Fn=s;const O=s.BITS,N=new qct(I,t.endo?Math.ceil(O/2):O);return I.BASE.precompute(8),I}function zwe(e){return Uint8Array.of(e?2:3)}function qwe(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function olt(e,t={}){const{Fn:n}=e,r=t.randomBytes||gb,s=Object.assign(qwe(e.Fp,n),{seed:Uwe(n.ORDER)});function i(h){try{return!!bv(n,h)}catch{return!1}}function o(h,f){const{publicKey:g,publicKeyUncompressed:p}=s;try{const m=h.length;return f===!0&&m!==g||f===!1&&m!==p?!1:!!e.fromBytes(h)}catch{return!1}}function a(h=r(s.seed)){return jct(yw(h,s.seed,"seed"),n.ORDER)}function c(h,f=!0){return e.BASE.multiply(bv(n,h)).toBytes(f)}function l(h){const f=a(h);return{secretKey:f,publicKey:c(f)}}function u(h){if(typeof h=="bigint")return!1;if(h instanceof e)return!0;const{secretKey:f,publicKey:g,publicKeyUncompressed:p}=s;if(n.allowedLengths||f===g)return;const m=xo("key",h).length;return m===g||m===p}function d(h,f,g=!0){if(u(h)===!0)throw new Error("first arg must be private key");if(u(f)===!1)throw new Error("second arg must be public key");const p=bv(n,h);return e.fromHex(f).multiply(p).toBytes(g)}return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:l,Point:e,utils:{isValidSecretKey:i,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:i,randomPrivateKey:a,normPrivateKeyToScalar:h=>bv(n,h),precompute(h=8,f=e.BASE){return f.precompute(h,!1)}},lengths:s})}function alt(e,t,n={}){lT(t),mT(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||gb,s=n.hmac||((_,...y)=>fT(t,_,nm(...y))),{Fp:i,Fn:o}=e,{ORDER:a,BITS:c}=o,{keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:f}=olt(e,n),g={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},p="compact";function m(_){const y=a>>Kv;return _>y}function w(_,y){if(!o.isValidNot0(y))throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);return y}function C(_,y){XM(y);const $=f.signature,R=y==="compact"?$:y==="recovered"?$+1:void 0;return yw(_,R,`${y} signature`)}class E{constructor(y,$,R){this.r=w("r",y),this.s=w("s",$),R!=null&&(this.recovery=R),Object.freeze(this)}static fromBytes(y,$=p){C(y,$);let R;if($==="der"){const{r:U,s:F}=Np.toSig(yw(y));return new E(U,F)}$==="recovered"&&(R=y[0],$="compact",y=y.subarray(1));const B=o.BYTES,k=y.subarray(0,B),D=y.subarray(B,B*2);return new E(o.fromBytes(k),o.fromBytes(D),R)}static fromHex(y,$){return this.fromBytes(yA(y),$)}addRecoveryBit(y){return new E(this.r,this.s,y)}recoverPublicKey(y){const $=i.ORDER,{r:R,s:B,recovery:k}=this;if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");if(a*Fwe<$&&k>1)throw new Error("recovery id is ambiguous for h>1 curve");const D=k===2||k===3?R+a:R;if(!i.isValid(D))throw new Error("recovery id 2 or 3 invalid");const U=i.toBytes(D),F=e.fromBytes(nm(zwe((k&1)===0),U)),K=o.inv(D),q=S(xo("msgHash",y)),H=o.create(-q*K),Z=o.create(B*K),ee=e.BASE.multiplyUnsafe(H).add(F.multiplyUnsafe(Z));if(ee.is0())throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return m(this.s)}toBytes(y=p){if(XM(y),y==="der")return yA(Np.hexFromSig(this));const $=o.toBytes(this.r),R=o.toBytes(this.s);if(y==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return nm(Uint8Array.of(this.recovery),$,R)}return nm($,R)}toHex(y){return Vv(this.toBytes(y))}assertValidity(){}static fromCompact(y){return E.fromBytes(xo("sig",y),"compact")}static fromDER(y){return E.fromBytes(xo("sig",y),"der")}normalizeS(){return this.hasHighS()?new E(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Vv(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Vv(this.toBytes("compact"))}}const b=n.bits2int||function(_){if(_.length>8192)throw new Error("input is too large");const y=gT(_),$=_.length*8-c;return $>0?y>>BigInt($):y},S=n.bits2int_modN||function(_){return o.create(b(_))},v=i$(c);function x(_){return YM("num < 2^"+c,_,Gp,v),o.toBytes(_)}function A(_,y){return yw(_,void 0,"message"),y?yw(t(_),void 0,"prehashed message"):_}function I(_,y,$){if(["recovered","canonical"].some(Z=>Z in $))throw new Error("sign() legacy options not supported");const{lowS:R,prehash:B,extraEntropy:k}=ER($,g);_=A(_,B);const D=S(_),U=bv(o,y),F=[x(U),x(D)];if(k!=null&&k!==!1){const Z=k===!0?r(f.secretKey):k;F.push(xo("extraEntropy",Z))}const K=nm(...F),q=D;function H(Z){const ee=b(Z);if(!o.isValidNot0(ee))return;const ie=o.inv(ee),X=e.BASE.multiply(ee).toAffine(),le=o.create(X.x);if(le===Gp)return;const _e=o.create(ie*o.create(q+le*U));if(_e===Gp)return;let Ne=(X.x===le?0:2)|Number(X.y&Kv),be=_e;return R&&m(_e)&&(be=o.neg(_e),Ne^=1),new E(le,be,Ne)}return{seed:K,k2sig:H}}function O(_,y,$={}){_=xo("message",_);const{seed:R,k2sig:B}=I(_,y,$);return Pct(t.outputLen,o.BYTES,s)(R,B)}function N(_){let y;const $=typeof _=="string"||cT(_),R=!$&&_!==null&&typeof _=="object"&&typeof _.r=="bigint"&&typeof _.s=="bigint";if(!$&&!R)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(R)y=new E(_.r,_.s);else if($){try{y=E.fromBytes(xo("sig",_),"der")}catch(B){if(!(B instanceof Np.Err))throw B}if(!y)try{y=E.fromBytes(xo("sig",_),"compact")}catch{return!1}}return y||!1}function T(_,y,$,R={}){const{lowS:B,prehash:k,format:D}=ER(R,g);if($=xo("publicKey",$),y=A(xo("message",y),k),"strict"in R)throw new Error("options.strict was renamed to lowS");const U=D===void 0?N(_):E.fromBytes(xo("sig",_),D);if(U===!1)return!1;try{const F=e.fromBytes($);if(B&&U.hasHighS())return!1;const{r:K,s:q}=U,H=S(y),Z=o.inv(q),ee=o.create(H*Z),ie=o.create(K*Z),X=e.BASE.multiplyUnsafe(ee).add(F.multiplyUnsafe(ie));return X.is0()?!1:o.create(X.x)===K}catch{return!1}}function P(_,y,$={}){const{prehash:R}=ER($,g);return y=A(y,R),E.fromBytes(_,"recovered").recoverPublicKey(y).toBytes()}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:d,utils:h,lengths:f,Point:e,sign:O,verify:T,recoverPublicKey:P,Signature:E,hash:t})}function clt(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=g1(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),i={Fp:n,Fn:s,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:i}}function llt(e){const{CURVE:t,curveOpts:n}=clt(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function ult(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,Bwe(n.Fn.ORDER,n.Fn.BITS))})}function dlt(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:s}=llt(e),i=ilt(t,n),o=alt(i,r,s);return ult(e,o)}function QM(e,t){const n=r=>dlt({...e,hash:r});return{...n(t),create:n}}const Wwe={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Hwe={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},Vwe={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},hlt=g1(Wwe.p),flt=g1(Hwe.p),plt=g1(Vwe.p),glt=QM({...Wwe,Fp:hlt,lowS:!1},dT);QM({...Hwe,Fp:flt,lowS:!1},vat),QM({...Vwe,Fp:plt,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},bat);const mlt=glt,Kwe="base10",oa="base16",Qa="base64pad",rm="base64url",o$="utf8",Gwe=0,o0=1,a$=2,wlt=0,hne=1,u8=12,GH=32;function ylt(){const e=JM.utils.randomPrivateKey(),t=JM.getPublicKey(e);return{privateKey:rn(e,oa),publicKey:rn(t,oa)}}function ej(){const e=gb(GH);return rn(e,oa)}function blt(e,t){const n=JM.getSharedSecret(vn(e,oa),vn(t,oa)),r=Nct(pT,n,void 0,void 0,GH);return rn(r,oa)}function _S(e){const t=pT(vn(e,oa));return rn(t,oa)}function lu(e){const t=pT(vn(e,o$));return rn(t,oa)}function Zwe(e){return vn(`${e}`,Kwe)}function sy(e){return Number(rn(e,Kwe))}function Ywe(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Jwe(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}function vlt(e){const t=Zwe(typeof e.type<"u"?e.type:Gwe);if(sy(t)===o0&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?vn(e.senderPublicKey,oa):void 0,r=typeof e.iv<"u"?vn(e.iv,oa):gb(u8),s=vn(e.symKey,oa),i=$we(s,r).encrypt(vn(e.message,o$)),o=Xwe({type:t,sealed:i,iv:r,senderPublicKey:n});return e.encoding===rm?Ywe(o):o}function Elt(e){const t=vn(e.symKey,oa),{sealed:n,iv:r}=l4({encoded:e.encoded,encoding:e.encoding}),s=$we(t,r).decrypt(n);if(s===null)throw new Error("Failed to decrypt");return rn(s,o$)}function Clt(e,t){const n=Zwe(a$),r=gb(u8),s=vn(e,o$),i=Xwe({type:n,sealed:s,iv:r});return t===rm?Ywe(i):i}function $lt(e,t){const{sealed:n}=l4({encoded:e,encoding:t});return rn(n,o$)}function Xwe(e){if(sy(e.type)===a$)return rn(Yo([e.type,e.sealed]),Qa);if(sy(e.type)===o0){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return rn(Yo([e.type,e.senderPublicKey,e.iv,e.sealed]),Qa)}return rn(Yo([e.type,e.iv,e.sealed]),Qa)}function l4(e){const t=(e.encoding||Qa)===rm?Jwe(e.encoded):e.encoded,n=vn(t,Qa),r=n.slice(wlt,hne),s=hne;if(sy(r)===o0){const c=s+GH,l=c+u8,u=n.slice(s,c),d=n.slice(c,l),h=n.slice(l);return{type:r,sealed:h,iv:d,senderPublicKey:u}}if(sy(r)===a$){const c=n.slice(s),l=gb(u8);return{type:r,sealed:c,iv:l}}const i=s+u8,o=n.slice(s,i),a=n.slice(i);return{type:r,sealed:a,iv:o}}function xlt(e,t){const n=l4({encoded:e,encoding:t==null?void 0:t.encoding});return Qwe({type:sy(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?rn(n.senderPublicKey,oa):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function Qwe(e){const t=(e==null?void 0:e.type)||Gwe;if(t===o0){if(typeof(e==null?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(e==null?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e==null?void 0:e.senderPublicKey,receiverPublicKey:e==null?void 0:e.receiverPublicKey}}function fne(e){return e.type===o0&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function pne(e){return e.type===a$}function Ilt(e){const t=Buffer.from(e.x,"base64"),n=Buffer.from(e.y,"base64");return Yo([new Uint8Array([4]),t,n])}function Slt(e,t){const[n,r,s]=e.split("."),i=Buffer.from(Jwe(s),"base64");if(i.length!==64)throw new Error("Invalid signature length");const o=i.slice(0,32),a=i.slice(32,64),c=`${n}.${r}`,l=pT(c),u=Ilt(t);if(!mlt.verify(Yo([o,a]),l,u))throw new Error("Invalid signature");return wu(e).payload}const Alt="irn";function $A(e){return(e==null?void 0:e.relay)||{protocol:Alt}}function vv(e){const t=ZN[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var _lt=Object.defineProperty,Nlt=Object.defineProperties,Tlt=Object.getOwnPropertyDescriptors,gne=Object.getOwnPropertySymbols,Plt=Object.prototype.hasOwnProperty,Olt=Object.prototype.propertyIsEnumerable,mne=(e,t,n)=>t in e?_lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CR=(e,t)=>{for(var n in t||(t={}))Plt.call(t,n)&&mne(e,n,t[n]);if(gne)for(var n of gne(t))Olt.call(t,n)&&mne(e,n,t[n]);return e},klt=(e,t)=>Nlt(e,Tlt(t));function Rlt(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(s=>{if(s.startsWith(r)){const i=s.replace(r,""),o=e[s];n[i]=o}}),n}function wne(e){if(!e.includes("wc:")){const l=nwe(e);l!=null&&l.includes("wc:")&&(e=l)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),s=e.substring(t+1,n).split("@"),i=typeof n<"u"?e.substring(n):"",o=new URLSearchParams(i),a=Object.fromEntries(o.entries()),c=typeof a.methods=="str
72ing"?a.methods.split(","):void 0;return{protocol:r,topic:Blt(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:Rlt(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Blt(e){return e.startsWith("//")?e.substring(2):e}function Dlt(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(s=>{const i=s,o=n+t+i;e[i]&&(r[o]=e[i])}),r}function yne(e){const t=new URLSearchParams,n=CR(CR(klt(CR({},Dlt(e.relay)),{symKey:e.symKey}),e.expiryTimestamp&&{expiryTimestamp:e.expiryTimestamp.toString()}),e.methods&&{methods:e.methods.join(",")});return Object.entries(n).sort(([r],[s])=>r.localeCompare(s)).forEach(([r,s])=>{s!==void 0&&t.append(r,String(s))}),`${e.protocol}:${e.topic}@${e.version}?${t}`}function hI(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}var Ult=Object.defineProperty,Llt=Object.defineProperties,Mlt=Object.getOwnPropertyDescriptors,bne=Object.getOwnPropertySymbols,jlt=Object.prototype.hasOwnProperty,Flt=Object.prototype.propertyIsEnumerable,vne=(e,t,n)=>t in e?Ult(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zlt=(e,t)=>{for(var n in t||(t={}))jlt.call(t,n)&&vne(e,n,t[n]);if(bne)for(var n of bne(t))Flt.call(t,n)&&vne(e,n,t[n]);return e},qlt=(e,t)=>Llt(e,Mlt(t));function D6(e){const t=[];return e.forEach(n=>{const[r,s]=n.split(":");t.push(`${r}:${s}`)}),t}function eye(e){const t=[];return Object.values(e).forEach(n=>{t.push(...D6(n.accounts))}),[...new Set(t)]}function Wlt(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.methods)}),[...new Set(t)]}function Hlt(e){const t=[];return Object.values(e).forEach(n=>{t.push(...n.events)}),[...new Set(t)]}function Vlt(e,t){const n=[];return Object.values(e).forEach(r=>{D6(r.accounts).includes(t)&&n.push(...r.methods)}),n}function Klt(e,t){const n=[];return Object.values(e).forEach(r=>{D6(r.accounts).includes(t)&&n.push(...r.events)}),n}function wT(e){return e.includes(":")}function Ev(e){return wT(e)?e.split(":")[0]:e}function Ene(e){var t,n,r;const s={};if(!Yh(e))return s;for(const[i,o]of Object.entries(e)){const a=wT(i)?[i]:o.chains,c=o.methods||[],l=o.events||[],u=Ev(i);s[u]=qlt(zlt({},s[u]),{chains:Zh(a,(t=s[u])==null?void 0:t.chains),methods:Zh(c,(n=s[u])==null?void 0:n.methods),events:Zh(l,(r=s[u])==null?void 0:r.events)})}return s}function Glt(e){const t={};return e==null||e.forEach(n=>{var r;const[s,i]=n.split(":");t[s]||(t[s]={accounts:[],chains:[],events:[],methods:[]}),t[s].accounts.push(n),(r=t[s].chains)==null||r.push(`${s}:${i}`)}),t}function Cne(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=Glt(t);for(const[r,s]of Object.entries(n))s.methods?s.methods=Zh(s.methods,e):s.methods=e,s.events=["chainChanged","accountsChanged"];return n}function Zlt(e,t){var n,r,s,i,o,a;const c=Ene(e),l=Ene(t),u={},d=Object.keys(c).concat(Object.keys(l));for(const h of d)u[h]={chains:Zh((n=c[h])==null?void 0:n.chains,(r=l[h])==null?void 0:r.chains),methods:Zh((s=c[h])==null?void 0:s.methods,(i=l[h])==null?void 0:i.methods),events:Zh((o=c[h])==null?void 0:o.events,(a=l[h])==null?void 0:a.events)};return u}function a0(e,t){return!!Array.isArray(e)}function Yh(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function bi(e){return typeof e>"u"}function Ts(e,t){return t&&bi(e)?!0:typeof e=="string"&&!!e.trim().length}function ZH(e,t){return typeof e=="number"&&!isNaN(e)}function Ylt(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),s=Object.keys(n);let i=!0;return ww(s,r)?(r.forEach(o=>{const{accounts:a,methods:c,events:l}=e.namespaces[o],u=D6(a),d=n[o];(!ww(J1e(o,d),u)||!ww(d.methods,c)||!ww(d.events,l))&&(i=!1)}),i):!1}function xA(e){return Ts(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function Jlt(e){if(Ts(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&xA(n)}}return!1}function Xlt(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(Ts(e,!1)){if(t(e))return!0;const n=nwe(e);return t(n)}}catch{}return!1}function Qlt(e){var t;return(t=e==null?void 0:e.proposer)==null?void 0:t.publicKey}function eut(e){return e==null?void 0:e.topic}function tut(e,t){let n=null;return Ts(e==null?void 0:e.publicKey,!1)||(n=Fe("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function $ne(e){let t=!0;return a0(e)?e.length&&(t=e.every(n=>Ts(n,!1))):t=!1,t}function nut(e,t,n){let r=null;return a0(t)&&t.length?t.forEach(s=>{r||xA(s)||(r=Jr("UNSUPPORTED_CHAINS",`${n}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):xA(e)||(r=Jr("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:
725"] }`)),r}function rut(e,t,n){let r=null;return Object.entries(e).forEach(([s,i])=>{if(r)return;const o=nut(s,J1e(s,i),`${t} ${n}`);o&&(r=o)}),r}function sut(e,t){let n=null;return a0(e)?e.forEach(r=>{n||Jlt(r)||(n=Jr("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=Jr("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function iut(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=sut(r==null?void 0:r.accounts,`${t} namespace`);s&&(n=s)}),n}function out(e,t){let n=null;return $ne(e==null?void 0:e.methods)?$ne(e==null?void 0:e.events)||(n=Jr("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=Jr("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function tye(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=out(r,`${t}, namespace`);s&&(n=s)}),n}function aut(e,t,n){let r=null;if(e&&Yh(e)){const s=tye(e,t);s&&(r=s);const i=rut(e,t,n);i&&(r=i)}else r=Fe("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function $R(e,t){let n=null;if(e&&Yh(e)){const r=tye(e,t);r&&(n=r);const s=iut(e,t);s&&(n=s)}else n=Fe("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function nye(e){return Ts(e.protocol,!0)}function cut(e,t){let n=!1;return e?e&&a0(e)&&e.length&&e.forEach(r=>{n=nye(r)}):n=!0,n}function lut(e){return typeof e=="number"}function za(e){return typeof e<"u"&&typeof e!==null}function uut(e){return!(!e||typeof e!="object"||!e.code||!ZH(e.code)||!e.message||!Ts(e.message,!1))}function dut(e){return!(bi(e)||!Ts(e.method,!1))}function hut(e){return!(bi(e)||bi(e.result)&&bi(e.error)||!ZH(e.id)||!Ts(e.jsonrpc,!1))}function fut(e){return!(bi(e)||!Ts(e.name,!1))}function xne(e,t){return!(!xA(t)||!eye(e).includes(t))}function put(e,t,n){return Ts(n,!1)?Vlt(e,t).includes(n):!1}function gut(e,t,n){return Ts(n,!1)?Klt(e,t).includes(n):!1}function Ine(e,t,n){let r=null;const s=mut(e),i=wut(t),o=Object.keys(s),a=Object.keys(i),c=Sne(Object.keys(e)),l=Sne(Object.keys(t)),u=c.filter(d=>!l.includes(d));return u.length&&(r=Fe("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces. 73 Required: ${u.toString()} 74 Received: ${Object.keys(t).toString()}`)),ww(o,a)||(r=Fe("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces. 75 Required: ${o.toString()} 76 Approved: ${a.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const h=D6(t[d].accounts);h.includes(d)||(r=Fe("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${d} 77 Required: ${d} 78 Approved: ${h.toString()}`))}),o.forEach(d=>{r||(ww(s[d].methods,i[d].methods)?ww(s[d].events,i[d].events)||(r=Fe("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${d}`)):r=Fe("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function mut(e){const t={};return Object.keys(e).forEach(n=>{var r;n.includes(":")?t[n]=e[n]:(r=e[n].chains)==null||r.forEach(s=>{t[s]={methods:e[n].methods,events:e[n].events}})}),t}function Sne(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function wut(e){const t={};return Object.keys(e).forEach(n=>{if(n.includes(":"))t[n]=e[n];else{const r=D6(e[n].accounts);r==null||r.forEach(s=>{t[s]={accounts:e[n].accounts.filter(i=>i.includes(`${s}:`)),methods:e[n].methods,events:e[n].events}})}}),t}function yut(e,t){return ZH(e)&&e<=t.max&&e>=t.min}function Ane(){const e=r$();return new Promise(t=>{switch(e){case al.browser:t(but());break;case al.reactNative:t(vut());break;case al.node:t(Eut());break;default:t(!0)}})}function but(){return B6()&&(navigator==null?void 0:navigator.onLine)}async function vut(){if(p1()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const e=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return e==null?void 0:e.isConnected}return!0}function Eut(){return!0}function Cut(e){switch(r$()){case al.browser:$ut(e);break;case al.reactNative:xut(e);break}}function $ut(e){!p1()&&B6()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function xut(e){p1()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(t=>e(t==null?void 0:t.isConnected)))}function Iut(){var e;return B6()&&cn.getDocument()?((e=cn.getDocument())==null?void 0:e.visibilityState)==="visible":!0}const xR={};class Z3{static get(t){return xR[t]}static set(t,n){xR[t]=n}static delete(t){delete xR[t]}}function Sut(e){const t=wf.decode(e);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Aut({publicKey:e,signature:t,payload:n}){var r;const s=tj(n.method),i=128|parseInt(((r=n.version)==null?void 0:r.toString())||"4"),o=Tut(n.address),a=n.era==="00"?new Uint8Array([0]):tj(n.era);if(a.length!==1&&a.length!==2)throw new Error("Invalid era length");const c=parseInt(n.nonce,16),l=new Uint8Array([c&255,c>>8&255]),u=BigInt(`0x${Nut(n.tip)}`),d=Out(u),h=new Uint8Array([0,...e,o,...t,...a,...l,...d,...s]),f=Put(h.length+1);return new Uint8Array([...f,i,...h])}function _ut(e){const t=tj(e),n=Oq.blake2b(t,void 0,32);return"0x"+Buffer.from(n).toString("hex")}function tj(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map(t=>
vendor: 9,084 bytes, line 78
78parseInt(t,16)))}function Nut(e){return e.startsWith("0x")?e.slice(2):e}function Tut(e){const t=wf.decode(e)[0];return t===42?0:t===60?2:1}function Put(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){const t=e<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(e<1<<30){const t=e<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Out(e){if(e<BigInt(1)<<BigInt(6))return new Uint8Array([Number(e<<BigInt(2))]);if(e<BigInt(1)<<BigInt(14)){const t=e<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(e<BigInt(1)<<BigInt(30)){const t=e<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function kut(e){const t=Uint8Array.from(Buffer.from(e.signature,"hex")),n=Sut(e.transaction.address),r=Aut({publicKey:n,signature:t,payload:e.transaction}),s=Buffer.from(r).toString("hex");return _ut(s)}function YH({logger:e,name:t}){const n=typeof e=="string"?OC({opts:{level:e,name:t}}).logger:e;return n.level=typeof e=="string"?e:e.level,n}var Rut={};const rye="wc",sye=2,nj="core",of=`${rye}@2:${nj}:`,But={logger:"error"},Dut={database:":memory:"},Uut="crypto",_ne="client_ed25519_seed",Lut=V.ONE_DAY,Mut="keychain",jut="0.3",Fut="messages",zut="0.3",qut=V.SIX_HOURS,Wut="publisher",iye="irn",Hut="error",oye="wss://relay.walletconnect.org",Vut="relayer",ps={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Kut="_subscription",Ll={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},Gut=.1,rj="2.23.7",Lr={link_mode:"link_mode",relay:"relay"},NS={inbound:"inbound",outbound:"outbound"},Zut="0.3",Yut="WALLETCONNECT_CLIENT_ID",Nne="WALLETCONNECT_LINK_MODE_APPS",Vc={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Jut="subscription",Xut="0.3",Qut="pairing",edt="0.3",Y3={wc_pairingDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:V.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:V.ONE_DAY,prompt:!1,tag:0},res:{ttl:V.ONE_DAY,prompt:!1,tag:0}}},Q1={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Xu={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},tdt="history",ndt="0.3",rdt="expirer",eu={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},sdt="0.3",idt="verify-api",odt="https://verify.walletconnect.com",aye="https://verify.walletconnect.org",d8=aye,adt=`${d8}/v3`,cdt=[odt,aye],ldt="echo",udt="https://echo.walletconnect.com",_h={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},pp={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Qu={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},O1={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},k1={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},J3={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ddt=.1,hdt="event-client",fdt=86400,pdt="https://pulse.walletconnect.org/batch";function gdt(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),o=i.charCodeAt(0);if(n[o]!==255)throw new TypeError(i+" is ambiguous");n[o]=s}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var p=0,m=0,w=0,C=g.length;w!==C&&g[w]===0;)w++,p++;for(var E=(C-w)*u+1>>>0,b=new Uint8Array(E);w!==C;){for(var S=g[w],v=0,x=E-1;(S!==0||v<m)&&x!==-1;x--,v++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");m=v,w++}for(var A=E-m;A!==E&&b[A]===0;)A++;for(var I=c.repeat(p);A<E;++A)I+=e.charAt(b[A]);return I}function h(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var p=0;if(g[p]!==" "){for(var m=0,w=0;g[p]===c;)m++,p++;for(var C=(g.length-p)*l+1>>>0,E=new Uint8Array(C);g[p];){var b=n[g.charCodeAt(p)];if(b===255)return;for(var S=0,v=C-1;(b!==0||S<w)&&v!==-1;v--,S++)b+=a*E[v]>>>0,E[v]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");w=S,p++}if(g[p]!==" "){for(var x=C-w;x!==C&&E[x]===0;)x++;for(var A=new Uint8Array(m+(C-x)),I=m;x!==C;)A[I++]=E[x++];return A}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var mdt=gdt,wdt=mdt;const cye=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},ydt=e=>new TextEncoder().encode(e),bdt=e=>new TextDecoder().decode(e);let vdt=class{constructor(t,n,r){this.name=t,this.prefix=n,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Edt=class{constructor(t,n,r){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name}
78 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return lye(this,t)}},Cdt=class{constructor(t){this.decoders=t}or(t){return lye(this,t)}decode(t){const n=t[0],r=this.decoders[n];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const lye=(e,t)=>new Cdt({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let $dt=class{constructor(t,n,r,s){this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new vdt(t,n,r),this.decoder=new Edt(t,n,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};const yT=({name:e,prefix:t,encode:n,decode:r})=>new $dt(e,t,n,r),c$=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:s}=wdt(n,t);return yT({prefix:e,name:t,encode:r,decode:i=>cye(s(i))})},xdt=(e,t,n,r)=>{const s={};for(let u=0;u<t.length;++u)s[t[u]]=u;let i=e.length;for(;e[i-1]==="=";)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,l=0;for(let u=0;u<i;++u){const d=s[e[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<n|d,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}
vendor: 62,168 bytes, line 78
78,Idt=(e,t,n)=>{const r=t[t.length-1]==="=",s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>n;)o-=n,i+=t[s&a>>o];if(o&&(i+=t[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i},ro=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>yT({prefix:t,name:e,encode(s){return Idt(s,r,n)},decode(s){return xdt(s,r,n,e)}}),Sdt=yT({prefix:"\0",name:"identity",encode:e=>bdt(e),decode:e=>ydt(e)});var Adt=Object.freeze({__proto__:null,identity:Sdt});const _dt=ro({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ndt=Object.freeze({__proto__:null,base2:_dt});const Tdt=ro({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Pdt=Object.freeze({__proto__:null,base8:Tdt});const Odt=c$({prefix:"9",name:"base10",alphabet:"0123456789"});var kdt=Object.freeze({__proto__:null,base10:Odt});const Rdt=ro({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Bdt=ro({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ddt=Object.freeze({__proto__:null,base16:Rdt,base16upper:Bdt});const Udt=ro({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ldt=ro({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mdt=ro({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),jdt=ro({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fdt=ro({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),zdt=ro({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qdt=ro({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Wdt=ro({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Hdt=ro({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Vdt=Object.freeze({__proto__:null,base32:Udt,base32upper:Ldt,base32pad:Mdt,base32padupper:jdt,base32hex:Fdt,base32hexupper:zdt,base32hexpad:qdt,base32hexpadupper:Wdt,base32z:Hdt});const Kdt=c$({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Gdt=c$({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Zdt=Object.freeze({__proto__:null,base36:Kdt,base36upper:Gdt});const Ydt=c$({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Jdt=c$({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Xdt=Object.freeze({__proto__:null,base58btc:Ydt,base58flickr:Jdt});const Qdt=ro({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),eht=ro({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tht=ro({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),nht=ro({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var rht=Object.freeze({__proto__:null,base64:Qdt,base64pad:eht,base64url:tht,base64urlpad:nht});const uye=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),sht=uye.reduce((e,t,n)=>(e[n]=t,e),[]),iht=uye.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function oht(e){return e.reduce((t,n)=>(t+=sht[n],t),"")}function aht(e){const t=[];for(const n of e){const r=iht[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);t.push(r)}return new Uint8Array(t)}const cht=yT({prefix:"ð",name:"base256emoji",encode:oht,decode:aht});var lht=Object.freeze({__proto__:null,base256emoji:cht}),uht=dye,Tne=128,dht=-128,hht=Math.pow(2,31);function dye(e,t,n){t=t||[],n=n||0;for(var r=n;e>=hht;)t[n++]=e&255|Tne,e/=128;for(;e&dht;)t[n++]=e&255|Tne,e>>>=7;return t[n]=e|0,dye.bytes=n-r+1,t}var fht=sj,pht=128,Pne=127;function sj(e,r){var n=0,r=r||0,s=0,i=r,o,a=e.length;do{if(i>=a)throw sj.bytes=0,new RangeError("Could not decode varint");o=e[i++],n+=s<28?(o&Pne)<<s:(o&Pne)*Math.pow(2,s),s+=7}while(o>=pht);return sj.bytes=i-r,n}var ght=Math.pow(2,7),mht=Math.pow(2,14),wht=Math.pow(2,21),yht=Math.pow(2,28),bht=Math.pow(2,35),vht=Math.pow(2,42),Eht=Math.pow(2,49),Cht=Math.pow(2,56),$ht=Math.pow(2,63),xht=function(e){return e<ght?1:e<mht?2:e<wht?3:e<yht?4:e<bht?5:e<vht?6:e<Eht?7:e<Cht?8:e<$ht?9:10},Iht={encode:uht,decode:fht,encodingLength:xht},hye=Iht;const One=(e,t,n=0)=>(hye.encode(e,t,n),t),kne=e=>hye.encodingLength(e),ij=(e,t)=>{const n=t.byteLength,r=kne(e),s=r+kne(n),i=new Uint8Array(s+n);return One(e,i,0),One(n,i,r),i.set(t,s),new Sht(e,n,t,i)};let Sht=class{constructor(t,n,r,s){this.code=t,this.size=n,this.digest=r,this.bytes=s}};const fye=({name:e,code:t,encode:n})=>new Aht(e,t,n);let Aht=class{constructor(t,n,r){this.name=t,this.code=n,this.encode=r}digest(t){if(t instanceof Uint8Array){const n=this.encode(t);return n instanceof Uint8Array?ij(this.code,n):n.then(r=>ij(this.code,r))}else throw Error("Unknown type, must be binary type")}};const pye=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),_ht=fye({name:"sha2-256",code:18,encode:pye("SHA-256")}),Nht=fye({name:"sha2-512",code:19,encode:pye("SHA-512")});var Tht=Object.freeze({__proto__:null,sha256:_ht,sha512:Nht});const gye=0,Pht="identity",mye=cye,Oht=e=>ij(gye,mye(e)),kht={code:gye,name:Pht,encode:mye,digest:Oht};var Rht=Object.freeze({__proto__:null,identity:kht});new TextEncoder,new TextDecoder;const Rne={...Adt,...Ndt,...Pdt,...kdt,...Ddt,...Vdt,...Zdt,...Xdt,...rht,...lht};({...Tht,...Rht});function wye(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function Bht(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?wye(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function yye(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const Bne=yye("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),IR=yye("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=Bht(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),Dht={utf8:Bne,"utf-8":Bne,hex:Rne.base16,latin1:IR,ascii:IR,binary:IR,...Rne};function Uht(e,t="utf8"){const n=Dht[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?wye(globalThis.Buffer.from(e,"utf-8")):n.decoder.decode(`${n.prefix}${e}`)}var Lht=Object.defineProperty,Mht=(e,t,n)=>t in e?Lht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yh=(e,t,n)=>Mht(e,typeof t!="symbol"?t+"":t,n);let jht=class{constructor(t,n){this.core=t,this.logger=n,yh(this,"keychain",new Map),yh(this,"name",Mut),yh(this,"version",jut),yh(this,"initialized",!1),yh(this,"storagePrefix",of),yh(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),yh(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),yh(this,"set",async(r,s)=>{this.isInitialized(),this.keychain.set(r,s),await this.persist()}),yh(this,"get",r=>{this.isInitialized();const s=this.keychain.get(r);if(typeof s>"u"){const{message:i}=Fe("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(i)}return s}),yh(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=kr(n,this.name)}get context(){return Sr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,zM(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?qM(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}};var Fht=Object.defineProperty,zht=(e,t,n)=>t in e?Fht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,si=(e,t,n)=>zht(e,typeof t!="symbol"?t+"":t,n);let qht=class{constructor(t,n,r){this.core=t,this.logger=n,si(this,"name",Uut),si(this,"keychain"),si(this,"randomSessionIdentifier",ej()),si(this,"initialized",!1),si(this,"clientId"),si(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),si(this,"hasKeys",s=>(this.isInitialized(),this.keychain.has(s))),si(this,"getClientId",async()=>{if(this.isInitialized(),this.clientId)return this.clientId;const s=await this.getClientSeed(),i=jm(s),o=bC(i.publicKey);return this.clientId=o,o}),si(this,"generateKeyPair",()=>{this.isInitialized();const s=ylt();return this.setPrivateKey(s.publicKey,s.privateKey)}),si(this,"signJWT",async s=>{this.isInitialized();const i=await this.getClientSeed(),o=jm(i),a=this.randomSessionIdentifier;return await KN(a,s,Lut,o)}),si(this,"generateSharedKey",(s,i,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=blt(a,i);return this.setSymKey(c,o)}),si(this,"setSymKey",async(s,i)=>{this.isInitialized();const o=i||_S(s);return await this.keychain.set(o,s),o}),si(this,"deleteKeyPair",async s=>{this.isInitialized(),await this.keychain.del(s)}),si(this,"deleteSymKey",async s=>{this.isInitialized(),await this.keychain.del(s)}),si(this,"encode",async(s,i,o)=>{this.isInitialized();const a=Qwe(o),c=Ao(i);if(pne(a))return Clt(c,o==null?void 0:o.encoding);if(fne(a)){const h=a.senderPublicKey,f=a.receiverPublicKey;s=await this.generateSharedKey(h,f)}const l=this.getSymKey(s),{type:u,senderPublicKey:d}=a;return vlt({type:u,symKey:l,message:c,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),si(this,"decode",async(s,i,o)=>{this.isInitialized();const a=xlt(i,o);if(pne(a)){const c=$lt(i,o==null?void 0:o.encoding);return ul(c)}if(fne(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(s),l=Elt({symKey:c,encoded:i,encoding:o==null?void 0:o.encoding});return ul(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),si(this,"getPayloadType",(s,i=Qa)=>{const o=l4({encoded:s,encoding:i});return sy(o.type)}),si(this,"getPayloadSenderPublicKey",(s,i=Qa)=>{const o=l4({encoded:s,encoding:i});return o.senderPublicKey?rn(o.senderPublicKey,oa):void 0}),this.core=t,this.logger=kr(n,this.name),this.keychain=r||new jht(this.core,this.logger)}get context(){return Sr(this.logger)}async setPrivateKey(t,n){return await this.keychain.set(t,n),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(_ne)}catch{t=ej(),await this.keychain.set(_ne,t)}return Uht(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}};var Wht=Object.defineProperty,Hht=Object.defineProperties,Vht=Object.getOwnPropertyDescriptors,Dne=Object.getOwnPropertySymbols,Kht=Object.prototype.hasOwnProperty,Ght=Object.prototype.propertyIsEnumerable,oj=(e,t,n)=>t in e?Wht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zht=(e,t)=>{for(var n in t||(t={}))Kht.call(t,n)&&oj(e,n,t[n]);if(Dne)for(var n of Dne(t))Ght.call(t,n)&&oj(e,n,t[n]);return e},Yht=(e,t)=>Hht(e,Vht(t)),Uc=(e,t,n)=>oj(e,typeof t!="symbol"?t+"":t,n);let Jht=class extends Pst{constructor(t,n){super(t,n),this.logger=t,this.core=n,Uc(this,"messages",new Map),Uc(this,"messagesWithoutClientAck",new Map),Uc(this,"name",Fut),Uc(this,"version",zut),Uc(this,"initialized",!1),Uc(this,"storagePrefix",of),Uc(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Uc(this,"set",async(r,s,i)=>{this.isInitialized();const o=lu(s);let a=this.messages.get(r);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(r,a),i===NS.inbound){const c=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,Yht(Zht({},c),{[o]:s}))}return await this.persist(),o}),Uc(this,"get",r=>{this.isInitialized();let s=this.messages.get(r);return typeof s>"u"&&(s={}),s}),Uc(this,"getWithoutAck",r=>{this.isInitialized();const s={};for(const i of r){const o=this.messagesWithoutClientAck.get(i)||{};s[i]=Object.values(o)}return s}),Uc(this,"has",(r,s)=>{this.isInitialized();const i=this.get(r),o=lu(s);return typeof i[o]<"u"}),Uc(this,"ack",async(r,s)=>{this.isInitialized();const i=this.messagesWithoutClientAck.get(r);if(typeof i>"u")return;const o=lu(s);delete i[o],Object.keys(i).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,i),await this.persist()}),Uc(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=kr(t,this.name),this.core=n}get context(){return Sr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,zM(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,zM(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?qM(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?qM(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}};var Xht=Object.defineProperty,Qht=Object.defineProperties,eft=Object.getOwnPropertyDescriptors,Une=Object.getOwnPropertySymbols,tft=Object.prototype.hasOwnProperty,nft=Object.prototype.propertyIsEnumerable,aj=(e,t,n)=>t in e?Xht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p2=(e,t)=>{for(var n in t||(t={}))tft.call(t,n)&&aj(e,n,t[n]);if(Une)for(var n of Une(t))nft.call(t,n)&&aj(e,n,t[n]);return e},Lne=(e,t)=>Qht(e,eft(t)),Ml=(e,t,n)=>aj(e,typeof t!="symbol"?t+"":t,n);let rft=class extends Ost{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,Ml(this,"events",new Dn.EventEmitter),Ml(this,"name",Wut),Ml(this,"queue",new Map),Ml(this,"publishTimeout",V.toMiliseconds(V.ONE_MINUTE)),Ml(this,"initialPublishTimeout",V.toMiliseconds(V.ONE_SECOND*15)),Ml(this,"needsTransportRestart",!1),Ml(this,"publish",async(r,s,i)=>{var o,a,c,l,u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:s,opts:i}});const d=(i==null?void 0:i.ttl)||qut,h=(i==null?void 0:i.prompt)||!1,f=(i==null?void 0:i.tag)||0,g=(i==null?void 0:i.id)||Ir().toString(),p=vv($A().protocol),m={id:g,method:(i==null?void 0:i.publishMethod)||p.publish,params:p2({topic:r,message:s,ttl:d,prompt:h,tag:f,attestation:i==null?void 0:i.attestation},i==null?void 0:i.tvf)},w=`Failed to publish payload, please try again. id:${g} tag:${f}`;try{bi((o=m.params)==null?void 0:o.prompt)&&((a=m.params)==null||delete a.prompt),bi((c=m.params)==null?void 0:c.tag)&&((l=m.params)==null||delete l.tag);const C=new Promise(async E=>{const b=({id:v})=>{var x;((x=m.id)==null?void 0:x.toString())===v.toString()&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(ps.publish,b),E())};this.relayer.events.on(ps.publish,b);const S=Mh(new Promise((v,x)=>{this.rpcPublish(m,i).then(v).catch(A=>{this.logger.warn(A,A==null?void 0:A.message),x(A)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${g} tag:${f}`);try{await S,this.events.removeListener(ps.publish,b)}catch(v){this.queue.set(g,{request:m,opts:i,attempt:1}),this.logger.warn(v,v==null?void 0:v.message)}});this.logger.trace({type:"method",method:"publish",params:{id:g,topic:r,message:s,opts:i}}),await Mh(C,this.publishTimeout,w)}catch(C){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(C),(u=i==null?void 0:i.internal)!=null&&u.throwOnFailedPublish)throw C}finally{this.queue.delete(g)}}),Ml(this,"publishCustom",async r=>{var s,i,o,a,c;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:l,opts:u={}}=r,{attestation:d,tvf:h,publishMethod:f,prompt:g,tag:p,ttl:m=V.FIVE_MINUTES}=u,w=u.id||Ir().toString(),C=vv($A().protocol),E=f||C.publish,b={id:w,method:E,params:p2(Lne(p2({},l),{ttl:m,prompt:g,tag:p,attestation:d}),h)},S=`Failed to publish custom payload, please try again. id:${w} tag:${p}`;try{bi((s=b.params)==null?void 0:s.prompt)&&((i=b.params)==null||delete i.prompt),bi((o=b.params)==null?void 0:o.tag)&&((a=b.params)==null||delete a.tag);const v=new Promise(async x=>{const A=({id:O})=>{var N;((N=b.id)==null?void 0:N.toString())===O.toString()&&(this.removeRequestFromQueue(O),this.relayer.events.removeListener(ps.publish,A),x())};this.relayer.events.on(ps.publish,A);const I=Mh(new Promise((O,N)=>{this.rpcPublish(b,u).then(O).catch(T=>{this.logger.warn(T,T==null?void 0:T.message),N(T)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${E} id:${w} tag:${p}`);try{await I,this.events.removeListener(ps.publish,A)}catch(O){this.queue.set(w,{request:b,opts:u,attempt:1}),this.logger.warn(O,O==null?void 0:O.message)}});this.logger.trace({type:"method",method:"publish",params:{id:w,payload:l,opts:u}}),await Mh(v,this.publishTimeout,S)}catch(v){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(v),(c=u==null?void 0:u.internal)!=null&&c.throwOnFailedPublish)throw v}finally{this.queue.delete(w)}}),Ml(this,"on",(r,s)=>{this.events.on(r,s)}),Ml(this,"once",(r,s)=>{this.events.once(r,s)}),Ml(this,"off",(r,s)=>{this.events.off(r,s)}),Ml(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.relayer=t,this.logger=kr(n,this.name),this.registerEventListeners()}get context(){return Sr(this.logger)}async rpcPublish(t,n){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const r=await this.relayer.request(t);return this.relayer.events.emit(ps.publish,p2(p2({},t),n)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,n)=>{var r;const s=t.attempt+1;this.queue.set(n,Lne(p2({},t),{attempt:s})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${s}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Hr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ps.connection_stalled);return}this.checkQueue()}),this.relayer.on(ps.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}};var sft=Object.defineProperty,ift=(e,t,n)=>t in e?sft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g2=(e,t,n)=>ift(e,typeof t!="symbol"?t+"":t,n);let oft=class{constructor(){g2(this,"map",new Map),g2(this,"set",(t,n)=>{const r=this.get(t);this.exists(t,n)||this.map.set(t,[...r,n])}),g2(this,"get",t=>this.map.get(t)||[]),g2(this,"exists",(t,n)=>this.get(t).includes(n)),g2(this,"delete",(t,n)=>{if(typeof n>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,n))return;const s=r.filter(i=>i!==n);if(!s.length){this.map.delete(t);return}this.map.set(t,s)}),g2(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}};var aft=Object.defineProperty,cft=Object.defineProperties,lft=Object.getOwnPropertyDescriptors,Mne=Object.getOwnPropertySymbols,uft=Object.prototype.hasOwnProperty,dft=Object.prototype.propertyIsEnumerable,cj=(e,t,n)=>t in e?aft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X3=(e,t)=>{for(var n in t||(t={}))uft.call(t,n)&&cj(e,n,t[n]);if(Mne)for(var n of Mne(t))dft.call(t,n)&&cj(e,n,t[n]);return e},SR=(e,t)=>cft(e,lft(t)),vr=(e,t,n)=>cj(e,typeof t!="symbol"?t+"":t,n);let hft=class extends Bst{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,vr(this,"subscriptions",new Map),vr(this,"topicMap",new oft),vr(this,"events",new Dn.EventEmitter),vr(this,"name",Jut),vr(this,"version",Xut),vr(this,"pending",new Map),vr(this,"cached",[]),vr(this,"initialized",!1),vr(this,"storagePrefix",of),vr(this,"subscribeTimeout",V.toMiliseconds(V.ONE_MINUTE)),vr(this,"initialSubscribeTimeout",V.toMiliseconds(V.ONE_SECOND*15)),vr(this,"clientId"),vr(this,"batchSubscribeTopicsLimit",500),vr(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),vr(this,"subscribe",async(r,s)=>{var i;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}});try{const o=$A(s),a={topic:r,relay:o,transportType:s==null?void 0:s.transportType};(i=s==null?void 0:s.internal)!=null&&i.skipSubscribe||this.pending.set(r,a);const c=await this.rpcSubscribe(r,o,s);return typeof c=="string"&&(this.onSubscribe(c,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}})),c}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),vr(this,"unsubscribe",async(r,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(r,s.id,s):await this.unsubscribeByTopic(r,s)}),vr(this,"isSubscribed",r=>new Promise(s=>{s(this.topicMap.topics.includes(r))})),vr(this,"isKnownTopic",r=>new Promise(s=>{s(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(i=>i.topic===r))})),vr(this,"on",(r,s)=>{this.events.on(r,s)}),vr(this,"once",(r,s)=>{this.events.once(r,s)}),vr(this,"off",(r,s)=>{this.events.off(r,s)}),vr(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),vr(this,"start",async()=>{await this.onConnect()}),vr(this,"stop",async()=>{await this.onDisconnect()}),vr(this,"restart",async()=>{await this.restore(),await this.onRestart()}),vr(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(s=>{r.push(s)}),await this.batchSubscribe(r)}),vr(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Hr.pulse,async()=>{await this.checkPending()}),this.events.on(Vc.created,async r=>{const s=Vc.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()}),this.events.on(Vc.deleted,async r=>{const s=Vc.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()})}),this.relayer=t,this.logger=kr(n,this.name),this.clientId=""}get context(){return Sr(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}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,n){let r=!1;try{r=this.getSubscription(t).topic===n}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,n){const r=this.topicMap.get(t);await Promise.all(r.map(async s=>await this.unsubscribeById(t,s,n)))}async unsubscribeById(t,n,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}});try{const s=$A(r);await this.restartToComplete({topic:t,id:n,relay:s}),await this.rpcUnsubscribe(t,n,s);const i=Jr("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,n,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(t,n,r){var s,i;const o=await this.getSubscriptionId(t);if((s=r==null?void 0:r.internal)!=null&&s.skipSubscribe)return o;(!r||(r==null?void 0:r.transportType)===Lr.relay)&&await this.restartToComplete({topic:t,id:t,relay:n});const a={method:vv(n.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a});const c=(i=r==null?void 0:r.internal)==null?void 0:i.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===Lr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(a).catch(d=>this.logger.warn(d))},V.toMiliseconds(V.ONE_SECOND)),o;const l=new Promise(async d=>{const h=f=>{f.topic===t&&(this.events.removeListener(Vc.created,h),d(f.id))};this.events.on(Vc.created,h);try{const f=await Mh(new Promise((g,p)=>{this.relayer.request(a).catch(m=>{this.logger.warn(m,m==null?void 0:m.message),p(m)}).then(g)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(Vc.created,h),d(f)}catch{}}),u=await Mh(l,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!u&&c)throw new Error(`Subscribing to ${t} failed, please try again`);return u?o:null}catch(l){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ps.connection_stalled),c)throw l}return null}async rpcBatchSubscribe(t){if(!t.length)return!0;const n=t[0].relay,r={method:vv(n.protocol).batchSubscribe,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{return await Mh(new Promise((s,i)=>{this.relayer.request(r).then(s).catch(o=>{this.logger.warn(o),i(o)})}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again"),!0}catch{return this.relayer.events.emit(ps.connection_stalled),!1}}async rpcBatchFetchMessages(t){if(!t.length)return;const n=t[0].relay,r={method:vv(n.protocol).batchFetchMessages,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let s;try{s=await await Mh(new Promise((i,o)=>{this.relayer.request(r).catch(a=>{this.logger.warn(a),o(a)}).then(i)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(ps.connection_stalled)}return s}rpcUnsubscribe(t,n,r){const s={method:vv(r.protocol).unsubscribe,params:{topic:t,id:n}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(t,n){this.setSubscription(t,SR(X3({},n),{id:t})),this.pending.delete(n.topic)}onBatchSubscribe(t){t.length&&t.forEach(n=>{this.setSubscription(n.id,X3({},n)),this.pending.delete(n.topic)})}async onUnsubscribe(t,n,r){this.events.removeAllListeners(n),this.hasSubscription(n,t)&&this.deleteSubscription(n,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,n){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:n}),this.addSubscription(t,n)}addSubscription(t,n){this.subscriptions.set(t,X3({},n)),this.topicMap.set(n.topic,t),this.events.emit(Vc.created,n)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const n=this.subscriptions.get(t);if(!n){const{message:r}=Fe("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}deleteSubscription(t,n){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:n});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(Vc.deleted,SR(X3({},r),{reason:n}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Vc.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],n=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<n;r++){const s=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(Vc.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(n=>{var r;return n.topic===((r=this.subscriptions.get(n.id))==null?void 0:r.topic)})){const{message:n}=Fe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){if(t.length){if(!await this.rpcBatchSubscribe(t)){this.logger.warn(`Batch subscribe failed for ${t.length} topics, adding to pending for retry`),t.forEach(n=>{this.pending.set(n.topic,n)});return}this.onBatchSubscribe(await Promise.all(t.map(async n=>SR(X3({},n),{id:await this.getSubscriptionId(n.topic)}))))}}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const n=await this.rpcBatchFetchMessages(t);n&&n.messages&&(await Lot(V.toMiliseconds(V.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(n.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return lu(t+await this.getClientId())}};var fft=Object.defineProperty,jne=Object.getOwnPropertySymbols,pft=Object.prototype.hasOwnProperty,gft=Object.prototype.propertyIsEnumerable,lj=(e,t,n)=>t in e?fft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fne=(e,t)=>{for(var n in t||(t={}))pft.call(t,n)&&lj(e,n,t[n]);if(jne)for(var n of jne(t))gft.call(t,n)&&lj(e,n,t[n]);return e},gn=(e,t,n)=>lj(e,typeof t!="symbol"?t+"":t,n);let mft=class extends kst{constructor(t){var n;super(t),gn(this,"protocol","wc"),gn(this,"version",2),gn(this,"core"),gn(this,"logger"),gn(this,"events",new Dn.EventEmitter),gn(this,"provider"),gn(this,"messages"),gn(this,"subscriber"),gn(this,"publisher"),gn(this,"name",Vut),gn(this,"transportExplicitlyClosed",!1),gn(this,"initialized",!1),gn(this,"connectionAttemptInProgress",!1),gn(this,"relayUrl"),gn(this,"projectId"),gn(this,"packageName"),gn(this,"bundleId"),gn(this,"hasExperiencedNetworkDisruption",!1),gn(this,"pingTimeout"),gn(this,"heartBeatTimeout",V.toMiliseconds(V.THIRTY_SECONDS+V.FIVE_SECONDS)),gn(this,"reconnectTimeout"),gn(this,"connectPromise"),gn(this,"reconnectInProgress",!1),gn(this,"requestsInFlight",[]),gn(this,"connectTimeout",V.toMiliseconds(V.ONE_SECOND*15)),gn(this,"stalledRestartInProgress",!1),gn(this,"stalledRestartTimeout"),gn(this,"stalledRestartBackoff",0),gn(this,"stalledRestartBaseInterval",V.toMiliseconds(V.ONE_SECOND*2)),gn(this,"stalledRestartMaxInterval",V.toMiliseconds(V.THIRTY_SECONDS)),gn(this,"request",async r=>{var s,i;this.logger.debug("Publishing Request Payload");const o=r.id||Ir().toString();await this.toEstablishConnection();try{this.logger.trace({id:o,method:r.method,topic:(s=r.params)==null?void 0:s.topic},"relayer.request - publishing...");const a=`${o}:${((i=r.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(a);const c=await this.provider.request(r);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==a),c}catch(a){throw this.logger.debug(`Failed to Publish Request: ${o}`),a}}),gn(this,"resetPingTimeout",()=>{wA()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,s,i,o;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(o=(i=(s=(r=this.provider)==null?void 0:r.connection)==null?void 0:s.socket)==null?void 0:i.terminate)==null||o.call(i)}catch(a){this.logger.warn(a,a==null?void 0:a.message)}},this.heartBeatTimeout))}),gn(this,"onPayloadHandler",r=>{this.onProviderPayload(r),this.resetPingTimeout()}),gn(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected ð"),this.startPingTimeout(),this.events.emit(ps.connect)}),gn(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected ð"),this.requestsInFlight=[],this.onProviderDisconnect()}),gn(this,"onProviderErrorHandler",r=>{this.logger.fatal(`Fatal socket error: ${r.message}`),this.events.emit(ps.error,r),this.logger.fatal("Fatal socket error received, closing transport"),this.transportExplicitlyClosed=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.reconnectInProgress=!1,this.transportClose().catch(s=>this.logger.warn(s))}),gn(this,"registerProviderListeners",()=>{this.provider.on(Ll.payload,this.onPayloadHandler),this.provider.on(Ll.connect,this.onConnectHandler),this.provider.on(Ll.disconnect,this.onDisconnectHandler),this.provider.on(Ll.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=YH({logger:(n=t.logger)!=null?n:Hut,name:this.name}),this.messages=new Jht(this.logger,t.core),this.subscriber=new hft(this,this.logger),this.publisher=new rft(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||oye,Cot()?this.packageName=Bte():$ot()&&(this.bundleId=Bte()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return Sr(this.logger)}get connected(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,n,r){this.isInitialized(),await this.publisher.publish(t,n,r),await this.recordMessageEvent({topic:t,message:n,publishedAt:Date.now(),transportType:Lr.relay},NS.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,n){var r,s,i;this.isInitialized(),(!(n!=null&&n.transportType)||(n==null?void 0:n.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=n==null?void 0:n.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;let a=((i=this.subscriber.topicMap.get(t))==null?void 0:i[0])||"",c;const l=u=>{u.topic===t&&(this.subscriber.off(Vc.created,l),c())};return await Promise.all([new Promise(u=>{c=u,this.subscriber.on(Vc.created,l)}),new Promise(async(u,d)=>{a=await this.subscriber.subscribe(t,Fne({internal:{throwOnFailedPublish:o}},n)).catch(h=>{o&&d(h)})||a,u()})]),a}async unsubscribe(t,n){this.isInitialized(),await this.subscriber.unsubscribe(t,n)}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Mh(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,clearTimeout(this.stalledRestartTimeout),this.stalledRestartInProgress=!1,this.stalledRestartBackoff=0,await this.resetTransport()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(n,r)=>{await this.connect(t).then(n).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.resetTransport(),await this.transportOpen())}async resetTransport(){this.reconnectInProgress=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,await this.transportDisconnect(),await this.subscriber.stop(),this.reconnectInProgress=!1}async confirmOnlineStateOrThrow(){if(!await Ane())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const n=t.sort((r,s)=>r.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${n.length} message events sorted`);for(const r of n)try{await this.onMessageEvent(r)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${n.length} message events processed`)}async onLinkMessageEvent(t,n){const{topic:r}=t;if(!n.sessionExists){const s=As(V.FIVE_MINUTES),i={topic:r,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,i)}this.events.emit(ps.message,t),await this.recordMessageEvent(t,NS.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let n=1;for(;n<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${n}...`),await this.createProvider(),await new Promise(async(r,s)=>{const i=()=>{s(new Error("Connection interrupted while trying to connect"))};this.provider.once(Ll.disconnect,i),await Mh(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(Ll.disconnect,i),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Ll.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(Ll.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const s=r;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${n}`);break}await new Promise(r=>setTimeout(r,V.toMiliseconds(n*1))),n++}}startPingTimeout(){var t,n,r,s,i;if(wA())try{(n=(t=this.provider)==null?void 0:t.connection)!=null&&n.socket&&((i=(s=(r=this.provider)==null?void 0:r.connection)==null?void 0:s.socket)==null||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new or(new o7(_ot({sdkVersion:rj,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,n){const{topic:r,message:s}=t;await this.messages.set(r,s,n)}async shouldIgnoreMessageEvent(t){const{topic:n,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(n))return this.logger.warn(`Ignoring message for unknown topic ${n}`),!0;const s=this.messages.has(n,r);return s&&this.logger.warn(`Ignoring duplicate message: ${r}`),s}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Du(t)){if(!t.method.endsWith(Kut))return;const n=t.params,{topic:r,message:s,publishedAt:i,attestation:o}=n.data,a={topic:r,message:s,publishedAt:i,transportType:Lr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Fne({type:"event",event:n.id},a)),this.events.emit(n.id,a),await this.acknowledgePayload(t),await this.onMessageEvent(a)}else Sl(t)&&this.events.emit(ps.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,NS.inbound),this.events.emit(ps.message,t))}async acknowledgePayload(t){const n=Pi(t.id,!0);await this.provider.connection.send(n)}unregisterProviderListeners(){this.provider.off(Ll.payload,this.onPayloadHandler),this.provider.off(Ll.connect,this.onConnectHandler),this.provider.off(Ll.disconnect,this.onDisconnectHandler),this.provider.off(Ll.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ane();Cut(async n=>{t!==n&&(t=n,n?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Hr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Iut())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(n){this.logger.warn(n,n==null?void 0:n.message)}}),this.events.on(ps.connection_stalled,()=>{if(this.transportExplicitlyClosed||this.stalledRestartInProgress)return;this.stalledRestartInProgress=!0;const n=this.stalledRestartBackoff===0?0:Math.min(Math.pow(2,this.stalledRestartBackoff-1)*this.stalledRestartBaseInterval,this.stalledRestartMaxInterval);this.stalledRestartBackoff++,this.logger.warn(`Connection stalled, restarting transport${n?` in ${n}ms`:""}...`),this.stalledRestartTimeout=setTimeout(async()=>{try{if(this.transportExplicitlyClosed)return;await this.restartTransport()}catch(r){this.logger.error(r,r==null?void 0:r.message)}finally{this.stalledRestartInProgress=!1}},n)})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(ps.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},V.toMiliseconds(Gut)))))}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}};function wft(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function zne(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function qne(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const yft="[object RegExp]",bft="[object String]",vft="[object Number]",Eft="[object Boolean]",Wne="[object Arguments]",Cft="[object Symbol]",$ft="[object Date]",xft="[object Map]",Ift="[object Set]",Sft="[object Array]",Aft="[object Function]",_ft="[object ArrayBuffer]",AR="[object Object]",Nft="[object Error]",Tft="[object DataView]",Pft="[object Uint8Array]",Oft="[object Uint8ClampedArray]",kft="[object Uint16Array]",Rft="[object Uint32Array]",Bft="[object BigUint64Array]",Dft="[object Int8Array]",Uft="[object Int16Array]",Lft="[object Int32Array]",Mft="[object BigInt64Array]",jft="[object Float32Array]",Fft="[object Float64Array]";function Hne(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)==="[object Object]":!1}function zft(e,t,n){return DE(e,t,void 0,void 0,void 0,void 0,n)}function DE(e,t,n,r,s,i,o){const a=o(e,t,n,r,s,i);if(a!==void 0)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return e===t;case"number":return e===t||Object.is(e,t);case"function":return e===t;case"object":return h8(e,t,i,o)}return h8(e,t,i,o)}function h8(e,t,n,r){if(Object.is(e,t))return!0;let s=qne(e),i=qne(t);if(s===Wne&&(s=AR),i===Wne&&(i=AR),s!==i)return!1;switch(s){case bft:return e.toString()===t.toString();case vft:{const c=e.valueOf(),l=t.valueOf();return wft(c,l)}case Eft:case $ft:case Cft:return Object.is(e.valueOf(),t.valueOf());case yft:return e.source===t.source&&e.flags===t.flags;case Aft:return e===t}n=n??new Map;const o=n.get(e),a=n.get(t);if(o!=null&&a!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(s){case xft:{if(e.size!==t.size)return!1;for(const[c,l]of e.entries())if(!t.has(c)||!DE(l,t.get(c),c,e,t,n,r))return!1;return!0}case Ift:{if(e.size!==t.size)return!1;const c=Array.from(e.values()),l=Array.from(t.values());for(let u=0;u<c.length;u++){const d=c[u],h=l.findIndex(f=>DE(d,f,void 0,e,t,n,r));if(h===-1)return!1;l.splice(h,1)}return!0}case Sft:case Pft:case Oft:case kft:case Rft:case Bft:case Dft:case Uft:case Lft:case Mft:case jft:case Fft:{if(typeof Buffer<"u"&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let c=0;c<e.length;c++)if(!DE(e[c],t[c],c,e,t,n,r))return!1;return!0}case _ft:return e.byteLength!==t.byteLength?!1:h8(new Uint8Array(e),new Uint8Array(t),n,r);case Tft:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:h8(new Uint8Array(e),new Uint8Array(t),n,r);case Nft:return e.name===t.name&&e.message===t.message;case AR:{if(!(h8(e.constructor,t.constructor,n,r)||Hne(e)&&Hne(t)))return!1;const c=[...Object.keys(e),...zne(e)],l=[...Object.keys(t),...zne(t)];if(c.length!==l.length)return!1;for(let u=0;u<c.length;u++){const d=c[u],h=e[d];if(!Object.hasOwn(t,d))return!1;const f=t[d];if(!DE(h,f,d,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function qft(){}function Wft(e,t){return zft(e,t,qft)}var Hft=Object.defineProperty,Vne=Object.getOwnPropertySymbols,Vft=Object.prototype.hasOwnProperty,Kft=Object.prototype.propertyIsEnumerable,uj=(e,t,n)=>t in e?Hft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kne=(e,t)=>{for(var n in t||(t={}))Vft.call(t,n)&&uj(e,n,t[n]);if(Vne)for(var n of Vne(t))Kft.call(t,n)&&uj(e,n,t[n]);return e},_a=(e,t,n)=>uj(e,typeof t!="symbol"?t+"":t,n);let mb=class extends Rst{constructor(t,n,r,s=of,i=void 0){super(t,n,r,s),this.core=t,this.logger=n,this.name=r,_a(this,"map",new Map),_a(this,"version",Zut),_a(this,"cached",[]),_a(this,"initialized",!1),_a(this,"getKey"),_a(this,"storagePrefix",of),_a(this,"recentlyDeleted",[]),_a(this,"recentlyDeletedLimit",200),_a(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!bi(o)?this.map.set(this.getKey(o),o):Qlt(o)?this.map.set(o.id,o):eut(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),_a(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),_a(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),_a(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>Wft(a[c],o[c]))):this.values)),_a(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=Kne(Kne({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),_a(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=kr(n,this.name),this.storagePrefix=s,this.getKey=i}get context(){return Sr(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const n=this.map.get(t);if(!n){if(this.recentlyDeleted.includes(t)){const{message:s}=Fe("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}const{message:r}=Fe("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return n}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:n}=Fe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}};var Gft=Object.defineProperty,Zft=(e,t,n)=>t in e?Gft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$n=(e,t,n)=>Zft(e,typeof t!="symbol"?t+"":t,n);let Yft=class{constructor(t,n){this.core=t,this.logger=n,$n(this,"name",Qut),$n(this,"version",edt),$n(this,"events",new Bu),$n(this,"pairings"),$n(this,"initialized",!1),$n(this,"storagePrefix",of),$n(this,"ignoredPayloadTypes",[o0]),$n(this,"registeredMethods",[]),$n(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),$n(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),$n(this,"create",async r=>{this.isInitialized();const s=ej(),i=await this.core.crypto.setSymKey(s),o=As(V.FIVE_MINUTES),a={protocol:iye},c={topic:i,expiry:o,relay:a,active:!1,methods:r==null?void 0:r.methods},l=yne({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:s,relay:a,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(Q1.create,c),this.core.expirer.set(i,o),await this.pairings.set(i,c),await this.core.relayer.subscribe(i,{transportType:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:i,uri:l}}),$n(this,"pair",async r=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[_h.pairing_started]}});this.isValidPair(r,s);const{topic:i,symKey:o,relay:a,expiryTimestamp:c,methods:l}=wne(r.uri);s.props.properties.topic=i,s.addTrace(_h.pairing_uri_validation_success),s.addTrace(_h.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(i)){if(u=this.pairings.get(i),s.addTrace(_h.existing_pairing),u.active)throw s.setError(pp.active_pairing_already_exists),new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);s.addTrace(_h.pairing_not_expired)}const d=c||As(V.FIVE_MINUTES),h={topic:i,relay:a,expiry:d,active:!1,methods:l};this.core.expirer.set(i,d),await this.pairings.set(i,h),s.addTrace(_h.store_new_pairing),r.activatePairing&&await this.activate({topic:i}),this.events.emit(Q1.create,h),s.addTrace(_h.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(o,i),s.addTrace(_h.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(pp.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:a})}catch(f){throw s.setError(pp.subscribe_pairing_topic_failure),f}return s.addTrace(_h.subscribe_pairing_topic_success),h}),$n(this,"activate",async({topic:r})=>{this.isInitialized();const s=As(V.FIVE_MINUTES);this.core.expirer.set(r,s),await this.pairings.update(r,{active:!0,expiry:s})}),$n(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=r;if(this.pairings.keys.includes(s)){const i=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=H1();this.events.once(ur("pairing_ping",i),({error:l})=>{l?c(l):a()}),await o()}}),$n(this,"updateExpiry",async({topic:r,expiry:s})=>{this.isInitialized(),await this.pairings.update(r,{expiry:s})}),$n(this,"updateMetadata",async({topic:r,metadata:s})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:s})}),$n(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),$n(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:s}=r;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",Jr("USER_DISCONNECTED")),await this.deletePairing(s))}),$n(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:s,relay:i,expiry:o,methods:a}=r,c=this.core.crypto.keychain.get(s);return yne({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:i,expiryTimestamp:o,methods:a})}),$n(this,"sendRequest",async(r,s,i)=>{const o=_n(s,i),a=await this.core.crypto.encode(r,o),c=Y3[s].req;return this.core.history.set(r,o),this.core.relayer.publish(r,a,c),o.id}),$n(this,"sendResult",async(r,s,i)=>{const o=Pi(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=Y3[c].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),$n(this,"sendError",async(r,s,i)=>{const o=yf(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=Y3[c]?Y3[c].res:Y3.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),$n(this,"deletePairing",async(r,s)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,Jr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),s?Promise.resolve():this.core.expirer.del(r)])}),$n(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(s=>Rh(s.expiry));await Promise.all(r.map(s=>this.deletePairing(s.topic)))}),$n(this,"onRelayEventRequest",async r=>{const{topic:s,payload:i}=r;switch(i.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,i);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,i);default:return await this.onUnknownRpcMethodRequest(s,i)}}),$n(this,"onRelayEventResponse",async r=>{const{topic:s,payload:i}=r,o=(await this.core.history.get(s,i.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,i);default:return this.onUnknownRpcMethodResponse(o)}}),$n(this,"onPairingPingRequest",async(r,s)=>{const{id:i}=s;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.events.emit(Q1.ping,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}}),$n(this,"onPairingPingResponse",(r,s)=>{const{id:i}=s;setTimeout(()=>{wn(s)?this.events.emit(ur("pairing_ping",i),{}):nn(s)&&this.events.emit(ur("pairing_ping",i),{error:s.error})},500)}),$n(this,"onPairingDeleteRequest",async(r,s)=>{const{id:i}=s;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(Q1.delete,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}}),$n(this,"onUnknownRpcMethodRequest",async(r,s)=>{const{id:i,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=Jr("WC_METHOD_UNSUPPORTED",o);await this.sendError(i,r,a),this.logger.error(a)}catch(a){await this.sendError(i,r,a),this.logger.error(a)}}),$n(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(Jr("WC_METHOD_UNSUPPORTED",r))}),$n(this,"isValidPair",(r,s)=>{var i;if(!za(r)){const{message:a}=Fe("MISSING_OR_INVALID",`pair() params: ${r}`);throw s.setError(pp.malformed_pairing_uri),new Error(a)}if(!Xlt(r.uri)){const{message:a}=Fe("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw s.setError(pp.malformed_pairing_uri),new Error(a)}const o=wne(r==null?void 0:r.uri);if(!((i=o==null?void 0:o.relay)!=null&&i.protocol)){const{message:a}=Fe("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(pp.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=Fe("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(pp.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&V.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){s.setError(pp.pairing_expired);const{message:a}=Fe("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),$n(this,"isValidPing",async r=>{if(!za(r)){const{message:i}=Fe("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)}),$n(this,"isValidDisconnect",async r=>{if(!za(r)){const{message:i}=Fe("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)}),$n(this,"isValidPairingTopic",async r=>{if(!Ts(r,!1)){const{message:s}=Fe("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(s)}if(!this.pairings.keys.includes(r)){const{message:s}=Fe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(s)}if(Rh(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:s}=Fe("EXPIRED",`pairing topic: ${r}`);throw new Error(s)}}),this.core=t,this.logger=kr(n,this.name),this.pairings=new mb(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Sr(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(ps.message,async t=>{const{topic:n,message:r,transportType:s}=t;if(this.pairings.keys.includes(n)&&s!==Lr.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const i=await this.core.crypto.decode(n,r);Du(i)?(this.core.history.set(n,i),await this.onRelayEventRequest({topic:n,payload:i})):Sl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:n,payload:i}),this.core.history.delete(n,i.id)),await this.core.relayer.messages.ack(n,r)}catch(i){this.logger.error(i)}})}registerExpirerEvents(){this.core.expirer.on(eu.expired,async t=>{const{topic:n}=twe(t.target);n&&this.pairings.keys.includes(n)&&(await this.deletePairing(n,!0),this.events.emit(Q1.expire,{topic:n}))})}};var Jft=Object.defineProperty,Xft=(e,t,n)=>t in e?Jft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mi=(e,t,n)=>Xft(e,typeof t!="symbol"?t+"":t,n);let Qft=class extends Tst{constructor(t,n){super(t,n),this.core=t,this.logger=n,Mi(this,"records",new Map),Mi(this,"events",new Dn.EventEmitter),Mi(this,"name",tdt),Mi(this,"version",ndt),Mi(this,"cac
78hed",[]),Mi(this,"initialized",!1),Mi(this,"storagePrefix",of),Mi(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Mi(this,"set",(r,s,i)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:s,chainId:i}),this.records.has(s.id))return;const o={id:s.id,topic:r,request:{method:s.method,params:s.params||null},chainId:i,expiry:As(V.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Xu.created,o)}),Mi(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const s=await this.getRecord(r.id);typeof s.response>"u"&&(s.response=nn(r)?{error:r.error}:{result:r.result},this.records.set(s.id,s),this.persist(),this.events.emit(Xu.updated,s))}),Mi(this,"get",async(r,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:s}),await this.getRecord(s))),Mi(this,"delete",(r,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(i=>{if(i.topic===r){if(typeof s<"u"&&i.id!==s)return;this.records.delete(i.id),this.events.emit(Xu.deleted,i)}}),this.persist()}),Mi(this,"exists",async(r,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===r:!1)),Mi(this,"on",(r,s)=>{this.events.on(r,s)}),Mi(this,"once",(r,s)=>{this.events.once(r,s)}),Mi(this,"off",(r,s)=>{this.events.off(r,s)}),Mi(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=kr(n,this.name)}get context(){return Sr(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(){const t=[];return this.values.forEach(n=>{if(typeof n.response<"u")return;const r={topic:n.topic,request:_n(n.request.method,n.request.params,n.id),chainId:n.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const n=this.records.get(t);if(!n){const{message:r}=Fe("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Xu.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:n}=Fe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(Xu.created,t=>{const n=Xu.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(Xu.updated,t=>{const n=Xu.updated;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(Xu.deleted,t=>{const n=Xu.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.core.heartbeat.on(Hr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(n=>{V.toMiliseconds(n.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${n.id}`),this.records.delete(n.id),this.events.emit(Xu.deleted,n,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}};
vendor: 79,825 bytes, line 78
78var ept=Object.defineProperty,tpt=(e,t,n)=>t in e?ept(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vo=(e,t,n)=>tpt(e,typeof t!="symbol"?t+"":t,n);let npt=class extends Dst{constructor(t,n){super(t,n),this.core=t,this.logger=n,vo(this,"expirations",new Map),vo(this,"events",new Dn.EventEmitter),vo(this,"name",rdt),vo(this,"version",sdt),vo(this,"cached",[]),vo(this,"initialized",!1),vo(this,"storagePrefix",of),vo(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),vo(this,"has",r=>{try{const s=this.formatTarget(r);return typeof this.getExpiration(s)<"u"}catch{return!1}}),vo(this,"set",(r,s)=>{this.isInitialized();const i=this.formatTarget(r),o={target:i,expiry:s};this.expirations.set(i,o),this.checkExpiry(i,o),this.events.emit(eu.created,{target:i,expiration:o})}),vo(this,"get",r=>{this.isInitialized();const s=this.formatTarget(r);return this.getExpiration(s)}),vo(this,"del",r=>{if(this.isInitialized(),this.has(r)){const s=this.formatTarget(r),i=this.getExpiration(s);this.expirations.delete(s),this.events.emit(eu.deleted,{target:s,expiration:i})}}),vo(this,"on",(r,s)=>{this.events.on(r,s)}),vo(this,"once",(r,s)=>{this.events.once(r,s)}),vo(this,"off",(r,s)=>{this.events.off(r,s)}),vo(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=kr(n,this.name)}get context(){return Sr(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(t){if(typeof t=="string")return Not(t);if(typeof t=="number")return Tot(t);const{message:n}=Fe("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(n)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(eu.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:n}=Fe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const n=this.expirations.get(t);if(!n){const{message:r}=Fe("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return n}checkExpiry(t,n){const{expiry:r}=n;V.toMiliseconds(r)-Date.now()<=0&&this.expire(t,n)}expire(t,n){this.expirations.delete(t),this.events.emit(eu.expired,{target:t,expiration:n})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,n)=>this.checkExpiry(n,t))}registerEventListeners(){this.core.heartbeat.on(Hr.pulse,()=>this.checkExpirations()),this.events.on(eu.created,t=>{const n=eu.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(eu.expired,t=>{const n=eu.expired;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(eu.deleted,t=>{const n=eu.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}};var rpt=Object.defineProperty,spt=(e,t,n)=>t in e?rpt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xs=(e,t,n)=>spt(e,typeof t!="symbol"?t+"":t,n);let ipt=class extends Ust{constructor(t,n,r){super(t,n,r),this.core=t,this.logger=n,this.store=r,xs(this,"name",idt),xs(this,"abortController"),xs(this,"isDevEnv"),xs(this,"verifyUrlV3",adt),xs(this,"storagePrefix",of),xs(this,"version",sye),xs(this,"publicKey"),xs(this,"fetchPromise"),xs(this,"init",async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&V.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),xs(this,"register",async s=>{if(!B6()||this.isDevEnv)return;const i=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${i}&id=${o}&decryptedId=${a}`;try{const l=cn.getDocument(),u=this.startAbortTimer(V.ONE_SECOND*5),d=await new Promise((h,f)=>{const g=()=>{window.removeEventListener("message",m),l.body.removeChild(p),f("attestation aborted")};this.abortController.signal.addEventListener("abort",g);const p=l.createElement("iframe");p.src=c,p.style.display="none",p.addEventListener("error",g,{signal:this.abortController.signal});const m=w=>{if(w.data&&typeof w.data=="string")try{const C=JSON.parse(w.data);if(C.type==="verify_attestation"){if(wu(C.attestation).payload.id!==o)return;clearInterval(u),l.body.removeChild(p),this.abortController.signal.removeEventListener("abort",g),window.removeEventListener("message",m),h(C.attestation===null?"":C.attestation)}}catch(C){this.logger.warn(C)}};l.body.appendChild(p),window.addEventListener("message",m,{signal:this.abortController.signal})});return this.logger.debug(d,"jwt attestation"),d}catch(l){this.logger.warn(l)}return""}),xs(this,"resolve",async s=>{if(this.isDevEnv)return"";const{attestationId:i,hash:o,encryptedId:a}=s;if(i===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(i){if(wu(i).payload.id!==a)return;const l=await this.isValidJwtAttestation(i);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)}),xs(this,"fetchAttestation",async(s,i)=>{this.logger.debug(`resolving attestation: ${s} from url: ${i}`);const o=this.startAbortTimer(V.ONE_SECOND*5),a=await fetch(`${i}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),xs(this,"getVerifyUrl",s=>{let i=s||d8;return cdt.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${d8}`),i=d8),i}),xs(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(V.FIVE_SECONDS),i=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await i.json()}catch(s){this.logger.warn(s)}}),xs(this,"persistPublicKey",async s=>{this.logger.debug(s,"persisting public key to local storage"),await this.store.setItem(this.storeKey,s),this.publicKey=s}),xs(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),xs(this,"isValidJwtAttestation",async s=>{const i=await this.getPublicKey();try{if(i)return this.validateAttestation(s,i)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),xs(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),xs(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async i=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),i(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s}),xs(this,"validateAttestation",(s,i)=>{const o=Slt(s,i.publicKey),a={hasExpired:V.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=kr(n,this.name),this.abortController=new AbortController,this.isDevEnv=MH(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Sr(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),V.toMiliseconds(t))}};var opt=Object.defineProperty,apt=(e,t,n)=>t in e?opt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gne=(e,t,n)=>apt(e,typeof t!="symbol"?t+"":t,n);let cpt=class extends Lst{constructor(t,n){super(t,n),this.projectId=t,this.logger=n,Gne(this,"context",ldt),Gne(this,"registerDeviceToken",async r=>{const{clientId:s,token:i,notificationType:o,enableEncrypted:a=!1}=r,c=`${udt}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:i,always_raw:a})})}),this.logger=kr(n,this.context)}};var lpt=Object.defineProperty,Zne=Object.getOwnPropertySymbols,upt=Object.prototype.hasOwnProperty,dpt=Object.prototype.propertyIsEnumerable,dj=(e,t,n)=>t in e?lpt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q3=(e,t)=>{for(var n in t||(t={}))upt.call(t,n)&&dj(e,n,t[n]);if(Zne)for(var n of Zne(t))dpt.call(t,n)&&dj(e,n,t[n]);return e},ii=(e,t,n)=>dj(e,typeof t!="symbol"?t+"":t,n);let hpt=class extends Mst{constructor(t,n,r=!0){super(t,n,r),this.core=t,this.logger=n,ii(this,"context",hdt),ii(this,"storagePrefix",of),ii(this,"storageVersion",ddt),ii(this,"events",new Map),ii(this,"shouldPersist",!1),ii(this,"init",async()=>{if(!MH())try{const s={eventId:Ute(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Q1e(this.core.relayer.protocol,this.core.relayer.version,rj)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}}),ii(this,"createEvent",s=>{const{event:i="ERROR",type:o="",properties:{topic:a,trace:c}}=s,l=Ute(),u=this.core.projectId||"",d=Date.now(),h=Q3({eventId:l,timestamp:d,props:{event:i,type:o,properties:{topic:a,trace:c}},bundleId:u,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,h),this.shouldPersist=!0),h}),ii(this,"getEvent",s=>{const{eventId:i,topic:o}=s;if(i)return this.events.get(i);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return Q3(Q3({},a),this.setMethods(a.eventId))}),ii(this,"deleteEvent",s=>{const{eventId:i}=s;this.events.delete(i),this.shouldPersist=!0}),ii(this,"setEventListeners",()=>{this.core.heartbeat.on(Hr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{V.fromMiliseconds(Date.now())-V.fromMiliseconds(s.timestamp)>fdt&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})}),ii(this,"setMethods",s=>({addTrace:i=>this.addTrace(s,i),setError:i=>this.setError(s,i)})),ii(this,"addTrace",(s,i)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(i),this.events.set(s,o),this.shouldPersist=!0)}),ii(this,"setError",(s,i)=>{const o=this.events.get(s);o&&(o.props.type=i,o.timestamp=Date.now(),this.events.set(s,o),this.shouldPersist=!0)}),ii(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),ii(this,"restore",async()=>{try{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(i=>{this.events.set(i.eventId,Q3(Q3({},i),this.setMethods(i.eventId)))})}catch(s){this.logger.warn(s)}}),ii(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[i,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const i of s)this.events.delete(i.eventId),this.shouldPersist=!0}catch(i){this.logger.warn(i)}}),ii(this,"sendEvent",async s=>{const i=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${pdt}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${rj}${i}`,{method:"POST",body:JSON.stringify(s)})}),ii(this,"getAppDomain",()=>X1e().url),this.logger=kr(n,this.context),this.telemetryEnabled=r,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 fpt=Object.defineProperty,Yne=Object.getOwnPropertySymbols,ppt=Object.prototype.hasOwnProperty,gpt=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?fpt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jne=(e,t)=>{for(var n in t||(t={}))ppt.call(t,n)&&hj(e,n,t[n]);if(Yne)for(var n of Yne(t))gpt.call(t,n)&&hj(e,n,t[n]);return e},_r=(e,t,n)=>hj(e,typeof t!="symbol"?t+"":t,n);let mpt=class bye extends Sst{constructor(t){var n;super(t),_r(this,"protocol",rye),_r(this,"version",sye),_r(this,"name",nj),_r(this,"relayUrl"),_r(this,"projectId"),_r(this,"customStoragePrefix"),_r(this,"events",new Dn.EventEmitter),_r(this,"logger"),_r(this,"heartbeat"),_r(this,"relayer"),_r(this,"crypto"),_r(this,"storage"),_r(this,"history"),_r(this,"expirer"),_r(this,"pairing"),_r(this,"verify"),_r(this,"echoClient"),_r(this,"linkModeSupportedApps"),_r(this,"eventClient"),_r(this,"initialized",!1),_r(this,"logChunkController"),_r(this,"on",(a,c)=>this.events.on(a,c)),_r(this,"once",(a,c)=>this.events.once(a,c)),_r(this,"off",(a,c)=>this.events.off(a,c)),_r(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),_r(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:l})=>{if(!a||!c)return;const u={topic:a,message:c,publishedAt:Date.now(),transportType:Lr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:l})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(a){console.warn("Failed to copy global core",a)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||oye,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const s=sW({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:But.logger,name:nj}),{logger:i,chunkLoggerController:o}=OC({opts:s,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(n=this.logChunkController)!=null&&n.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=kr(i,this.name),this.heartbeat=new s7,this.crypto=new qht(this,this.logger,t==null?void 0:t.keychain),this.history=new Qft(this,this.logger),this.expirer=new npt(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new i7(Jne(Jne({},Dut),t==null?void 0:t.storageOptions)),this.relayer=new mft({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Yft(this,this.logger),this.verify=new ipt(this,this.logger,this.storage),this.echoClient=new cpt(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new hpt(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const n=new bye(t);await n.initialize();const r=await n.crypto.getClientId();return await n.storage.setItem(Yut,r),n}get context(){return Sr(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Nne,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(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(Nne)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(t,`Core Initialization Failure at epoch ${Date.now()}`),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${t}`,r=`${n}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[n]}catch(n){console.warn("Failed to get global WalletConnect core",n);return}}setGlobalCore(t){var n;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((n=t.opts)==null?void 0:n.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&Rut.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const wpt=mpt,vye="wc",Eye=2,Cye="client",JH=`${vye}@${Eye}:${Cye}:`,_R={name:Cye,logger:"error"},Xne="WALLETCONNECT_DEEPLINK_CHOICE",ypt="proposal",Qne="Proposal expired",bpt="session",m2=V.SEVEN_DAYS,vpt="engine",ji={wc_sessionPropose:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1104},res:{ttl:V.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1106},res:{ttl:V.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:V.FIVE_MINUTES*3,prompt:!0,tag:1108},res:{ttl:V.FIVE_MINUTES*3,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1112},res:{ttl:V.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1114},res:{ttl:V.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:V.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:V.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1119}}},NR={min:V.FIVE_MINUTES,max:V.SEVEN_DAYS},bh={idle:"IDLE",active:"ACTIVE"},Ept={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},Cpt="request",$pt=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],xpt="wc",Ipt="auth",Spt="authKeys",Apt="pairingTopics",_pt="requests",bT=`${xpt}@${1.5}:${Ipt}:`,TS=`${bT}:PUB_KEY`;var Npt=Object.defineProperty,Tpt=Object.defineProperties,Ppt=Object.getOwnPropertyDescriptors,ere=Object.getOwnPropertySymbols,Opt=Object.prototype.hasOwnProperty,kpt=Object.prototype.propertyIsEnumerable,fj=(e,t,n)=>t in e?Npt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yn=(e,t)=>{for(var n in t||(t={}))Opt.call(t,n)&&fj(e,n,t[n]);if(ere)for(var n of ere(t))kpt.call(t,n)&&fj(e,n,t[n]);return e},Fi=(e,t)=>Tpt(e,Ppt(t)),$e=(e,t,n)=>fj(e,typeof t!="symbol"?t+"":t,n);let Rpt=class extends qst{constructor(t){super(t),$e(this,"name",vpt),$e(this,"events",new Bu),$e(this,"initialized",!1),$e(this,"requestQueue",{state:bh.idle,queue:[]}),$e(this,"sessionRequestQueue",{state:bh.idle,queue:[]}),$e(this,"emittedSessionRequests",new Mot({limit:500})),$e(this,"requestQueueDelay",V.ONE_SECOND),$e(this,"expectedPairingMethodMap",new Map),$e(this,"recentlyDeletedMap",new Map),$e(this,"recentlyDeletedLimit",200),$e(this,"relayMessageCache",[]),$e(this,"pendingSessions",new Map),$e(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(ji)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay)))}),$e(this,"connect",async n=>{var r;this.isInitialized(),await this.confirmOnlineStateOrThrow();const s=Fi(Yn({},n),{requiredNamespaces:n.requiredNamespaces||{},optionalNamespaces:n.optionalNamespaces||{}});await this.isValidConnect(s),s.optionalNamespaces=Zlt(s.requiredNamespaces,s.optionalNamespaces),s.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:o,optionalNamespaces:a,sessionProperties:c,scopedProperties:l,relays:u,authentication:d,walletPay:h}=s,f=((r=d==null?void 0:d[0])==null?void 0:r.ttl)||ji.wc_sessionPropose.req.ttl||V.FIVE_MINUTES;this.validateRequestExpiry(f);let g=i,p,m=!1;try{if(g){const I=this.client.core.pairing.pairings.get(g);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),m=I.active}}catch(I){throw this.client.logger.error(`connect() -> pairing.get(${g}) failed`),I}if(!g||!m){const{topic:I,uri:O}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});g=I,p=O}if(!g){const{message:I}=Fe("NO_MATCHING_KEY",`connect() pairing topic: ${g}`);throw new Error(I)}const w=await this.client.core.crypto.generateKeyPair(),C=As(f),E=Yn(Fi(Yn(Yn({requiredNamespaces:o,optionalNamespaces:a,relays:u??[{protocol:iye}],proposer:{publicKey:w,metadata:this.client.metadata},expiryTimestamp:C,pairingTopic:g},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Bn()}),(d||h)&&{requests:{authentication:d==null?void 0:d.map(I=>{const{domain:O,chains:N,nonce:T,uri:P,exp:_,nbf:y,type:$,statement:R,requestId:B,resources:k,signatureTypes:D}=I;return{domain:O,chains:N,nonce:T,type:$??"caip122",aud:P,version:"1",iat:new Date().toISOString(),exp:_,nbf:y,statement:R,requestId:B,resources:k,signatureTypes:D}}),walletPay:h}}),b=ur("session_connect",E.id),{reject:S,resolve:v,done:x}=H1(f,Qne),A=({id:I})=>{I===E.id&&(this.client.events.off("proposal_expire",A),this.pendingSessions.delete(E.id),this.events.emit(b,{error:{message:Qne,code:0}}))};return this.client.events.on("proposal_expire",A),this.events.once(b,({error:I,session:O})=>{this.client.events.off("proposal_expire",A),I?S(I):O&&v(O)}),await this.setProposal(E.id,E),await this.sendProposeSession({proposal:E,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:E.id}}}).catch(I=>{throw this.deleteProposal(E.id),I}),{uri:p,approval:x}}),$e(this,"pair",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(n)}catch(r){throw this.client.logger.error("pair() failed"),r}}),$e(this,"approve",async n=>{var r,s,i;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=n==null?void 0:n.id)==null?void 0:r.toString(),trace:[Qu.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(O){throw o.setError(O1.no_internet_connection),O}try{await this.isValidProposalId(n==null?void 0:n.id)}catch(O){throw this.client.logger.error(`approve() -> proposal.get(${n==null?void 0:n.id}) failed`),o.setError(O1.proposal_not_found),O}try{await this.isValidApprove(n)}catch(O){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(O1.session_approve_namespace_validation_failure),O}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h,proposalRequestsResponses:f}=n,g=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:p,proposer:m,requiredNamespaces:w,optionalNamespaces:C}=g;let E=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:p});E||(E=(i=this.client.core.eventClient)==null?void 0:i.createEvent({type:Qu.session_approve_started,properties:{topic:p,trace:[Qu.session_approve_started,Qu.session_namespaces_validation_success]}}));const b=await this.client.core.crypto.generateKeyPair(),S=m.publicKey,v=await this.client.core.crypto.generateSharedKey(b,S),x=Fi(Yn(Yn(Yn({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:b,metadata:this.client.metadata},expiry:As(m2)},u&&{sessionProperties:u}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),{proposalRequestsResponses:f}),A=Lr.relay;E.addTrace(Qu.subscribing_session_topic);try{await this.client.core.relayer.subscribe(v,{transportType:A,internal:{skipSubscribe:!0}})}catch(O){throw E.setError(O1.subscribe_session_topic_failure),O}E.addTrace(Qu.subscribe_session_topic_success);const I=Fi(Yn({},x),{topic:v,requiredNamespaces:w,optionalNamespaces:C,pairingTopic:p,acknowledged:!1,self:x.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:b,transportType:Lr.relay,authentication:f==null?void 0:f.authentication,walletPayResult:f==null?void 0:f.walletPay});await this.client.session.set(v,I),E.addTrace(Qu.store_session);try{await this.sendApproveSession({sessionTopic:v,proposal:g,pairingProposalResponse:{relay:{protocol:c??"irn"},responderPublicKey:b},sessionSettleRequest:x,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:Yn({correlationId:a},this.getTVFApproveParams(I))}}),E.addTrace(Qu.session_approve_publish_success)}catch(O){throw this.client.logger.error(O),this.client.session.delete(v,Jr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(v),O}return this.client.core.eventClient.deleteEvent({eventId:E.eventId}),await this.client.core.pairing.updateMetadata({topic:p,metadata:m.metadata}),await this.deleteProposal(a),await this.client.core.pairing.activate({topic:p}),await this.setExpiry(v,As(m2)),{topic:v,acknowledged:()=>Promise.resolve(this.client.session.get(v))}}),$e(this,"reject",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(n)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:s}=n;let i;try{i=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}i&&await this.sendError({id:r,topic:i,error:s,rpcOpts:ji.wc_sessionPropose.reject}),await this.deleteProposal(r)}),$e(this,"update",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(n)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:s}=n,{done:i,resolve:o,reject:a}=H1(V.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),c=Bn(),l=Ir().toString(),u=this.client.session.get(r).namespaces;return this.events.once(ur("session_update",c),({error:d})=>{d?a(d):o()}),await this.client.session.update(r,{namespaces:s}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:u}),a(d)}),{acknowledged:i}}),$e(this,"extend",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(n)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:r}=n,s=Bn(),{done:i,resolve:o,reject:a}=H1(V.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return this.events.once(ur("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(r,As(m2)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:i}}),$e(this,"request",async n=>{this.isInitialized();try{await this.isValidRequest(n)}catch(m){throw this.client.logger.error("request() -> isValidRequest() failed"),m}const{chainId:r,request:s,topic:i,expiry:o=ji.wc_sessionRequest.req.ttl}=n,a=this.client.session.get(i);(a==null?void 0:a.transportType)===Lr.relay&&await this.confirmOnlineStateOrThrow();const c=Bn(),l=Ir().toString(),{done:u,resolve:d,reject:h}=H1(o,"Request expired. Please try again.");this.events.once(ur("session_request",c),({error:m,result:w})=>{m?h(m):d(w)});const f="wc_sessionRequest",g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(g)return await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:{request:Fi(Yn({},s),{expiryTimestamp:As(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(m=>h(m)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),await u();const p={request:Fi(Yn({},s),{expiryTimestamp:As(o)}),chainId:r};return await Promise.all([new Promise(async m=>{await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:p,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(c,p)}).catch(w=>h(w)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),m()}),new Promise(async m=>{var w;if(!((w=a.sessionConfig)!=null&&w.disableDeepLink)){const C=await Rot(this.client.core.storage,Xne);await Pot({id:c,topic:i,wcDeepLink:C})}m()}),u()]).then(m=>m[2])}),$e(this,"respond",async n=>{var r,s;this.isInitialized();const i=this.client.core.eventClient.createEvent({properties:{topic:(n==null?void 0:n.topic)||((s=(r=n==null?void 0:n.response)==null?void 0:r.id)==null?void 0:s.toString()),trace:[Qu.session_request_response_started]}});try{await this.isValidRespond(n)}catch(d){throw i.addTrace(d==null?void 0:d.message),i.setError(O1.session_request_response_validation_failure),d}i.addTrace(Qu.session_request_response_validation_success);const{topic:o,response:a}=n,{id:c}=a,l=this.client.session.get(o);l.transportType===Lr.relay&&await this.confirmOnlineStateOrThrow();const u=this.getAppLinkIfEnabled(l.peer.metadata,l.transportType);try{i.addTrace(Qu.session_request_response_publish_started),wn(a)?await this.sendResult({id:c,topic:o,result:a.result,throwOnFailedPublish:!0,appLink:u}):nn(a)&&await this.sendError({id:c,topic:o,error:a.error,appLink:u}),this.cleanupAfterResponse(n)}catch(d){throw i.addTrace(d==null?void 0:d.message),i.setError(O1.session_request_response_publish_failure),d}}),$e(this,"ping",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(n)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:r}=n;if(this.client.session.keys.includes(r)){const s=Bn(),i=Ir().toString(),{done:o,resolve:a,reject:c}=H1(V.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");this.events.once(ur("session_ping",s),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:i}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),$e(this,"emit",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(n);const{topic:r,event:s,chainId:i}=n,o=Ir().toString(),a=Bn();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:s,chainId:i},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),$e(this,"disconnect",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(n);const{topic:r}=n;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:Jr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:s}=Fe("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(s)}}),$e(this,"find",n=>(this.isInitialized(),this.client.session.getAll().filter(r=>Ylt(r,n)))),$e(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),$e(this,"authenticate",async(n,r)=>{var s;this.isInitialized(),this.isValidAuthenticate(n);const i=r&&this.client.core.linkModeSupportedApps.includes(r)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),o=i?Lr.link_mode:Lr.relay;o===Lr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:u,nonce:d,type:h,exp:f,nbf:g,methods:p=[],expiry:m}=n,w=[...n.resources||[]],{topic:C,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:C,uri:E}});const b=await this.client.core.crypto.generateKeyPair(),S=_S(b);if(await Promise.all([this.client.auth.authKeys.set(TS,{responseTopic:S,publicKey:b}),this.client.auth.pairingTopics.set(S,{topic:S,pairingTopic:C})]),await this.client.core.relayer.subscribe(S,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${C}`),p.length>0){const{namespace:k}=i0(a[0]);let D=Xat(k,"request",p);AS(w)&&(D=ect(D,w.pop())),w.push(D)}const v=m&&m>ji.wc_sessionAuthenticate.req.ttl?m:ji.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:h??"caip122",chains:a,statement:c,aud:l,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:g,resources:w},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:As(v)},A={eip155:{chains:a,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},I={requiredNamespaces:{},optionalNamespaces:A,relays:[{protocol:"irn"}],pairingTopic:C,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:As(ji.wc_sessionPropose.req.ttl),id:Bn()},{done:O,resolve:N,reject:T}=H1(v,"Request expired"),P=Bn(),_=ur("session_connect",I.id),y=ur("session_request",P),$=async({error:k,session:D})=>{this.events.off(y,R),k?T(k):D&&N({session:D})},R=async k=>{var D,U,F;if(await this.deletePendingAuthRequest(P,{message:"fulfilled",code:0}),k.error){const X=Jr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return k.error.code===X.code?void 0:(this.events.off(_,$),T(k.error.message))}await this.deleteProposal(I.id),this.events.off(_,$);const{cacaos:K,responder:q}=k.result,H=[],Z=[];for(const X of K){await Gte({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),T(Jr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:le}=X,_e=AS(le.resources),Ne=[WM(le.iss)],be=bA(le.iss);if(_e){const Me=Zte(_e),Ct=Yte(_e);H.push(...Me),Ne.push(...Ct)}for(const Me of Ne)Z.push(`${Me}:${be}`)}const ee=await this.client.core.crypto.generateSharedKey(b,q.publicKey);let ie;H.length>0&&(ie={topic:ee,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:q,controller:q.publicKey,expiry:As(m2),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:C,namespaces:Cne([...new Set(H)],[...new Set(Z)]),transportType:o},await this.client.core.relayer.subscribe(ee,{transportType:o}),await this.client.session.set(ee,ie),C&&await this.client.core.pairing.updateMetadata({topic:C,metadata:q.metadata}),ie=this.client.session.get(ee)),(D=this.client.metadata.redirect)!=null&&D.linkMode&&(U=q.metadata.redirect)!=null&&U.linkMode&&(F=q.metadata.redirect)!=null&&F.universal&&r&&(this.client.core.addLinkModeSupportedApp(q.metadata.redirect.universal),this.client.session.update(ee,{transportType:Lr.link_mode})),N({auths:K,session:ie})};this.events.once(_,$),this.events.once(y,R);let B;try{if(i){const k=_n("wc_sessionAuthenticate",x,P);this.client.core.history.set(C,k);const D=await this.client.core.crypto.encode("",k,{type:a$,encoding:rm});B=hI(r,C,D)}else await Promise.all([this.sendRequest({topic:C,method:"wc_sessionAuthenticate",params:x,expiry:n.expiry,throwOnFailedPublish:!0,clientRpcId:P}),this.sendRequest({topic:C,method:"wc_sessionPropose",params:I,expiry:ji.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:I.id})])}catch(k){throw this.events.off(_,$),this.events.off(y,R),k}return await this.setProposal(I.id,I),await this.setAuthRequest(P,{request:Fi(Yn({},x),{verifyContext:{}}),pairingTopic:C,transportType:o}),{uri:B??E,response:O}}),$e(this,"approveSessionAuthenticate",async n=>{const{id:r,auths:s}=n,i=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[k1.authenticated_session_approve_started]}});try{this.isInitialized()}catch(m){throw i.setError(J3.no_internet_connection),m}const o=this.getPendingAuthRequest(r);if(!o)throw i.setError(J3.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const a=o.transportType||Lr.relay;a===Lr.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),u=_S(c),d={type:o0,receiverPublicKey:c,senderPublicKey:l},h=[],f=[];for(const m of s){if(!await Gte({cacao:m,projectId:this.client.core.projectId})){i.setError(J3.invalid_cacao);const S=Jr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:u,error:S,encodeOpts:d}),new Error(S.message)}i.addTrace(k1.cacaos_verified);const{p:w}=m,C=AS(w.resources),E=[WM(w.iss)],b=bA(w.iss);if(C){const S=Zte(C),v=Yte(C);h.push(...S),E.push(...v)}for(const S of E)f.push(`${S}:${b}`)}const g=await this.client.core.crypto.generateSharedKey(l,c);i.addTrace(k1.create_authenticated_session_topic);let p;if((h==null?void 0:h.length)>0){p={topic:g,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:As(m2),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Cne([...new Set(h)],[...new Set(f)]),transportType:a},i.addTrace(k1.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(g,{transportType:a})}catch(m){throw i.setError(J3.subscribe_authenticated_session_topic_failure),m}i.addTrace(k1.subscribe_authenticated_session_topic_success),await this.client.session.set(g,p),i.addTrace(k1.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}i.addTrace(k1.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:r,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(m){throw i.setError(J3.authenticated_session_approve_publish_failure),m}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:p}}),$e(this,"rejectSessionAuthenticate",async n=>{this.isInitialized();const{id:r,reason:s}=n,i=this.getPendingAuthRequest(r);if(!i)throw new Error(`Could not find pending auth request with id ${r}`);i.transportType===Lr.relay&&await this.confirmOnlineStateOrThrow();const o=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=_S(o),l={type:o0,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:r,topic:c,error:s,encodeOpts:l,rpcOpts:ji.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),$e(this,"formatAuthMessage",n=>{this.isInitialized();const{request:r,iss:s}=n;return ywe(r,s)}),$e(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const n=this.relayMessageCache.shift();n&&await this.onRelayMessage(n)}catch(n){this.client.logger.error(n)}},50)}),$e(this,"cleanupDuplicatePairings",async n=>{if(n.pairingTopic)try{const r=this.client.core.pairing.pairings.get(n.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(i=>{var o,a;return((o=i.peerMetadata)==null?void 0:o.url)&&((a=i.peerMetadata)==null?void 0:a.url)===n.peer.metadata.url&&i.topic&&i.topic!==r.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(i=>this.client.core.pairing.disconnect({topic:i.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),$e(this,"deleteSession",async n=>{var r;const{topic:s,expirerHasDeleted:i=!1,emitEvent:o=!0,id:a=0}=n,{self:c}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,Jr("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),i||this.client.core.expirer.del(s),this.client.core.storage.removeItem(Xne).catch(l=>this.client.logger.warn(l)),s===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=bh.idle),await Promise.all(this.getPendingSessionRequests().filter(l=>l.topic===s).map(l=>this.deletePendingSessionRequest(l.id,Jr("USER_DISCONNECTED")))),o&&this.client.events.emit("session_delete",{id:a,topic:s})}),$e(this,"deleteProposal",async(n,r)=>{if(r)try{const s=this.client.proposal.get(n),i=this.client.core.eventClient.getEvent({topic:s.pairingTopic});i==null||i.setError(O1.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(n,Jr("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"proposal")}),$e(this,"deletePendingSessionRequest",async(n,r,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==n),s&&(this.sessionRequestQueue.state=bh.idle,this.client.events.emit("session_request_expire",{id:n}))}),$e(this,"deletePendingAuthRequest",async(n,r,s=!1)=>{await Promise.all([this.client.auth.requests.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)])}),$e(this,"setExpiry",async(n,r)=>{this.client.session.keys.includes(n)&&(this.client.core.expirer.set(n,r),await this.client.session.update(n,{expiry:r}))}),$e(this,"setProposal",async(n,r)=>{this.client.core.expirer.set(n,As(ji.wc_sessionPropose.req.ttl)),await this.client.proposal.set(n,r)}),$e(this,"setAuthRequest",async(n,r)=>{const{request:s,pairingTopic:i,transportType:o=Lr.relay}=r;this.client.core.expirer.set(n,s.expiryTimestamp),await this.client.auth.requests.set(n,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:n,pairingTopic:i,verifyContext:s.verifyContext,transportType:o})}),$e(this,"setPendingSessionRequest",async n=>{const{id:r,topic:s,params:i,verifyContext:o}=n,a=i.request.expiryTimestamp||As(ji.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,a),await this.client.pendingRequest.set(r,{id:r,topic:s,params:i,verifyContext:o})}),$e(this,"sendRequest",async n=>{const{topic:r,method:s,params:i,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:u,tvf:d,publishOpts:h={}}=n,f=_n(s,i,c);let g;const p=!!u;try{const C=p?rm:Qa;g=await this.client.core.crypto.encode(r,f,{encoding:C})}catch(C){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),C}let m;if($pt.includes(s)){const C=lu(JSON.stringify(f)),E=lu(g);m=await this.client.core.verify.register({id:E,decryptedId:C})}const w=Yn(Yn({},ji[s].req),h);if(w.attestation=m,o&&(w.ttl=o),a&&(w.id=a),this.client.core.history.set(r,f),p){const C=hI(u,r,g);await globalThis.Linking.openURL(C,this.client.name)}else w.tvf=Fi(Yn({},d),{correlationId:f.id}),l?(w.internal=Fi(Yn({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,g,w)):this.client.core.relayer.publish(r,g,w).catch(C=>this.client.logger.error(C));return f.id}),$e(this,"sendProposeSession",async n=>{const{proposal:r,publishOpts:s}=n,i=_n("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,i);const o=await this.client.core.crypto.encode(r.pairingTopic,i,{encoding:Qa}),a=lu(JSON.stringify(i)),c=lu(o),l=await this.client.core.verify.register({id:c,decryptedId:a});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:Fi(Yn({},s),{publishMethod:"wc_proposeSession",attestation:l})})}),$e(this,"sendApproveSession",async n=>{const{sessionTopic:r,pairingProposalResponse:s,proposal:i,sessionSettleRequest:o,publishOpts:a}=n,c=Pi(i.id,s),l=await this.client.core.crypto.encode(i.pairingTopic,c,{encoding:Qa}),u=_n("wc_sessionSettle",o,a==null?void 0:a.id),d=await this.client.core.crypto.encode(r,u,{encoding:Qa});this.client.core.history.set(r,u),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:i.pairingTopic,sessionProposalResponse:l,sessionSettlementRequest:d},opts:Fi(Yn({},a),{publishMethod:"wc_approveSession"})})}),$e(this,"sendResult",async n=>{const{id:r,topic:s,result:i,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=n,l=Pi(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const g=d?rm:Qa;u=await this.client.core.crypto.encode(s,l,Fi(Yn({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),g}let h,f;try{h=await this.client.core.history.get(s,r);const g=h.request;try{f=this.getTVFParams(r,g.params,i)}catch(p){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${p==null?void 0:p.message}`)}}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${r}) failed`),g}if(d){const g=hI(c,s,u);await globalThis.Linking.openURL(g,this.client.name)}else{const g=h.request.method,p=ji[g].res;p.tvf=Fi(Yn({},f),{correlationId:r}),o?(p.internal=Fi(Yn({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,u,p)):this.client.core.relayer.publish(s,u,p).catch(m=>this.client.logger.error(m))}await this.client.core.history.resolve(l)}),$e(this,"sendError",async n=>{const{id:r,topic:s,error:i,encodeOpts:o,rpcOpts:a,appLink:c}=n,l=yf(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const f=d?rm:Qa;u=await this.client.core.crypto.encode(s,l,Fi(Yn({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),f}let h;try{h=await this.client.core.history.get(s,r)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${s}, ${r}) failed`),f}if(d){const f=hI(c,s,u);await globalThis.Linking.openURL(f,this.client.name)}else{const f=h.request.method,g=a||ji[f].res;this.client.core.relayer.publish(s,u,g)}await this.client.core.history.resolve(l)}),$e(this,"cleanup",async()=>{const n=[],r=[];this.client.session.getAll().forEach(s=>{let i=!1;Rh(s.expiry)&&(i=!0),this.client.core.crypto.keychain.has(s.topic)||(i=!0),i&&n.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{Rh(s.expiryTimestamp)&&r.push(s.id)}),await Promise.all([...n.map(s=>this.deleteSession({topic:s})),...r.map(s=>this.deleteProposal(s))])}),$e(this,"onProviderMessageEvent",async n=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(n):await this.onRelayMessage(n)}),$e(this,"onRelayEventRequest",async n=>{this.requestQueue.queue.push(n),await this.processRequestsQueue()}),$e(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===bh.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=bh.active;const n=this.requestQueue.queue.shift();if(n)try{await this.processRequest(n)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=bh.idle}),$e(this,"processRequest",async n=>{const{topic:r,payload:s,attestation:i,transportType:o,encryptedId:a}=n,c=s.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:s,attestation:i,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,s);case"wc_sessionPing":return await this.onSessionPingRequest(r,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),$e(this,"onRelayEventResponse",async n=>{const{topic:r,payload:s,transportType:i}=n,o=(await this.client.core.history.get(r,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,s,i);case"wc_sessionSettle":return this.onSessionSettleResponse(r,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,s);case"wc_sessionExtend":return this.onSessionExtendResponse(r,s);case"wc_sessionPing":return this.onSessionPingResponse(r,s);case"wc_sessionRequest":return this.onSessionRequestResponse(r,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),$e(this,"onRelayEventUnknownPayload",n=>{const{topic:r}=n,{message:s}=Fe("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)}),$e(this,"shouldIgnorePairingRequest",n=>{const{topic:r,requestMethod:s}=n,i=this.expectedPairingMethodMap.get(r);return!i||i.includes(s)?!1:!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),$e(this,"onSessionProposeRequest",async n=>{const{topic:r,payload:s,attestation:i,encryptedId:o}=n,{params:a,id:c}=s;try{const l=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(pp.proposal_listener_not_found)),this.isValidConnect(Yn({},s.params));const u=a.expiryTimestamp||As(ji.wc_sessionPropose.req.ttl),d=Yn({id:c,pairingTopic:r,expiryTimestamp:u,attestation:i,encryptedId:o},a);await this.setProposal(c,d);const h=await this.getVerifyContext({attestationId:i,hash:lu(JSON.stringify(s)),encryptedId:o,metadata:d.proposer.metadata});l==null||l.addTrace(_h.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:d,verifyContext:h})}catch(l){await this.sendError({id:c,topic:r,error:l,rpcOpts:ji.wc_sessionPropose.autoReject}),this.client.logger.error(l)}}),$e(this,"onSessionProposeResponse",async(n,r,s)=>{const{id:i}=r;if(wn(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const u=await this.client.core.crypto.generateSharedKey(c,l);this.pendingSessions.set(i,{sessionTopic:u,pairingTopic:n,proposalId:i,publicKey:c});const d=await this.client.core.relayer.subscribe(u,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:n})}else if(nn(r)){await this.deleteProposal(i);const o=ur("session_connect",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),$e(this,"onSessionSettleRequest",async(n,r)=>{const{id:s,params:i}=r;try{this.isValidSessionSettleRequest(i);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h,proposalRequestsResponses:f}=r.params,g=[...this.pendingSessions.values()].find(w=>w.sessionTopic===n);if(!g)return this.client.logger.error(`Pending session not found for topic ${n}`);const p=this.client.proposal.get(g.proposalId),m=Fi(Yn(Yn(Yn({topic:n,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:g.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,controller:a.publicKey,self:{publicKey:g.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},u&&{sessionProperties:u}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),{transportType:Lr.relay,authentication:f==null?void 0:f.authentication,walletPayResult:f==null?void 0:f.walletPay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:g.pairingTopic,metadata:m.peer.metadata}),this.pendingSessions.delete(g.proposalId),this.deleteProposal(g.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:r.id,topic:n,throwOnFailedPublish:!0,result:!0}),this.client.events.emit("session_connect",{session:m}),this.events.emit(ur("session_connect",g.proposalId),{session:m})}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),$e(this,"onSessionSettleResponse",async(n,r)=>{const{id:s}=r;wn(r)?(await this.client.session.update(n,{acknowledged:!0}),this.events.emit(ur("session_approve",s),{})):nn(r)&&(await this.client.session.delete(n,Jr("USER_DISCONNECTED")),this.events.emit(ur("session_approve",s),{error:r.error}))}),$e(this,"onSessionUpdateRequest",async(n,r)=>{const{params:s,id:i}=r;try{const o=`${n}_session_update`,a=Z3.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:n,error:Jr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Yn({topic:n},s));try{Z3.set(o,i),await this.client.session.update(n,{namespaces:s.namespaces}),await this.sendResult({id:i,topic:n,result:!0})}catch(c){throw Z3.delete(o),c}this.client.events.emit("session_update",{id:i,topic:n,params:s})}catch(o){await this.sendError({id:i,topic:n,error:o}),this.client.logger.error(o)}}),$e(this,"isRequestOutOfSync",(n,r)=>r.toString().slice(0,-3)<n.toString().slice(0,-3)),$e(this,"onSessionUpdateResponse",(n,r)=>{const{id:s}=r,i=ur("session_update",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(ur("session_update",s),{}):nn(r)&&this.events.emit(ur("session_update",s),{error:r.error})}),$e(this,"onSessionExtendRequest",async(n,r)=>{const{id:s}=r;try{this.isValidExtend({topic:n}),await this.setExpiry(n,As(m2)),await this.sendResult({id:s,topic:n,result:!0}),this.client.events.emit("session_extend",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}}),$e(this,"onSessionExtendResponse",(n,r)=>{const{id:s}=r,i=ur("session_extend",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(ur("session_extend",s),{}):nn(r)&&this.events.emit(ur("session_extend",s),{error:r.error})}),$e(this,"onSessionPingRequest",async(n,r)=>{const{id:s}=r;try{this.isValidPing({topic:n}),await this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}}),$e(this,"onSessionPingResponse",(n,r)=>{const{id:s}=r,i=ur("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners 2176`);wn(r)?this.events.emit(ur("session_ping",s),{}):nn(r)&&this.events.emit(ur("session_ping",s),{error:r.error})},500)}),$e(this,"onSessionDeleteRequest",async(n,r)=>{const{id:s}=r;try{await this.isValidDisconnect({topic:n,reason:r.params}),this.cleanupPendingSentRequestsForTopic({topic:n,error:Jr("USER_DISCONNECTED")}),await this.deleteSession({topic:n,id:s})}catch(i){this.client.logger.error(i)}}),$e(this,"onSessionRequest",async n=>{var r,s,i;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:u}=n,{id:d,params:h}=a;try{await this.isValidRequest(Yn({topic:o},h));const f=this.client.session.get(o),g=await this.getVerifyContext({attestationId:c,hash:lu(JSON.stringify(_n("wc_sessionRequest",h,d))),encryptedId:l,metadata:f.peer.metadata,transportType:u}),p={id:d,topic:o,params:h,verifyContext:g};await this.setPendingSessionRequest(p),u===Lr.link_mode&&(r=f.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((s=f.peer.metadata.redirect)==null?void 0:s.universal),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(p):(this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue())}catch(f){await this.sendError({id:d,topic:o,error:f}),this.client.logger.error(f)}}),$e(this,"onSessionRequestResponse",(n,r)=>{const{id:s}=r,i=ur("session_request",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit(ur("session_request",s),{result:r.result}):nn(r)&&this.events.emit(ur("session_request",s),{error:r.error})}),$e(this,"onSessionEventRequest",async(n,r)=>{const{id:s,params:i}=r;try{const o=`${n}_session_event_${i.event.name}`,a=Z3.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(Yn({topic:n},i)),this.client.events.emit("session_event",{id:s,topic:n,params:i}),Z3.set(o,s)}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),$e(this,"onSessionAuthenticateResponse",(n,r)=>{const{id:s}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:n,payload:r}),wn(r)?this.events.emit(ur("session_request",s),{result:r.result}):nn(r)&&this.events.emit(ur("session_request",s),{error:r.error})}),$e(this,"onSessionAuthenticateRequest",async n=>{var r;const{topic:s,payload:i,attestation:o,encryptedId:a,transportType:c}=n;try{const{requester:l,authPayload:u,expiryTimestamp:d}=i.params,h=await this.getVerifyContext({attestationId:o,hash:lu(JSON.stringify(i)),encryptedId:a,metadata:l.metadata,transportType:c}),f={requester:l,pairingTopic:s,id:i.id,authPayload:u,verifyContext:h,expiryTimestamp:d};await this.setAuthRequest(i.id,{request:f,pairingTopic:s,transportType:c}),c===Lr.link_mode&&(r=l.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:i.params,id:i.id,verifyContext:h})}catch(l){this.client.logger.error(l);const u=i.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(i.params.requester.metadata,c),f={type:o0,receiverPublicKey:u,senderPublicKey:d};await this.sendError({id:i.id,topic:s,error:l,encodeOpts:f,rpcOpts:ji.wc_sessionAuthenticate.autoReject,appLink:h})}}),$e(this,"addSessionRequestToSessionRequestQueue",n=>{this.sessionRequestQueue.queue.push(n)}),$e(this,"cleanupAfterResponse",n=>{this.deletePendingSessionRequest(n.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=bh.idle,this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay))}),$e(this,"cleanupPendingSentRequestsForTopic",({topic:n,error:r})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(i=>i.topic===n&&i.request.method==="wc_sessionRequest").forEach(i=>{this.events.emit(ur("session_request",i.request.id),{error:r})})}),$e(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===bh.active){this.client.logger.info("session request queue is already active.");return}const n=this.sessionRequestQueue.queue[0];if(!n){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(n)}catch(r){this.client.logger.error(r)}}),$e(this,"emitSessionRequest",n=>{if(this.emittedSessionRequests.has(n.id)){this.client.logger.warn({id:n.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${n.id}`);return}this.sessionRequestQueue.state=bh.active,this.emittedSessionRequests.add(n.id),this.client.events.emit("session_request",n)}),$e(this,"onPairingCreated",n=>{if(n.methods&&this.expectedPairingMethodMap.set(n.topic,n.methods),n.active)return;const r=this.client.proposal.getAll().find(s=>s.pairingTopic===n.topic);r&&this.onSessionProposeRequest({topic:n.topic,payload:_n("wc_sessionPropose",Fi(Yn({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),$e(this,"isValidConnect",async n=>{if(!za(n)){const{message:l}=Fe("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(n)}`);throw new Error(l)}const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:i,sessionProperties:o,scopedProperties:a,relays:c}=n;if(bi(r)||await this.isValidPairingTopic(r),!cut(c)){const{message:l}=Fe("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(l)}if(s&&!bi(s)&&Yh(s)!==0){const l="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(l):this.client.logger.warn(l),this.validateNamespaces(s,"requiredNamespaces")}if(i&&!bi(i)&&Yh(i)!==0&&this.validateNamespaces(i,"optionalNamespaces"),o&&!bi(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!bi(a)){this.validateSessionProps(a,"scopedProperties");const l=Object.keys(s||{}).concat(Object.keys(i||{}));if(!Object.keys(a).every(u=>l.includes(u.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(l)}`)}}),$e(this,"validateNamespaces",(n,r)=>{const s=aut(n,"connect()",r);if(s)throw new Error(s.message)}),$e(this,"isValidApprove",async n=>{if(!za(n))throw new Error(Fe("MISSING_OR_INVALID",`approve() params: ${n}`).message);const{id:r,namespaces:s,relayProtocol:i,sessionProperties:o,scopedProperties:a}=n;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const c=this.client.proposal.get(r),l=$R(s,"approve()");if(l)throw new Error(l.message);const u=Ine(c.requiredNamespaces,s,"approve()");if(u)throw new Error(u.message);if(!Ts(i,!0)){const{message:d}=Fe("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(d)}if(o&&!bi(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!bi(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(s));if(!Object.keys(a).every(h=>d.has(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),$e(this,"isValidReject",async n=>{if(!za(n)){const{message:i}=Fe("MISSING_OR_INVALID",`reject() params: ${n}`);throw new Error(i)}const{id:r,reason:s}=n;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!uut(s)){const{message:i}=Fe("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(i)}}),$e(this,"isValidSessionSettleRequest",n=>{if(!za(n)){const{message:l}=Fe("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${n}`);throw new Error(l)}const{relay:r,controller:s,namespaces:i,expiry:o}=n;if(!nye(r)){const{message:l}=Fe("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=tut(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=$R(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(Rh(o)){const{message:l}=Fe("EXPIRED","onSessionSettleRequest()");throw new Error(l)}}),$e(this,"isValidUpdate",async n=>{if(!za(n)){const{message:c}=Fe("MISSING_OR_INVALID",`update() params: ${n}`);throw new Error(c)}const{topic:r,namespaces:s}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const i=this.client.session.get(r),o=$R(s,"update()");if(o)throw new Error(o.message);const a=Ine(i.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)}),$e(this,"isValidExtend",async n=>{if(!za(n)){const{message:s}=Fe("MISSING_OR_INVALID",`extend() params: ${n}`);throw new Error(s)}const{topic:r}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),$e(this,"isValidRequest",async n=>{if(!za(n)){const{message:c}=Fe("MISSING_OR_INVALID",`request() params: ${n}`);throw new Error(c)}const{topic:r,request:s,chainId:i,expiry:o}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:a}=this.client.session.get(r);if(!xne(a,i)){const{message:c}=Fe("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(c)}if(!dut(s)){const{message:c}=Fe("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!put(a,i,s.method)){const{message:c}=Fe("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}this.validateRequestExpiry(o)}),$e(this,"isValidRespond",async n=>{var r;if(!za(n)){const{message:a}=Fe("MISSING_OR_INVALID",`respond() params: ${n}`);throw new Error(a)}const{topic:s,response:i}=n;try{await this.isValidSessionTopic(s)}catch(a){throw(r=n==null?void 0:n.response)!=null&&r.id&&this.cleanupAfterResponse(n),a}if(!hut(i)){const{message:a}=Fe("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(a)}const o=this.client.pendingRequest.get(i.id);if(o.topic!==s){const{message:a}=Fe("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${i.id}, expected topic: ${o.topic}, received topic: ${s}`);throw new Error(a)}}),$e(this,"isValidPing",async n=>{if(!za(n)){const{message:s}=Fe("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)}),$e(this,"isValidEmit",async n=>{if(!za(n)){const{message:a}=Fe("MISSING_OR_INVALID",`emit() params: ${n}`);throw new Error(a)}const{topic:r,event:s,chainId:i}=n;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!xne(o,i)){const{message:a}=Fe("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(a)}if(!fut(s)){const{message:a}=Fe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!gut(o,i,s.name)){const{message:a}=Fe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}}),$e(this,"isValidDisconnect",async n=>{if(!za(n)){const{message:s}=Fe("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)}),$e(this,"isValidAuthenticate",n=>{const{chains:r,uri:s,domain:i,nonce:o}=n;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!Ts(s,!1))throw new Error("uri is required parameter");if(!Ts(i,!1))throw new Error("domain is required parameter");if(!Ts(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(c=>i0(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=i0(r[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),$e(this,"getVerifyContext",async n=>{const{attestationId:r,hash:s,encryptedId:i,metadata:o,transportType:a}=n,c={verified:{verifyUrl:o.verifyUrl||d8,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Lr.link_mode){const u=this.getAppLinkIfEnabled(o,a);return c.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:r,hash:s,encryptedId:i,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),$e(this,"validateSessionProps",(n,r)=>{Object.values(n).forEach((s,i)=>{if(s==null){const{message:o}=Fe("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${s} for key ${Object.keys(n)[i]}`);throw new Error(o)}})}),$e(this,"getPendingAuthRequest",n=>{const r=this.client.auth.requests.get(n);return typeof r=="object"?r:void 0}),$e(this,"addToRecentlyDeleted",(n,r)=>{if(this.recentlyDeletedMap.set(n,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const i=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=i)break;this.recentlyDeletedMap.delete(o)}}}),$e(this,"checkRecentlyDeleted",n=>{const r=this.recentlyDeletedMap.get(n);if(r){const{message:s}=Fe("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${n}`);throw new Error(s)}}),$e(this,"isLinkModeEnabled",(n,r)=>{var s,i,o,a,c,l,u,d,h;return!n||r!==Lr.link_mode?!1:((i=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:i.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((u=n==null?void 0:n.redirect)==null?void 0:u.universal)!==void 0&&((d=n==null?void 0:n.redirect)==null?void 0:d.universal)!==""&&((h=n==null?void 0:n.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(n.redirect.universal)&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"}),$e(this,"getAppLinkIfEnabled",(n,r)=>{var s;return this.isLinkModeEnabled(n,r)?(s=n==null?void 0:n.redirect)==null?void 0:s.universal:void 0}),$e(this,"handleLinkModeMessage",({url:n})=>{if(!n||!n.includes("wc_ev")||!n.includes("topic"))return;const r=Dte(n,"topic")||"",s=decodeURIComponent(Dte(n,"wc_ev")||""),i=this.client.session.keys.includes(r);i&&this.client.session.update(r,{transportType:Lr.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:s,sessionExists:i})}),$e(this,"registerLinkModeListeners",async()=>{var n;if(MH()||p1()&&(n=this.client.metadata.redirect)!=null&&n.linkMode){const r=globalThis==null?void 0:globalThis.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await r.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}),$e(this,"getTVFApproveParams",n=>{try{const r=eye(n.namespaces),s=Wlt(n.namespaces),i=Hlt(n.namespaces),o=n.sessionProperties,a=n.scopedProperties;return{approvedChains:r,approvedMethods:s,approvedEvents:i,sessionProperties:o,scopedProperties:a}}catch(r){return this.client.logger.warn(r,"Error getting TVF approve params"),{}}}),$e(this,"getTVFParams",(n,r,s)=>{var i,o,a;if(!((i=r.request)!=null&&i.method))return{};const c={correlationId:n,rpcMethods:[r.request.method],chainId:r.chainId};try{const l=this.extractTxHashesFromResult(r.request,s);c.txHashes=l,c.contractAddresses=this.isValidContractData(r.request.params)?[(a=(o=r.request.params)==null?void 0:o[0])==null?void 0:a.to]:[]}catch(l){this.client.logger.warn(l,"Error getting TVF params")}return c}),$e(this,"isValidContractData",n=>{var r;if(!n)return!1;try{const s=(n==null?void 0:n.data)||((r=n==null?void 0:n[0])==null?void 0:r.data);if(!s.startsWith("0x"))return!1;const i=s.slice(2);return/^[0-9a-fA-F]*$/.test(i)?i.length%2===0:!1}catch{}return!1}),$e(this,"extractTxHashesFromResult",(n,r)=>{var s;try{if(!r)return[];const i=n.method,o=Ept[i];if(i==="sui_signTransaction")return[kat(r.transactionBytes)];if(i==="near_signTransaction")return[Wte(r)];if(i==="near_signTransactions")return r.map(c=>Wte(c));if(i==="xrpl_signTransactionFor"||i==="xrpl_signTransaction")return[(s=r.tx_json)==null?void 0:s.hash];if(i==="polkadot_signTransaction")return[kut({transaction:n.params.transactionPayload,signature:r.signature})];if(i==="algo_signTxn")return a0(r)?r.map(c=>Hte(c)):[Hte(r)];if(i==="cosmos_signDirect")return[Bat(r)];if(i==="wallet_sendCalls")return Dat(r);if(typeof r=="string")return[r];const a=r[o.key];if(a0(a))return i==="solana_signAllTransactions"?a.map(c=>Oat(c)):a;if(typeof a=="string")return[a]}catch(i){this.client.logger.warn(i,"Error extracting tx hashes from result")}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,n=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,s]of Object.entries(n))for(const i of s)try{await this.onProviderMessageEvent({topic:r,message:i,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${i}`)}}catch(t){this.client.logger.warn(t,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){const{message:t}=Fe("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ps.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:n,message:r,attestation:s,transportType:i}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(TS)?this.client.auth.authKeys.get(TS):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(n,r,{receiverPublicKey:o,encoding:i===Lr.link_mode?rm:Qa});Du(a)?(this.client.core.history.set(n,a),await this.onRelayEventRequest({topic:n,payload:a,attestation:s,transportType:i,encryptedId:lu(r)})):Sl(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:n,payload:a,transportType:i}),this.client.core.history.delete(n,a.id)):(this.client.logger.error(`onRelayMessage() -> unknown payload: ${JSON.stringify(a)}`),await this.onRelayEventUnknownPayload({topic:n,payload:a,transportType:i})),await this.client.core.relayer.messages.ack(n,r)}catch(a){this.client.logger.error(`onRelayMessage() -> failed to process an inbound message: ${r}`),this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(eu.expired,async t=>{const{topic:n,id:r}=twe(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,Fe("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,Fe("EXPIRED"),!0);n?this.client.session.keys.includes(n)&&(await this.deleteSession({topic:n,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:n})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(Q1.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Q1.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!Ts(t,!1)){const{message:n}=Fe("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(n)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:n}=Fe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(n)}if(Rh(this.client.core.pairing.pairings.get(t).expiry)){const{message:n}=Fe("EXPIRED",`pairing topic: ${t}`);throw new Error(n)}}async isValidSessionTopic(t){if(!Ts(t,!1)){const{message:n}=Fe("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(n)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:n}=Fe("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(n)}if(Rh(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:n}=Fe("EXPIRED",`session topic: ${t}`);throw new Error(n)}if(!this.client.core.crypto.keychain.has(t)){const{message:n}=Fe("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(n)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(Ts(t,!1)){const{message:n}=Fe("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(n)}else{const{message:n}=Fe("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(n)}}async isValidProposalId(t){if(!lut(t)){const{message:n}=Fe("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(n)}if(!this.client.proposal.keys.includes(t)){const{message:n}=Fe("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(n)}if(Rh(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:n}=Fe("EXPIRED",`proposal id: ${t}`);throw new Error(n)}}validateRequestExpiry(t){if(t&&!yut(t,NR)){const{message:n}=Fe("MISSING_OR_INVALID",`request() expiry: ${t}. Expiry must be a number (in seconds) between ${NR.min} and ${NR.max}`);throw new Error(n)}}},Bpt=class extends mb{constructor(t,n){super(t,n,ypt,JH),this.core=t,this.logger=n}},Dpt=class extends mb{constructor(t,n){super(t,n,bpt,JH),this.core=t,this.logger=n}},Upt=class extends mb{constructor(t,n){super(t,n,Cpt,JH,r=>r.id),this.core=t,this.logger=n}},Lpt=class extends mb{constructor(t,n){super(t,n,Spt,bT,()=>TS),this.core=t,this.logger=n}},Mpt=class extends mb{constructor(t,n){super(t,n,Apt,bT),this.core=t,this.logger=n}},jpt=class extends mb{constructor(t,n){super(t,n,_pt,bT,r=>r.id),this.core=t,this.logger=n}};var Fpt=Object.defineProperty,zpt=(e,t,n)=>t in e?Fpt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TR=(e,t,n)=>zpt(e,typeof t!="symbol"?t+"":t,n);let qpt=class{constructor(t,n){this.core=t,this.logger=n,TR(this,"authKeys"),TR(this,"pairingTopics"),TR(this,"requests"),this.authKeys=new Lpt(this.core,this.logger),this.pairingTopics=new Mpt(this.core,this.logger),this.requests=new jpt(this.core,this.logger)}
78async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}};var Wpt=Object.defineProperty,Hpt=(e,t,n)=>t in e?Wpt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xn=(e,t,n)=>Hpt(e,typeof t!="symbol"?t+"":t,n);let Vpt=class $ye extends zst{constructor(t){super(t),xn(this,"protocol",vye),xn(this,"version",Eye),xn(this,"name",_R.name),xn(this,"metadata"),xn(this,"core"),xn(this,"logger"),xn(this,"events",new Dn.EventEmitter),xn(this,"engine"),xn(this,"session"),xn(this,"proposal"),xn(this,"pendingRequest"),xn(this,"auth"),xn(this,"signConfig"),xn(this,"on",(r,s)=>this.events.on(r,s)),xn(this,"once",(r,s)=>this.events.once(r,s)),xn(this,"off",(r,s)=>this.events.off(r,s)),xn(this,"removeListener",(r,s)=>this.events.removeListener(r,s)),xn(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),xn(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"update",async r=>{try{return await this.engine.update(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"request",async r=>{try{return await this.engine.request(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"find",r=>{try{return this.engine.find(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),xn(this,"authenticate",async(r,s)=>{try{return await this.engine.authenticate(r,s)}catch(i){throw this.logger.error(i.message),i}}),xn(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),xn(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),this.name=(t==null?void 0:t.name)||_R.name,this.metadata=Iot(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const n=YH({logger:(t==null?void 0:t.logger)||_R.logger,name:this.name});this.logger=n,this.core=(t==null?void 0:t.core)||new wpt(t),this.session=new Dpt(this.core,this.logger),this.proposal=new Bpt(this.core,this.logger),this.pendingRequest=new Upt(this.core,this.logger),this.engine=new Rpt(this),this.auth=new qpt(this.core,this.logger)}static async init(t){const n=new $ye(t);return await n.initialize(),n}get context(){return Sr(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")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}};const Kpt=Vpt;function Gpt(e){return Number.isSafeInteger(e)&&e>=0}function Zpt(e){return e!=null&&typeof e!="function"&&Gpt(e.length)}function Ypt(e){return e==="__proto__"}function XH(e){return e==null||typeof e!="object"&&typeof e!="function"}function xye(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}
vendor: 40,929 bytes, line 78
78function QH(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Jpt="[object RegExp]",Iye="[object String]",Sye="[object Number]",Aye="[object Boolean]",_ye="[object Arguments]",Xpt="[object Symbol]",Qpt="[object Date]",e0t="[object Map]",t0t="[object Set]",n0t="[object Array]",r0t="[object ArrayBuffer]",Nye="[object Object]",s0t="[object DataView]",i0t="[object Uint8Array]",o0t="[object Uint8ClampedArray]",a0t="[object Uint16Array]",c0t="[object Uint32Array]",l0t="[object Int8Array]",u0t="[object Int16Array]",d0t="[object Int32Array]",h0t="[object Float32Array]",f0t="[object Float64Array]";function eV(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function p0t(e,t){return Cv(e,void 0,e,new Map,t)}function Cv(e,t,n,r=new Map,s=void 0){const i=s==null?void 0:s(e,t,n,r);if(i!==void 0)return i;if(XH(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const o=new Array(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=Cv(e[a],a,n,r,s);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;r.set(e,o);for(const[a,c]of e)o.set(a,Cv(c,a,n,r,s));return o}if(e instanceof Set){const o=new Set;r.set(e,o);for(const a of e)o.add(Cv(a,void 0,n,r,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(eV(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=Cv(e[a],a,n,r,s);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,o),wd(o,e,n,r,s),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return r.set(e,o),wd(o,e,n,r,s),o}if(typeof Blob<"u"&&e instanceof Blob){const o=new Blob([e],{type:e.type});return r.set(e,o),wd(o,e,n,r,s),o}if(e instanceof Error){const o=new e.constructor;return r.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,wd(o,e,n,r,s),o}if(e instanceof Boolean){const o=new Boolean(e.valueOf());return r.set(e,o),wd(o,e,n,r,s),o}if(e instanceof Number){const o=new Number(e.valueOf());return r.set(e,o),wd(o,e,n,r,s),o}if(e instanceof String){const o=new String(e.valueOf());return r.set(e,o),wd(o,e,n,r,s),o}if(typeof e=="object"&&g0t(e)){const o=Object.create(Object.getPrototypeOf(e));return r.set(e,o),wd(o,e,n,r,s),o}return e}function wd(e,t,n=e,r,s){const i=[...Object.keys(t),...xye(t)];for(let o=0;o<i.length;o++){const a=i[o],c=Object.getOwnPropertyDescriptor(e,a);(c==null||c.writable)&&(e[a]=Cv(t[a],a,n,r,s))}}function g0t(e){switch(QH(e)){case _ye:case n0t:case r0t:case s0t:case Aye:case Qpt:case h0t:case f0t:case l0t:case u0t:case d0t:case e0t:case Sye:case Nye:case Jpt:case t0t:case Iye:case Xpt:case i0t:case o0t:case a0t:case c0t:return!0;default:return!1}}function m0t(e,t){return p0t(e,(n,r,s,i)=>{if(typeof e=="object"){if(QH(e)===Nye&&typeof e.constructor!="function"){const o={};return i.set(e,o),wd(o,e,s,i),o}switch(Object.prototype.toString.call(e)){case Sye:case Iye:case Aye:{const o=new e.constructor(e==null?void 0:e.valueOf());return wd(o,e),o}case _ye:{const o={};return wd(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}}})}function tre(e){return m0t(e)}function nre(e){return e!==null&&typeof e=="object"&&QH(e)==="[object Arguments]"}function pj(e){return typeof e=="object"&&e!==null}function w0t(e){return pj(e)&&Zpt(e)}function y0t(){}function PR(e){return eV(e)}function OR(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){const r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function b0t(e){if(XH(e))return e;if(Array.isArray(e)||eV(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);const n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){const r=new n(e);return r.lastIndex=e.lastIndex,r}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let r;return e instanceof AggregateError?r=new n(e.errors,e.message,{cause:e.cause}):r=new n(e.message,{cause:e.cause}),r.stack=e.stack,Object.assign(r,e),r}if(typeof File<"u"&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e=="object"){const r=Object.create(t);return Object.assign(r,e)}return e}function v0t(e,...t){const n=t.slice(0,-1),r=t[t.length-1];let s=e;for(let i=0;i<n.length;i++){const o=n[i];s=gj(s,o,r,new Map)}return s}function gj(e,t,n,r){if(XH(e)&&(e=Object(e)),t==null||typeof t!="object")return e;if(r.has(t))return b0t(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let i=0;i<t.length;i++)t[i]=t[i]??void 0}const s=[...Object.keys(t),...xye(t)];for(let i=0;i<s.length;i++){const o=s[i];if(Ypt(o))continue;let a=t[o],c=e[o];if(nre(a)&&(a={...a}),nre(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=tre(a)),Array.isArray(a))if(Array.isArray(c)){const u=[],d=Reflect.ownKeys(c);for(let h=0;h<d.length;h++){const f=d[h];u[f]=c[f]}c=u}else if(w0t(c)){const u=[];for(let d=0;d<c.length;d++)u[d]=c[d];c=u}else c=[];const l=n(c,a,o,e,t,r);l!==void 0?e[o]=l:Array.isArray(a)||pj(c)&&pj(a)&&(OR(c)||OR(a)||PR(c)||PR(a))?e[o]=gj(c,a,n,r):c==null&&OR(a)?e[o]=gj({},a,n,r):c==null&&PR(a)?e[o]=tre(a):(c===void 0||a!==void 0)&&(e[o]=a)}return e}function E0t(e,...t){return v0t(e,...t,y0t)}const rre="error",C0t="wss://relay.walletconnect.org",$0t="wc",Tye="universal_provider",fI=`${$0t}@2:${Tye}:`,Pye="https://rpc.walletconnect.org/v1/",Oye="generic",x0t=`${Pye}bundler`,Gv="call_status",I0t=86400,tV={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var S0t=Object.defineProperty,A0t=Object.defineProperties,_0t=Object.getOwnPropertyDescriptors,sre=Object.getOwnPropertySymbols,N0t=Object.prototype.hasOwnProperty,T0t=Object.prototype.propertyIsEnumerable,ire=(e,t,n)=>t in e?S0t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pI=(e,t)=>{for(var n in t||(t={}))N0t.call(t,n)&&ire(e,n,t[n]);if(sre)for(var n of sre(t))T0t.call(t,n)&&ire(e,n,t[n]);return e},P0t=(e,t)=>A0t(e,_0t(t));function kye(e,t,n){var r;const s=i0(e);return((r=t.rpcMap)==null?void 0:r[s.reference])||`${Pye}?chainId=${s.namespace}:${s.reference}&projectId=${n}`}function O0t(e){return e.includes(":")?e.split(":")[1]:e}function Rye(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function k0t(e,t){const n=Object.keys(t.namespaces).filter(s=>s.includes(e));if(!n.length)return[];const r=[];return n.forEach(s=>{const i=t.namespaces[s].accounts;r.push(...i)}),r}function ore(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>{var r,s;return((r=n==null?void 0:n.chains)==null?void 0:r.length)&&((s=n==null?void 0:n.chains)==null?void 0:s.length)>0}))}function gI(e={},t={}){const n=ore(are(e)),r=ore(are(t));return E0t(n,r)}function are(e){var t,n,r,s,i;const o={};if(!Yh(e))return o;for(const[a,c]of Object.entries(e)){const l=wT(a)?[a]:c.chains,u=c.methods||[],d=c.events||[],h=c.rpcMap||{},f=Ev(a);o[f]=P0t(pI(pI({},o[f]),c),{chains:Zh(l,(t=o[f])==null?void 0:t.chains),methods:Zh(u,(n=o[f])==null?void 0:n.methods),events:Zh(d,(r=o[f])==null?void 0:r.events)}),(Yh(h)||Yh(((s=o[f])==null?void 0:s.rpcMap)||{}))&&(o[f].rpcMap=pI(pI({},h),(i=o[f])==null?void 0:i.rpcMap))}return o}function cre(e){return e.includes(":")?e.split(":")[2]:e}function lre(e){const t={};for(const[n,r]of Object.entries(e)){const s=r.methods||[],i=r.events||[],o=r.accounts||[],a=wT(n)?[n]:r.chains?r.chains:Rye(r.accounts);t[n]={chains:a,methods:s,events:i,accounts:o}}return t}function kR(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}function R0t(e){try{const t=JSON.parse(e);return typeof t=="object"&&t!==null&&!Array.isArray(t)}catch{return!1}}const Bye={},Zv=e=>Bye[e],RR=(e,t)=>{Bye[e]=t};var B0t=Object.defineProperty,ure=Object.getOwnPropertySymbols,D0t=Object.prototype.hasOwnProperty,U0t=Object.prototype.propertyIsEnumerable,dre=(e,t,n)=>t in e?B0t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hre=(e,t)=>{for(var n in t||(t={}))D0t.call(t,n)&&dre(e,n,t[n]);if(ure)for(var n of ure(t))U0t.call(t,n)&&dre(e,n,t[n]);return e};const fre="eip155",L0t=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],M0t=e=>e&&e.startsWith("0x")?BigInt(e).toString(10):e,BR=e=>e&&e.startsWith("0x")?e:`0x${BigInt(e).toString(16)}`,pre=e=>Object.keys(e).filter(t=>L0t.includes(t)).reduce((t,n)=>(t[n]=j0t(e[n]),t),{}),j0t=e=>typeof e=="string"&&R0t(e)?JSON.parse(e):e,F0t=(e,t,n)=>{const{sessionProperties:r={},scopedProperties:s={}}=e,i={};if(!Yh(s)&&!Yh(r))return;const o=pre(r);for(const a of n){const c=M0t(a);if(!c)continue;i[BR(c)]=o;const l=s==null?void 0:s[`${fre}:${c}`];if(l){const u=l==null?void 0:l[`${fre}:${c}:${t}`];i[BR(c)]=hre(hre({},i[BR(c)]),pre(u||l))}}for(const[a,c]of Object.entries(i))Object.keys(c).length===0&&delete i[a];return Object.keys(i).length>0?i:void 0};var z0t=Object.defineProperty,q0t=(e,t,n)=>t in e?z0t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W0t=(e,t,n)=>q0t(e,t+"",n);let DR,H0t=class Dye{constructor(t){W0t(this,"storage"),this.storage=t}async getItem(t){return await this.storage.getItem(t)}async setItem(t,n){return await this.storage.setItem(t,n)}async removeItem(t){return await this.storage.removeItem(t)}static getStorage(t){return DR||(DR=new Dye(t)),DR}};var V0t=Object.defineProperty,K0t=Object.defineProperties,G0t=Object.getOwnPropertyDescriptors,gre=Object.getOwnPropertySymbols,Z0t=Object.prototype.hasOwnProperty,Y0t=Object.prototype.propertyIsEnumerable,mre=(e,t,n)=>t in e?V0t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J0t=(e,t)=>{for(var n in t||(t={}))Z0t.call(t,n)&&mre(e,n,t[n]);if(gre)for(var n of gre(t))Y0t.call(t,n)&&mre(e,n,t[n]);return e},X0t=(e,t)=>K0t(e,G0t(t));async function Q0t(e,t){const n=i0(e.result.capabilities.caip345.caip2),r=e.result.capabilities.caip345.transactionHashes,s=await Promise.allSettled(r.map(d=>egt(n.reference,d,t))),i=s.filter(d=>d.status==="fulfilled").map(d=>d.value).filter(d=>d);s.filter(d=>d.status==="rejected").forEach(d=>console.warn("Failed to fetch transaction receipt:",d.reason));const o=!i.length||i.some(d=>!d),a=i.every(d=>(d==null?void 0:d.status)==="0x1"),c=i.every(d=>(d==null?void 0:d.status)==="0x0"),l=i.some(d=>(d==null?void 0:d.status)==="0x0");let u;return o?u=100:a?u=200:c?u=500:l&&(u=600),{id:e.result.id,version:e.request.version,atomic:e.request.atomicRequired,chainId:e.request.chainId,capabilities:e.result.capabilities,receipts:i,status:u}}async function egt(e,t,n){return await n(parseInt(e)).request(_n("eth_getTransactionReceipt",[t]))}async function tgt({sendCalls:e,storage:t}){const n=await t.getItem(Gv);await t.setItem(Gv,X0t(J0t({},n),{[e.result.id]:{request:e.request,result:e.result,expiry:As(I0t)}}))}async function ngt({resultId:e,storage:t}){const n=await t.getItem(Gv);if(n){delete n[e],await t.setItem(Gv,n);for(const r in n)Rh(n[r].expiry)&&delete n[r];await t.setItem(Gv,n)}}async function rgt({resultId:e,storage:t}){const n=await t.getItem(Gv),r=n==null?void 0:n[e];if(r&&!Rh(r.expiry))return r;await ngt({resultId:e,storage:t})}var sgt=Object.defineProperty,igt=Object.defineProperties,ogt=Object.getOwnPropertyDescriptors,wre=Object.getOwnPropertySymbols,agt=Object.prototype.hasOwnProperty,cgt=Object.prototype.propertyIsEnumerable,mj=(e,t,n)=>t in e?sgt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UR=(e,t)=>{for(var n in t||(t={}))agt.call(t,n)&&mj(e,n,t[n]);if(wre)for(var n of wre(t))cgt.call(t,n)&&mj(e,n,t[n]);return e},LR=(e,t)=>igt(e,ogt(t)),R1=(e,t,n)=>mj(e,typeof t!="symbol"?t+"":t,n);let lgt=class{constructor(t){R1(this,"name","eip155"),R1(this,"client"),R1(this,"chainId"),R1(this,"namespace"),R1(this,"httpProviders"),R1(this,"events"),R1(this,"storage"),this.namespace=t.namespace,this.events=Zv("events"),this.client=Zv("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=H0t.getStorage(this.client.core.storage)}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t);case"wallet_sendCalls":return await this.sendCalls(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(parseInt(t),n);const r=this.chainId;this.chainId=parseInt(t),this.events.emit(tV.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${t}`,previousCaipChainId:`${this.name}:${r}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,n){const r=n||kye(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zv("disableProviderPing")))}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=parseInt(O0t(n));t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}getHttpProvider(t){const n=t||this.chainId;return this.httpProviders[n]||(this.httpProviders=LR(UR({},this.httpProviders),{[n]:this.createHttpProvider(n)}),this.httpProviders[n])}async handleSwitchChain(t){var n,r;let s=t.request.params?(n=t.request.params[0])==null?void 0:n.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const i=parseInt(s,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(r=this.namespace.chains)==null?void 0:r[0]}),this.setDefaultChain(`${i}`);else throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var n,r,s,i,o;const a=(r=(n=t.request)==null?void 0:n.params)==null?void 0:r[0],c=((i=(s=t.request)==null?void 0:s.params)==null?void 0:i[1])||[];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const l=this.client.session.get(t.topic),u=((o=l==null?void 0:l.sessionProperties)==null?void 0:o.capabilities)||{},d=c.length>0?c.join(","):`0x${this.chainId.toString(16)}`,h=`${a}${d}`,f=u==null?void 0:u[h];if(f)return f;let g;try{g=F0t(l,a,c)}catch(m){console.warn("Failed to extract capabilities from session",m)}if(g)return g;const p=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:LR(UR({},l.sessionProperties||{}),{capabilities:LR(UR({},u||{}),{[h]:p})})})}catch(m){console.warn("Failed to update session with capabilities",m)}return p}async getCallStatus(t){var n,r,s;const i=this.client.session.get(t.topic),o=(n=i.sessionProperties)==null?void 0:n.bundler_name;if(o){const l=this.getBundlerUrl(t.chainId,o);try{return await this.getUserOperationReceipt(l,t)}catch(u){console.warn("Failed to fetch call status from bundler",u,l)}}const a=(r=i.sessionProperties)==null?void 0:r.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,t)}catch(l){console.warn("Failed to fetch call status from custom bundler",l,a)}const c=await rgt({resultId:(s=t.request.params)==null?void 0:s[0],storage:this.storage});if(c)try{return await Q0t(c,this.getHttpProvider.bind(this))}catch(l){console.warn("Failed to fetch call status from stored send calls",l,c)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,n){var r;const s=new URL(t),i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_n("eth_getUserOperationReceipt",[(r=n.request.params)==null?void 0:r[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(t,n){return`${x0t}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${n}`}async sendCalls(t){var n,r,s;const i=await this.client.request(t),o=(n=t.request.params)==null?void 0:n[0],a=i==null?void 0:i.id,c=(i==null?void 0:i.capabilities)||{},l=(r=c==null?void 0:c.caip345)==null?void 0:r.caip2,u=(s=c==null?void 0:c.caip345)==null?void 0:s.transactionHashes;return!a||!l||!(u!=null&&u.length)||await tgt({sendCalls:{request:o,result:i},storage:this.storage}),i}};var ugt=Object.defineProperty,dgt=(e,t,n)=>t in e?ugt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w2=(e,t,n)=>dgt(e,typeof t!="symbol"?t+"":t,n);let hgt=class{constructor(t){w2(this,"name",Oye),w2(this,"client"),w2(this,"httpProviders"),w2(this,"events"),w2(this,"namespace"),w2(this,"chainId"),this.namespace=t.namespace,this.events=Zv("events"),this.client=Zv("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n);const r=this.chainId;this.chainId=t,this.events.emit(tV.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${t}`,previousCaipChainId:`${this.name}:${r}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getNamespaceName(){const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return i0(t).namespace}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){var t,n;const r={};return(n=(t=this.namespace)==null?void 0:t.accounts)==null||n.forEach(s=>{var i,o;const a=i0(s),c=(o=(i=this.namespace)==null?void 0:i.rpcMap)==null?void 0:o[`${a.namespace}:${a.reference}`];r[a.reference]=this.createHttpProvider(s,c)}),r}getHttpProvider(t){const n=i0(t).reference,r=this.httpProviders[n];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return r}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||kye(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zv("disableProviderPing")))}};var fgt=Object.defineProperty,pgt=Object.defineProperties,ggt=Object.getOwnPropertyDescriptors,yre=Object.getOwnPropertySymbols,mgt=Object.prototype.hasOwnProperty,wgt=Object.prototype.propertyIsEnumerable,wj=(e,t,n)=>t in e?fgt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eE=(e,t)=>{for(var n in t||(t={}))mgt.call(t,n)&&wj(e,n,t[n]);if(yre)for(var n of yre(t))wgt.call(t,n)&&wj(e,n,t[n]);return e},mI=(e,t)=>pgt(e,ggt(t)),Lc=(e,t,n)=>wj(e,typeof t!="symbol"?t+"":t,n);let ygt=class Uye{constructor(t){Lc(this,"client"),Lc(this,"namespaces"),Lc(this,"optionalNamespaces"),Lc(this,"sessionProperties"),Lc(this,"scopedProperties"),Lc(this,"events",new Bu),Lc(this,"rpcProviders",{}),Lc(this,"session"),Lc(this,"providerOpts"),Lc(this,"logger"),Lc(this,"uri"),Lc(this,"disableProviderPing",!1),Lc(this,"connectParams");var n,r;this.providerOpts=t,this.logger=YH({logger:(n=t.logger)!=null?n:rre,name:(r=this.providerOpts.name)!=null?r:Tye}),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const n=new Uye(t);return await n.initialize(),n}async request(t,n,r){const[s,i]=this.validateChain(n);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:eE({},t),chainId:`${s}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(t,n,r,s){const i=new Date().getTime();this.request(t,r,s).then(o=>n(null,Pi(i,o))).catch(o=>n(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Jr("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=t,this.setNamespaces(t),this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,n){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:r,response:s}=await this.client.authenticate(t,n);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await s();if(this.session=i.session,this.session){const o=lre(this.session.namespaces);this.namespaces=gI(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}removeListener(t,n){this.events.removeListener(t,n)}off(t,n){this.events.off(t,n)}get isWalletConnect(){return!0}async pair(t){var n,r;const{uri:s,approval:i}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:(n=this.connectParams)==null?void 0:n.authentication,walletPay:(r=this.connectParams)==null?void 0:r.walletPay});s&&(this.uri=s,this.events.emit("display_uri",s));const o=await i();this.session=o;const a=lre(o.namespaces);return this.namespaces=gI(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,n){try{if(!this.session)return;const[r,s]=this.validateChain(t),i=this.getProvider(r);i?i.setDefaultChain(s,n):this.session&&this.logger.warn(`Provider for namespace '${r}' not found in setDefaultChain`)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(t={}){try{this.logger.info("Cleaning up inactive pairings...");const n=this.client.pairing.getAll();if(!a0(n))return;for(const r of n)t.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${n.length}`)}catch(n){this.logger.warn(n,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,n;if(this.client=this.providerOpts.client||await Kpt.init({core:this.providerOpts.core,logger:this.providerOpts.logger||rre,relayUrl:this.providerOpts.relayUrl||C0t,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.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error(r,"Failed to get session"),new Error(`The provided session: ${(n=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:n.topic} doesn't exist in the Sign client`)}else{const r=this.client.session.getAll();this.session=r[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(n=>Ev(n)))];RR("client",this.client),RR("events",this.events),RR("disableProviderPing",this.disableProviderPing),t.forEach(n=>{if(!this.session)return;const r=k0t(n,this.session);if((r==null?void 0:r.length)===0)return;const s=Rye(r),i=gI(this.namespaces,this.optionalNamespaces),o=mI(eE({},i[n]),{accounts:r,chains:s});switch(n){case"eip155":this.rpcProviders[n]=new lgt({namespace:o});break;default:this.rpcProviders[n]=new hgt({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var n;const{topic:r}=t;r===((n=this.session)==null?void 0:n.topic)&&this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{var n;const{params:r,topic:s}=t;if(s!==((n=this.session)==null?void 0:n.topic))return;const{event:i}=r;if(i.name==="accountsChanged"){const o=i.data;o&&a0(o)&&this.events.emit("accountsChanged",o.map(cre))}else if(i.name==="chainChanged"){const o=r.chainId,a=r.event.data,c=Ev(o),l=kR(o)!==kR(a)?`${c}:${kR(a)}`:o;this.onChainChanged({currentCaipChainId:l})}else this.events.emit(i.name,i.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:n})=>{var r,s;if(t!==((r=this.session)==null?void 0:r.topic))return;const{namespaces:i}=n,o=(s=this.client)==null?void 0:s.session.get(t);this.session=mI(eE({},o),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:n})}),this.client.on("session_delete",async t=>{var n;t.topic===((n=this.session)==null?void 0:n.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",mI(eE({},Jr("USER_DISCONNECTED")),{data:t.topic})))}),this.on(tV.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(mI(eE({},t),{internal:!0}))})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[Oye]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var n;this.getProvider(t).updateNamespace((n=this.session)==null?void 0:n.namespaces[t])})}setNamespaces(t){const{namespaces:n={},optionalNamespaces:r={},sessionProperties:s,scopedProperties:i}=t;this.optionalNamespaces=gI(n,r),this.sessionProperties=s,this.scopedProperties=i}validateChain(t){const[n,r]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[n,r];if(n&&!Object.keys(this.namespaces||{}).map(o=>Ev(o)).includes(n))throw new Error(`Namespace '${n}' is not configured. Please call connect() first with namespace config.`);if(n&&r)return[n,r];const s=Ev(Object.keys(this.namespaces)[0]),i=this.rpcProviders[s].getDefaultChain();return[s,i]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged({currentCaipChainId:t,previousCaipChainId:n,internal:r=!1}){if(!this.namespaces)return;const[s,i]=this.validateChain(t);if(i){if(this.updateNamespaceChain(s,i),r)this.events.emit("chainChanged",i),this.emitAccountsChangedOnChainChange({namespace:s,currentCaipChainId:t,previousCaipChainId:n});else{const o=this.getProvider(s);o?o.setDefaultChain(i):this.session&&this.logger.warn(`Provider for namespace '${s}' not found during chain change`)}await this.persist("namespaces",this.namespaces)}}emitAccountsChangedOnChainChange({namespace:t,currentCaipChainId:n,previousCaipChainId:r}){var s,i;try{if(r===n)return;const o=(i=(s=this.session)==null?void 0:s.namespaces[t])==null?void 0:i.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${n}:`)).map(cre);if(!a0(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn(o,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(t,n){if(!this.namespaces)return;const r=this.namespaces[t]?t:`${t}:${n}`,s={chains:[],methods:[],events:[],defaultChain:n};this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=n):this.namespaces[r]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,n){var r;const s=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.setItem(`${fI}/${t}${s}`,n)}async getFromStore(t){var n;const r=((n=this.session)==null?void 0:n.topic)||"";return await this.client.core.storage.getItem(`${fI}/${t}${r}`)}async deleteFromStore(t){var n;const r=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.removeItem(`${fI}/${t}${r}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const n=await this.client.core.storage.getKeys();for(const r of n)r.startsWith(fI)&&await this.client.core.storage.removeItem(r)}catch(n){this.logger.warn(n,"Failed to cleanup storage")}}};const bre=2147483648,bgt={convertEVMChainIdToCoinType(e){if(e>=bre)throw new Error("Invalid chainId");return(bre|e)>>>0}},jl=zr({suggestions:[],loading:!1}),vgt={state:jl,subscribe(e){return Gi(jl,()=>e(jl))},subscribeKey(e,t){return Zi(jl,e,t)},async resolveName(e){var t,n;try{return await Pt.lookupEnsName(e)}catch(r){const s=r;throw new Error(((n=(t=s==null?void 0:s.reasons)==null?void 0:t[0])==null?void 0:n.description)||"Error resolving name")}},async isNameRegistered(e){try{return await Pt.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{jl.loading=!0,jl.suggestions=[];const t=await Pt.getEnsNameSuggestions(e);return jl.suggestions=t.suggestions||[],jl.suggestions}catch(t){const n=f8.parseEnsApiError(t,"Error fetching name suggestions");throw new Error(n)}finally{jl.loading=!1}},async getNamesForAddress(e){try{if(!G.state.activeCaipNetwork)return[];const n=xe.getEnsFromCacheForAddress(e);if(n)return n;const r=await Pt.reverseLookupEnsName({address:e});return xe.updateEnsCache({address:e,ens:r,timestamp:Date.now()}),r}catch(t){const n=f8.parseEnsApiError(t,"Error fetching names for address");throw new Error(n)}},async registerName(e){var s;const t=G.state.activeCaipNetwork,n=(s=G.getAccountData(t==null?void 0:t.chainNamespace))==null?void 0:s.address,r=Te.getAuthConnector();if(!t)throw new Error("Network not found");if(!n||!r)throw new Error("Address or auth connector not found");jl.loading=!0;try{const i=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now()/1e3)});xt.pushTransactionStack({onCancel(){xt.replace("RegisterAccountName")}});const o=await Ue.signMessage(i);jl.loading=!1;const a=t.id;if(!a)throw new Error("Network not found");const c=bgt.convertEVMChainIdToCoinType(Number(a));await Pt.registerEnsName({coinType:c,address:n,signature:o,message:i}),G.setAccountProp("profileName",e,t.chainNamespace),xe.updateEnsCache({address:n,ens:[{name:e,registered_at:new Date().toISOString(),updated_at:void 0,addresses:{},attributes:[]}],timestamp:Date.now()}),xt.replace("RegisterAccountNameSuccess")}catch(i){const o=f8.parseEnsApiError(i,`Error registering name ${e}`);throw xt.replace("RegisterAccountName"),new Error(o)}finally{jl.loading=!1}},validateName(e){return/^[a-zA-Z0-9-]{4,}$/u.test(e)},parseEnsApiError(e,t){var r,s;const n=e;return((s=(r=n==null?void 0:n.reasons)==null?void 0:r[0])==null?void 0:s.description)||t}},f8=Lu(vgt);function yj(e){try{return new URL(e)}catch{return null}}function Egt(e){const t=e.split("/"),n=t.length>0&&t[0]!==void 0?t[0]:"",r=n.lastIndexOf(":");return r===-1?{host:n}:{host:n.slice(0,r),port:n.slice(r+1)}}function Cgt(e){const t=e.indexOf("://");if(t===-1)return null;const n=e.slice(0,t),r=t+3;let s=e.indexOf("/",r);s===-1&&(s=e.length);const i=e.slice(r,s),o=i.lastIndexOf(":");return o===-1?{scheme:n,host:i}:{scheme:n,host:i.slice(0,o),port:i.slice(o+1)}}function $gt(e,t){if(t.includes("://")){const o=yj(t);return o?o.origin===e:!1}const{host:n,port:r}=Egt(t),s=e.indexOf("://");if(s!==-1){const o=s+3;let a=e.indexOf("/",o);a===-1&&(a=e.length);const c=e.slice(o,a);if(r!==void 0)return`${n}:${r}`===c;const l=c.split(":")[0];return n===l}const i=yj(e);return i?r!==void 0?n===i.hostname&&r===(i.port||void 0):n===i.hostname:!1}function xgt(e,t,n){let r=n,s;const i=r.indexOf("://");i!==-1&&(s=r.slice(0,i),r=r.slice(i+3));const o=r.indexOf("/");o!==-1&&(r=r.slice(0,o));let a=r,c;const l=a.lastIndexOf(":");l!==-1&&(c=a.slice(l+1),a=a.slice(0,l));const u=a.split(".");for(const p of u)if(p.includes("*")&&p!=="*")return!1;const d=e.protocol.replace(/:$/u,"");if(s&&s!==d||c!==void 0&&c!=="*"&&c!==e.port)return!1;const h=Cgt(t),g=(h?h.host:e.hostname).split(".");if(u.length!==g.length)return!1;for(let p=u.length-1;p>=0;p-=1){const m=u[p],w=g[p];if(m!=="*"&&m!==w)return!1}return!0}const Igt={ton:["ton_sendMessage","ton_signData"],solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"],tron:["tron_signMessage","tron_signTransaction"]},xm={RPC_ERROR_CODE:{USER_REJECTED:5e3,USER_REJECTED_METHODS:5002},getMethodsByChainNamespace(e){return Igt[e]||[]},createDefaultNamespace(e){return{methods:this.getMethodsByChainNamespace(e),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(e,t){if(!t)return{...e};const n={...e},r=new Set;if(t.methods&&Object.keys(t.methods).forEach(s=>r.add(s)),t.chains&&Object.keys(t.chains).forEach(s=>r.add(s)),t.events&&Object.keys(t.events).forEach(s=>r.add(s)),t.rpcMap&&Object.keys(t.rpcMap).forEach(s=>{const[i]=s.split(":");i&&r.add(i)}),r.forEach(s=>{n[s]||(n[s]=this.createDefaultNamespace(s))}),t.methods&&Object.entries(t.methods).forEach(([s,i])=>{n[s]&&(n[s].methods=i)}),t.chains&&Object.entries(t.chains).forEach(([s,i])=>{n[s]&&(n[s].chains=i)}),t.events&&Object.entries(t.events).forEach(([s,i])=>{n[s]&&(n[s].events=i)}),t.rpcMap){const s=new Set;Object.entries(t.rpcMap).forEach(([i,o])=>{const[a,c]=i.split(":");!a||!c||!n[a]||(n[a].rpcMap||(n[a].rpcMap={}),s.has(a)||(n[a].rpcMap={},s.add(a)),n[a].rpcMap[c]=o)})}return n},createNamespaces(e,t){const n=e.reduce((r,s)=>{const{id:i,chainNamespace:o,rpcUrls:a}=s,c=a.default.http[0];r[o]||(r[o]=this.createDefaultNamespace(o));const l=`${o}:${i}`,u=r[o];switch(u.chains.push(l),l){case"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":u.chains.push("solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ");break;case"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":u.chains.push("solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K");break}return u!=null&&u.rpcMap&&c&&(u.rpcMap[i]=c),r},{});return this.applyNamespaceOverrides(n,t)},resolveReownName:async e=>{var r;const t=await f8.resolveName(e);return((r=(t!=null&&t.addresses?Object.values(t.addresses):[])[0])==null?void 0:r.address)||!1},getChainsFromNamespaces(e={}){return Object.values(e).flatMap(t=>{const n=t.chains||[],r=t.accounts.map(s=>{const[i,o]=s.split(":");return`${i}:${o}`});return Array.from(new Set([...n,...r]))})},isSessionEventData(e){return typeof e=="object"&&e!==null&&"id"in e&&"topic"in e&&"params"in e&&typeof e.params=="object"&&e.params!==null&&"chainId"in e.params&&"event"in e.params&&typeof e.params.event=="object"&&e.params.event!==null},isUserRejectedRequestError(e){try{if(typeof e=="object"&&e!==null){const t=e,n=typeof t.code=="number",r=n&&t.code===xm.RPC_ERROR_CODE.USER_REJECTED_METHODS,s=n&&t.code===xm.RPC_ERROR_CODE.USER_REJECTED;return r||s}return!1}catch{return!1}},isOriginAllowed(e,t,n){const r=[...t,...n];if(t.length===0)return!0;const s=yj(e);if(!s)return r.some(i=>!i.includes("*")&&i===e);if(s.hostname==="localhost"||s.hostname==="127.0.0.1")return!0;for(const i of r)if(i.includes("*")){if(xgt(s,e,i))return!0}else if($gt(e,i))return!0;return!1},listenWcProvider({universalProvider:e,namespace:t,onConnect:n,onDisconnect:r,onAccountsChanged:s,onChainChanged:i,onDisplayUri:o}){n&&e.on("connect",()=>{const a=xm.getWalletConnectAccounts(e,t);n(a)}),r&&e.on("disconnect",()=>{r()}),s&&e.on("accountsChanged",a=>{var c,l,u,d,h;try{const f=((u=(l=(c=e.session)==null?void 0:c.namespaces)==null?void 0:l[t])==null?void 0:u.accounts)||[],g=(h=(d=e.rpcProviders)==null?void 0:d[t])==null?void 0:h.getDefaultChain(),p=a.map(m=>{const w=f.find(b=>b.includes(`${t}:${g}:${m}`));if(!w)return;const{chainId:C,chainNamespace:E}=Ci.parseCaipAddress(w);return{address:m,chainId:C,chainNamespace:E}}).filter(m=>m!==void 0);p.length>0&&s(p)}catch(f){console.warn("Failed to parse accounts for namespace on accountsChanged event",t,a,f)}}),i&&e.on("chainChanged",a=>{i(a)}),o&&e.on("display_uri",a=>{o(a)})},getWalletConnectAccounts(e,t){var s,i,o,a;const n=new Set,r=(a=(o=(i=(s=e==null?void 0:e.session)==null?void 0:s.namespaces)==null?void 0:i[t])==null?void 0:o.accounts)==null?void 0:a.map(c=>Ci.parseCaipAddress(c)).filter(({address:c})=>n.has(c.toLowerCase())?!1:(n.add(c.toLowerCase()),!0));return r&&r.length>0?r:[]}},Sgt=[he.CONNECTOR_ID.AUTH,he.CONNECTOR_ID.WALLET_CONNECT];let Agt=class{constructor(t){this.availableConnectors=[],this.availableConnections=[],this.providerHandlers={},this.eventListeners=new Map,this.getCaipNetworks=n=>G.getCaipNetworks(n),this.getConnectorId=n=>Te.getConnectorId(n),t&&this.construct(t)}construct(t){this.projectId=t.projectId,this.namespace=t.namespace,this.adapterType=t.adapterType}get connectors(){return this.availableConnectors}get connections(){return this.availableConnections}get networks(){return this.getCaipNetworks(this.namespace)}onAuthConnected({accounts:t,chainId:n}){const r=this.getCaipNetworks().filter(s=>s.chainNamespace===this.namespace).find(s=>s.id.toString()===(n==null?void 0:n.toString()));t&&r&&this.addConnection({connectorId:he.CONNECTOR_ID.AUTH,accounts:t,caipNetwork:r})}setAuthProvider(t){t.onConnect(this.onAuthConnected.bind(this)),t.onSocialConnected(this.onAuthConnected.bind(this)),this.addConnector({id:he.CONNECTOR_ID.AUTH,type:"AUTH",
78name:he.CONNECTOR_NAMES.AUTH,provider:t,imageId:void 0,chain:this.namespace,chains:[]})}addConnector(...t){const n=new Set;this.availableConnectors=[...t,...this.availableConnectors].filter(r=>n.has(r.id)?!1:(n.add(r.id),!0)),this.emit("connectors",this.availableConnectors)}addConnection(...t){const n=new Set;this.availableConnections=[...t,...this.availableConnections].filter(r=>n.has(r.connectorId.toLowerCase())?!1:(n.add(r.connectorId.toLowerCase()),!0)),this.emit("connections",this.availableConnections)}deleteConnection(t){this.availableConnections=this.availableConnections.filter(n=>n.connectorId.toLowerCase()!==t.toLowerCase()),this.emit("connections",this.availableConnections)}clearConnections(t=!1){this.availableConnections=[],t&&this.emit("connections",this.availableConnections)}setStatus(t,n){G.setAccountProp("status",t,n)}on(t,n){var r;this.eventListeners.has(t)||this.eventListeners.set(t,new Set),(r=this.eventListeners.get(t))==null||r.add(n)}off(t,n){const r=this.eventListeners.get(t);r&&r.delete(n)}removeAllEventListeners(){this.eventListeners.forEach(t=>{t.clear()})}emit(t,n){const r=this.eventListeners.get(t);r&&r.forEach(s=>s(n))}async connectWalletConnect(t){try{return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}catch(n){throw xm.isUserRejectedRequestError(n)?new e0e(n):n}}async switchNetwork(t){var i;const{caipNetwork:n}=t,r=Br.getProviderId(n.chainNamespace),s=Br.getProvider(n.chainNamespace);if(!s)throw new Error("Provider not found");if(r==="WALLET_CONNECT"){s.setDefaultChain(n.caipNetworkId);return}if(r==="AUTH"){const o=(i=Te.getAuthConnector())==null?void 0:i.provider;if(!o)throw new Error("Auth provider not found");const a=pu(n.chainNamespace);await o.switchNetwork({chainId:n.caipNetworkId});const c=await o.getUser({chainId:n.caipNetworkId,preferredAccountType:a});this.emit("switchNetwork",c)}}getWalletConnectConnector(){const t=this.connectors.find(n=>n.id==="walletConnect");if(!t)throw new Error("WalletConnectConnector not found");return t}onConnect(t,n){if(t.length>0){const{address:r,chainId:s}=Je.getAccount(t[0]),i=this.getCaipNetworks().filter(a=>a.chainNamespace===this.namespace).find(a=>a.id.toString()===(s==null?void 0:s.toString())),o=this.connectors.find(a=>a.id===n);
78r&&(this.emit("accountChanged",{address:r,chainId:s,connector:o}),this.addConnection({connectorId:n,accounts:t.map(a=>{const{address:c}=Je.getAccount(a);return{address:c}}),caipNetwork:i}))}}onAccountsChanged(t,n,r=!0){var s,i;if(t.length>0){const{address:o}=Je.getAccount(t[0]),a=this.getConnection({connectorId:n,connections:this.connections,connectors:this.connectors});o&&((s=this.getConnectorId(he.CHAIN.EVM))==null?void 0:s.toLowerCase())===n.toLowerCase()&&this.emit("accountChanged",{address:o,chainId:(i=a==null?void 0:a.caipNetwork)==null?void 0:i.id,connector:a==null?void 0:a.connector}),this.addConnection({connectorId:n,accounts:t.map(c=>{const{address:l}=Je.getAccount(c);return{address:l}}),caipNetwork:a==null?void 0:a.caipNetwork})}else r&&this.onDisconnect(n)}onDisconnect(t){var n;this.removeProviderListeners(t),this.deleteConnection(t),((n=this.getConnectorId(he.CHAIN.EVM))==null?void 0:n.toLowerCase())===t.toLowerCase()&&this.emitFirstAvailableConnection(),this.connections.length===0&&this.emit("disconnect")}onChainChanged(t,n){var o;const r=typeof t=="string"&&t.startsWith("0x")?parseInt(t,16).toString():t.toString(),s=this.getConnection({connectorId:n,connections:this.connections,connectors:this.connectors}),i=this.getCaipNetworks().filter(a=>a.chainNamespace===this.namespace).find(a=>a.id.toString()===r);s&&this.addConnection({connectorId:n,accounts:s.accounts,caipNetwork:i}),((o=this.getConnectorId(he.CHAIN.EVM))==null?void 0:o.toLowerCase())===n.toLowerCase()&&this.emit("switchNetwork",{chainId:r})}listenProviderEvents(t,n){if(Sgt.includes(t))return;const r=o=>this.onAccountsChanged(o,t),s=o=>this.onChainChanged(o,t),i=()=>this.onDisconnect(t);this.providerHandlers[t]||(n.on("disconnect",i),n.on("accountsChanged",r),n.on("chainChanged",s),this.providerHandlers[t]={provider:n,disconnect:i,accountsChanged:r,chainChanged:s})}removeProviderListeners(t){if(this.providerHandlers[t]){const{provider:n,disconnect:r,accountsChanged:s,chainChanged:i}=this.providerHandlers[t];n.removeListener("disconnect",r),n.removeListener("accountsChanged",s),n.removeListener("chainChanged",i),this.providerHandlers[t]=null}}emitFirstAvailableConnection(){var n;const t=this.getConnection({connections:this.connections,connectors:this.connectors});if(t){const[r]=t.accounts;this.emit("accountChanged",{address:r==null?void 0:r.address,chainId:(n=t.caipNetwork)==null?void 0:n.id,connector:t.connector})}}getConnection({address:t,connectorId:n,connections:r,connectors:s}){if(n){const o=r.find(l=>l.connectorId.toLowerCase()===n.toLowerCase());if(!o)return null;const a=s.find(l=>l.id.toLowerCase()===o.connectorId.toLowerCase()),c=t?o.accounts.find(l=>l.address.toLowerCase()===t.toLowerCase()):o.accounts[0];return{...o,account:c,connector:a}}const i=r.find(o=>o.accounts.length>0&&s.some(a=>a.id.toLowerCase()===o.connectorId.toLowerCase()));if(i){const[o]=i.accounts,a=s.find(c=>c.id.toLowerCase()===i.connectorId.toLowerCase());return{...i,account:o,connector:a}}return null}},B1=null;const bd={getSIWX(){return pe.state.siwx},async initializeIfEnabled(e=G.getActiveCaipAddress()){var i,o,a;const t=pe.state.siwx;if(!(t&&e))return;const[n,r,s]=e.split(":");if(G.checkIfSupportedNetwork(n,`${n}:${r}`))try{if((i=pe.state.remoteFeatures)!=null&&i.emailCapture){const l=(o=G.getAccountData(n))==null?void 0:o.user;await dn.open({view:"DataCapture",data:{email:(l==null?void 0:l.email)??void 0}});return}if(B1&&await B1,(await t.getSessions(`${n}:${r}`,s)).length)return;await dn.open({view:"SIWXSignMessage"})}catch(c){console.error("SIWXUtil:initializeIfEnabled",c),sn.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(c)}),await((a=Ue._getClient())==null?void 0:a.disconnect().catch(console.error)),xt.reset("Connect"),Lh.showError("A problem occurred while trying initialize authentication")}},async isAuthenticated(e=G.getActiveCaipAddress()){if(!pe.state.siwx||!e)return!0;const{chainNamespace:n,chainId:r,address:s}=Ci.parseCaipAddress(e),i=`${n}:${r}`;return(await bd.getSessions({address:s,caipNetworkId:i})).length>0},async requestSignMessage(){const e=pe.state.siwx,t=Je.getPlainAddress(G.getActiveCaipAddress()),n=kE();if(!e)throw new Error("SIWX is not enabled");if(!t)throw new Error("No ActiveCaipAddress found");if(!n)throw new Error("No ActiveCaipNetwork or client found");try{const r=await e.createMessage({chainId:n.caipNetworkId,accountAddress:t}),s=r.toString();let i="";e.signMessage?i=await e.signMessage({message:s,chainId:n.caipNetworkId,accountAddress:t}):(Te.getConnectorId(n.chainNamespace)===he.CONNECTOR_ID.AUTH&&xt.pushTransactionStack({}
78),i=await Ue.signMessage(s)||""),await e.addSession({data:r,message:s,signature:i}),G.setLastConnectedSIWECaipNetwork(n),dn.close(),sn.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(r){(!dn.state.open||xt.state.view==="ApproveTransaction")&&await dn.open({view:"SIWXSignMessage"}),Lh.showError("Error signing message"),sn.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(r)}),console.error("SWIXUtil:requestSignMessage",r)}},async cancelSignMessage(){var e;try{const t=this.getSIWX();if((e=t==null?void 0:t.getRequired)==null?void 0:e.call(t)){const r=G.getLastConnectedSIWECaipNetwork();if(r){const s=await(t==null?void 0:t.getSessions(r==null?void 0:r.caipNetworkId,Je.getPlainAddress(G.getActiveCaipAddress())||""));s&&s.length>0?await G.switchActiveNetwork(r):await Ue.disconnect()}else await Ue.disconnect()}else dn.close();dn.close(),sn.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(t){console.error("SIWXUtil:cancelSignMessage",t)}},async getAllSessions(){const e=this.getSIWX(),t=G.getAllRequestedCaipNetworks(),n=[];return await Promise.all(t.map(async r=>{const s=await(e==null?void 0:e.getSessions(r.caipNetworkId,Je.getPlainAddress(G.getActiveCaipAddress())||""));s&&n.push(...s)})),n},async getSessions(e){const t=pe.state.siwx;let n=e==null?void 0:e.address;if(!n){const s=G.getActiveCaipAddress();n=Je.getPlainAddress(s)}let r=e==null?void 0:e.caipNetworkId;if(!r){const s=G.getActiveCaipNetwork();r=s==null?void 0:s.caipNetworkId}return t&&n&&r?t.getSessions(r,n):[]},async isSIWXCloseDisabled(){var t;const e=this.getSIWX();if(e){const n=xt.state.view==="ApproveTransaction",r=xt.state.view==="SIWXSignMessage";if(n||r)return((t=e.getRequired)==null?void 0:t.call(e))&&(await this.get
78Sessions()).length===0}return!1},async authConnectorAuthenticate({authConnector:e,chainId:t,socialUri:n,preferredAccountType:r,chainNamespace:s}){var d;const i=bd.getSIWX(),o=kE();if(!i||!s.includes(he.CHAIN.EVM)||(d=pe.state.remoteFeatures)!=null&&d.emailCapture){const h=await e.connect({chainId:t,socialUri:n,preferredAccountType:r});return{address:h.address,chainId:h.chainId,accounts:h.accounts}}const a=`${s}:${t}`,c=await i.createMessage({chainId:a,accountAddress:"<<AccountAddress>>"}),l={accountAddress:c.accountAddress,chainId:c.chainId,domain:c.domain,uri:c.uri,version:c.version,nonce:c.nonce,notBefore:c.notBefore,statement:c.statement,resources:c.resources,requestId:c.requestId,issuedAt:c.issuedAt,expirationTime:c.expirationTime,serializedMessage:c.toString()},u=await e.connect({chainId:t,socialUri:n,siwxMessage:l,preferredAccountType:r});return l.accountAddress=u.address,l.serializedMessage=u.message||"",u.signature&&u.message&&await bd.addEmbeddedWalletSession(l,u.message,u.signature),G.setLastConnectedSIWECaipNetwork(o),{address:u.address,chainId:u.chainId,accounts:u.accounts}},async addEmbeddedWalletSession(e,t,n){if(B1)return B1;const r=bd.getSIWX();return r?(B1=r.addSession({data:e,message:t,signature:n}).finally(()=>{B1=null}),B1):Promise.resolve()},async universalProviderAuthenticate({universalProvider:e,chains:t,methods:n}){var l,u,d;const r=bd.getSIWX(),s=kE(),i=new Set(t.map(h=>h.split(":")[0]));if(!r||i.size!==1||!i.has("eip155"))return!1;const o=await r.createMessage({chainId:((l=kE())==null?void 0:l.caipNetworkId)||"",accountAddress:""}),a=await e.authenticate({nonce:o.nonce,domain:o.domain,uri:o.uri,exp:o.expirationTime,iat:o.issuedAt,nbf:o.notBefore,requestId:o.requestId,version:o.version,resources:o.resources,statement:o.statement,chainId:o.chainId,methods:n,chains:[o.chainId,...t.filter(h=>h!==o.chainId)]});Lh.showLoading("Authenticating...",{autoClose:!1});const c={...a.session.peer.metadata,name:a.session.peer.metadata.name,icon:(u=a.session.peer.metadata.icons)==null?void 0:u[0],type:"WALLET_CONNECT"};if(G.setAccountProp("connectedWalletInfo",c,Array.from(i)[0]),(d=a==null?void 0:a.auths)!=null&&d.length){const h=a.auths.map(f=>{const g=e.client.formatAuthMessage({request:f.p,iss:f.p.iss});return{data:{...f.p,accountAddress:f.p.iss.split(":").slice(-1).join(""),chainId:f.p.iss.split(":").slice(2,4).join(":"),uri:f.p.aud??"",version:f.p.version||o.version,expirationTime:f.p.exp,issuedAt:f.p.iat,notBefore:f.p.nbf},message:g,signature:f.s.s,cacao:f}});try{await r.setSessions(h),s&&G.setLastConnectedSIWECaipNetwork(s),sn.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:bd.getSIWXEventProperties()})}catch(f){throw console.error("SIWX:universalProviderAuth - failed to set sessions",f),sn.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:bd.getSIWXEventProperties(f)}),await e.disconnect().catch(console.error),f}finally{Lh.hide()}}return!0},getSIWXEventProperties(e){var n;const t=G.state.activeChain;if(!t)throw new Error("SIWXUtil:getSIWXEventProperties - namespace is required");return{network:((n=G.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||"",isSmartAccount:pu(t)===Lp.ACCOUNT_TYPES.SMART_ACCOUNT,message:e?Je.parseError(e):void 0}},async clearSessions(){const e=this.getSIWX();e&&await e.setSessions([])}};let _gt=class{constructor({provider:t,namespace:n}){this.id=he.CONNECTOR_ID.WALLET_CONNECT,this.name="WalletConnect",this.type="WALLET_CONNECT",this.imageId="ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",this.getCaipNetworks=G.getCaipNetworks.bind(G),this.caipNetworks=this.getCaipNetworks(),this.provider=t,this.chain=n}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const n=this.getCaipNetworks(),r=pe.state.universalProviderConfigOverride,s=xm.createNamespaces(n,r);await this.provider.connect({optionalNamespaces:s})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){const t=this.chains.map(n=>n.caipNetworkId);return bd.universalProviderAuthenticate({universalProvider:this.provider,chains:t,methods:Ngt})}};const Ngt=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],ed=zr({message:"",variant:"info",open:!1}),Tgt={state:ed,subscribeKey(e,t){return Zi(ed,e,t)},open(e,t){const{debug:n}=pe.state,{code:r,displayMessage:s,debugMessage:i}=e;s&&n&&(ed.message=s,ed.variant=t,ed.open=!0)}
vendor: 4,631 bytes, line 78
78,warn(e,t,n){ed.open=!0,ed.message=e,ed.variant="warning",t&&console.warn(t,n)},close(){ed.open=!1,ed.message="",ed.variant="info"}},qc=Lu(Tgt),Pgt={asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"},Ogt={asset:"0x036CbD53842c5426634e7929541eC2318f3dCF7e"};const PS=globalThis,nV=PS.ShadowRoot&&(PS.ShadyCSS===void 0||PS.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rV=Symbol(),vre=new WeakMap;let Lye=class{constructor(t,n,r){if(this._$cssResult$=!0,r!==rV)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(nV&&t===void 0){const r=n!==void 0&&n.length===1;r&&(t=vre.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&vre.set(n,t))}return t}toString(){return this.cssText}};const Xr=e=>new Lye(typeof e=="string"?e:e+"",void 0,rV),Xe=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((r,s,i)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[i+1],e[0]);return new Lye(n,e,rV)},kgt=(e,t)=>{if(nV)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const r=document.createElement("style"),s=PS.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=n.cssText,e.appendChild(r)}},Ere=nV?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const r of t.cssRules)n+=r.cssText;return Xr(n)})(e):e;const{is:Rgt,defineProperty:Bgt,getOwnPropertyDescriptor:Dgt,getOwnPropertyNames:Ugt,getOwnPropertySymbols:Lgt,getPrototypeOf:Mgt}=Object,Im=globalThis,Cre=Im.trustedTypes,jgt=Cre?Cre.emptyScript:"",MR=Im.reactiveElementPolyfillSupport,p8=(e,t)=>e,IA={toAttribute(e,t){switch(t){case Boolean:e=e?jgt:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},sV=(e,t)=>!Rgt(e,t),$re={attribute:!0,type:String,converter:IA,reflect:!1,useDefault:!1,hasChanged:sV};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Im.litPropertyMetadata??(Im.litPropertyMetadata=new WeakMap);let ev=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=$re){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(t,r,n);s!==void 0&&Bgt(this.prototype,t,s)}}static getPropertyDescriptor(t,n,r){const{get:s,set:i}=Dgt(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);i==null||i.call(this,o),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??$re}static _$Ei(){if(this.hasOwnProperty(p8("elementProperties")))return;const t=Mgt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(p8("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(p8("properties"))){const n=this.properties,r=[...Ugt(n),...Lgt(n)];for(const s of r)this.createProperty(s,n[s])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[r,s]of n)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[n,r]of this.elementProperties){const s=this._$Eu(n,r);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const s of r)n.unshift(Ere(s))}else t!==void 0&&n.push(Ere(t));return n}static _$Eu(t,n){const r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(n=>n(this))}addController(t){var n;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)==null||n.call(t))}
vendor: 4,229 bytes, lines 78-80
78removeController(t){var n;(n=this._$EO)==null||n.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const r of n.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return kgt(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var r;return(r=n.hostConnected)==null?void 0:r.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var r;return(r=n.hostDisconnected)==null?void 0:r.call(n)})}attributeChangedCallback(t,n,r){this._$AK(t,r)}_$ET(t,n){var i;const r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){const o=(((i=r.converter)==null?void 0:i.toAttribute)!==void 0?r.converter:IA).toAttribute(n,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,n){var i,o;const r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=r.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:IA;this._$Em=s;const l=c.fromAttribute(n,a.type);this[s]=l??((o=this._$Ej)==null?void 0:o.get(s))??l,this._$Em=null}}requestUpdate(t,n,r,s=!1,i){var o;if(t!==void 0){const a=this.constructor;if(s===!1&&(i=this[t]),r??(r=a.getPropertyOptions(t)),!((r.hasChanged??sV)(i,n)||r.useDefault&&r.reflect&&i===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,r))))return;this.C(t,n,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:r,reflect:s,wrapped:i},o){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??n??this[t]),i!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:a}=o,c=this[i];a!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(r=this._$EO)==null||r.forEach(s=>{var i;return(i=s.hostUpdate)==null?void 0:i.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};ev.elementStyles=[],ev.shadowRootOptions={mode:"open"},ev[p8("elementProperties")]=new Map,ev[p8("finalized")]=new Map,MR==null||MR({ReactiveElement:ev}),(Im.reactiveElementVersions??(Im.reactiveElementVersions=[])).push("2.1.2");const g8=globalThis,xre=e=>e,SA=g8.trustedTypes,Ire=SA?SA.createPolicy("lit-html",{createHTML:e=>e}):void 0,Mye="$lit$",sm=`lit$${Math.random().toFixed(9).slice(2)}$`,jye="?"+sm,Fgt=`<${jye}>`,iy=document,u4=()=>iy.createComment(""),d4=e=>e===null||typeof e!="object"&&typeof e!="function",iV=Array.isArray,zgt=e=>iV(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",jR=`[ 79\f\r]`,tE=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Sre=/-->/g,Are=/>/g,D1=RegExp(`>|${jR}(?:([^\\s"'>=/]+)(${jR}*=${jR}*(?:[^ 80\f\r"'\`<>=]|("|')|))|$)`,"g"),_re=/'/g,Nre=/"/g,Fye=/^(?:script|style|textarea|title)$/i,zye=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}
vendor: 14,444 bytes, line 80
80),j=zye(1),ae=zye(2),C0=Symbol.for("lit-noChange"),ms=Symbol.for("lit-nothing"),Tre=new WeakMap,Ew=iy.createTreeWalker(iy,129);function qye(e,t){if(!iV(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ire!==void 0?Ire.createHTML(t):t}const qgt=(e,t)=>{const n=e.length-1,r=[];let s,i=t===2?"<svg>":t===3?"<math>":"",o=tE;for(let a=0;a<n;a++){const c=e[a];let l,u,d=-1,h=0;for(;h<c.length&&(o.lastIndex=h,u=o.exec(c),u!==null);)h=o.lastIndex,o===tE?u[1]==="!--"?o=Sre:u[1]!==void 0?o=Are:u[2]!==void 0?(Fye.test(u[2])&&(s=RegExp("</"+u[2],"g")),o=D1):u[3]!==void 0&&(o=D1):o===D1?u[0]===">"?(o=s??tE,d=-1):u[1]===void 0?d=-2:(d=o.lastIndex-u[2].length,l=u[1],o=u[3]===void 0?D1:u[3]==='"'?Nre:_re):o===Nre||o===_re?o=D1:o===Sre||o===Are?o=tE:(o=D1,s=void 0);const f=o===D1&&e[a+1].startsWith("/>")?" ":"";i+=o===tE?c+Fgt:d>=0?(r.push(l),c.slice(0,d)+Mye+c.slice(d)+sm+f):c+sm+(d===-2?a:f)}return[qye(e,i+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};let bj=class Wye{constructor({strings:t,_$litType$:n},r){let s;this.parts=[];let i=0,o=0;const a=t.length-1,c=this.parts,[l,u]=qgt(t,n);if(this.el=Wye.createElement(l,r),Ew.currentNode=this.el.content,n===2||n===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=Ew.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(Mye)){const h=u[o++],f=s.getAttribute(d).split(sm),g=/([.?@])?(.*)/.exec(h);c.push({type:1,index:i,name:g[2],strings:f,ctor:g[1]==="."?Hgt:g[1]==="?"?Vgt:g[1]==="@"?Kgt:vT}),s.removeAttribute(d)}else d.startsWith(sm)&&(c.push({type:6,index:i}),s.removeAttribute(d));if(Fye.test(s.tagName)){const d=s.textContent.split(sm),h=d.length-1;if(h>0){s.textContent=SA?SA.emptyScript:"";for(let f=0;f<h;f++)s.append(d[f],u4()),Ew.nextNode(),c.push({type:2,index:++i});s.append(d[h],u4())}}}else if(s.nodeType===8)if(s.data===jye)c.push({type:2,index:i});else{let d=-1;for(;(d=s.data.indexOf(sm,d+1))!==-1;)c.push({type:7,index:i}),d+=sm.length-1}i++}}static createElement(t,n){const r=iy.createElement("template");return r.innerHTML=t,r}};function m5(e,t,n=e,r){var o,a;if(t===C0)return t;let s=r!==void 0?(o=n._$Co)==null?void 0:o[r]:n._$Cl;const i=d4(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==i&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),i===void 0?s=void 0:(s=new i(e),s._$AT(e,n,r)),r!==void 0?(n._$Co??(n._$Co=[]))[r]=s:n._$Cl=s),s!==void 0&&(t=m5(e,s._$AS(e,t.values),s,r)),t}let Wgt=class{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:r}=this._$AD,s=((t==null?void 0:t.creationScope)??iy).importNode(n,!0);Ew.currentNode=s;let i=Ew.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let l;c.type===2?l=new oV(i,i.nextSibling,this,t):c.type===1?l=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(l=new Ggt(i,this,t)),this._$AV.push(l),c=r[++a]}o!==(c==null?void 0:c.index)&&(i=Ew.nextNode(),o++)}return Ew.currentNode=iy,s}p(t){let n=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,n),n+=r.strings.length-2):r._$AI(t[n])),n++}},oV=class Hye{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,r,s){this.type=2,this._$AH=ms,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=r,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=m5(this,t,n),d4(t)?t===ms||t==null||t===""?(this._$AH!==ms&&this._$AR(),this._$AH=ms):t!==this._$AH&&t!==C0&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):zgt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==ms&&d4(this._$AH)?this._$AA.nextSibling.data=t:this.T(iy.createTextNode(t)),this._$AH=t}$(t){var i;const{values:n,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=bj.createElement(qye(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)==null?void 0:i._$AD)===s)this._$AH.p(n);else{const o=new Wgt(s,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}_$AC(t){let n=Tre.get(t.strings);return n===void 0&&Tre.set(t.strings,n=new bj(t)),n}k(t){iV(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let r,s=0;for(const i of t)s===n.length?n.push(r=new Hye(this.O(u4()),this.O(u4()),this,this.options)):r=n[s],r._$AI(i),s++;s<n.length&&(this._$AR(r&&r._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,n);t!==this._$AB;){const s=xre(t).nextSibling;xre(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}},vT=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,r,s,i){this.type=1,this._$AH=ms,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ms}_$AI(t,n=this,r,s){const i=this.strings;let o=!1;if(i===void 0)t=m5(this,t,n,0),o=!d4(t)||t!==this._$AH&&t!==C0,o&&(this._$AH=t);else{const a=t;let c,l;for(t=i[0],c=0;c<i.length-1;c++)l=m5(this,a[r+c],n,c),l===C0&&(l=this._$AH[c]),o||(o=!d4(l)||l!==this._$AH[c]),l===ms?t=ms:t!==ms&&(t+=(l??"")+i[c+1]),this._$AH[c]=l}o&&!s&&this.j(t)}j(t){t===ms?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Hgt=class extends vT{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===ms?void 0:t}},Vgt=class extends vT{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==ms)}},Kgt=class extends vT{constructor(t,n,r,s,i){super(t,n,r,s,i),this.type=5}_$AI(t,n=this){if((t=m5(this,t,n,0)??ms)===C0)return;const r=this._$AH,s=t===ms&&r!==ms||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==ms&&(r===ms||s);s&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}};class Ggt{constructor(t,n,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){m5(this,t)}}const FR=g8.litHtmlPolyfillSupport;FR==null||FR(bj,oV),(g8.litHtmlVersions??(g8.litHtmlVersions=[])).push("3.3.2");const Zgt=(e,t,n)=>{const r=(n==null?void 0:n.renderBefore)??t;let s=r._$litPart$;if(s===void 0){const i=(n==null?void 0:n.renderBefore)??null;r._$litPart$=s=new oV(t.insertBefore(u4(),i),i,void 0,n??{})}return s._$AI(e),s};const Ow=globalThis;let ce=class extends ev{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const t=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=t.firstChild),t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Zgt(n,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return C0}};var fle;ce._$litElement$=!0,ce.finalized=!0,(fle=Ow.litElementHydrateSupport)==null||fle.call(Ow,{LitElement:ce});const zR=Ow.litElementPolyfillSupport;zR==null||zR({LitElement:ce});(Ow.litElementVersions??(Ow.litElementVersions=[])).push("4.2.2");const Ygt={black:"#202020",white:"#FFFFFF",white010:"rgba(255, 255, 255, 0.1)",accent010:"rgba(9, 136, 240, 0.1)",accent020:"rgba(9, 136, 240, 0.2)",accent030:"rgba(9, 136, 240, 0.3)",accent040:"rgba(9, 136, 240, 0.4)",accent050:"rgba(9, 136, 240, 0.5)",accent060:"rgba(9, 136, 240, 0.6)",accent070:"rgba(9, 136, 240, 0.7)",accent080:"rgba(9, 136, 240, 0.8)",accent090:"rgba(9, 136, 240, 0.9)",accent100:"rgba(9, 136, 240, 1.0)",accentSecondary010:"rgba(199, 185, 148, 0.1)",accentSecondary020:"rgba(199, 185, 148, 0.2)",accentSecondary030:"rgba(199, 185, 148, 0.3)",accentSecondary040:"rgba(199, 185, 148, 0.4)",accentSecondary050:"rgba(199, 185, 148, 0.5)",accentSecondary060:"rgba(199, 185, 148, 0.6)",accentSecondary070:"rgba(199, 185, 148, 0.7)",accentSecondary080:"rgba(199, 185, 148, 0.8)",accentSecondary090:"rgba(199, 185, 148, 0.9)",accentSecondary100:"rgba(199, 185, 148, 1.0)",productWalletKit:"#FFB800",productAppKit:"#FF573B",productCloud:"#0988F0",productDocumentation:"#008847",neutrals050:"#F6F6F6",neutrals100:"#F3F3F3",neutrals200:"#E9E9E9",neutrals300:"#D0D0D0",neutrals400:"#BBB",neutrals500:"#9A9A9A",neutrals600:"#6C6C6C",neutrals700:"#4F4F4F",neutrals800:"#363636",neutrals900:"#2A2A2A",neutrals1000:"#252525",semanticSuccess010:"rgba(48, 164, 107, 0.1)",semanticSuccess020:"rgba(48, 164, 107, 0.2)",semanticSuccess030:"rgba(48, 164, 107, 0.3)",semanticSuccess040:"rgba(48, 164, 107, 0.4)",semanticSuccess050:"rgba(48, 164, 107, 0.5)",semanticSuccess060:"rgba(48, 164, 107, 0.6)",semanticSuccess070:"rgba(48, 164, 107, 0.7)",semanticSuccess080:"rgba(48, 164, 107, 0.8)",semanticSuccess090:"rgba(48, 164, 107, 0.9)",semanticSuccess100:"rgba(48, 164, 107, 1.0)",semanticError010:"rgba(223, 74, 52, 0.1)",semanticError020:"rgba(223, 74, 52, 0.2)",semanticError030:"rgba(223, 74, 52, 0.3)",semanticError040:"rgba(223, 74, 52, 0.4)",semanticError050:"rgba(223, 74, 52, 0.5)",semanticError060:"rgba(223, 74, 52, 0.6)",semanticError070:"rgba(223, 74, 52, 0.7)",semanticError080:"rgba(223, 74, 52, 0.8)",semanticError090:"rgba(223, 74, 52, 0.9)",semanticError100:"rgba(223, 74, 52, 1.0)",semanticWarning010:"rgba(243, 161, 63, 0.1)",semanticWarning020:"rgba(243, 161, 63, 0.2)",semanticWarning030:"rgba(243, 161, 63, 0.3)",semanticWarning040:"rgba(243, 161, 63, 0.4)",semanticWarning050:"rgba(243, 161, 63, 0.5)",semanticWarning060:"rgba(243, 161, 63, 0.6)",semanticWarning070:"rgba(243, 161, 63, 0.7)",semanticWarning080:"rgba(243, 161, 63, 0.8)",semanticWarning090:"rgba(243, 161, 63, 0.9)",semanticWarning100:"rgba(243, 161, 63, 1.0)"},AA={core:{backgroundAccentPrimary:"#0988F0",backgroundAccentCertified:"#C7B994",backgroundWalletKit:"#FFB800",backgroundAppKit:"#FF573B",backgroundCloud:"#0988F0",backgroundDocumentation:"#008847",backgroundSuccess:"rgba(48, 164, 107, 0.20)",backgroundError:"rgba(223, 74, 52, 0.20)",backgroundWarning:"rgba(243, 161, 63, 0.20)",textAccentPrimary:"#0988F0",textAccentCertified:"#C7B994",textWalletKit:"#FFB800",textAppKit:"#FF573B",textCloud:"#0988F0",textDocumentation:"#008847",textSuccess:"#30A46B",textError:"#DF4A34",textWarning:"#F3A13F",borderAccentPrimary:"#0988F0",borderSecondary:"#C7B994",borderSuccess:"#30A46B",borderError:"#DF4A34",borderWarning:"#F3A13F",foregroundAccent010:"rgba(9, 136, 240, 0.1)",foregroundAccent020:"rgba(9, 136, 240, 0.2)",foregroundAccent040:"rgba(9, 136, 240, 0.4)",foregroundAccent060:"rgba(9, 136, 240, 0.6)",foregroundSecondary020:"rgba(199, 185, 148, 0.2)",foregroundSecondary040:"rgba(199, 185, 148, 0.4)",foregroundSecondary060:"rgba(199, 185, 148, 0.6)",iconAccentPrimary:"#0988F0",iconAccentCertified:"#C7B994",iconSuccess:"#30A46B",iconError:"#DF4A34",iconWarning:"#F3A13F",glass010:"rgba(255, 255, 255, 0.1)",zIndex:"9999"},dark:{overlay:"rgba(0, 0, 0, 0.50)",backgroundPrimary:"#202020",backgroundInvert:"#FFFFFF",textPrimary:"#FFFFFF",textSecondary:"#9A9A9A",textTertiary:"#BBBBBB",textInvert:"#202020",borderPrimary:"#2A2A2A",borderPrimaryDark:"#363636",borderSecondary:"#4F4F4F",foregroundPrimary:"#252525",foregroundSecondary:"#2A2A2A",foregroundTertiary:"#363636",iconDefault:"#9A9A9A",iconInverse:"#FFFFFF"},light:{overlay:"rgba(230 , 230, 230, 0.5)",backgroundPrimary:"#FFFFFF",borderPrimaryDark:"#E9E9E9",backgroundInvert:"#202020",textPrimary:"#202020",textSecondary:"#9A9A9A",textTertiary:"#6C6C6C",textInvert:"#FFFFFF",borderPrimary:"#E9E9E9",borderSecondary:"#D0D0D0",foregroundPrimary:"#F3F3F3",foregroundSecondary:"#E9E9E9",foregroundTertiary:"#D0D0D0",iconDefault:"#9A9A9A",iconInverse:"#202020"}},Jgt={1:"4px",2:"8px",10:"10px",3:"12px",4:"16px",6:"24px",5:"20px",8:"32px",16:"64px",20:"80px",32:"128px",64:"256px",128:"512px",round:"9999px"},Xgt={0:"0px","01":"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",12:"48px",14:"56px",16:"64px",20:"80px",32:"128px",64:"256px"},Qgt={regular:"KHTeka",mono:"KHTekaMono"},emt={regular:"400",medium:"500"},tmt={h1:"50px",h2:"44px",h3:"38px",h4:"32px",h5:"26px",h6:"20px",large:"16px",medium:"14px",small:"12px"},nmt={"h1-regular-mono":{lineHeight:"50px",letterSpacing:"-3px"},"h1-regular":{lineHeight:"50px",letterSpacing:"-1px"},"h1-medium":{lineHeight:"50px",letterSpacing:"-0.84px"},"h2-regular-mono":{lineHeight:"44px",letterSpacing:"-2.64px"},"h2-regular":{lineHeight:"44px",letterSpacing:"-0.88px"},"h2-medium":{lineHeight:"44px",letterSpacing:"-0.88px"},"h3-regular-mono":{lineHeight:"38px",letterSpacing:"-2.28px"},"h3-regular":{lineHeight:"38px",letterSpacing:"-0.76px"},"h3-medium":{lineHeight:"38px",letterSpacing:"-0.76px"},"h4-regular-mono":{lineHeight:"32px",letterSpacing:"-1.92px"},"h4-regular":{lineHeight:"32px",letterSpacing:"-0.32px"},"h4-medium":{lineHeight:"32px",letterSpacing:"-0.32px"},"h5-regular-mono":{lineHeight:"26px",letterSpacing:"-1.56px"},"h5-regular":{lineHeight:"26px",letterSpacing:"-0.26px"},"h5-medium":{lineHeight:"26px",letterSpacing:"-0.26px"},"h6-regular-mono":{lineHeight:"20px",letterSpacing:"-1.2px"},"h6-regular":{lineHeight:"20px",letterSpacing:"-0.6px"},"h6-medium":{lineHeight:"20px",letterSpacing:"-0.6px"},"lg-regular-mono":{lineHeight:"16px",letterSpacing:"-0.96px"},"lg-regular":{lineHeight:"18px",letterSpacing:"-0.16px"},"lg-medium":{lineHeight:"18px",letterSpacing:"-0.16px"},"md-regular-mono":{lineHeight:"14px",letterSpacing:"-0.84px"},"md-regular":{lineHeight:"16px",letterSpacing:"-0.14px"},"md-medium":{lineHeight:"16px",letterSpacing:"-0.14px"},"sm-regular-mono":{lineHeight:"12px",letterSpacing:"-0.72px"},"sm-regular":{lineHeight:"14px",letterSpacing:"-0.12px"},"sm-medium":{lineHeight:"14px",letterSpacing:"-0.12px"}}
vendor: 8,284 bytes, lines 80-114
80,rmt={"ease-out-power-2":"cubic-bezier(0.23, 0.09, 0.08, 1.13)","ease-out-power-1":"cubic-bezier(0.12, 0.04, 0.2, 1.06)","ease-in-power-2":"cubic-bezier(0.92, -0.13, 0.77, 0.91)","ease-in-power-1":"cubic-bezier(0.88, -0.06, 0.8, 0.96)","ease-inout-power-2":"cubic-bezier(0.77, 0.09, 0.23, 1.13)","ease-inout-power-1":"cubic-bezier(0.88, 0.04, 0.12, 1.06)"},smt={xl:"400ms",lg:"200ms",md:"125ms",sm:"75ms"},vj={colors:Ygt,fontFamily:Qgt,fontWeight:emt,textSize:tmt,typography:nmt,tokens:{core:AA.core,theme:AA.dark},borderRadius:Jgt,spacing:Xgt,durations:smt,easings:rmt},Pre="--apkt";function wI(e){if(!e)return{};const t={};return t["font-family"]=e["--apkt-font-family"]??e["--w3m-font-family"]??"KHTeka",t.accent=e["--apkt-accent"]??e["--w3m-accent"]??"#0988F0",t["color-mix"]=e["--apkt-color-mix"]??e["--w3m-color-mix"]??"#000",t["color-mix-strength"]=e["--apkt-color-mix-strength"]??e["--w3m-color-mix-strength"]??0,t["font-size-master"]=e["--apkt-font-size-master"]??e["--w3m-font-size-master"]??"10px",t["border-radius-master"]=e["--apkt-border-radius-master"]??e["--w3m-border-radius-master"]??"4px",e["--apkt-z-index"]!==void 0?t["z-index"]=e["--apkt-z-index"]:e["--w3m-z-index"]!==void 0&&(t["z-index"]=e["--w3m-z-index"]),t}const Bg={createCSSVariables(e){const t={},n={};function r(i,o,a=""){for(const[c,l]of Object.entries(i)){const u=a?`${a}-${c}`:c;l&&typeof l=="object"&&Object.keys(l).length?(o[c]={},r(l,o[c],u)):typeof l=="string"&&(o[c]=`${Pre}-${u}`)}}function s(i,o){for(const[a,c]of Object.entries(i))c&&typeof c=="object"?(o[a]={},s(c,o[a])):typeof c=="string"&&(o[a]=`var(${c})`)}return r(e,t),s(t,n),{cssVariables:t,cssVariablesVarPrefix:n}},assignCSSVariables(e,t){const n={};function r(s,i,o){for(const[a,c]of Object.entries(s)){const l=o?`${o}-${a}`:a,u=i[a];c&&typeof c=="object"?r(c,u,l):typeof u=="string"&&(n[`${Pre}-${l}`]=u)}}return r(e,t),n},createRootStyles(e,t){const n={...vj,tokens:{...vj.tokens,theme:e==="light"?AA.light:AA.dark}},{cssVariables:r}=Bg.createCSSVariables(n),s=Bg.assignCSSVariables(r,n),i=Bg.generateW3MVariables(t),o=Bg.generateW3MOverrides(t),a=Bg.generateScaledVariables(t),c=Bg.generateBaseVariables(s),l={...s,...c,...i,...o,...a},u=Bg.applyColorMixToVariables(t,l),d={...l,...u};return`:root {${Object.entries(d).map(([f,g])=>`${f}:${g.replace("/[:;{}</>]/g","")};`).join("")}}`},generateW3MVariables(e){if(!e)return{};const t=wI(e),n={};return n["--w3m-font-family"]=t["font-family"],n["--w3m-accent"]=t.accent,n["--w3m-color-mix"]=t["color-mix"],n["--w3m-color-mix-strength"]=`${t["color-mix-strength"]}%`,n["--w3m-font-size-master"]=t["font-size-master"],n["--w3m-border-radius-master"]=t["border-radius-master"],n},generateW3MOverrides(e){if(!e)return{};const t=wI(e),n={};if(e["--apkt-accent"]||e["--w3m-accent"]){const r=t.accent;n["--apkt-tokens-core-iconAccentPrimary"]=r,n["--apkt-tokens-core-borderAccentPrimary"]=r,n["--apkt-tokens-core-textAccentPrimary"]=r,n["--apkt-tokens-core-backgroundAccentPrimary"]=r}return(e["--apkt-font-family"]||e["--w3m-font-family"])&&(n["--apkt-fontFamily-regular"]=t["font-family"]),t["z-index"]!==void 0&&(n["--apkt-tokens-core-zIndex"]=`${t["z-index"]}`),n},generateScaledVariables(e){if(!e)return{};const t=wI(e),n={};if(e["--apkt-font-size-master"]||e["--w3m-font-size-master"]){const r=parseFloat(t["font-size-master"].replace("px",""));n["--apkt-textSize-h1"]=`${Number(r)*5}px`,n["--apkt-textSize-h2"]=`${Number(r)*4.4}px`,n["--apkt-textSize-h3"]=`${Number(r)*3.8}px`,n["--apkt-textSize-h4"]=`${Number(r)*3.2}px`,n["--apkt-textSize-h5"]=`${Number(r)*2.6}px`,n["--apkt-textSize-h6"]=`${Number(r)*2}px`,n["--apkt-textSize-large"]=`${Number(r)*1.6}px`,n["--apkt-textSize-medium"]=`${Number(r)*1.4}px`,n["--apkt-textSize-small"]=`${Number(r)*1.2}px`}if(e["--apkt-border-radius-master"]||e["--w3m-border-radius-master"]){const r=parseFloat(t["border-radius-master"].replace("px",""));n["--apkt-borderRadius-1"]=`${Number(r)}px`,n["--apkt-borderRadius-2"]=`${Number(r)*2}px`,n["--apkt-borderRadius-3"]=`${Number(r)*3}px`,n["--apkt-borderRadius-4"]=`${Number(r)*4}px`,n["--apkt-borderRadius-5"]=`${Number(r)*5}px`,n["--apkt-borderRadius-6"]=`${Number(r)*6}px`,n["--apkt-borderRadius-8"]=`${Number(r)*8}px`,n["--apkt-borderRadius-16"]=`${Number(r)*16}px`,n["--apkt-borderRadius-20"]=`${Number(r)*20}px`,n["--apkt-borderRadius-32"]=`${Number(r)*32}px`,n["--apkt-borderRadius-64"]=`${Number(r)*64}px`,n["--apkt-borderRadius-128"]=`${Number(r)*128}px`}return n},generateColorMixCSS(e,t){if(!(e!=null&&e["--w3m-color-mix"])||!e["--w3m-color-mix-strength"])return"";const n=e["--w3m-color-mix"],r=e["--w3m-color-mix-strength"];if(!r||r===0)return"";const s=Object.keys(t||{}).filter(o=>{const a=o.includes("-tokens-core-background")||o.includes("-tokens-core-text")||o.includes("-tokens-core-border")||o.includes("-tokens-core-foreground")||o.includes("-tokens-core-icon")||o.includes("-tokens-theme-background")||o.includes("-tokens-theme-text")||o.includes("-tokens-theme-border")||o.includes("-tokens-theme-foreground")||o.includes("-tokens-theme-icon"),c=o.includes("-borderRadius-")||o.includes("-spacing-")||o.includes("-textSize-")||o.includes("-fontFamily-")||o.includes("-fontWeight-")||o.includes("-typography-")||o.includes("-duration-")||o.includes("-ease-")||o.includes("-path-")||o.includes("-width-")||o.includes("-height-")||o.includes("-visual-size-")||o.includes("-modal-width")||o.includes("-cover");return a&&!c});return s.length===0?"":` @supports (background: color-mix(in srgb, white 50%, black)) { 81 :root { 82 ${s.map(o=>{const a=(t==null?void 0:t[o])||"";return a.includes("color-mix")||a.startsWith("#")||a.startsWith("rgb")?`${o}: color-mix(in srgb, ${n} ${r}%, ${a});`:`${o}: color-mix(in srgb, ${n} ${r}%, var(${o}-base, ${a}));`}).join("")} 83 } 84 }`},generateBaseVariables(e){const t={},n=e["--apkt-tokens-theme-backgroundPrimary"];n&&(t["--apkt-tokens-theme-backgroundPrimary-base"]=n);const r=e["--apkt-tokens-core-backgroundAccentPrimary"];return r&&(t["--apkt-tokens-core-backgroundAccentPrimary-base"]=r),t},applyColorMixToVariables(e,t){const n={};t!=null&&t["--apkt-tokens-theme-backgroundPrimary"]&&(n["--apkt-tokens-theme-backgroundPrimary"]="var(--apkt-tokens-theme-backgroundPrimary-base)"),t!=null&&t["--apkt-tokens-core-backgroundAccentPrimary"]&&(n["--apkt-tokens-core-backgroundAccentPrimary"]="var(--apkt-tokens-core-backgroundAccentPrimary-base)");const r=wI(e),s=r["color-mix"],i=r["color-mix-strength"];if(!i||i===0)return n;const o=Object.keys(t||{}).filter(a=>{const c=a.includes("-tokens-core-background")||a.includes("-tokens-core-text")||a.includes("-tokens-core-border")||a.includes("-tokens-core-foreground")||a.includes("-tokens-core-icon")||a.includes("-tokens-theme-background")||a.includes("-tokens-theme-text")||a.includes("-tokens-theme-border")||a.includes("-tokens-theme-foreground")||a.includes("-tokens-theme-icon")||a.includes("-tokens-theme-overlay"),l=a.includes("-borderRadius-")||a.includes("-spacing-")||a.includes("-textSize-")||a.includes("-fontFamily-")||a.includes("-fontWeight-")||a.includes("-typography-")||a.includes("-duration-")||a.includes("-ease-")||a.includes("-path-")||a.includes("-width-")||a.includes("-height-")||a.includes("-visual-size-")||a.includes("-modal-width")||a.includes("-cover");return c&&!l});return o.length===0||o.forEach(a=>{const c=(t==null?void 0:t[a])||"";a.endsWith("-base")||(a==="--apkt-tokens-theme-backgroundPrimary"||a==="--apkt-tokens-core-backgroundAccentPrimary"?n[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base))`:c.includes("color-mix")||c.startsWith("#")||c.startsWith("rgb")?n[a]=`color-mix(in srgb, ${s} ${i}%, ${c})`:n[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base, ${c}))`)}),n}};Bg.createCSSVariables(vj);Xe` 85 div, 86 span, 87 iframe, 88 a, 89 img, 90 form, 91 button, 92 label, 93 *::after, 94 *::before { 95 margin: 0; 96 padding: 0; 97 box-sizing: border-box; 98 font-style: normal; 99 text-rendering: optimizeSpeed; 100 -webkit-font-smoothing: antialiased; 101 -moz-osx-font-smoothing: grayscale; 102 -webkit-tap-highlight-color: transparent; 103 backface-visibility: hidden; 104 } 105 106 :host { 107 font-family: var(--apkt-fontFamily-regular); 108 } 109`;Xe` 110 button, 111 a { 112 cursor: pointer; 113 display: flex; 114 justify-content: center;
115 align-items: center; 116 position: relative; 117 118 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 119 outline: none; 120 border: none; 121 text-decoration: none; 122 transition: 123 background-color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 124 color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 125 border var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 126 box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 127 width var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 128 height var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 129 transform var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 130 opacity var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 131 scale var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 132 border-radius var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2); 133 will-change: 134 background-color, color, border, box-shadow, width, height, transform, opacity, scale, 135 border-radius; 136 } 137 138 a:active:not([disabled]), 139 button:active:not([disabled]) { 140 scale: 0.975; 141 transform-origin: center; 142 } 143 144 button:disabled { 145 cursor: default; 146 } 147 148 input { 149 border: none; 150 outline: none; 151 appearance: none; 152 } 153`;const gp={EIP155:he.CHAIN.EVM,CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH"},imt={NetworkImageIds:{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",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",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",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200","00000008819873e925422c1ff0f99f7c":"b3406e4a-bbfc-44fb-e3a6-89673c78b700","-239":"20f673c0-095e-49b2-07cf-eb5049dcf600","-3":"20f673c0-095e-49b2-07cf-eb5049dcf600","0x2b6653dc":"3502bb86-cc4e-420f-a387-59ea63a28b00","0x94a9059e":"3502bb86-cc4e-420f-a387-59ea63a28b00","0xcd8690dc":"3502bb86-cc4e-420f-a387-59ea63a28b00"}},Ej={getCaipTokens(e){if(!e)return;const t={};return Object.entries(e).forEach(([n,r])=>{t[`${gp.EIP155}:${n}`]=r}),t},isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())},getActiveNamespaceConnectedToAuth(){const e=G.state.activeChain;return he.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(t=>Te.getConnectorId(t)===he.CONNECTOR_ID.AUTH&&t===e)},withRetry({conditionFn:e,intervalMs:t,maxRetries:n}){let r=0;return new Promise(s=>{async function i(){return r+=1,await e()?s(!0):r>=n?s(!1):(setTimeout(i,t),null)}i()})},userChainIdToChainNamespace(e){if(typeof e=="number")return he.CHAIN.EVM;const[t]=e.split(":");return t},getOtherAuthNamespaces(e){return e?he.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(r=>r!==e):[]},getConnectorStorageInfo(e,t){const r=xe.getConnections()[t]??[];return{hasDisconnected:xe.isConnectorDisconnected(e,t),hasConnected:r.some(s=>Ej.isLowerCaseMatch(s.connectorId,e))}}},omt=new AbortController,Zl={EmbeddedWalletAbortController:omt,UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"ORIGIN_NOT_ALLOWED"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"}
153,INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{code:"APKT001",displayMessage:"Network Not Found",debugMessage:"The specified network is not recognized. Please ensure it is included in the `networks` array of your `createAppKit` configuration."},ORIGIN_NOT_ALLOWED:{code:"APKT002",displayMessage:"Invalid App Configuration",debugMessage:()=>`The origin ${NE()?window.origin:"unknown"} is not in your allow list. Please update your allowed domains at https://dashboard.reown.com. [PID: ${pe.state.projectId}]`},IFRAME_LOAD_FAILED:{code:"APKT003",displayMessage:"Network Error: Wallet Load Failed",debugMessage:()=>"Failed to load the embedded wallet. This may be due to network issues or server downtime. Please check your network connection and try again shortly. Contact support if the issue persists."},IFRAME_REQUEST_TIMEOUT:{code:"APKT004",displayMessage:"Wallet Request Timeout",debugMessage:()=>"The request to the embedded wallet timed out. Please check your network connection and try again shortly. Contact support if the issue persists."},UNVERIFIED_DOMAIN:{code:"APKT005",displayMessage:"Unverified Domain",debugMessage:()=>"Embedded wallet load failed. Ensure your domain is verified in https://dashboard.reown.com."},JWT_TOKEN_NOT_VALID:{code:"APKT006",displayMessage:"Session Expired",debugMessage:"Your session is invalid or expired. Please check your systemâs date and time settings, then reconnect."},INVALID_PROJECT_ID:{code:"APKT007",displayMessage:"Invalid Project ID",debugMessage:"The specified project ID is invali
153d. Please visit https://dashboard.reown.com to obtain a valid project ID."},PROJECT_ID_NOT_CONFIGURED:{code:"APKT008",displayMessage:"Project ID Missing",debugMessage:"No project ID is configured. You can create and configure a project ID at https://dashboard.reown.com."},SERVER_ERROR_APP_CONFIGURATION:{code:"APKT009",displayMessage:"Server Error",debugMessage:e=>`Unable to fetch App Configuration. ${e}. Please check your network connection and try again shortly. Contact support if the issue persists.`},RATE_LIMITED_APP_CONFIGURATION:{code:"APKT010",displayMessage:"Rate Limited",debugMessage:"You have been rate limited while retrieving App Configuration. Please wait a few minutes and try again. Contact support if the issue persists."}},ALERT_WARNINGS:{LOCAL_CONFIGURATION_IGNORED:{debugMessage:e=>`[Reown Config Notice] ${e}`},INACTIVE_NAMESPACE_NOT_CONNECTED:{code:"APKTW001",displayMessage:"Inactive Namespace Not Connected",debugMessage:(e,t)=>`An error occurred while connecting an inactive namespace ${e}: "${t}"`},INVALID_EMAIL:{code:"APKTW002",displayMessage:"Invalid Email Address",debugMessage:"Please enter a valid email address"}}},Vye={TOKEN_ADDRESSES_BY_SYMBOL:{USDC:{8453:Pgt.asset,84532:Ogt.asset}},getTokenSymbolByAddress(e){if(!e)return;const[t]=Object.entries(Vye.TOKEN_ADDRESSES_BY_SYMBOL).find(([n,r])=>Object.values(r).includes(e))??[];return t}},amt={createLogger(e,t="error"){const n=sW({level:t}),{logger:r}=OC({opts:n});return r.error=(...s)=>{for(const i of s)if(i instanceof Error){e(i,...s);return}e(void 0,...s)},r}},cmt="rpc.walletconnect.org";function Ore(e,t){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",e),n.searchParams.set("projectId",t),n.toString()}const qR=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","eip155:80094","eip155:80069","eip155:560048","eip155:31","eip155:2818","eip155:57054","eip155:911867","eip155:534351","eip155:1112","eip155:534352","eip155:1111","eip155:146","eip155:130","eip155:1284","eip155:30","eip155:2810","eip155:55931","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],tv={extendRpcUrlWithProjectId(e,t){let n=!1;try{n=new URL(e).host===cmt}catch{n=!1}if(n){const r=new URL(e);return r.searchParams.has("projectId")||r.searchParams.set("projectId",t),r.toString()}return e},isCaipNetwork(e){return"chainNamespace"in e&&"caipNetworkId"in e},getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:he.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${he.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,n){var s,i,o;const r=(o=(i=(s=e.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null?void 0:o[0];return qR.includes(t)?Ore(t,n):r||""},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){var h,f,g,p,m,w,C;const s=this.getChainNamespace(e),i=this.getCaipNetworkId(e),o=(g=(f=(h=e.rpcUrls)==null?void 0:h.default)==null?void 0:f.http)==null?void 0:g[0],a=this.getDefaultRpcUrl(e,i,n),c=((w=(m=(
153p=e==null?void 0:e.rpcUrls)==null?void 0:p.chainDefault)==null?void 0:m.http)==null?void 0:w[0])||o,l=((C=r==null?void 0:r[i])==null?void 0:C.map(E=>E.url))||[],u=[...l,...a?[a]:[]],d=[...l];return c&&!d.includes(c)&&d.push(c),{...e,chainNamespace:s,caipNetworkId:i,assets:{imageId:imt.NetworkImageIds[e.id],imageUrl:t==null?void 0:t[e.id]},rpcUrls:{...e.rpcUrls,default:{http:u},chainDefault:{http:d}}}},extendCaipNetworks(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){return e.map(s=>tv.extendCaipNetwork(s,{customNetworkImageUrls:t,customRpcUrls:r,projectId:n}))},getViemTransport(e,t,n){var s,i,o;const r=[];return n==null||n.forEach(a=>{r.push(OE(a.url,a.config))}),qR.includes(e.caipNetworkId)&&r.push(OE(Ore(e.caipNetworkId,t),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),(o=(i=(s=e==null?void 0:e.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null||o.forEach(a=>{r.push(OE(a))}),_M(r)},extendWagmiTransports(e,t,n){if(qR.includes(e.caipNetworkId)){const r=this.getDefaultRpcUrl(e,e.caipNetworkId,t);return _M([n,OE(r)])}return n},getUnsupportedNetwork(e){return{id:e.split(":")[1],caipNetworkId:e,name:he.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(e){var c;const t=xe.getActiveCaipNetworkId(),n=G.getAllRequestedCaipNetworks(),r=Array.from(((c=G.state.chains)==null?void 0:c.keys())||[]),s=t==null?void 0:t.split(":")[0],i=s?r.includes(s):!1,o=n==null?void 0:n.find(l=>l.caipNetworkId===t);return i&&!o&&t?this.getUnsupportedNetwork(t):o||e||(n==null?void 0:n[0])}},yI={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603};let lmt=class extends Agt{async setUniversalProvider(t){if(!this.namespace)throw new Error("UniversalAdapter:setUniversalProvider - namespace is required");return this.addConnector(new _gt({provider:t,caipNetworks:this.getCaipNetworks(),namespace:this.namespace})),Promise.resolve()}async connect(t){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(t.chainId),provider:this.provider,address:""})}async disconnect(){try{await this.getWalletConnectConnector().disconnect(),this.emit("disconnect")}catch(t){console.warn("UniversalAdapter:disconnect - error",t)}return{connections:[]}}syncConnections(){return Promise.resolve()}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async getAccounts({namespace:t}){var s,i,o;const n=this.provider,r=(((o=(i=(s=n==null?void 0:n.session)==null?void 0:s.namespaces)==null?void 0:i[t])==null?void 0:o.accounts)||[]).filter((a,c,l)=>l.indexOf(a)===c);return Promise.resolve({accounts:r.map(a=>Je.createAccount({caipAddress:a,type:t==="bip122"?"payment":"eoa"}))})}async syncConnectors(){return Promise.resolve()}async getBalance(t){var o,a,c,l,u;if(!(t.caipNetwork&&mn.BALANCE_SUPPORTED_CHAINS.includes((o=t.caipNetwork)==null?void 0:o.chainNamespace))||(a=t.caipNetwork)!=null&&a.testnet)return{balance:"0.00",symbol:((c=t.caipNetwork)==null?void 0:c.nativeCurrency.symbol)||""};const r=G.getAccountData();if(r!=null&&r.balanceLoading&&t.chainId===((l=G.state.activeCaipNetwork)==null?void 0:l.id))return{balance:(r==null?void 0:r.balance)||"0.00",symbol:(r==null?void 0:r.balanceSymbol)||""};const i=(await G.fetchTokenBalance()).find(d=>{var h,f;return d.chainId===`${(h=t.caipNetwork)==null?void 0:h.chainNamespace}:${t.chainId}`&&d.symbol===((f=t.caipNetwork)==null?void 0:f.nativeCurrency.symbol)});return{balance:(i==null?void 0:i.quantity.numeric)||"0.00",symbol:(i==null?void 0:i.symbol)||((u=t.caipNetwork)==null?void 0:u.nativeCurrency.symbol)||""}}async signMessage(t){var o,a,c;const{provider:n,message:r,address:s}=t;if(!n)throw new Error("UniversalAdapter:signMessage - provider is undefined");let i="";return((o=G.state.activeCaipNetwork)==null?void 0:o.chainNamespace)===he.CHAIN.SOLANA?i=(await n.request({method:"solana_signMessage",params:{message:l1.encode(new TextEncoder().encode(r)),pubkey:s}},(a=G.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)).signature:i=await n.request({method:"personal_sign",params:[r,s]},(c=G.state.activeCaipNetwork)==null?void 0:c.caipNetworkId),{signature:i}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(t){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}emitFirstAvailableConnection(){}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(t){var s,i,o,a,c,l;const{caipNetwork:n}=t,r=this.getWalletConnectConnector();if(n.chainNamespace===he.CHAIN.EVM)try{await((s=r.provider)==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Rd(n.id)}]}))}catch(u){if(u.code===yI.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||u.code===yI.ERROR_INVALID_CHAIN_ID||u.code===yI.ERROR_CODE_DEFAULT||((o=(i=u==null?void 0:u.data)==null?void 0:i.originalError)==null?void 0:o.code)===yI.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await((l=r.provider)==null?void 0:l.request({method:"wallet_addEthereumChain",params:[{chainId:Rd(n.id),rpcUrls:[(a=n==null?void 0:n.rpcUrls.chainDefault)==null?void 0:a.http],chainName:n.name,nativeCurrency:n.nativeCurrency,blockExplorerUrls:[(c=n.blockExplorers)==null?void 0:c.default.url]}]}))}catch{throw new Error("Chain is not supported")}}r.provider.setDefaultChain(n.caipNetworkId)}getWalletConnectProvider(){const t=this.connectors.find(r=>r.type==="WALLET_CONNECT");return t==null?void 0:t.provider}};const umt=["email","socials","swaps","onramp","activity","reownBranding","multiWallet","emailCapture","payWithExchange","payments","reownAuthentication","headless"],bI={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return!!e.isEnabled&&t.includes("email")},processFallback:e=>e===void 0?mn.DEFAULT_REMOTE_FEATURES.email:!!e},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return e.isEnabled&&t.length>0?t.filter(n=>n!=="email"):!1},processFallback:e=>e===void 0?mn.DEFAULT_REMOTE_FEATURES.socials:typeof e=="boolean"?e?mn.DEFAULT_REMOTE_FEATURES.socials:!1:e},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return e.isEnabled&&t.length>0?t:!1},processFallback:e=>e===void 0?mn.DEFAULT_REMOTE_FEATURES.swaps:typeof e=="boolean"?e?mn.DEFAULT_REMOTE_FEATURES.swaps:!1:e},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return e.isEnabled&&t.length>0?t:!1},processFallback:e=>e===void 0?mn.DEFAULT_REMOTE_FEATURES.onramp:typeof e=="boolean"?e?mn.DEFAULT_REMOTE_FEATURES.onramp:!1:e},activity:{apiFeatureName:"activity",localFeatureName:"history",returnType:!1,isLegacy:!0,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:e=>e===void 0?mn.DEFAULT_REMOTE_FEATURES.activity:!!e},reownBranding:{apiFeatureName:"reown_branding",localFeatureName:"reownBranding",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:e=>e===void 0?mn.DEFAULT_REMOTE_FEATURES.reownBranding:!!e},emailCapture:{apiFeatureName:"email_capture",localFeatureName:"emailCapture",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>e.isEnabled&&(e.config??[]),processFallback:e=>!1},multiWallet:{apiFeatureName:"multi_wallet",localFeatureName:"multiWallet",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:()=>mn.DEFAULT_REMOTE_FEATURES.multiWallet},payWithExchange:{apiFeatureName:"fund_from_exchange",localFeatureName:"payWithExchange",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:()=>mn.DEFAULT_REMOTE_FEATURES.payWithExchange},payments:{apiFeatureName:"payments",localFeatureName:"payments",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:()=>mn.DEFAULT_REMOTE_FEATURES.payments},reownAuthentication:{apiFeatureName:"reown_authentication",localFeatureName:"reownAuthentication",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:e=>typeof e>"u"?mn.DEFAULT_REMOTE_FEATURES.reownAuthentication:!!e},headless:{apiFeatureName:"headless",localFeatureName:"headless",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:()=>mn.DEFAULT_REMOTE_FEATURES.headless}},dmt={localSettingsOverridden:new Set,getApiConfig(e,t){return t==null?void 0:t.find(n=>n.id===e)},addWarning(e,t){if(e!==void 0){const n=bI[t],r=n.isLegacy?`"features.${n.localFeatureName}" (now "${t}")`:`"features.${t}"`;this.localSettingsOverridden.add(r)}}
vendor: 15,306 bytes, line 153
153,processFeature(e,t,n,r,s){const i=bI[e],o=t[i.localFeatureName];if(s&&!i.isAvailableOnBasic)return!1;if(r){const a=this.getApiConfig(i.apiFeatureName,n);return(a==null?void 0:a.config)===null?this.processFallbackFeature(e,o):a!=null&&a.config?(o!==void 0&&this.addWarning(o,e),this.processApiFeature(e,a)):!1}return this.processFallbackFeature(e,o)},processApiFeature(e,t){return bI[e].processApi(t)},processFallbackFeature(e,t){return bI[e].processFallback(t)},async fetchRemoteFeatures(e){const t=e.basic??!1,n=e.features||{};this.localSettingsOverridden.clear();let r=null,s=!1;try{r=await it.fetchProjectConfig(),s=r!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const i=s&&!t?mn.DEFAULT_REMOTE_FEATURES:mn.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of umt){const a=this.processFeature(o,n,r,s,t);Object.assign(i,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),mn.DEFAULT_REMOTE_FEATURES}if(s&&this.localSettingsOverridden.size>0){const o=`Your local configuration for ${Array.from(this.localSettingsOverridden).join(", ")} was ignored because a remote configuration was successfully fetched. Please manage these features via your project dashboard on dashboard.reown.com.`;qc.open({debugMessage:Zl.ALERT_WARNINGS.LOCAL_CONFIGURATION_IGNORED.debugMessage(o)},"warning")}return i}};let hmt=class{constructor(t){this.chainNamespaces=[],this.features={},this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(n,r)=>{var s,i,o;if(n){const a=(s=G.getCaipNetworks(n))==null?void 0:s.find(u=>u.id===r);if(a)return a;const c=(i=G.getNetworkData(n))==null?void 0:i.caipNetwork;return c||((o=G.getRequestedCaipNetworks(n).filter(u=>u.chainNamespace===n))==null?void 0:o[0])}return G.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const n=this.getCaipNetwork();if(n)return n.id},this.getCaipNetworks=n=>G.getCaipNetworks(n),this.getActiveChainNamespace=()=>G.state.activeChain,this.setRequestedCaipNetworks=(n,r)=>{G.setRequestedCaipNetworks(n,r)},this.getApprovedCaipNetworkIds=()=>G.getAllApprovedCaipNetworkIds(),this.getCaipAddress=n=>{var r,s;return G.state.activeChain===n||!n?G.state.activeCaipAddress:(s=(r=G.state.chains.get(n))==null?void 0:r.accountState)==null?void 0:s.caipAddress},this.setClientId=n=>{Pt.setClientId(n)},this.getProvider=n=>Br.getProvider(n),this.getProviderType=n=>Br.getProviderId(n),this.getPreferredAccountType=n=>pu(n),this.setCaipAddress=(n,r,s=!1)=>{G.setAccountProp("caipAddress",n,r,s),G.setAccountProp("address",Je.getPlainAddress(n),r,s)},this.setBalance=(n,r,s)=>{G.setAccountProp("balance",n,s),G.setAccountProp("balanceSymbol",r,s)},this.setProfileName=(n,r)=>{G.setAccountProp("profileName",n,r)},this.setProfileImage=(n,r)=>{G.setAccountProp("profileImage",n,r)},this.setUser=(n,r)=>{G.setAccountProp("user",n,r)},this.resetAccount=n=>{G.resetAccount(n)},this.setCaipNetwork=n=>{G.setActiveCaipNetwork(n)},this.setCaipNetworkOfNamespace=(n,r)=>{G.setChainNetworkData(r,{caipNetwork:n})},this.setStatus=(n,r)=>{G.setAccountProp("status",n,r),Te.isConnected()?xe.setConnectionStatus("connected"):xe.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=n=>{var r;return(r=G.getAccountData(n))==null?void 0:r.address},this.setConnectors=n=>{const r=[...Te.state.allConnectors,...n];Te.setConnectors(r)},this.setConnections=(n,r)=>{xe.setConnections(n,r),Ue.setConnections(n,r)},this.fetchIdentity=n=>Pt.fetchIdentity(n),this.getReownName=n=>f8.getNamesForAddress(n),this.getConnectors=()=>Te.getConnectors(),this.getConnectorImage=n=>dA.getConnectorImage(n),this.getConnections=n=>this.remoteFeatures.multiWallet?hA.getConnectionsData(n).connections:(qc.open(he.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.getRecentConnections=n=>this.remoteFeatures.multiWallet?hA.getConnectionsData(n).recentConnections:(qc.open(he.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.switchConnection=async n=>{if(!this.remoteFeatures.multiWallet){qc.open(he.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info");return}await Ue.switchConnection(n)},this.deleteConnection=n=>{if(!this.remoteFeatures.multiWallet){qc.open(he.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info");return}xe.deleteAddressFromConnection(n),Ue.syncStorageConnections()},this.setConnectedWalletInfo=(n,r)=>{const s=Br.getProviderId(r),i=n?{...n,type:s}:void 0;G.setAccountProp("connectedWalletInfo",i,r)},this.getIsConnectedState=()=>!!G.state.activeCaipAddress,this.addAddressLabel=(n,r,s)=>{var o;const i=((o=G.getAccountData(s))==null?void 0:o.addressLabels)||{};G.setAccountProp("addressLabels",{...i,[n]:r},s)},this.removeAddressLabel=(n,r)=>{var i;const s=((i=G.getAccountData(r))==null?void 0:i.addressLabels)||{};G.setAccountProp("addressLabels",{...s,[n]:void 0},r)},this.getAddress=n=>{var s;const r=n||G.state.activeChain;return(s=G.getAccountData(r))==null?void 0:s.address},this.resetNetwork=n=>{G.resetNetwork(n)},this.addConnector=n=>{Te.addConnector(n)},this.resetWcConnection=()=>{Ue.resetWcConnection()},this.setAddressExplorerUrl=(n,r)=>{G.setAccountProp("addressExplorerUrl",n,r)},this.setSmartAccountDeployed=(n,r)=>{G.setAccountProp("smartAccountDeployed",n,r)},this.setPreferredAccountType=(n,r)=>{G.setAccountProp("preferredAccountType",n,r)},this.setEIP6963Enabled=n=>{pe.setEIP6963Enabled(n)},this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.options=t,this.version=t.sdkVersion,this.caipNetworks=this.extendCaipNetworks(t),this.chainNamespaces=this.getChainNamespacesSet(t.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(t),this.chainAdapters=this.createAdapters(t.adapters),this.readyPromise=this.initialize(t)}getChainNamespacesSet(t,n){const r=t==null?void 0:t.map(i=>i.namespace).filter(i=>!!i);if(r!=null&&r.length)return[...new Set(r)];const s=n==null?void 0:n.map(i=>i.chainNamespace);return[...new Set(s)]}async initialize(t){var n,r,s,i,o,a;if(this.initializeProjectSettings(t),this.initControllers(t),await this.initChainAdapters(),this.sendInitializeEvent(t),(n=t.features)!=null&&n.headless&&!qo.hasInjectedConnectors()&&it.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1,fetchRecommendedWallets:!0}),pe.state.enableReconnect?(await this.syncExistingConnection(),await this.syncAdapterConnections()):await this.unSyncExistingConnection(),!t.basic&&!t.manualWCControl&&(this.remoteFeatures=await dmt.fetchRemoteFeatures(t)),await it.fetchUsage(),pe.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&RM.setOnrampProviders(this.remoteFeatures.onramp),((r=pe.state.remoteFeatures)!=null&&r.email||Array.isArray((s=pe.state.remoteFeatures)==null?void 0:s.socials)&&((i=pe.state.remoteFeatures)==null?void 0:i.socials.length)>0)&&await this.checkAllowedOrigins(),(o=pe.state.features)!=null&&o.reownAuthentication||(a=pe.state.remoteFeatures)!=null&&a.reownAuthentication){const{ReownAuthentication:c}=await te(async()=>{const{ReownAuthentication:u}=await Promise.resolve().then(()=>Rxt);return{ReownAuthentication:u}},void 0),l=pe.state.siwx;l instanceof c||(l&&console.warn("ReownAuthentication option is enabled, SIWX configuration will be overridden."),pe.setSIWX(new c))}}async openSend(t){var i;const n=t.namespace||G.state.activeChain,r=this.getCaipAddress(n),s=(i=this.getCaipNetwork(n))==null?void 0:i.id;if(!r)throw new Error("openSend: caipAddress not found");if((s==null?void 0:s.toString())!==t.chainId.toString()){const o=G.getCaipNetworkById(t.chainId,n);if(!o)throw new Error(`openSend: caipNetwork with chainId ${t.chainId} not found`);await this.switchNetwork(o,{throwOnFailure:!0})}try{const o=Vye.getTokenSymbolByAddress(t.assetAddress);o&&await it.fetchTokenImages([o])}catch{}return await dn.open({view:"WalletSend",data:{send:t}}),new Promise((o,a)=>{const c=an.subscribeKey("hash",d=>{d&&(u(),o({hash:d}))}),l=dn.subscribe(d=>{d.open||(u(),a(new Error("Modal closed")))}),u=this.createCleanupHandler([c,l])})}toModalOptions(){function t(r){return(r==null?void 0:r.view)==="Swap"}function n(r){return(r==null?void 0:r.view)==="WalletSend"}return{isSwap:t,isSend:n}}async checkAllowedOrigins(){try{const t=await it.fetchAllowedOrigins();if(!Je.isClient())return;const n=window.location.origin;xm.isOriginAllowed(n,t,he.DEFAULT_ALLOWED_ANCESTORS)||qc.open(Zl.ALERT_ERRORS.ORIGIN_NOT_ALLOWED,"error")}catch(t){if(!(t instanceof Error))return;switch(t.message){case"RATE_LIMITED":qc.open(Zl.ALERT_ERRORS.RATE_LIMITED_APP_CONFIGURATION,"error");break;case"SERVER_ERROR":{const n=t.cause instanceof Error?t.cause:t;qc.open({displayMessage:Zl.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.displayMessage,debugMessage:Zl.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.debugMessage(n.message)},"error");break}}}}createCleanupHandler(t){return()=>{t.forEach(n=>{try{n()}catch{}})}}sendInitializeEvent(t){var r;const{...n}=t;delete n.adapters,delete n.universalProvider,sn.sendEvent({type:"track",event:"INITIALIZE",properties:{...n,networks:t.networks.map(s=>s.id),siweConfig:{options:((r=t.siweConfig)==null?void 0:r.options)||{}}}})}initControllers(t){this.initializeOptionsController(t),this.initializeChainController(t),this.initializeThemeController(t),this.initializeConnectionController(t),this.initializeConnectorController()}initAdapterController(){$1e.initialize(this.chainAdapters)}initializeThemeController(t){t.themeMode&&Gc.setThemeMode(t.themeMode),t.themeVariables&&Gc.setThemeVariables(t.themeVariables)}initializeChainController(t){if(!this.connectionControllerClient)throw new Error("ConnectionControllerClient must be set");G.initialize(t.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient});const n=this.getDefaultNetwork();n&&G.setActiveCaipNetwork(n)}initializeConnectionController(t){Ue.initialize(t.adapters??[]),Ue.setWcBasic(t.basic??!1)}initializeConnectorController(){Te.initialize(this.chainNamespaces)}initializeProjectSettings(t){pe.setProjectId(t.projectId),pe.setSdkVersion(t.sdkVersion)}initializeOptionsController(t){var s;pe.setDebug(t.debug!==!1),pe.setEnableWalletGuide(t.enableWalletGuide!==!1),pe.setEnableWallets(t.enableWallets!==!1),pe.setEIP6963Enabled(t.enableEIP6963!==!1),pe.setEnableCoinbase(t.enableCoinbase!==!1),pe.setEnableNetworkSwitch(t.enableNetworkSwitch!==!1),pe.setEnableReconnect(t.enableReconnect!==!1),pe.setEnableMobileFullScreen(t.enableMobileFullScreen===!0),pe.setCoinbasePreference(t.coinbasePreference),pe.setEnableAuthLogger(t.enableAuthLogger!==!1),pe.setCustomRpcUrls(t.customRpcUrls),pe.setEnableEmbedded(t.enableEmbedded),pe.setAllWallets(t.allWallets),pe.setIncludeWalletIds(t.includeWalletIds),pe.setExcludeWalletIds(t.excludeWalletIds),pe.setFeaturedWalletIds(t.featuredWalletIds),pe.setTokens(t.tokens),pe.setTermsConditionsUrl(t.termsConditionsUrl),pe.setPrivacyPolicyUrl(t.privacyPolicyUrl),pe.setCustomWallets(t.customWallets),pe.setFeatures(t.features),pe.setAllowUnsupportedChain(t.allowUnsupportedChain),pe.setUniversalProviderConfigOverride(t.universalProviderConfigOverride),pe.setPreferUniversalLinks(t.experimental_preferUniversalLinks),pe.setDefaultAccountTypes(t.defaultAccountTypes);const n=this.getDefaultMetaData();if(!t.metadata&&n&&(t.metadata=n),pe.setMetadata(t.metadata),pe.setDisableAppend(t.disableAppend),pe.setEnableEmbedded(t.enableEmbedded),pe.setSIWX(t.siwx),this.features=pe.state.features??{},!t.projectId){qc.open(Zl.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(((s=t.adapters)==null?void 0:s.find(i=>i.namespace===he.CHAIN.EVM))&&t.siweConfig){if(t.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");pe.setSIWX(t.siweConfig.mapToSIWX())}}getDefaultMetaData(){var t,n,r,s;return Je.isClient()?{name:((n=(t=document.getElementsByTagName("title"))==null?void 0:t[0])==null?void 0:n.textContent)||"",description:((r=document.querySelector('meta[property="og:description"]'))==null?void 0:r.content)||"",url:window.location.origin,icons:[((s=document.querySelector('link[rel~="icon"]'))==null?void 0:s.href)||""]}:null}setUnsupportedNetwork(t){const n=this.getActiveChainNamespace();if(n){const r=tv.getUnsupportedNetwork(`${n}:${t}`);G.setActiveCaipNetwork(r)}}getDefaultNetwork(){return tv.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(t,n){return tv.extendCaipNetwork(t,{customNetworkImageUrls:n.chainImages,projectId:n.projectId})}extendCaipNetworks(t){return tv.extendCaipNetworks(t.networks,{customNetworkImageUrls:t.chainImages,customRpcUrls:t.customRpcUrls,projectId:t.projectId})}extendDefaultCaipNetwork(t){const n=t.networks.find(s=>{var i;return s.id===((i=t.defaultNetwork)==null?void 0:i.id)});return n?tv.extendCaipNetwork(n,{customNetworkImageUrls:t.chainImages,customRpcUrls:t.customRpcUrls,projectId:t.projectId}):void 0}async disconnectConnector(t,n){var r,s;try{this.setLoading(!0,t);let i={connections:[]};const o=this.getAdapter(t);return(((s=(r=G.state.chains.get(t))==null?void 0:r.accountState)==null?void 0:s.caipAddress)||!pe.state.enableReconnect)&&(o!=null&&o.disconnect)&&(i=await o.disconnect({id:n})),this.setLoading(!1,t),i}catch(i){throw this.setLoading(!1,t),new Error(`Failed to disconnect chains: ${i.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{var l;const t=G.state.activeChain,n=this.getAdapter(t),r=(l=this.getCaipNetwork(t))==null?void 0:l.id,s=Ue.getConnections(t),i=this.remoteFeatures.multiWallet,o=s.length>0;if(!n)throw new Error("Adapter not found");const a=await n.connectWalletConnect(r);(!o||!i)&&this.close(),this.setClientId((a==null?void 0:a.clientId)||null),xe.setConnectedNamespaces([...G.state.chains.keys()]),await this.syncWalletConnectAccount(),await bd.initializeIfEnabled()},connectExternal:async t=>{const n=await this.onConnectExternal(t);return await this.connectInactiveNamespaces(t,n),n?{address:n.address}:void 0},reconnectExternal:async({id:t,info:n,type:r,provider:s})=>{var a;const i=G.state.activeChain,o=this.getAdapter(i);if(!i)throw new Error("reconnectExternal: namespace not found");if(!o)throw new Error("reconnectExternal: adapter not found");o!=null&&o.reconnect&&(await(o==null?void 0:o.reconnect({id:t,info:n,type:r,provider:s,chainId:(a=this.getCaipNetwork())==null?void 0:a.id})),xe.addConnectedNamespace(i),this.syncConnectedWalletInfo(i))},disconnectConnector:async t=>{await this.disconnectConnector(t.namespace,t.id)},disconnect:async t=>{var l;const{id:n,chainNamespace:r,initialDisconnect:s}=t||{},i=r||G.state.activeChain,o=Te.getConnectorId(i),a=n===he.CONNECTOR_ID.AUTH||o===he.CONNECTOR_ID.AUTH,c=n===he.CONNECTOR_ID.WALLET_CONNECT||o===he.CONNECTOR_ID.WALLET_CONNECT;try{const u=Array.from(G.state.chains.keys());let d=r?[r]:u;(c||a)&&(d=u);const h=d.map(async p=>{const m=Te.getConnectorId(p),w=n||m,C=await this.disconnectConnector(p,w);C&&(a&&xe.deleteConnectedSocialProvider(),C.connections.forEach(E=>{xe.addDisconnectedConnectorId(E.connectorId,p)})),s&&this.onDisconnectNamespace({chainNamespace:p,closeModal:!1})}
153),f=await Promise.allSettled(h);an.resetSend(),Ue.resetWcConnection(),(l=bd.getSIWX())!=null&&l.signOutOnDisconnect&&await bd.clearSessions(),Te.setFilterByNamespace(void 0),Ue.syncStorageConnections();const g=f.filter(p=>p.status==="rejected");if(g.length>0)throw new Error(g.map(p=>p.reason.message).join(", "));sn.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:r||"all"}})}catch(u){throw new Error(`Failed to disconnect chains: ${u.message}`)}},checkInstalled:t=>t?t.some(n=>{var r;return!!((r=window.ethereum)!=null&&r[String(n)])}):!!window.ethereum,signMessage:async t=>{const n=G.state.activeChain,r=this.getAdapter(G.state.activeChain);if(!n)throw new Error("signMessage: namespace not found");if(!r)throw new Error("signMessage: adapter not found");const s=this.getAddress(n);if(!s)throw new Error("signMessage: address not found");const i=await(r==null?void 0:r.signMessage({message:t,address:s,provider:Br.getProvider(n)}));return(i==null?void 0:i.signature)||""},sendTransaction:async t=>{const n=t.chainNamespace;if(!n)throw new Error("sendTransaction: namespace not found");if(mn.SEND_SUPPORTED_NAMESPACES.includes(n)){const r=this.getAdapter(n);if(!r)throw new Error("sendTransaction: adapter not found");const s=Br.getProvider(n),i=await(r==null?void 0:r.sendTransaction({...t,caipNetwork:this.getCaipNetwork(),provider:s}));return(i==null?void 0:i.hash)||""}return""},estimateGas:async t=>{const n=t.chainNamespace;if(n===he.CHAIN.EVM){const r=this.getAdapter(n);if(!r)throw new Error("estimateGas: adapter is required but got undefined");const s=Br.getProvider(n),i=this.getCaipNetwork();if(!i)throw new Error("estimateGas: caipNetwork is required but got undefined");const o=await(r==null?void 0:r.estimateGas({...t,provider:s,caipNetwork:i}));return(o==null?void 0:o.gas)||0n}return 0n},getEnsAvatar:async()=>{var s;const t=G.state.activeChain;if(!t)throw new Error("getEnsAvatar: namespace is required but got undefined");const n=this.getAddress(t);if(!n)throw new Error("getEnsAvatar: address not found");await this.syncIdentity({address:n,chainId:Number((s=this.getCaipNetwork())==null?void 0:s.id),chainNamespace:t});const r=G.getAccountData();return(r==null?void 0:r.profileImage)||!1},getEnsAddress:async t=>await xm.resolveReownName(t),writeContract:async t=>{const n=G.state.activeChain,r=this.getAdapter(n);if(!n)throw new Error("writeContract: namespace is required but got undefined");if(!r)throw new Error("writeContract: adapter is required but got undefined");const s=this.getCaipNetwork(),i=this.getCaipAddress(),o=Br.getProvider(n);if(!s||!i)throw new Error("writeContract: caipNetwork or caipAddress is required but got undefined");const a=await(r==null?void 0:r.writeContract({...t,caipNetwork:s,provider:o,caipAddress:i}));return a==null?void 0:a.hash},writeSolanaTransaction:async t=>{const n=G.state.activeChain,r=this.getAdapter(n);if(!n)throw new Error("writeContract: namespace is required but got undefined");if(!r)throw new Error("writeContract: adapter is required but got undefined");const s=this.getCaipNetwork(),i=this.getCaipAddress(),o=Br.getProvider(n);if(!s||!i)throw new Error("writeContract: caipNetwork or caipAddress is required but got undefined");const a=await(r==null?void 0:r.writeSolanaTransaction({...t,caipNetwork:s,provider:o,caipAddress:i}));return a==null?void 0:a.hash},parseUnits:(t,n)=>{const r=this.getAdapter(G.state.activeChain);if(!r)throw new Error("parseUnits: adapter is required but got undefined");return(r==null?void 0:r.parseUnits({value:t,decimals:n}))??0n},formatUnits:(t,n)=>{const r=this.getAdapter(G.state.activeChain);if(!r)throw new Error("formatUnits: adapter is required but got undefined");return(r==null?void 0:r.formatUnits({value:t,decimals:n}))??"0"},getCapabilities:async t=>{const n=this.getAdapter(G.state.activeChain);if(!n)throw new Error("getCapabilities: adapter is required but got undefined");return await(n==null?void 0:n.getCapabilities(t))},grantPermissions:async t=>{const n=this.getAdapter(G.state.activeChain);if(!n)throw new Error("grantPermissions: adapter is required but got undefined");return await(n==null?void 0:n.grantPermissions(t))},revokePermissions:async t=>{const n=this.getAdapter(G.state.activeChain);if(!n)throw new Error("revokePermissions: adapter is required but got undefined");return n!=null&&n.revokePermissions?await n.revokePermissions(t):"0x"},walletGetAssets:async t=>{const n=this.getAdapter(G.state.activeChain);if(!n)throw new Error("walletGetAssets: adapter is required but got undefined");return await(n==null?void 0:n.walletGetAssets(t))??{}},updateBalance:t=>{const n=this.getAddress(t),r=this.getCaipNetwork(t);!r||!n||this.updateNativeBalance(n,r==null?void 0:r.id,t)}},Ue.setClient(this.connectionControllerClient)}async onConnectExternal(t){var l,u,d,h,f,g,p,m;const n=G.state.activeChain,r=t.chain||n,s=this.getAdapter(r);let i=!0;if(t.type===gp.CONNECTOR_TYPE_AUTH&&he.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(E=>Te.getConnectorId(E)===he.CONNECTOR_ID.AUTH)&&t.chain!==n&&(i=!1),t.chain&&t.chain!==n&&!t.caipNetwork){const w=this.getCaipNetworks().find(C=>C.chainNamespace===t.chain);w&&i&&this.setCaipNetwork(w)}if(!r)throw new Error("connectExternal: namespace not found");if(!s)throw new Error("connectExternal: adapter not found");const o=this.getCaipNetwork(r),a=t.caipNetwork||o,c=await s.connect({id:t.id,address:t.address,info:t.info,type:t.type,provider:t.provider,socialUri:t.socialUri,chainId:((l=t.caipNetwork)==null?void 0:l.id)||(o==null?void 0:o.id),rpcUrl:((f=(h=(d=(u=t.caipNetwork)==null?void 0:u.rpcUrls)==null?void 0:d.default)==null?void 0:h.http)==null?void 0:f[0])||((m=(p=(g=o==null?void 0:o.rpcUrls)==null?void 0:g.default)==null?void 0:p.http)==null?void 0:m[0])});if(c)return xe.addConnectedNamespace(r),this.syncProvider({...c,chainNamespace:r}),this.setStatus("connected",r),this.syncConnectedWalletInfo(r),xe.removeDisconnectedConnectorId(t.id,r),{address:c.address,connectedCaipNetwork:a}}async connectInactiveNamespaces(t,n){var a;const r=t.type===gp.CONNECTOR_TYPE_AUTH,s=Ej.getOtherAuthNamespaces((a=n==null?void 0:n.connectedCaipNetwork)==null?void 0:a.chainNamespace),i=G.state.activeCaipNetwork,o=this.getAdapter(i==null?void 0:i.chainNamespace);r&&(await Promise.all(s.map(async c=>{var l,u,d;try{const h=Br.getProvider(c),f=this.getCaipNetwork(c),g=this.getAdapter(c);await(g==null?void 0:g.connect({...t,provider:h,socialUri:void 0,chainId:f==null?void 0:f.id,rpcUrl:(d=(u=(l=f==null?void 0:f.rpcUrls)==null?void 0:l.default)==null?void 0:u.http)==null?void 0:d[0]}))&&(xe.addConnectedNamespace(c),xe.removeDisconnectedConnectorId(t.id,c),this.setStatus("connected",c),this.syncConnectedWalletInfo(c))}catch(h){qc.warn(Zl.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.displayMessage,Zl.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.debugMessage(c,h instanceof Error?h.message:void 0),Zl.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.code)}})),i&&await(o==null?void 0:o.switchNetwork({caipNetwork:i})))}getApprovedCaipNetworksData(){var n,r,s,i,o;if(Br.getProviderId(G.state.activeChain)===gp.CONNECTOR_TYPE_WALLET_CONNECT){const a=(r=(n=this.universalProvider)==null?void 0:n.session)==null?void 0:r.namespaces;return{supportsAllNetworks:((o=(i=(s=this.universalProvider)==null?void 0:s.session)==null?void 0:i.peer)==null?void 0:o.metadata.name)==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(a)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(t){const n=t.chainNamespace;if(this.getAddressByChainNamespace(t.chainNamespace)){const s=Br.getProviderId(n);if(t.chainNamespace===G.state.activeChain){const i=this.getAdapter(n);await(i==null?void 0:i.switchNetwork({caipNetwork:t}))}else if(this.setCaipNetwork(t),s===gp.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const i=this.getAddressByChainNamespace(n);i&&this.syncAccount({address:i,chainId:t.id,chainNamespace:n})}}else this.setCaipNetwork(t)}getChainsFromNamespaces(t={}){return Object.values(t).flatMap(n=>{const r=n.chains||[],s=n.accounts.map(i=>{const{chainId:o,chainNamespace:a}=Ci.parseCaipAddress(i);return`${a}:${o}`});return Array.from(new Set([...r,...s]))})}createAdapters(t){return this.createClients(),this.chainNamespaces.reduce((n,r)=>{var i,o;const s=t==null?void 0:t.find(a=>a.namespace===r);return s?(s.construct({namespace:r,projectId:(i=this.options)==null?void 0:i.projectId,networks:(o=this.caipNetworks)==null?void 0:o.filter(({chainNamespace:a})=>a===r)}
153),n[r]=s):n[r]=new lmt({namespace:r,networks:this.getCaipNetworks()}),n},{})}async initChainAdapter(t){this.onConnectors(t),this.listenAdapter(t);const n=this.getAdapter(t);if(!n)throw new Error("adapter not found");await n.syncConnectors(),await this.createUniversalProviderForAdapter(t)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async t=>{await this.initChainAdapter(t)})),this.initAdapterController()}onConnectors(t){const n=this.getAdapter(t);n==null||n.on("connectors",this.setConnectors.bind(this))}listenAdapter(t){const n=this.getAdapter(t);if(!n)return;const r=xe.getConnectionStatus();pe.state.enableReconnect===!1?this.setStatus("disconnected",t):r==="connected"?this.setStatus("connecting",t):r==="disconnected"?(xe.clearAddressCache(),this.setStatus(r,t)):this.setStatus(r,t),n.on("switchNetwork",({address:s,chainId:i})=>{var l,u;const o=this.getCaipNetworks().find(d=>d.id.toString()===i.toString()||d.caipNetworkId.toString()===i.toString()),a=G.state.activeChain===t,c=(u=(l=G.state.chains.get(t))==null?void 0:l.accountState)==null?void 0:u.address;if(o){const d=a&&s?s:c;d&&this.syncAccount({address:d,chainId:o.id,chainNamespace:t})}else this.setUnsupportedNetwork(i)}),n.on("disconnect",()=>{const s=this.remoteFeatures.multiWallet,i=Array.from(Ue.state.connections.values()).flat();this.onDisconnectNamespace({chainNamespace:t,closeModal:!s||i.length===0})}),n.on("connections",s=>{this.setConnections(s,t)}),n.on("pendingTransactions",()=>{const s=this.getAddress(t),i=G.state.activeCaipNetwork;!s||!(i!=null&&i.id)||this.updateNativeBalance(s,i.id,i.chainNamespace)}),n.on("accountChanged",({address:s,chainId:i,connector:o})=>{var u,d;this.handlePreviousConnectorConnection(o);const a=G.state.activeChain===t;o!=null&&o.provider&&(this.syncProvider({id:o.id,type:o.type,provider:o==null?void 0:o.provider,chainNamespace:t}),this.syncConnectedWalletInfo(t));const c=(d=(u=G.getNetworkData(t))==null?void 0:u.caipNetwork)==null?void 0:d.id,l=i||c;a&&l?this.syncAccount({address:s,chainId:l,chainNamespace:t}):!a&&l?(this.syncAccountInfo(s,l,t),this.syncBalance({address:s,chainId:l,chainNamespace:t})):this.syncAccountInfo(s,i,t),xe.addConnectedNamespace(t)})}async handlePreviousConnectorConnection(t){var c;const n=t==null?void 0:t.chain,r=t==null?void 0:t.id,s=Te.getConnectorId(n),i=(c=pe.state.remoteFeatures)==null?void 0:c.multiWallet,a=n&&r&&s&&s!==r&&!i;try{a&&await Ue.disconnect({id:s,namespace:n})}catch(l){console.warn("Error disconnecting previous connector",l)}}async createUniversalProviderForAdapter(t){var n,r,s;await this.getUniversalProvider(),this.universalProvider&&await((s=(r=(n=this.chainAdapters)==null?void 0:n[t])==null?void 0:r.setUniversalProvider)==null?void 0:s.call(r,this.universalProvider))}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(t=>this.syncNamespaceConnection(t)))}async unSyncExistingConnection(){try{await Promise.allSettled(this.chainNamespaces.map(t=>Ue.disconnect({namespace:t,initialDisconnect:!0})))}catch(t){console.error("Error disconnecting existing connections:",t)}}async reconnectWalletConnect(){await this.syncWalletConnectAccount();const t=this.getAddress();this.getCaipAddress()||xe.deleteRecentWallet();const n=xe.getRecentWallet();sn.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:t,properties:{method:Je.isMobile()?"mobile":"qrcode",name:(n==null?void 0:n.name)||"Unknown",reconnect:!0,view:xt.state.view,walletRank:n==null?void 0:n.order}})}async syncNamespaceConnection(t){try{t===he.CHAIN.EVM&&Je.isSafeApp()&&Te.setConnectorId(he.CONNECTOR_ID.SAFE,t);const n=Te.getConnectorId(t);switch(this.setStatus("connecting",t),n){case he.CONNECTOR_ID.WALLET_CONNECT:await this.reconnectWalletConnect();break;case he.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(t)}}catch(n){console.warn("AppKit couldn't sync existing connection",n),this.setStatus("disconnected",t)}}onDisconnectNamespace(t){const{chainNamespace:n,closeModal:r}=t||{};G.resetAccount(n),G.resetNetwork(n),xe.removeConnectedNamespace(n);const s=Array.from(G.state.chains.keys());
153(n?[n]:s).forEach(o=>xe.addDisconnectedConnectorId(Te.getConnectorId(o)||"",o)),Te.removeConnectorId(n),Br.resetChain(n),this.setUser(null,n),this.setStatus("disconnected",n),this.setConnectedWalletInfo(null,n),r!==!1&&dn.close()}async syncAdapterConnections(){await Promise.allSettled(this.chainNamespaces.map(t=>{const n=this.getAdapter(t),r=this.getCaipAddress(t),s=this.getCaipNetwork(t);return n==null?void 0:n.syncConnections({connectToFirstConnector:!r,caipNetwork:s})}))}async syncAdapterConnection(t){var a,c,l,u,d;const n=this.getAdapter(t),r=this.getCaipNetwork(t),s=Te.getConnectorId(t),o=Te.getConnectors(t).find(h=>h.id===s);try{if(!n||!o)throw new Error(`Adapter or connector not found for namespace ${t}`);if(!(r!=null&&r.id))throw new Error("CaipNetwork not found");const h=await(n==null?void 0:n.syncConnection({namespace:t,id:o.id,chainId:r.id,rpcUrl:(l=(c=(a=r==null?void 0:r.rpcUrls)==null?void 0:a.default)==null?void 0:c.http)==null?void 0:l[0]}));h?(this.syncProvider({...h,chainNamespace:t}),await this.syncAccount({...h,chainNamespace:t}),this.setStatus("connected",t),sn.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:h.address,properties:{method:"browser",name:((u=o.info)==null?void 0:u.name)||o.name||"Unknown",reconnect:!0,view:xt.state.view,walletRank:(d=o==null?void 0:o.explorerWallet)==null?void 0:d.order}})):this.setStatus("disconnected",t)}catch{this.onDisconnectNamespace({chainNamespace:t,closeModal:!1})}}async syncWalletConnectAccount(){var r,s;const t=Object.keys(((s=(r=this.universalProvider)==null?void 0:r.session)==null?void 0:s.namespaces)||{}),n=this.chainNamespaces.map(async i=>{var d,h,f,g,p;const o=this.getAdapter(i);if(!o)return;const a=((g=(f=(h=(d=this.universalProvider)==null?void 0:d.session)==null?void 0:h.namespaces)==null?void 0:f[i])==null?void 0:g.accounts)||[],c=(p=G.state.activeCaipNetwork)==null?void 0:p.id,l=a.find(m=>{const{chainId:w}=Ci.parseCaipAddress(m);return w===(c==null?void 0:c.toString())})||a[0];if(l){const m=Ci.validateCaipAddress(l),{chainId:w,address:C}=Ci.parseCaipAddress(m);if(Br.setProviderId(i,gp.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&G.state.activeCaipNetwork&&o.namespace!==he.CHAIN.EVM){const E=o.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:G.state.activeCaipNetwork});Br.setProvider(i,E)}else Br.setProvider(i,this.universalProvider);Te.setConnectorId(he.CONNECTOR_ID.WALLET_CONNECT,i),xe.addConnectedNamespace(i),await this.syncAccount({address:C,chainId:w,chainNamespace:i})}else t.includes(i)&&this.setStatus("disconnected",i);const u=this.getApprovedCaipNetworksData();this.syncConnectedWalletInfo(i),G.setApprovedCaipNetworksData(i,{approvedCaipNetworkIds:u.approvedCaipNetworkIds,supportsAllNetworks:u.supportsAllNetworks})});await Promise.all(n)}syncProvider({type:t,provider:n,id:r,chainNamespace:s}){Br.setProviderId(s,t),Br.setProvider(s,n),Te.setConnectorId(r,s)}async syncAccount(t){var d,h;const n=t.chainNamespace===G.state.activeChain,r=G.getCaipNetworkByNamespace(t.chainNamespace,t.chainId),{address:s,chainId:i,chainNamespace:o}=t,{chainId:a}=xe.getActiveNetworkProps(),c=(r==null?void 0:r.id)||a,l=((d=G.state.activeCaipNetwork)==null?void 0:d.name)===he.UNSUPPORTED_NETWORK_NAME,u=G.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(l&&!u)&&c){let f=this.getCaipNetworks().find(w=>w.id.toString()===c.toString()),g=this.getCaipNetworks().find(w=>w.chainNamespace===o);if(!u&&!f&&!g){const w=this.getApprovedCaipNetworkIds()||[],C=w.find(b=>{var S;return((S=Ci.parseCaipNetworkId(b))==null?void 0:S.chainId)===c.toString()}),E=w.find(b=>{var S;return((S=Ci.parseCaipNetworkId(b))==null?void 0:S.chainNamespace)===o});f=this.getCaipNetworks().find(b=>b.caipNetworkId===C),g=this.getCaipNetworks().find(b=>b.caipNetworkId===E||"deprecatedCaipNetworkId"in b&&b.deprecatedCaipNetworkId===E)}const p=f||g;(p==null?void 0:p.chainNamespace)===G.state.activeChain?pe.state.enableNetworkSwitch&&!pe.state.allowUnsupportedChain&&((h=G.state.activeCaipNetwork)==null?void 0:h.name)===he.UNSUPPORTED_NETWORK_NAME?G.showUnsupportedChainUI():this.setCaipNetwork(p):n||r&&this.setCaipNetworkOfNamespace(r,o),this.syncConnectedWalletInfo(o);const m=this.getAddress(o);Ej.isLowerCaseMatch(s,m)||this.syncAccountInfo(s,p==null?void 0:p.id,o),n?await this.syncBalance({address:s,chainId:p==null?void 0:p.id,chainNamespace:o}):await this.syncBalance({address:s,chainId:r==null?void 0:r.id,chainNamespace:o}),this.syncIdentity({address:s,chainId:i,chainNamespace:o})}}async syncAccountInfo(t,n,r){const s=this.getCaipAddress(r),i=n||(s==null?void 0:s.split(":")[1]);if(!i)return;const o=`${r}:${i}:${t}`;this.setCaipAddress(o,r,!0),await this.syncIdentity({address:t,chainId:i,chainNamespace:r})}async syncReownName(t,n){try{const r=await this.getReownName(t);if(r[0]){const s=r[0];this.setProfileName(s.name,n)}else this.setProfileName(null,n)}catch{this.setProfileName(null,n)}}syncConnectedWalletInfo(t){var s;const n=Te.getConnectorId(t),r=Br.getProviderId(t);if(r===gp.CONNECTOR_TYPE_ANNOUNCED||r===gp.CONNECTOR_TYPE_INJECTED){if(n){const o=this.getConnectors().find(a=>{var d,h;const c=a.id===n,l=((d=a.info)==null?void 0:d.rdns)===n,u=(h=a.connectors)==null?void 0:h.some(f=>{var g;return f.id===n||((g=f.info)==null?void 0:g.rdns)===n});return c||l||!!u});if(o){const{info:a,name:c,imageUrl:l}=o,u=l||this.getConnectorImage(o);this.setConnectedWalletInfo({name:c,icon:u,...a},t)}}}else if(r===gp.CONNECTOR_TYPE_WALLET_CONNECT){const i=Br.getProvider(t);i!=null&&i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:(s=i.session.peer.metadata.icons)==null?void 0:s[0]},t)}else if(n&&(n===he.CONNECTOR_ID.COINBASE_SDK||n===he.CONNECTOR_ID.COINBASE)){const i=this.getConnectors().find(l=>l.id===n),o=(i==null?void 0:i.name)||"Coinbase Wallet",a=(i==null?void 0:i.imageUrl)||this.getConnectorImage(i),c=i==null?void 0:i.info;this.setConnectedWalletInfo({...c,name:o,icon:a},t)}}async syncBalance(t){!PW.getNetworksByNamespace(this.getCaipNetworks(),t.chainNamespace).find(r=>{var s;return r.id.toString()===((s=t.chainId)==null?void 0:s.toString())})||!t.chainId||await this.updateNativeBalance(t.address,t.chainId,t.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(t,n,r){const s=this.getAdapter(r),i=G.getCaipNetworkByNamespace(r,n);if(s){const o=await s.getBalance({address:t,chainId:n,caipNetwork:i,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,r),o}}async initializeUniversalAdapter(){var s,i,o,a,c,l,u,d,h,f;const t=amt.createLogger((g,...p)=>{g&&this.handleAlertError(g),console.error(...p)}),n={projectId:(s=this.options)==null?void 0:s.projectId,metadata:{name:(i=this.options)!=null&&i.metadata?(o=this.options)==null?void 0:o.metadata.name:"",description:(a=this.options)!=null&&a.metadata?(c=this.options)==null?void 0:c.metadata.description:"",url:(l=this.options)!=null&&l.metadata?(u=this.options)==null?void 0:u.metadata.url:"",icons:(d=this.options)!=null&&d.metadata?(h=this.options)==null?void 0:h.metadata.icons:[""]},logger:t};pe.setManualWCControl(!!((f=this.options)!=null&&f.manualWCControl)),this.universalProvider=this.options.universalProvider??await ygt.init(n);const r=this.universalProvider.disconnect.bind(this.universalProvider);this.universalProvider.disconnect=async()=>{try{return await r()}catch(g){if(g instanceof Error&&g.message.includes("Missing or invalid. Record was recently deleted"))return;throw g}},pe.state.enableReconnect===!1&&this.universalProvider.session&&await this.universalProvider.disconnect(),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&this.chainNamespaces.forEac
153h(t=>{xm.listenWcProvider({universalProvider:this.universalProvider,namespace:t,onDisplayUri:n=>{Ue.setUri(n)},onConnect:n=>{const{address:r}=Je.getAccount(n[0]);for(const s of this.chainNamespaces)xe.removeDisconnectedConnectorId(he.CONNECTOR_ID.WALLET_CONNECT,s);Ue.finalizeWcConnection(r)},onDisconnect:()=>{G.state.noAdapters&&this.resetAccount(t),Ue.resetWcConnection()},onChainChanged:n=>{const r=G.state.activeChain,s=r&&Te.state.activeConnectorIds[r]===he.CONNECTOR_ID.WALLET_CONNECT;if(r===t&&(G.state.noAdapters||s)){const i=this.getCaipNetworks().find(a=>a.id.toString()===n.toString()||a.caipNetworkId.toString()===n.toString()),o=this.getCaipNetwork();if(!i){this.setUnsupportedNetwork(n);return}(o==null?void 0:o.id.toString())!==(i==null?void 0:i.id.toString())&&(o==null?void 0:o.chainNamespace)===(i==null?void 0:i.chainNamespace)&&this.setCaipNetwork(i)}},onAccountsChanged:n=>{const r=G.state.activeChain,s=r&&Te.state.activeConnectorIds[r]===he.CONNECTOR_ID.WALLET_CONNECT;if(r===t&&(G.state.noAdapters||s)){const i=n==null?void 0:n[0];i&&this.syncAccount({address:i.address,chainId:i.chainId,chainNamespace:i.chainNamespace})}}})})}createUniversalProvider(){var t;return!this.universalProviderInitPromise&&Je.isClient()&&((t=this.options)!=null&&t.projectId)&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}
vendor: 6,339 bytes, line 153
153async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(t){sn.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:t instanceof Error?t.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",t)}return this.universalProvider}getDisabledCaipNetworks(){const t=G.getAllApprovedCaipNetworkIds(),n=G.getAllRequestedCaipNetworks();return Je.sortRequestedNetworks(t,n).filter(s=>G.isCaipNetworkDisabled(s))}handleAlertError(t){const n=Object.entries(Zl.UniversalProviderErrors).find(([,{message:a}])=>t.message.includes(a)),[r,s]=n??[],{message:i,alertErrorKey:o}=s??{};if(r&&i&&!this.reportedAlertErrors[r]){const a=Zl.ALERT_ERRORS[o];a&&(qc.open(a,"error"),this.reportedAlertErrors[r]=!0)}}getAdapter(t){var n;if(t)return(n=this.chainAdapters)==null?void 0:n[t]}createAdapter(t){var s,i;if(!t)return;const n=t.namespace;if(!n)return;this.createClients();const r=t;r.namespace=n,r.construct({namespace:n,projectId:(s=this.options)==null?void 0:s.projectId,networks:(i=this.caipNetworks)==null?void 0:i.filter(({chainNamespace:o})=>o===n)}),this.chainNamespaces.includes(n)||this.chainNamespaces.push(n),this.chainAdapters&&(this.chainAdapters[n]=r)}async open(t){await this.injectModalUi(),t!=null&&t.uri&&Ue.setUri(t.uri);const{isSwap:n,isSend:r}=this.toModalOptions();return n(t)?dn.open({...t,data:{swap:t.arguments}}):r(t)&&t.arguments?this.openSend(t.arguments):dn.open(t)}async close(){await this.injectModalUi(),dn.close()}setLoading(t,n){dn.setLoading(t,n)}async disconnect(t){await Ue.disconnect({namespace:t})}getSIWX(){return pe.state.siwx}getError(){return""}getChainId(){var t;return(t=G.state.activeCaipNetwork)==null?void 0:t.id}async switchNetwork(t,{throwOnFailure:n=!1}={}){const r=this.getCaipNetworks().find(s=>s.id===t.id);if(!r){qc.open(Zl.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await G.switchActiveNetwork(r,{throwOnFailure:n})}getWalletProvider(){return G.state.activeChain?Br.state.providers[G.state.activeChain]:null}getWalletProviderType(){return Br.getProviderId(G.state.activeChain)}subscribeProviders(t){return Br.subscribeProviders(t)}getThemeMode(){return Gc.state.themeMode}getThemeVariables(){return Gc.state.themeVariables}setThemeMode(t){Gc.setThemeMode(t),Gc.state.themeMode}setTermsConditionsUrl(t){pe.setTermsConditionsUrl(t)}setPrivacyPolicyUrl(t){pe.setPrivacyPolicyUrl(t)}setThemeVariables(t){Gc.setThemeVariables(t),Gc.state.themeVariables}subscribeTheme(t){return Gc.subscribe(t)}subscribeConnections(t){return this.remoteFeatures.multiWallet?Ue.subscribe(t):(qc.open(he.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),()=>{})}getWalletInfo(t){var r,s;if(t)return(s=(r=G.state.chains.get(t))==null?void 0:r.accountState)==null?void 0:s.connectedWalletInfo;const n=G.getAccountData();return n==null?void 0:n.connectedWalletInfo}getAccount(t){const n=t||G.state.activeChain,r=Te.getAuthConnector(n),s=G.getAccountData(n),i=xe.getConnectedConnectorId(G.state.activeChain),o=Ue.getConnections(n);if(!n)throw new Error("AppKit:getAccount - namespace is required");const a=o.flatMap(c=>{const{caipNetwork:l}=c;return l?c.accounts.map(({address:u,type:d,publicKey:h})=>Je.createAccount({caipAddress:`${l.caipNetworkId}:${u}`,type:d||"eoa",publicKey:h})):[]});if(s)return{allAccounts:a,caipAddress:s.caipAddress,address:Je.getPlainAddress(s.caipAddress),isConnected:!!s.caipAddress,status:s.status,embeddedWalletInfo:r&&i===he.CONNECTOR_ID.AUTH?{user:s.user?{...s.user,username:xe.getConnectedSocialUsername()}:void 0,authProvider:s.socialProvider||"email",accountType:pu(n),isSmartAccountDeployed:!!s.smartAccountDeployed}:void 0}}subscribeAccount(t,n){const r=[],s=()=>{const o=this.getAccount(n);o&&t(o)};if(n){const o=G.subscribeChainProp("accountState",s,n);r.push(o)}else{const o=G.subscribe(s);r.push(o)}const i=Te.subscribe(s);return r.push(i),()=>{r.forEach(o=>o())}}subscribeNetwork(t){return G.subscribe(({activeCaipNetwork:n})=>{t({caipNetwork:n,chainId:n==null?void 0:n.id,caipNetworkId:n==null?void 0:n.caipNetworkId})})}subscribeWalletInfo(t,n){return n?G.subscribeChainProp("accountState",r=>t(r==null?void 0:r.connectedWalletInfo),n):G.subscribeChainProp("accountState",r=>t(r==null?void 0:r.connectedWalletInfo))}subscribeShouldUpdateToAddress(t){return G.subscribeChainProp("accountState",n=>t(n==null?void 0:n.shouldUpdateToAddress))}subscribeCaipNetworkChange(t){return G.subscribeKey("activeCaipNetwork",t)}getState(){return xd.state}getRemoteFeatures(){return pe.state.remoteFeatures}subscribeState(t){return xd.subscribe(t)}subscribeRemoteFeatures(t){return pe.subscribeKey("remoteFeatures",t)}showErrorMessage(t){Lh.showError(t)}showSuccessMessage(t){Lh.showSuccess(t)}getEvent(){return{...sn.state}}subscribeEvents(t){return sn.subscribe(t)}replace(t){xt.replace(t)}redirect(t){xt.push(t)}popTransactionStack(t){xt.popTransactionStack(t)}isOpen(){return dn.state.open}isTransactionStackEmpty(){return xt.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(t){pe.setFeatures(t)}updateRemoteFeatures(t){pe.setRemoteFeatures(t)}updateOptions(t){const r={...pe.state||{},...t};pe.setOptions(r)}setConnectMethodsOrder(t){pe.setConnectMethodsOrder(t)}setWalletFeaturesOrder(t){pe.setWalletFeaturesOrder(t)}setCollapseWallets(t){pe.setCollapseWallets(t)}setSocialsOrder(t){pe.setSocialsOrder(t)}getConnectMethodsOrder(){return lm.getConnectOrderMethod(pe.state.features,Te.getConnectors())}addNetwork(t,n){if(this.chainAdapters&&!this.chainAdapters[t])throw new Error(`Adapter for namespace ${t} doesn't exist`);const r=this.extendCaipNetwork(n,this.options);this.getCaipNetworks().find(s=>s.id===r.id)||G.addNetwork(r)}removeNetwork(t,n){if(this.chainAdapters&&!this.chainAdapters[t])throw new Error(`Adapter for namespace ${t} doesn't exist`);this.getCaipNetworks().find(s=>s.id===n)&&G.removeNetwork(t,n)}},kre=!1,fmt=class extends hmt{async open(t){Te.isConnected()||await super.open(t)}async close(){var t;if(await super.close(),this.options.manualWCControl){const n=(t=G.getAccountData(this.activeChainNamespace))==null?void 0:t.address;Ue.finalizeWcConnection(n)}}async syncIdentity(t){return Promise.resolve()}async syncBalance(t){return Promise.resolve()}
153async injectModalUi(){if(!kre&&Je.isClient()){if(await te(()=>Promise.resolve().then(()=>OTt),void 0),await te(()=>Promise.resolve().then(()=>RLt),void 0),!document.querySelector("w3m-modal")){const n=document.createElement("w3m-modal");!pe.state.disableAppend&&!pe.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",n)}kre=!0}}};const pmt="1.8.19";function gYt(e){return new fmt({...e,basic:!0,sdkVersion:`html-core-${pmt}`})}function ih(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}ih({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"});ih({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"});ih({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"});ih({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}});ih({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});ih({id:"00000008819873e925422c1ff0f99f7c",caipNetworkId:"bip122:00000008819873e925422c1ff0f99f7c",chainNamespace:"bip122",name:"Bitcoin Signet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});ih({id:"-239",name:"TON",network:"ton-mainnet",nativeCurrency:{name:"TON",symbol:"TON",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tonscan",url:"https://tonscan.org"}},testnet:!1,chainNamespace:"ton",caipNetworkId:"ton:-239"});ih({id:"-3",name:"TON Testnet",network:"ton-testnet",nativeCurrency:{name:"TON",symbol:"TON",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tonscan",url:"https://testnet.tonscan.org"}},testnet:!0,chainNamespace:"ton",caipNetworkId:"ton:-3"});ih({id:"0x2b6653dc",name:"TRON",network:"tron-mainnet",nativeCurrency:{name:"TRX",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tronscan",url:"https://tronscan.org"}},testnet:!1,chainNamespace:"tron",caipNetworkId:"tron:0x2b6653dc"});ih({id:"0x94a9059e",name:"TRON Shasta",network:"tron-shasta",nativeCurrency:{name:"TRX",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tronscan",url:"https://shasta.tronscan.org"}},testnet:!0,chainNamespace:"tron",caipNetworkId:"tron:0x94a9059e"});ih({id:"0xcd8690dc",name:"TRON Nile",network:"tron-nile",nativeCurrency:{name:"TRX",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Tronscan",url:"https://nile.tronscan.org"}},testnet:!0,chainNamespace:"tron",caipNetworkId:"tron:0xcd8690dc"});var Rre={};const $t={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"ID_AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122"}
153,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],HTTP_STATUS_CODES:{SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof process<"u"&&typeof Rre<"u"?Rre.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org"},Kye={caipNetworkIdToNumber(e){return e?Number(e.split(":")[1]):void 0},parseEvmChainId(e){return typeof e=="string"?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace(e,t){return(e==null?void 0:e.filter(n=>n.chainNamespace===t))||[]},getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]},getNetworkNameByCaipNetworkId(e,t){var s;if(!t)return;const n=e.find(i=>i.caipNetworkId===t);if(n)return n.name;const[r]=t.split(":");return((s=$t.CHAIN_NAME_MAP)==null?void 0:s[r])||void 0}},gmt={bigNumber(e){return e?new An(e):new An(0)},multiply(e,t){if(e===void 0||t===void 0)return new An(0);const n=new An(e),r=new An(t);return n.times(r)},formatNumberToLocalString(e,t=2){return e===void 0?"0.00":typeof e=="number"?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})},parseLocalStringToNumber(e){return e===void 0?0:parseFloat(e.replace(/,/gu,""))}},mmt=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],wmt=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],ymt=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],bmt={getERC20Abi:e=>$t.USDT_CONTRACT_ADDRESSES.includes(e)?ymt:mmt,getSwapAbi:()=>wmt},Eg={validateCaipAddress(e){var t;if(((t=e.split(":"))==null?void 0:t.length)!==3)throw new Error("Invalid CAIP Address");return e},parseCaipAddress(e){const t=e.split(":");if(t.length!==3)throw new Error(`Invalid CAIP-10 address: ${e}`);const[n,r,s]=t;if(!n||!r||!s)throw new Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:n,chainId:r,address:s}},parseCaipNetworkId(e){const t=e.split(":");if(t.length!==2)throw new Error(`Invalid CAIP-2 network id: ${e}`);const[n,r]=t;if(!n||!r)throw new Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:n,chainId:r}}},Jt={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cac
153he",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections"};function WR(e){if(!e)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}const Ht={setItem(e,t){UE()&&t!==void 0&&localStorage.setItem(e,t)},getItem(e){if(UE())return localStorage.getItem(e)||void 0},removeItem(e){UE()&&localStorage.removeItem(e)},clear(){UE()&&localStorage.clear()}};function UE(){return typeof window<"u"&&typeof localStorage<"u"}function um(e,t){return t==="light"?{"--w3m-accent":(e==null?void 0:e["--w3m-accent"])||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":(e==null?void 0:e["--w3m-accent"])||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}const vmt=Symbol(),Bre=Object.getPrototypeOf,Cj=new WeakMap,Emt=e=>e&&(Cj.has(e)?Cj.get(e):Bre(e)===Object.prototype||Bre(e)===Array.prototype),Cmt=e=>Emt(e)&&e[vmt]||null,Dre=(e,t=!0)=>{Cj.set(e,t)},_A={},HR=e=>typeof e=="object"&&e!==null,Zg=new WeakMap,LE=new WeakSet,$mt=(e=Object.is,t=(l,u)=>new Proxy(l,u),n=l=>HR(l)&&!LE.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),r=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},s=new WeakMap,i=(l,u,d=r)=>{const h=s.get(l);if((h==null?void 0:h[0])===u)return h[1];const f=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return Dre(f,!0),s.set(l,[u,f]),Reflect.ownKeys(l).forEach(g=>{if(Object.getOwnPropertyDescriptor(f,g))return;const p=Reflect.get(l,g),{enumerable:m}=Reflect.getOwnPropertyDescriptor(l,g),w={value:p,enumerable:m,configurable:!0};if(LE.has(p))Dre(p,!1);else if(p instanceof Promise)delete w.value,w.get=()=>d(p);else if(Zg.has(p)){const[C,E]=Zg.get(p);w.value=i(C,E(),d)}Object.defineProperty(f,g,w)}),Object.preventExtensions(f)},o=new WeakMap,a=[1,1],c=l=>{if(!HR(l))throw new Error("object required");const u=o.get(l);if(u)return u;let d=a[0];const h=new Set,f=(I,O=++a[0])=>{d!==O&&(d=O,h.forEach(N=>N(I,O)))};let g=a[1];const p=(I=++a[1])=>(g!==I&&!h.size&&(g=I,w.forEach(([O])=>{const N=O[1](I);N>d&&(d=N)})),d),m=I=>(O,N)=>{const T=[...O];T[1]=[I,...T[1]],f(T,N)},w=new Map,C=(I,O)=>{if((_A?"production":void 0)!=="production"&&w.has(I))throw new Error("prop listener already exists");if(h.size){const N=O[3](m(I));w.set(I,[O,N])}else w.set(I,[O])},E=I=>{var O;const N=w.get(I);N&&(w.delete(I),(O=N[1])==null||O.call(N))},b=I=>(h.add(I),h.size===1&&w.forEach(([N,T],P)=>{if((_A?"production":void 0)!=="production"&&T)throw new Error("remove already exists");const _=N[3](m(P));w.set(P,[N,_])}),()=>{h.delete(I),h.size===0&&w.forEach(([N,T],P)=>{T&&(T(),w.set(P,[N]))})}),S=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),x=t(S,{deleteProperty(I,O){const N=Reflect.get(I,O);E(O);const T=Reflect.deleteProperty(I,O);return T&&f(["delete",[O],N]),T},set(I,O,N,T){const P=Reflect.has(I,O),_=Reflect.get(I,O,T);if(P&&(e(_,N)||o.has(N)&&e(_,o.get(N))))return!0;E(O),HR(N)&&(N=Cmt(N)||N);let y=N;if(N instanceof Promise)N.then($=>{N.status="fulfilled",N.value=$,f(["resolve",[O],$])}).catch($=>{N.status="rejected",N.reason=$,f(["reject",[O],$])});else{!Zg.has(N)&&n(N)&&(y=c(N));const $=!LE.has(y)&&Zg.get(y);$&&C(O,$)}return Reflect.set(I,O,y,T),f(["set",[O],N,_]),!0}});o.set(l,x);const A=[S,p,i,b];return Zg.set(x,A),Reflect.ownKeys(l).forEach(I=>{const O=Object.getOwnPropertyDescriptor(l,I);"value"in O&&(x[I]=l[I],delete O.value,delete O.writable),Object.defineProperty(S,I,O)}),x})=>[c,Zg,LE,e,t,n,r,s,i,o,a],[xmt]=$mt();function Pr(e={}){return xmt(e)}function Yi(e,t,n){const r=Zg.get(e);(_A?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let s;const i=[],o=r[3];let a=!1;const l=o(u=>
153{i.push(u),s||(s=Promise.resolve().then(()=>{s=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,l()}}function h4(e,t){const n=Zg.get(e);(_A?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");const[r,s,i]=n;return i(r,s(),t)}function oy(e){return LE.add(e),e}function so(e,t,n,r){let s=e[t];return Yi(e,()=>{const i=e[t];Object.is(s,i)||n(s=i)})}function Imt(e){const t=Pr({data:Array.from([]),has(n){return this.data.some(r=>r[0]===n)},set(n,r){const s=this.data.find(i=>i[0]===n);return s?s[1]=r:this.data.push([n,r]),this},get(n){var r;return(r=this.data.find(s=>s[0]===n))==null?void 0:r[1]},delete(n){const r=this.data.findIndex(s=>s[0]===n);return r===-1?!1:(this.data.splice(r,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(n){this.data.forEach(r=>{n(r[1],r[0],this)})},keys(){return this.data.map(n=>n[0]).values()},values(){return this.data.map(n=>n[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}const Gye=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["eip155"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],Smt="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",dr={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,BALANCE_SUPPORTED_CHAINS:["eip155","solana"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in the wallet app"},SEND_SUPPORTED_NAMESPACES:["eip155","solana"],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["coinbase","meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1},DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal"}},lt={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired(e,t){return Date.now()-e>t},getActiveNetworkProps(){const e=lt.getActiveNamespace(),t=lt.getActiveCaipNetworkId(),n=t?t.split(":")[1]:void 0,r=n?isNaN(Number(n))?n:Number(n):void 0;return{namespace:e,caipNetworkId:t,chainId:r}},setWalletConnectDeepLink({name:e,href:t}){try{Ht.setItem(Jt.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const e=Ht.getItem(Jt.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{Ht.removeItem(Jt.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{Ht.setItem(Jt.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{Ht.setItem(Jt.ACTIVE_CAIP_NETWORK_ID,e),lt.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return Ht.getItem(Jt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{Ht.removeItem(Jt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{const t=WR(e);Ht.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{const t=lt.getRecentWallets();t.find(r=>r.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),Ht.setItem(Jt.RECENT_WALLETS,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const e=Ht.getItem(Jt.RECENT_WALLETS);return e?JSON.parse(e):[]}
vendor: 4,260 bytes, line 153
153catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(e,t){try{const n=WR(e);Ht.setItem(n,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return Ht.getItem(Jt.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{const t=WR(e);return Ht.getItem(t)}catch{console.info("Unable to get connected connector id in namespace ",e)}},setConnectedSocialProvider(e){try{Ht.setItem(Jt.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return Ht.getItem(Jt.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{Ht.removeItem(Jt.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return Ht.getItem(Jt.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var n;const e=Ht.getItem(Jt.ACTIVE_CAIP_NETWORK_ID);return(n=e==null?void 0:e.split(":"))==null?void 0:n[1]},setConnectionStatus(e){try{Ht.setItem(Jt.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return Ht.getItem(Jt.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const e=Ht.getItem(Jt.CONNECTED_NAMESPACES);return e!=null&&e.length?e.split(","):[]}catch{return[]}},setConnectedNamespaces(e){try{const t=Array.from(new Set(e));Ht.setItem(Jt.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{const t=lt.getConnectedNamespaces();t.includes(e)||(t.push(e),lt.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{const t=lt.getConnectedNamespaces(),n=t.indexOf(e);n>-1&&(t.splice(n,1),lt.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return Ht.getItem(Jt.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{Ht.setItem(Jt.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{Ht.removeItem(Jt.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{const t=Ht.getItem(Jt.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{const t=lt.getBalanceCache();Ht.setItem(Jt.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{const n=lt.getBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.portfolio))return n.balance;lt.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{const t=lt.getBalanceCache();t[e.caipAddress]=e,Ht.setItem(Jt.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{const t=Ht.getItem(Jt.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{const t=lt.getBalanceCache();Ht.setItem(Jt.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{const n=lt.getNativeBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.nativeBalance))return n;console.info("Discarding cache for address",e),lt.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{const t=lt.getNativeBalanceCache();t[e.caipAddress]=e,Ht.setItem(Jt.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{const t=Ht.getItem(Jt.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e}
153,getEnsFromCacheForAddress(e){try{const n=lt.getEnsCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.ens))return n.ens;lt.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{const t=lt.getEnsCache();t[e.address]=e,Ht.setItem(Jt.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{const t=lt.getEnsCache();Ht.setItem(Jt.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{const t=Ht.getItem(Jt.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{const n=lt.getIdentityCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.identity))return n.identity;lt.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{const t=lt.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},Ht.setItem(Jt.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{const t=lt.getIdentityCache();Ht.setItem(Jt.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},clearAddressCache(){try{Ht.removeItem(Jt.PORTFOLIO_CACHE),Ht.removeItem(Jt.NATIVE_BALANCE_CACHE),Ht.removeItem(Jt.ENS_CACHE),Ht.removeItem(Jt.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(e){try{Ht.setItem(Jt.PREFERRED_ACCOUNT_TYPES,JSON.stringify(e))}catch{console.info("Unable to set preferred account types",e)}},getPreferredAccountTypes(){try{const e=Ht.getItem(Jt.PREFERRED_ACCOUNT_TYPES);return e?JSON.parse(e):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(e,t){try{const n={...lt.getConnections(),[t]:e};Ht.setItem(Jt.CONNECTIONS,JSON.stringify(n))}catch(n){console.error("Unable to sync connections to storage",n)}},getConnections(){try{const e=Ht.getItem(Jt.CONNECTIONS);return e?JSON.parse(e):{}}catch(e){return console.error("Unable to get connections from storage",e),{}}}},Re={isMobile(){var e;return this.isClient()?!!(typeof(window==null?void 0:window.matchMedia)=="function"&&((e=window==null?void 0:window.matchMedia("(pointer:coarse)"))!=null&&e.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(e,t=""){return e==null?void 0:e.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return Re.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(e){return e?e-Date.now()<=dr.TEN_SEC_MS:!0},isAllowedRetry(e,t=dr.ONE_SEC_MS){return Date.now()-e>=t},copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var e,t;
153if(Re.isClient()&&window.self!==window.top)try{const n=(t=(e=window==null?void 0:window.location)==null?void 0:e.ancestorOrigins)==null?void 0:t[0],r="https://app.safe.global";if(n){const s=new URL(n),i=new URL(r);return s.hostname===i.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+dr.FOUR_MINUTES_MS},getNetworkId(e){return e==null?void 0:e.split(":")[1]},getPlainAddress(e){return e==null?void 0:e.split(":")[2]},async wait(e){return new Promise(t=>{setTimeout(t,e)})},debounce(e,t=500){let n;return(...r)=>{function s(){e(...r)}n&&clearTimeout(n),n=setTimeout(s,t)}},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},formatNativeUrl(e,t,n=null){if(Re.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e,s=n;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),s&&!(s!=null&&s.endsWith("/"))&&(s=`${s}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));const i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,redirectUniversalLink:s?`${s}wc?uri=${i}`:void 0,href:r}},formatUniversalUrl(e,t){if(!Re.isHttpUrl(e))return this.formatNativeUrl(e,t);let n=e;n.endsWith("/")||(n=`${n}/`);const r=encodeURIComponent(t);return{redirect:`${n}wc?uri=${r}`,href:n}},getOpenTargetForPlatform(e){return e==="popupWindow"?e:this.isTelegram()?lt.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,n){window==null||window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},returnOpenHref(e,t,n){return window==null?void 0:window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var n,r,s;if(typeof window>"u")return!1;const e=(r=(n=window.matchMedia)==null?void 0:n.call(window,"(display-mode: standalone)"))==null?void 0:r.matches,t=(s=window==null?void 0:window.navigator)==null?void 0:s.standalone;return!!(e||t)},async preloadImage(e){const t=new Promise((n,r)=>{const s=new Image;s.onload=n,s.onerror=r,s.crossOrigin="anonymous",s.src=e});return Promise.race([t,Re.wait(2e3)])},formatBalance(e,t){let n="0.000";if(typeof e=="string"){const r=Number(e);if(r){const s=Math.floor(r*1e3)/1e3;s&&(n=s.toString())}}return`${n}${t?` ${t}`:""}`},formatBalance2(e,t){var r;let n;if(e==="0")n="0";else if(typeof e=="string"){const s=Number(e);s&&(n=(r=s.toString().match(/^-?\d+(?:\.\d{0,3})?/u))==null?void 0:r[0])}return{value:n??"0",rest:n==="0"?"000":"",symbol:t}},getApiUrl(){return $t.W3M_API_URL},getBlockchainApiUrl(){return $t.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return $t.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},parseError(e){var t,n;return typeof e=="string"?e:typeof((n=(t=e==null?void 0:e.issues)==null?void 0:t[0])==null?void 0:n.message)=="string"?e.issues[0].message:e instanceof Error?e.message:"Unknown error"},sortRequestedNetworks(e,t=[]){const n={};return t&&e&&(e.forEach((r,s)=>{n[r]=s}),t.sort((r,s)=>{const i=n[r.id],o=n[s.id];return i!==void 0&&o!==void 0?i-o:i!==void 0?-1:o!==void 0?1:0})),t},calculateBalance(e){let t=0;for(const n of e)t+=n.value??0;return t},formatTokenBalance(e){const t=e.toFixed(2),[n,r]=t.split(".");return{dollars:n,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);default:return!1}},uniqueBy(e,t){const n=new Set;return e.filter(r=>{const s=r[t];return n.has(s)?!1:(n.add(s),!0)})},generateSdkVersion(e,t,n){const s=e.length===0?dr.ADAPTER_TYPES.UNIVERSAL:e.map(i=>i.adapterType).join(",");return`${t}-${s}-${n}`},createAccount(e,t,n,r,s){return{namespace:e,address:t,type:n,publicKey:r,path:s}},isCaipAddress(e){if(typeof e!="string")return!1;const t=e.split(":"),n=t[0];return t.filter(Boolean).length===3&&n in $t.CHAIN_NAME_MAP},isMac(){const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){const t=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,n="state=";if(new URL(e).host==="auth.magic.link"){const s="provider_authorization_url=",i=e.substring(e.indexOf(s)+s.length),o=this.injectIntoUrl(decodeURIComponent(i),n,t);return e.replace(i,encodeURIComponent(o))}return this.injectIntoUrl(e,n,t)},injectIntoUrl(e,t,n){const r=e.indexOf(t);if(r===-1)throw new Error(`${t} parameter not found in the URL: ${e}`);const s=e.indexOf("&",r),i=t.length,o=s!==-1?s:e.length,a=e.substring(0,r+i),c=e.substring(r+i,o),l=e.substring(s),u=c+n;return a+u+l}};async function nE(...e){const t=await fetch(...e);if(!t.ok)throw new Error(`HTTP status code: ${t.status}`,{cause:t});return t}let l$=class{constructor({baseUrl:t,clientId:n}
153){this.baseUrl=t,this.clientId=n}async get({headers:t,signal:n,cache:r,...s}){const i=this.createUrl(s);return(await nE(i,{method:"GET",headers:t,signal:n,cache:r})).json()}async getBlob({headers:t,signal:n,...r}){const s=this.createUrl(r);return(await nE(s,{method:"GET",headers:t,signal:n})).blob()}async post({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await nE(i,{method:"POST",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async put({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await nE(i,{method:"PUT",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async delete({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await nE(i,{method:"DELETE",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}createUrl({path:t,params:n}){const r=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,i])=>{i&&r.searchParams.append(s,i)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}};const Amt={getFeatureValue(e,t){const n=t==null?void 0:t[e];return n===void 0?dr.DEFAULT_FEATURES[e]:n},filterSocialsByPlatform(e){if(!e||!e.length)return e;if(Re.isTelegram()){if(Re.isIos())return e.filter(t=>t!=="google");if(Re.isMac())return e.filter(t=>t!=="x");if(Re.isAndroid())return e.filter(t=>!["facebook","x"].includes(t))}return e}},Nt=Pr({features:dr.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:dr.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{}}),we={state:Nt,subscribeKey(e,t){return so(Nt,e,t)},setOptions(e){Object.assign(Nt,e)},setRemoteFeatures(e){var n;if(!e)return;const t={...Nt.remoteFeatures,...e};Nt.remoteFeatures=t,(n=Nt.remoteFeatures)!=null&&n.socials&&(Nt.remoteFeatures.socials=Amt.filterSocialsByPlatform(Nt.remoteFeatures.socials))},setFeatures(e){if(!e)return;Nt.features||(Nt.features=dr.DEFAULT_FEATURES);const t={...Nt.features,...e};Nt.features=t},setProjectId(e){Nt.projectId=e},setCustomRpcUrls(e){Nt.customRpcUrls=e},setAllWallets(e){Nt.allWallets=e},setIncludeWalletIds(e){Nt.includeWalletIds=e},setExcludeWalletIds(e){Nt.excludeWalletIds=e},setFeaturedWalletIds(e){Nt.featuredWalletIds=e},setTokens(e){Nt.tokens=e},setTermsConditionsUrl(e){Nt.termsConditionsUrl=e},setPrivacyPolicyUrl(e){Nt.privacyPolicyUrl=e},setCustomWallets(e){Nt.customWallets=e},setIsSiweEnabled(e){Nt.isSiweEnabled=e},setIsUniversalProvider(e){Nt.isUniversalProvider=e},setSdkVersion(e){Nt.sdkVersion=e},setMetadata(e){Nt.metadata=e},setDisableAppend(e){Nt.disableAppend=e},setEIP6963Enabled(e){Nt.enableEIP6963=e},setDebug(e){Nt.debug=e},setEnableWalletConnect(e){Nt.enableWalletConnect=e},setEnableWalletGuide(e){Nt.enableWalletGuide=e},setEnableAuthLogger(e){Nt.enableAuthLogger=e},setEnableWallets(e){Nt.enableWallets=e},setPreferUniversalLinks(e){Nt.experimental_preferUniversalLinks=e},setHasMultipleAddresses(e){Nt.hasMultipleAddresses=e},setSIWX(e){Nt.siwx=e},setConnectMethodsOrder(e){Nt.features={...Nt.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){Nt.features={...Nt.features,walletFeaturesOrder:e}},setSocialsOrder(e){Nt.remoteFeatures={...Nt.remoteFeatures,socials:e}},setCollapseWallets(e){Nt.features={...Nt.features,collapseWallets:e}},setEnableEmbedded(e){Nt.enableEmbedded=e},setAllowUnsupportedChain(e){Nt.allowUnsupportedChain=e},setManualWCControl(e){Nt.manualWCControl=e},setEnableNetworkSwitch(e){Nt.enableNetworkSwitch=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([t,n])=>{n&&(Nt.defaultAccountTypes[t]=n)})},setUniversalProviderConfigOverride(e){Nt.universalProviderConfigOverride=e},getUniversalProviderConfigOverride(){return Nt.universalProviderConfigOverride},getSnapshot(){return h4(Nt)}},_mt=Object.freeze({enabled:!0,events:[]}),Nmt=new l$({baseUrl:Re.getAnalyticsUrl(),clientId:null}),Tmt=5,Pmt=60*1e3,Cg=Pr({..._mt}),Omt={state:Cg,subscribeKey(e,t){return so(Cg,e,t)},async sendError(e,t){if(!Cg.enabled)return;const n=Date.now();if(Cg.events.filter(i=>{const o=new Date(i.properties.timestamp||"").getTime();return n-o<Pmt}).length>=Tmt)return;const s={type:"error",event:t,properties:{errorType:e.name,errorMessage:e.message,stackTrace:e.stack,timestamp:new Date().toISOString()}};Cg.events.push(s);try{if(typeof window>"u")return;const{projectId:i,sdkType:o,sdkVersion:a}=we.state;await Nmt.post({path:"/e",params:{projectId:i,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:Re.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:t,errorType:e.name,errorMessage:e.message,stackTrace:e.stack}}})}catch{}},enable(){Cg.enabled=!0},disable(){Cg.enabled=!1},clearEvents(){Cg.events=[]}};
153let $j=class xj extends Error{constructor(t,n,r){super(t),this.name="AppKitError",this.category=n,this.originalError=r,Object.setPrototypeOf(this,xj.prototype);let s=!1;if(r instanceof Error&&typeof r.stack=="string"&&r.stack){const i=r.stack,o=i.indexOf(` 154`);if(o>-1){const a=i.substring(o+1);this.stack=`${this.name}: ${this.message} 155${a}`,s=!0}}s||(Error.captureStackTrace?Error.captureStackTrace(this,xj):this.stack||(this.stack=`${this.name}: ${this.message}`))}};function Ure(e,t){const n=e instanceof $j?e:new $j(e instanceof Error?e.message:String(e),t,e);throw Omt.sendError(n,n.category),n}function xc(e,t="INTERNAL_SDK_ERROR"){const n={};return Object.keys(e).forEach(r=>{const s=e[r];if(typeof s=="function"){let i=s;s.constructor.name==="AsyncFunction"?i=async(...o)=>{try{return await s(...o)}catch(a){return Ure(a,t)}}:i=(...o)=>{try{return s(...o)}catch(a){return Ure(a,t)}},n[r]=i}else n[r]=s}),n}const Bh={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com"}},kmt={handleMobileDeeplinkRedirect(e,t){const n=window.location.href,r=encodeURIComponent(n);if(e===Bh.PHANTOM.id&&!("phantom"in window)){const s=n.startsWith("https")?"https":"http",i=n.split("/")[2],o=encodeURIComponent(`${s}://${i}`);window.location.href=`${Bh.PHANTOM.url}/ul/browse/${r}?ref=${o}`}e===Bh.SOLFLARE.id&&!("solflare"in window)&&(window.location.href=`${Bh.SOLFLARE.url}/ul/v1/browse/${r}?ref=${r}`),t===$t.CHAIN.SOLANA&&e===Bh.COINBASE.id&&!("coinbaseSolana"in window)&&(window.location.href=`${Bh.COINBASE.url}/dapp?cb_url=${r}`)}},Mc=Pr({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),Rmt={state:Mc,subscribeNetworkImages(e){return Yi(Mc.networkImages,()=>e(Mc.networkImages))},subscribeKey(e,t){return so(Mc,e,t)},subscribe(e){return Yi(Mc,()=>e(Mc))},setWalletImage(e,t){Mc.walletImages[e]=t},setNetworkImage(e,t){Mc.networkImages[e]=t},setChainImage(e,t){Mc.chainImages[e]=t},setConnectorImage(e,t){Mc.connectorImages={...Mc.connectorImages,[e]:t}},setTokenImage(e,t){Mc.tokenImages[e]=t},setCurrencyImage(e,t){Mc.currencyImages[e]=t}},oc=xc(Rmt),Bmt={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:""},VR=Pr({networkImagePromises:{}}),ti={async fetchWalletImage(e){if(e)return await ze._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(!e)return;const t=this.getNetworkImageById(e);return t||(VR.networkImagePromises[e]||(VR.networkImagePromises[e]=ze._fetchNetworkImage(e)),await VR.networkImagePromises[e],this.getNetworkImageById(e))},getWalletImageById(e){if(e)return oc.state.walletImages[e]},getWalletImage(e){if(e!=null&&e.image_url)return e==null?void 0:e.image_url;if(e!=null&&e.image_id)return oc.state.walletImages[e.image_id]},getNetworkImage(e){var t,n,r;if((t=e==null?void 0:e.assets)!=null&&t.imageUrl)return(n=e==null?void 0:e.assets)==null?void 0:n.imageUrl;if((r=e==null?void 0:e.assets)!=null&&r.imageId)return oc.state.networkImages[e.assets.imageId]},getNetworkImageById(e){if(e)return oc.state.networkImages[e]},getConnectorImage(e){if(e!=null&&e.imageUrl)return e.imageUrl;if(e!=null&&e.imageId)return oc.state.connectorImages[e.imageId]},getChainImage(e){return oc.state.networkImages[Bmt[e]]}},$g=Pr({message:"",variant:"info",open:!1}),Dmt={state:$g,subscribeKey(e,t){return so($g,e,t)},open(e,t){const{debug:n}=we.state,{shortMessage:r,longMessage:s}=e;n&&($g.message=r,$g.variant=t,$g.open=!0),s&&console.error(typeof s=="function"?s():s)},close(){$g.open=!1,$g.message="",$g.variant="info"}},vd=xc(Dmt),Umt=Re.getAnalyticsUrl(),Lmt=new l$({baseUrl:Umt,clientId:null}),Mmt=["MODAL_CREATED"],Vf=Pr({timestamp:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"}}),bn={state:Vf,subscribe(e){return Yi(Vf,()=>e(Vf))},getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=we.state;return{projectId:e,st:t,sv:n||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(e){try{const t=Et.state.address;if(Mmt.includes(e.data.event)||typeof window>"u")return;await Lmt.post({path:"/e",params:bn.getSdkProperties(),body:{eventId:Re.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:t}}}),Vf.reportedErrors.FORBIDDEN=!1}
155catch(t){t instanceof Error&&t.cause instanceof Response&&t.cause.status===$t.HTTP_STATUS_CODES.FORBIDDEN&&!Vf.reportedErrors.FORBIDDEN&&(vd.open({shortMessage:"Invalid App Configuration",longMessage:`Origin ${UE()?window.origin:"uknown"} not found on Allowlist - update configuration on cloud.reown.com`},"error"),Vf.reportedErrors.FORBIDDEN=!0)}},sendEvent(e){var t;Vf.timestamp=Date.now(),Vf.data=e,(t=we.state.features)!=null&&t.analytics&&bn._sendAnalyticsEvent(Vf)}},jmt=Re.getApiUrl(),Na=new l$({baseUrl:jmt,clientId:null}),Fmt=40,Lre=4,zmt=20,Xt=Pr({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1}),ze={state:Xt,subscribeKey(e,t){return so(Xt,e,t)},_getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=we.state;return{projectId:e,st:t||"appkit",sv:n||"html-wagmi-4.2.2"}},_filterOutExtensions(e){return we.state.isUniversalProvider?e.filter(t=>!!(t.mobile_link||t.desktop_link||t.webapp_link)):e},async _fetchWalletImage(e){const t=`${Na.baseUrl}/getWalletImage/${e}`,n=await Na.getBlob({path:t,params:ze._getSdkProperties()});oc.setWalletImage(e,URL.createObjectURL(n))},async _fetchNetworkImage(e){const t=`${Na.baseUrl}/public/getAssetImage/${e}`,n=await Na.getBlob({path:t,params:ze._getSdkProperties()});oc.setNetworkImage(e,URL.createObjectURL(n))},async _fetchConnectorImage(e){const t=`${Na.baseUrl}/public/getAssetImage/${e}`,n=await Na.getBlob({path:t,params:ze._getSdkProperties()});oc.setConnectorImage(e,URL.createObjectURL(n))},async _fetchCurrencyImage(e){const t=`${Na.baseUrl}/public/getCurrencyImage/${e}`,n=await Na.getBlob({path:t,params:ze._getSdkProperties()});oc.setCurrencyImage(e,URL.createObjectURL(n))},async _fetchTokenImage(e){const t=`${Na.baseUrl}/public/getTokenImage/${e}`,n=await Na.getBlob({path:t,params:ze._getSdkProperties()});oc.setTokenImage(e,URL.createObjectURL(n))},_filterWalletsByPlatform(e){return Re.isMobile()?e==null?void 0:e.filter(n=>n.mobile_link||n.id===Bh.COINBASE.id?!0:J.state.activeChain==="solana"&&(n.id===Bh.SOLFLARE.id||n.id===Bh.PHANTOM.id)):e},async fetchProjectConfig(){return(await Na.get({path:"/appkit/v1/config",params:ze._getSdkProperties()})).features},async fetchAllowedOrigins(){try{const{allowedOrigins:e}=await Na.get({path:"/projects/v1/origins",params:ze._getSdkProperties()});return e}catch{return[]}},async fetchNetworkImages(){const e=J.getAllRequestedCaipNetworks(),t=e==null?void 0:e.map(({assets:n})=>n==null?void 0:n.imageId).filter(Boolean).filter(n=>!ti.getNetworkImageById(n));t&&await Promise.allSettled(t.map(n=>ze._fetchNetworkImage(n)))},async fetchConnectorImages(){const{connectors:e}=Pe.state,t=e.map(({imageId:n})=>n).filter(Boolean);await Promise.allSettled(t.map(n=>ze._fetchConnectorImage(n)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(t=>ze._fetchCurrencyImage(t)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(t=>ze._fetchTokenImage(t)))},async fetchWallets(e){var i;const t=e.exclude??[];ze._getSdkProperties().sv.startsWith("html-core-")&&t.push(...Object.values(Bh).map(o=>o.id));const r=await Na.get({path:"/getWallets",params:{...ze._getSdkProperties(),...e,page:String(e.page),entries:String(e.entries),include:(i=e.include)==null?void 0:i.join(","),exclude:t.join(",")}});return{data:ze._filterWalletsByPlatform(r==null?void 0:r.data)||[],count:r==null?void 0:r.count}},async fetchFeaturedWallets(){const{featuredWalletIds:e}=we.state;if(e!=null&&e.length){const t={...ze._getSdkProperties(),page:1,entries:(e==null?void 0:e.length)??Lre,include:e},{data:n}=await ze.fetchWallets(t),r=[...n].sort((i,o)=>e.indexOf(i.id)-e.indexOf(o.id)),s=r.map(i=>i.image_id).filter(Boolean);await Promise.allSettled(s.map(i=>ze._fetchWalletImage(i))),Xt.featured=r,Xt.allFeatured=r}},async fetchRecommendedWallets(){try{Xt.isFetchingRecommendedWallets=!0;const{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:n}=we.state,r=[...t??[],...n??[]].filter(Boolean),s=J.getRequestedCaipNetworkIds().join(","),i={page:1,entries:Lre,include:e,exclude:r,chains:s},{data:o,count:a}=await ze.fetchWallets(i),c=lt.getRecentWallets(),l=o.map(d=>
155d.image_id).filter(Boolean),u=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...l,...u].map(d=>ze._fetchWalletImage(d))),Xt.recommended=o,Xt.allRecommended=o,Xt.count=a??0}catch{}finally{Xt.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:e}){const{includeWalletIds:t,excludeWalletIds:n,featuredWalletIds:r}=we.state,s=J.getRequestedCaipNetworkIds().join(","),i=[...Xt.recommended.map(({id:u})=>u),...n??[],...r??[]].filter(Boolean),o={page:e,entries:Fmt,include:t,exclude:i,chains:s},{data:a,count:c}=await ze.fetchWallets(o),l=a.slice(0,zmt).map(u=>u.image_id).filter(Boolean);await Promise.allSettled(l.map(u=>ze._fetchWalletImage(u))),Xt.wallets=Re.uniqueBy([...Xt.wallets,...ze._filterOutExtensions(a)],"id").filter(u=>{var d;return(d=u.chains)==null?void 0:d.some(h=>s.includes(h))}),Xt.count=c>Xt.count?c:Xt.count,Xt.page=e},async initializeExcludedWallets({ids:e}){const t={page:1,entries:e.length,include:e},{data:n}=await ze.fetchWallets(t);n&&n.forEach(r=>{Xt.excludedWallets.push({rdns:r.rdns,name:r.name})})},async searchWallet({search:e,badge:t}){const{includeWalletIds:n,excludeWalletIds:r}=we.state,s=J.getRequestedCaipNetworkIds().join(",");Xt.search=[];const i={page:1,entries:100,search:e==null?void 0:e.trim(),badge_type:t,include:n,exclude:r,chains:s},{data:o}=await ze.fetchWallets(i);bn.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});const a=o.map(c=>c.image_id).filter(Boolean);await Promise.allSettled([...a.map(c=>ze._fetchWalletImage(c)),Re.wait(300)]),Xt.search=ze._filterOutExtensions(o)},initPromise(e,t){const n=Xt.promises[e];return n||(Xt.promises[e]=t())},prefetch({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:n=!0,fetchNetworkImages:r=!0}={}){const s=[e&&ze.initPromise("connectorImages",ze.fetchConnectorImages),t&&ze.initPromise("featuredWallets",ze.fetchFeaturedWallets),n&&ze.initPromise("recommendedWallets",ze.fetchRecommendedWallets),r&&ze.initPromise("networkImages",ze.fetchNetworkImages)].filter(Boolean);return Promise.allSettled(s)},prefetchAnalyticsConfig(){var e;(e=we.state.features)!=null&&e.analytics&&ze.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:e}=await Na.get({path:"/getAnalyticsConfig",params:ze._getSdkProperties()});we.setFeatures({analytics:e})}catch{we.setFeatures({analytics:!1})}},filterByNamespaces(e){if(!(e!=null&&e.length)){Xt.featured=Xt.allFeatured,Xt.recommended=Xt.allRecommended;return}const t=J.getRequestedCaipNetworkIds().join(",");Xt.featured=Xt.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Xt.recommended=Xt.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Xt.filteredWallets=Xt.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})},clearFilterByNamespaces(){Xt.filteredWallets=[]},setFilterByNamespace(e){if(!e){Xt.featured=Xt.allFeatured,Xt.recommended=Xt.allRecommended;return}const t=J.getRequestedCaipNetworkIds().join(",");Xt.featured=Xt.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Xt.recommended=Xt.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),Xt.filteredWallets=Xt.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})}},fr=Pr({view:"Connect",history:["Connect"],transactionStack:[]}),qmt={state:fr,subscribeKey(e,t){return so(fr,e,t)},pushTransactionStack(e){fr.transactionStack.push(e)},popTransactionStack(e){const t=fr.transactionStack.pop();if(!t)return;const{onSuccess:n,onError:r,onCancel:s}=t;switch(e){case"success":n==null||n();break;case"error":r==null||r(),Le.goBack();break;case"cancel":s==null||s(),Le.goBack();break}},push(e,t){e!==fr.view&&(fr.view=e,fr.history.push(e),fr.data=t)},reset(e,t){fr.view=e,fr.history=[e],fr.data=t},replace(e,t){fr.history.at(-1)===e||(fr.view=e,fr.history[fr.history.length-1]=e,fr.data=t)},goBack(){var r;const e=J.state.activeCaipAddress,t=Le.state.view==="ConnectingFarcaster",n=!e&&t;if(fr.history.length>1){fr.history.pop();const[s]=fr.history.slice(-1);s&&(e&&s==="Connect"?fr.view="Account":fr.view=s)}else ir.close();(r=fr.data)!=null&&r.wallet&&(fr.data.wallet=void 0),setTimeout(()=>{var s,i,o;if(n){Et.setFarcasterUrl(void 0,J.state.activeChain);const a=Pe.getAuthConnector();(s=a==null?void 0:a.provider)==null||s.reload();const c=h4(we.state);(o=(i=a==null?void 0:a.provider)==null?void 0:i.syncDappData)==null||o.call(i,{metadata:c.metadata,sdkVersion:c.sdkVersion,projectId:c.projectId,sdkType:c.sdkType})}},100)},goBackToIndex(e){if(fr.history.length>1){fr.history=fr.history.slice(0,e+1);const[t]=fr.history.slice(-1);t&&(fr.view=t)}},goBackOrCloseModal(){Le.state.history.length>1?Le.goBack():ir.close()}},Le=xc(qmt),Kf=Pr({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),Ij={state:Kf,subscribe(e){return Yi(Kf,()=>e(Kf))},setThemeMode(e){Kf.themeMode=e;try{const t=Pe.getAuthConnector();if(t){const n=Ij.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:n,w3mThemeVariables:um(n,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){Kf.themeVariables={...Kf.themeVariables,...e};try{const t=Pe.getAuthConnector();if(t){const n=Ij.getSnapshot().themeVariables;t.provider.syncTheme({themeVariables:n,w3mThemeVariables:um(Kf.themeVariables,Kf.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}}
155,getSnapshot(){return h4(Kf)}},Vi=xc(Ij),Zye={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0},Wn=Pr({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:{...Zye},filterByNamespaceMap:{eip155:!0,solana:!0,polkadot:!0,bip122:!0,cosmos:!0}}),Wmt={state:Wn,subscribe(e){return Yi(Wn,()=>{e(Wn)})},subscribeKey(e,t){return so(Wn,e,t)},initialize(e){e.forEach(t=>{const n=lt.getConnectedConnectorId(t);n&&Pe.setConnectorId(n,t)})},setActiveConnector(e){e&&(Wn.activeConnector=oy(e))},setConnectors(e){e.filter(s=>!Wn.allConnectors.some(i=>i.id===s.id&&Pe.getConnectorName(i.name)===Pe.getConnectorName(s.name)&&i.chain===s.chain)).forEach(s=>{s.type!=="MULTI_CHAIN"&&Wn.allConnectors.push(oy(s))});const n=Pe.getEnabledNamespaces(),r=Pe.getEnabledConnectors(n);Wn.connectors=Pe.mergeMultiChainConnectors(r)},filterByNamespaces(e){Object.keys(Wn.filterByNamespaceMap).forEach(t=>{Wn.filterByNamespaceMap[t]=!1}),e.forEach(t=>{Wn.filterByNamespaceMap[t]=!0}),Pe.updateConnectorsForEnabledNamespaces()},filterByNamespace(e,t){Wn.filterByNamespaceMap[e]=t,Pe.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const e=Pe.getEnabledNamespaces(),t=Pe.getEnabledConnectors(e),n=Pe.areAllNamespacesEnabled();Wn.connectors=Pe.mergeMultiChainConnectors(t),n?ze.clearFilterByNamespaces():ze.filterByNamespaces(e)},getEnabledNamespaces(){return Object.entries(Wn.filterByNamespaceMap).filter(([e,t])=>t).map(([e])=>e)},getEnabledConnectors(e){return Wn.allConnectors.filter(t=>e.includes(t.chain))},areAllNamespacesEnabled(){return Object.values(Wn.filterByNamespaceMap).every(e=>e)},mergeMultiChainConnectors(e){const t=Pe.generateConnectorMapByName(e),n=[];return t.forEach(r=>{const s=r[0],i=(s==null?void 0:s.id)===$t.CONNECTOR_ID.AUTH;r.length>1&&s?n.push({name:s.name,imageUrl:s.imageUrl,imageId:s.imageId,connectors:[...r],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(s==null?void 0:s.id)||""}):s&&n.push(s)}),n},generateConnectorMapByName(e){const t=new Map;return e.forEach(n=>{const{name:r}=n,s=Pe.getConnectorName(r);if(!s)return;const i=t.get(s)||[];i.find(a=>a.chain===n.chain)||i.push(n),t.set(s,i)}),t},getConnectorName(e){return e&&({"Trust Wallet":"Trust"}[e]||e)},getUniqueConnectorsByName(e){const t=[];return e.forEach(n=>{t.find(r=>r.chain===n.chain)||t.push(n)}),t},addConnector(e){var t,n,r;if(e.id===$t.CONNECTOR_ID.AUTH){const s=e,i=h4(we.state),o=Vi.getSnapshot().themeMode,a=Vi.getSnapshot().themeVariables;(n=(t=s==null?void 0:s.provider)==null?void 0:t.syncDappData)==null||n.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),(r=s==null?void 0:s.provider)==null||r.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:um(a,o)}),Pe.setConnectors([e])}else Pe.setConnectors([e])},getAuthConnector(e){var r;const t=e||J.state.activeChain,n=Wn.connectors.find(s=>s.id===$t.CONNECTOR_ID.AUTH);if(n)return(r=n==null?void 0:n.connectors)!=null&&r.length?n.connectors.find(i=>i.chain===t):n},getAnnouncedConnectorRdns(){return Wn.connectors.filter(e=>e.type==="ANNOUNCED").map(e=>{var t;return(t=e.info)==null?void 0:t.rdns})},getConnectorById(e){return Wn.allConnectors.find(t=>t.id===e)},getConnector(e,t){return Wn.allConnectors.filter(r=>r.chain===J.state.activeChain).find(r=>{var s;return r.explorerId===e||((s=r.info)==null?void 0:s.rdns)===t})},syncIfAuthConnector(e){var i,o;if(e.id!=="ID_AUTH")return;
155const t=e,n=h4(we.state),r=Vi.getSnapshot().themeMode,s=Vi.getSnapshot().themeVariables;(o=(i=t==null?void 0:t.provider)==null?void 0:i.syncDappData)==null||o.call(i,{metadata:n.metadata,sdkVersion:n.sdkVersion,sdkType:n.sdkType,projectId:n.projectId}),t.provider.syncTheme({themeMode:r,themeVariables:s,w3mThemeVariables:um(s,r)})},getConnectorsByNamespace(e){const t=Wn.allConnectors.filter(n=>n.chain===e);return Pe.mergeMultiChainConnectors(t)},selectWalletConnector(e){const t=Pe.getConnector(e.id,e.rdns),n=J.state.activeChain;kmt.handleMobileDeeplinkRedirect((t==null?void 0:t.explorerId)||e.id,n),t?Le.push("ConnectingExternal",{connector:t}):Le.push("ConnectingWalletConnect",{wallet:e})},getConnectors(e){return e?Pe.getConnectorsByNamespace(e):Pe.mergeMultiChainConnectors(Wn.allConnectors)},setFilterByNamespace(e){Wn.filterByNamespace=e,Wn.connectors=Pe.getConnectors(e),ze.setFilterByNamespace(e)},setConnectorId(e,t){e&&(Wn.activeConnectorIds={...Wn.activeConnectorIds,[t]:e},lt.setConnectedConnectorId(t,e))},removeConnectorId(e){Wn.activeConnectorIds={...Wn.activeConnectorIds,[e]:void 0},lt.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return Wn.activeConnectorIds[e]},isConnected(e){return e?!!Wn.activeConnectorIds[e]:Object.values(Wn.activeConnectorIds).some(t=>!!t)},resetConnectorIds(){Wn.activeConnectorIds={...Zye}}},Pe=xc(Wmt),m8={ACCOUNT_TYPES:{SMART_ACCOUNT:"smartAccount"}},V1=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),Ws=Pr({...V1}),Hmt={state:Ws,subscribeKey(e,t){return so(Ws,e,t)},showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){const t=Re.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){Ws.message=V1.message,Ws.variant=V1.variant,Ws.svg=V1.svg,Ws.open=V1.open,Ws.autoClose=V1.autoClose},_showMessage({message:e,svg:t,variant:n="success",autoClose:r=V1.autoClose}){Ws.open?(Ws.open=!1,setTimeout(()=>{Ws.message=e,Ws.variant=n,Ws.svg=t,Ws.open=!0,Ws.autoClose=r},150)):(Ws.message=e,Ws.variant=n,Ws.svg=t,Ws.open=!0,Ws.autoClose=r)}},vs=Hmt,Nr=Pr({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),Vmt={state:Nr,subscribe(e){return Yi(Nr,()=>e(Nr))},setLastNetworkInView(e){Nr.lastNetworkInView=e},async fetchTransactions(e,t){var n,r;if(!e)throw new Error("Transactions can't be fetched without an accountAddress");Nr.loading=!0;try{const s=await Ut.fetchTransactions({account:e,cursor:Nr.next,onramp:t,cache:t==="coinbase"?"no-cache":void 0,chainId:(n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId}),i=ME.filterSpamTransactions(s.data),o=ME.filterByConnectedChain(i),a=[...Nr.transactions,...o];Nr.loading=!1,t==="coinbase"?Nr.coinbaseTransactions=ME.groupTransactionsByYearAndMonth(Nr.coinbaseTransactions,s.data):(Nr.transactions=a,Nr.transactionsByYear=ME.groupTransactionsByYearAndMonth(Nr.transactionsByYear,o)),Nr.empty=a.length===0,Nr.next=s.next?s.next:void 0}catch{const i=J.state.activeChain;bn.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:we.state.projectId,cursor:Nr.next,isSmartAccount:((r=Et.state.preferredAccountTypes)==null?void 0:r[i])===m8.ACCOUNT_TYPES.SMART_ACCOUNT}}),vs.showError("Failed to fetch transactions"),Nr.loading=!1,Nr.empty=!0,Nr.next=void 0}},groupTransactionsByYearAndMonth(e={},t=[]){const n=e;return t.forEach(r=>{const s=new Date(r.metadata.minedAt).getFullYear(),i=new Date(r.metadata.minedAt).getMonth(),o=n[s]??{},c=(o[i]??[]).filter(l=>l.id!==r.id);n[s]={...o,[i]:[...c,r].sort((l,u)=>new Date(u.metadata.minedAt).getTime()-new Date(l.metadata.minedAt).getTime())}}),n},filterSpamTransactions(e){return e.filter(t=>!t.transfers.every(r=>{var s;return((s=r.nft_info)==null?void 0:s.flags.is_spam)===!0}))},filterByConnectedChain(e){var r;const t=(r=J.state.activeCaipNetwork)==null?void 0:r.caipNetworkId;return e.filter(s=>s.metadata.chain===t)},clearCursor(){Nr.next=void 0},resetTransactions(){Nr.transactions=[],Nr.transactionsByYear={},Nr.lastNetworkInView=void 0,Nr.loading=!1,Nr.empty=!1,Nr.next=void 0}},ME=xc(Vmt,"API_ERROR"),Er=Pr({connections:new Map,wcError:!1,buffering:!1,status:"disconnected"});let U1;const Kmt={state:Er,subscribeKey(e,t){return so(Er,e,t)},_getClient(){return Er._client},setClient(e){Er._client=oy(e)},async connectWalletConnect(){var e,t,n,r;
155if(Re.isTelegram()||Re.isSafari()&&Re.isIos()){if(U1){await U1,U1=void 0;return}if(!Re.isPairingExpired(Er==null?void 0:Er.wcPairingExpiry)){const s=Er.wcUri;Er.wcUri=s;return}U1=(t=(e=He._getClient())==null?void 0:e.connectWalletConnect)==null?void 0:t.call(e).catch(()=>{}),He.state.status="connecting",await U1,U1=void 0,Er.wcPairingExpiry=void 0,He.state.status="connected"}else await((r=(n=He._getClient())==null?void 0:n.connectWalletConnect)==null?void 0:r.call(n))},async connectExternal(e,t,n=!0){var r,s;await((s=(r=He._getClient())==null?void 0:r.connectExternal)==null?void 0:s.call(r,e)),n&&J.setActiveNamespace(t)},async reconnectExternal(e){var n,r;await((r=(n=He._getClient())==null?void 0:n.reconnectExternal)==null?void 0:r.call(n,e));const t=e.chain||J.state.activeChain;t&&Pe.setConnectorId(e.id,t)},async setPreferredAccountType(e,t){var r;ir.setLoading(!0,J.state.activeChain);const n=Pe.getAuthConnector();n&&(Et.setPreferredAccountType(e,t),await n.provider.setPreferredAccount(e),lt.setPreferredAccountTypes(Et.state.preferredAccountTypes??{[t]:e}),await He.reconnectExternal(n),ir.setLoading(!1,J.state.activeChain),bn.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:((r=J.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}}))},async signMessage(e){var t;return(t=He._getClient())==null?void 0:t.signMessage(e)},parseUnits(e,t){var n;return(n=He._getClient())==null?void 0:n.parseUnits(e,t)},formatUnits(e,t){var n;return(n=He._getClient())==null?void 0:n.formatUnits(e,t)},async sendTransaction(e){var t;return(t=He._getClient())==null?void 0:t.sendTransaction(e)},async getCapabilities(e){var t;return(t=He._getClient())==null?void 0:t.getCapabilities(e)},async grantPermissions(e){var t;return(t=He._getClient())==null?void 0:t.grantPermissions(e)},async walletGetAssets(e){var t;return((t=He._getClient())==null?void 0:t.walletGetAssets(e))??{}},async estimateGas(e){var t;return(t=He._getClient())==null?void 0:t.estimateGas(e)},async writeContract(e){var t;return(t=He._getClient())==null?void 0:t.writeContract(e)},async getEnsAddress(e){var t;return(t=He._getClient())==null?void 0:t.getEnsAddress(e)},async getEnsAvatar(e){var t;return(t=He._getClient())==null?void 0:t.getEnsAvatar(e)},checkInstalled(e){var t,n;return((n=(t=He._getClient())==null?void 0:t.checkInstalled)==null?void 0:n.call(t,e))||!1},resetWcConnection(){Er.wcUri=void 0,Er.wcPairingExpiry=void 0,Er.wcLinking=void 0,Er.recentWallet=void 0,Er.status="disconnected",ME.resetTransactions(),lt.deleteWalletConnectDeepLink()},resetUri(){Er.wcUri=void 0,Er.wcPairingExpiry=void 0,U1=void 0},finalizeWcConnection(){var n,r;const{wcLinking:e,recentWallet:t}=He.state;e&<.setWalletConnectDeepLink(e),t&<.setAppKitRecent(t),bn.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:((r=(n=Le.state.data)==null?void 0:n.wallet)==null?void 0:r.name)||"Unknown"}})},setWcBasic(e){Er.wcBasic=e},setUri(e){Er.wcUri=e,Er.wcPairingExpiry=Re.getPairingExpiry()},setWcLinking(e){Er.wcLinking=e},setWcError(e){Er.wcError=e,Er.buffering=!1},setRecentWallet(e){Er.recentWallet=e},setBuffering(e){Er.buffering=e},setStatus(e){Er.status=e},async disconnect(e){var t;try{await((t=He._getClient())==null?void 0:t.disconnect(e))}catch(n){throw new $j("Failed to disconnect","INTERNAL_SDK_ERROR",n)}},setConnections(e,t){Er.connections.set(t,e)},switchAccount({connection:e,address:t,namespace:n}){if(Pe.state.activeConnectorIds[n]===e.connectorId){const i=J.state.activeCaipNetwork;if(i){const o=`${n}:${i.id}:${t}`;Et.setCaipAddress(o,n)}else console.warn(`No current network found for namespace "${n}"`)}else{const i=Pe.getConnector(e.connectorId);i?He.connectExternal(i,n):console.warn(`No connector found for namespace "${n}"`)}}},He=xc(Kmt),y2=Pr({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1}),Sm={state:y2,subscribe(e){return Yi(y2,()=>e(y2))},subscribeOpen(e){return so(y2,"open",e)},set(e){Object.assign(y2,{...y2,...e})}};function Gmt(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${i?`.${i}`:""}`}const KR={createBalance(e,t){const n={name:e.metadata.name||"",symbol
155:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:n.name,symbol:n.symbol,chainId:t,address:e.address==="native"?void 0:this.convertAddressToCAIP10Address(e.address,t),value:n.value,price:n.price,quantity:{decimals:n.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:n.decimals})},iconUrl:n.iconUrl}},convertHexToBalance({hex:e,decimals:t}){return Gmt(BigInt(e),t)},convertAddressToCAIP10Address(e,t){return`${t}:${e}`},createCAIP2ChainId(e,t){return`${t}:${parseInt(e,16)}`},getChainIdHexFromCAIP2ChainId(e){const t=e.split(":");if(t.length<2||!t[1])return"0x0";const n=t[1],r=parseInt(n,10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return typeof e!="object"||e===null?!1:Object.values(e).every(t=>Array.isArray(t)&&t.every(n=>this.isValidAsset(n)))},isValidAsset(e){return typeof e=="object"&&e!==null&&typeof e.address=="string"&&typeof e.balance=="string"&&(e.type==="ERC20"||e.type==="NATIVE")&&typeof e.metadata=="object"&&e.metadata!==null&&typeof e.metadata.name=="string"&&typeof e.metadata.symbol=="string"&&typeof e.metadata.decimals=="number"&&typeof e.metadata.price=="number"&&typeof e.metadata.iconUrl=="string"}},Mre={async getMyTokensWithBalance(e){const t=Et.state.address,n=J.state.activeCaipNetwork;if(!t||!n)return[];if(n.chainNamespace==="eip155"){const s=await this.getEIP155Balances(t,n);if(s)return this.filterLowQualityTokens(s)}const r=await Ut.getBalance(t,n.caipNetworkId,e);return this.filterLowQualityTokens(r.balances)},async getEIP155Balances(e,t){var n,r;try{const s=KR.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await He.getCapabilities(e);if(!((r=(n=i==null?void 0:i[s])==null?void 0:n.assetDiscovery)!=null&&r.supported))return null;const o=await He.walletGetAssets({account:e,chainFilter:[s]});return KR.isWalletGetAssetsResponse(o)?(o[s]||[]).map(c=>KR.createBalance(c,t.caipNetworkId)):null}catch{return null}},filterLowQualityTokens(e){return e.filter(t=>t.quantity.decimals!=="0")},mapBalancesToSwapTokens(e){return(e==null?void 0:e.map(t=>({...t,address:t!=null&&t.address?t.address:J.getActiveNetworkTokenAddress(),decimals:parseInt(t.quantity.decimals,10),logoUri:t.iconUrl,eip2612:!1})))||[]}},cr=Pr({tokenBalances:[],loading:!1}),Zmt={state:cr,subscribe(e){return Yi(cr,()=>e(cr))},subscribeKey(e,t){return so(cr,e,t)},setToken(e){e&&(cr.token=oy(e))},setTokenAmount(e){cr.sendTokenAmount=e},setReceiverAddress(e){cr.receiverAddress=e},setReceiverProfileImageUrl(e){cr.receiverProfileImageUrl=e},setReceiverProfileName(e){cr.receiverProfileName=e},setNetworkBalanceInUsd(e){cr.networkBalanceInUSD=e},setLoading(e){cr.loading=e},async sendToken(){var e;try{switch(Jn.setLoading(!0),(e=J.state.activeCaipNetwork)==null?void 0:e.chainNamespace){case"eip155":await Jn.sendEvmToken();return;case"solana":await Jn.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}
155finally{Jn.setLoading(!1)}},async sendEvmToken(){var n,r,s,i;const e=J.state.activeChain,t=(n=Et.state.preferredAccountTypes)==null?void 0:n[e];if(!Jn.state.sendTokenAmount||!Jn.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!Jn.state.token)throw new Error("A token is required");(r=Jn.state.token)!=null&&r.address?(bn.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===m8.ACCOUNT_TYPES.SMART_ACCOUNT,token:Jn.state.token.address,amount:Jn.state.sendTokenAmount,network:((s=J.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}}),await Jn.sendERC20Token({receiverAddress:Jn.state.receiverAddress,tokenAddress:Jn.state.token.address,sendTokenAmount:Jn.state.sendTokenAmount,decimals:Jn.state.token.quantity.decimals})):(bn.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===m8.ACCOUNT_TYPES.SMART_ACCOUNT,token:Jn.state.token.symbol||"",amount:Jn.state.sendTokenAmount,network:((i=J.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||""}}),await Jn.sendNativeToken({receiverAddress:Jn.state.receiverAddress,sendTokenAmount:Jn.state.sendTokenAmount,decimals:Jn.state.token.quantity.decimals}))},async fetchTokenBalance(e){var i,o;cr.loading=!0;const t=(i=J.state.activeCaipNetwork)==null?void 0:i.caipNetworkId,n=(o=J.state.activeCaipNetwork)==null?void 0:o.chainNamespace,r=J.state.activeCaipAddress,s=r?Re.getPlainAddress(r):void 0;if(cr.lastRetry&&!Re.isAllowedRetry(cr.lastRetry,30*dr.ONE_SEC_MS))return cr.loading=!1,[];try{if(s&&t&&n){const a=await Mre.getMyTokensWithBalance();return cr.tokenBalances=a,cr.lastRetry=void 0,a}}catch(a){cr.lastRetry=Date.now(),e==null||e(a),vs.showError("Token Balance Unavailable")}finally{cr.loading=!1}return[]},fetchNetworkBalance(){if(cr.tokenBalances.length===0)return;const e=Mre.mapBalancesToSwapTokens(cr.tokenBalances);if(!e)return;const t=e.find(n=>n.address===J.getActiveNetworkTokenAddress());t&&(cr.networkBalanceInUSD=t?gmt.multiply(t.quantity.numeric,t.price).toString():"0")},async sendNativeToken(e){var i,o,a,c;Le.pushTransactionStack({});const t=e.receiverAddress,n=Et.state.address,r=He.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));await He.sendTransaction({chainNamespace:"eip155",to:t,address:n,data:"0x",value:r??BigInt(0)}),bn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:((i=Et.state.preferredAccountTypes)==null?void 0:i.eip155)===m8.ACCOUNT_TYPES.SMART_ACCOUNT,token:((o=Jn.state.token)==null?void 0:o.symbol)||"",amount:e.sendTokenAmount,network:((a=J.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)||""}}),(c=He._getClient())==null||c.updateBalance("eip155"),Jn.resetSend()},async sendERC20Token(e){Le.pushTransactionStack({onSuccess(){Le.replace("Account")}});const t=He.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));if(Et.state.address&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){const n=Re.getPlainAddress(e.tokenAddress);await He.writeContract({fromAddress:Et.state.address,tokenAddress:n,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:bmt.getERC20Abi(n),chainNamespace:"eip155"}),Jn.resetSend()}},async sendSolanaToken(){var e;if(!Jn.state.sendTokenAmount||!Jn.state.receiverAddress)throw new Error("An amount and receiver address are required");Le.pushTransactionStack({onSuccess(){Le.replace("Account")}}),await He.sendTransaction({chainNamespace:"solana",to:Jn.state.receiverAddress,value:Jn.state.sendTokenAmount}),(e=He._getClient())==null||e.updateBalance("solana"),Jn.resetSend()},resetSend(){cr.token=void 0,cr.sendTokenAmount=void 0,cr.receiverAddress=void 0,cr.receiverProfileImageUrl=void 0,cr.receiverProfileName=void 0,cr.loading=!1,cr.tokenBalances=[]}},Jn=xc(Zmt),GR={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[],user:void 0},vI={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},et=Pr({chains:Imt(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0},isSwitchingNamespace:!1}),Ymt={state:et,subscribe(e){return Yi(et,()=>{e(et)})},subscribeKey(e,t){return so(et,e,t)},subscribeChainProp(e,t,n){let r;return Yi(et.chains,()=>{var i;const s=n||et.activeChain;if(s){const o=(i=et.chains.get(s))==null?void 0:i[e];r!==o&&(r=o,t(o))}})},initialize(e,t,n){const{chainId:r,namespace:s}=lt.getActiveNetworkProps(),i=t==null?void 0:t.find(u=>u.id.toString()===(r==null?void 0:r.toString())),a=e.find(u=>(u==null?void 0:u.namespace)===s)||(e==null?void 0:e[0]),c=e.map(u=>u.namespace).filter(u=>u!==void 0),l=we.state.enableEmbedded?new Set([...c]):new Set([...(t==null?void 0:t.map(u=>u.chainNamespace))??[]]);((e==null?void 0:e.length)===0||!a)&&(et.noAdapters=!0),et.noAdapters||(et.activeChain=a==null?void 0:a.namespace,et.activeCaipNetwork=i,J.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:i}),et.activeChain&&Sm.set({activeChain:a==null?void 0:a.namespace})),l.forEach(u=>{const d=t==null?void 0:t.filter(h=>h.chainNamespace===u);J.state.chains.set(u,{namespace:u,networkState:Pr({...vI,caipNetwork:d==null?void 0:d[0]}),accountState:Pr(GR),caipNetworks:d??[],...n}),J.setRequestedCaipNetworks(d??[],u)})},removeAdapter(e){var t,n;if(et.activeChain===e){const r=Array.from(et.chains.entries()).find(([s])=>s!==e);if(r){const s=(n=(t=r[1])==null?void 0:t.caipNetworks)==null?void 0:n[0];s&&J.setActiveCaipNetwork(s)}}et.chains.delete(e)},addAdapter(e,{networkControllerClient:t,connectionControllerClient:n},r){et.chains.set(e.namespace,{namespace:e.namespace,networkState:{...vI,caipNetwork:r[0]},accountState:GR,caipNetworks:r,connectionControllerClient:n,networkControllerClient:t}),J.setRequestedCaipNetworks((r==null?void 0:r.filter(s=>s.chainNamespace===e.namespace))??[],e.namespace)},addNetwork(e){var n;const t=et.chains.get(e.chainNamespace);if(t){const r=[...t.caipNetworks||[]];(n=t.caipNetworks)!=null&&n.find(s=>s.id===e.id)||r.push(e),et.chains.set(e.chainNamespace,{...t,caipNetworks:r}),J.setRequestedCaipNetworks(r,e.chainNamespace),Pe.filterByNamespace(e.chainNamespace,!0)}},removeNetwork(e,t){var r,s,i;const n=et.chains.get(e);if(n){const o=((r=et.activeCaipNetwork)==null?void 0:r.id)===t,a=[...((s=n.caipNetworks)==null?void 0:s.filter(c=>c.id!==t))||[]];o&&((i=n==null?void 0:n.caipNetworks)!=null&&i[0])&&J.setActiveCaipNetwork(n.caipNetworks[0]),et.chains.set(e,{...n,caipNetworks:a}),J.setRequestedCaipNetworks(a||[],e),a.length===0&&Pe.filterByNamespace(e,!1)}},setAdapterNetworkState(e,t){const n=et.chains.get(e);n&&(n.networkState={...n.networkState||vI,...t},et.chains.set(e,n))},setChainAccountData(e,t,n=!0){if(!e)throw new Error("Chain is required to update chain account data");const r=et.chains.get(e);if(r){const s={...r.accountState||GR,...t};et.chains.set(e,{...r,accountState:s}),(et.chains.size===1||et.activeChain===e)&&(t.caipAddress&&(et.activeCaipAddress=t.caipAddress),Et.replaceState(s))}},setChainNetworkData(e,t){if(!e)return;const n=et.chains.get(e);if(n){const r={...n.networkState||vI,...t};et.chains.set(e,{...n,networkState:r})}}
155,setAccountProp(e,t,n,r=!0){J.setChainAccountData(n,{[e]:t},r),e==="status"&&t==="disconnected"&&n&&Pe.removeConnectorId(n)},setActiveNamespace(e){var r,s;et.activeChain=e;const t=e?et.chains.get(e):void 0,n=(r=t==null?void 0:t.networkState)==null?void 0:r.caipNetwork;n!=null&&n.id&&e&&(et.activeCaipAddress=(s=t==null?void 0:t.accountState)==null?void 0:s.caipAddress,et.activeCaipNetwork=n,J.setChainNetworkData(e,{caipNetwork:n}),lt.setActiveCaipNetworkId(n==null?void 0:n.caipNetworkId),Sm.set({activeChain:e,selectedNetworkId:n==null?void 0:n.caipNetworkId}))},setActiveCaipNetwork(e){var r,s,i;if(!e)return;et.activeChain!==e.chainNamespace&&J.setIsSwitchingNamespace(!0);const t=et.chains.get(e.chainNamespace);et.activeChain=e.chainNamespace,et.activeCaipNetwork=e,J.setChainNetworkData(e.chainNamespace,{caipNetwork:e}),(r=t==null?void 0:t.accountState)!=null&&r.address?et.activeCaipAddress=`${e.chainNamespace}:${e.id}:${(s=t==null?void 0:t.accountState)==null?void 0:s.address}`:et.activeCaipAddress=void 0,J.setAccountProp("caipAddress",et.activeCaipAddress,e.chainNamespace),t&&Et.replaceState(t.accountState),Jn.resetSend(),Sm.set({activeChain:et.activeChain,selectedNetworkId:(i=et.activeCaipNetwork)==null?void 0:i.caipNetworkId}),lt.setActiveCaipNetworkId(e.caipNetworkId),!J.checkIfSupportedNetwork(e.chainNamespace)&&we.state.enableNetworkSwitch&&!we.state.allowUnsupportedChain&&!He.state.wcBasic&&J.showUnsupportedChainUI()},addCaipNetwork(e){var n;if(!e)return;const t=et.chains.get(e.chainNamespace);t&&((n=t==null?void 0:t.caipNetworks)==null||n.push(e))},async switchActiveNamespace(e){var s;if(!e)return;const t=e!==J.state.activeChain,n=(s=J.getNetworkData(e))==null?void 0:s.caipNetwork,r=J.getCaipNetworkByNamespace(e,n==null?void 0:n.id);t&&r&&await J.switchActiveNetwork(r)},async switchActiveNetwork(e){var s;const t=J.state.chains.get(J.state.activeChain),n=!((s=t==null?void 0:t.caipNetworks)!=null&&s.some(i=>{var o;return i.id===((o=et.activeCaipNetwork)==null?void 0:o.id)})),r=J.getNetworkControllerClient(e.chainNamespace);if(r){try{await r.switchCaipNetwork(e),n&&ir.close()}catch{Le.goBack()}bn.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}})}},getNetworkControllerClient(e){const t=e||et.activeChain,n=et.chains.get(t);if(!n)throw new Error("Chain adapter not found");if(!n.networkControllerClient)throw new Error("NetworkController client not set");return n.networkControllerClient},getConnectionControllerClient(e){const t=e||et.activeChain;if(!t)throw new Error("Chain is required to get connection controller client");const n=et.chains.get(t);if(!(n!=null&&n.connectionControllerClient))throw new Error("ConnectionController client not set");return n.connectionControllerClient},getAccountProp(e,t){var s;let n=et.activeChain;if(t&&(n=t),!n)return;const r=(s=et.chains.get(n))==null?void 0:s.accountState;if(r)return r[e]},getNetworkProp(e,t){var r;const n=(r=et.chains.get(t))==null?void 0:r.networkState;if(n)return n[e]},getRequestedCaipNetworks(e){const t=et.chains.get(e),{approvedCaipNetworkIds:n=[],requestedCaipNetworks:r=[]}=(t==null?void 0:t.networkState)||{};return Re.sortRequestedNetworks(n,r)},getAllRequestedCaipNetworks(){const e=[];return et.chains.forEach(t=>{const n=J.getRequestedCaipNetworks(t.namespace);e.push(...n)}),e},setRequestedCaipNetworks(e,t){J.setAdapterNetworkState(t,{requestedCaipNetworks:e});const r=J.getAllRequestedCaipNetworks().map(i=>i.chainNamespace),s=Array.from(new Set(r));Pe.filterByNamespaces(s)},getAllApprovedCaipNetworkIds(){const e=[];return et.chains.forEach(t=>{const n=J.getApprovedCaipNetworkIds(t.namespace);e.push(...n)}),e},getActiveCaipNetwork(){return et.activeCaipNetwork},getActiveCaipAddress(){return et.activeCaipAddress},getApprovedCaipNetworkIds(e){var r;const t=et.chains.get(e);return((r=t==null?void 0:t.networkState)==null?void 0:r.approvedCaipNetworkIds)||[]},async setApprovedCaipNetworksData(e){const t=J.getNetworkControllerClient(),n=await(t==null?void 0:t.getApprovedCaipNetworksData());J.setAdapterNetworkState(e,{approvedCaipNetworkIds:n==null?void 0:n.approvedCaipNetworkIds,supportsAllNetworks:n==null?void 0:n.supportsAllNetworks})},checkIfSupportedNetwork(e,t){const n=t||et.activeCaipNetwork,r=J.getRequestedCaipNetworks(e);return r.length?r==null?void 0:r.some(s=>s.id===(n==null?void 0:n.id)):!0},checkIfSupportedChainId(e){if(!et.activeChain)return!0;const t=J.getRequestedCaipNetworks(et.activeChain);return t==null?void 0:t.some(n=>n.id===e)},setSmartAccountEnabledNetworks(e,t){J.setAdapterNetworkState(t,{smartAccountEnabledNetworks:e})},checkIfSmartAccountEnabled(){var r;const e=Kye.caipNetworkIdToNumber((r=et.activeCaipNetwork)==null?void 0:r.caipNetworkId),t=et.activeChain;if(!t||!e)return!1;const n=J.getNetworkProp("smartAccountEnabledNetworks",t);return!!(n!=null&&n.includes(Number(e)))},getActiveNetworkTokenAddress(){var r,s;const e=((r=et.activeCaipNetwork)==null?void 0:r.chainNamespace)||"eip155",t=((s=et.activeCaipNetwork)==null?void 0:s.id)||1,n=dr.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${n}`},showUnsupportedChainUI(){ir.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const e=et.activeCaipNetwork;return!!(e!=null&&e.chainNamespace&&dr.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){J.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(e){const t=e;if(!t)throw new Error("Chain is required to set account prop");et.activeCaipAddress=void 0,J.setChainAccountData(t,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol
155:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountTypes:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,allAccounts:[],user:void 0,status:"disconnected"}),Pe.removeConnectorId(t)},setIsSwitchingNamespace(e){et.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){var n,r;const e=[];let t;if(et.chains.forEach(s=>{$t.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(i=>i===s.namespace)&&s.namespace&&e.push(s.namespace)}),e.length>0){const s=e[0];return t=s?(r=(n=et.chains.get(s))==null?void 0:n.caipNetworks)==null?void 0:r[0]:void 0,t}},getAccountData(e){var t;return e?(t=J.state.chains.get(e))==null?void 0:t.accountState:Et.state},getNetworkData(e){var n;const t=e||et.activeChain;if(t)return(n=J.state.chains.get(t))==null?void 0:n.networkState},getCaipNetworkByNamespace(e,t){var s,i,o;if(!e)return;const n=J.state.chains.get(e),r=(s=n==null?void 0:n.caipNetworks)==null?void 0:s.find(a=>a.id===t);return r||((i=n==null?void 0:n.networkState)==null?void 0:i.caipNetwork)||((o=n==null?void 0:n.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const e=Pe.state.filterByNamespace;return(e?[et.chains.get(e)]:Array.from(et.chains.values())).flatMap(n=>(n==null?void 0:n.caipNetworks)||[]).map(n=>n.caipNetworkId)},getCaipNetworks(e){return e?J.getRequestedCaipNetworks(e):J.getAllRequestedCaipNetworks()}},J=xc(Ymt),Jmt={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},Yye=Re.getBlockchainApiUrl(),Ta=Pr({clientId:null,api:new l$({baseUrl:Yye,clientId:null}),supportedChains:{http:[],ws:[]}}),Ut={state:Ta,async get(e){const{st:t,sv:n}=Ut.getSdkProperties(),r=we.state.projectId,s={...e.params||{},st:t,sv:n,projectId:r};return Ta.api.get({...e,params:s})},getSdkProperties(){const{sdkType:e,sdkVersion:t}=we.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{Ta.supportedChains.http.length||await Ut.getSupportedNetworks()}catch{return!1}return Ta.supportedChains.http.includes(e)},async getSupportedNetworks(){try{const e=await Ut.get({path:"v1/supported-chains"});return Ta.supportedChains=e,e}catch{return Ta.supportedChains}},async fetchIdentity({address:e,caipNetworkId:t}){if(!await Ut.isNetworkSupported(t))return{avatar:"",name:""};const r=lt.getIdentityFromCacheForAddress(e);if(r)return r;const s=await Ut.get({path:`/v1/identity/${e}`,params:{sender:J.state.activeCaipAddress?Re.getPlainAddress(J.state.activeCaipAddress):void 0}});return lt.updateIdentityCache({address:e,identity:s,timestamp:Date.now()}),s},async fetchTransactions({account:e,cursor:t,onramp:n,signal:r,cache:s,chainId:i}){var a;return await Ut.isNetworkSupported((a=J.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?Ut.get({path:`/v1/account/${e}/history`,params:{cursor:t,onramp:n,chainId:i},signal:r,cache:s}):{data:[],next:void 0}},async fetchSwapQuote({amount:e,userAddress:t,from:n,to:r,gasPrice:s}){var o;return await Ut.isNetworkSupported((o=J.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?Ut.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:n,to:r,gasPrice:s}}):{quotes:[]}},async fetchSwapTokens({chainId:e}){var n;return await Ut.isNetworkSupported((n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?
155Ut.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]}},async fetchTokenPrice({addresses:e}){var n;return await Ut.isNetworkSupported((n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Ta.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:we.state.projectId},headers:{"Content-Type":"application/json"}}):{fungibles:[]}},async fetchSwapAllowance({tokenAddress:e,userAddress:t}){var r;return await Ut.isNetworkSupported((r=J.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Ut.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:e}){var s;const{st:t,sv:n}=Ut.getSdkProperties();if(!await Ut.isNetworkSupported((s=J.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))throw new Error("Network not supported for Gas Price");return Ut.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:n}})},async generateSwapCalldata({amount:e,from:t,to:n,userAddress:r,disableEstimate:s}){var o;if(!await Ut.isNetworkSupported((o=J.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Ta.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:dr.CONVERT_SLIPPAGE_TOLERANCE},projectId:we.state.projectId,from:t,to:n,userAddress:r,disableEstimate:s}})},async generateApproveCalldata({from:e,to:t,userAddress:n}){var o;const{st:r,sv:s}=Ut.getSdkProperties();if(!await Ut.isNetworkSupported((o=J.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Ut.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:n,from:e,to:t,st:r,sv:s}})},async getBalance(e,t,n){var l;const{st:r,sv:s}=Ut.getSdkProperties();if(!await Ut.isNetworkSupported((l=J.state.activeCaipNetwork)==null?void 0:l.caipNetworkId))return vs.showError("Token Balance Unavailable"),{balances:[]};const o=`${t}:${e}`,a=lt.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await Ut.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:n,st:r,sv:s}});return lt.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(e){var n;return await Ut.isNetworkSupported((n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Ut.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:e}){var n;return await Ut.isNetworkSupported((n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Ut.get({path:`/v1/profile/reverse/${e}`,params:{sender:Et.state.address,apiVersion:"2"}}):[]},async getEnsNameSuggestions(e){var n;return await Ut.isNetworkSupported((n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Ut.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:e,address:t,message:n,signature:r}){var i;return await Ut.isNetworkSupported((i=J.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?Ta.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:n,signature:r},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:e,partnerUserId:t,defaultNetwork:n,purchaseAmount:r,paymentAmount:s}){var a;return await Ut.isNetworkSupported((a=J.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await Ta.api.post({path:"/v1/generators/onrampurl",params:{projectId:we.state.projectId},body:{destinationWallets:e,defaultNetwork:n,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:r,presetFiatAmount:s}})).url:""},async getOnrampOptions(){var t;if(!await Ut.isNetworkSupported((t=J.state.activeCaipNetwork)==null?void 0:t.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await Ut.get({path:"/v1/onramp/options"})}catch{return Jmt}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}){var s;try{return await Ut.isNetworkSupported((s=J.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?await Ta.api.post({path:"/v1/onramp/quote",params:{projectId:we.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}}):null}catch{return{coinbaseFee:{amount:n,currency:t.id},networkFee:{amount:n,currency:t.id},paymentSubtotal:{amount:n,currency:t.id},paymentTotal:{amount:n,currency:t.id},purchaseAmount:{amount:n,currency:t.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(e){var n;return await Ut.isNetworkSupported((n=J.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?
155Ut.get({path:`/v1/sessions/${e}`}):[]},async revokeSmartSession(e,t,n){var s;return await Ut.isNetworkSupported((s=J.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?Ta.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:we.state.projectId},body:{pci:t,signature:n}}):{success:!1}},setClientId(e){Ta.clientId=e,Ta.api=new l$({baseUrl:Yye,clientId:e})}},Fl=Pr({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),Xmt={state:Fl,replaceState(e){e&&Object.assign(Fl,oy(e))},subscribe(e){return J.subscribeChainProp("accountState",t=>{if(t)return e(t)})},subscribeKey(e,t,n){let r;return J.subscribeChainProp("accountState",s=>{if(s){const i=s[e];r!==i&&(r=i,t(i))}},n)},setStatus(e,t){J.setAccountProp("status",e,t)},getCaipAddress(e){return J.getAccountProp("caipAddress",e)},setCaipAddress(e,t){const n=e?Re.getPlainAddress(e):void 0;t===J.state.activeChain&&(J.state.activeCaipAddress=e),J.setAccountProp("caipAddress",e,t),J.setAccountProp("address",n,t)},setBalance(e,t,n){J.setAccountProp("balance",e,n),J.setAccountProp("balanceSymbol",t,n)},setProfileName(e,t){J.setAccountProp("profileName",e,t)},setProfileImage(e,t){J.setAccountProp("profileImage",e,t)},setUser(e,t){J.setAccountProp("user",e,t)},setAddressExplorerUrl(e,t){J.setAccountProp("addressExplorerUrl",e,t)},setSmartAccountDeployed(e,t){J.setAccountProp("smartAccountDeployed",e,t)},setCurrentTab(e){J.setAccountProp("currentTab",e,J.state.activeChain)},setTokenBalance(e,t){e&&J.setAccountProp("tokenBalance",e,t)},setShouldUpdateToAddress(e,t){J.setAccountProp("shouldUpdateToAddress",e,t)},setAllAccounts(e,t){J.setAccountProp("allAccounts",e,t)},addAddressLabel(e,t,n){const r=J.getAccountProp("addressLabels",n)||new Map;r.set(e,t),J.setAccountProp("addressLabels",r,n)},removeAddressLabel(e,t){const n=J.getAccountProp("addressLabels",t)||new Map;n.delete(e),J.setAccountProp("addressLabels",n,t)},setConnectedWalletInfo(e,t){J.setAccountProp("connectedWalletInfo",e,t,!1)},setPreferredAccountType(e,t){J.setAccountProp("preferredAccountTypes",{...Fl.preferredAccountTypes,[t]:e},t)},setPreferredAccountTypes(e){Fl.preferredAccountTypes=e},setSocialProvider(e,t){e&&J.setAccountProp("socialProvider",e,t)},setSocialWindow(e,t){J.setAccountProp("socialWindow",e?oy(e):void 0,t)},setFarcasterUrl(e,t){J.setAccountProp("farcasterUrl",e,t)},async fetchTokenBalance(e){var i,o;Fl.balanceLoading=!0;const t=(i=J.state.activeCaipNetwork)==null?void 0:i.caipNetworkId,n=(o=J.state.activeCaipNetwork)==null?void 0:o.chainNamespace,r=J.state.activeCaipAddress,s=r?Re.getPlainAddress(r):void 0;if(Fl.lastRetry&&!Re.isAllowedRetry(Fl.lastRetry,30*dr.ONE_SEC_MS))return Fl.balanceLoading=!1,[];try{if(s&&t&&n){const c=(await Ut.getBalance(s,t)).balances.filter(l=>l.quantity.decimals!=="0");return Et.setTokenBalance(c,n),Fl.lastRetry=void 0,Fl.balanceLoading=!1,c}}catch(a){Fl.lastRetry=Date.now(),e==null||e(a),vs.showError("Token Balance Unavailable")}finally{Fl.balanceLoading=!1}return[]},resetAccount(e){J.resetAccount(e)}},Et=xc(Xmt),Qmt={onSwitchNetwork({network:e,ignoreSwitchConfirmation:t=!1}){const n=J.state.activeCaipNetwork,r=Le.state.data;if(e.id===(n==null?void 0:n.id))return;const i=Et.getCaipAddress(J.state.activeChain),o=e.chainNamespace!==J.state.activeChain,a=Et.getCaipAddress(e.chainNamespace),l=Pe.getConnectorId(J.state.activeChain)===$t.CONNECTOR_ID.AUTH,u=$t.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(d=>d===e.chainNamespace);t||l&&u?Le.push("SwitchNetwork",{...r,network:e}):i&&o&&!a?Le.push("SwitchActiveChain",{switchToChain:e.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:e}):Le.push("SwitchNetwork",{...r,network:e})}},Pa=Pr({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),e1t={state:Pa,subscribe(e){return Yi(Pa,()=>e(Pa))},subscribeKey(e,t){return so(Pa,e,t)},async open(e){var o,a;const t=Et.state.status==="connected",n=e==null?void 0:e.namespace,r=J.state.activeChain,s=n&&n!==r,i=(o=J.getAccountData(e==null?void 0:e.namespace))==null?void 0:o.caipAddress;if(He.state.wcBasic?ze.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1}):await ze.prefetch({fetchConnectorImages:!t,fetchFeaturedWallets:!t,fetchRecommendedWallets:!t}),Pe.setFilterByNamespace(e==null?void 0:e.namespace),ir.setLoading(!0,n),n&&s){const c=((a=J.getNetworkData(n))==null?void 0:a.caipNetwork)||J.getRequestedCaipNetworks(n)[0];c&&Qmt.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0})}else{const c=J.state.noAdapters;we.state.manualWCControl||c&&!i?Re.isMobile()?Le.reset("AllWallets"):Le.reset("ConnectingWalletConnectBasic"):e!=null&&e.view?Le.reset(e.view,e.data):i?Le.reset("Account"):Le.reset("Connect")}Pa.open=!0,Sm.set({open:!0}),bn.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!i}})},close(){const e=we.state.enableEmbedded,t=!!J.state.activeCaipAddress;Pa.open&&bn.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),Pa.open=!1,Le.reset("Connect"),ir.clearLoading(),e?t?Le.replace("Account"):Le.push("Connect"):Sm.set({open:!1}),He.resetUri()}
155,setLoading(e,t){t&&Pa.loadingNamespaceMap.set(t,e),Pa.loading=e,Sm.set({loading:e})},clearLoading(){Pa.loadingNamespaceMap.clear(),Pa.loading=!1},shake(){Pa.shake||(Pa.shake=!0,setTimeout(()=>{Pa.shake=!1},500))}},ir=xc(e1t),w8={id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},Sj={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},t1t={providers:Gye,selectedProvider:null,error:null,purchaseCurrency:w8,paymentCurrency:Sj,purchaseCurrencies:[w8],paymentCurrencies:[],quotesLoading:!1},Ln=Pr(t1t),n1t={state:Ln,subscribe(e){return Yi(Ln,()=>e(Ln))},subscribeKey(e,t){return so(Ln,e,t)},setSelectedProvider(e){if(e&&e.name==="meld"){const t=J.state.activeChain===$t.CHAIN.SOLANA?"SOL":"USDC",n=Et.state.address??"",r=new URL(e.url);r.searchParams.append("publicKey",Smt),r.searchParams.append("destinationCurrencyCode",t),r.searchParams.append("walletAddress",n),r.searchParams.append("externalCustomerId",we.state.projectId),Ln.selectedProvider={...e,url:r.toString()}}else Ln.selectedProvider=e},setOnrampProviders(e){if(Array.isArray(e)&&e.every(t=>typeof t=="string")){const t=e,n=Gye.filter(r=>t.includes(r.name));Ln.providers=n}else Ln.providers=[]},setPurchaseCurrency(e){Ln.purchaseCurrency=e},setPaymentCurrency(e){Ln.paymentCurrency=e},setPurchaseAmount(e){Aj.state.purchaseAmount=e},setPaymentAmount(e){Aj.state.paymentAmount=e},async getAvailableCurrencies(){const e=await Ut.getOnrampOptions();Ln.purchaseCurrencies=e.purchaseCurrencies,Ln.paymentCurrencies=e.paymentCurrencies,Ln.paymentCurrency=e.paymentCurrencies[0]||Sj,Ln.purchaseCurrency=e.purchaseCurrencies[0]||w8,await ze.fetchCurrencyImages(e.paymentCurrencies.map(t=>t.id)),await ze.fetchTokenImages(e.purchaseCurrencies.map(t=>t.symbol))},async getQuote(){var e,t;Ln.quotesLoading=!0;try{const n=await Ut.getOnrampQuote({purchaseCurrency:Ln.purchaseCurrency,paymentCurrency:Ln.paymentCurrency,amount:((e=Ln.paymentAmount)==null?void 0:e.toString())||"0",network:(t=Ln.purchaseCurrency)==null?void 0:t.symbol});return Ln.quotesLoading=!1,Ln.purchaseAmount=Number(n==null?void 0:n.purchaseAmount.amount),n}catch(n){return Ln.error=n.message,Ln.quotesLoading=!1,null}finally{Ln.quotesLoading=!1}},resetState(){Ln.selectedProvider=null,Ln.error=null,Ln.purchaseCurrency=w8,Ln.paymentCurrency=Sj,Ln.purchaseCurrencies=[w8],Ln.paymentCurrencies=[],Ln.paymentAmount=void 0,Ln.purchaseAmount=void 0,Ln.quotesLoading=!1}},Aj=xc(n1t),td=Pr({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),r1t={state:td,subscribe(e){return Yi(td,()=>e(td))},subscribeKey(e,t){return so(td,e,t)},showTooltip({message:e,triggerRect:t,variant:n}){td.open=!0,td.message=e,td.triggerRect=t,td.variant=n},hide(){td.open=!1,td.message="",td.triggerRect={width:0,height:0,top:0,left:0}}},nv=xc(r1t),jre=2147483648,s1t={convertEVMChainIdToCoinType(e){if(e>=jre)throw new Error("Invalid chainId");return(jre|e)>>>0}},zl=Pr({suggestions:[],loading:!1}),i1t={state:zl,subscribe(e){return Yi(zl,()=>e(zl))},subscribeKey(e,t){return so(zl,e,t)},async resolveName(e){var t,n;try{return await Ut.lookupEnsName(e)}catch(r){const s=r;throw new Error(((n=(t=s==null?void 0:s.reasons)==null?void 0:t[0])==null?void 0:n.description)||"Error resolving name")}},async isNameRegistered(e){try{return await Ut.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{zl.loading=!0,zl.suggestions=[];const t=await Ut.getEnsNameSuggestions(e);return zl.suggestions=t.suggestions.map(n=>({...n,name:n.name}))||[],zl.suggestions}catch(t){const n=y8.parseEnsApiError(t,"Error fetching name suggestions");throw new Error(n)}finally{zl.loading=!1}},async getNamesForAddress(e){try{if(!J.state.activeCaipNetwork)return[];const n=lt.getEnsFromCacheForAddress(e);if(n)return n;const r=await Ut.reverseLookupEnsName({address:e});return lt.updateEnsCache({address:e,ens:r,timestamp:Date.now()}),r}catch(t){const n=y8.parseEnsApiError(t,"Error fetching names for address");throw new Error(n)}},async registerName(e){const t=J.state.activeCaipNetwork;if(!t)throw new Error("Network not found");const n=Et.state.address,r=Pe.getAuthConnector();if(!n||!r)throw new Error("Address or auth connector not found");zl.loading=!0;try{const s=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now()/1e3)});Le.pushTransactionStack({onCancel(){Le.replace("RegisterAccountName")}});const i=await He.signMessage(s);zl.loading=!1;const o=t.id;if(!o)throw new Error("Network not found");const a=s1t.convertEVMChainIdToCoinType(Number(o));await Ut.registerEnsName({coinType:a,address:n,signature:i,message:s}),Et.setProfileName(e,t.chainNamespace),Le.replace("RegisterAccountNameSuccess")}catch(s){const i=y8.parseEnsApiError(s,`Error registering name ${e}`);throw Le.replace("RegisterAccountName"),new Error(i)}finally{zl.loading=!1}},validateName(e){return/^[a-zA-Z0-9-]{4,}$/u.test(e)},parseEnsApiError(e,t){var r,s;const n=e;return((s=(r=n==null?void 0:n.reasons)==null?void 0:r[0])==null?void 0:s.description)||t}},y8=xc(i1t);var ZR,Fre;function o1t(){if(Fre)return ZR;Fre=1;const e=SC();ZR=s;const t=S().console||{},n={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:p,wrapResponseSerializer:p,wrapErrorSerializer:p,req:g,res:g,err:h};function r(v,x){return Array.isArray(v)?v.filter(function(I){return I!=="!stdSerializers.err"}):v===!0?Object.keys(x):!1}function s(v){v=v||{},v.browser=v.browser||{};const x=v.browser.transmit;if(x&&typeof x.send!="function")throw Error("pino: transmit option must have a send function");const A=v.browser.write||t;v.browser.write&&(v.browser.asObject=!0);const I=v.serializers||{},O=r(v.browser.serialize,I);let N=v.browser.serialize;Array.isArray(v.browser.serialize)&&v.browser.serialize.indexOf("!stdSerializers.err")>-1&&(N=!1);const T=["error","fatal","warn","info","debug","trace"];typeof A=="function"&&(A.error=A.fatal=A.warn=A.info=A.debug=A.trace=A),v.enabled===!1&&(v.level="silent");const P=v.level||"info",_=Object.create(A);_.log||(_.log=m),Object.defineProperty(_,"levelVal",{get:$}),Object.defineProperty(_,"level",{get:R,set:B});const y={transmit:x,serialize:O,asObject:v.browser.asObject,levels:T,timestamp:f(v)};_.levels=s.levels,_.level=P,_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=m,_.serializers=I,_._serialize=O,_._stdErrSerialize=N,_.child=k,x&&(_._logEvent=d());
155function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function R(){return this._level}function B(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,i(y,_,"error","log"),i(y,_,"fatal","error"),i(y,_,"warn","error"),i(y,_,"info","log"),i(y,_,"debug","log"),i(y,_,"trace","log")}function k(D,U){if(!D)throw new Error("missing bindings for child Pino");U=U||{},O&&D.serializers&&(U.serializers=D.serializers);const F=U.serializers;if(O&&F){var K=Object.assign({},I,F),q=v.browser.serialize===!0?Object.keys(K):O;delete D.serializers,c([D],q,K,this._stdErrSerialize)}function H(Z){this._childLevel=(Z._childLevel|0)+1,this.error=l(Z,D,"error"),this.fatal=l(Z,D,"fatal"),this.warn=l(Z,D,"warn"),this.info=l(Z,D,"info"),this.debug=l(Z,D,"debug"),this.trace=l(Z,D,"trace"),K&&(this.serializers=K,this._serialize=q),x&&(this._logEvent=d([].concat(Z._logEvent.bindings,D)))}return H.prototype=this,new H(this)}return _}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers=n,s.stdTimeFunctions=Object.assign({},{nullTime:w,epochTime:C,unixTime:E,isoTime:b});function i(v,x,A,I){const O=Object.getPrototypeOf(x);x[A]=x.levelVal>x.levels.values[A]?m:O[A]?O[A]:t[A]||t[I]||m,o(v,x,A)}function o(v,x,A){!v.transmit&&x[A]===m||(x[A]=(function(I){return function(){const N=v.timestamp(),T=new Array(arguments.length),P=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var _=0;_<T.length;_++)T[_]=arguments[_];if(v.serialize&&!v.asObject&&c(T,this._serialize,this.serializers,this._stdErrSerialize),v.asObject?I.call(P,a(this,A,T,N)):I.apply(P,T),v.transmit){const y=v.transmit.level||x.level,$=s.levels.values[y],R=s.levels.values[A];if(R<$)return;u(this,{ts:N,methodLevel:A,methodValue:R,transmitValue:s.levels.values[v.transmit.level||x.level],send:v.transmit.send,val:x.levelVal},T)}}})(x[A]))}
155function a(v,x,A,I){v._serialize&&c(A,v._serialize,v.serializers,v._stdErrSerialize);const O=A.slice();let N=O[0];const T={};I&&(T.time=I),T.level=s.levels.values[x];let P=(v._childLevel|0)+1;if(P<1&&(P=1),N!==null&&typeof N=="object"){for(;P--&&typeof O[0]=="object";)Object.assign(T,O.shift());N=O.length?e(O.shift(),O):void 0}else typeof N=="string"&&(N=e(O.shift(),O));return N!==void 0&&(T.msg=N),T}function c(v,x,A,I){for(const O in v)if(I&&v[O]instanceof Error)v[O]=s.stdSerializers.err(v[O]);else if(typeof v[O]=="object"&&!Array.isArray(v[O]))for(const N in v[O])x&&x.indexOf(N)>-1&&N in A&&(v[O][N]=A[N](v[O][N]))}function l(v,x,A){return function(){const I=new Array(1+arguments.length);I[0]=x;for(var O=1;O<I.length;O++)I[O]=arguments[O-1];return v[A].apply(this,I)}}function u(v,x,A){const I=x.send,O=x.ts,N=x.methodLevel,T=x.methodValue,P=x.val,_=v._logEvent.bindings;c(A,v._serialize||Object.keys(v.serializers),v.serializers,v._stdErrSerialize===void 0?!0:v._stdErrSerialize),v._logEvent.ts=O,v._logEvent.messages=A.filter(function(y){return _.indexOf(y)===-1}),v._logEvent.level.label=N,v._logEvent.level.value=T,I(N,v._logEvent,P),v._logEvent=d(_)}function d(v){return{ts:0,messages:[],bindings:v||[],level:{label:"",value:0}}}function h(v){const x={type:v.constructor.name,msg:v.message,stack:v.stack};for(const A in v)x[A]===void 0&&(x[A]=v[A]);return x}function f(v){return typeof v.timestamp=="function"?v.timestamp:v.timestamp===!1?w:C}function g(){return{}}function p(v){return v}function m(){}function w(){return!1}function C(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function S(){function v(x){return typeof x<"u"&&x}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return v(self)||v(window)||v(this)||{}}}return ZR}o1t();const kw={getSIWX(){return we.state.siwx},async initializeIfEnabled(){var i;const e=we.state.siwx,t=J.getActiveCaipAddress();if(!(e&&t))return;const[n,r,s]=t.split(":");if(J.checkIfSupportedNetwork(n))try{if((await e.getSessions(`${n}:${r}`,s)).length)return;await ir.open({view:"SIWXSignMessage"})}catch(o){console.error("SIWXUtil:initializeIfEnabled",o),bn.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties()}),await((i=He._getClient())==null?void 0:i.disconnect().catch(console.error)),Le.reset("Connect"),vs.showError("A problem occurred while trying initialize authentication")}},async requestSignMessage(){const e=we.state.siwx,t=Re.getPlainAddress(J.getActiveCaipAddress()),n=J.getActiveCaipNetwork(),r=He._getClient();if(!e)throw new Error("SIWX is not enabled");if(!t)throw new Error("No ActiveCaipAddress found");if(!n)throw new Error("No ActiveCaipNetwork or client found");if(!r)throw new Error("No ConnectionController client found");try{const s=await e.createMessage({chainId:n.caipNetworkId,accountAddress:t}),i=s.toString();Pe.getConnectorId(n.chainNamespace)===$t.CONNECTOR_ID.AUTH&&Le.pushTransactionStack({});const a=await r.signMessage(i);await e.addSession({data:s,message:i,signature:a}),ir.close(),bn.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(s){const i=this.getSIWXEventProperties();(!ir.state.open||Le.state.view==="ApproveTransaction")&&await ir.open({view:"SIWXSignMessage"}),i.isSmartAccount?vs.showError("This application might not support Smart Accounts"):vs.showError("Signature declined"),bn.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:i}),console.error("SWIXUtil:requestSignMessage",s)}},async cancelSignMessage(){var e;try{const t=this.getSIWX();((e=t==null?void 0:t.getRequired)==null?void 0:e.call(t))?await He.disconnect():ir.close(),Le.reset("Connect"),bn.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(t){console.error("SIWXUtil:cancelSignMessage",t)}},async getSessions(){const e=we.state.siwx,t=Re.getPlainAddress(J.getActiveCaipAddress()),n=J.getActiveCaipNetwork();return e&&t&&n?e.getSessions(n.caipNetworkId,t):[]},async isSIWXCloseDisabled(){var t;const e=this.getSIWX();if(e){const n=Le.state.view==="ApproveTransaction",r=Le.state.view==="SIWXSignMessage";if(n||r)return((t=e.getRequired)==null?void 0:t.call(e))&&(await this.get
vendor: 40,211 bytes, line 155
155Sessions()).length===0}return!1},async universalProviderAuthenticate({universalProvider:e,chains:t,methods:n}){var a,c,l;const r=kw.getSIWX(),s=new Set(t.map(u=>u.split(":")[0]));if(!r||s.size!==1||!s.has("eip155"))return!1;const i=await r.createMessage({chainId:((a=J.getActiveCaipNetwork())==null?void 0:a.caipNetworkId)||"",accountAddress:""}),o=await e.authenticate({nonce:i.nonce,domain:i.domain,uri:i.uri,exp:i.expirationTime,iat:i.issuedAt,nbf:i.notBefore,requestId:i.requestId,version:i.version,resources:i.resources,statement:i.statement,chainId:i.chainId,methods:n,chains:[i.chainId,...t.filter(u=>u!==i.chainId)]});if(vs.showLoading("Authenticating...",{autoClose:!1}),Et.setConnectedWalletInfo({...o.session.peer.metadata,name:o.session.peer.metadata.name,icon:(c=o.session.peer.metadata.icons)==null?void 0:c[0],type:"WALLET_CONNECT"},Array.from(s)[0]),(l=o==null?void 0:o.auths)!=null&&l.length){const u=o.auths.map(d=>{const h=e.client.formatAuthMessage({request:d.p,iss:d.p.iss});return{data:{...d.p,accountAddress:d.p.iss.split(":").slice(-1).join(""),chainId:d.p.iss.split(":").slice(2,4).join(":"),uri:d.p.aud,version:d.p.version||i.version,expirationTime:d.p.exp,issuedAt:d.p.iat,notBefore:d.p.nbf},message:h,signature:d.s.s,cacao:d}});try{await r.setSessions(u),bn.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:kw.getSIWXEventProperties()})}catch(d){throw console.error("SIWX:universalProviderAuth - failed to set sessions",d),bn.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:kw.getSIWXEventProperties()}),await e.disconnect().catch(console.error),d}finally{vs.hide()}}return!0},getSIWXEventProperties(){var t,n;const e=J.state.activeChain;return{network:((t=J.state.activeCaipNetwork)==null?void 0:t.caipNetworkId)||"",isSmartAccount:((n=Et.state.preferredAccountTypes)==null?void 0:n[e])===m8.ACCOUNT_TYPES.SMART_ACCOUNT}},async clearSessions(){const e=this.getSIWX();e&&await e.setSessions([])}},Jye={isUnsupportedChainView(){return Le.state.view==="UnsupportedChain"||Le.state.view==="SwitchNetwork"&&Le.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){ir.shake();return}if(await kw.isSIWXCloseDisabled()){ir.shake();return}ir.close()}};var a1t=Object.defineProperty,c1t=(e,t,n)=>t in e?a1t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zre=(e,t,n)=>c1t(e,typeof t!="symbol"?t+"":t,n);let l1t=class extends Wr{constructor(t){super(),this.opts=t,zre(this,"protocol","wc"),zre(this,"version",2)}};var u1t=Object.defineProperty,d1t=(e,t,n)=>t in e?u1t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h1t=(e,t,n)=>d1t(e,t+"",n);let f1t=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n,h1t(this,"records",new Map)}},p1t=class{constructor(t,n){this.logger=t,this.core=n}},g1t=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},m1t=class extends Wr{constructor(t){super()}},w1t=class{constructor(t,n,r,s){this.core=t,this.logger=n,this.name=r}},y1t=class extends Wr{constructor(t,n){super(),this.relayer=t,this.logger=n}},b1t=class extends Wr{constructor(t,n){super(),this.core=t,this.logger=n}},v1t=class{constructor(t,n,r){this.core=t,this.logger=n,this.store=r}},E1t=class{constructor(t,n){this.projectId=t,this.logger=n}},C1t=class{constructor(t,n,r){this.core=t,this.logger=n,this.telemetryEnabled=r}};function Xye(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function b8(e,t){t||(t=e.reduce((s,i)=>s+i.length,0));const n=Xye(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function Qye(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const qre=Qye("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),YR=Qye("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=Xye(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),ebe={utf8:qre,"utf-8":qre,hex:JS.base16,latin1:YR,ascii:YR,binary:YR,...JS};function pc(e,t="utf8"){const n=ebe[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,"utf8"):n.decoder.decode(`${n.prefix}${e}`)}function So(e,t="utf8"){const n=ebe[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):n.encoder.encode(e).substring(1)}var $1t={};const x1t="ReactNative",Id={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},I1t="js";function NA(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function wb(){return!cn.getDocument()&&!!cn.getNavigator()&&navigator.product===x1t}function S1t(){return wb()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="android"}function A1t(){return wb()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"&&(globalThis==null?void 0:globalThis.Platform.OS)==="ios"}function u$(){return!NA()&&!!cn.getNavigator()&&!!cn.getDocument()}function ET(){return wb()?Id.reactNative:NA()?Id.node:u$()?Id.browser:Id.unknown}function Wre(){var e;try{return wb()&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Application)<"u"?(e=globalThis.Application)==null?void 0:e.applicationId:void 0}catch{return}}function _1t(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const s=t[r];s!==void 0&&n.set(r,s)}return n.toString()}function N1t(){return gC.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function T1t(){if(ET()===Id.reactNative&&typeof globalThis<"u"&&typeof(globalThis==null?void 0:globalThis.Platform)<"u"){const{OS:n,Version:r}=globalThis.Platform;return[n,r].join("-")}const e=MN();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function P1t(){var e;const t=ET();return t===Id.browser?[t,((e=cn.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function tbe(e,t,n){const r=T1t(),s=P1t();return[[e,t].join("-"),[I1t,n].join("-"),r,s].join("/")}function O1t({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:s,projectId:i,useOnCloseEvent:o,bundleId:a,packageName:c}){const l=n.split("?"),u=tbe(e,t,r),d={auth:s,ua:u,projectId:i,useOnCloseEvent:o,packageName:c||void 0,bundleId:a||void 0},h=_1t(l[1]||"",d);return l[0]+"?"+h}function _j(e){return Object.fromEntries(e.entries())}function Nj(e){return new Map(Object.entries(e))}function k1t(e=V.FIVE_MINUTES,t){const n=V.toMiliseconds(e||V.FIVE_MINUTES);let r,s,i,o;return{resolve:a=>{i&&r&&(clearTimeout(i),r(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const l=new Error(t);o=Promise.reject(l),c(l)},n),r=a,s=c})}}function dm(e,t,n){return new Promise(async(r,s)=>{const i=setTimeout(()=>s(new Error(n)),t);try{const o=await e;r(o)}catch(o){s(o)}clearTimeout(i)})}function nbe(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function R1t(e){return nbe("topic",e)}function B1t(e){return nbe("id",e)}function D1t(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function v8(e,t){return V.fromMiliseconds(Date.now()+V.toMiliseconds(e))}function Hre(e){return Date.now()>=V.toMiliseconds(e)}function JR(e,t){return`${e}${t?`:${t}`:""}`}function Vre(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function rbe(){return typeof process<"u"&&$1t.IS_VITEST==="true"}function sbe(e){return Buffer.from(e,"base64").toString("utf-8")}function U1t(e){return new Promise(t=>setTimeout(t,e))}function f4(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function L1t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function d$(e,...t){if(!L1t(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function aV(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");f4(e.outputLen),f4(e.blockLen)}function w5(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ibe(e,t){d$(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const EI=BigInt(2**32-1),Kre=BigInt(32);function M1t(e,t=!1){return t?{h:Number(e&EI),l:Number(e>>Kre&EI)}:{h:Number(e>>Kre&EI)|0,l:Number(e&EI)|0}}function j1t(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:o}=M1t(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const F1t=(e,t,n)=>e<<n|t>>>32-n,z1t=(e,t,n)=>t<<n|e>>>32-n,q1t=(e,t,n)=>t<<n-32|e>>>64-n,W1t=(e,t,n)=>e<<n-32|t>>>64-n,b2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function H1t(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function XR(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function vh(e,t){return e<<32-t|e>>>t}const Gre=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function V1t(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Zre(e){for(let t=0;t<e.length;t++)e[t]=V1t(e[t])}function K1t(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function y5(e){return typeof e=="string"&&(e=K1t(e)),d$(e),e}function G1t(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];d$(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}let cV=class{clone(){return this._cloneInto()}};function obe(e){const t=r=>e().update(y5(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function U6(e=32){if(b2&&typeof b2.getRandomValues=="function")return b2.getRandomValues(new Uint8Array(e));if(b2&&typeof b2.randomBytes=="function")return b2.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const abe=[],cbe=[],lbe=[],Z1t=BigInt(0),rE=BigInt(1),Y1t=BigInt(2),J1t=BigInt(7),X1t=BigInt(256),Q1t=BigInt(113);for(let e=0,t=rE,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],abe.push(2*(5*r+n)),cbe.push((e+1)*(e+2)/2%64);let s=Z1t;for(let i=0;i<7;i++)t=(t<<rE^(t>>J1t)*Q1t)%X1t,t&Y1t&&(s^=rE<<(rE<<BigInt(i))-rE);lbe.push(s)}const[ewt,twt]=j1t(lbe,!0),Yre=(e,t,n)=>n>32?q1t(e,t,n):F1t(e,t,n),Jre=(e,t,n)=>n>32?W1t(e,t,n):z1t(e,t,n);function nwt(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=Yre(l,u,1)^n[a],h=Jre(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=cbe[o],c=Yre(s,i,a),l=Jre(s,i,a),u=abe[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=ewt[r],e[1]^=twt[r]}n.fill(0)}let rwt=class ube extends cV{constructor(t,n,r,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,f4(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=H1t(this.state)}keccak(){Gre||Zre(this.state32),nwt(this.state32,this.rounds),Gre||Zre(this.state32),this.posOut=0,this.pos=0}update(t){w5(this);const{blockLen:n,state:r}=this;t=y5(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){w5(this,!1),d$(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return f4(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ibe(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new ube(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}};const swt=(e,t,n)=>obe(()=>new rwt(t,e,n));swt(1,136,256/8);function QR(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function dbe(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function el(e,...t){if(!dbe(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Xre(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function iwt(e,t){el(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Qre(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}const Am=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),owt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),awt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!awt)throw new Error("Non little-endian hardware is not supported");function cwt(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Tj(e){if(typeof e=="string")e=cwt(e);else if(dbe(e))e=Pj(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function lwt(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function uwt(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const dwt=(e,t)=>{function n(r,...s){if(el(r),e.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?el(l):el(l,e.nonceLength)}const i=e.tagLength;i&&s[1]!==void 0&&el(s[1]);const o=t(r,...s),a=(l,u)=>{if(u!==void 0){if(l!==2)throw new Error("cipher output not supported");el(u)}};let c=!1;return{encrypt(l,u){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,el(l),a(o.encrypt.length,u),o.encrypt(l,u)},decrypt(l,u){if(el(l),i&&l.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,u),o.decrypt(l,u)}}}return Object.assign(n,e),n};function ese(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!hwt(t))throw new Error("invalid output, must be aligned");return t}function tse(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i);e.setUint32(t+4,o,r),e.setUint32(t+0,a,r)}function hwt(e){return e.byteOffset%4===0}function Pj(e){return Uint8Array.from(e)}function b5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const hbe=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),fwt=hbe("expand 16-byte k"),pwt=hbe("expand 32-byte k"),gwt=Am(fwt),mwt=Am(pwt);function Hn(e,t){return e<<t|e>>>32-t}function Oj(e){return e.byteOffset%4===0}const CI=64,wwt=16,fbe=2**32-1,nse=new Uint32Array;function ywt(e,t,n,r,s,i,o,a){const c=s.length,l=new Uint8Array(CI),u=Am(l),d=Oj(s)&&Oj(i),h=d?Am(s):nse,f=d?Am(i):nse;for(let g=0;g<c;o++){if(e(t,n,r,u,o,a),o>=fbe)throw new Error("arx: counter overflow");const p=Math.min(CI,c-g);if(d&&p===CI){const m=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let w=0,C;w<wwt;w++)C=m+w,f[C]=h[C]^u[w];g+=CI;continue}for(let m=0,w;m<p;m++)w=g+m,i[w]=s[w]^l[m];g+=p}}function bwt(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:s,counterRight:i,rounds:o}=lwt({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return QR(s),QR(o),Qre(i),Qre(n),(a,c,l,u,d=0)=>{el(a),el(c),el(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),el(u),QR(d),d<0||d>=fbe)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g=a.length,p,m;if(g===32)f.push(p=Pj(a)),m=mwt;else if(g===16&&n)p=new Uint8Array(32),p.set(a),p.set(a,16),m=gwt,f.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${g}`);Oj(c)||f.push(c=Pj(c));const w=Am(p);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,w,Am(c.subarray(0,16)),w),c=c.subarray(16)}const C=16-s;if(C!==c.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const b=new Uint8Array(12);b.set(c,i?0:12-c.length),c=b,f.push(c)}const E=Am(c);return ywt(e,m,w,E,l,u,d,o),b5(...f),u}}const zi=(e,t)=>e[t++]&255|(e[t++]&255)<<8;let vwt=class{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=Tj(t),el(t,32);const n=zi(t,0),r=zi(t,2),s=zi(t,4),i=zi(t,6),o=zi(t,8),a=zi(t,10),c=zi(t,12),l=zi(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=zi(t,16+2*u)}process(t,n,r=!1){const s=r?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],l=o[2],u=o[3],d=o[4],h=o[5],f=o[6],g=o[7],p=o[8],m=o[9],w=zi(t,n+0),C=zi(t,n+2),E=zi(t,n+4),b=zi(t,n+6),S=zi(t,n+8),v=zi(t,n+10),x=zi(t,n+12),A=zi(t,n+14);let I=i[0]+(w&8191),O=i[1]+((w>>>13|C<<3)&8191),N=i[2]+((C>>>10|E<<6)&8191),T=i[3]+((E>>>7|b<<9)&8191),P=i[4]+((b>>>4|S<<12)&8191),_=i[5]+(S>>>1&8191),y=i[6]+((S>>>14|v<<2)&8191),$=i[7]+((v>>>11|x<<5)&8191),R=i[8]+((x>>>8|A<<8)&8191),B=i[9]+(A>>>5|s),k=0,D=k+I*a+O*(5*m)+N*(5*p)+T*(5*g)+P*(5*f);k=D>>>13,D&=8191,D+=_*(5*h)+y*(5*d)+$*(5*u)+R*(5*l)+B*(5*c),k+=D>>>13,D&=8191;let U=k+I*c+O*a+N*(5*m)+T*(5*p)+P*(5*g);k=U>>>13,U&=8191,U+=_*(5*f)+y*(5*h)+$*(5*d)+R*(5*u)+B*(5*l),k+=U>>>13,U&=8191;let F=k+I*l+O*c+N*a+T*(5*m)+P*(5*p);k=F>>>13,F&=8191,F+=_*(5*g)+y*(5*f)+$*(5*h)+R*(5*d)+B*(5*u),k+=F>>>13,F&=8191;let K=k+I*u+O*l+N*c+T*a+P*(5*m);k=K>>>13,K&=8191,K+=_*(5*p)+y*(5*g)+$*(5*f)+R*(5*h)+B*(5*d),k+=K>>>13,K&=8191;let q=k+I*d+O*u+N*l+T*c+P*a;k=q>>>13,q&=8191,q+=_*(5*m)+y*(5*p)+$*(5*g)+R*(5*f)+B*(5*h),k+=q>>>13,q&=8191;let H=k+I*h+O*d+N*u+T*l+P*c;k=H>>>13,H&=8191,H+=_*a+y*(5*m)+$*(5*p)+R*(5*g)+B*(5*f),k+=H>>>13,H&=8191;let Z=k+I*f+O*h+N*d+T*u+P*l;k=Z>>>13,Z&=8191,Z+=_*c+y*a+$*(5*m)+R*(5*p)+B*(5*g),k+=Z>>>13,Z&=8191;let ee=k+I*g+O*f+N*h+T*d+P*u;k=ee>>>13,ee&=8191,ee+=_*l+y*c+$*a+R*(5*m)+B*(5*p),k+=ee>>>13,ee&=8191;let ie=k+I*p+O*g+N*f+T*h+P*d;k=ie>>>13,ie&=8191,ie+=_*u+y*l+$*c+R*a+B*(5*m),k+=ie>>>13,ie&=8191;let X=k+I*m+O*p+N*g+T*f+P*h;k=X>>>13,X&=8191,X+=_*d+y*u+$*l+R*c+B*a,k+=X>>>13,X&=8191,k=(k<<2)+k|0,k=k+D|0,D=k&8191,k=k>>>13,U+=k,i[0]=D,i[1]=U,i[2]=F,i[3]=K,i[4]=q,i[5]=H,i[6]=Z,i[7]=ee,i[8]=ie,i[9]=X}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let s=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=s,s=t[a]>>>13,t[a]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,r[0]=t[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+n[0];t[0]=o&65535;for(let a=1;a<8;a++)o=(t[a]+n[a]|0)+(o>>>16)|0,t[a]=o&65535;b5(r)}update(t){Xre(this);const{buffer:n,blockLen:r}=this;t=Tj(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o===r){for(;r<=s-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){b5(this.h,this.r,this.buffer,this.pad)}digestInto(t){Xre(this),iwt(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)t[i++]=r[o]>>>0,t[i++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}};function Ewt(e){const t=(r,s)=>e(s).update(Tj(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Cwt=Ewt(e=>new vwt(e));function $wt(e,t,n,r,s,i=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],d=t[1],h=t[2],f=t[3],g=t[4],p=t[5],m=t[6],w=t[7],C=s,E=n[0],b=n[1],S=n[2],v=o,x=a,A=c,I=l,O=u,N=d,T=h,P=f,_=g,y=p,$=m,R=w,B=C,k=E,D=b,U=S;for(let K=0;K<i;K+=2)v=v+O|0,B=Hn(B^v,16),_=_+B|0,O=Hn(O^_,12),v=v+O|0,B=Hn(B^v,8),_=_+B|0,O=Hn(O^_,7),x=x+N|0,k=Hn(k^x,16),y=y+k|0,N=Hn(N^y,12),x=x+N|0,k=Hn(k^x,8),y=y+k|0,N=Hn(N^y,7),A=A+T|0,D=Hn(D^A,16),$=$+D|0,T=Hn(T^$,12),A=A+T|0,D=Hn(D^A,8),$=$+D|0,T=Hn(T^$,7),I=I+P|0,U=Hn(U^I,16),R=R+U|0,P=Hn(P^R,12),I=I+P|0,U=Hn(U^I,8),R=R+U|0,P=Hn(P^R,7),v=v+N|0,U=Hn(U^v,16),$=$+U|0,N=Hn(N^$,12),v=v+N|0,U=Hn(U^v,8),$=$+U|0,N=Hn(N^$,7),x=x+T|0,B=Hn(B^x,16),R=R+B|0,T=Hn(T^R,12),x=x+T|0,B=Hn(B^x,8),R=R+B|0,T=Hn(T^R,7),A=A+P|0,k=Hn(k^A,16),_=_+k|0,P=Hn(P^_,12),A=A+P|0,k=Hn(k^A,8),_=_+k|0,P=Hn(P^_,7),I=I+O|0,D=Hn(D^I,16),y=y+D|0,O=Hn(O^y,12),I=I+O|0,D=Hn(D^I,8),y=y+D|0,O=Hn(O^y,7);let F=0;r[F++]=o+v|0,r[F++]=a+x|0,r[F++]=c+A|0,r[F++]=l+I|0,r[F++]=u+O|0,r[F++]=d+N|0,r[F++]=h+T|0,r[F++]=f+P|0,r[F++]=g+_|0,r[F++]=p+y|0,r[F++]=m+$|0,r[F++]=w+R|0,r[F++]=C+B|0,r[F++]=E+k|0,r[F++]=b+D|0,r[F++]=S+U|0}const xwt=bwt($wt,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Iwt=new Uint8Array(16),rse=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(Iwt.subarray(n))},Swt=new Uint8Array(32);function sse(e,t,n,r,s){const i=e(t,n,Swt),o=Cwt.create(i);s&&rse(o,s),rse(o,r);const a=new Uint8Array(16),c=owt(a);tse(c,0,BigInt(s?s.length:0),!0),tse(c,8,BigInt(r.length),!0),o.update(a);const l=o.digest();return b5(i,a),l}const Awt=e=>(t,n,r)=>({encrypt(s,i){const o=s.length;i=ese(o+16,i,!1),i.set(s);const a=i.subarray(0,-16);e(t,n,a,a,1);const c=sse(e,t,n,a,r);return i.set(c,o),b5(c),i},decrypt(s,i){i=ese(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=sse(e,t,n,o,r);if(!uwt(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),b5(c),i}}),pbe=dwt({blockSize:64,nonceLength:12,tagLength:16},Awt(xwt));let gbe=class extends cV{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,aV(t);const r=y5(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(t){return w5(this),this.iHash.update(t),this}digestInto(t){w5(this),d$(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const CT=(e,t,n)=>new gbe(e,t).update(n).digest();CT.create=(e,t)=>new gbe(e,t);function _wt(e,t,n){return aV(e),n===void 0&&(n=new Uint8Array(e.outputLen)),CT(e,y5(n),y5(t))}const eB=new Uint8Array([0]),ise=new Uint8Array;function Nwt(e,t,n,r=32){if(aV(e),f4(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/e.outputLen);n===void 0&&(n=ise);const i=new Uint8Array(s*e.outputLen),o=CT.create(e,t),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let l=0;l<s;l++)eB[0]=l+1,a.update(l===0?ise:c).update(n).update(eB).digestInto(c),i.set(c,e.outputLen*l),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),eB.fill(0),i.slice(0,r)}const Twt=(e,t,n,r,s)=>Nwt(e,_wt(e,t,n),r,s);function Pwt(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}function Owt(e,t,n){return e&t^~e&n}function kwt(e,t,n){return e&t^e&n^t&n}let Rwt=class extends cV{constructor(t,n,r,s){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=XR(this.buffer)}update(t){w5(this);const{view:n,buffer:r,blockLen:s}=this;t=y5(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=XR(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){w5(this),ibe(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;Pwt(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=XR(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.length=s,t.pos=a,t.finished=i,t.destroyed=o,s%n&&t.buffer.set(r),t}};const Bwt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),xg=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ig=new Uint32Array(64);let Dwt=class extends Rwt{constructor(){super(64,32,8,!1),this.A=xg[0]|0,this.B=xg[1]|0,this.C=xg[2]|0,this.D=xg[3]|0,this.E=xg[4]|0,this.F=xg[5]|0,this.G=xg[6]|0,this.H=xg[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Ig[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=Ig[d-15],f=Ig[d-2],g=vh(h,7)^vh(h,18)^h>>>3,p=vh(f,17)^vh(f,19)^f>>>10;Ig[d]=p+Ig[d-7]+g+Ig[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=vh(a,6)^vh(a,11)^vh(a,25),f=u+h+Owt(a,c,l)+Bwt[d]+Ig[d]|0,g=(vh(r,2)^vh(r,13)^vh(r,22))+kwt(r,s,i)|0;u=l,l=c,c=a,a=o+f|0,o=i,i=s,s=r,r=f+g|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,c,l,u)}roundClean(){Ig.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const h$=obe(()=>new Dwt);const $T=BigInt(0),xT=BigInt(1),Uwt=BigInt(2);function ay(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function f$(e){if(!ay(e))throw new Error("Uint8Array expected")}function v5(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}const Lwt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function E5(e){f$(e);let t="";for(let n=0;n<e.length;n++)t+=Lwt[e[n]];return t}function $v(e){const t=e.toString(16);return t.length&1?"0"+t:t}function lV(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?$T:BigInt("0x"+e)}const Gf={_0:48,_9:57,A:65,F:70,a:97,f:102};function ose(e){if(e>=Gf._0&&e<=Gf._9)return e-Gf._0;if(e>=Gf.A&&e<=Gf.F)return e-(Gf.A-10);if(e>=Gf.a&&e<=Gf.f)return e-(Gf.a-10)}function C5(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=ose(e.charCodeAt(i)),a=ose(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Rw(e){return lV(E5(e))}function p4(e){return f$(e),lV(E5(Uint8Array.from(e).reverse()))}function $5(e,t){return C5(e.toString(16).padStart(t*2,"0"))}function IT(e,t){return $5(e,t).reverse()}function Mwt(e){return C5($v(e))}function Xc(e,t,n){let r;if(typeof t=="string")try{r=C5(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(ay(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function g4(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];f$(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}function jwt(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Fwt(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}const tB=e=>typeof e=="bigint"&&$T<=e;function ST(e,t,n){return tB(e)&&tB(t)&&tB(n)&&t<=e&&e<n}function c0(e,t,n,r){if(!ST(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function mbe(e){let t;for(t=0;e>$T;e>>=xT,t+=1);return t}function zwt(e,t){return e>>BigInt(t)&xT}function qwt(e,t,n){return e|(n?xT:$T)<<BigInt(t)}const uV=e=>(Uwt<<BigInt(e-1))-xT,nB=e=>new Uint8Array(e),ase=e=>Uint8Array.from(e);function wbe(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=nB(e),s=nB(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...u)=>n(s,r,...u),c=(u=nB())=>{s=a(ase([0]),u),r=a(),u.length!==0&&(s=a(ase([1]),u),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<t;){r=a();const h=r.slice();d.push(h),u+=r.length}return g4(...d)};return(u,d)=>{o(),c(u);let h;for(;!(h=d(l()));)c();return o(),h}}const Wwt={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||ay(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function L6(e,t,n={}){const r=(s,i,o)=>{const a=Wwt[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}const Hwt=()=>{throw new Error("not implemented")};function kj(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}var Vwt=Object.freeze({__proto__:null,isBytes:ay,abytes:f$,abool:v5,bytesToHex:E5,numberToHexUnpadded:$v,hexToNumber:lV,hexToBytes:C5,bytesToNumberBE:Rw,bytesToNumberLE:p4,numberToBytesBE:$5,numberToBytesLE:IT,numberToVarBytesBE:Mwt,ensureBytes:Xc,concatBytes:g4,equalBytes:jwt,utf8ToBytes:Fwt,inRange:ST,aInRange:c0,bitLen:mbe,bitGet:zwt,bitSet:qwt,bitMask:uV,createHmacDrbg:wbe,validateObject:L6,notImplemented:Hwt,memoized:kj});const Si=BigInt(0),ws=BigInt(1),ew=BigInt(2),Kwt=BigInt(3),Rj=BigInt(4),cse=BigInt(5),lse=BigInt(8);function ec(e,t){const n=e%t;return n>=Si?n:t+n}function ybe(e,t,n){if(t<Si)throw new Error("invalid exponent, negatives unsupported");if(n<=Si)throw new Error("invalid modulus");if(n===ws)return Si;let r=ws;for(;t>Si;)t&ws&&(r=r*e%n),e=e*e%n,t>>=ws;return r}function dd(e,t,n){let r=e;for(;t-- >Si;)r*=r,r%=n;return r}function Bj(e,t){if(e===Si)throw new Error("invert: expected non-zero number");if(t<=Si)throw new Error("invert: expected positive modulus, got "+t);let n=ec(e,t),r=t,s=Si,i=ws;for(;n!==Si;){const o=r/n,a=r%n,c=s-i*o;r=n,n=a,s=i,i=c}if(r!==ws)throw new Error("invert: does not exist");return ec(s,t)}function Gwt(e){const t=(e-ws)/ew;let n,r,s;for(n=e-ws,r=0;n%ew===Si;n/=ew,r++);for(s=ew;s<e&&ybe(s,t,e)!==e-ws;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+ws)/Rj;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const i=(n+ws)/ew;return function(o,a){if(o.pow(a,t)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,s),n),u=o.pow(a,i),d=o.pow(a,n);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let h=1;for(let g=o.sqr(d);h<c&&!o.eql(g,o.ONE);h++)g=o.sqr(g);const f=o.pow(l,ws<<BigInt(c-h-1));l=o.sqr(f),u=o.mul(u,f),d=o.mul(d,l),c=h}return u}}function Zwt(e){if(e%Rj===Kwt){const t=(e+ws)/Rj;return function(n,r){const s=n.pow(r,t);if(!n.eql(n.sqr(s),r))throw new Error("Cannot find square root");return s}}if(e%lse===cse){const t=(e-cse)/lse;return function(n,r){const s=n.mul(r,ew),i=n.pow(s,t),o=n.mul(r,i),a=n.mul(n.mul(o,ew),i),c=n.mul(o,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),r))throw new Error("Cannot find square root");return c}}return Gwt(e)}const Ywt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Jwt(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Ywt.reduce((r,s)=>(r[s]="function",r),t);return L6(e,n)}function Xwt(e,t,n){if(n<Si)throw new Error("invalid exponent, negatives unsupported");if(n===Si)return e.ONE;if(n===ws)return t;let r=e.ONE,s=t;for(;n>Si;)n&ws&&(r=e.mul(r,s)),s=e.sqr(s),n>>=ws;return r}function Qwt(e,t){const n=new Array(t.length),r=t.reduce((i,o,a)=>e.is0(o)?i:(n[a]=i,e.mul(i,o)),e.ONE),s=e.inv(r);return t.reduceRight((i,o,a)=>e.is0(o)?i:(n[a]=e.mul(i,n[a]),e.mul(i,o)),s),n}function bbe(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function vbe(e,t,n=!1,r={}){if(e<=Si)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=bbe(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:uV(s),ZERO:Si,ONE:ws,create:c=>ec(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Si<=c&&c<e},is0:c=>c===Si,isOdd:c=>(c&ws)===ws,neg:c=>ec(-c,e),eql:(c,l)=>c===l,sqr:c=>ec(c*c,e),add:(c,l)=>ec(c+l,e),sub:(c,l)=>ec(c-l,e),mul:(c,l)=>ec(c*l,e),pow:(c,l)=>Xwt(a,c,l),div:(c,l)=>ec(c*Bj(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>Bj(c,e),sqrt:r.sqrt||(c=>(o||(o=Zwt(e)),o(a,c))),invertBatch:c=>Qwt(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>n?IT(c,i):$5(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?p4(c):Rw(c)}});return Object.freeze(a)}function Ebe(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Cbe(e){const t=Ebe(e);return t+Math.ceil(t/2)}function eyt(e,t,n=!1){const r=e.length,s=Ebe(t),i=Cbe(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?p4(e):Rw(e),a=ec(o,t-ws)+ws;return n?IT(a,s):$5(a,s)}const use=BigInt(0),$I=BigInt(1);function rB(e,t){const n=t.negate();return e?n:t}function $be(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function sB(e,t){$be(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1);return{windows:n,windowSize:r}}function tyt(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function nyt(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const iB=new WeakMap,xbe=new WeakMap;function oB(e){return xbe.get(e)||1}function ryt(e,t){return{constTimeNegate:rB,hasPrecomputes(n){return oB(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>use;)r&$I&&(s=s.add(i)),i=i.double(),r>>=$I;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=sB(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){const{windows:i,windowSize:o}=sB(n,t);let a=e.ZERO,c=e.BASE;const l=BigInt(2**n-1),u=2**n,d=BigInt(n);for(let h=0;h<i;h++){const f=h*o;let g=Number(s&l);s>>=d,g>o&&(g-=u,s+=$I);const p=f,m=f+Math.abs(g)-1,w=h%2!==0,C=g<0;g===0?c=c.add(rB(w,r[p])):a=a.add(rB(C,r[m]))}return{p:a,f:c}},wNAFUnsafe(n,r,s,i=e.ZERO){const{windows:o,windowSize:a}=sB(n,t),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let d=0;d<o;d++){const h=d*a;if(s===use)break;let f=Number(s&c);if(s>>=u,f>a&&(f-=l,s+=$I),f===0)continue;let g=r[h+Math.abs(f)-1];f<0&&(g=g.negate()),i=i.add(g)}return i},getPrecomputes(n,r,s){let i=iB.get(r);
vendor: 4,818 bytes, line 155
155return i||(i=this.precomputeWindow(r,n),n!==1&&iB.set(r,s(i))),i},wNAFCached(n,r,s){const i=oB(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=oB(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){$be(r,t),xbe.set(n,r),iB.delete(n)}}}function syt(e,t,n,r){if(tyt(n,e),nyt(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,i=mbe(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((t.BITS-1)/o)*o;let u=s;for(let d=l;d>=0;d-=o){c.fill(s);for(let f=0;f<r.length;f++){const g=r[f],p=Number(g>>BigInt(d)&BigInt(a));c[p]=c[p].add(n[f])}let h=s;for(let f=c.length-1,g=s;f>0;f--)g=g.add(c[f]),h=h.add(g);if(u=u.add(h),d!==0)for(let f=0;f<o;f++)u=u.double()}return u}function Ibe(e){return Jwt(e.Fp),L6(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...bbe(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const v2=BigInt(0),aB=BigInt(1);function iyt(e){return L6(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})}function oyt(e){const t=iyt(e),{P:n}=t,r=C=>ec(C,n),s=t.montgomeryBits,i=Math.ceil(s/8),o=t.nByteLength,a=t.adjustScalarBytes||(C=>C),c=t.powPminus2||(C=>ybe(C,n-BigInt(2),n));function l(C,E,b){const S=r(C*(E-b));return E=r(E-S),b=r(b+S),[E,b]}const u=(t.a-BigInt(2))/BigInt(4);function d(C,E){c0("u",C,v2,n),c0("scalar",E,v2,n);const b=E,S=C;let v=aB,x=v2,A=C,I=aB,O=v2,N;for(let P=BigInt(s-1);P>=v2;P--){const _=b>>P&aB;O^=_,N=l(O,v,A),v=N[0],A=N[1],N=l(O,x,I),x=N[0],I=N[1],O=_;const y=v+x,$=r(y*y),R=v-x,B=r(R*R),k=$-B,D=A+I,U=A-I,F=r(U*y),K=r(D*R),q=F+K,H=F-K;A=r(q*q),I=r(S*r(H*H)),v=r($*B),x=r(k*($+r(u*k)))}N=l(O,v,A),v=N[0],A=N[1],N=l(O,x,I),x=N[0],I=N[1];const T=c(x);return r(v*T)}function h(C){return IT(r(C),i)}function f(C){const E=Xc("u coordinate",C,i);return o===32&&(E[31]&=127),p4(E)}function g(C){const E=Xc("scalar",C),b=E.length;if(b!==i&&b!==o){let S=""+i+" or "+o;throw new Error("invalid scalar, expected "+S+" bytes, got "+b)}return p4(a(E))}function p(C,E){const b=f(E),S=g(C),v=d(b,S);if(v===v2)throw new Error("invalid private or public key received");return h(v)}const m=h(t.Gu);function w(C){return p(C,m)}return{scalarMult:p,scalarMultBase:w,getSharedSecret:(C,E)=>p(C,E),getPublicKey:C=>w(C),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:m}}const Dj=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const ayt=BigInt(1),dse=BigInt(2),cyt=BigInt(3),lyt=BigInt(5);BigInt(8);function uyt(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=Dj,o=e*e%i*e%i,a=dd(o,dse,i)*o%i,c=dd(a,ayt,i)*e%i,l=dd(c,lyt,i)*c%i,u=dd(l,t,i)*l%i,d=dd(u,n,i)*u%i,h=dd(d,r,i)*d%i,f=dd(h,s,i)*h%i,g=dd(f,s,i)*h%i,p=dd(g,t,i)*l%i;return{pow_p_5_8:dd(p,dse,i)*e%i,b2:o}}function dyt(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const Uj=oyt({P:Dj,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=Dj,{pow_p_5_8:n,b2:r}=uyt(e);return ec(dd(n,cyt,t)*r,t)},adjustScalarBytes:dyt,randomBytes:U6});function hse(e){e.lowS!==void 0&&v5("lowS",e.lowS),e.prehash!==void 0&&v5("prehash",e.prehash)}function hyt(e){const t=Ibe(e);L6(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:fyt,hexToBytes:pyt}=Vwt;let gyt=class extends Error{constructor(t=""){super(t)}};const Tp={Err:gyt,_tlv:{encode:(e,t)=>{const{Err:n}=Tp;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=$v(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?$v(s.length/2|128):"";return $v(e)+i+s+t},decode(e,t){const{Err:n}=Tp;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);
vendor: 17,034 bytes, line 155
155if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Tp;if(e<Fp)throw new t("integer: negative integers are not allowed");let n=$v(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Tp;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return fyt(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Tp,s=typeof e=="string"?pyt(e):e;f$(s);const{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Tp,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}},Fp=BigInt(0),fi=BigInt(1);BigInt(2);const fse=BigInt(3);BigInt(4);function myt(e){const t=hyt(e),{Fp:n}=t,r=vbe(t.n,t.nBitLength),s=t.toBytes||((p,m,w)=>{const C=m.toAffine();return g4(Uint8Array.from([4]),n.toBytes(C.x),n.toBytes(C.y))}),i=t.fromBytes||(p=>{const m=p.subarray(1),w=n.fromBytes(m.subarray(0,n.BYTES)),C=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:w,y:C}});function o(p){const{a:m,b:w}=t,C=n.sqr(p),E=n.mul(C,p);return n.add(n.add(E,n.mul(p,m)),w)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return ST(p,fi,t.n)}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:w,wrapPrivateKey:C,n:E}=t;if(m&&typeof p!="bigint"){if(ay(p)&&(p=E5(p)),typeof p!="string"||!m.includes(p.length))throw new Error("invalid private key");p=p.padStart(w*2,"0")}let b;try{b=typeof p=="bigint"?p:Rw(Xc("private key",p,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof p)}return C&&(b=ec(b,E)),c0("private key",b,fi,E),b}function l(p){if(!(p instanceof h))throw new Error("ProjectivePoint expected")}const u=kj((p,m)=>{const{px:w,py:C,pz:E}=p;if(n.eql(E,n.ONE))return{x:w,y:C};const b=p.is0();m==null&&(m=b?n.ONE:n.inv(E));const S=n.mul(w,m),v=n.mul(C,m),x=n.mul(E,m);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(x,n.ONE))throw new Error("invZ was invalid");return{x:S,y:v}}),d=kj(p=>{if(p.is0()){if(t.allowInfinityPoint&&!n.is0(p.py))return;throw new Error("bad point: ZERO")}const{x:m,y:w}=p.toAffine();if(!n.isValid(m)||!n.isValid(w))throw new Error("bad point: x or y not FE");const C=n.sqr(w),E=o(m);if(!n.eql(C,E))throw new Error("bad point: equation left != right");if(!p.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(m,w,C){if(this.px=m,this.py=w,this.pz=C,m==null||!n.isValid(m))throw new Error("x required");if(w==null||!n.isValid(w))throw new Error("y required");if(C==null||!n.isValid(C))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:w,y:C}=m||{};if(!m||!n.isValid(w)||!n.isValid(C))throw new Error("invalid affine point");if(m instanceof h)throw new Error("projective point not allowed");const E=b=>n.eql(b,n.ZERO);return E(w)&&E(C)?h.ZERO:new h(w,C,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const w=n.invertBatch(m.map(C=>C.pz));return m.map((C,E)=>C.toAffine(w[E])).map(h.fromAffine)}static fromHex(m){const w=h.fromAffine(i(Xc("pointHex",m)));return w.assertValidity(),w}static fromPrivateKey(m){return h.BASE.multiply(c(m))}static msm(m,w){return syt(h,r,m,w)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){l(m);const{px:w,py:C,pz:E}=this,{px:b,py:S,pz:v}=m,x=n.eql(n.mul(w,v),n.mul(b,E)),A=n.eql(n.mul(C,v),n.mul(S,E));return x&&A}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:w}=t,C=n.mul(w,fse),{px:E,py:b,pz:S}=this;let v=n.ZERO,x=n.ZERO,A=n.ZERO,I=n.mul(E,E),O=n.mul(b,b),N=n.mul(S,S),T=n.mul(E,b);return T=n.add(T,T),A=n.mul(E,S),A=n.add(A,A),v=n.mul(m,A),x=n.mul(C,N),x=n.add(v,x),v=n.sub(O,x),x=n.add(O,x),x=n.mul(v,x),v=n.mul(T,v),A=n.mul(C,A),N=n.mul(m,N),T=n.sub(I,N),T=n.mul(m,T),T=n.add(T,A),A=n.add(I,I),I=n.add(A,I),I=n.add(I,N),I=n.mul(I,T),x=n.add(x,I),N=n.mul(b,S),N=n.add(N,N),I=n.mul(N,T),v=n.sub(v,I),A=n.mul(N,O),A=n.add(A,A),A=n.add(A,A),new h(v,x,A)}add(m){l(m);const{px:w,py:C,pz:E}=this,{px:b,py:S,pz:v}=m;let x=n.ZERO,A=n.ZERO,I=n.ZERO;const O=t.a,N=n.mul(t.b,fse);let T=n.mul(w,b),P=n.mul(C,S),_=n.mul(E,v),y=n.add(w,C),$=n.add(b,S);y=n.mul(y,$),$=n.add(T,P),y=n.sub(y,$),$=n.add(w,E);let R=n.add(b,v);return $=n.mul($,R),R=n.add(T,_),$=n.sub($,R),R=n.add(C,E),x=n.add(S,v),R=n.mul(R,x),x=n.add(P,_),R=n.sub(R,x),I=n.mul(O,$),x=n.mul(N,_),I=n.add(x,I),x=n.sub(P,I),I=n.add(P,I),A=n.mul(x,I),P=n.add(T,T),P=n.add(P,T),_=n.mul(O,_),$=n.mul(N,$),P=n.add(P,_),_=n.sub(T,_),_=n.mul(O,_),$=n.add($,_),T=n.mul(P,$),A=n.add(A,T),T=n.mul(R,$),x=n.mul(y,x),x=n.sub(x,T),T=n.mul(y,P),I=n.mul(R,I),I=n.add(I,T),new h(x,A,I)}subtract(m){return this.add(m.negate())}is0(){return this.equals(h.ZERO)}wNAF(m){return g.wNAFCached(this,m,h.normalizeZ)}multiplyUnsafe(m){const{endo:w,n:C}=t;c0("scalar",m,Fp,C);const E=h.ZERO;if(m===Fp)return E;if(this.is0()||m===fi)return this;if(!w||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,h.normalizeZ);let{k1neg:b,k1:S,k2neg:v,k2:x}=w.splitScalar(m),A=E,I=E,O=this;for(;S>Fp||x>Fp;)S&fi&&(A=A.add(O)),x&fi&&(I=I.add(O)),O=O.double(),S>>=fi,x>>=fi;return b&&(A=A.negate()),v&&(I=I.negate()),I=new h(n.mul(I.px,w.beta),I.py,I.pz),A.add(I)}multiply(m){const{endo:w,n:C}=t;c0("scalar",m,fi,C);let E,b;if(w){const{k1neg:S,k1:v,k2neg:x,k2:A}=w.splitScalar(m);let{p:I,f:O}=this.wNAF(v),{p:N,f:T}=this.wNAF(A);I=g.constTimeNegate(S,I),N=g.constTimeNegate(x,N),N=new h(n.mul(N.px,w.beta),N.py,N.pz),E=I.add(N),b=O.add(T)}else{const{p:S,f:v}=this.wNAF(m);E=S,b=v}return h.normalizeZ([E,b])[0]}multiplyAndAddUnsafe(m,w,C){const E=h.BASE,b=(v,x)=>x===Fp||x===fi||!v.equals(E)?v.multiplyUnsafe(x):v.multiply(x),S=b(this,w).add(b(m,C));return S.is0()?void 0:S}toAffine(m){return u(this,m)}isTorsionFree(){const{h:m,isTorsionFree:w}=t;if(m===fi)return!0;if(w)return w(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:w}=t;return m===fi?this:w?w(h,this):this.multiplyUnsafe(t.h)}toRawBytes(m=!0){return v5("isCompressed",m),this.assertValidity(),s(h,this,m)}toHex(m=!0){return v5("isCompressed",m),E5(this.toRawBytes(m))}}h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const f=t.nBitLength,g=ryt(h,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function wyt(e){const t=Ibe(e);return L6(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function yyt(e){const t=wyt(e),{Fp:n,n:r}=t,s=n.BYTES+1,i=2*n.BYTES+1;function o(_){return ec(_,r)}function a(_){return Bj(_,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:d}=myt({...t,toBytes(_,y,$){const R=y.toAffine(),B=n.toBytes(R.x),k=g4;return v5("isCompressed",$),$?k(Uint8Array.from([y.hasEvenY()?2:3]),B):k(Uint8Array.from([4]),B,n.toBytes(R.y))},fromBytes(_){const y=_.length,$=_[0],R=_.subarray(1);if(y===s&&($===2||$===3)){const B=Rw(R);if(!ST(B,fi,n.ORDER))throw new Error("Point is not on curve");const k=u(B);let D;try{D=n.sqrt(k)}catch(F){const K=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+K)}const U=(D&fi)===fi;return($&1)===1!==U&&(D=n.neg(D)),{x:B,y:D}}else if(y===i&&$===4){const B=n.fromBytes(R.subarray(0,n.BYTES)),k=n.fromBytes(R.subarray(n.BYTES,2*n.BYTES));return{x:B,y:k}}else{const B=s,k=i;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+k+", got "+y)}}}),h=_=>E5($5(_,t.nByteLength));function f(_){const y=r>>fi;return _>y}function g(_){return f(_)?o(-_):_}const p=(_,y,$)=>Rw(_.slice(y,$));class m{constructor(y,$,R){this.r=y,this.s=$,this.recovery=R,this.assertValidity()}static fromCompact(y){const $=t.nByteLength;return y=Xc("compactSignature",y,$*2),new m(p(y,0,$),p(y,$,2*$))}static fromDER(y){const{r:$,s:R}=Tp.toSig(Xc("DER",y));return new m($,R)}assertValidity(){c0("r",this.r,fi,r),c0("s",this.s,fi,r)}addRecoveryBit(y){return new m(this.r,this.s,y)}recoverPublicKey(y){const{r:$,s:R,recovery:B}=this,k=v(Xc("msgHash",y));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const D=B===2||B===3?$+t.n:$;if(D>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const U=(B&1)===0?"02":"03",F=c.fromHex(U+h(D)),K=a(D),q=o(-k*K),H=o(R*K),Z=c.BASE.multiplyAndAddUnsafe(F,q,H);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return C5(this.toDERHex())}toDERHex(){return Tp.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return C5(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const w={isValidPrivateKey(_){try{return l(_),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const _=Cbe(t.n);return eyt(t.randomBytes(_),t.n)},precompute(_=8,y=c.BASE){return y._setWindowSize(_),y.multiply(BigInt(3)),y}};function C(_,y=!0){return c.fromPrivateKey(_).toRawBytes(y)}function E(_){const y=ay(_),$=typeof _=="string",R=(y||$)&&_.length;return y?R===s||R===i:$?R===2*s||R===2*i:_ instanceof c}function b(_,y,$=!0){if(E(_))throw new Error("first arg must be private key");if(!E(y))throw new Error("second arg must be public key");return c.fromHex(y).multiply(l(_)).toRawBytes($)}const S=t.bits2int||function(_){if(_.length>8192)throw new Error("input is too large");const y=Rw(_),$=_.length*8-t.nBitLength;return $>0?y>>BigInt($):y},v=t.bits2int_modN||function(_){return o(S(_))},x=uV(t.nBitLength);function A(_){return c0("num < 2^"+t.nBitLength,_,Fp,x),$5(_,t.nByteLength)}function I(_,y,$=O){if(["recovered","canonical"].some(ie=>ie in $))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:B}=t;let{lowS:k,prehash:D,extraEntropy:U}=$;k==null&&(k=!0),_=Xc("msgHash",_),hse($),D&&(_=Xc("prehashed msgHash",R(_)));const F=v(_),K=l(y),q=[A(K),A(F)];if(U!=null&&U!==!1){const ie=U===!0?B(n.BYTES):U;q.push(Xc("extraEntropy",ie))}const H=g4(...q),Z=F;function ee(ie){const X=S(ie);if(!d(X))return;const le=a(X),_e=c.BASE.multiply(X).toAffine(),Ne=o(_e.x);if(Ne===Fp)return;const be=o(le*o(Z+Ne*K));if(be===Fp)return;let Me=(_e.x===Ne?0:2)|Number(_e.y&fi),Ct=be;return k&&f(be)&&(Ct=g(be),Me^=1),new m(Ne,Ct,Me)}return{seed:H,k2sig:ee}}const O={lowS:t.lowS,prehash:!1},N={lowS:t.lowS,prehash:!1};function T(_,y,$=O){const{seed:R,k2sig:B}=I(_,y,$),k=t;return wbe(k.hash.outputLen,k.nByteLength,k.hmac)(R,B)}c.BASE._setWindowSize(8);function P(_,y,$,R=N){var be;const B=_;y=Xc("msgHash",y),$=Xc("publicKey",$);const{lowS:k,prehash:D,format:U}=R;if(hse(R),"strict"in R)throw new Error("options.strict was renamed to lowS");if(U!==void 0&&U!=="compact"&&U!=="der")throw new Error("format must be compact or der");const F=typeof B=="string"||ay(B),K=!F&&!U&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!F&&!K)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let q,H;try{if(K&&(q=new m(B.r,B.s)),F){try{U!=="compact"&&(q=m.fromDER(B))}catch(Me){if(!(Me instanceof Tp.Err))throw Me}!q&&U!=="der"&&(q=m.fromCompact(B))}H=c.fromHex($)}catch{return!1}if(!q||k&&q.hasHighS())return!1;D&&(y=t.hash(y));const{r:Z,s:ee}=q,ie=v(y),X=a(ee),le=o(ie*X),_e=o(Z*X),Ne=(be=c.BASE.multiplyAndAddUnsafe(H,le,_e))==null?void 0:be.toAffine();return Ne?o(Ne.x)===Z:!1}return{CURVE:t,getPublicKey:C,getSharedSecret:b,sign:T,verify:P,ProjectivePoint:c,Signature:m,utils:w}}function byt(e){return{hash:e,hmac:(t,...n)=>CT(e,t,G1t(...n)),randomBytes:U6}}function vyt(e,t){const n=r=>yyt({...e,...byt(r)});return{...n(t),create:n}}const Sbe=vbe(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),Eyt=Sbe.create(BigInt("-3")),Cyt=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),$yt=vyt({a:Eyt,b:Cyt,Fp:Sbe,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},h$),Abe="base10",aa="base16",Bw="base64pad",dV="base64url",p$="utf8",_be=0,M6=1,AT=2,xyt=0,pse=1,E8=12,hV=32;function Iyt(){const e=Uj.utils.randomPrivateKey(),t=Uj.getPublicKey(e);return{privateKey:So(e,aa),publicKey:So(t,aa)}}function Lj(){const e=U6(hV);return So(e,aa)}function Syt(e,t){const n=Uj.getSharedSecret(pc(e,aa),pc(t,aa)),r=Twt(h$,n,void 0,void 0,hV);return So(r,aa)}function Ayt(e){const t=h$(pc(e,aa));return So(t,aa)}function OS(e){const t=h$(pc(e,p$));return So(t,aa)}function Nbe(e){return pc(`${e}`,Abe)}function cy(e){return Number(So(e,Abe))}function Tbe(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Pbe(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}function _yt(e){const t=Nbe(typeof e.type<"u"?e.type:_be);if(cy(t)===M6&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?pc(e.senderPublicKey,aa):void 0,r=typeof e.iv<"u"?pc(e.iv,aa):U6(E8),s=pc(e.symKey,aa),i=pbe(s,r).encrypt(pc(e.message,p$)),o=Obe({type:t,sealed:i,iv:r,senderPublicKey:n});return e.encoding===dV?Tbe(o):o}function Nyt(e){const t=pc(e.symKey,aa),{sealed:n,iv:r}=m4({encoded:e.encoded,encoding:e.encoding}),s=pbe(t,r).decrypt(n);if(s===null)throw new Error("Failed to decrypt");return So(s,p$)}function Tyt(e,t){const n=Nbe(AT),r=U6(E8),s=pc(e,p$),i=Obe({type:n,sealed:s,iv:r});return t===dV?Tbe(i):i}function Pyt(e,t){const{sealed:n}=m4({encoded:e,encoding:t});return So(n,p$)}function Obe(e){if(cy(e.type)===AT)return So(b8([e.type,e.sealed]),Bw);if(cy(e.type)===M6){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return So(b8([e.type,e.senderPublicKey,e.iv,e.sealed]),Bw)}return So(b8([e.type,e.iv,e.sealed]),Bw)}function m4(e){const t=(e.encoding||Bw)===dV?Pbe(e.encoded):e.encoded,n=pc(t,Bw),r=n.slice(xyt,pse),s=pse;if(cy(r)===M6){const c=s+hV,l=c+E8,u=n.slice(s,c),d=n.slice(c,l),h=n.slice(l);return{type:r,sealed:h,iv:d,senderPublicKey:u}}if(cy(r)===AT){const c=n.slice(s),l=U6(E8);return{type:r,sealed:c,iv:l}}const i=s+E8,o=n.slice(s,i),a=n.slice(i);return{type:r,sealed:a,iv:o}}function Oyt(e,t){const n=m4({encoded:e,encoding:t==null?void 0:t.encoding});return kbe({type:cy(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?So(n.senderPublicKey,aa):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function kbe(e){const t=(e==null?void 0:e.type)||_be;if(t===M6){if(typeof(e==null?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(e==null?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:e==null?void 0:e.senderPublicKey,receiverPublicKey:e==null?void 0:e.receiverPublicKey}}function gse(e){return e.type===M6&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}function mse(e){return e.type===AT}function kyt(e){const t=Buffer.from(e.x,"base64"),n=Buffer.from(e.y,"base64");return b8([new Uint8Array([4]),t,n])}function Ryt(e,t){const[n,r,s]=e.split("."),i=Buffer.from(Pbe(s),"base64");if(i.length!==64)throw new Error("Invalid signature length");const o=i.slice(0,32),a=i.slice(32,64),c=`${n}.${r}`,l=h$(c),u=kyt(t);if(!$yt.verify(b8([o,a]),l,u))throw new Error("Invalid signature");return wu(e).payload}const Byt="irn";function TA(e){return(e==null?void 0:e.relay)||{protocol:Byt}}function jE(e){const t=ZN[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}function Dyt(e,t="-"){const n={},r="relay"+t;return Object.keys(e).forEach(s=>{if(s.startsWith(r)){const i=s.replace(r,""),o=e[s];n[i]=o}}),n}function wse(e){if(!e.includes("wc:")){const l=sbe(e);l!=null&&l.includes("wc:")&&(e=l)}e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),n=e.indexOf("?")!==-1?e.indexOf("?"):void 0,r=e.substring(0,t),s=e.substring(t+1,n).split("@"),i=typeof n<"u"?e.substring(n):"",o=new URLSearchParams(i),a={};o.forEach((l,u)=>{a[u]=l});
155const c=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:r,topic:Uyt(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:Dyt(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Uyt(e){return e.startsWith("//")?e.substring(2):e}function Lyt(e,t="-"){const n="relay",r={};return Object.keys(e).forEach(s=>{const i=s,o=n+t+i;e[i]&&(r[o]=e[i])}),r}function yse(e){const t=new URLSearchParams,n=Lyt(e.relay);Object.keys(n).sort().forEach(s=>{t.set(s,n[s])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));const r=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${r}`}const Myt={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},jyt={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function sr(e,t){const{message:n,code:r}=jyt[e];return{message:t?`${n} ${t}`:n,code:r}}function FE(e,t){const{message:n,code:r}=Myt[e];return{message:t?`${n} ${t}`:n,code:r}}function Mj(e){return typeof e>"u"}function Rbe(e,t){return typeof e=="string"&&!!e.trim().length}function Fyt(e){function t(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(Rbe(e,!1)){if(t(e))return!0;const n=sbe(e);return t(n)}}catch{}return!1}function zyt(e){var t;return(t=e==null?void 0:e.proposer)==null?void 0:t.publicKey}function qyt(e){return e==null?void 0:e.topic}function cB(e){return typeof e<"u"&&typeof e!==null}function bse(){const e=ET();return new Promise(t=>{switch(e){case Id.browser:t(Wyt());break;case Id.reactNative:t(Hyt());break;case Id.node:t(Vyt());break;default:t(!0)}})}function Wyt(){return u$()&&(navigator==null?void 0:navigator.onLine)}async function Hyt(){if(wb()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo){const e=await(globalThis==null?void 0:globalThis.NetInfo.fetch());return e==null?void 0:e.isConnected}return!0}function Vyt(){return!0}function Kyt(e){switch(ET()){case Id.browser:Gyt(e);break;case Id.reactNative:Zyt(e);break}}function Gyt(e){!wb()&&u$()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function Zyt(e){wb()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&(globalThis==null||globalThis.NetInfo.addEventListener(t=>e(t==null?void 0:t.isConnected)))}function Yyt(){var e;return u$()&&cn.getDocument()?((e=cn.getDocument())==null?void 0:e.visibilityState)==="visible":!0}var Jyt={};const Bbe="wc",Dbe=2,jj="core",af=`${Bbe}@2:${jj}:`,Xyt={logger:"error"},Qyt={database:":memory:"},ebt="crypto",vse="client_ed25519_seed",tbt=V.ONE_DAY,nbt="keychain",rbt="0.3",sbt="messages",ibt="0.3",Ese=V.SIX_HOURS,obt="publisher",Ube="irn",abt="error",Lbe="wss://relay.walletconnect.org",cbt="relayer",$i={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},lbt="_subscription",ql={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ubt=.1,Fj="2.21.0",Mr={link_mode:"link_mode",relay:"relay"},kS={inbound:"inbound",outbound:"outbound"},dbt="0.3",hbt="WALLETCONNECT_CLIENT_ID",Cse="WALLETCONNECT_LINK_MODE_APPS",Kc={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},fbt="subscription",pbt="0.3",gbt="pairing",mbt="0.3",sE={wc_pairingDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:V.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:V.ONE_DAY,prompt:!1,tag:0},res:{ttl:V.ONE_DAY,prompt:!1,tag:0}}},tw={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nd={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},wbt="history",ybt="0.3",bbt="expirer",tu={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},vbt="0.3",Ebt="verify-api",Cbt="https://verify.walletconnect.com",Mbe="https://verify.walletconnect.org",C8=Mbe,$bt=`${C8}/v3`,xbt=[Cbt,Mbe],Ibt="echo",Sbt="https://echo.walletconnect.com",Nh={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},mp={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},rd={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},L1={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},M1={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"}
vendor: 7,085 bytes, line 155
155,iE={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},Abt=.1,_bt="event-client",Nbt=86400,Tbt="https://pulse.walletconnect.org/batch";function Pbt(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<e.length;s++){var i=e.charAt(s),o=i.charCodeAt(0);if(n[o]!==255)throw new TypeError(i+" is ambiguous");n[o]=s}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function d(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var p=0,m=0,w=0,C=g.length;w!==C&&g[w]===0;)w++,p++;for(var E=(C-w)*u+1>>>0,b=new Uint8Array(E);w!==C;){for(var S=g[w],v=0,x=E-1;(S!==0||v<m)&&x!==-1;x--,v++)S+=256*b[x]>>>0,b[x]=S%a>>>0,S=S/a>>>0;if(S!==0)throw new Error("Non-zero carry");m=v,w++}for(var A=E-m;A!==E&&b[A]===0;)A++;for(var I=c.repeat(p);A<E;++A)I+=e.charAt(b[A]);return I}function h(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var p=0;if(g[p]!==" "){for(var m=0,w=0;g[p]===c;)m++,p++;for(var C=(g.length-p)*l+1>>>0,E=new Uint8Array(C);g[p];){var b=n[g.charCodeAt(p)];if(b===255)return;for(var S=0,v=C-1;(b!==0||S<w)&&v!==-1;v--,S++)b+=a*E[v]>>>0,E[v]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");w=S,p++}if(g[p]!==" "){for(var x=C-w;x!==C&&E[x]===0;)x++;for(var A=new Uint8Array(m+(C-x)),I=m;x!==C;)A[I++]=E[x++];return A}}}function f(g){var p=h(g);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:h,decode:f}}var Obt=Pbt,kbt=Obt;const jbe=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Rbt=e=>new TextEncoder().encode(e),Bbt=e=>new TextDecoder().decode(e);let Dbt=class{constructor(t,n,r){this.name=t,this.prefix=n,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},Ubt=class{constructor(t,n,r){if(this.name=t,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Fbe(this,t)}},Lbt=class{constructor(t){this.decoders=t}or(t){return Fbe(this,t)}decode(t){const n=t[0],r=this.decoders[n];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Fbe=(e,t)=>new Lbt({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});let Mbt=class{constructor(t,n,r,s){this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new Dbt(t,n,r),this.decoder=new Ubt(t,n,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};const _T=({name:e,prefix:t,encode:n,decode:r})=>new Mbt(e,t,n,r),g$=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:s}=kbt(n,t);return _T({prefix:e,name:t,encode:r,decode:i=>jbe(s(i))})},jbt=(e,t,n,r)=>{const s={};for(let u=0;u<t.length;++u)s[t[u]]=u;let i=e.length;for(;e[i-1]==="=";)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,l=0;for(let u=0;u<i;++u){const d=s[e[u]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);c=c<<n|d,a+=n,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o},Fbt=(e,t,n)=>{const r=t[t.length-1]==="=",s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>n;)o-=n,i+=t[s&a>>o];if(o&&(i+=t[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i},io=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>_T({prefix:t,name:e,encode(s){return Fbt(s,r,n)},decode(s){return jbt(s,r,n,e)}}),zbt=_T({prefix:"\0",name:"identity",encode:e=>Bbt(e),decode:e=>Rbt(e)});var qbt=Object.freeze({__proto__:null,identity:zbt});const Wbt=io({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Hbt=Object.freeze({__proto__:null,base2:Wbt});const Vbt=io({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Kbt=Object.freeze({__proto__:null,base8:Vbt});const Gbt=g$({prefix:"9",name:"base10",alphabet:"0123456789"});var Zbt=Object.freeze({__proto__:null,base10:Gbt});const Ybt=io({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Jbt=io({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Xbt=Object.freeze({__proto__:null,base16:Ybt,base16upper:Jbt});const Qbt=io({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),e2t=io({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),t2t=io({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),n2t=io({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),r2t=io({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),s2t=io({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),i2t=io({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),o2t=io({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),a2t=io({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var c2t=Object.freeze({__proto__:null,base32:Qbt,base32upper:e2t,base32pad:t2t,base32padupper:n2t,base32hex:r2t,base32hexupper:s2t,base32hexpad:i2t,base32hexpadupper:o2t,base32z:a2t});const l2t=g$({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),u2t=g$({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var d2t=Object.freeze({__proto__:null,base36:l2t,base36upper:u2t});const h2t=g$({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),f2t=g$({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var p2t=Object.freeze({__proto__:null,base58btc:h2t,base58flickr:f2t});const g2t=io({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
155+/",bitsPerChar:6}),m2t=io({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w2t=io({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),y2t=io({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var b2t=Object.freeze({__proto__:null,base64:g2t,base64pad:m2t,base64url:w2t,base64urlpad:y2t});const zbe=Array.from("ððªâð°ðððððððððððððâð»ð¥ð¾ð¿ðâ¤ðð¤£ððððððð
ððð¥ð¥°ðððð¢ð¤ðððªðâºðð¤ððððð¹ð¤¦ððââ¨ð¤·ð±ðð¸ððððððððð¤©ððð¤ðð¯ððð¶ðð¤â£ððððªðð¥ððð©ð¡ð¤ªðð¥³ð¥ð¤¤ððð³âððð´ðð¬ððð·ð»ðââ
ð¥ºððð¤ð¦âð£ððâ¹ððð âððºðð»ððððð¹ð£ð«ðððµð¤ðð´ð¤ð¼ð«â½ð¤âðð¤«ðð®ðð»ðð¶ðð²ð¿ð§¡ðâ¡ððââðð°ð¤¨ð¶ð¤ð¶ð°ðð¢ð¤ðð¨ð¨ð¤¬âððºð¤ððð±ðð¶ð¥´â¶â¡âðð¸â¬ð¨ðð¦ð·ðºâ ð
ððµðð¤²ð¤ ð¤§ððµð
ð§ð¾ððð¤ðð¤¯ð·âð§ð¯ððð¤ððâð´ð£ð¸ððð¥ð¤¢ð
ð¡ð©ðð¸ð»ð¤ð¤®ð¼ð¥µð©ððð¼ðð£ð¥"),v2t=zbe.reduce((e,t,n)=>(e[n]=t,e),[]),E2t=zbe.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function C2t(e){return e.reduce((t,n)=>(t+=v2t[n],t),"")}function $2t(e){const t=[];for(const n of e){const r=E2t[n.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${n}`);t.push(r)}return new Uint8Array(t)}const x2t=_T({prefix:"ð",name:"base256emoji",encode:C2t,decode:$2t});var I2t=Object.freeze({__proto__:null,base256emoji:x2t}),S2t=qbe,$se=128,A2t=-128,_2t=Math.pow(2,31);function qbe(e,t,n){t=t||[],n=n||0;for(var r=n;e>=_2t;)t[n++]=e&255|$se,e/=128;for(;e&A2t;)t[n++]=e&255|$se,e>>>=7;return t[n]=e|0,qbe.bytes=n-r+1,t}var N2t=zj,T2t=128,xse=127;function zj(e,r){var n=0,r=r||0,s=0,i=r,o,a=e.length;do{if(i>=a)throw zj.bytes=0,new RangeError("Could not decode varint");o=e[i++],n+=s<28?(o&xse)<<s:(o&xse)*Math.pow(2,s),s+=7}while(o>=T2t);return zj.bytes=i-r,n}var P2t=Math.pow(2,7),O2t=Math.pow(2,14),k2t=Math.pow(2,21),R2t=Math.pow(2,28),B2t=Math.pow(2,35),D2t=Math.pow(2,42),U2t=Math.pow(2,49),L2t=Math.pow(2,56),M2t=Math.pow(2,63),j2t=function(e){return e<P2t?1:e<O2t?2:e<k2t?3:e<R2t?4:e<B2t?5:e<D2t?6:e<U2t?7:e<L2t?8:e<M2t?9:10},F2t={encode:S2t,decode:N2t,encodingLength:j2t},Wbe=F2t;const Ise=(e,t,n=0)=>(Wbe.encode(e,t,n),t),Sse=e=>Wbe.encodingLength(e),qj=(e,t)=>{const n=t.byteLength,r=Sse(e),s=r+Sse(n),i=new Uint8Array(s+n);return Ise(e,i,0),Ise(n,i,r),i.set(t,s),new z2t(e,n,t,i)};let z2t=class{constructor(t,n,r,s){this.code=t,this.size=n,this.digest=r,this.bytes=s}};const Hbe=({name:e,code:t,encode:n})=>new q2t(e,t,n);class q2t{constructor(t,n,r){this.name=t,this.code=n,this.encode=r}digest(t){if(t instanceof Uint8Array){const n=this.encode(t);return n instanceof Uint8Array?qj(this.code,n):n.then(r=>qj(this.code,r))}else throw Error("Unknown type, must be binary type")}}const Vbe=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),W2t=Hbe({name:"sha2-256",code:18,encode:Vbe("SHA-256")}),H2t=Hbe({name:"sha2-512",code:19,encode:Vbe("SHA-512")});var V2t=Object.freeze({__proto__:null,sha256:W2t,sha512:H2t});const Kbe=0,K2t="identity",Gbe=jbe,G2t=e=>qj(Kbe,Gbe(e)),Z2t={code:Kbe,name:K2t,encode:Gbe,digest:G2t};var Y2t=Object.freeze({__proto__:null,identity:Z2t});new TextEncoder,new TextDecoder;const Ase={...qbt,...Hbt,...Kbt,...Zbt,...Xbt,...c2t,...d2t,...p2t,...b2t,...I2t};({...V2t,...Y2t});function J2t(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function Zbe(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const _se=Zbe("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),lB=Zbe("ascii","a",e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);const t=J2t(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),X2t={utf8:_se,"utf-8":_se,hex:Ase.base16,latin1:lB,ascii:lB,binary:lB,...Ase};function Q2t(e,t="utf8"){const n=X2t[t];if(!n)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,"utf8"):n.decoder.decode(`${n.prefix}${e}`)}var evt=Object.defineProperty,tvt=(e,t,n)=>t in e?evt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eh=(e,t,n)=>tvt(e,typeof t!="symbol"?t+"":t,n);let nvt=class{constructor(t,n){this.core=t,this.logger=n,Eh(this,"keychain",new Map),Eh(this,"name",nbt),Eh(this,"version",rbt),Eh(this,"initialized",!1),Eh(this,"storagePrefix",af),Eh(this,"init",async()=>
vendor: 4,266 bytes, line 155
155{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),Eh(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),Eh(this,"set",async(r,s)=>{this.isInitialized(),this.keychain.set(r,s),await this.persist()}),Eh(this,"get",r=>{this.isInitialized();const s=this.keychain.get(r);if(typeof s>"u"){const{message:i}=sr("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(i)}return s}),Eh(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=pa(n,this.name)}get context(){return Cc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,_j(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Nj(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}};var rvt=Object.defineProperty,svt=(e,t,n)=>t in e?rvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qi=(e,t,n)=>svt(e,typeof t!="symbol"?t+"":t,n);let ivt=class{constructor(t,n,r){this.core=t,this.logger=n,qi(this,"name",ebt),qi(this,"keychain"),qi(this,"randomSessionIdentifier",Lj()),qi(this,"initialized",!1),qi(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),qi(this,"hasKeys",s=>(this.isInitialized(),this.keychain.has(s))),qi(this,"getClientId",async()=>{this.isInitialized();const s=await this.getClientSeed(),i=jm(s);return bC(i.publicKey)}),qi(this,"generateKeyPair",()=>{this.isInitialized();const s=Iyt();return this.setPrivateKey(s.publicKey,s.privateKey)}),qi(this,"signJWT",async s=>{this.isInitialized();const i=await this.getClientSeed(),o=jm(i),a=this.randomSessionIdentifier;return await KN(a,s,tbt,o)}),qi(this,"generateSharedKey",(s,i,o)=>{this.isInitialized();const a=this.getPrivateKey(s),c=Syt(a,i);return this.setSymKey(c,o)}),qi(this,"setSymKey",async(s,i)=>{this.isInitialized();const o=i||Ayt(s);return await this.keychain.set(o,s),o}),qi(this,"deleteKeyPair",async s=>{this.isInitialized(),await this.keychain.del(s)}),qi(this,"deleteSymKey",async s=>{this.isInitialized(),await this.keychain.del(s)}),qi(this,"encode",async(s,i,o)=>{this.isInitialized();const a=kbe(o),c=Ao(i);if(mse(a))return Tyt(c,o==null?void 0:o.encoding);if(gse(a)){const h=a.senderPublicKey,f=a.receiverPublicKey;s=await this.generateSharedKey(h,f)}const l=this.getSymKey(s),{type:u,senderPublicKey:d}=a;return _yt({type:u,symKey:l,message:c,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),qi(this,"decode",async(s,i,o)=>{this.isInitialized();const a=Oyt(i,o);if(mse(a)){const c=Pyt(i,o==null?void 0:o.encoding);return ul(c)}if(gse(a)){const c=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(c,l)}try{const c=this.getSymKey(s),l=Nyt({symKey:c,encoded:i,encoding:o==null?void 0:o.encoding});return ul(l)}catch(c){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(c)}}),qi(this,"getPayloadType",(s,i=Bw)=>{const o=m4({encoded:s,encoding:i});return cy(o.type)}),qi(this,"getPayloadSenderPublicKey",(s,i=Bw)=>{const o=m4({encoded:s,encoding:i});return o.senderPublicKey?So(o.senderPublicKey,aa):void 0}),this.core=t,this.logger=pa(n,this.name),this.keychain=r||new nvt(this.core,this.logger)}get context(){return Cc(this.logger)}async setPrivateKey(t,n){return await this.keychain.set(t,n),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(vse)}catch{t=Lj(),await this.keychain.set(vse,t)}return Q2t(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}};var ovt=Object.defineProperty,avt=Object.defineProperties,cvt=Object.getOwnPropertyDescriptors,Nse=Object.getOwnPropertySymbols,lvt=Object.prototype.hasOwnProperty,uvt=Object.prototype.propertyIsEnumerable,Wj=(e,t,n)=>t in e?ovt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dvt=(e,t)=>{for(var n in t||(t={}
155))lvt.call(t,n)&&Wj(e,n,t[n]);if(Nse)for(var n of Nse(t))uvt.call(t,n)&&Wj(e,n,t[n]);return e},hvt=(e,t)=>avt(e,cvt(t)),jc=(e,t,n)=>Wj(e,typeof t!="symbol"?t+"":t,n);let fvt=class extends p1t{constructor(t,n){super(t,n),this.logger=t,this.core=n,jc(this,"messages",new Map),jc(this,"messagesWithoutClientAck",new Map),jc(this,"name",sbt),jc(this,"version",ibt),jc(this,"initialized",!1),jc(this,"storagePrefix",af),jc(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const s=await this.getRelayerMessagesWithoutClientAck();typeof s<"u"&&(this.messagesWithoutClientAck=s),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),jc(this,"set",async(r,s,i)=>{this.isInitialized();const o=OS(s);let a=this.messages.get(r);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=s,this.messages.set(r,a),i===kS.inbound){const c=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,hvt(dvt({},c),{[o]:s}))}return await this.persist(),o}),jc(this,"get",r=>{this.isInitialized();let s=this.messages.get(r);return typeof s>"u"&&(s={}),s}),jc(this,"getWithoutAck",r=>{this.isInitialized();const s={};for(const i of r){const o=this.messagesWithoutClientAck.get(i)||{};s[i]=Object.values(o)}return s}),jc(this,"has",(r,s)=>{this.isInitialized();const i=this.get(r),o=OS(s);return typeof i[o]<"u"}),jc(this,"ack",async(r,s)=>{this.isInitialized();const i=this.messagesWithoutClientAck.get(r);if(typeof i>"u")return;const o=OS(s);delete i[o],Object.keys(i).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,i),await this.persist()}),jc(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=pa(t,this.name),this.core=n}get context(){return Cc(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,_j(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,_j(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Nj(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Nj(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}};var pvt=Object.defineProperty,gvt=Object.defineProperties,mvt=Object.getOwnPropertyDescriptors,Tse=Object.getOwnPropertySymbols,wvt=Object.prototype.hasOwnProperty,yvt=Object.prototype.propertyIsEnumerable,Hj=(e,t,n)=>t in e?pvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xI=(e,t)=>{for(var n in t||(t={}))wvt.call(t,n)&&Hj(e,n,t[n]);if(Tse)for(var n of Tse(t))yvt.call(t,n)&&Hj(e,n,t[n]);return e},uB=(e,t)=>gvt(e,mvt(t)),sd=(e,t,n)=>Hj(e,typeof t!="symbol"?t+"":t,n);class bvt extends g1t{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,sd(this,"events",new Dn.EventEmitter),sd(this,"name",obt),sd(this,"queue",new Map),sd(this,"publishTimeout",V.toMiliseconds(V.ONE_MINUTE)),sd(this,"initialPublishTimeout",V.toMiliseconds(V.ONE_SECOND*15)),sd(this,"needsTransportRestart",!1),sd(this,"publish",async(r,s,i)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:s,opts:i}});const a=(i==null?void 0:i.ttl)||Ese,c=TA(i),l=(i==null?void 0:i.prompt)||!1,u=(i==null?void 0:i.tag)||0,d=(i==null?void 0:i.id)||Ir().toString(),h={topic:r,message:s,opts:{ttl:a,relay:c,prompt:l,tag:u,id:d,attestation:i==null?void 0:i.attestation,tvf:i==null?void 0:i.tvf}},f=`Failed to publish payload, please try again. id:${d} tag:${u}`;try{const g=new Promise(async p=>{const m=({id:C})=>{h.opts.id===C&&(this.removeRequestFromQueue(C),this.relayer.events.removeListener($i.publish,m),p(h))};this.relayer.events.on($i.publish,m);const w=dm(new Promise((C,E)=>{this.rpcPublish({topic:r,message:s,ttl:a,prompt:l,tag:u,id:d,attestation:i==null?void 0:i.attestation,tvf:i==null?void 0:i.tvf}).then(C).catch(b=>{this.logger.warn(b,b==null?void 0:b.message),E(b)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${d} tag:${u}`);try{await w,this.events.removeListener($i.publish,m)}catch(C){this.queue.set(d,uB(xI({},h),{attempt:1})),this.logger.warn(C,C==null?void 0:C.message)}});this.logger.trace({type:"method",method:"publish",params:{id:d,topic:r,message:s,opts:i}}),await dm(g,this.publishTimeout,f)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(o=i==null?void 0:i.internal)!=null&&o.throwOnFailedPublish)throw g}finally{this.queue.delete(d)}}),sd(this,"on",(r,s)=>{this.events.on(r,s)}),sd(this,"once",(r,s)=>{this.events.once(r,s)}),sd(this,"off",(r,s)=>{this.events.off(r,s)}),sd(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.relayer=t,this.logger=pa(n,this.name),this.registerEventListeners()}get context(){return Cc(this.logger)}async rpcPublish(t){var n,r,s,i;const{topic:o,message:a,ttl:c=Ese,prompt:l,tag:u,id:d,attestation:h,tvf:f}=t,g={method:jE(TA().protocol).publish,params:xI({topic:o,message:a,ttl:c,prompt:l,tag:u,attestation:h},f),id:d};Mj((n=g.params)==null?void 0:n.prompt)&&((r=g.params)==null||delete r.prompt),Mj((s=g.params)==null?void 0:s.tag)&&((i=g.params)==null||delete i.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g});const p=await this.relayer.request(g);return this.relayer.events.emit($i.publish,t),this.logger.debug("Successfully Published Payload"),p}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,n)=>{const r=t.attempt+1;this.queue.set(n,uB(xI({},t),{attempt:r}));const{topic:s,message:i,opts:o,attestation:a}=t;this.logger.warn({},`Publisher: queue->publishing: ${t.opts.id}, tag: ${t.opts.tag}, attempt: ${r}`),await this.rpcPublish(uB(xI({},t),{topic:s,message:i,ttl:o.ttl,prompt:o.prompt,tag:o.tag,id:o.id,attestation:a,tvf:o.tvf})),this.logger.warn({},`Publisher: queue->published: ${t.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Hr.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit($i.connection_stalled);return}this.checkQueue()}),this.relayer.on($i.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var vvt=Object.defineProperty,Evt=(e,t,n)=>t in e?vvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
vendor: 58,532 bytes, line 155
155):e[t]=n,E2=(e,t,n)=>Evt(e,typeof t!="symbol"?t+"":t,n);class Cvt{constructor(){E2(this,"map",new Map),E2(this,"set",(t,n)=>{const r=this.get(t);this.exists(t,n)||this.map.set(t,[...r,n])}),E2(this,"get",t=>this.map.get(t)||[]),E2(this,"exists",(t,n)=>this.get(t).includes(n)),E2(this,"delete",(t,n)=>{if(typeof n>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,n))return;const s=r.filter(i=>i!==n);if(!s.length){this.map.delete(t);return}this.map.set(t,s)}),E2(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var $vt=Object.defineProperty,xvt=Object.defineProperties,Ivt=Object.getOwnPropertyDescriptors,Pse=Object.getOwnPropertySymbols,Svt=Object.prototype.hasOwnProperty,Avt=Object.prototype.propertyIsEnumerable,Vj=(e,t,n)=>t in e?$vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oE=(e,t)=>{for(var n in t||(t={}))Svt.call(t,n)&&Vj(e,n,t[n]);if(Pse)for(var n of Pse(t))Avt.call(t,n)&&Vj(e,n,t[n]);return e},dB=(e,t)=>xvt(e,Ivt(t)),Cr=(e,t,n)=>Vj(e,typeof t!="symbol"?t+"":t,n);let _vt=class extends y1t{constructor(t,n){super(t,n),this.relayer=t,this.logger=n,Cr(this,"subscriptions",new Map),Cr(this,"topicMap",new Cvt),Cr(this,"events",new Dn.EventEmitter),Cr(this,"name",fbt),Cr(this,"version",pbt),Cr(this,"pending",new Map),Cr(this,"cached",[]),Cr(this,"initialized",!1),Cr(this,"storagePrefix",af),Cr(this,"subscribeTimeout",V.toMiliseconds(V.ONE_MINUTE)),Cr(this,"initialSubscribeTimeout",V.toMiliseconds(V.ONE_SECOND*15)),Cr(this,"clientId"),Cr(this,"batchSubscribeTopicsLimit",500),Cr(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),Cr(this,"subscribe",async(r,s)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}});try{const i=TA(s),o={topic:r,relay:i,transportType:s==null?void 0:s.transportType};this.pending.set(r,o);const a=await this.rpcSubscribe(r,i,s);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:s}})),a}catch(i){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(i),i}}),Cr(this,"unsubscribe",async(r,s)=>{this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(r,s.id,s):await this.unsubscribeByTopic(r,s)}),Cr(this,"isSubscribed",r=>new Promise(s=>{s(this.topicMap.topics.includes(r))})),Cr(this,"isKnownTopic",r=>new Promise(s=>{s(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(i=>i.topic===r))})),Cr(this,"on",(r,s)=>{this.events.on(r,s)}),Cr(this,"once",(r,s)=>{this.events.once(r,s)}),Cr(this,"off",(r,s)=>{this.events.off(r,s)}),Cr(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),Cr(this,"start",async()=>{await this.onConnect()}),Cr(this,"stop",async()=>{await this.onDisconnect()}),Cr(this,"restart",async()=>{await this.restore(),await this.onRestart()}),Cr(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(s=>{r.push(s)}),await this.batchSubscribe(r)}),Cr(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Hr.pulse,async()=>{await this.checkPending()}),this.events.on(Kc.created,async r=>{const s=Kc.created;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()}),this.events.on(Kc.deleted,async r=>{const s=Kc.deleted;this.logger.info(`Emitting ${s}`),this.logger.debug({type:"event",event:s,data:r}),await this.persist()})}),this.relayer=t,this.logger=pa(n,this.name),this.clientId=""}get context(){return Cc(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}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,n){let r=!1;try{r=this.getSubscription(t).topic===n}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,n){const r=this.topicMap.get(t);await Promise.all(r.map(async s=>await this.unsubscribeById(t,s,n)))}async unsubscribeById(t,n,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}});try{const s=TA(r);await this.restartToComplete({topic:t,id:n,relay:s}),await this.rpcUnsubscribe(t,n,s);const i=FE("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,n,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:n,opts:r}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(t,n,r){var s;(!r||(r==null?void 0:r.transportType)===Mr.relay)&&await this.restartToComplete({topic:t,id:t,relay:n});const i={method:jE(n.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});const o=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{const a=await this.getSubscriptionId(t);if((r==null?void 0:r.transportType)===Mr.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(i).catch(u=>this.logger.warn(u))},V.toMiliseconds(V.ONE_SECOND)),a;const c=new Promise(async u=>{const d=h=>{h.topic===t&&(this.events.removeListener(Kc.created,d),u(h.id))};this.events.on(Kc.created,d);try{const h=await dm(new Promise((f,g)=>{this.relayer.request(i).catch(p=>{this.logger.warn(p,p==null?void 0:p.message),g(p)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(Kc.created,d),u(h)}catch{}}),l=await dm(c,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!l&&o)throw new Error(`Subscribing to ${t} failed, please try again`);return l?a:null}catch(a){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit($i.connection_stalled),o)throw a}return null}async rpcBatchSubscribe(t){if(!t.length)return;const n=t[0].relay,r={method:jE(n.protocol).batchSubscribe,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await dm(new Promise(s=>{this.relayer.request(r).catch(i=>this.logger.warn(i)).then(s)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit($i.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const n=t[0].relay,r={method:jE(n.protocol).batchFetchMessages,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let s;try{s=await await dm(new Promise((i,o)=>{this.relayer.request(r).catch(a=>{this.logger.warn(a),o(a)}).then(i)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit($i.connection_stalled)}return s}rpcUnsubscribe(t,n,r){const s={method:jE(r.protocol).unsubscribe,params:{topic:t,id:n}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(t,n){this.setSubscription(t,dB(oE({},n),{id:t})),this.pending.delete(n.topic)}onBatchSubscribe(t){t.length&&t.forEach(n=>{this.setSubscription(n.id,oE({},n)),this.pending.delete(n.topic)})}async onUnsubscribe(t,n,r){this.events.removeAllListeners(n),this.hasSubscription(n,t)&&this.deleteSubscription(n,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,n){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:n}),this.addSubscription(t,n)}addSubscription(t,n){this.subscriptions.set(t,oE({},n)),this.topicMap.set(n.topic,t),this.events.emit(Kc.created,n)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const n=this.subscriptions.get(t);if(!n){const{message:r}=sr("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}deleteSubscription(t,n){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:n});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(Kc.deleted,dB(oE({},r),{reason:n}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Kc.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],n=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<n;r++){const s=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(s)}}this.events.emit(Kc.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size){const{message:n}=sr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async n=>dB(oE({},n),{id:await this.getSubscriptionId(n.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const n=await this.rpcBatchFetchMessages(t);n&&n.messages&&(await U1t(V.toMiliseconds(V.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(n.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return OS(t+await this.getClientId())}};var Nvt=Object.defineProperty,Ose=Object.getOwnPropertySymbols,Tvt=Object.prototype.hasOwnProperty,Pvt=Object.prototype.propertyIsEnumerable,Kj=(e,t,n)=>t in e?Nvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kse=(e,t)=>{for(var n in t||(t={}))Tvt.call(t,n)&&Kj(e,n,t[n]);if(Ose)for(var n of Ose(t))Pvt.call(t,n)&&Kj(e,n,t[n]);return e},Vn=(e,t,n)=>Kj(e,typeof t!="symbol"?t+"":t,n);let Ovt=class extends m1t{constructor(t){super(t),Vn(this,"protocol","wc"),Vn(this,"version",2),Vn(this,"core"),Vn(this,"logger"),Vn(this,"events",new Dn.EventEmitter),Vn(this,"provider"),Vn(this,"messages"),Vn(this,"subscriber"),Vn(this,"publisher"),Vn(this,"name",cbt),Vn(this,"transportExplicitlyClosed",!1),Vn(this,"initialized",!1),Vn(this,"connectionAttemptInProgress",!1),Vn(this,"relayUrl"),Vn(this,"projectId"),Vn(this,"packageName"),Vn(this,"bundleId"),Vn(this,"hasExperiencedNetworkDisruption",!1),Vn(this,"pingTimeout"),Vn(this,"heartBeatTimeout",V.toMiliseconds(V.THIRTY_SECONDS+V.FIVE_SECONDS)),Vn(this,"reconnectTimeout"),Vn(this,"connectPromise"),Vn(this,"reconnectInProgress",!1),Vn(this,"requestsInFlight",[]),Vn(this,"connectTimeout",V.toMiliseconds(V.ONE_SECOND*15)),Vn(this,"request",async n=>{var r,s;this.logger.debug("Publishing Request Payload");const i=n.id||Ir().toString();await this.toEstablishConnection();try{this.logger.trace({id:i,method:n.method,topic:(r=n.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${i}:${((s=n.params)==null?void 0:s.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(n);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${i}`),o}}),Vn(this,"resetPingTimeout",()=>{NA()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var n,r,s,i;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(i=(s=(r=(n=this.provider)==null?void 0:n.connection)==null?void 0:r.socket)==null?void 0:s.terminate)==null||i.call(s)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Vn(this,"onPayloadHandler",n=>{this.onProviderPayload(n),this.resetPingTimeout()}),Vn(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected ð"),this.startPingTimeout(),this.events.emit($i.connect)}),Vn(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected ð"),this.requestsInFlight=[],this.onProviderDisconnect()}),Vn(this,"onProviderErrorHandler",n=>{this.logger.fatal(`Fatal socket error: ${n.message}`),this.events.emit($i.error,n),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Vn(this,"registerProviderListeners",()=>{this.provider.on(ql.payload,this.onPayloadHandler),this.provider.on(ql.connect,this.onConnectHandler),this.provider.on(ql.disconnect,this.onDisconnectHandler),this.provider.on(ql.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?pa(t.logger,this.name):S6(PC({level:t.logger||abt})),this.messages=new fvt(this.logger,t.core),this.subscriber=new _vt(this,this.logger),this.publisher=new bvt(this,this.logger),this.relayUrl=(t==null?void 0:t.relayUrl)||Lbe,this.projectId=t.projectId,S1t()?this.packageName=Wre():A1t()&&(this.bundleId=Wre()),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(t){this.logger.warn(t,t==null?void 0:t.message)}}get context(){return Cc(this.logger)}get connected(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,n,r;return((r=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,n,r){this.isInitialized(),await this.publisher.publish(t,n,r),await this.recordMessageEvent({topic:t,message:n,publishedAt:Date.now(),transportType:Mr.relay},kS.outbound)}async subscribe(t,n){var r,s,i;this.isInitialized(),(!(n!=null&&n.transportType)||(n==null?void 0:n.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=n==null?void 0:n.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(s=n==null?void 0:n.internal)==null?void 0:s.throwOnFailedPublish;let a=((i=this.subscriber.topicMap.get(t))==null?void 0:i[0])||"",c;const l=u=>{u.topic===t&&(this.subscriber.off(Kc.created,l),c())};return await Promise.all([new Promise(u=>{c=u,this.subscriber.on(Kc.created,l)}),new Promise(async(u,d)=>{a=await this.subscriber.subscribe(t,kse({internal:{throwOnFailedPublish:o}},n)).catch(h=>{o&&d(h)})||a,u()})]),a}async unsubscribe(t,n){this.isInitialized(),await this.subscriber.unsubscribe(t,n)}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}off(t,n){this.events.off(t,n)}removeListener(t,n){this.events.removeListener(t,n)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await dm(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(n,r)=>{await this.connect(t).then(n).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await bse())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const n=t.sort((r,s)=>r.publishedAt-s.publishedAt);this.logger.debug(`Batch of ${n.length} message events sorted`);for(const r of n)try{await this.onMessageEvent(r)}catch(s){this.logger.warn(s,"Error while processing batch message event: "+(s==null?void 0:s.message))}this.logger.trace(`Batch of ${n.length} message events processed`)}async onLinkMessageEvent(t,n){const{topic:r}=t;if(!n.sessionExists){const s=v8(V.FIVE_MINUTES),i={topic:r,expiry:s,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,i)}this.events.emit($i.message,t),await this.recordMessageEvent(t,kS.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let n=1;for(;n<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${n}...`),await this.createProvider(),await new Promise(async(r,s)=>{const i=()=>{s(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(ql.disconnect,i),await dm(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{s(o)}).finally(()=>{this.provider.off(ql.disconnect,i),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const c=()=>{a(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(ql.disconnect,c),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(ql.disconnect,c)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const s=r;this.logger.warn({},s.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${n}`);break}await new Promise(r=>setTimeout(r,V.toMiliseconds(n*1))),n++}}startPingTimeout(){var t,n,r,s,i;if(NA())try{(n=(t=this.provider)==null?void 0:t.connection)!=null&&n.socket&&((i=(s=(r=this.provider)==null?void 0:r.connection)==null?void 0:s.socket)==null||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new or(new o7(O1t({sdkVersion:Fj,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,n){const{topic:r,message:s}=t;await this.messages.set(r,s,n)}async shouldIgnoreMessageEvent(t){const{topic:n,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(n))return this.logger.warn(`Ignoring message for unknown topic ${n}`),!0;const s=this.messages.has(n,r);return s&&this.logger.warn(`Ignoring duplicate message: ${r}`),s}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Du(t)){if(!t.method.endsWith(lbt))return;const n=t.params,{topic:r,message:s,publishedAt:i,attestation:o}=n.data,a={topic:r,message:s,publishedAt:i,transportType:Mr.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(kse({type:"event",event:n.id},a)),this.events.emit(n.id,a),await this.acknowledgePayload(t),await this.onMessageEvent(a)}else Sl(t)&&this.events.emit($i.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,kS.inbound),this.events.emit($i.message,t))}async acknowledgePayload(t){const n=Pi(t.id,!0);await this.provider.connection.send(n)}unregisterProviderListeners(){this.provider.off(ql.payload,this.onPayloadHandler),this.provider.off(ql.connect,this.onConnectHandler),this.provider.off(ql.disconnect,this.onDisconnectHandler),this.provider.off(ql.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await bse();Kyt(async n=>{t!==n&&(t=n,n?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Hr.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Yyt())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(n){this.logger.warn(n,n==null?void 0:n.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit($i.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},V.toMiliseconds(ubt)))))}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}};function kvt(){}function Rse(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)==="[object Object]":!1}function Bse(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Dse(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const Rvt="[object RegExp]",Bvt="[object String]",Dvt="[object Number]",Uvt="[object Boolean]",Use="[object Arguments]",Lvt="[object Symbol]",Mvt="[object Date]",jvt="[object Map]",Fvt="[object Set]",zvt="[object Array]",qvt="[object Function]",Wvt="[object ArrayBuffer]",hB="[object Object]",Hvt="[object Error]",Vvt="[object DataView]",Kvt="[object Uint8Array]",Gvt="[object Uint8ClampedArray]",Zvt="[object Uint16Array]",Yvt="[object Uint32Array]",Jvt="[object BigUint64Array]",Xvt="[object Int8Array]",Qvt="[object Int16Array]",e5t="[object Int32Array]",t5t="[object BigInt64Array]",n5t="[object Float32Array]",r5t="[object Float64Array]";function s5t(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function i5t(e,t,n){return zE(e,t,void 0,void 0,void 0,void 0,n)}function zE(e,t,n,r,s,i,o){const a=o(e,t,n,r,s,i);if(a!==void 0)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return e===t;case"number":return e===t||Object.is(e,t);case"function":return e===t;case"object":return $8(e,t,i,o)}return $8(e,t,i,o)}function $8(e,t,n,r){if(Object.is(e,t))return!0;let s=Dse(e),i=Dse(t);if(s===Use&&(s=hB),i===Use&&(i=hB),s!==i)return!1;switch(s){case Bvt:return e.toString()===t.toString();case Dvt:{const c=e.valueOf(),l=t.valueOf();return s5t(c,l)}case Uvt:case Mvt:case Lvt:return Object.is(e.valueOf(),t.valueOf());case Rvt:return e.source===t.source&&e.flags===t.flags;case qvt:return e===t}n=n??new Map;const o=n.get(e),a=n.get(t);if(o!=null&&a!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(s){case jvt:{if(e.size!==t.size)return!1;for(const[c,l]of e.entries())if(!t.has(c)||!zE(l,t.get(c),c,e,t,n,r))return!1;return!0}case Fvt:{if(e.size!==t.size)return!1;const c=Array.from(e.values()),l=Array.from(t.values());for(let u=0;u<c.length;u++){const d=c[u],h=l.findIndex(f=>zE(d,f,void 0,e,t,n,r));if(h===-1)return!1;l.splice(h,1)}return!0}case zvt:case Kvt:case Gvt:case Zvt:case Yvt:case Jvt:case Xvt:case Qvt:case e5t:case t5t:case n5t:case r5t:{if(typeof Buffer<"u"&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let c=0;c<e.length;c++)if(!zE(e[c],t[c],c,e,t,n,r))return!1;return!0}case Wvt:return e.byteLength!==t.byteLength?!1:$8(new Uint8Array(e),new Uint8Array(t),n,r);case Vvt:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:$8(new Uint8Array(e),new Uint8Array(t),n,r);case Hvt:return e.name===t.name&&e.message===t.message;case hB:{if(!($8(e.constructor,t.constructor,n,r)||Rse(e)&&Rse(t)))return!1;const c=[...Object.keys(e),...Bse(e)],l=[...Object.keys(t),...Bse(t)];if(c.length!==l.length)return!1;for(let u=0;u<c.length;u++){const d=c[u],h=e[d];if(!Object.hasOwn(t,d))return!1;const f=t[d];if(!zE(h,f,d,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function o5t(e,t){return i5t(e,t,kvt)}var a5t=Object.defineProperty,Lse=Object.getOwnPropertySymbols,c5t=Object.prototype.hasOwnProperty,l5t=Object.prototype.propertyIsEnumerable,Gj=(e,t,n)=>t in e?a5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mse=(e,t)=>{for(var n in t||(t={}))c5t.call(t,n)&&Gj(e,n,t[n]);if(Lse)for(var n of Lse(t))l5t.call(t,n)&&Gj(e,n,t[n]);return e},Oa=(e,t,n)=>Gj(e,typeof t!="symbol"?t+"":t,n);let yb=class extends w1t{constructor(t,n,r,s=af,i=void 0){super(t,n,r,s),this.core=t,this.logger=n,this.name=r,Oa(this,"map",new Map),Oa(this,"version",dbt),Oa(this,"cached",[]),Oa(this,"initialized",!1),Oa(this,"getKey"),Oa(this,"storagePrefix",af),Oa(this,"recentlyDeleted",[]),Oa(this,"recentlyDeletedLimit",200),Oa(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!Mj(o)?this.map.set(this.getKey(o),o):zyt(o)?this.map.set(o.id,o):qyt(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Oa(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),Oa(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Oa(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(c=>o5t(a[c],o[c]))):this.values)),Oa(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const c=Mse(Mse({},this.getData(o)),a);this.map.set(o,c),await this.persist()}),Oa(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=pa(n,this.name),this.storagePrefix=s,this.getKey=i}get context(){return Cc(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(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const n=this.map.get(t);if(!n){if(this.recentlyDeleted.includes(t)){const{message:s}=sr("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}const{message:r}=sr("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return n}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:n}=sr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}};var u5t=Object.defineProperty,d5t=(e,t,n)=>t in e?u5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,In=(e,t,n)=>d5t(e,typeof t!="symbol"?t+"":t,n);let h5t=class{constructor(t,n){this.core=t,this.logger=n,In(this,"name",gbt),In(this,"version",mbt),In(this,"events",new Bu),In(this,"pairings"),In(this,"initialized",!1),In(this,"storagePrefix",af),In(this,"ignoredPayloadTypes",[M6]),In(this,"registeredMethods",[]),In(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),In(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),In(this,"create",async r=>{this.isInitialized();const s=Lj(),i=await this.core.crypto.setSymKey(s),o=v8(V.FIVE_MINUTES),a={protocol:Ube},c={topic:i,expiry:o,relay:a,active:!1,methods:r==null?void 0:r.methods},l=yse({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:s,relay:a,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(tw.create,c),this.core.expirer.set(i,o),await this.pairings.set(i,c),await this.core.relayer.subscribe(i,{transportType:r==null?void 0:r.transportType}),{topic:i,uri:l}}),In(this,"pair",async r=>{this.isInitialized();const s=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[Nh.pairing_started]}});this.isValidPair(r,s);const{topic:i,symKey:o,relay:a,expiryTimestamp:c,methods:l}=wse(r.uri);s.props.properties.topic=i,s.addTrace(Nh.pairing_uri_validation_success),s.addTrace(Nh.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(i)){if(u=this.pairings.get(i),s.addTrace(Nh.existing_pairing),u.active)throw s.setError(mp.active_pairing_already_exists),new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);s.addTrace(Nh.pairing_not_expired)}const d=c||v8(V.FIVE_MINUTES),h={topic:i,relay:a,expiry:d,active:!1,methods:l};this.core.expirer.set(i,d),await this.pairings.set(i,h),s.addTrace(Nh.store_new_pairing),r.activatePairing&&await this.activate({topic:i}),this.events.emit(tw.create,h),s.addTrace(Nh.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(o,i),s.addTrace(Nh.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{s.setError(mp.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:a})}catch(f){throw s.setError(mp.subscribe_pairing_topic_failure),f}return s.addTrace(Nh.subscribe_pairing_topic_success),h}),In(this,"activate",async({topic:r})=>{this.isInitialized();const s=v8(V.FIVE_MINUTES);this.core.expirer.set(r,s),await this.pairings.update(r,{active:!0,expiry:s})}),In(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:s}=r;if(this.pairings.keys.includes(s)){const i=await this.sendRequest(s,"wc_pairingPing",{}),{done:o,resolve:a,reject:c}=k1t();this.events.once(JR("pairing_ping",i),({error:l})=>{l?c(l):a()}),await o()}}),In(this,"updateExpiry",async({topic:r,expiry:s})=>{this.isInitialized(),await this.pairings.update(r,{expiry:s})}),In(this,"updateMetadata",async({topic:r,metadata:s})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:s})}),In(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),In(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:s}=r;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",FE("USER_DISCONNECTED")),await this.deletePairing(s))}),In(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:s,relay:i,expiry:o,methods:a}=r,c=this.core.crypto.keychain.get(s);return yse({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:c,relay:i,expiryTimestamp:o,methods:a})}),In(this,"sendRequest",async(r,s,i)=>{const o=_n(s,i),a=await this.core.crypto.encode(r,o),c=sE[s].req;return this.core.history.set(r,o),this.core.relayer.publish(r,a,c),o.id}),In(this,"sendResult",async(r,s,i)=>{const o=Pi(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=sE[c].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),In(this,"sendError",async(r,s,i)=>{const o=yf(r,i),a=await this.core.crypto.encode(s,o),c=(await this.core.history.get(s,r)).request.method,l=sE[c]?sE[c].res:sE.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(o)}),In(this,"deletePairing",async(r,s)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,FE("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),s?Promise.resolve():this.core.expirer.del(r)])}),In(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(s=>Hre(s.expiry));await Promise.all(r.map(s=>this.deletePairing(s.topic)))}),In(this,"onRelayEventRequest",async r=>{const{topic:s,payload:i}=r;switch(i.method){case"wc_pairingPing":return await this.onPairingPingRequest(s,i);case"wc_pairingDelete":return await this.onPairingDeleteRequest(s,i);default:return await this.onUnknownRpcMethodRequest(s,i)}}),In(this,"onRelayEventResponse",async r=>{const{topic:s,payload:i}=r,o=(await this.core.history.get(s,i.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(s,i);default:return this.onUnknownRpcMethodResponse(o)}}),In(this,"onPairingPingRequest",async(r,s)=>{const{id:i}=s;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.events.emit(tw.ping,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}}),In(this,"onPairingPingResponse",(r,s)=>{const{id:i}=s;setTimeout(()=>{wn(s)?this.events.emit(JR("pairing_ping",i),{}):nn(s)&&this.events.emit(JR("pairing_ping",i),{error:s.error})},500)}),In(this,"onPairingDeleteRequest",async(r,s)=>{const{id:i}=s;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(tw.delete,{id:i,topic:r})}catch(o){await this.sendError(i,r,o),this.logger.error(o)}}),In(this,"onUnknownRpcMethodRequest",async(r,s)=>{const{id:i,method:o}=s;try{if(this.registeredMethods.includes(o))return;const a=FE("WC_METHOD_UNSUPPORTED",o);await this.sendError(i,r,a),this.logger.error(a)}catch(a){await this.sendError(i,r,a),this.logger.error(a)}}),In(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(FE("WC_METHOD_UNSUPPORTED",r))}),In(this,"isValidPair",(r,s)=>{var i;if(!cB(r)){const{message:a}=sr("MISSING_OR_INVALID",`pair() params: ${r}`);throw s.setError(mp.malformed_pairing_uri),new Error(a)}if(!Fyt(r.uri)){const{message:a}=sr("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw s.setError(mp.malformed_pairing_uri),new Error(a)}const o=wse(r==null?void 0:r.uri);if(!((i=o==null?void 0:o.relay)!=null&&i.protocol)){const{message:a}=sr("MISSING_OR_INVALID","pair() uri#relay-protocol");throw s.setError(mp.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=sr("MISSING_OR_INVALID","pair() uri#symKey");throw s.setError(mp.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&V.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){s.setError(mp.pairing_expired);const{message:a}=sr("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),In(this,"isValidPing",async r=>{if(!cB(r)){const{message:i}=sr("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)}),In(this,"isValidDisconnect",async r=>{if(!cB(r)){const{message:i}=sr("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:s}=r;await this.isValidPairingTopic(s)}),In(this,"isValidPairingTopic",async r=>{if(!Rbe(r)){const{message:s}=sr("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(s)}if(!this.pairings.keys.includes(r)){const{message:s}=sr("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(s)}if(Hre(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:s}=sr("EXPIRED",`pairing topic: ${r}`);throw new Error(s)}}),this.core=t,this.logger=pa(n,this.name),this.pairings=new yb(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Cc(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on($i.message,async t=>{const{topic:n,message:r,transportType:s}=t;if(this.pairings.keys.includes(n)&&s!==Mr.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const i=await this.core.crypto.decode(n,r);Du(i)?(this.core.history.set(n,i),await this.onRelayEventRequest({topic:n,payload:i})):Sl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:n,payload:i}),this.core.history.delete(n,i.id)),await this.core.relayer.messages.ack(n,r)}catch(i){this.logger.error(i)}})}registerExpirerEvents(){this.core.expirer.on(tu.expired,async t=>{const{topic:n}=D1t(t.target);n&&this.pairings.keys.includes(n)&&(await this.deletePairing(n,!0),this.events.emit(tw.expire,{topic:n}))})}};var f5t=Object.defineProperty,p5t=(e,t,n)=>t in e?f5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wi=(e,t,n)=>p5t(e,typeof t!="symbol"?t+"":t,n);let g5t=class extends f1t{constructor(t,n){super(t,n),this.core=t,this.logger=n,Wi(this,"records",new Map),Wi(this,"events",new Dn.EventEmitter),Wi(this,"name",wbt),Wi(this,"version",ybt),Wi(this,"cached",[]),Wi(this,"initialized",!1),Wi(this,"storagePrefix",af),Wi(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Wi(this,"set",(r,s,i)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:s,chainId:i}),this.records.has(s.id))return;const o={id:s.id,topic:r,request:{method:s.method,params:s.params||null},chainId:i,expiry:v8(V.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nd.created,o)}),Wi(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const s=await this.getRecord(r.id);typeof s.response>"u"&&(s.response=nn(r)?{error:r.error}:{result:r.result},this.records.set(s.id,s),this.persist(),this.events.emit(nd.updated,s))}),Wi(this,"get",async(r,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:s}),await this.getRecord(s))),Wi(this,"delete",(r,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(i=>{if(i.topic===r){if(typeof s<"u"&&i.id!==s)return;this.records.delete(i.id),this.events.emit(nd.deleted,i)}}),this.persist()}),Wi(this,"exists",async(r,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===r:!1)),Wi(this,"on",(r,s)=>{this.events.on(r,s)}),Wi(this,"once",(r,s)=>{this.events.once(r,s)}),Wi(this,"off",(r,s)=>{this.events.off(r,s)}),Wi(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=pa(n,this.name)}get context(){return Cc(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(){const t=[];return this.values.forEach(n=>{if(typeof n.response<"u")return;const r={topic:n.topic,request:_n(n.request.method,n.request.params,n.id),chainId:n.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const n=this.records.get(t);if(!n){const{message:r}=sr("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return n}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nd.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:n}=sr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nd.created,t=>{const n=nd.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(nd.updated,t=>{const n=nd.updated;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.events.on(nd.deleted,t=>{const n=nd.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:t})}),this.core.heartbeat.on(Hr.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(n=>{V.toMiliseconds(n.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${n.id}`),this.records.delete(n.id),this.events.emit(nd.deleted,n,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}};var m5t=Object.defineProperty,w5t=(e,t,n)=>t in e?m5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eo=(e,t,n)=>w5t(e,typeof t!="symbol"?t+"":t,n);let y5t=class extends b1t{constructor(t,n){super(t,n),this.core=t,this.logger=n,Eo(this,"expirations",new Map),Eo(this,"events",new Dn.EventEmitter),Eo(this,"name",bbt),Eo(this,"version",vbt),Eo(this,"cached",[]),Eo(this,"initialized",!1),Eo(this,"storagePrefix",af),Eo(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Eo(this,"has",r=>{try{const s=this.formatTarget(r);return typeof this.getExpiration(s)<"u"}catch{return!1}}),Eo(this,"set",(r,s)=>{this.isInitialized();const i=this.formatTarget(r),o={target:i,expiry:s};this.expirations.set(i,o),this.checkExpiry(i,o),this.events.emit(tu.created,{target:i,expiration:o})}),Eo(this,"get",r=>{this.isInitialized();const s=this.formatTarget(r);return this.getExpiration(s)}),Eo(this,"del",r=>{if(this.isInitialized(),this.has(r)){const s=this.formatTarget(r),i=this.getExpiration(s);this.expirations.delete(s),this.events.emit(tu.deleted,{target:s,expiration:i})}}),Eo(this,"on",(r,s)=>{this.events.on(r,s)}),Eo(this,"once",(r,s)=>{this.events.once(r,s)}),Eo(this,"off",(r,s)=>{this.events.off(r,s)}),Eo(this,"removeListener",(r,s)=>{this.events.removeListener(r,s)}),this.logger=pa(n,this.name)}get context(){return Cc(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(t){if(typeof t=="string")return R1t(t);if(typeof t=="number")return B1t(t);const{message:n}=sr("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(n)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(tu.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:n}=sr("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(n),new Error(n)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const n=this.expirations.get(t);if(!n){const{message:r}=sr("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return n}checkExpiry(t,n){const{expiry:r}=n;V.toMiliseconds(r)-Date.now()<=0&&this.expire(t,n)}expire(t,n){this.expirations.delete(t),this.events.emit(tu.expired,{target:t,expiration:n})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,n)=>this.checkExpiry(n,t))}registerEventListeners(){this.core.heartbeat.on(Hr.pulse,()=>this.checkExpirations()),this.events.on(tu.created,t=>{const n=tu.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(tu.expired,t=>{const n=tu.expired;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()}),this.events.on(tu.deleted,t=>{const n=tu.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=sr("NOT_INITIALIZED",this.name);throw new Error(t)}}};var b5t=Object.defineProperty,v5t=(e,t,n)=>t in e?b5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Is=(e,t,n)=>v5t(e,typeof t!="symbol"?t+"":t,n);let E5t=class extends v1t{constructor(t,n,r){super(t,n,r),this.core=t,this.logger=n,this.store=r,Is(this,"name",Ebt),Is(this,"abortController"),Is(this,"isDevEnv"),Is(this,"verifyUrlV3",$bt),Is(this,"storagePrefix",af),Is(this,"version",Dbe),Is(this,"publicKey"),Is(this,"fetchPromise"),Is(this,"init",async()=>{var s;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&V.toMiliseconds((s=this.publicKey)==null?void 0:s.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),Is(this,"register",async s=>{if(!u$()||this.isDevEnv)return;const i=window.location.origin,{id:o,decryptedId:a}=s,c=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${i}&id=${o}&decryptedId=${a}`;try{const l=cn.getDocument(),u=this.startAbortTimer(V.ONE_SECOND*5),d=await new Promise((h,f)=>{const g=()=>{window.removeEventListener("message",m),l.body.removeChild(p),f("attestation aborted")};this.abortController.signal.addEventListener("abort",g);const p=l.createElement("iframe");p.src=c,p.style.display="none",p.addEventListener("error",g,{signal:this.abortController.signal});const m=w=>{if(w.data&&typeof w.data=="string")try{const C=JSON.parse(w.data);if(C.type==="verify_attestation"){if(wu(C.attestation).payload.id!==o)return;clearInterval(u),l.body.removeChild(p),this.abortController.signal.removeEventListener("abort",g),window.removeEventListener("message",m),h(C.attestation===null?"":C.attestation)}}catch(C){this.logger.warn(C)}};l.body.appendChild(p),window.addEventListener("message",m,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(l){this.logger.warn(l)}return""}),Is(this,"resolve",async s=>{if(this.isDevEnv)return"";const{attestationId:i,hash:o,encryptedId:a}=s;if(i===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(i){if(wu(i).payload.id!==a)return;const l=await this.isValidJwtAttestation(i);if(l){if(!l.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return l}}if(!o)return;const c=this.getVerifyUrl(s==null?void 0:s.verifyUrl);return this.fetchAttestation(o,c)}),Is(this,"fetchAttestation",async(s,i)=>{this.logger.debug(`resolving attestation: ${s} from url: ${i}`);const o=this.startAbortTimer(V.ONE_SECOND*5),a=await fetch(`${i}/attestation/${s}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),Is(this,"getVerifyUrl",s=>{let i=s||C8;return xbt.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${C8}`),i=C8),i}),Is(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const s=this.startAbortTimer(V.FIVE_SECONDS),i=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(s),await i.json()}catch(s){this.logger.warn(s)}}),Is(this,"persistPublicKey",async s=>{this.logger.debug("persisting public key to local storage",s),await this.store.setItem(this.storeKey,s),this.publicKey=s}),Is(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),Is(this,"isValidJwtAttestation",async s=>{const i=await this.getPublicKey();try{if(i)return this.validateAttestation(s,i)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(s,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),Is(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),Is(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async i=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),i(o))});const s=await this.fetchPromise;return this.fetchPromise=void 0,s}),Is(this,"validateAttestation",(s,i)=>{const o=Ryt(s,i.publicKey),a={hasExpired:V.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=pa(n,this.name),this.abortController=new AbortController,this.isDevEnv=rbe(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Cc(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),V.toMiliseconds(t))}};var C5t=Object.defineProperty,$5t=(e,t,n)=>t in e?C5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jse=(e,t,n)=>$5t(e,typeof t!="symbol"?t+"":t,n);let x5t=class extends E1t{constructor(t,n){super(t,n),this.projectId=t,this.logger=n,jse(this,"context",Ibt),jse(this,"registerDeviceToken",async r=>{const{clientId:s,token:i,notificationType:o,enableEncrypted:a=!1}=r,c=`${Sbt}/${this.projectId}/clients`;await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:o,token:i,always_raw:a})})}),this.logger=pa(n,this.context)}};var I5t=Object.defineProperty,Fse=Object.getOwnPropertySymbols,S5t=Object.prototype.hasOwnProperty,A5t=Object.prototype.propertyIsEnumerable,Zj=(e,t,n)=>t in e?I5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aE=(e,t)=>{for(var n in t||(t={}))S5t.call(t,n)&&Zj(e,n,t[n]);if(Fse)for(var n of Fse(t))A5t.call(t,n)&&Zj(e,n,t[n]);return e},oi=(e,t,n)=>Zj(e,typeof t!="symbol"?t+"":t,n);class _5t extends C1t{constructor(t,n,r=!0){super(t,n,r),this.core=t,this.logger=n,oi(this,"context",_bt),oi(this,"storagePrefix",af),oi(this,"storageVersion",Abt),oi(this,"events",new Map),oi(this,"shouldPersist",!1),oi(this,"init",async()=>{if(!rbe())try{const s={eventId:Vre(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:tbe(this.core.relayer.protocol,this.core.relayer.version,Fj)}}};await this.sendEvent([s])}catch(s){this.logger.warn(s)}}),oi(this,"createEvent",s=>{const{event:i="ERROR",type:o="",properties:{topic:a,trace:c}}=s,l=Vre(),u=this.core.projectId||"",d=Date.now(),h=aE({eventId:l,timestamp:d,props:{event:i,type:o,properties:{topic:a,trace:c}},bundleId:u,domain:this.getAppDomain()},this.setMethods(l));return this.telemetryEnabled&&(this.events.set(l,h),this.shouldPersist=!0),h}),oi(this,"getEvent",s=>{const{eventId:i,topic:o}=s;if(i)return this.events.get(i);const a=Array.from(this.events.values()).find(c=>c.props.properties.topic===o);if(a)return aE(aE({},a),this.setMethods(a.eventId))}),oi(this,"deleteEvent",s=>{const{eventId:i}=s;this.events.delete(i),this.shouldPersist=!0}),oi(this,"setEventListeners",()=>{this.core.heartbeat.on(Hr.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(s=>{V.fromMiliseconds(Date.now())-V.fromMiliseconds(s.timestamp)>Nbt&&(this.events.delete(s.eventId),this.shouldPersist=!0)})})}),oi(this,"setMethods",s=>({addTrace:i=>this.addTrace(s,i),setError:i=>this.setError(s,i)})),oi(this,"addTrace",(s,i)=>{const o=this.events.get(s);o&&(o.props.properties.trace.push(i),this.events.set(s,o),this.shouldPersist=!0)}),oi(this,"setError",(s,i)=>{const o=this.events.get(s);o&&(o.props.type=i,o.timestamp=Date.now(),this.events.set(s,o),this.shouldPersist=!0)}),oi(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),oi(this,"restore",async()=>{try{const s=await this.core.storage.getItem(this.storageKey)||[];if(!s.length)return;s.forEach(i=>{this.events.set(i.eventId,aE(aE({},i),this.setMethods(i.eventId)))})}catch(s){this.logger.warn(s)}}),oi(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const s=[];for(const[i,o]of this.events)o.props.type&&s.push(o);if(s.length!==0)try{if((await this.sendEvent(s)).ok)for(const i of s)this.events.delete(i.eventId),this.shouldPersist=!0}catch(i){this.logger.warn(i)}}),oi(this,"sendEvent",async s=>{const i=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${Tbt}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Fj}${i}`,{method:"POST",body:JSON.stringify(s)})}),oi(this,"getAppDomain",()=>N1t().url),this.logger=pa(n,this.context),this.telemetryEnabled=r,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 N5t=Object.defineProperty,zse=Object.getOwnPropertySymbols,T5t=Object.prototype.hasOwnProperty,P5t=Object.prototype.propertyIsEnumerable,Yj=(e,t,n)=>t in e?N5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qse=(e,t)=>{for(var n in t||(t={}))T5t.call(t,n)&&Yj(e,n,t[n]);if(zse)for(var n of zse(t))P5t.call(t,n)&&Yj(e,n,t[n]);return e},Tr=(e,t,n)=>Yj(e,typeof t!="symbol"?t+"":t,n);let O5t=class Ybe extends l1t{constructor(t){var n;super(t),Tr(this,"protocol",Bbe),Tr(this,"version",Dbe),Tr(this,"name",jj),Tr(this,"relayUrl"),Tr(this,"projectId"),Tr(this,"customStoragePrefix"),Tr(this,"events",new Dn.EventEmitter),Tr(this,"logger"),Tr(this,"heartbeat"),Tr(this,"relayer"),Tr(this,"crypto"),Tr(this,"storage"),Tr(this,"history"),Tr(this,"expirer"),Tr(this,"pairing"),Tr(this,"verify"),Tr(this,"echoClient"),Tr(this,"linkModeSupportedApps"),Tr(this,"eventClient"),Tr(this,"initialized",!1),Tr(this,"logChunkController"),Tr(this,"on",(a,c)=>this.events.on(a,c)),Tr(this,"once",(a,c)=>this.events.once(a,c)),Tr(this,"off",(a,c)=>this.events.off(a,c)),Tr(this,"removeListener",(a,c)=>this.events.removeListener(a,c)),Tr(this,"dispatchEnvelope",({topic:a,message:c,sessionExists:l})=>{if(!a||!c)return;const u={topic:a,message:c,publishedAt:Date.now(),transportType:Mr.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:l})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(a){console.warn("Failed to copy global core",a)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Lbe,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const s=PC({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:Xyt.logger,name:jj}
155),{logger:i,chunkLoggerController:o}=bMe({opts:s,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(n=this.logChunkController)!=null&&n.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,c;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((c=this.logChunkController)==null||c.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=pa(i,this.name),this.heartbeat=new s7,this.crypto=new ivt(this,this.logger,t==null?void 0:t.keychain),this.history=new g5t(this,this.logger),this.expirer=new y5t(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new i7(qse(qse({},Qyt),t==null?void 0:t.storageOptions)),this.relayer=new Ovt({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new h5t(this,this.logger),this.verify=new E5t(this,this.logger,this.storage),this.echoClient=new x5t(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new _5t(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const n=new Ybe(t);await n.initialize();const r=await n.crypto.getClientId();return await n.storage.setItem(hbt,r),n}get context(){return Cc(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Cse,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(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(Cse)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${t}`,r=`${n}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[n]}catch(n){console.warn("Failed to get global WalletConnect core",n);return}}setGlobalCore(t){var n;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((n=t.opts)==null?void 0:n.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&Jyt.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const k5t=O5t;var R5t=Object.defineProperty,B5t=(e,t,n)=>t in e?R5t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wse=(e,t,n)=>B5t(e,typeof t!="symbol"?t+"":t,n);let D5t=class{constructor(t){this.opts=t,Wse(this,"protocol","wc"),Wse(this,"version",2)}},U5t=class{constructor(t){this.client=t}};function w4(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function Hse(e){return w4(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Jbe="2.23.2";let cE={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Jbe}`},NT=class Jj extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof Jj?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof Jj&&n.cause.docsPath||n.docsPath,i=(a=cE.getDocsUrl)==null?void 0:a.call(cE,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...cE.version?[`Version: ${cE.version}`]:[]].join(` 156`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Jbe}walk(t){return Xbe(this,t)}};function Xbe(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Xbe(e.cause,t):t?null:e}let Qbe=class extends NT{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function j6(e,{dir:t,size:n=32}={}){return typeof e=="string"?L5t(e,{dir:t,size:n}):M5t(e,{dir:t,size:n})}function L5t(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Qbe({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function M5t(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Qbe({size:e.length,targetSize:n,type:"bytes"});
156const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let j5t=class extends NT{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},F5t=class extends NT{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function F6(e,{size:t}){if(Hse(e)>t)throw new F5t({givenSize:Hse(e),maxSize:t})}function Xj(e,t={}){const{signed:n}=t;t.size&&F6(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function z5t(e,t={}){return Number(Xj(e,t))}const q5t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Qj(e,t={}){return typeof e=="number"||typeof e=="bigint"?t2e(e,t):typeof e=="string"?V5t(e,t):typeof e=="boolean"?W5t(e,t):e2e(e,t)}function W5t(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(F6(n,{size:t.size}),j6(n,{size:t.size})):n}function e2e(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=q5t[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(F6(r,{size:t.size}),j6(r,{dir:"right",size:t.size})):r}function t2e(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new j5t({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?j6(a,{size:r}):a}const H5t=new TextEncoder;function V5t(e,t={}){const n=H5t.encode(e);return e2e(n,t)}const K5t=new TextEncoder;function G5t(e,t={}){return typeof e=="number"||typeof e=="bigint"?Y5t(e,t):typeof e=="boolean"?Z5t(e,t):w4(e)?n2e(e,t):r2e(e,t)}function Z5t(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(F6(n,{size:t.size}),j6(n,{size:t.size})):n}const Zf={zero:48,nine:57,A:65,F:70,a:97,f:102};function Vse(e){if(e>=Zf.zero&&e<=Zf.nine)return e-Zf.zero;if(e>=Zf.A&&e<=Zf.F)return e-(Zf.A-10);if(e>=Zf.a&&e<=Zf.f)return e-(Zf.a-10)}function n2e(e,t={}){let n=e;t.size&&(F6(n,{size:t.size}),n=j6(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=Vse(r.charCodeAt(a++)),l=Vse(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new NT(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[o]=c*16+l}return i}function Y5t(e,t){const n=t2e(e,t);return n2e(n)}function r2e(e,t={}){const n=K5t.encode(e);return typeof t.size=="number"?(F6(n,{size:t.size}),j6(n,{dir:"right",size:t.size})):n}function PA(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function J5t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function m$(e,...t){if(!J5t(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function X5t(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");PA(e.outputLen),PA(e.blockLen)}function x5(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function s2e(e,t){m$(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const II=BigInt(2**32-1),Kse=BigInt(32);function Q5t(e,t=!1){return t?{h:Number(e&II),l:Number(e>>Kse&II)}:{h:Number(e>>Kse&II)|0,l:Number(e&II)|0}}
vendor: 4,347 bytes, line 156
156function e6t(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:o}=Q5t(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const t6t=(e,t,n)=>e<<n|t>>>32-n,n6t=(e,t,n)=>t<<n|e>>>32-n,r6t=(e,t,n)=>t<<n-32|e>>>64-n,s6t=(e,t,n)=>e<<n-32|t>>>64-n,C2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function i6t(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function fB(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ch(e,t){return e<<32-t|e>>>t}const Gse=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function o6t(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Zse(e){for(let t=0;t<e.length;t++)e[t]=o6t(e[t])}function a6t(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function TT(e){return typeof e=="string"&&(e=a6t(e)),m$(e),e}function c6t(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];m$(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}class fV{clone(){return this._cloneInto()}}function i2e(e){const t=r=>e().update(TT(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function l6t(e=32){if(C2&&typeof C2.getRandomValues=="function")return C2.getRandomValues(new Uint8Array(e));if(C2&&typeof C2.randomBytes=="function")return C2.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const o2e=[],a2e=[],c2e=[],u6t=BigInt(0),lE=BigInt(1),d6t=BigInt(2),h6t=BigInt(7),f6t=BigInt(256),p6t=BigInt(113);for(let e=0,t=lE,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],o2e.push(2*(5*r+n)),a2e.push((e+1)*(e+2)/2%64);let s=u6t;for(let i=0;i<7;i++)t=(t<<lE^(t>>h6t)*p6t)%f6t,t&d6t&&(s^=lE<<(lE<<BigInt(i))-lE);c2e.push(s)}const[g6t,m6t]=e6t(c2e,!0),Yse=(e,t,n)=>n>32?r6t(e,t,n):t6t(e,t,n),Jse=(e,t,n)=>n>32?s6t(e,t,n):n6t(e,t,n);function w6t(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=Yse(l,u,1)^n[a],h=Jse(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=a2e[o],c=Yse(s,i,a),l=Jse(s,i,a),u=o2e[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=g6t[r],e[1]^=m6t[r]}n.fill(0)}class pV extends fV{constructor(t,n,r,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,PA(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=i6t(this.state)}keccak(){Gse||Zse(this.state32),w6t(this.state32,this.rounds),Gse||Zse(this.state32),this.posOut=0,this.pos=0}update(t){x5(this);const{blockLen:n,state:r}=this;t=TT(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){x5(this,!1),m$(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return PA(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(s2e(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new pV(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}}
156const y6t=(e,t,n)=>i2e(()=>new pV(t,e,n)),b6t=y6t(1,136,256/8);function l2e(e,t){const n=t||"hex",r=b6t(w4(e,{strict:!1})?G5t(e):e);return n==="bytes"?r:Qj(r)}let v6t=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const pB=new v6t(8192);function E6t(e,t){if(pB.has(`${e}.${t}`))return pB.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=l2e(r2e(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const i=`0x${s.join("")}`;return pB.set(`${e}.${t}`,i),i}function C6t(e){const t=l2e(`0x${e.substring(4)}`).substring(26);return E6t(`0x${t}`)}async function $6t({hash:e,signature:t}){const n=w4(e)?e:Qj(e),{secp256k1:r}=await te(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>o3t);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:d,yParity:h}=t,f=Number(h??d),g=Xse(f);return new r.Signature(Xj(l),Xj(u)).addRecoveryBit(g)}const o=w4(t)?t:Qj(t),a=z5t(`0x${o.slice(130)}`),c=Xse(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Xse(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function x6t({hash:e,signature:t}){return C6t(await $6t({hash:e,signature:t}))}function I6t(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}function S6t(e,t,n){return e&t^~e&n}function A6t(e,t,n){return e&t^e&n^t&n}class _6t extends fV{constructor(t,n,r,s){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=fB(this.buffer)}update(t){x5(this);const{view:n,buffer:r,blockLen:s}=this;
vendor: 4,142 bytes, line 156
156t=TT(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=fB(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){x5(this),s2e(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;I6t(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=fB(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.length=s,t.pos=a,t.finished=i,t.destroyed=o,s%n&&t.buffer.set(r),t}}const N6t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Sg=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ag=new Uint32Array(64);class T6t extends _6t{constructor(){super(64,32,8,!1),this.A=Sg[0]|0,this.B=Sg[1]|0,this.C=Sg[2]|0,this.D=Sg[3]|0,this.E=Sg[4]|0,this.F=Sg[5]|0,this.G=Sg[6]|0,this.H=Sg[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Ag[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=Ag[d-15],f=Ag[d-2],g=Ch(h,7)^Ch(h,18)^h>>>3,p=Ch(f,17)^Ch(f,19)^f>>>10;Ag[d]=p+Ag[d-7]+g+Ag[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=Ch(a,6)^Ch(a,11)^Ch(a,25),f=u+h+S6t(a,c,l)+N6t[d]+Ag[d]|0,p=(Ch(r,2)^Ch(r,13)^Ch(r,22))+A6t(r,s,i)|0;u=l,l=c,c=a,a=o+f|0,o=i,i=s,s=r,r=f+p|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,c,l,u)}roundClean(){Ag.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const P6t=i2e(()=>new T6t);class u2e extends fV{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,X5t(t);const r=TT(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(t){return x5(this),this.iHash.update(t),this}digestInto(t){x5(this),m$(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}
vendor: 153,066 bytes, lines 156-165
156const d2e=(e,t,n)=>new u2e(e,t).update(n).digest();d2e.create=(e,t)=>new u2e(e,t);const gV=BigInt(0),h2e=BigInt(1),O6t=BigInt(2);function ly(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function w$(e){if(!ly(e))throw new Error("Uint8Array expected")}function I5(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}const k6t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function S5(e){w$(e);let t="";for(let n=0;n<e.length;n++)t+=k6t[e[n]];return t}function qE(e){const t=e.toString(16);return t.length&1?"0"+t:t}function mV(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?gV:BigInt("0x"+e)}const Yf={_0:48,_9:57,A:65,F:70,a:97,f:102};function Qse(e){if(e>=Yf._0&&e<=Yf._9)return e-Yf._0;if(e>=Yf.A&&e<=Yf.F)return e-(Yf.A-10);if(e>=Yf.a&&e<=Yf.f)return e-(Yf.a-10)}function y4(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Qse(e.charCodeAt(i)),a=Qse(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Dw(e){return mV(S5(e))}function wV(e){return w$(e),mV(S5(Uint8Array.from(e).reverse()))}function A5(e,t){return y4(e.toString(16).padStart(t*2,"0"))}function yV(e,t){return A5(e,t).reverse()}function yd(e,t,n){let r;if(typeof t=="string")try{r=y4(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(ly(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function b4(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];w$(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const gB=e=>typeof e=="bigint"&&gV<=e;function PT(e,t,n){return gB(e)&&gB(t)&&gB(n)&&t<=e&&e<n}function Uw(e,t,n,r){if(!PT(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function f2e(e){let t;for(t=0;e>gV;e>>=h2e,t+=1);return t}const bV=e=>(O6t<<BigInt(e-1))-h2e,mB=e=>new Uint8Array(e),eie=e=>Uint8Array.from(e);function p2e(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=mB(e),s=mB(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=mB())=>{s=a(eie([0]),d),r=a(),d.length!==0&&(s=a(eie([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return b4(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const R6t={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||ly(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function y$(e,t,n={}){const r=(s,i,o)=>{const a=R6t[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function eF(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const B6t=Object.freeze(Object.defineProperty({__proto__:null,aInRange:Uw,abool:I5,abytes:w$,bitLen:f2e,bitMask:bV,bytesToHex:S5,bytesToNumberBE:Dw,bytesToNumberLE:wV,concatBytes:b4,createHmacDrbg:p2e,ensureBytes:yd,hexToBytes:y4,hexToNumber:mV,inRange:PT,isBytes:ly,memoized:eF,numberToBytesBE:A5,numberToBytesLE:yV,numberToHexUnpadded:qE,validateObject:y$},Symbol.toStringTag,{value:"Module"}));const Ai=BigInt(0),ys=BigInt(1),nw=BigInt(2),D6t=BigInt(3),tF=BigInt(4),tie=BigInt(5),nie=BigInt(8);function tc(e,t){const n=e%t;return n>=Ai?n:t+n}function U6t(e,t,n){if(t<Ai)throw new Error("invalid exponent, negatives unsupported");if(n<=Ai)throw new Error("invalid modulus");if(n===ys)return Ai;let r=ys;for(;t>Ai;)t&ys&&(r=r*e%n),e=e*e%n,t>>=ys;return r}function Wl(e,t,n){let r=e;for(;t-- >Ai;)r*=r,r%=n;return r}function nF(e,t){if(e===Ai)throw new Error("invert: expected non-zero number");if(t<=Ai)throw new Error("invert: expected positive modulus, got "+t);let n=tc(e,t),r=t,s=Ai,i=ys;for(;n!==Ai;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==ys)throw new Error("invert: does not exist");return tc(s,t)}function L6t(e){const t=(e-ys)/nw;let n,r,s;for(n=e-ys,r=0;n%nw===Ai;n/=nw,r++);for(s=nw;s<e&&U6t(s,t,e)!==e-ys;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+ys)/tF;return function(c,l){const u=c.pow(l,o);if(!c.eql(c.sqr(u),l))throw new Error("Cannot find square root");return u}}const i=(n+ys)/nw;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let l=r,u=a.pow(a.mul(a.ONE,s),n),d=a.pow(c,i),h=a.pow(c,n);for(;!a.eql(h,a.ONE);){if(a.eql(h,a.ZERO))return a.ZERO;let f=1;for(let p=a.sqr(h);f<l&&!a.eql(p,a.ONE);f++)p=a.sqr(p);const g=a.pow(u,ys<<BigInt(l-f-1));u=a.sqr(g),d=a.mul(d,g),h=a.mul(h,u),l=f}return d}}function M6t(e){if(e%tF===D6t){const t=(e+ys)/tF;return function(r,s){const i=r.pow(s,t);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(e%nie===tie){const t=(e-tie)/nie;return function(r,s){const i=r.mul(s,nw),o=r.pow(i,t),a=r.mul(s,o),c=r.mul(r.mul(a,nw),o),l=r.mul(a,r.sub(c,r.ONE));if(!r.eql(r.sqr(l),s))throw new Error("Cannot find square root");return l}}return L6t(e)}const j6t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function F6t(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=j6t.reduce((r,s)=>(r[s]="function",r),t);return y$(e,n)}function z6t(e,t,n){if(n<Ai)throw new Error("invalid exponent, negatives unsupported");if(n===Ai)return e.ONE;if(n===ys)return t;let r=e.ONE,s=t;for(;n>Ai;)n&ys&&(r=e.mul(r,s)),s=e.sqr(s),n>>=ys;return r}function q6t(e,t){const n=new Array(t.length),r=t.reduce((i,o,a)=>e.is0(o)?i:(n[a]=i,e.mul(i,o)),e.ONE),s=e.inv(r);return t.reduceRight((i,o,a)=>e.is0(o)?i:(n[a]=e.mul(i,n[a]),e.mul(i,o)),s),n}function g2e(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function m2e(e,t,n=!1,r={}){if(e<=Ai)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=g2e(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:bV(s),ZERO:Ai,ONE:ys,create:c=>tc(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return Ai<=c&&c<e},is0:c=>c===Ai,isOdd:c=>(c&ys)===ys,neg:c=>tc(-c,e),eql:(c,l)=>c===l,sqr:c=>tc(c*c,e),add:(c,l)=>tc(c+l,e),sub:(c,l)=>tc(c-l,e),mul:(c,l)=>tc(c*l,e),pow:(c,l)=>z6t(a,c,l),div:(c,l)=>tc(c*nF(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>nF(c,e),sqrt:r.sqrt||(c=>(o||(o=M6t(e)),o(a,c))),invertBatch:c=>q6t(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>n?yV(c,i):A5(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?wV(c):Dw(c)}});return Object.freeze(a)}function w2e(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function y2e(e){const t=w2e(e);return t+Math.ceil(t/2)}function W6t(e,t,n=!1){const r=e.length,s=w2e(t),i=y2e(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?wV(e):Dw(e),a=tc(o,t-ys)+ys;return n?yV(a,s):A5(a,s)}const rie=BigInt(0),SI=BigInt(1);function wB(e,t){const n=t.negate();return e?n:t}function b2e(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function yB(e,t){b2e(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1);return{windows:n,windowSize:r}}function H6t(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function V6t(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const bB=new WeakMap,v2e=new WeakMap;function vB(e){return v2e.get(e)||1}function K6t(e,t){return{constTimeNegate:wB,hasPrecomputes(n){return vB(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>rie;)r&SI&&(s=s.add(i)),i=i.double(),r>>=SI;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=yB(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){const{windows:i,windowSize:o}=yB(n,t);let a=e.ZERO,c=e.BASE;const l=BigInt(2**n-1),u=2**n,d=BigInt(n);for(let h=0;h<i;h++){const f=h*o;let g=Number(s&l);s>>=d,g>o&&(g-=u,s+=SI);const p=f,m=f+Math.abs(g)-1,w=h%2!==0,C=g<0;g===0?c=c.add(wB(w,r[p])):a=a.add(wB(C,r[m]))}return{p:a,f:c}},wNAFUnsafe(n,r,s,i=e.ZERO){const{windows:o,windowSize:a}=yB(n,t),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let d=0;d<o;d++){const h=d*a;if(s===rie)break;let f=Number(s&c);if(s>>=u,f>a&&(f-=l,s+=SI),f===0)continue;let g=r[h+Math.abs(f)-1];f<0&&(g=g.negate()),i=i.add(g)}return i},getPrecomputes(n,r,s){let i=bB.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&bB.set(r,s(i))),i},wNAFCached(n,r,s){const i=vB(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=vB(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){b2e(r,t),v2e.set(n,r),bB.delete(n)}}}function G6t(e,t,n,r){if(H6t(n,e),V6t(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,i=f2e(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((t.BITS-1)/o)*o;let u=s;for(let d=l;d>=0;d-=o){c.fill(s);for(let f=0;f<r.length;f++){const g=r[f],p=Number(g>>BigInt(d)&BigInt(a));c[p]=c[p].add(n[f])}let h=s;for(let f=c.length-1,g=s;f>0;f--)g=g.add(c[f]),h=h.add(g);if(u=u.add(h),d!==0)for(let f=0;f<o;f++)u=u.double()}return u}function E2e(e){return F6t(e.Fp),y$(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...g2e(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function sie(e){e.lowS!==void 0&&I5("lowS",e.lowS),e.prehash!==void 0&&I5("prehash",e.prehash)}function Z6t(e){const t=E2e(e);y$(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Y6t,hexToBytes:J6t}=B6t;let X6t=class extends Error{constructor(t=""){super(t)}};const Pp={Err:X6t,_tlv:{encode:(e,t)=>{const{Err:n}=Pp;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=qE(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?qE(s.length/2|128):"";return qE(e)+i+s+t},decode(e,t){const{Err:n}=Pp;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Pp;if(e<zp)throw new t("integer: negative integers are not allowed");let n=qE(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Pp;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Y6t(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Pp,s=typeof e=="string"?J6t(e):e;w$(s);const{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Pp,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}},zp=BigInt(0),pi=BigInt(1);BigInt(2);const iie=BigInt(3);BigInt(4);function Q6t(e){const t=Z6t(e),{Fp:n}=t,r=m2e(t.n,t.nBitLength),s=t.toBytes||((p,m,w)=>{const C=m.toAffine();return b4(Uint8Array.from([4]),n.toBytes(C.x),n.toBytes(C.y))}),i=t.fromBytes||(p=>{const m=p.subarray(1),w=n.fromBytes(m.subarray(0,n.BYTES)),C=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:w,y:C}});function o(p){const{a:m,b:w}=t,C=n.sqr(p),E=n.mul(C,p);return n.add(n.add(E,n.mul(p,m)),w)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return PT(p,pi,t.n)}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:w,wrapPrivateKey:C,n:E}=t;if(m&&typeof p!="bigint"){if(ly(p)&&(p=S5(p)),typeof p!="string"||!m.includes(p.length))throw new Error("invalid private key");p=p.padStart(w*2,"0")}let b;try{b=typeof p=="bigint"?p:Dw(yd("private key",p,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof p)}return C&&(b=tc(b,E)),Uw("private key",b,pi,E),b}function l(p){if(!(p instanceof h))throw new Error("ProjectivePoint expected")}const u=eF((p,m)=>{const{px:w,py:C,pz:E}=p;if(n.eql(E,n.ONE))return{x:w,y:C};const b=p.is0();m==null&&(m=b?n.ONE:n.inv(E));const S=n.mul(w,m),v=n.mul(C,m),x=n.mul(E,m);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(x,n.ONE))throw new Error("invZ was invalid");return{x:S,y:v}}),d=eF(p=>{if(p.is0()){if(t.allowInfinityPoint&&!n.is0(p.py))return;throw new Error("bad point: ZERO")}const{x:m,y:w}=p.toAffine();if(!n.isValid(m)||!n.isValid(w))throw new Error("bad point: x or y not FE");const C=n.sqr(w),E=o(m);if(!n.eql(C,E))throw new Error("bad point: equation left != right");if(!p.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(m,w,C){if(this.px=m,this.py=w,this.pz=C,m==null||!n.isValid(m))throw new Error("x required");if(w==null||!n.isValid(w))throw new Error("y required");if(C==null||!n.isValid(C))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:w,y:C}=m||{};if(!m||!n.isValid(w)||!n.isValid(C))throw new Error("invalid affine point");if(m instanceof h)throw new Error("projective point not allowed");const E=b=>n.eql(b,n.ZERO);return E(w)&&E(C)?h.ZERO:new h(w,C,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const w=n.invertBatch(m.map(C=>C.pz));return m.map((C,E)=>C.toAffine(w[E])).map(h.fromAffine)}static fromHex(m){const w=h.fromAffine(i(yd("pointHex",m)));return w.assertValidity(),w}static fromPrivateKey(m){return h.BASE.multiply(c(m))}static msm(m,w){return G6t(h,r,m,w)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){l(m);const{px:w,py:C,pz:E}=this,{px:b,py:S,pz:v}=m,x=n.eql(n.mul(w,v),n.mul(b,E)),A=n.eql(n.mul(C,v),n.mul(S,E));return x&&A}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:w}=t,C=n.mul(w,iie),{px:E,py:b,pz:S}=this;let v=n.ZERO,x=n.ZERO,A=n.ZERO,I=n.mul(E,E),O=n.mul(b,b),N=n.mul(S,S),T=n.mul(E,b);return T=n.add(T,T),A=n.mul(E,S),A=n.add(A,A),v=n.mul(m,A),x=n.mul(C,N),x=n.add(v,x),v=n.sub(O,x),x=n.add(O,x),x=n.mul(v,x),v=n.mul(T,v),A=n.mul(C,A),N=n.mul(m,N),T=n.sub(I,N),T=n.mul(m,T),T=n.add(T,A),A=n.add(I,I),I=n.add(A,I),I=n.add(I,N),I=n.mul(I,T),x=n.add(x,I),N=n.mul(b,S),N=n.add(N,N),I=n.mul(N,T),v=n.sub(v,I),A=n.mul(N,O),A=n.add(A,A),A=n.add(A,A),new h(v,x,A)}add(m){l(m);const{px:w,py:C,pz:E}=this,{px:b,py:S,pz:v}=m;let x=n.ZERO,A=n.ZERO,I=n.ZERO;const O=t.a,N=n.mul(t.b,iie);let T=n.mul(w,b),P=n.mul(C,S),_=n.mul(E,v),y=n.add(w,C),$=n.add(b,S);y=n.mul(y,$),$=n.add(T,P),y=n.sub(y,$),$=n.add(w,E);let R=n.add(b,v);return $=n.mul($,R),R=n.add(T,_),$=n.sub($,R),R=n.add(C,E),x=n.add(S,v),R=n.mul(R,x),x=n.add(P,_),R=n.sub(R,x),I=n.mul(O,$),x=n.mul(N,_),I=n.add(x,I),x=n.sub(P,I),I=n.add(P,I),A=n.mul(x,I),P=n.add(T,T),P=n.add(P,T),_=n.mul(O,_),$=n.mul(N,$),P=n.add(P,_),_=n.sub(T,_),_=n.mul(O,_),$=n.add($,_),T=n.mul(P,$),A=n.add(A,T),T=n.mul(R,$),x=n.mul(y,x),x=n.sub(x,T),T=n.mul(y,P),I=n.mul(R,I),I=n.add(I,T),new h(x,A,I)}subtract(m){return this.add(m.negate())}is0(){return this.equals(h.ZERO)}wNAF(m){return g.wNAFCached(this,m,h.normalizeZ)}multiplyUnsafe(m){const{endo:w,n:C}=t;Uw("scalar",m,zp,C);const E=h.ZERO;if(m===zp)return E;if(this.is0()||m===pi)return this;if(!w||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,h.normalizeZ);let{k1neg:b,k1:S,k2neg:v,k2:x}=w.splitScalar(m),A=E,I=E,O=this;for(;S>zp||x>zp;)S&pi&&(A=A.add(O)),x&pi&&(I=I.add(O)),O=O.double(),S>>=pi,x>>=pi;return b&&(A=A.negate()),v&&(I=I.negate()),I=new h(n.mul(I.px,w.beta),I.py,I.pz),A.add(I)}multiply(m){const{endo:w,n:C}=t;Uw("scalar",m,pi,C);let E,b;if(w){const{k1neg:S,k1:v,k2neg:x,k2:A}=w.splitScalar(m);let{p:I,f:O}=this.wNAF(v),{p:N,f:T}=this.wNAF(A);I=g.constTimeNegate(S,I),N=g.constTimeNegate(x,N),N=new h(n.mul(N.px,w.beta),N.py,N.pz),E=I.add(N),b=O.add(T)}else{const{p:S,f:v}=this.wNAF(m);E=S,b=v}return h.normalizeZ([E,b])[0]}multiplyAndAddUnsafe(m,w,C){const E=h.BASE,b=(v,x)=>x===zp||x===pi||!v.equals(E)?v.multiplyUnsafe(x):v.multiply(x),S=b(this,w).add(b(m,C));return S.is0()?void 0:S}toAffine(m){return u(this,m)}isTorsionFree(){const{h:m,isTorsionFree:w}=t;if(m===pi)return!0;if(w)return w(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:w}=t;return m===pi?this:w?w(h,this):this.multiplyUnsafe(t.h)}toRawBytes(m=!0){return I5("isCompressed",m),this.assertValidity(),s(h,this,m)}toHex(m=!0){return I5("isCompressed",m),S5(this.toRawBytes(m))}}h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const f=t.nBitLength,g=K6t(h,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function e3t(e){const t=E2e(e);return y$(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function t3t(e){const t=e3t(e),{Fp:n,n:r}=t,s=n.BYTES+1,i=2*n.BYTES+1;function o(_){return tc(_,r)}function a(_){return nF(_,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:d}=Q6t({...t,toBytes(_,y,$){const R=y.toAffine(),B=n.toBytes(R.x),k=b4;return I5("isCompressed",$),$?k(Uint8Array.from([y.hasEvenY()?2:3]),B):k(Uint8Array.from([4]),B,n.toBytes(R.y))},fromBytes(_){const y=_.length,$=_[0],R=_.subarray(1);if(y===s&&($===2||$===3)){const B=Dw(R);if(!PT(B,pi,n.ORDER))throw new Error("Point is not on curve");const k=u(B);let D;try{D=n.sqrt(k)}catch(K){const q=K instanceof Error?": "+K.message:"";throw new Error("Point is not on curve"+q)}const U=(D&pi)===pi;return($&1)===1!==U&&(D=n.neg(D)),{x:B,y:D}}else if(y===i&&$===4){const B=n.fromBytes(R.subarray(0,n.BYTES)),k=n.fromBytes(R.subarray(n.BYTES,2*n.BYTES));return{x:B,y:k}}else{const B=s,k=i;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+k+", got "+y)}}}),h=_=>S5(A5(_,t.nByteLength));function f(_){const y=r>>pi;return _>y}function g(_){return f(_)?o(-_):_}const p=(_,y,$)=>Dw(_.slice(y,$));class m{constructor(y,$,R){this.r=y,this.s=$,this.recovery=R,this.assertValidity()}static fromCompact(y){const $=t.nByteLength;return y=yd("compactSignature",y,$*2),new m(p(y,0,$),p(y,$,2*$))}static fromDER(y){const{r:$,s:R}=Pp.toSig(yd("DER",y));return new m($,R)}assertValidity(){Uw("r",this.r,pi,r),Uw("s",this.s,pi,r)}addRecoveryBit(y){return new m(this.r,this.s,y)}recoverPublicKey(y){const{r:$,s:R,recovery:B}=this,k=v(yd("msgHash",y));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const D=B===2||B===3?$+t.n:$;if(D>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const U=(B&1)===0?"02":"03",F=c.fromHex(U+h(D)),K=a(D),q=o(-k*K),H=o(R*K),Z=c.BASE.multiplyAndAddUnsafe(F,q,H);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return y4(this.toDERHex())}toDERHex(){return Pp.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return y4(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const w={isValidPrivateKey(_){try{return l(_),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const _=y2e(t.n);return W6t(t.randomBytes(_),t.n)},precompute(_=8,y=c.BASE){return y._setWindowSize(_),y.multiply(BigInt(3)),y}};function C(_,y=!0){return c.fromPrivateKey(_).toRawBytes(y)}function E(_){const y=ly(_),$=typeof _=="string",R=(y||$)&&_.length;return y?R===s||R===i:$?R===2*s||R===2*i:_ instanceof c}function b(_,y,$=!0){if(E(_))throw new Error("first arg must be private key");if(!E(y))throw new Error("second arg must be public key");return c.fromHex(y).multiply(l(_)).toRawBytes($)}const S=t.bits2int||function(_){if(_.length>8192)throw new Error("input is too large");const y=Dw(_),$=_.length*8-t.nBitLength;return $>0?y>>BigInt($):y},v=t.bits2int_modN||function(_){return o(S(_))},x=bV(t.nBitLength);function A(_){return Uw("num < 2^"+t.nBitLength,_,zp,x),A5(_,t.nByteLength)}function I(_,y,$=O){if(["recovered","canonical"].some(ie=>ie in $))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:B}=t;let{lowS:k,prehash:D,extraEntropy:U}=$;k==null&&(k=!0),_=yd("msgHash",_),sie($),D&&(_=yd("prehashed msgHash",R(_)));const F=v(_),K=l(y),q=[A(K),A(F)];if(U!=null&&U!==!1){const ie=U===!0?B(n.BYTES):U;q.push(yd("extraEntropy",ie))}const H=b4(...q),Z=F;function ee(ie){const X=S(ie);if(!d(X))return;const le=a(X),_e=c.BASE.multiply(X).toAffine(),Ne=o(_e.x);if(Ne===zp)return;const be=o(le*o(Z+Ne*K));if(be===zp)return;let Me=(_e.x===Ne?0:2)|Number(_e.y&pi),Ct=be;return k&&f(be)&&(Ct=g(be),Me^=1),new m(Ne,Ct,Me)}return{seed:H,k2sig:ee}}const O={lowS:t.lowS,prehash:!1},N={lowS:t.lowS,prehash:!1};function T(_,y,$=O){const{seed:R,k2sig:B}=I(_,y,$),k=t;return p2e(k.hash.outputLen,k.nByteLength,k.hmac)(R,B)}c.BASE._setWindowSize(8);function P(_,y,$,R=N){var Me;const B=_;y=yd("msgHash",y),$=yd("publicKey",$);const{lowS:k,prehash:D,format:U}=R;if(sie(R),"strict"in R)throw new Error("options.strict was renamed to lowS");if(U!==void 0&&U!=="compact"&&U!=="der")throw new Error("format must be compact or der");const F=typeof B=="string"||ly(B),K=!F&&!U&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!F&&!K)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let q,H;try{if(K&&(q=new m(B.r,B.s)),F){try{U!=="compact"&&(q=m.fromDER(B))}catch(Ct){if(!(Ct instanceof Pp.Err))throw Ct}!q&&U!=="der"&&(q=m.fromCompact(B))}H=c.fromHex($)}catch{return!1}if(!q||k&&q.hasHighS())return!1;D&&(y=t.hash(y));const{r:Z,s:ee}=q,ie=v(y),X=a(ee),le=o(ie*X),_e=o(Z*X),Ne=(Me=c.BASE.multiplyAndAddUnsafe(H,le,_e))==null?void 0:Me.toAffine();return Ne?o(Ne.x)===Z:!1}return{CURVE:t,getPublicKey:C,getSharedSecret:b,sign:T,verify:P,ProjectivePoint:c,Signature:m,utils:w}}function n3t(e){return{hash:e,hmac:(t,...n)=>d2e(e,t,c6t(...n)),randomBytes:l6t}}function r3t(e,t){const n=r=>t3t({...e,...n3t(r)});return{...n(t),create:n}}const C2e=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),oie=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),s3t=BigInt(1),rF=BigInt(2),aie=(e,t)=>(e+t/rF)/t;function i3t(e){const t=C2e,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Wl(u,n,t)*u%t,h=Wl(d,n,t)*u%t,f=Wl(h,rF,t)*l%t,g=Wl(f,s,t)*f%t,p=Wl(g,i,t)*g%t,m=Wl(p,a,t)*p%t,w=Wl(m,c,t)*m%t,C=Wl(w,a,t)*p%t,E=Wl(C,n,t)*u%t,b=Wl(E,o,t)*g%t,S=Wl(b,r,t)*l%t,v=Wl(S,rF,t);if(!sF.eql(sF.sqr(v),e))throw new Error("Cannot find square root");return v}const sF=m2e(C2e,void 0,void 0,{sqrt:i3t}),$2e=r3t({a:BigInt(0),b:BigInt(7),Fp:sF,n:oie,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=oie,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-s3t*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=aie(i*e,t),c=aie(-r*e,t);let l=tc(e-a*n-c*s,t),u=tc(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},P6t);BigInt(0);$2e.ProjectivePoint;const o3t=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:$2e},Symbol.toStringTag,{value:"Module"}));var a3t={};const c3t=":";function Yv(e){const[t,n]=e.split(c3t);return{namespace:t,reference:n}}function x2e(e,t){return e.includes(":")?[e]:t.chains||[]}var l3t=Object.defineProperty,u3t=Object.defineProperties,d3t=Object.getOwnPropertyDescriptors,cie=Object.getOwnPropertySymbols,h3t=Object.prototype.hasOwnProperty,f3t=Object.prototype.propertyIsEnumerable,lie=(e,t,n)=>t in e?l3t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uie=(e,t)=>{for(var n in t||(t={}))h3t.call(t,n)&&lie(e,n,t[n]);if(cie)for(var n of cie(t))f3t.call(t,n)&&lie(e,n,t[n]);return e},p3t=(e,t)=>u3t(e,d3t(t));const g3t="ReactNative",xv={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function I2e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function S2e(){return!cn.getDocument()&&!!cn.getNavigator()&&navigator.product===g3t}function A2e(){return!I2e()&&!!cn.getNavigator()&&!!cn.getDocument()}function m3t(){return S2e()?xv.reactNative:I2e()?xv.node:A2e()?xv.browser:xv.unknown}function w3t(e){var t,n;const r=y3t();try{return e!=null&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),e.url=r.url),(t=e==null?void 0:e.icons)!=null&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(s=>s!=="")),p3t(uie(uie({},r),e),{url:(e==null?void 0:e.url)||r.url,name:(e==null?void 0:e.name)||r.name,description:(e==null?void 0:e.description)||r.description,icons:(n=e==null?void 0:e.icons)!=null&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(s){return console.warn("Error populating app metadata",s),e||r}}function y3t(){return gC.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Cw(e,t){return e.filter(n=>t.includes(n)).length===e.length}function $2(e=V.FIVE_MINUTES,t){const n=V.toMiliseconds(e||V.FIVE_MINUTES);let r,s,i,o;return{resolve:a=>{i&&r&&(clearTimeout(i),r(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const l=new Error(t);o=Promise.reject(l),c(l)},n),r=a,s=c})}}function b3t(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function ka(e,t){return V.fromMiliseconds(Date.now()+V.toMiliseconds(e))}function x2(e){return Date.now()>=V.toMiliseconds(e)}function $r(e,t){return`${e}${t?`:${t}`:""}`}function Jh(e=[],t=[]){return[...new Set([...e,...t])]}async function v3t({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const s=typeof n=="string"?JSON.parse(n):n,i=s==null?void 0:s.href;if(typeof i!="string")return;const o=E3t(i,e,t),a=m3t();if(a===xv.browser){if(!((r=cn.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}C3t(o)}else a===xv.reactNative&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"&&await globalThis.Linking.openURL(o)}catch(s){console.error(s)}}function E3t(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let s=`${e}`;if(e.startsWith("https://t.me")){const i=e.includes("?")?"&startapp=":"?startapp=";s=`${s}${i}${A3t(r,!0)}`}else s=`${s}/wc?${r}`;return s}function C3t(e){let t="_self";S3t()?t="_top":(I3t()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function $3t(e,t){let n="";try{if(A2e()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function die(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function x3t(){return typeof process<"u"&&a3t.IS_VITEST==="true"}function I3t(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function S3t(){try{return window.self!==window.top}catch{return!1}}function A3t(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function OA(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function _3t(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function b$(e,...t){if(!_3t(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function N3t(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");OA(e.outputLen),OA(e.blockLen)}function _5(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function _2e(e,t){b$(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const AI=BigInt(2**32-1),hie=BigInt(32);function T3t(e,t=!1){return t?{h:Number(e&AI),l:Number(e>>hie&AI)}:{h:Number(e>>hie&AI)|0,l:Number(e&AI)|0}}function P3t(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:o}=T3t(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const O3t=(e,t,n)=>e<<n|t>>>32-n,k3t=(e,t,n)=>t<<n|e>>>32-n,R3t=(e,t,n)=>t<<n-32|e>>>64-n,B3t=(e,t,n)=>e<<n-32|t>>>64-n,I2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function D3t(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function EB(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function $h(e,t){return e<<32-t|e>>>t}const fie=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function U3t(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function pie(e){for(let t=0;t<e.length;t++)e[t]=U3t(e[t])}function L3t(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function OT(e){return typeof e=="string"&&(e=L3t(e)),b$(e),e}function M3t(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];b$(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}let vV=class{clone(){return this._cloneInto()}};function N2e(e){const t=r=>e().update(OT(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function T2e(e=32){if(I2&&typeof I2.getRandomValues=="function")return I2.getRandomValues(new Uint8Array(e));if(I2&&typeof I2.randomBytes=="function")return I2.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}const P2e=[],O2e=[],k2e=[],j3t=BigInt(0),uE=BigInt(1),F3t=BigInt(2),z3t=BigInt(7),q3t=BigInt(256),W3t=BigInt(113);for(let e=0,t=uE,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],P2e.push(2*(5*r+n)),O2e.push((e+1)*(e+2)/2%64);let s=j3t;for(let i=0;i<7;i++)t=(t<<uE^(t>>z3t)*W3t)%q3t,t&F3t&&(s^=uE<<(uE<<BigInt(i))-uE);k2e.push(s)}const[H3t,V3t]=P3t(k2e,!0),gie=(e,t,n)=>n>32?R3t(e,t,n):O3t(e,t,n),mie=(e,t,n)=>n>32?B3t(e,t,n):k3t(e,t,n);function K3t(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],u=n[c+1],d=gie(l,u,1)^n[a],h=mie(l,u,1)^n[a+1];for(let f=0;f<50;f+=10)e[o+f]^=d,e[o+f+1]^=h}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=O2e[o],c=gie(s,i,a),l=mie(s,i,a),u=P2e[o];s=e[u],i=e[u+1],e[u]=c,e[u+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=H3t[r],e[1]^=V3t[r]}n.fill(0)}class EV extends vV{constructor(t,n,r,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,OA(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=D3t(this.state)}keccak(){fie||pie(this.state32),K3t(this.state32,this.rounds),fie||pie(this.state32),this.posOut=0,this.pos=0}update(t){_5(this);const{blockLen:n,state:r}=this;t=OT(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){_5(this,!1),b$(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return OA(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(_2e(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new EV(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}}const G3t=(e,t,n)=>N2e(()=>new EV(t,e,n)),Z3t=G3t(1,136,256/8),Y3t="https://rpc.walletconnect.org/v1";function R2e(e){const t=`�Ethereum Signed Message: 157${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(Z3t(n)).toString("hex")}async function J3t(e,t,n,r,s,i){switch(n.t){case"eip191":return await X3t(e,t,n.s);case"eip1271":return await Q3t(e,t,n.s,r,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}async function X3t(e,t,n){return(await x6t({hash:R2e(t),signature:n})).toLowerCase()===e.toLowerCase()}async function Q3t(e,t,n,r,s,i){const o=Yv(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",l="0000000000000000000000000000000000000000000000000000000000000041",u=n.substring(2),d=R2e(t).substring(2),h=a+d+c+l+u,f=await fetch(`${i||Y3t}/?chainId=${r}&projectId=${s}`,{method:"POST",body:JSON.stringify({id:eEt(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:h},"latest"]})}),{result:g}=await f.json();return g?g.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function eEt(){return Date.now()+Math.floor(Math.random()*1e3)}function tEt(e){const t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);const r=n[0];if(r===0)throw new Error("No signatures found");const s=1+r*64;if(n.length<s)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const i=Buffer.from(e,"base64").slice(1,65);return l1.encode(i)}var nEt=Object.defineProperty,rEt=Object.defineProperties,sEt=Object.getOwnPropertyDescriptors,wie=Object.getOwnPropertySymbols,iEt=Object.prototype.hasOwnProperty,oEt=Object.prototype.propertyIsEnumerable,yie=(e,t,n)=>t in e?nEt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aEt=(e,t)=>{for(var n in t||(t={}))iEt.call(t,n)&&yie(e,n,t[n]);if(wie)for(var n of wie(t))oEt.call(t,n)&&yie(e,n,t[n]);return e},cEt=(e,t)=>rEt(e,sEt(t));const lEt="did:pkh:",CV=e=>e==null?void 0:e.split(":"),uEt=e=>{const t=e&&CV(e);if(t)return e.includes(lEt)?t[3]:t[1]},iF=e=>{const t=e&&CV(e);if(t)return t[2]+":"+t[3]},kA=e=>{const t=e&&CV(e);if(t)return t.pop()};async function bie(e){const{cacao:t,projectId:n}=e,{s:r,p:s}=t,i=B2e(s,s.iss),o=kA(s.iss);return await J3t(o,i,r,iF(s.iss),n)}const B2e=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=kA(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,o=`Version: ${e.version}`,a=`Chain ID: ${uEt(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map(p=>` 158- ${p}`).join("")}`:void 0,g=RS(e.resources);if(g){const p=v4(g);s=bEt(s,p)}return[n,r,"",s,"",i,o,a,c,l,u,d,h,f].filter(p=>p!=null).join(` 159`)};function dEt(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function hEt(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function uy(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(s=>{const i=r[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);i.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function fEt(e,t,n,r={}){return n==null||n.sort((s,i)=>s.localeCompare(i)),{att:{[e]:pEt(t,n,r)}}}function pEt(e,t,n={}){t=t==null?void 0:t.sort((s,i)=>s.localeCompare(i));const r=t.map(s=>({[`${e}/${s}`]:[n]}));return Object.assign({},...r)}function D2e(e){return uy(e),`urn:recap:${dEt(e).replace(/=/g,"")}`}function v4(e){const t=hEt(e.replace("urn:recap:",""));return uy(t),t}function gEt(e,t,n){const r=fEt(e,t,n);return D2e(r)}function mEt(e){return e&&e.includes("urn:recap:")}function wEt(e,t){const n=v4(e),r=v4(t),s=yEt(n,r);return D2e(s)}function yEt(e,t){uy(e),uy(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((s,i)=>s.localeCompare(i)),r={att:{}};return n.forEach(s=>{var i,o;Object.keys(((i=e.att)==null?void 0:i[s])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,l;r.att[s]=cEt(aEt({},r.att[s]),{[a]:((c=e.att[s])==null?void 0:c[a])||((l=t.att[s])==null?void 0:l[a])})})}),r}function bEt(e="",t){uy(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let s=0;Object.keys(t.att).forEach(a=>{const c=Object.keys(t.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));c.sort((d,h)=>d.action.localeCompare(h.action));const l={};c.forEach(d=>{l[d.ability]||(l[d.ability]=[]),l[d.ability].push(d.action)});const u=Object.keys(l).map(d=>(s++,`(${s}) '${d}': '${l[d].join("', '")}' for '${a}'.`));r.push(u.join(", ").replace(".,","."))});const i=r.join(" "),o=`${n}${i}`;return`${e?e+" ":""}${o}`}function vie(e){var t;const n=v4(e);uy(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(s=>s.split("/")[1]):[]}function Eie(e){const t=v4(e);uy(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(s=>{var i;(i=s==null?void 0:s[0])!=null&&i.chains&&n.push(s[0].chains)})}),[...new Set(n.flat())]}function RS(e){if(!e)return;const t=e==null?void 0:e[e.length-1];return mEt(t)?t:void 0}function CB(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function U2e(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function tl(e,...t){if(!U2e(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cie(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function vEt(e,t){tl(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function $ie(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}const _m=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),EEt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),CEt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!CEt)throw new Error("Non little-endian hardware is not supported");function $Et(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function oF(e){if(typeof e=="string")e=$Et(e);else if(U2e(e))e=aF(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function xEt(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function IEt(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const SEt=(e,t)=>{function n(r,...s){if(tl(r),e.nonceLength!==void 0){const l=s[0];if(!l)throw new Error("nonce / iv required");e.varSizeNonce?tl(l):tl(l,e.nonceLength)}const i=e.tagLength;i&&s[1]!==void 0&&tl(s[1]);const o=t(r,...s),a=(l,u)=>{if(u!==void 0){if(l!==2)throw new Error("cipher output not supported");tl(u)}};let c=!1;return{encrypt(l,u){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,tl(l),a(o.encrypt.length,u),o.encrypt(l,u)},decrypt(l,u){if(tl(l),i&&l.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,u),o.decrypt(l,u)}}}return Object.assign(n,e),n};function xie(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!AEt(t))throw new Error("invalid output, must be aligned");return t}function Iie(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i);e.setUint32(t+4,o,r),e.setUint32(t+0,a,r)}function AEt(e){return e.byteOffset%4===0}function aF(e){return Uint8Array.from(e)}function N5(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const L2e=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),_Et=L2e("expand 16-byte k"),NEt=L2e("expand 32-byte k"),TEt=_m(_Et),PEt=_m(NEt);function Kn(e,t){return e<<t|e>>>32-t}function cF(e){return e.byteOffset%4===0}const _I=64,OEt=16,M2e=2**32-1,Sie=new Uint32Array;function kEt(e,t,n,r,s,i,o,a){const c=s.length,l=new Uint8Array(_I),u=_m(l),d=cF(s)&&cF(i),h=d?_m(s):Sie,f=d?_m(i):Sie;for(let g=0;g<c;o++){if(e(t,n,r,u,o,a),o>=M2e)throw new Error("arx: counter overflow");const p=Math.min(_I,c-g);if(d&&p===_I){const m=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let w=0,C;w<OEt;w++)C=m+w,f[C]=h[C]^u[w];g+=_I;continue}for(let m=0,w;m<p;m++)w=g+m,i[w]=s[w]^l[m];g+=p}}function REt(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:s,counterRight:i,rounds:o}=xEt({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return CB(s),CB(o),$ie(i),$ie(n),(a,c,l,u,d=0)=>{tl(a),tl(c),tl(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),tl(u),CB(d),d<0||d>=M2e)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g=a.length,p,m;if(g===32)f.push(p=aF(a)),m=PEt;else if(g===16&&n)p=new Uint8Array(32),p.set(a),p.set(a,16),m=TEt,f.push(p);else throw new Error(`arx: invalid 32-byte key, got length=${g}`);cF(c)||f.push(c=aF(c));const w=_m(p);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,w,_m(c.subarray(0,16)),w),c=c.subarray(16)}const C=16-s;if(C!==c.length)throw new Error(`arx: nonce must be ${C} or 16 bytes`);if(C!==12){const b=new Uint8Array(12);b.set(c,i?0:12-c.length),c=b,f.push(c)}const E=_m(c);return kEt(e,m,w,E,l,u,d,o),N5(...f),u}}const Hi=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class BEt{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=oF(t),tl(t,32);const n=Hi(t,0),r=Hi(t,2),s=Hi(t,4),i=Hi(t,6),o=Hi(t,8),a=Hi(t,10),c=Hi(t,12),l=Hi(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Hi(t,16+2*u)}process(t,n,r=!1){const s=r?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],l=o[2],u=o[3],d=o[4],h=o[5],f=o[6],g=o[7],p=o[8],m=o[9],w=Hi(t,n+0),C=Hi(t,n+2),E=Hi(t,n+4),b=Hi(t,n+6),S=Hi(t,n+8),v=Hi(t,n+10),x=Hi(t,n+12),A=Hi(t,n+14);let I=i[0]+(w&8191),O=i[1]+((w>>>13|C<<3)&8191),N=i[2]+((C>>>10|E<<6)&8191),T=i[3]+((E>>>7|b<<9)&8191),P=i[4]+((b>>>4|S<<12)&8191),_=i[5]+(S>>>1&8191),y=i[6]+((S>>>14|v<<2)&8191),$=i[7]+((v>>>11|x<<5)&8191),R=i[8]+((x>>>8|A<<8)&8191),B=i[9]+(A>>>5|s),k=0,D=k+I*a+O*(5*m)+N*(5*p)+T*(5*g)+P*(5*f);k=D>>>13,D&=8191,D+=_*(5*h)+y*(5*d)+$*(5*u)+R*(5*l)+B*(5*c),k+=D>>>13,D&=8191;let U=k+I*c+O*a+N*(5*m)+T*(5*p)+P*(5*g);k=U>>>13,U&=8191,U+=_*(5*f)+y*(5*h)+$*(5*d)+R*(5*u)+B*(5*l),k+=U>>>13,U&=8191;let F=k+I*l+O*c+N*a+T*(5*m)+P*(5*p);k=F>>>13,F&=8191,F+=_*(5*g)+y*(5*f)+$*(5*h)+R*(5*d)+B*(5*u),k+=F>>>13,F&=8191;let K=k+I*u+O*l+N*c+T*a+P*(5*m);k=K>>>13,K&=8191,K+=_*(5*p)+y*(5*g)+$*(5*f)+R*(5*h)+B*(5*d),k+=K>>>13,K&=8191;let q=k+I*d+O*u+N*l+T*c+P*a;k=q>>>13,q&=8191,q+=_*(5*m)+y*(5*p)+$*(5*g)+R*(5*f)+B*(5*h),k+=q>>>13,q&=8191;let H=k+I*h+O*d+N*u+T*l+P*c;k=H>>>13,H&=8191,H+=_*a+y*(5*m)+$*(5*p)+R*(5*g)+B*(5*f),k+=H>>>13,H&=8191;let Z=k+I*f+O*h+N*d+T*u+P*l;k=Z>>>13,Z&=8191,Z+=_*c+y*a+$*(5*m)+R*(5*p)+B*(5*g),k+=Z>>>13,Z&=8191;let ee=k+I*g+O*f+N*h+T*d+P*u;k=ee>>>13,ee&=8191,ee+=_*l+y*c+$*a+R*(5*m)+B*(5*p),k+=ee>>>13,ee&=8191;let ie=k+I*p+O*g+N*f+T*h+P*d;k=ie>>>13,ie&=8191,ie+=_*u+y*l+$*c+R*a+B*(5*m),k+=ie>>>13,ie&=8191;let X=k+I*m+O*p+N*g+T*f+P*h;k=X>>>13,X&=8191,X+=_*d+y*u+$*l+R*c+B*a,k+=X>>>13,X&=8191,k=(k<<2)+k|0,k=k+D|0,D=k&8191,k=k>>>13,U+=k,i[0]=D,i[1]=U,i[2]=F,i[3]=K,i[4]=q,i[5]=H,i[6]=Z,i[7]=ee,i[8]=ie,i[9]=X}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let s=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=s,s=t[a]>>>13,t[a]&=8191;t[0]+=s*5,s=t[0]>>>13,t[0]&=8191,t[1]+=s,s=t[1]>>>13,t[1]&=8191,t[2]+=s,r[0]=t[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)t[a]=t[a]&i|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+n[0];t[0]=o&65535;for(let a=1;a<8;a++)o=(t[a]+n[a]|0)+(o>>>16)|0,t[a]=o&65535;N5(r)}update(t){Cie(this);const{buffer:n,blockLen:r}=this;t=oF(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o===r){for(;r<=s-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){N5(this.h,this.r,this.buffer,this.pad)}digestInto(t){Cie(this),vEt(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)t[i++]=r[o]>>>0,t[i++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function DEt(e){const t=(r,s)=>e(s).update(oF(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const UEt=DEt(e=>new BEt(e));function LEt(e,t,n,r,s,i=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],d=t[1],h=t[2],f=t[3],g=t[4],p=t[5],m=t[6],w=t[7],C=s,E=n[0],b=n[1],S=n[2],v=o,x=a,A=c,I=l,O=u,N=d,T=h,P=f,_=g,y=p,$=m,R=w,B=C,k=E,D=b,U=S;for(let K=0;K<i;K+=2)v=v+O|0,B=Kn(B^v,16),_=_+B|0,O=Kn(O^_,12),v=v+O|0,B=Kn(B^v,8),_=_+B|0,O=Kn(O^_,7),x=x+N|0,k=Kn(k^x,16),y=y+k|0,N=Kn(N^y,12),x=x+N|0,k=Kn(k^x,8),y=y+k|0,N=Kn(N^y,7),A=A+T|0,D=Kn(D^A,16),$=$+D|0,T=Kn(T^$,12),A=A+T|0,D=Kn(D^A,8),$=$+D|0,T=Kn(T^$,7),I=I+P|0,U=Kn(U^I,16),R=R+U|0,P=Kn(P^R,12),I=I+P|0,U=Kn(U^I,8),R=R+U|0,P=Kn(P^R,7),v=v+N|0,U=Kn(U^v,16),$=$+U|0,N=Kn(N^$,12),v=v+N|0,U=Kn(U^v,8),$=$+U|0,N=Kn(N^$,7),x=x+T|0,B=Kn(B^x,16),R=R+B|0,T=Kn(T^R,12),x=x+T|0,B=Kn(B^x,8),R=R+B|0,T=Kn(T^R,7),A=A+P|0,k=Kn(k^A,16),_=_+k|0,P=Kn(P^_,12),A=A+P|0,k=Kn(k^A,8),_=_+k|0,P=Kn(P^_,7),I=I+O|0,D=Kn(D^I,16),y=y+D|0,O=Kn(O^y,12),I=I+O|0,D=Kn(D^I,8),y=y+D|0,O=Kn(O^y,7);let F=0;r[F++]=o+v|0,r[F++]=a+x|0,r[F++]=c+A|0,r[F++]=l+I|0,r[F++]=u+O|0,r[F++]=d+N|0,r[F++]=h+T|0,r[F++]=f+P|0,r[F++]=g+_|0,r[F++]=p+y|0,r[F++]=m+$|0,r[F++]=w+R|0,r[F++]=C+B|0,r[F++]=E+k|0,r[F++]=b+D|0,r[F++]=S+U|0}const MEt=REt(LEt,{counterRight:!1,counterLength:4,allowShortKeys:!1}),jEt=new Uint8Array(16),Aie=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(jEt.subarray(n))},FEt=new Uint8Array(32);function _ie(e,t,n,r,s){const i=e(t,n,FEt),o=UEt.create(i);s&&Aie(o,s),Aie(o,r);const a=new Uint8Array(16),c=EEt(a);Iie(c,0,BigInt(s?s.length:0),!0),Iie(c,8,BigInt(r.length),!0),o.update(a);const l=o.digest();return N5(i,a),l}const zEt=e=>(t,n,r)=>({encrypt(s,i){const o=s.length;i=xie(o+16,i,!1),i.set(s);const a=i.subarray(0,-16);e(t,n,a,a,1);const c=_ie(e,t,n,a,r);return i.set(c,o),N5(c),i},decrypt(s,i){i=xie(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=_ie(e,t,n,o,r);if(!IEt(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),N5(c),i}});SEt({blockSize:64,nonceLength:12,tagLength:16},zEt(MEt));class j2e extends vV{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,N3t(t);const r=OT(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(t){return _5(this),this.iHash.update(t),this}digestInto(t){_5(this),b$(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const F2e=(e,t,n)=>new j2e(e,t).update(n).digest();F2e.create=(e,t)=>new j2e(e,t);function qEt(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,a,r)}function WEt(e,t,n){return e&t^~e&n}function HEt(e,t,n){return e&t^e&n^t&n}let VEt=class extends vV{constructor(t,n,r,s){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=EB(this.buffer)}update(t){_5(this);const{view:n,buffer:r,blockLen:s}=this;t=OT(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=EB(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){_5(this),_2e(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;qEt(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=EB(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,u[d],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return t.length=s,t.pos=a,t.finished=i,t.destroyed=o,s%n&&t.buffer.set(r),t}};const KEt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_g=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ng=new Uint32Array(64);class GEt extends VEt{constructor(){super(64,32,8,!1),this.A=_g[0]|0,this.B=_g[1]|0,this.C=_g[2]|0,this.D=_g[3]|0,this.E=_g[4]|0,this.F=_g[5]|0,this.G=_g[6]|0,this.H=_g[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)Ng[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=Ng[d-15],f=Ng[d-2],g=$h(h,7)^$h(h,18)^h>>>3,p=$h(f,17)^$h(f,19)^f>>>10;Ng[d]=p+Ng[d-7]+g+Ng[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=$h(a,6)^$h(a,11)^$h(a,25),f=u+h+WEt(a,c,l)+KEt[d]+Ng[d]|0,g=($h(r,2)^$h(r,13)^$h(r,22))+HEt(r,s,i)|0;u=l,l=c,c=a,a=o+f|0,o=i,i=s,s=r,r=f+g|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,c,l,u)}roundClean(){Ng.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const $V=N2e(()=>new GEt);const kT=BigInt(0),RT=BigInt(1),ZEt=BigInt(2);function dy(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function v$(e){if(!dy(e))throw new Error("Uint8Array expected")}function T5(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}const YEt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function P5(e){v$(e);let t="";for(let n=0;n<e.length;n++)t+=YEt[e[n]];return t}function Iv(e){const t=e.toString(16);return t.length&1?"0"+t:t}function xV(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?kT:BigInt("0x"+e)}const Jf={_0:48,_9:57,A:65,F:70,a:97,f:102};function Nie(e){if(e>=Jf._0&&e<=Jf._9)return e-Jf._0;if(e>=Jf.A&&e<=Jf.F)return e-(Jf.A-10);if(e>=Jf.a&&e<=Jf.f)return e-(Jf.a-10)}function O5(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Nie(e.charCodeAt(i)),a=Nie(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function Lw(e){return xV(P5(e))}function E4(e){return v$(e),xV(P5(Uint8Array.from(e).reverse()))}function k5(e,t){return O5(e.toString(16).padStart(t*2,"0"))}function BT(e,t){return k5(e,t).reverse()}function JEt(e){return O5(Iv(e))}function Qc(e,t,n){let r;if(typeof t=="string")try{r=O5(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(dy(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function C4(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];v$(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}function XEt(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function QEt(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}const $B=e=>typeof e=="bigint"&&kT<=e;function DT(e,t,n){return $B(e)&&$B(t)&&$B(n)&&t<=e&&e<n}function l0(e,t,n,r){if(!DT(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function z2e(e){let t;for(t=0;e>kT;e>>=RT,t+=1);return t}function e8t(e,t){return e>>BigInt(t)&RT}function t8t(e,t,n){return e|(n?RT:kT)<<BigInt(t)}const IV=e=>(ZEt<<BigInt(e-1))-RT,xB=e=>new Uint8Array(e),Tie=e=>Uint8Array.from(e);function q2e(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=xB(e),s=xB(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...u)=>n(s,r,...u),c=(u=xB())=>{s=a(Tie([0]),u),r=a(),u.length!==0&&(s=a(Tie([1]),u),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<t;){r=a();const h=r.slice();d.push(h),u+=r.length}return C4(...d)};return(u,d)=>{o(),c(u);let h;for(;!(h=d(l()));)c();return o(),h}}const n8t={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||dy(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function z6(e,t,n={}){const r=(s,i,o)=>{const a=n8t[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}const r8t=()=>{throw new Error("not implemented")};function lF(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}var s8t=Object.freeze({__proto__:null,isBytes:dy,abytes:v$,abool:T5,bytesToHex:P5,numberToHexUnpadded:Iv,hexToNumber:xV,hexToBytes:O5,bytesToNumberBE:Lw,bytesToNumberLE:E4,numberToBytesBE:k5,numberToBytesLE:BT,numberToVarBytesBE:JEt,ensureBytes:Qc,concatBytes:C4,equalBytes:XEt,utf8ToBytes:QEt,inRange:DT,aInRange:l0,bitLen:z2e,bitGet:e8t,bitSet:t8t,bitMask:IV,createHmacDrbg:q2e,validateObject:z6,notImplemented:r8t,memoized:lF});const _i=BigInt(0),bs=BigInt(1),rw=BigInt(2),i8t=BigInt(3),uF=BigInt(4),Pie=BigInt(5),Oie=BigInt(8);function nc(e,t){const n=e%t;return n>=_i?n:t+n}function W2e(e,t,n){if(t<_i)throw new Error("invalid exponent, negatives unsupported");if(n<=_i)throw new Error("invalid modulus");if(n===bs)return _i;let r=bs;for(;t>_i;)t&bs&&(r=r*e%n),e=e*e%n,t>>=bs;return r}function hd(e,t,n){let r=e;for(;t-- >_i;)r*=r,r%=n;return r}function dF(e,t){if(e===_i)throw new Error("invert: expected non-zero number");if(t<=_i)throw new Error("invert: expected positive modulus, got "+t);let n=nc(e,t),r=t,s=_i,i=bs;for(;n!==_i;){const o=r/n,a=r%n,c=s-i*o;r=n,n=a,s=i,i=c}if(r!==bs)throw new Error("invert: does not exist");return nc(s,t)}function o8t(e){const t=(e-bs)/rw;let n,r,s;for(n=e-bs,r=0;n%rw===_i;n/=rw,r++);for(s=rw;s<e&&W2e(s,t,e)!==e-bs;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+bs)/uF;return function(a,c){const l=a.pow(c,o);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const i=(n+bs)/rw;return function(o,a){if(o.pow(a,t)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,s),n),u=o.pow(a,i),d=o.pow(a,n);for(;!o.eql(d,o.ONE);){if(o.eql(d,o.ZERO))return o.ZERO;let h=1;for(let g=o.sqr(d);h<c&&!o.eql(g,o.ONE);h++)g=o.sqr(g);const f=o.pow(l,bs<<BigInt(c-h-1));l=o.sqr(f),u=o.mul(u,f),d=o.mul(d,l),c=h}return u}}function a8t(e){if(e%uF===i8t){const t=(e+bs)/uF;return function(n,r){const s=n.pow(r,t);if(!n.eql(n.sqr(s),r))throw new Error("Cannot find square root");return s}}if(e%Oie===Pie){const t=(e-Pie)/Oie;return function(n,r){const s=n.mul(r,rw),i=n.pow(s,t),o=n.mul(r,i),a=n.mul(n.mul(o,rw),i),c=n.mul(o,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),r))throw new Error("Cannot find square root");return c}}return o8t(e)}const c8t=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function l8t(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=c8t.reduce((r,s)=>(r[s]="function",r),t);return z6(e,n)}function u8t(e,t,n){if(n<_i)throw new Error("invalid exponent, negatives unsupported");if(n===_i)return e.ONE;if(n===bs)return t;let r=e.ONE,s=t;for(;n>_i;)n&bs&&(r=e.mul(r,s)),s=e.sqr(s),n>>=bs;return r}function d8t(e,t){const n=new Array(t.length),r=t.reduce((i,o,a)=>e.is0(o)?i:(n[a]=i,e.mul(i,o)),e.ONE),s=e.inv(r);return t.reduceRight((i,o,a)=>e.is0(o)?i:(n[a]=e.mul(i,n[a]),e.mul(i,o)),s),n}function H2e(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function V2e(e,t,n=!1,r={}){if(e<=_i)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=H2e(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:IV(s),ZERO:_i,ONE:bs,create:c=>nc(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return _i<=c&&c<e},is0:c=>c===_i,isOdd:c=>(c&bs)===bs,neg:c=>nc(-c,e),eql:(c,l)=>c===l,sqr:c=>nc(c*c,e),add:(c,l)=>nc(c+l,e),sub:(c,l)=>nc(c-l,e),mul:(c,l)=>nc(c*l,e),pow:(c,l)=>u8t(a,c,l),div:(c,l)=>nc(c*dF(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>dF(c,e),sqrt:r.sqrt||(c=>(o||(o=a8t(e)),o(a,c))),invertBatch:c=>d8t(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>n?BT(c,i):k5(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?E4(c):Lw(c)}});return Object.freeze(a)}function K2e(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function G2e(e){const t=K2e(e);return t+Math.ceil(t/2)}function h8t(e,t,n=!1){const r=e.length,s=K2e(t),i=G2e(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?E4(e):Lw(e),a=nc(o,t-bs)+bs;return n?BT(a,s):k5(a,s)}const kie=BigInt(0),NI=BigInt(1);function IB(e,t){const n=t.negate();return e?n:t}function Z2e(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function SB(e,t){Z2e(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1);return{windows:n,windowSize:r}}function f8t(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function p8t(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const AB=new WeakMap,Y2e=new WeakMap;function _B(e){return Y2e.get(e)||1}function g8t(e,t){return{constTimeNegate:IB,hasPrecomputes(n){return _B(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>kie;)r&NI&&(s=s.add(i)),i=i.double(),r>>=NI;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=SB(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){const{windows:i,windowSize:o}=SB(n,t);let a=e.ZERO,c=e.BASE;const l=BigInt(2**n-1),u=2**n,d=BigInt(n);for(let h=0;h<i;h++){const f=h*o;let g=Number(s&l);s>>=d,g>o&&(g-=u,s+=NI);const p=f,m=f+Math.abs(g)-1,w=h%2!==0,C=g<0;g===0?c=c.add(IB(w,r[p])):a=a.add(IB(C,r[m]))}return{p:a,f:c}},wNAFUnsafe(n,r,s,i=e.ZERO){const{windows:o,windowSize:a}=SB(n,t),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let d=0;d<o;d++){const h=d*a;if(s===kie)break;let f=Number(s&c);if(s>>=u,f>a&&(f-=l,s+=NI),f===0)continue;let g=r[h+Math.abs(f)-1];f<0&&(g=g.negate()),i=i.add(g)}return i},getPrecomputes(n,r,s){let i=AB.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&AB.set(r,s(i))),i},wNAFCached(n,r,s){const i=_B(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=_B(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){Z2e(r,t),Y2e.set(n,r),AB.delete(n)}}}function m8t(e,t,n,r){if(f8t(n,e),p8t(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,i=z2e(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s),l=Math.floor((t.BITS-1)/o)*o;let u=s;for(let d=l;d>=0;d-=o){c.fill(s);for(let f=0;f<r.length;f++){const g=r[f],p=Number(g>>BigInt(d)&BigInt(a));c[p]=c[p].add(n[f])}let h=s;for(let f=c.length-1,g=s;f>0;f--)g=g.add(c[f]),h=h.add(g);if(u=u.add(h),d!==0)for(let f=0;f<o;f++)u=u.double()}return u}function J2e(e){return l8t(e.Fp),z6(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...H2e(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const S2=BigInt(0),NB=BigInt(1);function w8t(e){return z6(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})}function y8t(e){const t=w8t(e),{P:n}=t,r=C=>nc(C,n),s=t.montgomeryBits,i=Math.ceil(s/8),o=t.nByteLength,a=t.adjustScalarBytes||(C=>C),c=t.powPminus2||(C=>W2e(C,n-BigInt(2),n));function l(C,E,b){const S=r(C*(E-b));return E=r(E-S),b=r(b+S),[E,b]}const u=(t.a-BigInt(2))/BigInt(4);function d(C,E){l0("u",C,S2,n),l0("scalar",E,S2,n);const b=E,S=C;let v=NB,x=S2,A=C,I=NB,O=S2,N;for(let P=BigInt(s-1);P>=S2;P--){const _=b>>P&NB;O^=_,N=l(O,v,A),v=N[0],A=N[1],N=l(O,x,I),x=N[0],I=N[1],O=_;const y=v+x,$=r(y*y),R=v-x,B=r(R*R),k=$-B,D=A+I,U=A-I,F=r(U*y),K=r(D*R),q=F+K,H=F-K;A=r(q*q),I=r(S*r(H*H)),v=r($*B),x=r(k*($+r(u*k)))}N=l(O,v,A),v=N[0],A=N[1],N=l(O,x,I),x=N[0],I=N[1];const T=c(x);return r(v*T)}function h(C){return BT(r(C),i)}function f(C){const E=Qc("u coordinate",C,i);return o===32&&(E[31]&=127),E4(E)}function g(C){const E=Qc("scalar",C),b=E.length;if(b!==i&&b!==o){let S=""+i+" or "+o;throw new Error("invalid scalar, expected "+S+" bytes, got "+b)}return E4(a(E))}function p(C,E){const b=f(E),S=g(C),v=d(b,S);if(v===S2)throw new Error("invalid private or public key received");return h(v)}const m=h(t.Gu);function w(C){return p(C,m)}return{scalarMult:p,scalarMultBase:w,getSharedSecret:(C,E)=>p(C,E),getPublicKey:C=>w(C),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:m}}const hF=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);const b8t=BigInt(1),Rie=BigInt(2),v8t=BigInt(3),E8t=BigInt(5);BigInt(8);function C8t(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=hF,o=e*e%i*e%i,a=hd(o,Rie,i)*o%i,c=hd(a,b8t,i)*e%i,l=hd(c,E8t,i)*c%i,u=hd(l,t,i)*l%i,d=hd(u,n,i)*u%i,h=hd(d,r,i)*d%i,f=hd(h,s,i)*h%i,g=hd(f,s,i)*h%i,p=hd(g,t,i)*l%i;return{pow_p_5_8:hd(p,Rie,i)*e%i,b2:o}}function $8t(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}y8t({P:hF,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=hF,{pow_p_5_8:n,b2:r}=C8t(e);return nc(hd(n,v8t,t)*r,t)},adjustScalarBytes:$8t,randomBytes:T2e});function Bie(e){e.lowS!==void 0&&T5("lowS",e.lowS),e.prehash!==void 0&&T5("prehash",e.prehash)}function x8t(e){const t=J2e(e);z6(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:I8t,hexToBytes:S8t}=s8t;class A8t extends Error{constructor(t=""){super(t)}}const Op={Err:A8t,_tlv:{encode:(e,t)=>{const{Err:n}=Op;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=Iv(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?Iv(s.length/2|128):"";return Iv(e)+i+s+t},decode(e,t){const{Err:n}=Op;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Op;if(e<qp)throw new t("integer: negative integers are not allowed");let n=Iv(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Op;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return I8t(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Op,s=typeof e=="string"?S8t(e):e;v$(s);const{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Op,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}},qp=BigInt(0),gi=BigInt(1);BigInt(2);const Die=BigInt(3);BigInt(4);function _8t(e){const t=x8t(e),{Fp:n}=t,r=V2e(t.n,t.nBitLength),s=t.toBytes||((p,m,w)=>{const C=m.toAffine();return C4(Uint8Array.from([4]),n.toBytes(C.x),n.toBytes(C.y))}),i=t.fromBytes||(p=>{const m=p.subarray(1),w=n.fromBytes(m.subarray(0,n.BYTES)),C=n.fromBytes(m.subarray(n.BYTES,2*n.BYTES));return{x:w,y:C}});function o(p){const{a:m,b:w}=t,C=n.sqr(p),E=n.mul(C,p);return n.add(n.add(E,n.mul(p,m)),w)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return DT(p,gi,t.n)}function c(p){const{allowedPrivateKeyLengths:m,nByteLength:w,wrapPrivateKey:C,n:E}=t;if(m&&typeof p!="bigint"){if(dy(p)&&(p=P5(p)),typeof p!="string"||!m.includes(p.length))throw new Error("invalid private key");p=p.padStart(w*2,"0")}let b;try{b=typeof p=="bigint"?p:Lw(Qc("private key",p,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof p)}return C&&(b=nc(b,E)),l0("private key",b,gi,E),b}function l(p){if(!(p instanceof h))throw new Error("ProjectivePoint expected")}const u=lF((p,m)=>{const{px:w,py:C,pz:E}=p;if(n.eql(E,n.ONE))return{x:w,y:C};const b=p.is0();m==null&&(m=b?n.ONE:n.inv(E));const S=n.mul(w,m),v=n.mul(C,m),x=n.mul(E,m);if(b)return{x:n.ZERO,y:n.ZERO};if(!n.eql(x,n.ONE))throw new Error("invZ was invalid");return{x:S,y:v}}),d=lF(p=>{if(p.is0()){if(t.allowInfinityPoint&&!n.is0(p.py))return;throw new Error("bad point: ZERO")}const{x:m,y:w}=p.toAffine();if(!n.isValid(m)||!n.isValid(w))throw new Error("bad point: x or y not FE");const C=n.sqr(w),E=o(m);if(!n.eql(C,E))throw new Error("bad point: equation left != right");if(!p.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class h{constructor(m,w,C){if(this.px=m,this.py=w,this.pz=C,m==null||!n.isValid(m))throw new Error("x required");if(w==null||!n.isValid(w))throw new Error("y required");if(C==null||!n.isValid(C))throw new Error("z required");Object.freeze(this)}static fromAffine(m){const{x:w,y:C}=m||{};if(!m||!n.isValid(w)||!n.isValid(C))throw new Error("invalid affine point");if(m instanceof h)throw new Error("projective point not allowed");const E=b=>n.eql(b,n.ZERO);return E(w)&&E(C)?h.ZERO:new h(w,C,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const w=n.invertBatch(m.map(C=>C.pz));return m.map((C,E)=>C.toAffine(w[E])).map(h.fromAffine)}static fromHex(m){const w=h.fromAffine(i(Qc("pointHex",m)));return w.assertValidity(),w}static fromPrivateKey(m){return h.BASE.multiply(c(m))}static msm(m,w){return m8t(h,r,m,w)}_setWindowSize(m){g.setWindowSize(this,m)}assertValidity(){d(this)}hasEvenY(){const{y:m}=this.toAffine();if(n.isOdd)return!n.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){l(m);const{px:w,py:C,pz:E}=this,{px:b,py:S,pz:v}=m,x=n.eql(n.mul(w,v),n.mul(b,E)),A=n.eql(n.mul(C,v),n.mul(S,E));return x&&A}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:m,b:w}=t,C=n.mul(w,Die),{px:E,py:b,pz:S}=this;let v=n.ZERO,x=n.ZERO,A=n.ZERO,I=n.mul(E,E),O=n.mul(b,b),N=n.mul(S,S),T=n.mul(E,b);return T=n.add(T,T),A=n.mul(E,S),A=n.add(A,A),v=n.mul(m,A),x=n.mul(C,N),x=n.add(v,x),v=n.sub(O,x),x=n.add(O,x),x=n.mul(v,x),v=n.mul(T,v),A=n.mul(C,A),N=n.mul(m,N),T=n.sub(I,N),T=n.mul(m,T),T=n.add(T,A),A=n.add(I,I),I=n.add(A,I),I=n.add(I,N),I=n.mul(I,T),x=n.add(x,I),N=n.mul(b,S),N=n.add(N,N),I=n.mul(N,T),v=n.sub(v,I),A=n.mul(N,O),A=n.add(A,A),A=n.add(A,A),new h(v,x,A)}add(m){l(m);const{px:w,py:C,pz:E}=this,{px:b,py:S,pz:v}=m;let x=n.ZERO,A=n.ZERO,I=n.ZERO;const O=t.a,N=n.mul(t.b,Die);let T=n.mul(w,b),P=n.mul(C,S),_=n.mul(E,v),y=n.add(w,C),$=n.add(b,S);y=n.mul(y,$),$=n.add(T,P),y=n.sub(y,$),$=n.add(w,E);let R=n.add(b,v);return $=n.mul($,R),R=n.add(T,_),$=n.sub($,R),R=n.add(C,E),x=n.add(S,v),R=n.mul(R,x),x=n.add(P,_),R=n.sub(R,x),I=n.mul(O,$),x=n.mul(N,_),I=n.add(x,I),x=n.sub(P,I),I=n.add(P,I),A=n.mul(x,I),P=n.add(T,T),P=n.add(P,T),_=n.mul(O,_),$=n.mul(N,$),P=n.add(P,_),_=n.sub(T,_),_=n.mul(O,_),$=n.add($,_),T=n.mul(P,$),A=n.add(A,T),T=n.mul(R,$),x=n.mul(y,x),x=n.sub(x,T),T=n.mul(y,P),I=n.mul(R,I),I=n.add(I,T),new h(x,A,I)}subtract(m){return this.add(m.negate())}is0(){return this.equals(h.ZERO)}wNAF(m){return g.wNAFCached(this,m,h.normalizeZ)}multiplyUnsafe(m){const{endo:w,n:C}=t;l0("scalar",m,qp,C);const E=h.ZERO;if(m===qp)return E;if(this.is0()||m===gi)return this;if(!w||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,m,h.normalizeZ);let{k1neg:b,k1:S,k2neg:v,k2:x}=w.splitScalar(m),A=E,I=E,O=this;for(;S>qp||x>qp;)S&gi&&(A=A.add(O)),x&gi&&(I=I.add(O)),O=O.double(),S>>=gi,x>>=gi;return b&&(A=A.negate()),v&&(I=I.negate()),I=new h(n.mul(I.px,w.beta),I.py,I.pz),A.add(I)}multiply(m){const{endo:w,n:C}=t;l0("scalar",m,gi,C);let E,b;if(w){const{k1neg:S,k1:v,k2neg:x,k2:A}=w.splitScalar(m);let{p:I,f:O}=this.wNAF(v),{p:N,f:T}=this.wNAF(A);I=g.constTimeNegate(S,I),N=g.constTimeNegate(x,N),N=new h(n.mul(N.px,w.beta),N.py,N.pz),E=I.add(N),b=O.add(T)}else{const{p:S,f:v}=this.wNAF(m);E=S,b=v}return h.normalizeZ([E,b])[0]}multiplyAndAddUnsafe(m,w,C){const E=h.BASE,b=(v,x)=>x===qp||x===gi||!v.equals(E)?v.multiplyUnsafe(x):v.multiply(x),S=b(this,w).add(b(m,C));return S.is0()?void 0:S}toAffine(m){return u(this,m)}isTorsionFree(){const{h:m,isTorsionFree:w}=t;if(m===gi)return!0;if(w)return w(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:w}=t;return m===gi?this:w?w(h,this):this.multiplyUnsafe(t.h)}toRawBytes(m=!0){return T5("isCompressed",m),this.assertValidity(),s(h,this,m)}toHex(m=!0){return T5("isCompressed",m),P5(this.toRawBytes(m))}}h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const f=t.nBitLength,g=g8t(h,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function N8t(e){const t=J2e(e);return z6(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function T8t(e){const t=N8t(e),{Fp:n,n:r}=t,s=n.BYTES+1,i=2*n.BYTES+1;function o(_){return nc(_,r)}function a(_){return dF(_,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:u,isWithinCurveOrder:d}=_8t({...t,toBytes(_,y,$){const R=y.toAffine(),B=n.toBytes(R.x),k=C4;return T5("isCompressed",$),$?k(Uint8Array.from([y.hasEvenY()?2:3]),B):k(Uint8Array.from([4]),B,n.toBytes(R.y))},fromBytes(_){const y=_.length,$=_[0],R=_.subarray(1);if(y===s&&($===2||$===3)){const B=Lw(R);if(!DT(B,gi,n.ORDER))throw new Error("Point is not on curve");const k=u(B);let D;try{D=n.sqrt(k)}catch(F){const K=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+K)}const U=(D&gi)===gi;return($&1)===1!==U&&(D=n.neg(D)),{x:B,y:D}}else if(y===i&&$===4){const B=n.fromBytes(R.subarray(0,n.BYTES)),k=n.fromBytes(R.subarray(n.BYTES,2*n.BYTES));return{x:B,y:k}}else{const B=s,k=i;throw new Error("invalid Point, expected length of "+B+", or uncompressed "+k+", got "+y)}}}),h=_=>P5(k5(_,t.nByteLength));function f(_){const y=r>>gi;return _>y}function g(_){return f(_)?o(-_):_}const p=(_,y,$)=>Lw(_.slice(y,$));class m{constructor(y,$,R){this.r=y,this.s=$,this.recovery=R,this.assertValidity()}static fromCompact(y){const $=t.nByteLength;return y=Qc("compactSignature",y,$*2),new m(p(y,0,$),p(y,$,2*$))}static fromDER(y){const{r:$,s:R}=Op.toSig(Qc("DER",y));return new m($,R)}assertValidity(){l0("r",this.r,gi,r),l0("s",this.s,gi,r)}addRecoveryBit(y){return new m(this.r,this.s,y)}recoverPublicKey(y){const{r:$,s:R,recovery:B}=this,k=v(Qc("msgHash",y));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const D=B===2||B===3?$+t.n:$;if(D>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const U=(B&1)===0?"02":"03",F=c.fromHex(U+h(D)),K=a(D),q=o(-k*K),H=o(R*K),Z=c.BASE.multiplyAndAddUnsafe(F,q,H);if(!Z)throw new Error("point at infinify");return Z.assertValidity(),Z}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return O5(this.toDERHex())}toDERHex(){return Op.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return O5(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const w={isValidPrivateKey(_){try{return l(_),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const _=G2e(t.n);return h8t(t.randomBytes(_),t.n)},precompute(_=8,y=c.BASE){return y._setWindowSize(_),y.multiply(BigInt(3)),y}};function C(_,y=!0){return c.fromPrivateKey(_).toRawBytes(y)}function E(_){const y=dy(_),$=typeof _=="string",R=(y||$)&&_.length;return y?R===s||R===i:$?R===2*s||R===2*i:_ instanceof c}function b(_,y,$=!0){if(E(_))throw new Error("first arg must be private key");if(!E(y))throw new Error("second arg must be public key");return c.fromHex(y).multiply(l(_)).toRawBytes($)}const S=t.bits2int||function(_){if(_.length>8192)throw new Error("input is too large");const y=Lw(_),$=_.length*8-t.nBitLength;return $>0?y>>BigInt($):y},v=t.bits2int_modN||function(_){return o(S(_))},x=IV(t.nBitLength);function A(_){return l0("num < 2^"+t.nBitLength,_,qp,x),k5(_,t.nByteLength)}function I(_,y,$=O){if(["recovered","canonical"].some(ie=>ie in $))throw new Error("sign() legacy options not supported");const{hash:R,randomBytes:B}=t;let{lowS:k,prehash:D,extraEntropy:U}=$;k==null&&(k=!0),_=Qc("msgHash",_),Bie($),D&&(_=Qc("prehashed msgHash",R(_)));const F=v(_),K=l(y),q=[A(K),A(F)];if(U!=null&&U!==!1){const ie=U===!0?B(n.BYTES):U;q.push(Qc("extraEntropy",ie))}const H=C4(...q),Z=F;function ee(ie){const X=S(ie);if(!d(X))return;const le=a(X),_e=c.BASE.multiply(X).toAffine(),Ne=o(_e.x);if(Ne===qp)return;const be=o(le*o(Z+Ne*K));if(be===qp)return;let Me=(_e.x===Ne?0:2)|Number(_e.y&gi),Ct=be;return k&&f(be)&&(Ct=g(be),Me^=1),new m(Ne,Ct,Me)}return{seed:H,k2sig:ee}}const O={lowS:t.lowS,prehash:!1},N={lowS:t.lowS,prehash:!1};function T(_,y,$=O){const{seed:R,k2sig:B}=I(_,y,$),k=t;return q2e(k.hash.outputLen,k.nByteLength,k.hmac)(R,B)}c.BASE._setWindowSize(8);function P(_,y,$,R=N){var be;const B=_;y=Qc("msgHash",y),$=Qc("publicKey",$);const{lowS:k,prehash:D,format:U}=R;if(Bie(R),"strict"in R)throw new Error("options.strict was renamed to lowS");if(U!==void 0&&U!=="compact"&&U!=="der")throw new Error("format must be compact or der");const F=typeof B=="string"||dy(B),K=!F&&!U&&typeof B=="object"&&B!==null&&typeof B.r=="bigint"&&typeof B.s=="bigint";if(!F&&!K)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let q,H;try{if(K&&(q=new m(B.r,B.s)),F){try{U!=="compact"&&(q=m.fromDER(B))}catch(Me){if(!(Me instanceof Op.Err))throw Me}!q&&U!=="der"&&(q=m.fromCompact(B))}H=c.fromHex($)}catch{return!1}if(!q||k&&q.hasHighS())return!1;D&&(y=t.hash(y));const{r:Z,s:ee}=q,ie=v(y),X=a(ee),le=o(ie*X),_e=o(Z*X),Ne=(be=c.BASE.multiplyAndAddUnsafe(H,le,_e))==null?void 0:be.toAffine();return Ne?o(Ne.x)===Z:!1}return{CURVE:t,getPublicKey:C,getSharedSecret:b,sign:T,verify:P,ProjectivePoint:c,Signature:m,utils:w}}function P8t(e){return{hash:e,hmac:(t,...n)=>F2e(e,t,M3t(...n)),randomBytes:T2e}}function O8t(e,t){const n=r=>T8t({...e,...P8t(r)});return{...n(t),create:n}}const X2e=V2e(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),k8t=X2e.create(BigInt("-3")),R8t=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b");O8t({a:k8t,b:R8t,Fp:X2e,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},$V);const fF="base16",TI="base64pad",dE="base64url",B8t="utf8",TB=1,D8t=2;function PB(e){const t=$V(pc(e,fF));return So(t,fF)}function A2(e){const t=$V(pc(e,B8t));return So(t,fF)}function PI(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}var U8t=Object.defineProperty,L8t=Object.defineProperties,M8t=Object.getOwnPropertyDescriptors,Uie=Object.getOwnPropertySymbols,j8t=Object.prototype.hasOwnProperty,F8t=Object.prototype.propertyIsEnumerable,Lie=(e,t,n)=>t in e?U8t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z8t=(e,t)=>{for(var n in t||(t={}))j8t.call(t,n)&&Lie(e,n,t[n]);if(Uie)for(var n of Uie(t))F8t.call(t,n)&&Lie(e,n,t[n]);return e},q8t=(e,t)=>L8t(e,M8t(t));function q6(e){const t=[];return e.forEach(n=>{const[r,s]=n.split(":");t.push(`${r}:${s}`)}),t}function W8t(e){const t=[];return Object.values(e).forEach(n=>{t.push(...q6(n.accounts))}),t}function H8t(e,t){const n=[];return Object.values(e).forEach(r=>{q6(r.accounts).includes(t)&&n.push(...r.methods)}),n}function V8t(e,t){const n=[];return Object.values(e).forEach(r=>{q6(r.accounts).includes(t)&&n.push(...r.events)}),n}function UT(e){return e.includes(":")}function Sv(e){return UT(e)?e.split(":")[0]:e}function Mie(e){var t,n,r;const s={};if(!Tm(e))return s;for(const[i,o]of Object.entries(e)){const a=UT(i)?[i]:o.chains,c=o.methods||[],l=o.events||[],u=Sv(i);s[u]=q8t(z8t({},s[u]),{chains:Jh(a,(t=s[u])==null?void 0:t.chains),methods:Jh(c,(n=s[u])==null?void 0:n.methods),events:Jh(l,(r=s[u])==null?void 0:r.events)})}return s}function K8t(e){const t={};return e==null||e.forEach(n=>{var r;const[s,i]=n.split(":");t[s]||(t[s]={accounts:[],chains:[],events:[],methods:[]}),t[s].accounts.push(n),(r=t[s].chains)==null||r.push(`${s}:${i}`)}),t}function jie(e,t){t=t.map(r=>r.replace("did:pkh:",""));const n=K8t(t);for(const[r,s]of Object.entries(n))s.methods?s.methods=Jh(s.methods,e):s.methods=e,s.events=["chainChanged","accountsChanged"];return n}function G8t(e,t){var n,r,s,i,o,a;const c=Mie(e),l=Mie(t),u={},d=Object.keys(c).concat(Object.keys(l));for(const h of d)u[h]={chains:Jh((n=c[h])==null?void 0:n.chains,(r=l[h])==null?void 0:r.chains),methods:Jh((s=c[h])==null?void 0:s.methods,(i=l[h])==null?void 0:i.methods),events:Jh((o=c[h])==null?void 0:o.events,(a=l[h])==null?void 0:a.events)};return u}const Z8t={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Y8t={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Tt(e,t){const{message:n,code:r}=Y8t[e];return{message:t?`${n} ${t}`:n,code:r}}function ss(e,t){const{message:n,code:r}=Z8t[e];return{message:t?`${n} ${t}`:n,code:r}}function Nm(e,t){return!!Array.isArray(e)}function Tm(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function rc(e){return typeof e>"u"}function vi(e,t){return t&&rc(e)?!0:typeof e=="string"&&!!e.trim().length}function SV(e,t){return t&&rc(e)?!0:typeof e=="number"&&!isNaN(e)}function J8t(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),s=Object.keys(n);let i=!0;return Cw(s,r)?(r.forEach(o=>{const{accounts:a,methods:c,events:l}=e.namespaces[o],u=q6(a),d=n[o];(!Cw(x2e(o,d),u)||!Cw(d.methods,c)||!Cw(d.events,l))&&(i=!1)}),i):!1}function RA(e){return vi(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function X8t(e){if(vi(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const n=t[0]+":"+t[1];return!!t[2]&&RA(n)}}return!1}function Q8t(e,t){let n=null;return vi(e==null?void 0:e.publicKey,!1)||(n=Tt("MISSING_OR_INVALID",`${t} controller public key should be a string`)),n}function Fie(e){let t=!0;return Nm(e)?e.length&&(t=e.every(n=>vi(n,!1))):t=!1,t}function e4t(e,t,n){let r=null;return Nm(t)&&t.length?t.forEach(s=>{r||RA(s)||(r=ss("UNSUPPORTED_CHAINS",`${n}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):RA(e)||(r=ss("UNSUPPORTED_CHAINS",`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function t4t(e,t,n){let r=null;return Object.entries(e).forEach(([s,i])=>{if(r)return;const o=e4t(s,x2e(s,i),`${t} ${n}`);o&&(r=o)}),r}function n4t(e,t){let n=null;return Nm(e)?e.forEach(r=>{n||X8t(r)||(n=ss("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=ss("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function r4t(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=n4t(r==null?void 0:r.accounts,`${t} namespace`);s&&(n=s)}),n}function s4t(e,t){let n=null;return Fie(e==null?void 0:e.methods)?Fie(e==null?void 0:e.events)||(n=ss("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):n=ss("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),n}function Q2e(e,t){let n=null;return Object.values(e).forEach(r=>{if(n)return;const s=s4t(r,`${t}, namespace`);s&&(n=s)}),n}function i4t(e,t,n){let r=null;if(e&&Tm(e)){const s=Q2e(e,t);s&&(r=s);const i=t4t(e,t,n);i&&(r=i)}else r=Tt("MISSING_OR_INVALID",`${t}, ${n} should be an object with data`);return r}function OB(e,t){let n=null;if(e&&Tm(e)){const r=Q2e(e,t);r&&(n=r);const s=r4t(e,t);s&&(n=s)}else n=Tt("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return n}function eve(e){return vi(e.protocol,!0)}function o4t(e,t){let n=!1;return e?e&&Nm(e)&&e.length&&e.forEach(r=>{n=eve(r)}):n=!0,n}function a4t(e){return typeof e=="number"}function id(e){return typeof e<"u"&&typeof e!==null}function c4t(e){return!(!e||typeof e!="object"||!e.code||!SV(e.code,!1)||!e.message||!vi(e.message,!1))}function l4t(e){return!(rc(e)||!vi(e.method,!1))}function u4t(e){return!(rc(e)||rc(e.result)&&rc(e.error)||!SV(e.id,!1)||!vi(e.jsonrpc,!1))}function d4t(e){return!(rc(e)||!vi(e.name,!1))}function zie(e,t){return!(!RA(t)||!W8t(e).includes(t))}function h4t(e,t,n){return vi(n,!1)?H8t(e,t).includes(n):!1}function f4t(e,t,n){return vi(n,!1)?V8t(e,t).includes(n):!1}function qie(e,t,n){let r=null;const s=p4t(e),i=g4t(t),o=Object.keys(s),a=Object.keys(i),c=Wie(Object.keys(e)),l=Wie(Object.keys(t)),u=c.filter(d=>!l.includes(d));return u.length&&(r=Tt("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces. 160 Required: ${u.toString()} 161 Received: ${Object.keys(t).toString()}`)),Cw(o,a)||(r=Tt("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces. 162 Required: ${o.toString()} 163 Approved: ${a.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const h=q6(t[d].accounts);h.includes(d)||(r=Tt("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${d} 164 Required: ${d} 165 Approved: ${h.toString()}`))}),o.forEach(d=>{r||(Cw(s[d].methods,i[d].methods)?Cw(s[d].events,i[d].events)||(r=Tt("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${d}`)):r=Tt("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function p4t(e){const t={};return Object.keys(e).forEach(n=>{var r;n.includes(":")?t[n]=e[n]:(r=e[n].chains)==null||r.forEach(s=>{t[s]={methods:e[n].methods,events:e[n].events}})}),t}function Wie(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function g4t(e){const t={};return Object.keys(e).forEach(n=>{if(n.includes(":"))t[n]=e[n];else{const r=q6(e[n].accounts);r==null||r.forEach(s=>{t[s]={accounts:e[n].accounts.filter(i=>i.includes(`${s}:`)),methods:e[n].methods,events:e[n].events}})}}),t}function m4t(e,t){return SV(e,!1)&&e<=t.max&&e>=t.min}const kB={};class hE{static get(t){return kB[t]}static set(t,n){kB[t]=n}static delete(t){delete kB[t]}}const tve="wc",nve=2,rve="client",AV=`${tve}@${nve}:${rve}:`,RB={name:rve,logger:"error"},Hie="WALLETCONNECT_DEEPLINK_CHOICE",w4t="proposal",Vie="Proposal expired",y4t="session",_2=V.SEVEN_DAYS,b4t="engine",ai={wc_sessionPropose:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1104},res:{ttl:V.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1106},res:{ttl:V.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1112},res:{ttl:V.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1114},res:{ttl:V.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:V.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:V.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1119}}},BB={min:V.FIVE_MINUTES,max:V.SEVEN_DAYS},xh={idle:"IDLE",active:"ACTIVE"},Kie={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},v4t="request",E4t=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],C4t="wc",$4t="auth",x4t="authKeys",I4t="pairingTopics",S4t="requests",LT=`${C4t}@${1.5}:${$4t}:`,BS=`${LT}:PUB_KEY`;var A4t=Object.defineProperty,_4t=Object.defineProperties,N4t=Object.getOwnPropertyDescriptors,Gie=Object.getOwnPropertySymbols,T4t=Object.prototype.hasOwnProperty,P4t=Object.prototype.propertyIsEnumerable,pF=(e,t,n)=>t in e?A4t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xr=(e,t)=>{for(var n in t||(t={}))T4t.call(t,n)&&pF(e,n,t[n]);if(Gie)for(var n of Gie(t))P4t.call(t,n)&&pF(e,n,t[n]);return e},Lo=(e,t)=>_4t(e,N4t(t)),Se=(e,t,n)=>pF(e,typeof t!="symbol"?t+"":t,n);class O4t extends U5t{constructor(t){super(t),Se(this,"name",b4t),Se(this,"events",new Bu),Se(this,"initialized",!1),Se(this,"requestQueue",{state:xh.idle,queue:[]}),Se(this,"sessionRequestQueue",{state:xh.idle,queue:[]}),Se(this,"requestQueueDelay",V.ONE_SECOND),Se(this,"expectedPairingMethodMap",new Map),Se(this,"recentlyDeletedMap",new Map),Se(this,"recentlyDeletedLimit",200),Se(this,"relayMessageCache",[]),Se(this,"pendingSessions",new Map),Se(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(ai)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay)))}),Se(this,"connect",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Lo(xr({},n),{requiredNamespaces:n.requiredNamespaces||{},optionalNamespaces:n.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=G8t(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:s,requiredNamespaces:i,optionalNamespaces:o,sessionProperties:a,scopedProperties:c,relays:l}=r;let u=s,d,h=!1;try{if(u){const v=this.client.core.pairing.pairings.get(u);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),h=v.active}}catch(v){throw this.client.logger.error(`connect() -> pairing.get(${u}) failed`),v}if(!u||!h){const{topic:v,uri:x}=await this.client.core.pairing.create();u=v,d=x}if(!u){const{message:v}=Tt("NO_MATCHING_KEY",`connect() pairing topic: ${u}`);throw new Error(v)}const f=await this.client.core.crypto.generateKeyPair(),g=ai.wc_sessionPropose.req.ttl||V.FIVE_MINUTES,p=ka(g),m=Lo(xr(xr({requiredNamespaces:i,optionalNamespaces:o,relays:l??[{protocol:Ube}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:p,pairingTopic:u},a&&{sessionProperties:a}),c&&{scopedProperties:c}),{id:Bn()}),w=$r("session_connect",m.id),{reject:C,resolve:E,done:b}=$2(g,Vie),S=({id:v})=>{v===m.id&&(this.client.events.off("proposal_expire",S),this.pendingSessions.delete(m.id),this.events.emit(w,{error:{message:Vie,code:0}}))};return this.client.events.on("proposal_expire",S),this.events.once(w,({error:v,session:x})=>{this.client.events.off("proposal_expire",S),v?C(v):x&&E(x)}),await this.sendRequest({topic:u,method:"wc_sessionPropose",params:m,throwOnFailedPublish:!0,clientRpcId:m.id}),await this.setProposal(m.id,m),{uri:d,approval:b}}),Se(this,"pair",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(n)}catch(r){throw this.client.logger.error("pair() failed"),r}}),Se(this,"approve",async n=>{var r,s,i;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=n==null?void 0:n.id)==null?void 0:r.toString(),trace:[rd.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(I){throw o.setError(L1.no_internet_connection),I}try{await this.isValidProposalId(n==null?void 0:n.id)}catch(I){throw this.client.logger.error(`approve() -> proposal.get(${n==null?void 0:n.id}) failed`),o.setError(L1.proposal_not_found),I}try{await this.isValidApprove(n)}catch(I){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(L1.session_approve_namespace_validation_failure),I}const{id:a,relayProtocol:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h}=n,f=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:g,proposer:p,requiredNamespaces:m,optionalNamespaces:w}=f;let C=(s=this.client.core.eventClient)==null?void 0:s.getEvent({topic:g});C||(C=(i=this.client.core.eventClient)==null?void 0:i.createEvent({type:rd.session_approve_started,properties:{topic:g,trace:[rd.session_approve_started,rd.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),b=p.publicKey,S=await this.client.core.crypto.generateSharedKey(E,b),v=xr(xr(xr({relay:{protocol:c??"irn"},namespaces:l,controller:{publicKey:E,metadata:this.client.metadata},expiry:ka(_2)},u&&{sessionProperties:u}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),x=Mr.relay;C.addTrace(rd.subscribing_session_topic);try{await this.client.core.relayer.subscribe(S,{transportType:x})}catch(I){throw C.setError(L1.subscribe_session_topic_failure),I}C.addTrace(rd.subscribe_session_topic_success);const A=Lo(xr({},v),{topic:S,requiredNamespaces:m,optionalNamespaces:w,pairingTopic:g,acknowledged:!1,self:v.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:E,transportType:Mr.relay});await this.client.session.set(S,A),C.addTrace(rd.store_session);try{C.addTrace(rd.publishing_session_settle),await this.sendRequest({topic:S,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch(I=>{throw C==null||C.setError(L1.session_settle_publish_failure),I}),C.addTrace(rd.session_settle_publish_success),C.addTrace(rd.publishing_session_approve),await this.sendResult({id:a,topic:g,result:{relay:{protocol:c??"irn"},responderPublicKey:E},throwOnFailedPublish:!0}).catch(I=>{throw C==null||C.setError(L1.session_approve_publish_failure),I}),C.addTrace(rd.session_approve_publish_success)}catch(I){throw this.client.logger.error(I),this.client.session.delete(S,ss("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(S),I}return this.client.core.eventClient.deleteEvent({eventId:C.eventId}),await this.client.core.pairing.updateMetadata({topic:g,metadata:p.metadata}),await this.client.proposal.delete(a,ss("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:g}),await this.setExpiry(S,ka(_2)),{topic:S,acknowledged:()=>Promise.resolve(this.client.session.get(S))}}),Se(this,"reject",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(n)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:s}=n;let i;try{i=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}i&&(await this.sendError({id:r,topic:i,error:s,rpcOpts:ai.wc_sessionPropose.reject}),await this.client.proposal.delete(r,ss("USER_DISCONNECTED")))}),Se(this,"update",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(n)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:s}=n,{done:i,resolve:o,reject:a}=$2(),c=Bn(),l=Ir().toString(),u=this.client.session.get(r).namespaces;return this.events.once($r("session_update",c),({error:d})=>{d?a(d):o()}),await this.client.session.update(r,{namespaces:s}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:c,relayRpcId:l}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:u}),a(d)}),{acknowledged:i}}),Se(this,"extend",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(n)}catch(c){throw this.client.logger.error("extend() -> isValidExtend() failed"),c}const{topic:r}=n,s=Bn(),{done:i,resolve:o,reject:a}=$2();return this.events.once($r("session_extend",s),({error:c})=>{c?a(c):o()}),await this.setExpiry(r,ka(_2)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(c=>{a(c)}),{acknowledged:i}}),Se(this,"request",async n=>{this.isInitialized();try{await this.isValidRequest(n)}catch(w){throw this.client.logger.error("request() -> isValidRequest() failed"),w}const{chainId:r,request:s,topic:i,expiry:o=ai.wc_sessionRequest.req.ttl}=n,a=this.client.session.get(i);(a==null?void 0:a.transportType)===Mr.relay&&await this.confirmOnlineStateOrThrow();const c=Bn(),l=Ir().toString(),{done:u,resolve:d,reject:h}=$2(o,"Request expired. Please try again.");this.events.once($r("session_request",c),({error:w,result:C})=>{w?h(w):d(C)});const f="wc_sessionRequest",g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(g)return await this.sendRequest({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:{request:Lo(xr({},s),{expiryTimestamp:ka(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(w=>h(w)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),await u();const p={request:Lo(xr({},s),{expiryTimestamp:ka(o)}),chainId:r},m=this.shouldSetTVF(f,p);return await Promise.all([new Promise(async w=>{await this.sendRequest(xr({clientRpcId:c,relayRpcId:l,topic:i,method:f,params:p,expiry:o,throwOnFailedPublish:!0},m&&{tvf:this.getTVFParams(c,p)})).catch(C=>h(C)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:r,id:c}),w()}),new Promise(async w=>{var C;if(!((C=a.sessionConfig)!=null&&C.disableDeepLink)){const E=await $3t(this.client.core.storage,Hie);await v3t({id:c,topic:i,wcDeepLink:E})}w()}),u()]).then(w=>w[2])}),Se(this,"respond",async n=>{this.isInitialized(),await this.isValidRespond(n);const{topic:r,response:s}=n,{id:i}=s,o=this.client.session.get(r);o.transportType===Mr.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);wn(s)?await this.sendResult({id:i,topic:r,result:s.result,throwOnFailedPublish:!0,appLink:a}):nn(s)&&await this.sendError({id:i,topic:r,error:s.error,appLink:a}),this.cleanupAfterResponse(n)}),Se(this,"ping",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(n)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:r}=n;if(this.client.session.keys.includes(r)){const s=Bn(),i=Ir().toString(),{done:o,resolve:a,reject:c}=$2();this.events.once($r("session_ping",s),({error:l})=>{l?c(l):a()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:i}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),Se(this,"emit",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(n);const{topic:r,event:s,chainId:i}=n,o=Ir().toString(),a=Bn();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:s,chainId:i},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),Se(this,"disconnect",async n=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(n);const{topic:r}=n;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:ss("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:s}=Tt("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(s)}}),Se(this,"find",n=>(this.isInitialized(),this.client.session.getAll().filter(r=>J8t(r,n)))),Se(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),Se(this,"authenticate",async(n,r)=>{var s;this.isInitialized(),this.isValidAuthenticate(n);const i=r&&this.client.core.linkModeSupportedApps.includes(r)&&((s=this.client.metadata.redirect)==null?void 0:s.linkMode),o=i?Mr.link_mode:Mr.relay;o===Mr.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:c="",uri:l,domain:u,nonce:d,type:h,exp:f,nbf:g,methods:p=[],expiry:m}=n,w=[...n.resources||[]],{topic:C,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:C,uri:E}});const b=await this.client.core.crypto.generateKeyPair(),S=PB(b);if(await Promise.all([this.client.auth.authKeys.set(BS,{responseTopic:S,publicKey:b}),this.client.auth.pairingTopics.set(S,{topic:S,pairingTopic:C})]),await this.client.core.relayer.subscribe(S,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${C}`),p.length>0){const{namespace:k}=Yv(a[0]);let D=gEt(k,"request",p);RS(w)&&(D=wEt(D,w.pop())),w.push(D)}const v=m&&m>ai.wc_sessionAuthenticate.req.ttl?m:ai.wc_sessionAuthenticate.req.ttl,x={authPayload:{type:h??"caip122",chains:a,statement:c,aud:l,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:g,resources:w},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:ka(v)},A={eip155:{chains:a,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},I={requiredNamespaces:{},optionalNamespaces:A,relays:[{protocol:"irn"}],pairingTopic:C,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:ka(ai.wc_sessionPropose.req.ttl),id:Bn()},{done:O,resolve:N,reject:T}=$2(v,"Request expired"),P=Bn(),_=$r("session_connect",I.id),y=$r("session_request",P),$=async({error:k,session:D})=>{this.events.off(y,R),k?T(k):D&&N({session:D})},R=async k=>{var D,U,F;if(await this.deletePendingAuthRequest(P,{message:"fulfilled",code:0}),k.error){const X=ss("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return k.error.code===X.code?void 0:(this.events.off(_,$),T(k.error.message))}await this.deleteProposal(I.id),this.events.off(_,$);const{cacaos:K,responder:q}=k.result,H=[],Z=[];for(const X of K){await bie({cacao:X,projectId:this.client.core.projectId})||(this.client.logger.error(X,"Signature verification failed"),T(ss("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:le}=X,_e=RS(le.resources),Ne=[iF(le.iss)],be=kA(le.iss);if(_e){const Me=vie(_e),Ct=Eie(_e);H.push(...Me),Ne.push(...Ct)}for(const Me of Ne)Z.push(`${Me}:${be}`)}const ee=await this.client.core.crypto.generateSharedKey(b,q.publicKey);let ie;H.length>0&&(ie={topic:ee,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:q,controller:q.publicKey,expiry:ka(_2),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:C,namespaces:jie([...new Set(H)],[...new Set(Z)]),transportType:o},await this.client.core.relayer.subscribe(ee,{transportType:o}),await this.client.session.set(ee,ie),C&&await this.client.core.pairing.updateMetadata({topic:C,metadata:q.metadata}),ie=this.client.session.get(ee)),(D=this.client.metadata.redirect)!=null&&D.linkMode&&(U=q.metadata.redirect)!=null&&U.linkMode&&(F=q.metadata.redirect)!=null&&F.universal&&r&&(this.client.core.addLinkModeSupportedApp(q.metadata.redirect.universal),this.client.session.update(ee,{transportType:Mr.link_mode})),N({auths:K,session:ie})};this.events.once(_,$),this.events.once(y,R);let B;try{if(i){const k=_n("wc_sessionAuthenticate",x,P);this.client.core.history.set(C,k);const D=await this.client.core.crypto.encode("",k,{type:D8t,encoding:dE});B=PI(r,C,D)}else await Promise.all([this.sendRequest({topic:C,method:"wc_sessionAuthenticate",params:x,expiry:n.expiry,throwOnFailedPublish:!0,clientRpcId:P}),this.sendRequest({topic:C,method:"wc_sessionPropose",params:I,expiry:ai.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:I.id})])}catch(k){throw this.events.off(_,$),this.events.off(y,R),k}return await this.setProposal(I.id,I),await this.setAuthRequest(P,{request:Lo(xr({},x),{verifyContext:{}}),pairingTopic:C,transportType:o}),{uri:B??E,response:O}}),Se(this,"approveSessionAuthenticate",async n=>{const{id:r,auths:s}=n,i=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[M1.authenticated_session_approve_started]}});try{this.isInitialized()}catch(m){throw i.setError(iE.no_internet_connection),m}const o=this.getPendingAuthRequest(r);if(!o)throw i.setError(iE.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const a=o.transportType||Mr.relay;a===Mr.relay&&await this.confirmOnlineStateOrThrow();const c=o.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),u=PB(c),d={type:TB,receiverPublicKey:c,senderPublicKey:l},h=[],f=[];for(const m of s){if(!await bie({cacao:m,projectId:this.client.core.projectId})){i.setError(iE.invalid_cacao);const S=ss("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:u,error:S,encodeOpts:d}),new Error(S.message)}i.addTrace(M1.cacaos_verified);const{p:w}=m,C=RS(w.resources),E=[iF(w.iss)],b=kA(w.iss);if(C){const S=vie(C),v=Eie(C);h.push(...S),E.push(...v)}for(const S of E)f.push(`${S}:${b}`)}const g=await this.client.core.crypto.generateSharedKey(l,c);i.addTrace(M1.create_authenticated_session_topic);let p;if((h==null?void 0:h.length)>0){p={topic:g,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:o.requester.metadata},controller:c,expiry:ka(_2),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:jie([...new Set(h)],[...new Set(f)]),transportType:a},i.addTrace(M1.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(g,{transportType:a})}catch(m){throw i.setError(iE.subscribe_authenticated_session_topic_failure),m}i.addTrace(M1.subscribe_authenticated_session_topic_success),await this.client.session.set(g,p),i.addTrace(M1.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}i.addTrace(M1.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:r,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(m){throw i.setError(iE.authenticated_session_approve_publish_failure),m}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:p}}),Se(this,"rejectSessionAuthenticate",async n=>{this.isInitialized();const{id:r,reason:s}=n,i=this.getPendingAuthRequest(r);if(!i)throw new Error(`Could not find pending auth request with id ${r}`);i.transportType===Mr.relay&&await this.confirmOnlineStateOrThrow();const o=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=PB(o),l={type:TB,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:r,topic:c,error:s,encodeOpts:l,rpcOpts:ai.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.client.proposal.delete(r,ss("USER_DISCONNECTED"))}),Se(this,"formatAuthMessage",n=>{this.isInitialized();const{request:r,iss:s}=n;return B2e(r,s)}),Se(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const n=this.relayMessageCache.shift();n&&await this.onRelayMessage(n)}catch(n){this.client.logger.error(n)}},50)}),Se(this,"cleanupDuplicatePairings",async n=>{if(n.pairingTopic)try{const r=this.client.core.pairing.pairings.get(n.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(i=>{var o,a;return((o=i.peerMetadata)==null?void 0:o.url)&&((a=i.peerMetadata)==null?void 0:a.url)===n.peer.metadata.url&&i.topic&&i.topic!==r.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(i=>this.client.core.pairing.disconnect({topic:i.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),Se(this,"deleteSession",async n=>{var r;const{topic:s,expirerHasDeleted:i=!1,emitEvent:o=!0,id:a=0}=n,{self:c}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,ss("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(c.publicKey)&&await this.client.core.crypto.deleteKeyPair(c.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),i||this.client.core.expirer.del(s),this.client.core.storage.removeItem(Hie).catch(l=>this.client.logger.warn(l)),this.getPendingSessionRequests().forEach(l=>{l.topic===s&&this.deletePendingSessionRequest(l.id,ss("USER_DISCONNECTED"))}),s===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=xh.idle),o&&this.client.events.emit("session_delete",{id:a,topic:s})}),Se(this,"deleteProposal",async(n,r)=>{if(r)try{const s=this.client.proposal.get(n),i=this.client.core.eventClient.getEvent({topic:s.pairingTopic});i==null||i.setError(L1.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(n,ss("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"proposal")}),Se(this,"deletePendingSessionRequest",async(n,r,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)]),this.addToRecentlyDeleted(n,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==n),s&&(this.sessionRequestQueue.state=xh.idle,this.client.events.emit("session_request_expire",{id:n}))}),Se(this,"deletePendingAuthRequest",async(n,r,s=!1)=>{await Promise.all([this.client.auth.requests.delete(n,r),s?Promise.resolve():this.client.core.expirer.del(n)])}),Se(this,"setExpiry",async(n,r)=>{this.client.session.keys.includes(n)&&(this.client.core.expirer.set(n,r),await this.client.session.update(n,{expiry:r}))}),Se(this,"setProposal",async(n,r)=>{this.client.core.expirer.set(n,ka(ai.wc_sessionPropose.req.ttl)),await this.client.proposal.set(n,r)}),Se(this,"setAuthRequest",async(n,r)=>{const{request:s,pairingTopic:i,transportType:o=Mr.relay}=r;this.client.core.expirer.set(n,s.expiryTimestamp),await this.client.auth.requests.set(n,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:n,pairingTopic:i,verifyContext:s.verifyContext,transportType:o})}),Se(this,"setPendingSessionRequest",async n=>{const{id:r,topic:s,params:i,verifyContext:o}=n,a=i.request.expiryTimestamp||ka(ai.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,a),await this.client.pendingRequest.set(r,{id:r,topic:s,params:i,verifyContext:o})}),Se(this,"sendRequest",async n=>{const{topic:r,method:s,params:i,expiry:o,relayRpcId:a,clientRpcId:c,throwOnFailedPublish:l,appLink:u,tvf:d}=n,h=_n(s,i,c);let f;const g=!!u;try{const w=g?dE:TI;f=await this.client.core.crypto.encode(r,h,{encoding:w})}catch(w){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),w}let p;if(E4t.includes(s)){const w=A2(JSON.stringify(h)),C=A2(f);p=await this.client.core.verify.register({id:C,decryptedId:w})}const m=ai[s].req;if(m.attestation=p,o&&(m.ttl=o),a&&(m.id=a),this.client.core.history.set(r,h),g){const w=PI(u,r,f);await globalThis.Linking.openURL(w,this.client.name)}else{const w=ai[s].req;o&&(w.ttl=o),a&&(w.id=a),w.tvf=Lo(xr({},d),{correlationId:h.id}),l?(w.internal=Lo(xr({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,f,w)):this.client.core.relayer.publish(r,f,w).catch(C=>this.client.logger.error(C))}return h.id}),Se(this,"sendResult",async n=>{const{id:r,topic:s,result:i,throwOnFailedPublish:o,encodeOpts:a,appLink:c}=n,l=Pi(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const g=d?dE:TI;u=await this.client.core.crypto.encode(s,l,Lo(xr({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),g}let h,f;try{h=await this.client.core.history.get(s,r);const g=h.request;try{this.shouldSetTVF(g.method,g.params)&&(f=this.getTVFParams(r,g.params,i))}catch(p){this.client.logger.warn("sendResult() -> getTVFParams() failed",p)}}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${r}) failed`),g}if(d){const g=PI(c,s,u);await globalThis.Linking.openURL(g,this.client.name)}else{const g=h.request.method,p=ai[g].res;p.tvf=Lo(xr({},f),{correlationId:r}),o?(p.internal=Lo(xr({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,u,p)):this.client.core.relayer.publish(s,u,p).catch(m=>this.client.logger.error(m))}await this.client.core.history.resolve(l)}),Se(this,"sendError",async n=>{const{id:r,topic:s,error:i,encodeOpts:o,rpcOpts:a,appLink:c}=n,l=yf(r,i);let u;const d=c&&typeof(globalThis==null?void 0:globalThis.Linking)<"u";try{const f=d?dE:TI;u=await this.client.core.crypto.encode(s,l,Lo(xr({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),f}let h;try{h=await this.client.core.history.get(s,r)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${s}, ${r}) failed`),f}if(d){const f=PI(c,s,u);await globalThis.Linking.openURL(f,this.client.name)}else{const f=h.request.method,g=a||ai[f].res;this.client.core.relayer.publish(s,u,g)}await this.client.core.history.resolve(l)}),Se(this,"cleanup",async()=>{const n=[],r=[];this.client.session.getAll().forEach(s=>{let i=!1;x2(s.expiry)&&(i=!0),this.client.core.crypto.keychain.has(s.topic)||(i=!0),i&&n.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{x2(s.expiryTimestamp)&&r.push(s.id)}),await Promise.all([...n.map(s=>this.deleteSession({topic:s})),...r.map(s=>this.deleteProposal(s))])}),Se(this,"onProviderMessageEvent",async n=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(n):await this.onRelayMessage(n)}),Se(this,"onRelayEventRequest",async n=>{this.requestQueue.queue.push(n),await this.processRequestsQueue()}),Se(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===xh.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=xh.active;const n=this.requestQueue.queue.shift();if(n)try{await this.processRequest(n)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=xh.idle}),Se(this,"processRequest",async n=>{const{topic:r,payload:s,attestation:i,transportType:o,encryptedId:a}=n,c=s.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:c}))switch(c){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:s,attestation:i,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,s);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,s);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,s);case"wc_sessionPing":return await this.onSessionPingRequest(r,s);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,s);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,s);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:s,attestation:i,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${c}`)}}),Se(this,"onRelayEventResponse",async n=>{const{topic:r,payload:s,transportType:i}=n,o=(await this.client.core.history.get(r,s.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,s,i);case"wc_sessionSettle":return this.onSessionSettleResponse(r,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,s);case"wc_sessionExtend":return this.onSessionExtendResponse(r,s);case"wc_sessionPing":return this.onSessionPingResponse(r,s);case"wc_sessionRequest":return this.onSessionRequestResponse(r,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,s);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),Se(this,"onRelayEventUnknownPayload",n=>{const{topic:r}=n,{message:s}=Tt("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)}),Se(this,"shouldIgnorePairingRequest",n=>{const{topic:r,requestMethod:s}=n,i=this.expectedPairingMethodMap.get(r);return!i||i.includes(s)?!1:!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),Se(this,"onSessionProposeRequest",async n=>{const{topic:r,payload:s,attestation:i,encryptedId:o}=n,{params:a,id:c}=s;try{const l=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),l==null||l.setError(mp.proposal_listener_not_found)),this.isValidConnect(xr({},s.params));const u=a.expiryTimestamp||ka(ai.wc_sessionPropose.req.ttl),d=xr({id:c,pairingTopic:r,expiryTimestamp:u},a);await this.setProposal(c,d);const h=await this.getVerifyContext({attestationId:i,hash:A2(JSON.stringify(s)),encryptedId:o,metadata:d.proposer.metadata});l==null||l.addTrace(Nh.emit_session_proposal),this.client.events.emit("session_proposal",{id:c,params:d,verifyContext:h})}catch(l){await this.sendError({id:c,topic:r,error:l,rpcOpts:ai.wc_sessionPropose.autoReject}),this.client.logger.error(l)}}),Se(this,"onSessionProposeResponse",async(n,r,s)=>{const{id:i}=r;if(wn(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const c=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:c});const l=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:l});const u=await this.client.core.crypto.generateSharedKey(c,l);this.pendingSessions.set(i,{sessionTopic:u,pairingTopic:n,proposalId:i,publicKey:c});const d=await this.client.core.relayer.subscribe(u,{transportType:s});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:n})}else if(nn(r)){await this.client.proposal.delete(i,ss("USER_DISCONNECTED"));const o=$r("session_connect",i);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),Se(this,"onSessionSettleRequest",async(n,r)=>{const{id:s,params:i}=r;try{this.isValidSessionSettleRequest(i);const{relay:o,controller:a,expiry:c,namespaces:l,sessionProperties:u,scopedProperties:d,sessionConfig:h}=r.params,f=[...this.pendingSessions.values()].find(m=>m.sessionTopic===n);if(!f)return this.client.logger.error(`Pending session not found for topic ${n}`);const g=this.client.proposal.get(f.proposalId),p=Lo(xr(xr(xr({topic:n,relay:o,expiry:c,namespaces:l,acknowledged:!0,pairingTopic:f.pairingTopic,requiredNamespaces:g.requiredNamespaces,optionalNamespaces:g.optionalNamespaces,controller:a.publicKey,self:{publicKey:f.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},u&&{sessionProperties:u}),d&&{scopedProperties:d}),h&&{sessionConfig:h}),{transportType:Mr.relay});await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:p.peer.metadata}),this.client.events.emit("session_connect",{session:p}),this.events.emit($r("session_connect",f.proposalId),{session:p}),this.pendingSessions.delete(f.proposalId),this.deleteProposal(f.proposalId,!1),this.cleanupDuplicatePairings(p),await this.sendResult({id:r.id,topic:n,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),Se(this,"onSessionSettleResponse",async(n,r)=>{const{id:s}=r;wn(r)?(await this.client.session.update(n,{acknowledged:!0}),this.events.emit($r("session_approve",s),{})):nn(r)&&(await this.client.session.delete(n,ss("USER_DISCONNECTED")),this.events.emit($r("session_approve",s),{error:r.error}))}),Se(this,"onSessionUpdateRequest",async(n,r)=>{const{params:s,id:i}=r;try{const o=`${n}_session_update`,a=hE.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:n,error:ss("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(xr({topic:n},s));try{hE.set(o,i),await this.client.session.update(n,{namespaces:s.namespaces}),await this.sendResult({id:i,topic:n,result:!0,throwOnFailedPublish:!0})}catch(c){throw hE.delete(o),c}this.client.events.emit("session_update",{id:i,topic:n,params:s})}catch(o){await this.sendError({id:i,topic:n,error:o}),this.client.logger.error(o)}}),Se(this,"isRequestOutOfSync",(n,r)=>r.toString().slice(0,-3)<n.toString().slice(0,-3)),Se(this,"onSessionUpdateResponse",(n,r)=>{const{id:s}=r,i=$r("session_update",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit($r("session_update",s),{}):nn(r)&&this.events.emit($r("session_update",s),{error:r.error})}),Se(this,"onSessionExtendRequest",async(n,r)=>{const{id:s}=r;try{this.isValidExtend({topic:n}),await this.setExpiry(n,ka(_2)),await this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}}),Se(this,"onSessionExtendResponse",(n,r)=>{const{id:s}=r,i=$r("session_extend",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit($r("session_extend",s),{}):nn(r)&&this.events.emit($r("session_extend",s),{error:r.error})}),Se(this,"onSessionPingRequest",async(n,r)=>{const{id:s}=r;try{this.isValidPing({topic:n}),await this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:n})}catch(i){await this.sendError({id:s,topic:n,error:i}),this.client.logger.error(i)}}),Se(this,"onSessionPingResponse",(n,r)=>{const{id:s}=r,i=$r("session_ping",s);setTimeout(()=>{if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners 2176`);wn(r)?this.events.emit($r("session_ping",s),{}):nn(r)&&this.events.emit($r("session_ping",s),{error:r.error})},500)}),Se(this,"onSessionDeleteRequest",async(n,r)=>{const{id:s}=r;try{this.isValidDisconnect({topic:n,reason:r.params}),Promise.all([new Promise(i=>{this.client.core.relayer.once($i.publish,async()=>{i(await this.deleteSession({topic:n,id:s}))})}),this.sendResult({id:s,topic:n,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:n,error:ss("USER_DISCONNECTED")})]).catch(i=>this.client.logger.error(i))}catch(i){this.client.logger.error(i)}}),Se(this,"onSessionRequest",async n=>{var r,s,i;const{topic:o,payload:a,attestation:c,encryptedId:l,transportType:u}=n,{id:d,params:h}=a;try{await this.isValidRequest(xr({topic:o},h));const f=this.client.session.get(o),g=await this.getVerifyContext({attestationId:c,hash:A2(JSON.stringify(_n("wc_sessionRequest",h,d))),encryptedId:l,metadata:f.peer.metadata,transportType:u}),p={id:d,topic:o,params:h,verifyContext:g};await this.setPendingSessionRequest(p),u===Mr.link_mode&&(r=f.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((s=f.peer.metadata.redirect)==null?void 0:s.universal),(i=this.client.signConfig)!=null&&i.disableRequestQueue?this.emitSessionRequest(p):(this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue())}catch(f){await this.sendError({id:d,topic:o,error:f}),this.client.logger.error(f)}}),Se(this,"onSessionRequestResponse",(n,r)=>{const{id:s}=r,i=$r("session_request",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);wn(r)?this.events.emit($r("session_request",s),{result:r.result}):nn(r)&&this.events.emit($r("session_request",s),{error:r.error})}),Se(this,"onSessionEventRequest",async(n,r)=>{const{id:s,params:i}=r;try{const o=`${n}_session_event_${i.event.name}`,a=hE.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(xr({topic:n},i)),this.client.events.emit("session_event",{id:s,topic:n,params:i}),hE.set(o,s)}catch(o){await this.sendError({id:s,topic:n,error:o}),this.client.logger.error(o)}}),Se(this,"onSessionAuthenticateResponse",(n,r)=>{const{id:s}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:n,payload:r}),wn(r)?this.events.emit($r("session_request",s),{result:r.result}):nn(r)&&this.events.emit($r("session_request",s),{error:r.error})}),Se(this,"onSessionAuthenticateRequest",async n=>{var r;const{topic:s,payload:i,attestation:o,encryptedId:a,transportType:c}=n;try{const{requester:l,authPayload:u,expiryTimestamp:d}=i.params,h=await this.getVerifyContext({attestationId:o,hash:A2(JSON.stringify(i)),encryptedId:a,metadata:l.metadata,transportType:c}),f={requester:l,pairingTopic:s,id:i.id,authPayload:u,verifyContext:h,expiryTimestamp:d};await this.setAuthRequest(i.id,{request:f,pairingTopic:s,transportType:c}),c===Mr.link_mode&&(r=l.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:s,params:i.params,id:i.id,verifyContext:h})}catch(l){this.client.logger.error(l);const u=i.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),h=this.getAppLinkIfEnabled(i.params.requester.metadata,c),f={type:TB,receiverPublicKey:u,senderPublicKey:d};await this.sendError({id:i.id,topic:s,error:l,encodeOpts:f,rpcOpts:ai.wc_sessionAuthenticate.autoReject,appLink:h})}}),Se(this,"addSessionRequestToSessionRequestQueue",n=>{this.sessionRequestQueue.queue.push(n)}),Se(this,"cleanupAfterResponse",n=>{this.deletePendingSessionRequest(n.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=xh.idle,this.processSessionRequestQueue()},V.toMiliseconds(this.requestQueueDelay))}),Se(this,"cleanupPendingSentRequestsForTopic",({topic:n,error:r})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(i=>i.topic===n&&i.request.method==="wc_sessionRequest").forEach(i=>{const o=i.request.id,a=$r("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit($r("session_request",i.request.id),{error:r})})}),Se(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===xh.active){this.client.logger.info("session request queue is already active.");return}const n=this.sessionRequestQueue.queue[0];if(!n){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=xh.active,this.emitSessionRequest(n)}catch(r){this.client.logger.error(r)}}),Se(this,"emitSessionRequest",n=>{this.client.events.emit("session_request",n)}),Se(this,"onPairingCreated",n=>{if(n.methods&&this.expectedPairingMethodMap.set(n.topic,n.methods),n.active)return;const r=this.client.proposal.getAll().find(s=>s.pairingTopic===n.topic);r&&this.onSessionProposeRequest({topic:n.topic,payload:_n("wc_sessionPropose",Lo(xr({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id)})}),Se(this,"isValidConnect",async n=>{if(!id(n)){const{message:l}=Tt("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(n)}`);throw new Error(l)}const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:i,sessionProperties:o,scopedProperties:a,relays:c}=n;if(rc(r)||await this.isValidPairingTopic(r),!o4t(c)){const{message:l}=Tt("MISSING_OR_INVALID",`connect() relays: ${c}`);throw new Error(l)}if(!rc(s)&&Tm(s)!==0){const l="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(l):this.client.logger.warn(l),this.validateNamespaces(s,"requiredNamespaces")}if(!rc(i)&&Tm(i)!==0&&this.validateNamespaces(i,"optionalNamespaces"),rc(o)||this.validateSessionProps(o,"sessionProperties"),!rc(a)){this.validateSessionProps(a,"scopedProperties");const l=Object.keys(s||{}).concat(Object.keys(i||{}));if(!Object.keys(a).every(u=>l.includes(u)))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(l)}`)}}),Se(this,"validateNamespaces",(n,r)=>{const s=i4t(n,"connect()",r);if(s)throw new Error(s.message)}),Se(this,"isValidApprove",async n=>{if(!id(n))throw new Error(Tt("MISSING_OR_INVALID",`approve() params: ${n}`).message);const{id:r,namespaces:s,relayProtocol:i,sessionProperties:o,scopedProperties:a}=n;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const c=this.client.proposal.get(r),l=OB(s,"approve()");if(l)throw new Error(l.message);const u=qie(c.requiredNamespaces,s,"approve()");if(u)throw new Error(u.message);if(!vi(i,!0)){const{message:d}=Tt("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(d)}if(rc(o)||this.validateSessionProps(o,"sessionProperties"),!rc(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(s));if(!Object.keys(a).every(h=>d.has(h)))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),Se(this,"isValidReject",async n=>{if(!id(n)){const{message:i}=Tt("MISSING_OR_INVALID",`reject() params: ${n}`);throw new Error(i)}const{id:r,reason:s}=n;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!c4t(s)){const{message:i}=Tt("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(i)}}),Se(this,"isValidSessionSettleRequest",n=>{if(!id(n)){const{message:l}=Tt("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${n}`);throw new Error(l)}const{relay:r,controller:s,namespaces:i,expiry:o}=n;if(!eve(r)){const{message:l}=Tt("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}const a=Q8t(s,"onSessionSettleRequest()");if(a)throw new Error(a.message);const c=OB(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);if(x2(o)){const{message:l}=Tt("EXPIRED","onSessionSettleRequest()");throw new Error(l)}}),Se(this,"isValidUpdate",async n=>{if(!id(n)){const{message:c}=Tt("MISSING_OR_INVALID",`update() params: ${n}`);throw new Error(c)}const{topic:r,namespaces:s}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const i=this.client.session.get(r),o=OB(s,"update()");if(o)throw new Error(o.message);const a=qie(i.requiredNamespaces,s,"update()");if(a)throw new Error(a.message)}),Se(this,"isValidExtend",async n=>{if(!id(n)){const{message:s}=Tt("MISSING_OR_INVALID",`extend() params: ${n}`);throw new Error(s)}const{topic:r}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),Se(this,"isValidRequest",async n=>{if(!id(n)){const{message:c}=Tt("MISSING_OR_INVALID",`request() params: ${n}`);throw new Error(c)}const{topic:r,request:s,chainId:i,expiry:o}=n;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:a}=this.client.session.get(r);if(!zie(a,i)){const{message:c}=Tt("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(c)}if(!l4t(s)){const{message:c}=Tt("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(c)}if(!h4t(a,i,s.method)){const{message:c}=Tt("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(c)}if(o&&!m4t(o,BB)){const{message:c}=Tt("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${BB.min} and ${BB.max}`);throw new Error(c)}}),Se(this,"isValidRespond",async n=>{var r;if(!id(n)){const{message:o}=Tt("MISSING_OR_INVALID",`respond() params: ${n}`);throw new Error(o)}const{topic:s,response:i}=n;try{await this.isValidSessionTopic(s)}catch(o){throw(r=n==null?void 0:n.response)!=null&&r.id&&this.cleanupAfterResponse(n),o}if(!u4t(i)){const{message:o}=Tt("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(o)}}),Se(this,"isValidPing",async n=>{if(!id(n)){const{message:s}=Tt("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)}),Se(this,"isValidEmit",async n=>{if(!id(n)){const{message:a}=Tt("MISSING_OR_INVALID",`emit() params: ${n}`);throw new Error(a)}const{topic:r,event:s,chainId:i}=n;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!zie(o,i)){const{message:a}=Tt("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(a)}if(!d4t(s)){const{message:a}=Tt("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}if(!f4t(o,i,s.name)){const{message:a}=Tt("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(a)}}),Se(this,"isValidDisconnect",async n=>{if(!id(n)){const{message:s}=Tt("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidSessionOrPairingTopic(r)}),Se(this,"isValidAuthenticate",n=>{const{chains:r,uri:s,domain:i,nonce:o}=n;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!vi(s,!1))throw new Error("uri is required parameter");if(!vi(i,!1))throw new Error("domain is required parameter");if(!vi(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(c=>Yv(c).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Yv(r[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),Se(this,"getVerifyContext",async n=>{const{attestationId:r,hash:s,encryptedId:i,metadata:o,transportType:a}=n,c={verified:{verifyUrl:o.verifyUrl||C8,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Mr.link_mode){const u=this.getAppLinkIfEnabled(o,a);return c.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",c}const l=await this.client.core.verify.resolve({attestationId:r,hash:s,encryptedId:i,verifyUrl:o.verifyUrl});l&&(c.verified.origin=l.origin,c.verified.isScam=l.isScam,c.verified.validation=l.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.warn(l)}return this.client.logger.debug(`Verify context: ${JSON.stringify(c)}`),c}),Se(this,"validateSessionProps",(n,r)=>{Object.values(n).forEach((s,i)=>{if(s==null){const{message:o}=Tt("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${s} for key ${Object.keys(n)[i]}`);throw new Error(o)}})}),Se(this,"getPendingAuthRequest",n=>{const r=this.client.auth.requests.get(n);return typeof r=="object"?r:void 0}),Se(this,"addToRecentlyDeleted",(n,r)=>{if(this.recentlyDeletedMap.set(n,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const i=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(s++>=i)break;this.recentlyDeletedMap.delete(o)}}}),Se(this,"checkRecentlyDeleted",n=>{const r=this.recentlyDeletedMap.get(n);if(r){const{message:s}=Tt("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${n}`);throw new Error(s)}}),Se(this,"isLinkModeEnabled",(n,r)=>{var s,i,o,a,c,l,u,d,h;return!n||r!==Mr.link_mode?!1:((i=(s=this.client.metadata)==null?void 0:s.redirect)==null?void 0:i.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((l=(c=this.client.metadata)==null?void 0:c.redirect)==null?void 0:l.universal)!==""&&((u=n==null?void 0:n.redirect)==null?void 0:u.universal)!==void 0&&((d=n==null?void 0:n.redirect)==null?void 0:d.universal)!==""&&((h=n==null?void 0:n.redirect)==null?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(n.redirect.universal)&&typeof(globalThis==null?void 0:globalThis.Linking)<"u"}),Se(this,"getAppLinkIfEnabled",(n,r)=>{var s;return this.isLinkModeEnabled(n,r)?(s=n==null?void 0:n.redirect)==null?void 0:s.universal:void 0}),Se(this,"handleLinkModeMessage",({url:n})=>{if(!n||!n.includes("wc_ev")||!n.includes("topic"))return;const r=die(n,"topic")||"",s=decodeURIComponent(die(n,"wc_ev")||""),i=this.client.session.keys.includes(r);i&&this.client.session.update(r,{transportType:Mr.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:s,sessionExists:i})}),Se(this,"registerLinkModeListeners",async()=>{var n;if(x3t()||S2e()&&(n=this.client.metadata.redirect)!=null&&n.linkMode){const r=globalThis==null?void 0:globalThis.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const s=await r.getInitialURL();s&&setTimeout(()=>{this.handleLinkModeMessage({url:s})},50)}}}),Se(this,"shouldSetTVF",(n,r)=>{if(!r||n!=="wc_sessionRequest")return!1;const{request:s}=r;return Object.keys(Kie).includes(s.method)}),Se(this,"getTVFParams",(n,r,s)=>{var i,o;try{const a=r.request.method,c=this.extractTxHashesFromResult(a,s);return Lo(xr({correlationId:n,rpcMethods:[a],chainId:r.chainId},this.isValidContractData(r.request.params)&&{contractAddresses:[(o=(i=r.request.params)==null?void 0:i[0])==null?void 0:o.to]}),{txHashes:c})}catch(a){this.client.logger.warn("Error getting TVF params",a)}return{}}),Se(this,"isValidContractData",n=>{var r;if(!n)return!1;try{const s=(n==null?void 0:n.data)||((r=n==null?void 0:n[0])==null?void 0:r.data);if(!s.startsWith("0x"))return!1;const i=s.slice(2);return/^[0-9a-fA-F]*$/.test(i)?i.length%2===0:!1}catch{}return!1}),Se(this,"extractTxHashesFromResult",(n,r)=>{try{const s=Kie[n];if(typeof r=="string")return[r];const i=r[s.key];if(Nm(i))return n==="solana_signAllTransactions"?i.map(o=>tEt(o)):i;if(typeof i=="string")return[i]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,n=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,s]of Object.entries(n))for(const i of s)try{await this.onProviderMessageEvent({topic:r,message:i,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${i}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=Tt("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on($i.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:n,message:r,attestation:s,transportType:i}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(BS)?this.client.auth.authKeys.get(BS):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(n,r,{receiverPublicKey:o,encoding:i===Mr.link_mode?dE:TI});Du(a)?(this.client.core.history.set(n,a),await this.onRelayEventRequest({topic:n,payload:a,attestation:s,transportType:i,encryptedId:A2(r)})):Sl(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:n,payload:a,transportType:i}),this.client.core.history.delete(n,a.id)):await this.onRelayEventUnknownPayload({topic:n,payload:a,transportType:i}),await this.client.core.relayer.messages.ack(n,r)}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(tu.expired,async t=>{const{topic:n,id:r}=b3t(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,Tt("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,Tt("EXPIRED"),!0);n?this.client.session.keys.includes(n)&&(await this.deleteSession({topic:n,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:n})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(tw.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(tw.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!vi(t,!1)){const{message:n}=Tt("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(n)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:n}=Tt("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(n)}if(x2(this.client.core.pairing.pairings.get(t).expiry)){const{message:n}=Tt("EXPIRED",`pairing topic: ${t}`);throw new Error(n)}}async isValidSessionTopic(t){if(!vi(t,!1)){const{message:n}=Tt("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(n)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:n}=Tt("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(n)}if(x2(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:n}=Tt("EXPIRED",`session topic: ${t}`);throw new Error(n)}if(!this.client.core.crypto.keychain.has(t)){const{message:n}=Tt("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(n)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(vi(t,!1)){const{message:n}=Tt("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(n)}else{const{message:n}=Tt("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(n)}}async isValidProposalId(t){if(!a4t(t)){const{message:n}=Tt("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(n)}if(!this.client.proposal.keys.includes(t)){const{message:n}=Tt("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(n)}if(x2(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:n}=Tt("EXPIRED",`proposal id: ${t}`);throw new Error(n)}}}class k4t extends yb{constructor(t,n){super(t,n,w4t,AV),this.core=t,this.logger=n}}let R4t=class extends yb{constructor(t,n){super(t,n,y4t,AV),this.core=t,this.logger=n}};class B4t extends yb{constructor(t,n){super(t,n,v4t,AV,r=>r.id),this.core=t,this.logger=n}}class D4t extends yb{constructor(t,n){super(t,n,x4t,LT,()=>BS),this.core=t,this.logger=n}}class U4t extends yb{constructor(t,n){super(t,n,I4t,LT),this.core=t,this.logger=n}}class L4t extends yb{constructor(t,n){super(t,n,S4t,LT,r=>r.id),this.core=t,this.logger=n}}var M4t=Object.defineProperty,j4t=(e,t,n)=>t in e?M4t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DB=(e,t,n)=>j4t(e,typeof t!="symbol"?t+"":t,n);class F4t{constructor(t,n){this.core=t,this.logger=n,DB(this,"authKeys"),DB(this,"pairingTopics"),DB(this,"requests"),this.authKeys=new D4t(this.core,this.logger),this.pairingTopics=new U4t(this.core,this.logger),this.requests=new L4t(this.core,this.logger)}
165async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var z4t=Object.defineProperty,q4t=(e,t,n)=>t in e?z4t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sn=(e,t,n)=>q4t(e,typeof t!="symbol"?t+"":t,n);let W4t=class sve extends D5t{constructor(t){super(t),Sn(this,"protocol",tve),Sn(this,"version",nve),Sn(this,"name",RB.name),Sn(this,"metadata"),Sn(this,"core"),Sn(this,"logger"),Sn(this,"events",new Dn.EventEmitter),Sn(this,"engine"),Sn(this,"session"),Sn(this,"proposal"),Sn(this,"pendingRequest"),Sn(this,"auth"),Sn(this,"signConfig"),Sn(this,"on",(r,s)=>this.events.on(r,s)),Sn(this,"once",(r,s)=>this.events.once(r,s)),Sn(this,"off",(r,s)=>this.events.off(r,s)),Sn(this,"removeListener",(r,s)=>this.events.removeListener(r,s)),Sn(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),Sn(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"update",async r=>{try{return await this.engine.update(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"request",async r=>{try{return await this.engine.request(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"find",r=>{try{return this.engine.find(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),Sn(this,"authenticate",async(r,s)=>{try{return await this.engine.authenticate(r,s)}catch(i){throw this.logger.error(i.message),i}}),Sn(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),Sn(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(s){throw this.logger.error(s.message),s}}),this.name=(t==null?void 0:t.name)||RB.name,this.metadata=w3t(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const n=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:S6(PC({level:(t==null?void 0:t.logger)||RB.logger}));this.core=(t==null?void 0:t.core)||new k5t(t),this.logger=pa(n,this.name),this.session=new R4t(this.core,this.logger),this.proposal=new k4t(this.core,this.logger),this.pendingRequest=new B4t(this.core,this.logger),this.engine=new O4t(this),this.auth=new F4t(this.core,this.logger)}static async init(t){const n=new sve(t);return await n.initialize(),n}get context(){return Cc(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"),setTimeout(()=>{this.engine.processRelayMessageCache()},V.toMiliseconds(V.ONE_SECOND))}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}};const Zie="error",H4t="wss://relay.walletconnect.org",V4t="wc",K4t="universal_provider",OI=`${V4t}@2:${K4t}
165:`,ive="https://rpc.walletconnect.org/v1/",rv="generic",G4t=`${ive}bundler`,Mu={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function Z4t(){}function _V(e){return e==null||typeof e!="object"&&typeof e!="function"}function NV(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Y4t(e){if(_V(e))return e;if(Array.isArray(e)||NV(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e),n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){const r=new n(e);return r.lastIndex=e.lastIndex,r}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){const r=new n(e.message);return r.stack=e.stack,r.name=e.name,r.cause=e.cause,r}if(typeof File<"u"&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e=="object"){const r=Object.create(t);return Object.assign(r,e)}return e}function Yie(e){return typeof e=="object"&&e!==null}function ove(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function ave(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const J4t="[object RegExp]",cve="[object String]",lve="[object Number]",uve="[object Boolean]",dve="[object Arguments]",X4t="[object Symbol]",Q4t="[object Date]",eCt="[object Map]",tCt="[object Set]",nCt="[object Array]",rCt="[object ArrayBuffer]",sCt="[object Object]",iCt="[object DataView]",oCt="[object Uint8Array]",aCt="[object Uint8ClampedArray]",cCt="[object Uint16Array]",lCt="[object Uint32Array]",uCt="[object Int8Array]",dCt="[object Int16Array]",hCt="[object Int32Array]",fCt="[object Float32Array]",pCt="[object Float64Array]";function gCt(e,t){return Av(e,void 0,e,new Map,t)}function Av(e,t,n,r=new Map,s=void 0){const i=s==null?void 0:s(e,t,n,r);if(i!=null)return i;if(_V(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const o=new Array(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=Av(e[a],a,n,r,s);return Object.hasOwn(e,"index")&&(o.index=e.index),Object.hasOwn(e,"input")&&(o.input=e.input),o}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o}if(e instanceof Map){const o=new Map;r.set(e,o);for(const[a,c]of e)o.set(a,Av(c,a,n,r,s));return o}if(e instanceof Set){const o=new Set;r.set(e,o);for(const a of e)o.add(Av(a,void 0,n,r,s));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(NV(e)){const o=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,o);for(let a=0;a<e.length;a++)o[a]=Av(e[a],a,n,r,s);return o}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const o=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,o),sw(o,e,n,r,s),o}if(typeof File<"u"&&e instanceof File){const o=new File([e],e.name,{type:e.type});return r.set(e,o),sw(o,e,n,r,s),o}if(e instanceof Blob){const o=new Blob([e],{type:e.type});return r.set(e,o),sw(o,e,n,r,s),o}if(e instanceof Error){const o=new e.constructor;return r.set(e,o),o.message=e.message,o.name=e.name,o.stack=e.stack,o.cause=e.cause,sw(o,e,n,r,s),o}if(typeof e=="object"&&mCt(e)){const o=Object.create(Object.getPrototypeOf(e));return r.set(e,o),sw(o,e,n,r,s),o}return e}function sw(e,t,n=e,r,s){const i=[...Object.keys(t),...ove(t)];for(let o=0;o<i.length;o++){const a=i[o],c=Object.getOwnPropertyDescriptor(e,a);(c==null||c.writable)&&(e[a]=Av(t[a],a,n,r,s))}}function mCt(e){switch(ave(e)){case dve:case nCt:case rCt:case iCt:case uve:case Q4t:case fCt:case pCt:case uCt:case dCt:case hCt:case eCt:case lve:case sCt:case J4t:case tCt:case cve:case X4t:case oCt:case aCt:case cCt:case lCt:return!0;default:return!1}}function wCt(e,t){return gCt(e,(n,r,s,i)=>{if(typeof e=="object")switch(Object.prototype.toString.call(e)){case lve:case cve:case uve:{const o=new e.constructor(e==null?void 0:e.valueOf());return sw(o,e),o}case dve:{const o={};return sw(o,e),o.length=e.length,o[Symbol.iterator]=e[Symbol.iterator],o}default:return}})}function Jie(e){return wCt(e)}function Xie(e){return e!==null&&typeof e=="object"&&ave(e)==="[object Arguments]"}function yCt(e){return NV(e)}function bCt(e){var n;if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;
vendor: 13,837 bytes, line 165
165if(Object.prototype.toString.call(e)!=="[object Object]"){const r=e[Symbol.toStringTag];return r==null||!((n=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))!=null&&n.writable)?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function vCt(e,...t){const n=t.slice(0,-1),r=t[t.length-1];let s=e;for(let i=0;i<n.length;i++){const o=n[i];s=gF(s,o,r,new Map)}return s}function gF(e,t,n,r){if(_V(e)&&(e=Object(e)),t==null||typeof t!="object")return e;if(r.has(t))return Y4t(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let i=0;i<t.length;i++)t[i]=t[i]??void 0}const s=[...Object.keys(t),...ove(t)];for(let i=0;i<s.length;i++){const o=s[i];let a=t[o],c=e[o];if(Xie(a)&&(a={...a}),Xie(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=Jie(a)),Array.isArray(a))if(typeof c=="object"&&c!=null){const u=[],d=Reflect.ownKeys(c);for(let h=0;h<d.length;h++){const f=d[h];u[f]=c[f]}c=u}else c=[];const l=n(c,a,o,e,t,r);l!=null?e[o]=l:Array.isArray(a)||Yie(c)&&Yie(a)?e[o]=gF(c,a,n,r):c==null&&bCt(a)?e[o]=gF({},a,n,r):c==null&&yCt(a)?e[o]=Jie(a):(c===void 0||a!==void 0)&&(e[o]=a)}return e}function ECt(e,...t){return vCt(e,...t,Z4t)}var CCt=Object.defineProperty,$Ct=Object.defineProperties,xCt=Object.getOwnPropertyDescriptors,Qie=Object.getOwnPropertySymbols,ICt=Object.prototype.hasOwnProperty,SCt=Object.prototype.propertyIsEnumerable,eoe=(e,t,n)=>t in e?CCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kI=(e,t)=>{for(var n in t||(t={}))ICt.call(t,n)&&eoe(e,n,t[n]);if(Qie)for(var n of Qie(t))SCt.call(t,n)&&eoe(e,n,t[n]);return e},ACt=(e,t)=>$Ct(e,xCt(t));function gl(e,t,n){var r;const s=Yv(e);return((r=t.rpcMap)==null?void 0:r[s.reference])||`${ive}?chainId=${s.namespace}:${s.reference}&projectId=${n}`}function bb(e){return e.includes(":")?e.split(":")[1]:e}function hve(e){return e.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function _Ct(e,t){const n=Object.keys(t.namespaces).filter(s=>s.includes(e));if(!n.length)return[];const r=[];return n.forEach(s=>{const i=t.namespaces[s].accounts;r.push(...i)}),r}function RI(e={},t={}){const n=toe(e),r=toe(t);return ECt(n,r)}function toe(e){var t,n,r,s,i;const o={};if(!Tm(e))return o;for(const[a,c]of Object.entries(e)){const l=UT(a)?[a]:c.chains,u=c.methods||[],d=c.events||[],h=c.rpcMap||{},f=Sv(a);o[f]=ACt(kI(kI({},o[f]),c),{chains:Jh(l,(t=o[f])==null?void 0:t.chains),methods:Jh(u,(n=o[f])==null?void 0:n.methods),events:Jh(d,(r=o[f])==null?void 0:r.events)}),(Tm(h)||Tm(((s=o[f])==null?void 0:s.rpcMap)||{}))&&(o[f].rpcMap=kI(kI({},h),(i=o[f])==null?void 0:i.rpcMap))}return o}function noe(e){return e.includes(":")?e.split(":")[2]:e}function roe(e){const t={};for(const[n,r]of Object.entries(e)){const s=r.methods||[],i=r.events||[],o=r.accounts||[],a=UT(n)?[n]:r.chains?r.chains:hve(r.accounts);t[n]={chains:a,methods:s,events:i,accounts:o}}return t}function UB(e){return typeof e=="number"?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const fve={},Zn=e=>fve[e],LB=(e,t)=>{fve[e]=t};var NCt=Object.defineProperty,TCt=(e,t,n)=>t in e?NCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N2=(e,t,n)=>TCt(e,typeof t!="symbol"?t+"":t,n);class PCt{constructor(t){N2(this,"name","polkadot"),N2(this,"client"),N2(this,"httpProviders"),N2(this,"events"),N2(this,"namespace"),N2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=bb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}var OCt=Object.defineProperty,kCt=Object.defineProperties,RCt=Object.getOwnPropertyDescriptors,soe=Object.getOwnPropertySymbols,BCt=Object.prototype.hasOwnProperty,DCt=Object.prototype.propertyIsEnumerable,mF=(e,t,n)=>t in e?OCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ioe=(e,t)=>{for(var n in t||(t={}))BCt.call(t,n)&&mF(e,n,t[n]);if(soe)for(var n of soe(t))DCt.call(t,n)&&mF(e,n,t[n]);return e},ooe=(e,t)=>kCt(e,RCt(t)),T2=(e,t,n)=>mF(e,typeof t!="symbol"?t+"":t,n);class UCt{constructor(t){T2(this,"name","eip155"),T2(this,"client"),T2(this,"chainId"),T2(this,"namespace"),T2(this,"httpProviders"),T2(this,"events"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t);case"wallet_getCallsStatus":return await this.getCallStatus(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(parseInt(t),n),this.chainId=parseInt(t),this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,n){const r=n||gl(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=parseInt(bb(n));t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}async handleSwitchChain(t){var n,r;let s=t.request.params?(n=t.request.params[0])==null?void 0:n.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const i=parseInt(s,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(r=this.namespace.chains)==null?void 0:r[0]}),this.setDefaultChain(`${i}`);else throw new Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var n,r,s,i,o;const a=(r=(n=t.request)==null?void 0:n.params)==null?void 0:r[0],c=((i=(s=t.request)==null?void 0:s.params)==null?void 0:i[1])||[],l=`${a}${c.join(",")}`;if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),d=((o=u==null?void 0:u.sessionProperties)==null?void 0:o.capabilities)||{};if(d!=null&&d[l])return d==null?void 0:d[l];const h=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:ooe(ioe({},u.sessionProperties||{}),{capabilities:ooe(ioe({},d||{}),{[l]:h})})})}catch(f){console.warn("Failed to update session with capabilities",f)}return h}async getCallStatus(t){var n,r;const s=this.client.session.get(t.topic),i=(n=s.sessionProperties)==null?void 0:n.bundler_name;if(i){const a=this.getBundlerUrl(t.chainId,i);try{return await this.getUserOperationReceipt(a,t)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(r=s.sessionProperties)==null?void 0:r.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,t)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(t.request.method))return await this.client.request(t);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(t,n){var r;const s=new URL(t),i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_n("eth_getUserOperationReceipt",[(r=n.request.params)==null?void 0:r[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}getBundlerUrl(t,n){return`${G4t}?projectId=${this.client.core.projectId}&chainId=${t}&bundler=${n}`}}var LCt=Object.defineProperty,MCt=(e,t,n)=>t in e?LCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P2=(e,t,n)=>MCt(e,typeof t!="symbol"?t+"":t,n);class jCt{constructor(t){P2(this,"name","solana"),P2(this,"client"),P2(this,"httpProviders"),P2(this,"events"),P2(this,"namespace"),P2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=bb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}var FCt=Object.defineProperty,zCt=(e,t,n)=>t in e?FCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O2=(e,t,n)=>zCt(e,typeof t!="symbol"?t+"":t,n);class qCt{constructor(t){O2(this,"name","cosmos"),O2(this,"client"),O2(this,"httpProviders"),O2(this,"events"),O2(this,"namespace"),O2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=bb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}
165var WCt=Object.defineProperty,HCt=(e,t,n)=>t in e?WCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k2=(e,t,n)=>HCt(e,typeof t!="symbol"?t+"":t,n);class VCt{constructor(t){k2(this,"name","algorand"),k2(this,"client"),k2(this,"httpProviders"),k2(this,"events"),k2(this,"namespace"),k2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){if(!this.httpProviders[t]){const r=n||gl(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;t[n]=this.createHttpProvider(n,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new or(new Or(r,Zn("disableProviderPing")))}}var KCt=Object.defineProperty,GCt=(e,t,n)=>t in e?KCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R2=(e,t,n)=>GCt(e,typeof t!="symbol"?t+"":t,n);class ZCt{constructor(t){R2(this,"name","cip34"),R2(this,"client"),R2(this,"httpProviders"),R2(this,"events"),R2(this,"namespace"),R2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{const r=this.getCardanoRPCUrl(n),s=bb(n);t[s]=this.createHttpProvider(s,r)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}getCardanoRPCUrl(t){const n=this.namespace.rpcMap;if(n)return n[t]}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||this.getCardanoRPCUrl(t);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}var YCt=Object.defineProperty,JCt=(e,t,n)=>t in e?YCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B2=(e,t,n)=>JCt(e,typeof t!="symbol"?t+"":t,n);class XCt{constructor(t){B2(this,"name","elrond"),B2(this,"client"),B2(this,"httpProviders"),B2(this,"events"),B2(this,"namespace"),B2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=bb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}var QCt=Object.defineProperty,e$t=(e,t,n)=>t in e?QCt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
vendor: 1,861 bytes, line 165
165):e[t]=n,D2=(e,t,n)=>e$t(e,typeof t!="symbol"?t+"":t,n);class t$t{constructor(t){D2(this,"name","multiversx"),D2(this,"client"),D2(this,"httpProviders"),D2(this,"events"),D2(this,"namespace"),D2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;const s=bb(n);t[s]=this.createHttpProvider(s,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}var n$t=Object.defineProperty,r$t=(e,t,n)=>t in e?n$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}
165):e[t]=n,U2=(e,t,n)=>r$t(e,typeof t!="symbol"?t+"":t,n);class s$t{constructor(t){U2(this,"name","near"),U2(this,"client"),U2(this,"httpProviders"),U2(this,"events"),U2(this,"namespace"),U2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){if(this.chainId=t,!this.httpProviders[t]){const r=n||gl(`${this.name}:${t}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{var r;t[n]=this.createHttpProvider(n,(r=this.namespace.rpcMap)==null?void 0:r[n])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace);return typeof r>"u"?void 0:new or(new Or(r,Zn("disableProviderPing")))}}var i$t=Object.defineProperty,o$t=(e,t,n)=>t in e?i$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L2=(e,t,n)=>o$t(e,typeof t!="symbol"?t+"":t,n);class a$t{constructor(t){L2(this,"name","tezos"),L2(this,"client"),L2(this,"httpProviders"),L2(this,"events"),L2(this,"namespace"),L2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,n){if(this.chainId=t,!this.httpProviders[t]){const r=n||gl(`${this.name}:${t}`,this.namespace);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,r)}this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(n=>{t[n]=this.createHttpProvider(n)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace);return typeof r>"u"?void 0:new or(new Or(r))}}var c$t=Object.defineProperty,l$t=(e,t,n)=>t in e?c$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M2=(e,t,n)=>l$t(e,typeof t!="symbol"?t+"":t,n);class u$t{constructor(t){M2(this,"name",rv),M2(this,"client"),M2(this,"httpProviders"),M2(this,"events"),M2(this,"namespace"),M2(this,"chainId"),this.namespace=t.namespace,this.events=Zn("events"),this.client=Zn("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(t.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(t.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(t.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(t.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider(t.chainId).request(t.request)}setDefaultChain(t,n){this.httpProviders[t]||this.setHttpProvider(t,n),this.chainId=t,this.events.emit(Mu.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){var t,n;const r={};return(n=(t=this.namespace)==null?void 0:t.accounts)==null||n.forEac
vendor: 7,268 bytes, line 165
165h(s=>{const i=Yv(s);r[`${i.namespace}:${i.reference}`]=this.createHttpProvider(s)}),r}getHttpProvider(t){const n=this.httpProviders[t];if(typeof n>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return n}setHttpProvider(t,n){const r=this.createHttpProvider(t,n);r&&(this.httpProviders[t]=r)}createHttpProvider(t,n){const r=n||gl(t,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${t}`);return new or(new Or(r,Zn("disableProviderPing")))}}var d$t=Object.defineProperty,h$t=Object.defineProperties,f$t=Object.getOwnPropertyDescriptors,aoe=Object.getOwnPropertySymbols,p$t=Object.prototype.hasOwnProperty,g$t=Object.prototype.propertyIsEnumerable,wF=(e,t,n)=>t in e?d$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BI=(e,t)=>{for(var n in t||(t={}))p$t.call(t,n)&&wF(e,n,t[n]);if(aoe)for(var n of aoe(t))g$t.call(t,n)&&wF(e,n,t[n]);return e},MB=(e,t)=>h$t(e,f$t(t)),Hl=(e,t,n)=>wF(e,typeof t!="symbol"?t+"":t,n);let m$t=class pve{constructor(t){Hl(this,"client"),Hl(this,"namespaces"),Hl(this,"optionalNamespaces"),Hl(this,"sessionProperties"),Hl(this,"scopedProperties"),Hl(this,"events",new Bu),Hl(this,"rpcProviders",{}),Hl(this,"session"),Hl(this,"providerOpts"),Hl(this,"logger"),Hl(this,"uri"),Hl(this,"disableProviderPing",!1),this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:S6(PC({level:(t==null?void 0:t.logger)||Zie})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const n=new pve(t);return await n.initialize(),n}async request(t,n,r){const[s,i]=this.validateChain(n);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:BI({},t),chainId:`${s}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(t,n,r,s){const i=new Date().getTime();this.request(t,r,s).then(o=>n(null,Pi(i,o))).catch(o=>n(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:ss("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t,n){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:r,response:s}=await this.client.authenticate(t,n);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await s();if(this.session=i.session,this.session){const o=roe(this.session.namespaces);this.namespaces=RI(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(t,n){this.events.on(t,n)}once(t,n){this.events.once(t,n)}removeListener(t,n){this.events.removeListener(t,n)}off(t,n){this.events.off(t,n)}get isWalletConnect(){return!0}async pair(t){const{uri:n,approval:r}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});n&&(this.uri=n,this.events.emit("display_uri",n));const s=await r();this.session=s;const i=roe(s.namespaces);return this.namespaces=RI(this.namespaces,i),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(t,n){try{if(!this.session)return;const[r,s]=this.validateChain(t),i=this.getProvider(r);i.name===rv?i.setDefaultChain(`${r}:${s}`,n):i.setDefaultChain(s,n)}catch(r){if(!/Please call connect/.test(r.message))throw r}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const n=this.client.pairing.getAll();if(Nm(n)){for(const r of n)t.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${n.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var t,n;if(this.client=this.providerOpts.client||await W4t.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Zie,relayUrl:this.providerOpts.relayUrl||H4t,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.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error("Failed to get session",r),new Error(`The provided session: ${(n=(t=this.providerOpts)==null?void 0:t.session)==null?void 0:n.topic} doesn't exist in the Sign client`)}else{const r=this.client.session.getAll();this.session=r[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(n=>Sv(n)))];LB("client",this.client),LB("events",this.events),LB("disableProviderPing",this.disableProviderPing),t.forEach(n=>{if(!this.session)return;const r=_Ct(n,this.session),s=hve(r),i=RI(this.namespaces,this.optionalNamespaces),o=MB(BI({},i[n]),{accounts:r,chains:s});switch(n){case"eip155":this.rpcProviders[n]=new UCt({namespace:o});break;case"algorand":this.rpcProviders[n]=new VCt({namespace:o});break;case"solana":this.rpcProviders[n]=new jCt({namespace:o});break;case"cosmos":this.rpcProviders[n]=new qCt({namespace:o});break;case"polkadot":this.rpcProviders[n]=new PCt({namespace:o});break;case"cip34":this.rpcProviders[n]=new ZCt({namespace:o});break;case"elrond":this.rpcProviders[n]=new XCt({namespace:o});break;case"multiversx":this.rpcProviders[n]=new t$t({namespace:o});break;case"near":this.rpcProviders[n]=new s$t({namespace:o});break;case"tezos":this.rpcProviders[n]=new a$t({namespace:o});break;default:this.rpcProviders[rv]?this.rpcProviders[rv].updateNamespace(o):this.rpcProviders[rv]=new u$t({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{var n;const{topic:r}=t;r===((n=this.session)==null?void 0:n.topic)&&this.events.emit("session_ping",t)}
165),this.client.on("session_event",t=>{var n;const{params:r,topic:s}=t;if(s!==((n=this.session)==null?void 0:n.topic))return;const{event:i}=r;if(i.name==="accountsChanged"){const o=i.data;o&&Nm(o)&&this.events.emit("accountsChanged",o.map(noe))}else if(i.name==="chainChanged"){const o=r.chainId,a=r.event.data,c=Sv(o),l=UB(o)!==UB(a)?`${c}:${UB(a)}`:o;this.onChainChanged(l)}else this.events.emit(i.name,i.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:n})=>{var r,s;if(t!==((r=this.session)==null?void 0:r.topic))return;const{namespaces:i}=n,o=(s=this.client)==null?void 0:s.session.get(t);this.session=MB(BI({},o),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:n})}),this.client.on("session_delete",async t=>{var n;t.topic===((n=this.session)==null?void 0:n.topic)&&(await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",MB(BI({},ss("USER_DISCONNECTED")),{data:t.topic})))}),this.on(Mu.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){return this.rpcProviders[t]||this.rpcProviders[rv]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var n;this.getProvider(t).updateNamespace((n=this.session)==null?void 0:n.namespaces[t])})}setNamespaces(t){const{namespaces:n={},optionalNamespaces:r={},sessionProperties:s,scopedProperties:i}=t;this.optionalNamespaces=RI(n,r),this.sessionProperties=s,this.scopedProperties=i}validateChain(t){const[n,r]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[n,r];if(n&&!Object.keys(this.namespaces||{}).map(o=>Sv(o)).includes(n))throw new Error(`Namespace '${n}' is not configured. Please call connect() first with namespace config.`);if(n&&r)return[n,r];const s=Sv(Object.keys(this.namespaces)[0]),i=this.rpcProviders[s].getDefaultChain();return[s,i]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}async onChainChanged(t,n=!1){if(!this.namespaces)return;const[r,s]=this.validateChain(t);if(!s)return;this.updateNamespaceChain(r,s),this.events.emit("chainChanged",s);const i=this.getProvider(r).getDefaultChain();n||this.getProvider(r).setDefaultChain(s),this.emitAccountsChangedOnChainChange({namespace:r,previousChainId:i,newChainId:t}),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:t,previousChainId:n,newChainId:r}){var s,i;try{if(n===r)return;const o=(i=(s=this.session)==null?void 0:s.namespaces[t])==null?void 0:i.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${r}:`)).map(noe);if(!Nm(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn("Failed to emit accountsChanged on chain change",o)}}updateNamespaceChain(t,n){if(!this.namespaces)return;const r=this.namespaces[t]?t:`${t}:${n}`,s={chains:[],methods:[],events:[],defaultChain:n};this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=n):this.namespaces[r]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(t,n){var r;const s=((r=this.session)==null?void 0:r.topic)||"";await this.client.core.storage.setItem(`${OI}/${t}${s}`,n)}async getFromStore(t){var n;const r=((n=this.session)==null?void 0:n.topic)||"";return await this.client.core.storage.getItem(`${OI}/${t}${r}`)}async deleteFromStore(t){var n;const r=((n=this.session)==null?void 0:n.topic)||"";await this.client.core.storage.removeItem(`${OI}/${t}${r}`)}async cleanupStorage(){var t;try{if(((t=this.client)==null?void 0:t.session.length)>0)return;const n=await this.client.core.storage.getKeys();for(const r of n)r.startsWith(OI)&&await this.client.core.storage.removeItem(r)}catch(n){this.logger.warn("Failed to cleanup storage",n)}}};function DI(e,t){return Pe.getConnectorId(e)===t}function w$t(e){const t=Array.from(J.state.chains.keys());let n=[];return e?(n.push([e,J.state.chains.get(e)]),DI(e,$t.CONNECTOR_ID.WALLET_CONNECT)?t.forEach(r=>{r!==e&&DI(r,$t.CONNECTOR_ID.WALLET_CONNECT)&&n.push([r,J.state.chains.get(r)])}):DI(e,$t.CONNECTOR_ID.AUTH)&&t.forEach(r=>{r!==e&&DI(r,$t.CONNECTOR_ID.AUTH)&&n.push([r,J.state.chains.get(r)])})):n=Array.from(J.state.chains.entries()),n}const Dg={EIP155:"eip155",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED"},BA={NetworkImageIds:{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",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",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",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200"},ConnectorImageIds:{[$t.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[$t.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[$t.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[$t.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[$t.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[$t.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-454
1650-9e6a2b9cae00"},ConnectorNamesMap:{[$t.CONNECTOR_ID.INJECTED]:"Browser Wallet",[$t.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[$t.CONNECTOR_ID.COINBASE]:"Coinbase",[$t.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[$t.CONNECTOR_ID.LEDGER]:"Ledger",[$t.CONNECTOR_ID.SAFE]:"Safe"}},TV={getCaipTokens(e){if(!e)return;const t={};return Object.entries(e).forEach(([n,r])=>{t[`${Dg.EIP155}:${n}`]=r}),t},isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}};new AbortController;const j2={UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"INVALID_APP_CONFIGURATION"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"},INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{shortMessage:"Network Not Found",longMessage:"Network not found - please make sure it is included in 'networks' array in createAppKit function"},INVALID_APP_CONFIGURATION:{shortMessage:"Invalid App Configuration",longMessage:()=>`Origin ${y$t()?window.origin:"unknown"} not found on Allowlist - update configuration on cloud.reown.com`},IFRAME_LOAD_FAILED:{shortMessage:"Network Error - Could not load embedded wallet",longMessage:()=>"There was an issue loading the embedded wallet. Please try again later."},IFRAME_REQUEST_TIMEOUT:{shortMessage:"Embedded Wallet Request Timed Out",longMessage:()=>"There was an issue doing the request to the embedded wallet. Please try again later."},UNVERIFIED_DOMAIN:{shortMessage:"Invalid App Configuration",longMessage:()=>"There was an issue loading the embedded wallet. Please verify that your domain is allowed at cloud.reown.com"},JWT_TOKEN_NOT_VALID:{shortMessage:"Session Expired",longMessage:"Invalid session found on UniversalProvider - please check your time settings and connect again"},INVALID_PROJECT_ID:{shortMessage:"Invalid App Configuration",longMessage:"Invalid Project ID - update configuration"},PROJECT_ID_NOT_CONFIGURED:{shortMessage:"Project ID Not Configured",longMessage:"Project ID Not Configured - update configuration on cloud.reown.com"}}};function y$t(){return typeof window<"u"}var jB,coe;function b$t(){if(coe)return jB;coe=1;const e=SC();jB=s;const t=S().console||{},n={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:p,wrapResponseSerializer:p,wrapErrorSerializer:p,req:g,res:g,err:h};function r(v,x){return Array.isArray(v)?v.filter(function(I){return I!=="!stdSerializers.err"}):v===!0?Object.keys(x):!1}function s(v){v=v||{},v.browser=v.browser||{};const x=v.browser.transmit;if(x&&typeof x.send!="function")throw Error("pino: transmit option must have a send function");const A=v.browser.write||t;v.browser.write&&(v.browser.asObject=!0);const I=v.serializers||{},O=r(v.browser.serialize,I);let N=v.browser.serialize;Array.isArray(v.browser.serialize)&&v.browser.serialize.indexOf("!stdSerializers.err")>-1&&(N=!1);const T=["error","fatal","warn","info","debug","trace"];typeof A=="function"&&(A.error=A.fatal=A.warn=A.info=A.debug=A.trace=A),v.enabled===!1&&(v.level="silent");const P=v.level||"info",_=Object.create(A);_.log||(_.log=m),Object.defineProperty(_,"levelVal",{get:$}),Object.defineProperty(_,"level",{get:R,set:B});const y={transmit:x,serialize:O,asObject:v.browser.asObject,levels:T,timestamp:f(v)};_.levels=s.levels,_.level=P,_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=m,_.serializers=I,_._serialize=O,_._stdErrSerialize=N,_.child=k,x&&(_._logEvent=d());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function R(){return this._level}function B(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,i(y,_,"error","log"),i(y,_,"fatal","error"),i(y,_,"warn","error"),i(y,_,"info","log"),i(y,_,"debug","log"),i(y,_,"trace","log")}function k(D,U){if(!D)throw new Error("missing bindings for child Pino");U=U||{}
165,O&&D.serializers&&(U.serializers=D.serializers);const F=U.serializers;if(O&&F){var K=Object.assign({},I,F),q=v.browser.serialize===!0?Object.keys(K):O;delete D.serializers,c([D],q,K,this._stdErrSerialize)}function H(Z){this._childLevel=(Z._childLevel|0)+1,this.error=l(Z,D,"error"),this.fatal=l(Z,D,"fatal"),this.warn=l(Z,D,"warn"),this.info=l(Z,D,"info"),this.debug=l(Z,D,"debug"),this.trace=l(Z,D,"trace"),K&&(this.serializers=K,this._serialize=q),x&&(this._logEvent=d([].concat(Z._logEvent.bindings,D)))}return H.prototype=this,new H(this)}return _}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers=n,s.stdTimeFunctions=Object.assign({},{nullTime:w,epochTime:C,unixTime:E,isoTime:b});function i(v,x,A,I){const O=Object.getPrototypeOf(x);x[A]=x.levelVal>x.levels.values[A]?m:O[A]?O[A]:t[A]||t[I]||m,o(v,x,A)}function o(v,x,A){!v.transmit&&x[A]===m||(x[A]=(function(I){return function(){const N=v.timestamp(),T=new Array(arguments.length),P=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var _=0;_<T.length;_++)T[_]=arguments[_];if(v.serialize&&!v.asObject&&c(T,this._serialize,this.serializers,this._stdErrSerialize),v.asObject?I.call(P,a(this,A,T,N)):I.apply(P,T),v.transmit){const y=v.transmit.level||x.level,$=s.levels.values[y],R=s.levels.values[A];if(R<$)return;u(this,{ts:N,methodLevel:A,methodValue:R,transmitValue:s.levels.values[v.transmit.level||x.level],send:v.transmit.send,val:x.levelVal},T)}}})(x[A]))}
165function a(v,x,A,I){v._serialize&&c(A,v._serialize,v.serializers,v._stdErrSerialize);const O=A.slice();let N=O[0];const T={};I&&(T.time=I),T.level=s.levels.values[x];let P=(v._childLevel|0)+1;if(P<1&&(P=1),N!==null&&typeof N=="object"){for(;P--&&typeof O[0]=="object";)Object.assign(T,O.shift());N=O.length?e(O.shift(),O):void 0}else typeof N=="string"&&(N=e(O.shift(),O));return N!==void 0&&(T.msg=N),T}function c(v,x,A,I){for(const O in v)if(I&&v[O]instanceof Error)v[O]=s.stdSerializers.err(v[O]);else if(typeof v[O]=="object"&&!Array.isArray(v[O]))for(const N in v[O])x&&x.indexOf(N)>-1&&N in A&&(v[O][N]=A[N](v[O][N]))}function l(v,x,A){return function(){const I=new Array(1+arguments.length);I[0]=x;for(var O=1;O<I.length;O++)I[O]=arguments[O-1];return v[A].apply(this,I)}}function u(v,x,A){const I=x.send,O=x.ts,N=x.methodLevel,T=x.methodValue,P=x.val,_=v._logEvent.bindings;c(A,v._serialize||Object.keys(v.serializers),v.serializers,v._stdErrSerialize===void 0?!0:v._stdErrSerialize),v._logEvent.ts=O,v._logEvent.messages=A.filter(function(y){return _.indexOf(y)===-1}),v._logEvent.level.label=N,v._logEvent.level.value=T,I(N,v._logEvent,P),v._logEvent=d(_)}function d(v){return{ts:0,messages:[],bindings:v||[],level:{label:"",value:0}}}function h(v){const x={type:v.constructor.name,msg:v.message,stack:v.stack};for(const A in v)x[A]===void 0&&(x[A]=v[A]);return x}function f(v){return typeof v.timestamp=="function"?v.timestamp:v.timestamp===!1?w:C}function g(){return{}}function p(v){return v}function m(){}function w(){return!1}function C(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function b(){return new Date(Date.now()).toISOString()}function S(){function v(x){return typeof x<"u"&&x}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return v(self)||v(window)||v(this)||{}}}return jB}var sv=b$t();const gve=mf(sv),v$t={level:"info"},PV=1e3*1024;class E$t{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class loe{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const n=new E$t(t);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let n=this.head;for(;n!==null;)t.push(n.value),n=n.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const n=t.value;return t=t.next,{done:!1,value:n}}}}}class mve{constructor(t,n=PV){this.level=t??"error",this.levelValue=sv.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new loe(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,n){n===sv.levels.values.error?console.error(t):n===sv.levels.values.warn?console.warn(t):n===sv.levels.values.debug?console.debug(t):n===sv.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Ao({timestamp:new Date().toISOString(),log:t}));const n=typeof t=="string"?JSON.parse(t).level:t.level;n>=this.levelValue&&this.forwardToConsole(t,n)}getLogs(){return this.logs}clearLogs(){this.logs=new loe(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const n=this.getLogArray();return n.push(Ao({extraMetadata:t})),new Blob(n,{type:"application/json"})}}let C$t=class{constructor(t,n=PV){this.baseChunkLogger=new mve(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const n=URL.createObjectURL(this.logsToBlob(t)),r=document.createElement("a");r.href=n,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}};class $$t{constructor(t,n=PV){this.baseChunkLogger=new mve(t,n)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}}var x$t=Object.defineProperty,I$t=Object.defineProperties,S$t=Object.getOwnPropertyDescriptors,uoe=Object.getOwnPropertySymbols,A$t=Object.prototype.hasOwnProperty,_$t=Object.prototype.propertyIsEnumerable,doe=(e,t,n)=>t in e?x$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DA=(e,t)=>{for(var n in t||(t={}))A$t.call(t,n)&&doe(e,n,t[n]);if(uoe)for(var n of uoe(t))_$t.call(t,n)&&doe(e,n,t[n]);return e},UA=(e,t)=>I$t(e,S$t(t));
165function N$t(e){return UA(DA({},e),{level:(e==null?void 0:e.level)||v$t.level})}function T$t(e){var t,n;const r=new C$t((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:gve(UA(DA({},e.opts),{level:"trace",browser:UA(DA({},(n=e.opts)==null?void 0:n.browser),{write:s=>r.write(s)})})),chunkLoggerController:r}}function P$t(e){var t;const n=new $$t((t=e.opts)==null?void 0:t.level,e.maxSizeInBytes);return{logger:gve(UA(DA({},e.opts),{level:"trace"}),n),chunkLoggerController:n}}function O$t(e){return typeof e.loggerOverride<"u"&&typeof e.loggerOverride!="string"?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<"u"?T$t(e):P$t(e)}const k$t={createLogger(e,t="error"){const n=N$t({level:t}),{logger:r}=O$t({opts:n});return r.error=(...s)=>{for(const i of s)if(i instanceof Error){e(i,...s);return}e(void 0,...s)},r}};function R$t(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function hoe(e){return R$t(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const wve="2.47.6";let fE={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${wve}`},q0=class yF extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof yF?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof yF&&n.cause.docsPath||n.docsPath,i=(a=fE.getDocsUrl)==null?void 0:a.call(fE,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...fE.version?[`Version: ${fE.version}`]:[]].join(` 166`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=wve}walk(t){return yve(this,t)}};function yve(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?yve(e.cause,t):t?null:e}let bve=class extends q0{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function B$t(e,{dir:t,size:n=32}={}){return typeof e=="string"?D$t(e,{dir:t,size:n}):U$t(e,{dir:t,size:n})}function D$t(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new bve({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function U$t(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new bve({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let L$t=class extends q0{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function M$t(e,{size:t}){if(hoe(e)>t)throw new L$t({givenSize:hoe(e),maxSize:t})}const j$t=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function F$t(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=j$t[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(M$t(r,{size:t.size}),B$t(r,{dir:"right",size:t.size})):r}const z$t=new TextEncoder;function q$t(e,t={}){const n=z$t.encode(e);return F$t(n,t)}let W$t=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,n)),n}set(t,n){if(super.has(t)&&super.delete(t),super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=super.keys().next().value;r!==void 0&&super.delete(r)}return this}};const Mw=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n),OV=e=>e;let x8=class extends q0{constructor({body:t,cause:n,details:r,headers:s,status:i,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${OV(o)}`,t&&`Request body: ${Mw(t)}
166`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=s,this.status=i,this.url=o}},vve=class extends q0{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${OV(r)}`,`Request body: ${Mw(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}},foe=class extends q0{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${OV(n)}`,`Request body: ${Mw(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}};const H$t=-1;let Ic=class extends q0{constructor(t,{code:n,docsPath:r,metaMessages:s,name:i,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:s||(t==null?void 0:t.metaMessages),name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||t.name,this.code=t instanceof vve?t.code:n??H$t}},Sc=class extends Ic{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}},bF=class Eve extends Ic{constructor(t){super(t,{code:Eve.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}};Object.defineProperty(bF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let vF=class Cve extends Ic{constructor(t){super(t,{code:Cve.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}};Object.defineProperty(vF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let EF=class $ve extends Ic{constructor(t,{method:n}={}){super(t,{code:$ve.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}};Object.defineProperty(EF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let CF=class xve extends Ic{constructor(t){super(t,{code:xve.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` 167`)})}};Object.defineProperty(CF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let LA=class Ive extends Ic{constructor(t){super(t,{code:Ive.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}};Object.defineProperty(LA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let $F=class Sve extends Ic{constructor(t){super(t,{code:Sve.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` 168`)})}};Object.defineProperty($F,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let xF=class Ave extends Ic{constructor(t){super(t,{code:Ave.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(xF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let IF=class _ve extends Ic{constructor(t){super(t,{code:_ve.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}};Object.defineProperty(IF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let MA=class Nve extends Ic{constructor(t){super(t,{code:Nve.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}};Object.defineProperty(MA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let WE=class Tve extends Ic{constructor(t,{method:n}={}){super(t,{code:Tve.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}};Object.defineProperty(WE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let jA=class Pve extends Ic{constructor(t){super(t,{code:Pve.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}};Object.defineProperty(jA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let SF=class Ove extends Ic{constructor(t){super(t,{code:Ove.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}};Object.defineProperty(SF,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let I8=class kve extends Sc{constructor(t){super(t,{code:kve.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(I8,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let AF=class Rve extends Sc{constructor(t){super(t,{code:Rve.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}};Object.defineProperty(AF,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let _F=class Bve extends Sc{constructor(t,{method:n}={}){super(t,{code:Bve.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}};Object.defineProperty(_F,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let NF=class Dve extends Sc{constructor(t){super(t,{code:Dve.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}};Object.defineProperty(NF,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let TF=class Uve extends Sc{constructor(t){super(t,{code:Uve.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}};Object.defineProperty(TF,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});let PF=class Lve extends Sc{constructor(t){super(t,{code:Lve.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}};Object.defineProperty(PF,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let OF=class Mve extends Sc{constructor(t){super(t,{code:Mve.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}};Object.defineProperty(OF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});let kF=class jve extends Sc{constructor(t){super(t,{code:jve.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}};Object.defineProperty(kF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});let RF=class Fve extends Sc{constructor(t){super(t,{code:Fve.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}};Object.defineProperty(RF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});let BF=class zve extends Sc{constructor(t){super(t,{code:zve.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}};Object.defineProperty(BF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});let DF=class qve extends Sc{constructor(t){super(t,{code:qve.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}};Object.defineProperty(DF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});let UF=class Wve extends Sc{constructor(t){super(t,{code:Wve.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}};Object.defineProperty(UF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
168);let LF=class Hve extends Sc{constructor(t){super(t,{code:Hve.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}};Object.defineProperty(LF,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});let FA=class Vve extends Sc{constructor(t){super(t,{code:Vve.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}};Object.defineProperty(FA,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});let V$t=class extends Ic{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}},kV=class extends q0{constructor({cause:t,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(kV,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(kV,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});function K$t(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}const FB=new Map;function G$t({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:s}){const i=async()=>{const u=c();o();const d=u.map(({args:h})=>h);d.length!==0&&e(d).then(h=>{s&&Array.isArray(h)&&h.sort(s);for(let f=0;f<u.length;f++){const{resolve:g}=u[f];g==null||g([h[f],h])}}).catch(h=>{for(let f=0;f<u.length;f++){const{reject:g}=u[f];g==null||g(h)}})},o=()=>FB.delete(t),a=()=>c().map(({args:u})=>u),c=()=>FB.get(t)||[],l=u=>FB.set(t,[...c(),u]);return{flush:o,async schedule(u){const{promise:d,resolve:h,reject:f}=K$t();return(n==null?void 0:n([...a(),u]))&&i(),c().length>0?(l({args:u,resolve:h,reject:f}),d):(l({args:u,resolve:h,reject:f}),setTimeout(i,r),d)}}}async function Kve(e){return new Promise(t=>setTimeout(t,e))}function Z$t(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,i)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const u=typeof t=="function"?t({count:a,error:l}):t;u&&await Kve(u),o({count:a+1})};try{const l=await e();s(l)}catch(l){if(a<n&&await r({count:a,error:l}))return c({error:l});i(l)}};o()})}const MF=256;let UI=MF,LI;function Y$t(e=11){if(!LI||UI+e>MF*2){LI="",UI=0;for(let t=0;t<MF;t++)LI+=(256+Math.random()*256|0).toString(16).substring(1)}return LI.substring(UI,UI+++e)}const MI=new W$t(8192);function J$t(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(MI.get(n))return MI.get(n);const r=e().finally(()=>MI.delete(n));return MI.set(n,r),r}function X$t(e,t={}){return async(n,r={})=>{var d;const{dedupe:s=!1,methods:i,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...r},{method:l}=n;if((d=i==null?void 0:i.exclude)!=null&&d.includes(l))throw new WE(new Error("method not supported"),{method:l});if(i!=null&&i.include&&!i.include.includes(l))throw new WE(new Error("method not supported"),{method:l});const u=s?q$t(`${c}.${Mw(n)}`):void 0;return J$t(()=>Z$t(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case bF.code:throw new bF(f);case vF.code:throw new vF(f);case EF.code:throw new EF(f,{method:n.method});case CF.code:throw new CF(f);case LA.code:throw new LA(f);case $F.code:throw new $F(f);case xF.code:throw new xF(f);case IF.code:throw new IF(f);case MA.code:throw new MA(f);case WE.code:throw new WE(f,{method:n.method});case jA.code:throw new jA(f);case SF.code:throw new SF(f);case I8.code:throw new I8(f);case AF.code:throw new AF(f);case _F.code:throw new _F(f);case NF.code:throw new NF(f);case TF.code:throw new TF(f);case PF.code:throw new PF(f);case OF.code:throw new OF(f);case kF.code:throw new kF(f);case RF.code:throw new RF(f);case BF.code:throw new BF(f);case DF.code:throw new DF(f);case UF.code:throw new UF(f);case LF.code:throw new LF(f);case 5e3:throw new I8(f);case FA.code:throw new FA(f);default:throw h instanceof q0?h:new V$t(f)}}},{delay:({count:h,error:f})=>{var g;if(f&&f instanceof x8){const p=(g=f==null?void 0:f.headers)==null?void 0:g.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*o},retryCount:a,shouldRetry:({error:h})=>Q$t(h)}),{enabled:s,id:u})}}function Q$t(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===jA.code||e.code===LA.code:e instanceof x8&&e.status?e.status===403||e.status===408||e.status===4
16813||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function ext(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,i)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{r&&a.abort()},n)),s(await e({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&i(t),i(a)}finally{clearTimeout(o)}})()})}function txt(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const poe=txt();function nxt(e,t={}){const{url:n,headers:r}=rxt(e);return{async request(s){var g,p,m;const{body:i,fetchFn:o=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:c=t.onResponse,timeout:l=t.timeout??1e4}=s,u={...t.fetchOptions??{},...s.fetchOptions??{}},{headers:d,method:h,signal:f}=u;try{const w=await ext(async({signal:E})=>{const b={...u,body:Array.isArray(i)?Mw(i.map(A=>({jsonrpc:"2.0",id:A.id??poe.take(),...A}))):Mw({jsonrpc:"2.0",id:i.id??poe.take(),...i}),headers:{...r,"Content-Type":"application/json",...d},method:h||"POST",signal:f||(l>0?E:null)},S=new Request(n,b),v=await(a==null?void 0:a(S,b))??{...b,url:n};return await o(v.url??n,v)},{errorInstance:new foe({body:i,url:n}),timeout:l,signal:!0});c&&await c(w);let C;if((g=w.headers.get("Content-Type"))!=null&&g.startsWith("application/json"))C=await w.json();else{C=await w.text();try{C=JSON.parse(C||"{}")}catch(E){if(w.ok)throw E;C={error:C}}}if(!w.ok){if(typeof((p=C.error)==null?void 0:p.code)=="number"&&typeof((m=C.error)==null?void 0:m.message)=="string")return C;throw new x8({body:i,details:Mw(C.error)||w.statusText,headers:w.headers,status:w.status,url:n})}return C}catch(w){throw w instanceof x8||w instanceof foe?w:new x8({body:i,cause:w,url:n})}}}}function rxt(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}function Gve({key:e,methods:t,name:n,request:r,retryCount:s=3,retryDelay:i=150,timeout:o,type:a},c){const l=Y$t();return{config:{key:e,methods:t,name:n,request:r,retryCount:s,retryDelay:i,timeout:o,type:a},request:X$t(r,{methods:t,retryCount:s,retryDelay:i,uid:l}),value:c}}function goe(e,t={}){const{key:n="fallback",name:r="Fallback",rank:s=!1,shouldThrow:i=sxt,retryCount:o,retryDelay:a}=t;return(({chain:c,pollingInterval:l=4e3,timeout:u,...d})=>{let h=e,f=()=>{};const g=Gve({key:n,name:r,async request({method:p,params:m}){let w;const C=async(E=0)=>{const b=h[E]({...d,chain:c,retryCount:0,timeout:u});try{const S=await b.request({method:p,params:m});return f({method:p,params:m,response:S,transport:b,status:"success"}),S}catch(S){if(f({error:S,method:p,params:m,transport:b,status:"error"}),i(S)||E===h.length-1||(w??(w=h.slice(E+1).some(v=>{const{include:x,exclude:A}=v({chain:c}).config.methods||{};return x?x.includes(p):A?!A.includes(p):!0})),!w))throw S;return C(E+1)}};return C()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:p=>f=p,transports:h.map(p=>p({chain:c,retryCount:0}))});if(s){const p=typeof s=="object"?s:{};ixt({chain:c,interval:p.interval??l,onTransports:m=>h=m,ping:p.ping,sampleCount:p.sampleCount,timeout:p.timeout,transports:h,weights:p.weights})}return g})}function sxt(e){return!!("code"in e&&typeof e.code=="number"&&(e.code===MA.code||e.code===I8.code||e.code===FA.code||kV.nodeMessage.test(e.message)||e.code===5e3))}function ixt({chain:e,interval:t=4e3,onTransports:n,ping:r,sampleCount:s=10,timeout:i=1e3,transports:o,weights:a={}}){const{stability:c=.7,latency:l=.3}=a,u=[],d=async()=>{const h=await Promise.all(o.map(async p=>{const m=p({chain:e,retryCount:0,timeout:i}),w=Date.now();let C,E;try{await(r?r({transport:m}):m.request({method:"net_listening"})),E=1}catch{E=0}finally{C=Date.now()}return{latency:C-w,success:E}}));u.push(h),u.length>s&&u.shift();const f=Math.max(...u.map(p=>Math.max(...p.map(({latency:m})=>m)))),g=o.map((p,m)=>{const w=u.map(v=>v[m].latency),E=1-w.reduce((v,x)=>v+x,0)/w.length/f,b=u.map(v=>v[m].success),S=b.reduce((v,x)=>v+x,0)/b.length;return S===0?[0,m]:[l*E+c*S,m]}).sort((p,m)=>m[0]-p[0]);n(g.map(([,p])=>o[p])),await Kve(t),d()};d()}let oxt=class extends q0{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}};function jI(e,t={}){const{batch:n,fetchFn:r,fetchOptions:s,key:i="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:u,raw:d}=t;return({chain:h,retryCount:f,timeout:g})=>{const{batchSize:p=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??f,C=g??t.timeout??1e4,E=e||(h==null?void 0:h.rpcUrls.default.http[0]);if(!E)throw new oxt;const b=nxt(E,{fetchFn:r,fetchOptions:s,onRequest:c,onResponse:l,timeout:C});return Gve({key:i,methods:o,name:a,async request({method:S,params:v}){const x={method:S,params:v},{schedule:A}=G$t({id:E,wait:m,shouldSplitBatch(T){return T.length>p},fn:T=>b.request({body:T}),sort:(T,P)=>T.id-P.id}),I=async T=>n?A(T):[await b.request({body:T})],[{error:O,result:N}]=await I(x);if(d)return{error:O,result:N};if(O)throw new vve({body:x,error:O,url:E});return N},retryCount:w,retryDelay:u,timeout:C,type:"http"},{fetchOptions:s,url:E})}}const axt="rpc.walletconnect.org";function moe(e,t){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",e),n.searchParams.set("projectId",t),n.toString()}const zB=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:
16856","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],iv={extendRpcUrlWithProjectId(e,t){let n=!1;try{n=new URL(e).host===axt}catch{n=!1}if(n){const r=new URL(e);return r.searchParams.has("projectId")||r.searchParams.set("projectId",t),r.toString()}return e},isCaipNetwork(e){return"chainNamespace"in e&&"caipNetworkId"in e},getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:$t.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${$t.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,n){var s,i,o;const r=(o=(i=(s=e.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null?void 0:o[0];return zB.includes(t)?moe(t,n):r||""},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){var h,f,g,p,m;const s=this.getChainNamespace(e),i=this.getCaipNetworkId(e),o=(h=e.rpcUrls.default.http)==null?void 0:h[0],a=this.getDefaultRpcUrl(e,i,n),c=((p=(g=(f=e==null?void 0:e.rpcUrls)==null?void 0:f.chainDefault)==null?void 0:g.http)==null?void 0:p[0])||o,l=((m=r==null?void 0:r[i])==null?void 0:m.map(w=>w.url))||[],u=[...l,a],d=[...l];return c&&!d.includes(c)&&d.push(c),{...e,chainNamespace:s,caipNetworkId:i,assets:{imageId:BA.NetworkImageIds[e.id],imageUrl:t==null?void 0:t[e.id]},rpcUrls:{...e.rpcUrls,default:{http:u},chainDefault:{http:d}}}},extendCaipNetworks(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){return e.map(s=>iv.extendCaipNetwork(s,{customNetworkImageUrls:t,customRpcUrls:r,projectId:n}))},getViemTransport(e,t,n){var s,i,o;const r=[];return n==null||n.forEach(a=>{r.push(jI(a.url,a.config))}),zB.includes(e.caipNetworkId)&&r.push(jI(moe(e.caipNetworkId,t),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),(o=(i=(s=e==null?void 0:e.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null||o.forEach(a=>{r.push(jI(a))}),goe(r)},extendWagmiTransports(e,t,n){if(zB.includes(e.caipNetworkId)){const r=this.getDefaultRpcUrl(e,e.caipNetworkId,t);return goe([n,jI(r)])}return n},getUnsupportedNetwork(e){return{id:e.split(":")[1],caipNetworkId:e,name:$t.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(e){var c;const t=lt.getActiveCaipNetworkId(),n=J.getAllRequestedCaipNetworks(),r=Array.from(((c=J.state.chains)==null?void 0:c.keys())||[]),s=t==null?void 0:t.split(":")[0],i=s?r.includes(s):!1,o=n==null?void 0:n.find(l=>l.caipNetworkId===t);return i&&!o&&t?this.getUnsupportedNetwork(t):o||e||(n==null?void 0:n[0])}},zA={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0},Ra=Pr({providers:{...zA},providerIds:{...zA}}),rs={state:Ra,subscribeKey(e,t){return so(Ra,e,t)},subscribe(e){return Yi(Ra,()=>{e(Ra)})},subscribeProviders(e){return Yi(Ra.providers,()=>e(Ra.providers))},setProvider(e,t){t&&(Ra.providers[e]=oy(t))},getProvider(e){return Ra.providers[e]},setProviderId(e,t){t&&(Ra.providerIds[e]=t)},getProviderId(e){if(e)return Ra.providerIds[e]},reset(){Ra.providers={...zA},Ra.providerIds={...zA}},resetChain(e){Ra.providers[e]=void 0,Ra.providerIds[e]=void 0}},hm={VIEW_DIRECTION:{Next:"next",Prev:"prev"},DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"],ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150}},hy={filterOutDuplicatesByRDNS(e){const t=we.state.enableEIP6963?Pe.state.connectors:[],n=lt.getRecentWallets(),r=t.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),s=n.map(a=>a.rdns).filter(Boolean),i=r.concat(s);if(i.includes("io.metamask.mobile")&&Re.isMobile()){const a=i.indexOf("io.metamask.mobile");i[a]="io.metamask"}return e.filter(a=>!i.includes(String(a==null?void 0:a.rdns)))},filterOutDuplicatesByIds(e){const t=Pe.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"),n=lt.getRecentWallets(),r=t.map(a=>a.explorerId),s=n.map(a=>a.id),i=r.concat(s);return e.filter(a=>!i.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(e){const t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){const{connectors:t}=Pe.state,{featuredWalletIds:n}=we.state,r=t.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return e.map(o=>({...o,installed:!!o.rdns&&!!r[o.rdns??""]}
168)).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(n!=null&&n.length){const l=n.indexOf(o.id),u=n.indexOf(a.id);if(l!==-1&&u!==-1)return l-u;if(l!==-1)return-1;if(u!==-1)return 1}return 0})},getConnectOrderMethod(e,t){var c;const n=(e==null?void 0:e.connectMethodsOrder)||((c=we.state.features)==null?void 0:c.connectMethodsOrder),r=t||Pe.state.connectors;if(n)return n;const{injected:s,announced:i}=u0.getConnectorsByType(r,ze.state.recommended,ze.state.featured),o=s.filter(u0.showConnector),a=i.filter(u0.showConnector);return o.length||a.length?["wallet","email","social"]:hm.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(e){const t=!!e.rdns&&ze.state.excludedWallets.some(r=>r.rdns===e.rdns),n=!!e.name&&ze.state.excludedWallets.some(r=>TV.isLowerCaseMatch(r.name,e.name));return t||n}},u0={getConnectorsByType(e,t,n){const{customWallets:r}=we.state,s=lt.getRecentWallets(),i=hy.filterOutDuplicateWallets(t),o=hy.filterOutDuplicateWallets(n),a=e.filter(d=>d.type==="MULTI_CHAIN"),c=e.filter(d=>d.type==="ANNOUNCED"),l=e.filter(d=>d.type==="INJECTED"),u=e.filter(d=>d.type==="EXTERNAL");return{custom:r,recent:s,external:u,multiChain:a,announced:c,injected:l,recommended:i,featured:o}},showConnector(e){var s;const t=(s=e.info)==null?void 0:s.rdns,n=!!t&&ze.state.excludedWallets.some(i=>!!i.rdns&&i.rdns===t),r=!!e.name&&ze.state.excludedWallets.some(i=>TV.isLowerCaseMatch(i.name,e.name));return!(e.type==="INJECTED"&&(e.name==="Browser Wallet"&&(!Re.isMobile()||Re.isMobile()&&!t&&!He.checkInstalled())||n||r)||(e.type==="ANNOUNCED"||e.type==="EXTERNAL")&&(n||r))},getIsConnectedWithWC(){return Array.from(J.state.chains.values()).some(n=>Pe.getConnectorId(n.namespace)===$t.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:e,featured:t,custom:n,recent:r,announced:s,injected:i,multiChain:o,external:a,overriddenConnectors:c=(l=>(l=we.state.features)==null?void 0:l.connectorTypeOrder)()??[]}){const u=u0.getIsConnectedWithWC(),f=[{type:"walletConnect",isEnabled:we.state.enableWalletConnect&&!u},{type:"recent",isEnabled:r.length>0},{type:"injected",isEnabled:[...i,...s,...o].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:n&&n.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:e.length>0}].filter(w=>w.isEnabled),g=new Set(f.map(w=>w.type)),p=c.filter(w=>g.has(w)).map(w=>({type:w,isEnabled:!0})),m=f.filter(({type:w})=>!p.some(({type:E})=>E===w));return Array.from(new Set([...p,...m].map(({type:w})=>w)))}};let S8,Pm,Om;function cxt(e,t){S8=document.createElement("style"),Pm=document.createElement("style"),Om=document.createElement("style"),S8.textContent=Jv(e).core.cssText,Pm.textContent=Jv(e).dark.cssText,Om.textContent=Jv(e).light.cssText,document.head.appendChild(S8),document.head.appendChild(Pm),document.head.appendChild(Om),Zve(t)}function Zve(e){Pm&&Om&&(e==="light"?(Pm.removeAttribute("media"),Om.media="enabled"):(Om.removeAttribute("media"),Pm.media="enabled"))}function lxt(e){S8&&Pm&&Om&&(S8.textContent=Jv(e).core.cssText,Pm.textContent=Jv(e).dark.cssText,Om.textContent=Jv(e).light.cssText)}function Jv(e){return{core:Xe` 169 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); 170 @keyframes w3m-shake { 171 0% { 172 transform: scale(1) rotate(0deg); 173 } 174 20% { 175 transform: scale(1) rotate(-1deg); 176 } 177 40% { 178 transform: scale(1) rotate(1.5deg); 179 } 180 60% { 181 transform: scale(1) rotate(-1.5deg); 182 } 183 80% { 184 transform: scale(1) rotate(1deg); 185 } 186 100% { 187 transform: scale(1) rotate(0deg); 188 } 189 } 190 @keyframes w3m-iframe-fade-out { 191 0% { 192 opacity: 1; 193 } 194 100% { 195 opacity: 0; 196 } 197 } 198 @keyframes w3m-iframe-zoom-in { 199 0% { 200 transform: translateY(50px); 201 opacity: 0; 202 } 203 100% { 204 transform: translateY(0px); 205 opacity: 1; 206 } 207 } 208 @keyframes w3m-iframe-zoom-in-mobile { 209 0% { 210 transform: scale(0.95); 211 opacity: 0; 212 } 213 100% { 214 transform: scale(1); 215 opacity: 1; 216 } 217 } 218 :root { 219 --w3m-modal-width: 360px; 220 --w3m-color-mix-strength: ${Xr(e!=null&&e["--w3m-color-mix-strength"]?`${e["--w3m-color-mix-strength"]}%`:"0%")}; 221 --w3m-font-family: ${Xr((e==null?void 0:e["--w3m-font-family"])||"Inter, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;")}; 222 --w3m-font-size-master: ${Xr((e==null?void 0:e["--w3m-font-size-master"])||"10px")}; 223 --w3m-border-radius-master: ${Xr((e==null?void 0:e["--w3m-border-radius-master"])||"4px")}; 224 --w3m-z-index: ${Xr((e==null?void 0:e["--w3m-z-index"])||
vendor: 15,824 bytes, lines 224-650
224999)}; 225 226 --wui-font-family: var(--w3m-font-family); 227 228 --wui-font-size-mini: calc(var(--w3m-font-size-master) * 0.8); 229 --wui-font-size-micro: var(--w3m-font-size-master); 230 --wui-font-size-tiny: calc(var(--w3m-font-size-master) * 1.2); 231 --wui-font-size-small: calc(var(--w3m-font-size-master) * 1.4); 232 --wui-font-size-paragraph: calc(var(--w3m-font-size-master) * 1.6); 233 --wui-font-size-medium: calc(var(--w3m-font-size-master) * 1.8); 234 --wui-font-size-large: calc(var(--w3m-font-size-master) * 2); 235 --wui-font-size-title-6: calc(var(--w3m-font-size-master) * 2.2); 236 --wui-font-size-medium-title: calc(var(--w3m-font-size-master) * 2.4); 237 --wui-font-size-2xl: calc(var(--w3m-font-size-master) * 4); 238 239 --wui-border-radius-5xs: var(--w3m-border-radius-master); 240 --wui-border-radius-4xs: calc(var(--w3m-border-radius-master) * 1.5); 241 --wui-border-radius-3xs: calc(var(--w3m-border-radius-master) * 2); 242 --wui-border-radius-xxs: calc(var(--w3m-border-radius-master) * 3); 243 --wui-border-radius-xs: calc(var(--w3m-border-radius-master) * 4); 244 --wui-border-radius-s: calc(var(--w3m-border-radius-master) * 5); 245 --wui-border-radius-m: calc(var(--w3m-border-radius-master) * 7); 246 --wui-border-radius-l: calc(var(--w3m-border-radius-master) * 9); 247 --wui-border-radius-3xl: calc(var(--w3m-border-radius-master) * 20); 248 249 --wui-font-weight-light: 400; 250 --wui-font-weight-regular: 500; 251 --wui-font-weight-medium: 600; 252 --wui-font-weight-bold: 700; 253 254 --wui-letter-spacing-2xl: -1.6px; 255 --wui-letter-spacing-medium-title: -0.96px; 256 --wui-letter-spacing-title-6: -0.88px; 257 --wui-letter-spacing-large: -0.8px; 258 --wui-letter-spacing-medium: -0.72px; 259 --wui-letter-spacing-paragraph: -0.64px; 260 --wui-letter-spacing-small: -0.56px; 261 --wui-letter-spacing-tiny: -0.48px; 262 --wui-letter-spacing-micro: -0.2px; 263 --wui-letter-spacing-mini: -0.16px; 264 265 --wui-spacing-0: 0px; 266 --wui-spacing-4xs: 2px; 267 --wui-spacing-3xs: 4px; 268 --wui-spacing-xxs: 6px; 269 --wui-spacing-2xs: 7px; 270 --wui-spacing-xs: 8px; 271 --wui-spacing-1xs: 10px; 272 --wui-spacing-s: 12px; 273 --wui-spacing-m: 14px; 274 --wui-spacing-l: 16px; 275 --wui-spacing-2l: 18px; 276 --wui-spacing-xl: 20px; 277 --wui-spacing-xxl: 24px; 278 --wui-spacing-2xl: 32px; 279 --wui-spacing-3xl: 40px; 280 --wui-spacing-4xl: 90px; 281 --wui-spacing-5xl: 95px; 282 283 --wui-icon-box-size-xxs: 14px; 284 --wui-icon-box-size-xs: 20px; 285 --wui-icon-box-size-sm: 24px; 286 --wui-icon-box-size-md: 32px; 287 --wui-icon-box-size-mdl: 36px; 288 --wui-icon-box-size-lg: 40px; 289 --wui-icon-box-size-2lg: 48px; 290 --wui-icon-box-size-xl: 64px; 291 292 --wui-icon-size-inherit: inherit; 293 --wui-icon-size-xxs: 10px; 294 --wui-icon-size-xs: 12px; 295 --wui-icon-size-sm: 14px; 296 --wui-icon-size-md: 16px; 297 --wui-icon-size-mdl: 18px; 298 --wui-icon-size-lg: 20px; 299 --wui-icon-size-xl: 24px; 300 --wui-icon-size-xxl: 28px; 301 302 --wui-wallet-image-size-inherit: inherit; 303 --wui-wallet-image-size-sm: 40px; 304 --wui-wallet-image-size-md: 56px; 305 --wui-wallet-image-size-lg: 80px; 306 307 --wui-visual-size-size-inherit: inherit; 308 --wui-visual-size-sm: 40px; 309 --wui-visual-size-md: 55px; 310 --wui-visual-size-lg: 80px; 311 312 --wui-box-size-md: 100px; 313 --wui-box-size-lg: 120px; 314 315 --wui-ease-out-power-2: cubic-bezier(0, 0, 0.22, 1); 316 --wui-ease-out-power-1: cubic-bezier(0, 0, 0.55, 1); 317 318 --wui-ease-in-power-3: cubic-bezier(0.66, 0, 1, 1); 319 --wui-ease-in-power-2: cubic-bezier(0.45, 0, 1, 1); 320 --wui-ease-in-power-1: cubic-bezier(0.3, 0, 1, 1); 321 322 --wui-ease-inout-power-1: cubic-bezier(0.45, 0, 0.55, 1); 323 324 --wui-duration-lg: 200ms; 325 --wui-duration-md: 125ms; 326 --wui-duration-sm: 75ms; 327 328 --wui-path-network-sm: path( 329 'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z' 330 ); 331 332 --wui-path-network-md: path( 333 'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z' 334 ); 335 336 --wui-path-network-lg: path( 337 'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z' 338 ); 339 340 --wui-width-network-sm: 36px; 341 --wui-width-network-md: 48px; 342 --wui-width-network-lg: 86px; 343 344 --wui-height-network-sm: 40px; 345 --wui-height-network-md: 54px; 346 --wui-height-network-lg: 96px; 347 348 --wui-icon-size-network-xs: 12px; 349 --wui-icon-size-network-sm: 16px; 350 --wui-icon-size-network-md: 24px; 351 --wui-icon-size-network-lg: 42px; 352 353 --wui-color-inherit: inherit; 354 355 --wui-color-inverse-100: #fff; 356 --wui-color-inverse-000: #000; 357 358 --wui-cover: rgba(20, 20, 20, 0.8); 359 360 --wui-color-modal-bg: var(--wui-color-modal-bg-base); 361 362 --wui-color-accent-100: var(--wui-color-accent-base-100); 363 --wui-color-accent-090: var(--wui-color-accent-base-090); 364 --wui-color-accent-080: var(--wui-color-accent-base-080); 365 366 --wui-color-success-100: var(--wui-color-success-base-100); 367 --wui-color-success-125: var(--wui-color-success-base-125); 368 369 --wui-color-warning-100: var(--wui-color-warning-base-100); 370 371 --wui-color-error-100: var(--wui-color-error-base-100); 372 --wui-color-error-125: var(--wui-color-error-base-125); 373 374 --wui-color-blue-100: var(--wui-color-blue-base-100); 375 --wui-color-blue-90: var(--wui-color-blue-base-90); 376 377 --wui-icon-box-bg-error-100: var(--wui-icon-box-bg-error-base-100); 378 --wui-icon-box-bg-blue-100: var(--wui-icon-box-bg-blue-base-100); 379 --wui-icon-box-bg-success-100: var(--wui-icon-box-bg-success-base-100); 380 --wui-icon-box-bg-inverse-100: var(--wui-icon-box-bg-inverse-base-100); 381 382 --wui-all-wallets-bg-100: var(--wui-all-wallets-bg-100); 383 384 --wui-avatar-border: var(--wui-avatar-border-base); 385 386 --wui-thumbnail-border: var(--wui-thumbnail-border-base); 387 388 --wui-wallet-button-bg: var(--wui-wallet-button-bg-base); 389 390 --wui-box-shadow-blue: var(--wui-color-accent-glass-020); 391 } 392 393 @supports (background: color-mix(in srgb, white 50%, black)) { 394 :root { 395 --wui-color-modal-bg: color-mix( 396 in srgb, 397 var(--w3m-color-mix) var(--w3m-color-mix-strength), 398 var(--wui-color-modal-bg-base) 399 ); 400 401 --wui-box-shadow-blue: color-mix(in srgb, var(--wui-color-accent-100) 20%, transparent); 402 403 --wui-color-accent-100: color-mix( 404 in srgb, 405 var(--wui-color-accent-base-100) 100%, 406 transparent 407 ); 408 --wui-color-accent-090: color-mix( 409 in srgb, 410 var(--wui-color-accent-base-100) 90%, 411 transparent 412 ); 413 --wui-color-accent-080: color-mix( 414 in srgb, 415 var(--wui-color-accent-base-100) 80%, 416 transparent 417 ); 418 --wui-color-accent-glass-090: color-mix( 419 in srgb, 420 var(--wui-color-accent-base-100) 90%, 421 transparent 422 ); 423 --wui-color-accent-glass-080: color-mix( 424 in srgb, 425 var(--wui-color-accent-base-100) 80%, 426 transparent 427 ); 428 --wui-color-accent-glass-020: color-mix( 429 in srgb, 430 var(--wui-color-accent-base-100) 20%, 431 transparent 432 ); 433 --wui-color-accent-glass-015: color-mix( 434 in srgb, 435 var(--wui-color-accent-base-100) 15%, 436 transparent 437 ); 438 --wui-color-accent-glass-010: color-mix( 439 in srgb, 440 var(--wui-color-accent-base-100) 10%, 441 transparent 442 ); 443 --wui-color-accent-glass-005: color-mix( 444 in srgb, 445 var(--wui-color-accent-base-100) 5%, 446 transparent 447 ); 448 --wui-color-accent-002: color-mix( 449 in srgb, 450 var(--wui-color-accent-base-100) 2%, 451 transparent 452 ); 453 454 --wui-color-fg-100: color-mix( 455 in srgb, 456 var(--w3m-color-mix) var(--w3m-color-mix-strength), 457 var(--wui-color-fg-100) 458 ); 459 --wui-color-fg-125: color-mix( 460 in srgb, 461 var(--w3m-color-mix) var(--w3m-color-mix-strength), 462 var(--wui-color-fg-125) 463 ); 464 --wui-color-fg-150: color-mix( 465 in srgb, 466 var(--w3m-color-mix) var(--w3m-color-mix-strength), 467 var(--wui-color-fg-150) 468 ); 469 --wui-color-fg-175: color-mix( 470 in srgb, 471 var(--w3m-color-mix) var(--w3m-color-mix-strength), 472 var(--wui-color-fg-175) 473 ); 474 --wui-color-fg-200: color-mix( 475 in srgb, 476 var(--w3m-color-mix) var(--w3m-color-mix-strength), 477 var(--wui-color-fg-200) 478 ); 479 --wui-color-fg-225: color-mix( 480 in srgb, 481 var(--w3m-color-mix) var(--w3m-color-mix-strength), 482 var(--wui-color-fg-225) 483 ); 484 --wui-color-fg-250: color-mix( 485 in srgb, 486 var(--w3m-color-mix) var(--w3m-color-mix-strength), 487 var(--wui-color-fg-250) 488 ); 489 --wui-color-fg-275: color-mix( 490 in srgb, 491 var(--w3m-color-mix) var(--w3m-color-mix-strength), 492 var(--wui-color-fg-275) 493 ); 494 --wui-color-fg-300: color-mix( 495 in srgb, 496 var(--w3m-color-mix) var(--w3m-color-mix-strength), 497 var(--wui-color-fg-300) 498 ); 499 --wui-color-fg-325: color-mix( 500 in srgb, 501 var(--w3m-color-mix) var(--w3m-color-mix-strength), 502 var(--wui-color-fg-325) 503 ); 504 --wui-color-fg-350: color-mix( 505 in srgb, 506 var(--w3m-color-mix) var(--w3m-color-mix-strength), 507 var(--wui-color-fg-350) 508 ); 509 510 --wui-color-bg-100: color-mix( 511 in srgb, 512 var(--w3m-color-mix) var(--w3m-color-mix-strength), 513 var(--wui-color-bg-100) 514 ); 515 --wui-color-bg-125: color-mix( 516 in srgb, 517 var(--w3m-color-mix) var(--w3m-color-mix-strength), 518 var(--wui-color-bg-125) 519 ); 520 --wui-color-bg-150: color-mix( 521 in srgb, 522 var(--w3m-color-mix) var(--w3m-color-mix-strength), 523 var(--wui-color-bg-150) 524 ); 525 --wui-color-bg-175: color-mix( 526 in srgb, 527 var(--w3m-color-mix) var(--w3m-color-mix-strength), 528 var(--wui-color-bg-175) 529 ); 530 --wui-color-bg-200: color-mix( 531 in srgb, 532 var(--w3m-color-mix) var(--w3m-color-mix-strength), 533 var(--wui-color-bg-200) 534 ); 535 --wui-color-bg-225: color-mix( 536 in srgb, 537 var(--w3m-color-mix) var(--w3m-color-mix-strength), 538 var(--wui-color-bg-225) 539 ); 540 --wui-color-bg-250: color-mix( 541 in srgb, 542 var(--w3m-color-mix) var(--w3m-color-mix-strength), 543 var(--wui-color-bg-250) 544 ); 545 --wui-color-bg-275: color-mix( 546 in srgb, 547 var(--w3m-color-mix) var(--w3m-color-mix-strength), 548 var(--wui-color-bg-275) 549 ); 550 --wui-color-bg-300: color-mix( 551 in srgb, 552 var(--w3m-color-mix) var(--w3m-color-mix-strength), 553 var(--wui-color-bg-300) 554 ); 555 --wui-color-bg-325: color-mix( 556 in srgb, 557 var(--w3m-color-mix) var(--w3m-color-mix-strength), 558 var(--wui-color-bg-325) 559 ); 560 --wui-color-bg-350: color-mix( 561 in srgb, 562 var(--w3m-color-mix) var(--w3m-color-mix-strength), 563 var(--wui-color-bg-350) 564 ); 565 566 --wui-color-success-100: color-mix( 567 in srgb, 568 var(--w3m-color-mix) var(--w3m-color-mix-strength), 569 var(--wui-color-success-base-100) 570 ); 571 --wui-color-success-125: color-mix( 572 in srgb, 573 var(--w3m-color-mix) var(--w3m-color-mix-strength), 574 var(--wui-color-success-base-125) 575 ); 576 577 --wui-color-warning-100: color-mix( 578 in srgb, 579 var(--w3m-color-mix) var(--w3m-color-mix-strength), 580 var(--wui-color-warning-base-100) 581 ); 582 583 --wui-color-error-100: color-mix( 584 in srgb, 585 var(--w3m-color-mix) var(--w3m-color-mix-strength), 586 var(--wui-color-error-base-100) 587 ); 588 --wui-color-blue-100: color-mix( 589 in srgb, 590 var(--w3m-color-mix) var(--w3m-color-mix-strength), 591 var(--wui-color-blue-base-100) 592 ); 593 --wui-color-blue-90: color-mix( 594 in srgb, 595 var(--w3m-color-mix) var(--w3m-color-mix-strength), 596 var(--wui-color-blue-base-90) 597 ); 598 --wui-color-error-125: color-mix( 599 in srgb, 600 var(--w3m-color-mix) var(--w3m-color-mix-strength), 601 var(--wui-color-error-base-125) 602 ); 603 604 --wui-icon-box-bg-error-100: color-mix( 605 in srgb, 606 var(--w3m-color-mix) var(--w3m-color-mix-strength), 607 var(--wui-icon-box-bg-error-base-100) 608 ); 609 --wui-icon-box-bg-accent-100: color-mix( 610 in srgb, 611 var(--w3m-color-mix) var(--w3m-color-mix-strength), 612 var(--wui-icon-box-bg-blue-base-100) 613 ); 614 --wui-icon-box-bg-success-100: color-mix( 615 in srgb, 616 var(--w3m-color-mix) var(--w3m-color-mix-strength), 617 var(--wui-icon-box-bg-success-base-100) 618 ); 619 --wui-icon-box-bg-inverse-100: color-mix( 620 in srgb, 621 var(--w3m-color-mix) var(--w3m-color-mix-strength), 622 var(--wui-icon-box-bg-inverse-base-100) 623 ); 624 625 --wui-all-wallets-bg-100: color-mix( 626 in srgb, 627 var(--w3m-color-mix) var(--w3m-color-mix-strength), 628 var(--wui-all-wallets-bg-100) 629 ); 630 631 --wui-avatar-border: color-mix( 632 in srgb, 633 var(--w3m-color-mix) var(--w3m-color-mix-strength), 634 var(--wui-avatar-border-base) 635 ); 636 637 --wui-thumbnail-border: color-mix( 638 in srgb, 639 var(--w3m-color-mix) var(--w3m-color-mix-strength), 640 var(--wui-thumbnail-border-base) 641 ); 642 643 --wui-wallet-button-bg: color-mix( 644 in srgb, 645 var(--w3m-color-mix) var(--w3m-color-mix-strength), 646 var(--wui-wallet-button-bg-base) 647 ); 648 } 649 } 650 `,
650light:Xe` 651 :root { 652 --w3m-color-mix: ${Xr((e==null?void 0:e["--w3m-color-mix"])||"#fff")}; 653 --w3m-accent: ${Xr(um(e,"dark")["--w3m-accent"])}; 654 --w3m-default: #fff; 655 656 --wui-color-modal-bg-base: ${Xr(um(e,"dark")["--w3m-background"])}; 657 --wui-color-accent-base-100: var(--w3m-accent); 658 659 --wui-color-blueberry-100: hsla(230, 100%, 67%, 1); 660 --wui-color-blueberry-090: hsla(231, 76%, 61%, 1); 661 --wui-color-blueberry-080: hsla(230, 59%, 55%, 1); 662 --wui-color-blueberry-050: hsla(231, 100%, 70%, 0.1); 663 664 --wui-color-fg-100: #e4e7e7; 665 --wui-color-fg-125: #d0d5d5; 666 --wui-color-fg-150: #a8b1b1; 667 --wui-color-fg-175: #a8b0b0; 668 --wui-color-fg-200: #949e9e; 669 --wui-color-fg-225: #868f8f; 670 --wui-color-fg-250: #788080; 671 --wui-color-fg-275: #788181; 672 --wui-color-fg-300: #6e7777; 673 --wui-color-fg-325: #9a9a9a; 674 --wui-color-fg-350: #363636; 675 676 --wui-color-bg-100: #141414; 677 --wui-color-bg-125: #191a1a; 678 --wui-color-bg-150: #1e1f1f; 679 --wui-color-bg-175: #222525; 680 --wui-color-bg-200: #272a2a; 681 --wui-color-bg-225: #2c3030; 682 --wui-color-bg-250: #313535; 683 --wui-color-bg-275: #363b3b; 684 --wui-color-bg-300: #3b4040; 685 --wui-color-bg-325: #252525; 686 --wui-color-bg-350: #ffffff; 687 688 --wui-color-success-base-100: #26d962; 689 --wui-color-success-base-125: #30a46b; 690 691 --wui-color-warning-base-100: #f3a13f; 692 693 --wui-color-error-base-100: #f25a67; 694 --wui-color-error-base-125: #df4a34; 695 696 --wui-color-blue-base-100: rgba(102, 125, 255, 1); 697 --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); 698 699 --wui-color-success-glass-001: rgba(38, 217, 98, 0.01); 700 --wui-color-success-glass-002: rgba(38, 217, 98, 0.02); 701 --wui-color-success-glass-005: rgba(38, 217, 98, 0.05); 702 --wui-color-success-glass-010: rgba(38, 217, 98, 0.1); 703 --wui-color-success-glass-015: rgba(38, 217, 98, 0.15); 704 --wui-color-success-glass-020: rgba(38, 217, 98, 0.2); 705 --wui-color-success-glass-025: rgba(38, 217, 98, 0.25); 706 --wui-color-success-glass-030: rgba(38, 217, 98, 0.3); 707 --wui-color-success-glass-060: rgba(38, 217, 98, 0.6); 708 --wui-color-success-glass-080: rgba(38, 217, 98, 0.8); 709 710 --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); 711 712 --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); 713 714 --wui-color-error-glass-001: rgba(242, 90, 103, 0.01); 715 --wui-color-error-glass-002: rgba(242, 90, 103, 0.02); 716 --wui-color-error-glass-005: rgba(242, 90, 103, 0.05); 717 --wui-color-error-glass-010: rgba(242, 90, 103, 0.1); 718 --wui-color-error-glass-015: rgba(242, 90, 103, 0.15); 719 --wui-color-error-glass-020: rgba(242, 90, 103, 0.2); 720 --wui-color-error-glass-025: rgba(242, 90, 103, 0.25); 721 --wui-color-error-glass-030: rgba(242, 90, 103, 0.3); 722 --wui-color-error-glass-060: rgba(242, 90, 103, 0.6); 723 --wui-color-error-glass-080: rgba(242, 90, 103, 0.8); 724 725 --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); 726 727 --wui-color-gray-glass-001: rgba(255, 255, 255, 0.01); 728 --wui-color-gray-glass-002: rgba(255, 255, 255, 0.02); 729 --wui-color-gray-glass-005: rgba(255, 255, 255, 0.05); 730 --wui-color-gray-glass-010: rgba(255, 255, 255, 0.1); 731 --wui-color-gray-glass-015: rgba(255, 255, 255, 0.15); 732 --wui-color-gray-glass-020: rgba(255, 255, 255, 0.2); 733 --wui-color-gray-glass-025: rgba(255, 255, 255, 0.25); 734 --wui-color-gray-glass-030: rgba(255, 255, 255, 0.3); 735 --wui-color-gray-glass-060: rgba(255, 255, 255, 0.6); 736 --wui-color-gray-glass-080: rgba(255, 255, 255, 0.8); 737 --wui-color-gray-glass-090: rgba(255, 255, 255, 0.9); 738 739 --wui-color-dark-glass-100: rgba(42, 42, 42, 1); 740 741 --wui-icon-box-bg-error-base-100: #3c2426; 742 --wui-icon-box-bg-blue-base-100: #20303f; 743 --wui-icon-box-bg-success-base-100: #1f3a28; 744 --wui-icon-box-bg-inverse-base-100: #243240; 745 746 --wui-all-wallets-bg-100: #222b35; 747 748 --wui-avatar-border-base: #252525; 749
750 --wui-thumbnail-border-base: #252525; 751 752 --wui-wallet-button-bg-base: var(--wui-color-bg-125); 753 754 --w3m-card-embedded-shadow-color: rgb(17 17 18 / 25%); 755 } 756 `,dark:Xe` 757 :root { 758 --w3m-color-mix: ${Xr((e==null?void 0:e["--w3m-color-mix"])||"#000")}; 759 --w3m-accent: ${Xr(um(e,"light")["--w3m-accent"])}; 760 --w3m-default: #000; 761 762 --wui-color-modal-bg-base: ${Xr(um(e,"light")["--w3m-background"])}; 763 --wui-color-accent-base-100: var(--w3m-accent); 764 765 --wui-color-blueberry-100: hsla(231, 100%, 70%, 1); 766 --wui-color-blueberry-090: hsla(231, 97%, 72%, 1); 767 --wui-color-blueberry-080: hsla(231, 92%, 74%, 1); 768 769 --wui-color-fg-100: #141414; 770 --wui-color-fg-125: #2d3131; 771 --wui-color-fg-150: #474d4d; 772 --wui-color-fg-175: #636d6d; 773 --wui-color-fg-200: #798686; 774 --wui-color-fg-225: #828f8f; 775 --wui-color-fg-250: #8b9797; 776 --wui-color-fg-275: #95a0a0; 777 --wui-color-fg-300: #9ea9a9; 778 --wui-color-fg-325: #9a9a9a; 779 --wui-color-fg-350: #d0d0d0; 780 781 --wui-color-bg-100: #ffffff; 782 --wui-color-bg-125: #f5fafa; 783 --wui-color-bg-150: #f3f8f8; 784 --wui-color-bg-175: #eef4f4; 785 --wui-color-bg-200: #eaf1f1; 786 --wui-color-bg-225: #e5eded; 787 --wui-color-bg-250: #e1e9e9; 788 --wui-color-bg-275: #dce7e7; 789 --wui-color-bg-300: #d8e3e3; 790 --wui-color-bg-325: #f3f3f3; 791 --wui-color-bg-350: #202020; 792 793 --wui-color-success-base-100: #26b562; 794 --wui-color-success-base-125: #30a46b; 795 796 --wui-color-warning-base-100: #f3a13f; 797 798 --wui-color-error-base-100: #f05142; 799 --wui-color-error-base-125: #df4a34; 800 801 --wui-color-blue-base-100: rgba(102, 125, 255, 1); 802 --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); 803 804 --wui-color-success-glass-001: rgba(38, 181, 98, 0.01); 805 --wui-color-success-glass-002: rgba(38, 181, 98, 0.02); 806 --wui-color-success-glass-005: rgba(38, 181, 98, 0.05); 807 --wui-color-success-glass-010: rgba(38, 181, 98, 0.1); 808 --wui-color-success-glass-015: rgba(38, 181, 98, 0.15); 809 --wui-color-success-glass-020: rgba(38, 181, 98, 0.2); 810 --wui-color-success-glass-025: rgba(38, 181, 98, 0.25); 811 --wui-color-success-glass-030: rgba(38, 181, 98, 0.3); 812 --wui-color-success-glass-060: rgba(38, 181, 98, 0.6); 813 --wui-color-success-glass-080: rgba(38, 181, 98, 0.8); 814 815 --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); 816 817 --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); 818 819 --wui-color-error-glass-001: rgba(240, 81, 66, 0.01); 820 --wui-color-error-glass-002: rgba(240, 81, 66, 0.02); 821 --wui-color-error-glass-005: rgba(240, 81, 66, 0.05); 822 --wui-color-error-glass-010: rgba(240, 81, 66, 0.1); 823 --wui-color-error-glass-015: rgba(240, 81, 66, 0.15); 824 --wui-color-error-glass-020: rgba(240, 81, 66, 0.2); 825 --wui-color-error-glass-025: rgba(240, 81, 66, 0.25); 826 --wui-color-error-glass-030: rgba(240, 81, 66, 0.3); 827 --wui-color-error-glass-060: rgba(240, 81, 66, 0.6); 828 --wui-color-error-glass-080: rgba(240, 81, 66, 0.8); 829 830 --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); 831 832 --wui-icon-box-bg-error-base-100: #f4dfdd; 833 --wui-icon-box-bg-blue-base-100: #d9ecfb; 834 --wui-icon-box-bg-success-base-100: #daf0e4; 835 --wui-icon-box-bg-inverse-base-100: #dcecfc; 836 837 --wui-all-wallets-bg-100: #e8f1fa; 838 839 --wui-avatar-border-base: #f3f4f4; 840 841 --wui-thumbnail-border-base: #eaefef; 842 843 --wui-wallet-button-bg-base: var(--wui-color-bg-125); 844 845 --wui-color-gray-glass-001: rgba(0, 0, 0, 0.01); 846 --wui-color-gray-glass-002: rgba(0, 0, 0, 0.02); 847 --wui-color-gray-glass-005: rgba(0, 0, 0, 0.05); 848 --wui-color-gray-glass-010: rgba(0, 0, 0, 0.1); 849 --wui-color-gray-glass-015: rgba(0, 0, 0, 0.15); 850 --wui-color-gray-glass-020: rgba(0, 0, 0, 0.2); 851 --wui-color-gray-glass-025: rgba(0, 0, 0, 0.25); 852 --wui-color-gray-glass-030: rgba(0, 0, 0, 0.3); 853 --wui-color-gray-glass-060: rgba(0, 0, 0, 0.6); 854 --wui-color-gray-glass-080: rgba(0, 0, 0, 0.8); 855 --wui-color-gray-glass-090: rgba(0, 0, 0, 0.9); 856 857 --wui-color-dark-glass-100: rgba(233, 233, 233, 1); 858 859 --w3m-card-embedded-shadow-color: rgb(224 225 233 / 25%); 860 } 861 `}}const Qn=Xe` 862 *, 863 *::after, 864 *::before, 865 :host { 866 margin: 0; 867 padding: 0; 868 box-sizing: border-box; 869 font-style: normal; 870 text-rendering: optimizeSpeed; 871 -webkit-font-smoothing: antialiased; 872 -moz-osx-font-smoothing: grayscale; 873 -webkit-tap-highlight-color: transparent; 874 font-family: var(--wui-font-family); 875 backface-visibility: hidden; 876 } 877`,oo=Xe` 878 button, 879 a { 880 cursor: pointer; 881 display: flex; 882 justify-content: center;
883 align-items: center; 884 position: relative; 885 transition: 886 color var(--wui-duration-lg) var(--wui-ease-out-power-1), 887 background-color var(--wui-duration-lg) var(--wui-ease-out-power-1), 888 border var(--wui-duration-lg) var(--wui-ease-out-power-1), 889 border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), 890 box-shadow var(--wui-duration-lg) var(--wui-ease-out-power-1); 891 will-change: background-color, color, border, box-shadow, border-radius; 892 outline: none; 893 border: none; 894 column-gap: var(--wui-spacing-3xs); 895 background-color: transparent; 896 text-decoration: none; 897 } 898 899 wui-flex { 900 transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1); 901 will-change: border-radius; 902 } 903 904 button:disabled > wui-wallet-image, 905 button:disabled > wui-all-wallets-image, 906 button:disabled > wui-network-image, 907 button:disabled > wui-image, 908 button:disabled > wui-transaction-visual, 909 button:disabled > wui-logo { 910 filter: grayscale(1); 911 } 912 913 @media (hover: hover) and (pointer: fine) { 914 button:hover:enabled { 915 background-color: var(--wui-color-gray-glass-005); 916 } 917 918 button:active:enabled { 919 background-color: var(--wui-color-gray-glass-010); 920 } 921 } 922 923 button:disabled > wui-icon-box { 924 opacity: 0.5; 925 } 926 927 input { 928 border: none; 929 outline: none; 930 appearance: none; 931 } 932`,E$=Xe` 933 .wui-color-inherit { 934 color: var(--wui-color-inherit); 935 } 936 937 .wui-color-accent-100 { 938 color: var(--wui-color-accent-100); 939 } 940 941 .wui-color-error-100 { 942 color: var(--wui-color-error-100); 943 } 944 945 .wui-color-blue-100 { 946 color: var(--wui-color-blue-100); 947 } 948 949 .wui-color-blue-90 { 950 color: var(--wui-color-blue-90); 951 } 952 953 .wui-color-error-125 { 954 color: var(--wui-color-error-125); 955 } 956 957 .wui-color-success-100 { 958 color: var(--wui-color-success-100); 959 } 960 961 .wui-color-success-125 { 962 color: var(--wui-color-success-125); 963 } 964 965 .wui-color-inverse-100 { 966 color: var(--wui-color-inverse-100); 967 } 968 969 .wui-color-inverse-000 { 970 color: var(--wui-color-inverse-000); 971 } 972 973 .wui-color-fg-100 { 974 color: var(--wui-color-fg-100); 975 } 976 977 .wui-color-fg-200 { 978 color: var(--wui-color-fg-200); 979 } 980 981 .wui-color-fg-300 { 982 color: var(--wui-color-fg-300); 983 } 984 985 .wui-color-fg-325 { 986 color: var(--wui-color-fg-325); 987 } 988 989 .wui-color-fg-350 { 990 color: var(--wui-color-fg-350); 991 } 992 993 .wui-bg-color-inherit { 994 background-color: var(--wui-color-inherit); 995 } 996 997 .wui-bg-color-blue-100 { 998 background-color: var(--wui-color-accent-100); 999 } 1000 1001 .wui-bg-color-error-100 { 1002 background-color: var(--wui-color-error-100); 1003 } 1004 1005 .wui-bg-color-error-125 { 1006 background-color: var(--wui-color-error-125); 1007 } 1008 1009 .wui-bg-color-success-100 { 1010 background-color: var(--wui-color-success-100); 1011 } 1012 1013 .wui-bg-color-success-125 { 1014 background-color: var(--wui-color-success-100); 1015 } 1016 1017 .wui-bg-color-inverse-100 { 1018 background-color: var(--wui-color-inverse-100); 1019 } 1020 1021 .wui-bg-color-inverse-000 { 1022 background-color: var(--wui-color-inverse-000); 1023 } 1024 1025 .wui-bg-color-fg-100 { 1026 background-color: var(--wui-color-fg-100); 1027 } 1028 1029 .wui-bg-color-fg-200 { 1030 background-color: var(--wui-color-fg-200); 1031 } 1032 1033 .wui-bg-color-fg-300 { 1034 background-color: var(--wui-color-fg-300); 1035 } 1036 1037 .wui-color-fg-325 { 1038 background-color: var(--wui-color-fg-325); 1039 } 1040 1041 .wui-color-fg-350 { 1042 background-color: var(--wui-color-fg-350); 1043 } 1044`,yi={getSpacingStyles(e,t){if(Array.isArray(e))return e[t]?`var(--wui-spacing-${e[t]})`:void 0;if(typeof e=="string")return`var(--wui-spacing-${e})`},getFormattedDate(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e)},getHostName(e){try{return new URL(e).hostname}catch{return""}},getTruncateString({string:e,charsStart:t,charsEnd:n,truncate:r}){return e.length<=t+n?e:r==="end"?`${e.substring(0,t)}...`:r==="start"?`...${e.substring(e.length-n)}`:`${e.substring(0,Math.floor(t))}...${e.substring(e.length-Math.floor(n))}`},generateAvatarColors(e){const n=e.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),r=this.hexToRgb(n),s=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),o=100-3*Number(s==null?void 0:s.replace("px","")),a=`${o}% ${o}% at 65% 40%`,c=[];for(let l=0;l<5;l+=1){const u=this.tintColor(r,.15*l);c.push(`rgb(${u[0]}, ${u[1]}, ${u[2]})`)}return` 1045 --local-color-1: ${c[0]};
1046 --local-color-2: ${c[1]}; 1047 --local-color-3: ${c[2]}; 1048 --local-color-4: ${c[3]}; 1049 --local-color-5: ${c[4]}; 1050 --local-radial-circle: ${a} 1051 `},hexToRgb(e){const t=parseInt(e,16),n=t>>16&255,r=t>>8&255,s=t&255;return[n,r,s]},tintColor(e,t){const[n,r,s]=e,i=Math.round(n+(255-n)*t),o=Math.round(r+(255-r)*t),a=Math.round(s+(255-s)*t);return[i,o,a]},isNumber(e){return{number:/^[0-9]+$/u}.number.test(e)},getColorTheme(e){var t;return e||(typeof window<"u"&&window.matchMedia?(t=window.matchMedia("(prefers-color-scheme: dark)"))!=null&&t.matches?"dark":"light":"dark")},splitBalance(e){const t=e.split(".");return t.length===2?[t[0],t[1]]:["0","00"]},roundNumber(e,t,n){return e.toString().length>=t?Number(e).toFixed(n):e},formatNumberToLocalString(e,t=2){return e===void 0?"0.00":typeof e=="number"?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})}};function uxt(e,t){const{kind:n,elements:r}=t;return{kind:n,elements:r,finisher(s){customElements.get(e)||customElements.define(e,s)}}}function dxt(e,t){return customElements.get(e)||customElements.define(e,t),t}function ct(e){return function(n){return typeof n=="function"?dxt(e,n):uxt(e,n)}}function hxt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function woe(e){return hxt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Yve="2.47.6";let pE={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Yve}`},RV=class jF extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof jF?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof jF&&n.cause.docsPath||n.docsPath,i=(a=pE.getDocsUrl)==null?void 0:a.call(pE,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...pE.version?[`Version: ${pE.version}`]:[]].join(` 1052`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Yve}walk(t){return Jve(this,t)}};function Jve(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Jve(e.cause,t):t?null:e}let Xve=class extends RV{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};function BV(e,{dir:t,size:n=32}={}){return typeof e=="string"?fxt(e,{dir:t,size:n}):pxt(e,{dir:t,size:n})}function fxt(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Xve({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function pxt(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Xve({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let gxt=class extends RV{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},mxt=class extends RV{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Qve(e,{size:t}){if(woe(e)>t)throw new mxt({givenSize:woe(e),maxSize:t})}const wxt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function yoe(e,t={}){return typeof e=="number"||typeof e=="bigint"?bxt(e,t):typeof e=="string"?Ext(e,t):typeof e=="boolean"?yxt(e,t):e5e(e,t)}function yxt(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Qve(n,{size:t.size}),BV(n,{size:t.size})):n}function e5e(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=wxt[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(Qve(r,{size:t.size}),BV(r,{dir:"right",size:t.size})):r}function bxt(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new gxt({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?BV(a,{size:r}):a}const vxt=new TextEncoder;function Ext(e,t={}){const n=vxt.encode(e);return e5e(n,t)}const HE={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"]};function C$(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const boe=C$({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"}
1052),voe=C$({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"});C$({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"});C$({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}});C$({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});const Cxt={solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"]},DS={getMethodsByChainNamespace(e){return Cxt[e]||[]},createDefaultNamespace(e){return{methods:this.getMethodsByChainNamespace(e),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(e,t){if(!t)return{...e};const n={...e},r=new Set;if(t.methods&&Object.keys(t.methods).forEach(s=>r.add(s)),t.chains&&Object.keys(t.chains).forEach(s=>r.add(s)),t.events&&Object.keys(t.events).forEach(s=>r.add(s)),t.rpcMap&&Object.keys(t.rpcMap).forEach(s=>{const[i]=s.split(":");i&&r.add(i)}),r.forEach(s=>{n[s]||(n[s]=this.createDefaultNamespace(s))}),t.methods&&Object.entries(t.methods).forEach(([s,i])=>{n[s]&&(n[s].methods=i)}),t.chains&&Object.entries(t.chains).forEach(([s,i])=>{n[s]&&(n[s].chains=i)}),t.events&&Object.entries(t.events).forEach(([s,i])=>{n[s]&&(n[s].events=i)}),t.rpcMap){const s=new Set;Object.entries(t.rpcMap).forEach(([i,o])=>{const[a,c]=i.split(":");!a||!c||!n[a]||(n[a].rpcMap||(n[a].rpcMap={}),s.has(a)||(n[a].rpcMap={},s.add(a)),n[a].rpcMap[c]=o)})}return n},createNamespaces(e,t){const n=e.reduce((r,s)=>{const{id:i,chainNamespace:o,rpcUrls:a}=s,c=a.default.http[0];r[o]||(r[o]=this.createDefaultNamespace(o));const l=`${o}:${i}`,u=r[o];switch(u.chains.push(l),l){case boe.caipNetworkId:u.chains.push(boe.deprecatedCaipNetworkId);break;case voe.caipNetworkId:u.chains.push(voe.deprecatedCaipNetworkId);break}return u!=null&&u.rpcMap&&c&&(u.rpcMap[i]=c),r},{});return this.applyNamespaceOverrides(n,t)},resolveReownName:async e=>{var r;const t=await y8.resolveName(e);return((r=(Object.values(t==null?void 0:t.addresses)||[])[0])==null?void 0:r.address)||!1},getChainsFromNamespaces(e={}){return Object.values(e).flatMap(t=>{const n=t.chains||[],r=t.accounts.map(s=>{const[i,o]=s.split(":");return`${i}:${o}`});return Array.from(new Set([...n,...r]))})},isSessionEventData(e){return typeof e=="object"&&e!==null&&"id"in e&&"topic"in e&&"params"in e&&typeof e.params=="object"&&e.params!==null&&"chainId"in e.params&&"event"in e.params&&typeof e.params.event=="object"&&e.params.event!==null},isOriginAllowed(e,t,n){for(const r of[...t,...n])if(r.includes("*")){const i=`^${r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&").replace(/\\\*/gu,".*")}$`;if(new RegExp(i,"u").test(e))return!0}
1052else try{if(new URL(r).origin===e)return!0}catch{if(r===e)return!0}return!1}};class t5e{constructor({provider:t,namespace:n}){this.id=$t.CONNECTOR_ID.WALLET_CONNECT,this.name=BA.ConnectorNamesMap[$t.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=BA.ConnectorImageIds[$t.CONNECTOR_ID.WALLET_CONNECT],this.getCaipNetworks=J.getCaipNetworks.bind(J),this.caipNetworks=this.getCaipNetworks(),this.provider=t,this.chain=n}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){const n=this.getCaipNetworks(),r=we.state.universalProviderConfigOverride,s=DS.createNamespaces(n,r);await this.provider.connect({optionalNamespaces:s})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){const t=this.chains.map(n=>n.caipNetworkId);return kw.universalProviderAuthenticate({universalProvider:this.provider,chains:t,methods:$xt})}}const $xt=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"];class xxt{constructor(t){this.availableConnectors=[],this.eventListeners=new Map,this.getCaipNetworks=n=>J.getCaipNetworks(n),t&&this.construct(t)}construct(t){this.projectId=t.projectId,this.namespace=t.namespace,this.adapterType=t.adapterType}get connectors(){return this.availableConnectors}get networks(){return this.getCaipNetworks(this.namespace)}setAuthProvider(t){this.addConnector({id:$t.CONNECTOR_ID.AUTH,type:"AUTH",name:$t.CONNECTOR_NAMES.AUTH,provider:t,imageId:BA.ConnectorImageIds[$t.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...t){const n=new Set;this.availableConnectors=[...t,...this.availableConnectors].filter(r=>n.has(r.id)?!1:(n.add(r.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(t,n){Et.setStatus(t,n)}on(t,n){var r;this.eventListeners.has(t)||this.eventListeners.set(t,new Set),(r=this.eventListeners.get(t))==null||r.add(n)}off(t,n){const r=this.eventListeners.get(t);r&&r.delete(n)}removeAllEventListeners(){this.eventListeners.forEach(t=>{t.clear()})}emit(t,n){const r=this.eventListeners.get(t);r&&r.forEach(s=>s(n))}async connectWalletConnect(t){return{clientId:(await this.getWalletConnectConnector().connectWalletConnect()).clientId}}async switchNetwork(t){var i;const{caipNetwork:n,providerType:r}=t;if(!t.provider)return;const s="provider"in t.provider?t.provider.provider:t.provider;if(r==="WALLET_CONNECT"){s.setDefaultChain(n.caipNetworkId);return}if(s&&r==="AUTH"){const o=s,a=(i=Et.state.preferredAccountTypes)==null?void 0:i[n.chainNamespace];await o.switchNetwork(n.caipNetworkId);const c=await o.getUser({chainId:n.caipNetworkId,preferredAccountType:a});this.emit("switchNetwork",c)}}getWalletConnectConnector(){const t=this.connectors.find(n=>n instanceof t5e);if(!t)throw new Error("WalletConnectConnector not found");return t}}class Ixt extends xxt{setUniversalProvider(t){this.addConnector(new t5e({provider:t,caipNetworks:this.getCaipNetworks(),namespace:this.namespace}))}async connect(t){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(t.chainId),provider:this.provider,address:""})}async disconnect(){try{await this.getWalletConnectConnector().disconnect()}catch(t){console.warn("UniversalAdapter:disconnect - error",t)}}async getAccounts({namespace:t}){var s,i,o,a;const n=this.provider,r=((a=(o=(i=(s=n==null?void 0:n.session)==null?void 0:s.namespaces)==null?void 0:i[t])==null?void 0:o.accounts)==null?void 0:a.map(c=>{const[,,l]=c.split(":");return l}).filter((c,l,u)=>u.indexOf(c)===l))||[];return Promise.resolve({accounts:r.map(c=>Re.createAccount(t,c,t==="bip122"?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(t){var i,o,a,c,l;if(!(t.caipNetwork&&dr.BALANCE_SUPPORTED_CHAINS.includes((i=t.caipNetwork)==null?void 0:i.chainNamespace))||(o=t.caipNetwork)!=null&&o.testnet)return{balance:"0.00",symbol:((a=t.caipNetwork)==null?void 0:a.nativeCurrency.symbol)||""};if(Et.state.balanceLoading&&t.chainId===((c=J.state.activeCaipNetwork)==null?void 0:c.id))return{balance:Et.state.balance||"0.00",symbol:Et.state.balanceSymbol||""};const s=(await Et.fetchTokenBalance()).find(u=>{var d,h;return u.chainId===`${(d=t.caipNetwork)==null?void 0:d.chainNamespace}:${t.chainId}`&&u.symbol===((h=t.caipNetwork)==null?void 0:h.nativeCurrency.symbol)});return{balance:(s==null?void 0:s.quantity.numeric)||"0.00",symbol:(s==null?void 0:s.symbol)||((l=t.caipNetwork)==null?void 0:l.nativeCurrency.symbol)||""}}async signMessage(t){var o,a,c;const{provider:n,message:r,address:s}=t;
1052if(!n)throw new Error("UniversalAdapter:signMessage - provider is undefined");let i="";return((o=J.state.activeCaipNetwork)==null?void 0:o.chainNamespace)===$t.CHAIN.SOLANA?i=(await n.request({method:"solana_signMessage",params:{message:l1.encode(new TextEncoder().encode(r)),pubkey:s}},(a=J.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)).signature:i=await n.request({method:"personal_sign",params:[r,s]},(c=J.state.activeCaipNetwork)==null?void 0:c.caipNetworkId),{signature:i}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(t){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(t){var s,i,o,a,c,l;const{caipNetwork:n}=t,r=this.getWalletConnectConnector();if(n.chainNamespace===$t.CHAIN.EVM)try{await((s=r.provider)==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:yoe(n.id)}]}))}catch(u){if(u.code===HE.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||u.code===HE.ERROR_INVALID_CHAIN_ID||u.code===HE.ERROR_CODE_DEFAULT||((o=(i=u==null?void 0:u.data)==null?void 0:i.originalError)==null?void 0:o.code)===HE.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await((l=r.provider)==null?void 0:l.request({method:"wallet_addEthereumChain",params:[{chainId:yoe(n.id),rpcUrls:[(a=n==null?void 0:n.rpcUrls.chainDefault)==null?void 0:a.http],chainName:n.name,nativeCurrency:n.nativeCurrency,blockExplorerUrls:[(c=n.blockExplorers)==null?void 0:c.default.url]}]}))}catch{throw new Error("Chain is not supported")}}r.provider.setDefaultChain(n.caipNetworkId)}getWalletConnectProvider(){const t=this.connectors.find(r=>r.type==="WALLET_CONNECT");return t==null?void 0:t.provider}}const Sxt=["email","socials","swaps","onramp","activity","reownBranding"],FI={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return!!e.isEnabled&&t.includes("email")},processFallback:e=>e===void 0?dr.DEFAULT_REMOTE_FEATURES.email:!!e},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return e.isEnabled&&t.length>0?t.filter(n=>n!=="email"):!1},processFallback:e=>e===void 0?dr.DEFAULT_REMOTE_FEATURES.socials:typeof e=="boolean"?e?dr.DEFAULT_REMOTE_FEATURES.socials:!1:e},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return e.isEnabled&&t.length>0?t:!1},processFallback:e=>e===void 0?dr.DEFAULT_REMOTE_FEATURES.swaps:typeof e=="boolean"?e?dr.DEFAULT_REMOTE_FEATURES.swaps:!1:e},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>{if(!(e!=null&&e.config))return!1;const t=e.config;return e.isEnabled&&t.length>0?t:!1},processFallback:e=>e===void 0?dr.DEFAULT_REMOTE_FEATURES.onramp:typeof e=="boolean"?e?dr.DEFAULT_REMOTE_FEATURES.onramp:!1:e},activity:{apiFeatureName:"activity",localFeatureName:"history",returnType:!1,isLegacy:!0,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:e=>e===void 0?dr.DEFAULT_REMOTE_FEATURES.activity:!!e},reownBranding:{apiFeatureName:"reown_branding",localFeatureName:"reownBranding",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:e=>!!e.isEnabled,processFallback:e=>e===void 0?dr.DEFAULT_REMOTE_FEATURES.reownBranding:!!e}},Axt={localSettingsOverridden:new Set,getApiConfig(e,t){return t==null?void 0:t.find(n=>n.id===e)},addWarning(e,t){if(e!==void 0){const n=FI[t],r=n.isLegacy?`"features.${n.localFeatureName}" (now "${t}")`:`"features.${t}"`;this.localSettingsOverridden.add(r)}}
1052,processFeature(e,t,n,r,s){const i=FI[e],o=t[i.localFeatureName];if(s&&!i.isAvailableOnBasic)return!1;if(r){const a=this.getApiConfig(i.apiFeatureName,n);return(a==null?void 0:a.config)===null?this.processFallbackFeature(e,o):a!=null&&a.config?(o!==void 0&&this.addWarning(o,e),this.processApiFeature(e,a)):!1}return this.processFallbackFeature(e,o)},processApiFeature(e,t){return FI[e].processApi(t)},processFallbackFeature(e,t){return FI[e].processFallback(t)},async fetchRemoteFeatures(e){const t=e.basic??!1,n=e.features||{};this.localSettingsOverridden.clear();let r=null,s=!1;try{r=await ze.fetchProjectConfig(),s=r!=null}catch(o){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",o)}const i=s&&!t?dr.DEFAULT_REMOTE_FEATURES:dr.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const o of Sxt){const a=this.processFeature(o,n,r,s,t);Object.assign(i,{[o]:a})}}catch(o){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",o),dr.DEFAULT_REMOTE_FEATURES}if(s&&this.localSettingsOverridden.size>0){const o=`Your local configuration for ${Array.from(this.localSettingsOverridden).join(", ")} was ignored because a remote configuration was successfully fetched. Please manage these features via your project dashboard on dashboard.reown.com.`;vd.open({shortMessage:"Local configuration ignored",longMessage:`[Reown Config Notice] ${o}`},"warning")}return i}};class _xt{constructor(t){this.chainNamespaces=[],this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(n,r)=>{var s,i,o,a;if(n){const c=(i=(s=J.getNetworkData(n))==null?void 0:s.requestedCaipNetworks)==null?void 0:i.find(d=>d.id===r);if(c)return c;const l=(o=J.getNetworkData(n))==null?void 0:o.caipNetwork;return l||((a=J.getRequestedCaipNetworks(n).filter(d=>d.chainNamespace===n))==null?void 0:a[0])}return J.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const n=this.getCaipNetwork();if(n)return n.id},this.getCaipNetworks=n=>J.getCaipNetworks(n),this.getActiveChainNamespace=()=>J.state.activeChain,this.setRequestedCaipNetworks=(n,r)=>{J.setRequestedCaipNetworks(n,r)},this.getApprovedCaipNetworkIds=()=>J.getAllApprovedCaipNetworkIds(),this.getCaipAddress=n=>J.state.activeChain===n||!n?J.state.activeCaipAddress:J.getAccountProp("caipAddress",n),this.setClientId=n=>{Ut.setClientId(n)},this.getProvider=n=>rs.getProvider(n),this.getProviderType=n=>rs.getProviderId(n),this.getPreferredAccountType=n=>{var r;return(r=Et.state.preferredAccountTypes)==null?void 0:r[n]},this.setCaipAddress=(n,r)=>{Et.setCaipAddress(n,r),n&&we.state.enableEmbedded&&this.close()},this.setBalance=(n,r,s)=>{Et.setBalance(n,r,s)},this.setProfileName=(n,r)=>{Et.setProfileName(n,r)},this.setProfileImage=(n,r)=>{Et.setProfileImage(n,r)},this.setUser=(n,r)=>{Et.setUser(n,r)},this.resetAccount=n=>{Et.resetAccount(n)},this.setCaipNetwork=n=>{J.setActiveCaipNetwork(n)},this.setCaipNetworkOfNamespace=(n,r)=>{J.setChainNetworkData(r,{caipNetwork:n})},this.setAllAccounts=(n,r)=>{Et.setAllAccounts(n,r),we.setHasMultipleAddresses((n==null?void 0:n.length)>1)},this.setStatus=(n,r)=>{Et.setStatus(n,r),Pe.isConnected()?lt.setConnectionStatus("connected"):lt.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=n=>J.getAccountProp("address",n),this.setConnectors=n=>{const r=[...Pe.state.allConnectors,...n];Pe.setConnectors(r)},this.setConnections=(n,r)=>{He.setConnections(n,r)},this.fetchIdentity=n=>Ut.fetchIdentity(n),this.getReownName=n=>y8.getNamesForAddress(n),this.getConnectors=()=>Pe.getConnectors(),this.getConnectorImage=n=>ti.getConnectorImage(n),this.setConnectedWalletInfo=(n,r)=>{const s=rs.getProviderId(r),i=n?{...n,type:s}:void 0;Et.setConnectedWalletInfo(i,r)},this.getIsConnectedState=()=>!!J.state.activeCaipAddress,this.addAddressLabel=(n,r,s)=>{Et.addAddressLabel(n,r,s)},this.removeAddressLabel=(n,r)=>{Et.removeAddressLabel(n,r)},this.getAddress=n=>J.state.activeChain===n||!n?Et.state.address:J.getAccountProp("address",n),this.setApprovedCaipNetworksData=n=>J.setApprovedCaipNetworksData(n),this.resetNetwork=n=>{J.resetNetwork(n)},this.addConnector=n=>{Pe.addConnector(n)},this.resetWcConnection=()=>{He.resetWcConnection()},this.setAddressExplorerUrl=(n,r)=>{Et.setAddressExplorerUrl(n,r)},this.setSmartAccountDeployed=(n,r)=>{Et.setSmartAccountDeployed(n,r)},this.setSmartAccountEnabledNetworks=(n,r)=>{J.setSmartAccountEnabledNetworks(n,r)},this.setPreferredAccountType=(n,r)=>{Et.setPreferredAccountType(n,r)},this.setEIP6963Enabled=n=>{we.setEIP6963Enabled(n)},this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.options=t,this.version=t.sdkVersion,this.caipNetworks=this.extendCaipNetworks(t),this.chainNamespaces=this.getChainNamespacesSet(t.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(t),this.chainAdapters=this.createAdapters(t.adapters),this.readyPromise=this.initialize(t)}getChainNamespacesSet(t,n){const r=t==null?void 0:t.map(i=>i.namespace).filter(i=>!!i);if(r!=null&&r.length)return[...new Set(r)];const s=n==null?void 0:n.map(i=>i.chainNamespace);return[...new Set(s)]}async initialize(t){var n,r,s;this.initializeProjectSettings(t),this.initControllers(t),await this.initChainAdapters(),this.sendInitializeEvent(t),await this.syncExistingConnection(),this.remoteFeatures=await Axt.fetchRemoteFeatures(t),we.setRemoteFeatures(this.remoteFeatures),this.remoteFeatures.onramp&&Aj.setOnrampProviders(this.remoteFeatures.onramp),((n=we.state.remoteFeatures)!=null&&n.email||Array.isArray((r=we.state.remoteFeatures)==null?void 0:r.socials)&&((s=we.state.remoteFeatures)==null?void 0:s.socials.length)>0)&&await this.checkAllowedOrigins()}async checkAllowedOrigins(){const t=await ze.fetchAllowedOrigins();if(t&&Re.isClient()){const n=window.location.origin;DS.isOriginAllowed(n,t,HE.DEFAULT_ALLOWED_ANCESTORS)||vd.open(j2.ALERT_ERRORS.INVALID_APP_CONFIGURATION,"error")}else vd.open(j2.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error")}sendInitializeEvent(t){var r;const{...n}=t;delete n.adapters,delete n.universalProvider,bn.sendEvent({type:"track",event:"INITIALIZE",properties:{...n,networks:t.networks.map(s=>s.id),siweConfig:{options:((r=t.siweConfig)==null?void 0:r.options)||{}}}})}initControllers(t){this.initializeOptionsController(t),this.initializeChainController(t),this.initializeThemeController(t),this.initializeConnectionController(t),this.initializeConnectorController()}initializeThemeController(t){t.themeMode&&Vi.setThemeMode(t.themeMode),t.themeVariables&&Vi.setThemeVariables(t.themeVariables)}initializeChainController(t){if(!this.connectionControllerClient||!this.networkControllerClient)throw new Error("ConnectionControllerClient and NetworkControllerClient must be set");J.initialize(t.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});const n=this.getDefaultNetwork();n&&J.setActiveCaipNetwork(n)}initializeConnectionController(t){He.setWcBasic(t.basic??!1)}initializeConnectorController(){Pe.initialize(this.chainNamespaces)}initializeProjectSettings(t){we.setProjectId(t.projectId),we.setSdkVersion(t.sdkVersion)}initializeOptionsController(t){var o;we.setDebug(t.debug!==!1),we.setEnableWalletConnect(t.enableWalletConnect!==!1),we.setEnableWalletGuide(t.enableWalletGuide!==!1),we.setEnableWallets(t.enableWallets!==!1),we.setEIP6963Enabled(t.enableEIP6963!==!1),we.setEnableNetworkSwitch(t.enableNetworkSwitch!==!1),we.setEnableAuthLogger(t.enableAuthLogger!==!1),we.setCustomRpcUrls(t.customRpcUrls),we.setEnableEmbedded(t.enableEmbedded),we.setAllWallets(t.allWallets),we.setIncludeWalletIds(t.includeWalletIds),we.setExcludeWalletIds(t.excludeWalletIds),we.setFeaturedWalletIds(t.featuredWalletIds),we.setTokens(t.tokens),we.setTermsConditionsUrl(t.termsConditionsUrl),we.setPrivacyPolicyUrl(t.privacyPolicyUrl),we.setCustomWallets(t.customWallets),we.setFeatures(t.features),we.setAllowUnsupportedChain(t.allowUnsupportedChain),we.setUniversalProviderConfigOverride(t.universalProviderConfigOverride),we.setPreferUniversalLinks(t.experimental_preferUniversalLinks),we.setDefaultAccountTypes(t.defaultAccountTypes);const n=lt.getPreferredAccountTypes()||{},r={...we.state.defaultAccountTypes,...n};Et.setPreferredAccountTypes(r);const s=this.getDefaultMetaData();if(!t.metadata&&s&&(t.metadata=s),we.setMetadata(t.metadata),we.setDisableAppend(t.disableAppend),we.setEnableEmbedded(t.enableEmbedded),we.setSIWX(t.siwx),!t.projectId){vd.open(j2.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(((o=t.adapters)==null?void 0:o.find(a=>a.namespace===$t.CHAIN.EVM))&&t.siweConfig){if(t.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");we.setSIWX(t.siweConfig.mapToSIWX())}}getDefaultMetaData(){var t,n,r,s;return Re.isClient()?{name:((n=(t=document.getElementsByTagName("title"))==null?void 0:t[0])==null?void 0:n.textContent)||"",description:((r=document.querySelector('meta[property="og:description"]'))==null?void 0:r.content)||"",url:window.location.origin,icons:[((s=document.querySelector('link[rel~="icon"]'))==null?void 0:s.href)||""]}:null}setUnsupportedNetwork(t){const n=this.getActiveChainNamespace();if(n){const r=iv.getUnsupportedNetwork(`${n}:${t}`);J.setActiveCaipNetwork(r)}}getDefaultNetwork(){return iv.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(t,n){return iv.extendCaipNetwork(t,{customNetworkImageUrls:n.chainImages,projectId:n.projectId})}extendCaipNetworks(t){return iv.extendCaipNetworks(t.networks,{customNetworkImageUrls:t.chainImages,customRpcUrls:t.customRpcUrls,projectId:t.projectId})}extendDefaultCaipNetwork(t){const n=t.networks.find(s=>{var i;return s.id===((i=t.defaultNetwork)==null?void 0:i.id)});return n?iv.extendCaipNetwork(n,{customNetworkImageUrls:t.chainImages,customRpcUrls:t.customRpcUrls,projectId:t.projectId}):void 0}async disconnectNamespace(t){try{const n=this.getAdapter(t),r=rs.getProvider(t),s=rs.getProviderId(t),{caipAddress:i}=J.getAccountData(t)||{};this.setLoading(!0,t),i&&(n!=null&&n.disconnect)&&await n.disconnect({provider:r,providerType:s}),lt.removeConnectedNamespace(t),rs.resetChain(t),this.setUser(void 0,t),this.setStatus("disconnected",t),this.setConnectedWalletInfo(void 0,t),Pe.removeConnectorId(t),J.resetAccount(t),J.resetNetwork(t),this.setLoading(!1,t)}catch(n){throw this.setLoading(!1,t),new Error(`Failed to disconnect chain ${t}: ${n.message}`)}}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{var i;const t=J.state.activeChain,n=this.getAdapter(t),r=(i=this.getCaipNetwork(t))==null?void 0:i.id;if(!n)throw new Error("Adapter not found");const s=await n.connectWalletConnect(r);this.close(),this.setClientId((s==null?void 0:s.clientId)||null),lt.setConnectedNamespaces([...J.state.chains.keys()]),this.chainNamespaces.forEac
1052h(o=>{Pe.setConnectorId(Dg.CONNECTOR_TYPE_WALLET_CONNECT,o)}),await this.syncWalletConnectAccount()},connectExternal:async({id:t,info:n,type:r,provider:s,chain:i,caipNetwork:o,socialUri:a})=>{var p,m,w,C,E,b;const c=J.state.activeChain,l=i||c,u=this.getAdapter(l);if(i&&i!==c&&!o){const S=this.getCaipNetworks().find(v=>v.chainNamespace===i);S&&this.setCaipNetwork(S)}if(!u)throw new Error("Adapter not found");const d=this.getCaipNetwork(l),h=await u.connect({id:t,info:n,type:r,provider:s,socialUri:a,chainId:(o==null?void 0:o.id)||(d==null?void 0:d.id),rpcUrl:((w=(m=(p=o==null?void 0:o.rpcUrls)==null?void 0:p.default)==null?void 0:m.http)==null?void 0:w[0])||((b=(E=(C=d==null?void 0:d.rpcUrls)==null?void 0:C.default)==null?void 0:E.http)==null?void 0:b[0])});if(!h)return;lt.addConnectedNamespace(l),this.syncProvider({...h,chainNamespace:l});const f=Et.state.allAccounts,{accounts:g}=(f==null?void 0:f.length)>0?{accounts:[...f]}:await u.getAccounts({namespace:l,id:t});this.setAllAccounts(g,l),this.setStatus("connected",l),this.syncConnectedWalletInfo(l)},reconnectExternal:async({id:t,info:n,type:r,provider:s})=>{var a;const i=J.state.activeChain,o=this.getAdapter(i);o!=null&&o.reconnect&&(await(o==null?void 0:o.reconnect({id:t,info:n,type:r,provider:s,chainId:(a=this.getCaipNetwork())==null?void 0:a.id})),lt.addConnectedNamespace(i),this.syncConnectedWalletInfo(i))},disconnect:async t=>{const n=w$t(t);try{const r=await Promise.allSettled(n.map(async([i])=>this.disconnectNamespace(i)));Jn.resetSend(),He.resetWcConnection(),await kw.clearSessions(),Pe.setFilterByNamespace(void 0);const s=r.filter(i=>i.status==="rejected");if(s.length>0)throw new Error(s.map(i=>i.reason.message).join(", "));lt.deleteConnectedSocialProvider(),bn.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:t||"all"}})}catch(r){throw new Error(`Failed to disconnect chains: ${r.message}`)}},checkInstalled:t=>t?t.some(n=>{var r;return!!((r=window.ethereum)!=null&&r[String(n)])}):!!window.ethereum,signMessage:async t=>{const n=this.getAdapter(J.state.activeChain),r=await(n==null?void 0:n.signMessage({message:t,address:Et.state.address,provider:rs.getProvider(J.state.activeChain)}));return(r==null?void 0:r.signature)||""},sendTransaction:async t=>{const n=t.chainNamespace;if(dr.SEND_SUPPORTED_NAMESPACES.includes(n)){const r=this.getAdapter(J.state.activeChain),s=rs.getProvider(n),i=await(r==null?void 0:r.sendTransaction({...t,caipNetwork:this.getCaipNetwork(),provider:s}));return(i==null?void 0:i.hash)||""}return""},estimateGas:async t=>{if(t.chainNamespace===$t.CHAIN.EVM){const n=this.getAdapter(J.state.activeChain),r=rs.getProvider(J.state.activeChain),s=this.getCaipNetwork();if(!s)throw new Error("CaipNetwork is undefined");const i=await(n==null?void 0:n.estimateGas({...t,provider:r,caipNetwork:s}));return(i==null?void 0:i.gas)||0n}return 0n},getEnsAvatar:async()=>{var t;return await this.syncIdentity({address:Et.state.address,chainId:Number((t=this.getCaipNetwork())==null?void 0:t.id),chainNamespace:J.state.activeChain}),Et.state.profileImage||!1},getEnsAddress:async t=>await DS.resolveReownName(t),writeContract:async t=>{const n=this.getAdapter(J.state.activeChain),r=this.getCaipNetwork(),s=this.getCaipAddress(),i=rs.getProvider(J.state.activeChain);if(!r||!s)throw new Error("CaipNetwork or CaipAddress is undefined");const o=await(n==null?void 0:n.writeContract({...t,caipNetwork:r,provider:i,caipAddress:s}));return o==null?void 0:o.hash},parseUnits:(t,n)=>{const r=this.getAdapter(J.state.activeChain);return(r==null?void 0:r.parseUnits({value:t,decimals:n}))??0n},formatUnits:(t,n)=>{const r=this.getAdapter(J.state.activeChain);return(r==null?void 0:r.formatUnits({value:t,decimals:n}))??"0"},getCapabilities:async t=>{const n=this.getAdapter(J.state.activeChain);return await(n==null?void 0:n.getCapabilities(t))},grantPermissions:async t=>{const n=this.getAdapter(J.state.activeChain);return await(n==null?void 0:n.grantPermissions(t))},revokePermissions:async t=>{const n=this.getAdapter(J.state.activeChain);return n!=null&&n.revokePermissions?await n.revokePermissions(t):"0x"},walletGetAssets:async t=>{const n=this.getAdapter(J.state.activeChain);return await(n==null?void 0:n.walletGetAssets(t))??{}},updateBalance:t=>{const n=this.getCaipNetwork(t);!n||!Et.state.address||this.updateNativeBalance(Et.state.address,n==null?void 0:n.id,t)}},this.networkControllerClient={switchCaipNetwork:async t=>await this.switchCaipNetwork(t),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},He.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){var n,r,s,i,o;if(rs.getProviderId(J.state.activeChain)===Dg.CONNECTOR_TYPE_WALLET_CONNECT){const a=(r=(n=this.universalProvider)==null?void 0:n.session)==null?void 0:r.namespaces;return{supportsAllNetworks:((o=(i=(s=this.universalProvider)==null?void 0:s.session)==null?void 0:i.peer)==null?void 0:o.metadata.name)==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(a)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(t){if(!t)return;const n=t.chainNamespace;if(this.getAddressByChainNamespace(t.chainNamespace)){const s=rs.getProvider(n),i=rs.getProviderId(n);if(t.chainNamespace===J.state.activeChain){const o=this.getAdapter(n);
1052await(o==null?void 0:o.switchNetwork({caipNetwork:t,provider:s,providerType:i}))}else if(this.setCaipNetwork(t),i===Dg.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{const o=this.getAddressByChainNamespace(n);o&&this.syncAccount({address:o,chainId:t.id,chainNamespace:n})}}else this.setCaipNetwork(t)}getChainsFromNamespaces(t={}){return Object.values(t).flatMap(n=>{const r=n.chains||[],s=n.accounts.map(i=>{const{chainId:o,chainNamespace:a}=Eg.parseCaipAddress(i);return`${a}:${o}`});return Array.from(new Set([...r,...s]))})}createAdapters(t){return this.createClients(),this.chainNamespaces.reduce((n,r)=>{var i;const s=t==null?void 0:t.find(o=>o.namespace===r);return s?(s.construct({namespace:r,projectId:(i=this.options)==null?void 0:i.projectId,networks:this.getCaipNetworks()}),n[r]=s):n[r]=new Ixt({namespace:r,networks:this.getCaipNetworks()}),n},{})}async initChainAdapter(t){var n;this.onConnectors(t),this.listenAdapter(t),await((n=this.chainAdapters)==null?void 0:n[t].syncConnectors(this.options,this)),await this.createUniversalProviderForAdapter(t)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async t=>{await this.initChainAdapter(t)}))}onConnectors(t){const n=this.getAdapter(t);n==null||n.on("connectors",this.setConnectors.bind(this))}listenAdapter(t){const n=this.getAdapter(t);if(!n)return;const r=lt.getConnectionStatus();r==="connected"?this.setStatus("connecting",t):r==="disconnected"?(lt.clearAddressCache(),this.setStatus(r,t)):this.setStatus(r,t),n.on("switchNetwork",({address:s,chainId:i})=>{const o=this.getCaipNetworks().find(l=>l.id===i||l.caipNetworkId===i),a=J.state.activeChain===t,c=J.getAccountProp("address",t);if(o){const l=a&&s?s:c;l&&this.syncAccount({address:l,chainId:o.id,chainNamespace:t})}else this.setUnsupportedNetwork(i)}),n.on("disconnect",this.disconnect.bind(this,t)),n.on("connections",s=>{this.setConnections(s,t)}),n.on("pendingTransactions",()=>{const s=Et.state.address,i=J.state.activeCaipNetwork;!s||!(i!=null&&i.id)||this.updateNativeBalance(s,i.id,i.chainNamespace)}),n.on("accountChanged",({address:s,chainId:i})=>{var a,c;const o=J.state.activeChain===t;o&&i?this.syncAccount({address:s,chainId:i,chainNamespace:t}):o&&((a=J.state.activeCaipNetwork)!=null&&a.id)?this.syncAccount({address:s,chainId:(c=J.state.activeCaipNetwork)==null?void 0:c.id,chainNamespace:t}):this.syncAccountInfo(s,i,t),this.syncAllAccounts(t)})}async createUniversalProviderForAdapter(t){var n,r,s;await this.getUniversalProvider(),this.universalProvider&&((s=(r=(n=this.chainAdapters)==null?void 0:n[t])==null?void 0:r.setUniversalProvider)==null||s.call(r,this.universalProvider))}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(t=>this.syncNamespaceConnection(t)))}async syncNamespaceConnection(t){try{t===$t.CHAIN.EVM&&Re.isSafeApp()&&Pe.setConnectorId($t.CONNECTOR_ID.SAFE,t);const n=Pe.getConnectorId(t);switch(this.setStatus("connecting",t),n){case $t.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case $t.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(t)}}catch(n){console.warn("AppKit couldn't sync existing connection",n),this.setStatus("disconnected",t)}}async syncAdapterConnection(t){var a,c,l;const n=this.getAdapter(t),r=Pe.getConnectorId(t),s=this.getCaipNetwork(t),o=Pe.getConnectors(t).find(u=>u.id===r);try{if(!n||!o)throw new Error(`Adapter or connector not found for namespace ${t}`);if(!(s!=null&&s.id))throw new Error("CaipNetwork not found");const u=await(n==null?void 0:n.syncConnection({namespace:t,id:o.id,chainId:s.id,rpcUrl:(l=(c=(a=s==null?void 0:s.rpcUrls)==null?void 0:a.default)==null?void 0:c.http)==null?void 0:l[0]}));if(u){const d=await(n==null?void 0:n.getAccounts({namespace:t,id:o.id}));d&&d.accounts.length>0?this.setAllAccounts(d.accounts,t):this.setAllAccounts([Re.createAccount(t,u.address,"eoa")],t),this.syncProvider({...u,chainNamespace:t}),await this.syncAccount({...u,chainNamespace:t}),this.setStatus("connected",t)}else this.setStatus("disconnected",t)}catch{this.setStatus("disconnected",t)}}async syncWalletConnectAccount(){const t=this.chainNamespaces.map(async n=>{var a,c,l,u,d;const r=this.getAdapter(n),s=((u=(l=(c=(a=this.universalProvider)==null?void 0:a.session)==null?void 0:c.namespaces)==null?void 0:l[n])==null?void 0:u.accounts)||[],i=(d=J.state.activeCaipNetwork)==null?void 0:d.id,o=s.find(h=>{const{chainId:f}=Eg.parseCaipAddress(h);return f===(i==null?void 0:i.toString())})||s[0];
1052if(o){const h=Eg.validateCaipAddress(o),{chainId:f,address:g}=Eg.parseCaipAddress(h);if(rs.setProviderId(n,Dg.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&J.state.activeCaipNetwork&&(r==null?void 0:r.namespace)!==$t.CHAIN.EVM){const p=r==null?void 0:r.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:J.state.activeCaipNetwork});rs.setProvider(n,p)}else rs.setProvider(n,this.universalProvider);Pe.setConnectorId($t.CONNECTOR_ID.WALLET_CONNECT,n),lt.addConnectedNamespace(n),this.syncWalletConnectAccounts(n),await this.syncAccount({address:g,chainId:f,chainNamespace:n})}else this.setStatus("disconnected",n);this.syncConnectedWalletInfo(n),await J.setApprovedCaipNetworksData(n)});await Promise.all(t)}syncWalletConnectAccounts(t){var r,s,i,o,a;const n=(a=(o=(i=(s=(r=this.universalProvider)==null?void 0:r.session)==null?void 0:s.namespaces)==null?void 0:i[t])==null?void 0:o.accounts)==null?void 0:a.map(c=>{const{address:l}=Eg.parseCaipAddress(c);return l}).filter((c,l,u)=>u.indexOf(c)===l);n&&this.setAllAccounts(n.map(c=>Re.createAccount(t,c,t==="bip122"?"payment":"eoa")),t)}syncProvider({type:t,provider:n,id:r,chainNamespace:s}){rs.setProviderId(s,t),rs.setProvider(s,n),Pe.setConnectorId(r,s)}async syncAllAccounts(t){const n=Pe.getConnectorId(t);if(!n)return;const r=this.getAdapter(t),s=await(r==null?void 0:r.getAccounts({namespace:t,id:n}));s&&s.accounts.length>0&&this.setAllAccounts(s.accounts,t)}async syncAccount(t){var d,h;const n=t.chainNamespace===J.state.activeChain,r=J.getCaipNetworkByNamespace(t.chainNamespace,t.chainId),{address:s,chainId:i,chainNamespace:o}=t,{chainId:a}=lt.getActiveNetworkProps(),c=i||a,l=((d=J.state.activeCaipNetwork)==null?void 0:d.name)===$t.UNSUPPORTED_NETWORK_NAME,u=J.getNetworkProp("supportsAllNetworks",o);if(this.setStatus("connected",o),!(l&&!u)&&c){let f=this.getCaipNetworks().find(m=>m.id.toString()===c.toString()),g=this.getCaipNetworks().find(m=>m.chainNamespace===o);if(!u&&!f&&!g){const m=this.getApprovedCaipNetworkIds()||[],w=m.find(E=>{var b;return((b=Eg.parseCaipNetworkId(E))==null?void 0:b.chainId)===c.toString()}),C=m.find(E=>{var b;return((b=Eg.parseCaipNetworkId(E))==null?void 0:b.chainNamespace)===o});f=this.getCaipNetworks().find(E=>E.caipNetworkId===w),g=this.getCaipNetworks().find(E=>E.caipNetworkId===C||"deprecatedCaipNetworkId"in E&&E.deprecatedCaipNetworkId===C)}const p=f||g;(p==null?void 0:p.chainNamespace)===J.state.activeChain?we.state.enableNetworkSwitch&&!we.state.allowUnsupportedChain&&((h=J.state.activeCaipNetwork)==null?void 0:h.name)===$t.UNSUPPORTED_NETWORK_NAME?J.showUnsupportedChainUI():this.setCaipNetwork(p):n||r&&this.setCaipNetworkOfNamespace(r,o),this.syncConnectedWalletInfo(o),TV.isLowerCaseMatch(s,Et.state.address)||this.syncAccountInfo(s,p==null?void 0:p.id,o),n?await this.syncBalance({address:s,chainId:p==null?void 0:p.id,chainNamespace:o}):await this.syncBalance({address:s,chainId:r==null?void 0:r.id,chainNamespace:o})}}async syncAccountInfo(t,n,r){const s=this.getCaipAddress(r),i=n||(s==null?void 0:s.split(":")[1]);if(!i)return;const o=`${r}:${i}:${t}`;this.setCaipAddress(o,r),await this.syncIdentity({address:t,chainId:i,chainNamespace:r})}async syncReownName(t,n){try{const r=await this.getReownName(t);if(r[0]){const s=r[0];this.setProfileName(s.name,n)}else this.setProfileName(null,n)}catch{this.setProfileName(null,n)}}syncConnectedWalletInfo(t){var s;const n=Pe.getConnectorId(t),r=rs.getProviderId(t);if(r===Dg.CONNECTOR_TYPE_ANNOUNCED||r===Dg.CONNECTOR_TYPE_INJECTED){if(n){const i=this.getConnectors().find(o=>o.id===n);if(i){const{info:o,name:a,imageUrl:c}=i,l=c||this.getConnectorImage(i);this.setConnectedWalletInfo({name:a,icon:l,...o},t)}}}else if(r===Dg.CONNECTOR_TYPE_WALLET_CONNECT){const i=rs.getProvider(t);i!=null&&i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:(s=i.session.peer.metadata.icons)==null?void 0:s[0]},t)}else if(n&&n===$t.CONNECTOR_ID.COINBASE){const i=this.getConnectors().find(o=>o.id===$t.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(i)},t)}}async syncBalance(t){!Kye.getNetworksByNamespace(this.getCaipNetworks(),t.chainNamespace).find(r=>{var s;return r.id.toString()===((s=t.chainId)==null?void 0:s.toString())})||!t.chainId||await this.updateNativeBalance(t.address,t.chainId,t.chainNamespace)}async ready(){await this.readyPromise}async updateNativeBalance(t,n,r){const s=this.getAdapter(r),i=J.getCaipNetworkByNamespace(r,n);if(s){const o=await s.getBalance({address:t,chainId:n,caipNetwork:i,tokens:this.options.tokens});return this.setBalance(o.balance,o.symbol,r),o}}async initializeUniversalAdapter(){var r,s,i,o,a,c,l,u,d,h;const t=k$t.createLogger((f,...g)=>{f&&this.handleAlertError(f),console.error(...g)}),n={projectId:(r=this.options)==null?void 0:r.projectId,metadata:{name:(s=this.options)!=null&&s.metadata?(i=this.options)==null?void 0:i.metadata.name:"",description:(o=this.options)!=null&&o.metadata?(a=this.options)==null?void 0:a.metadata.description:"",url:(c=this.options)!=null&&c.metadata?(l=this.options)==null?void 0:l.metadata.url:"",icons:(u=this.options)!=null&&u.metadata?(d=this.options)==null?void 0:d.metadata.icons:[""]},logger:t};we.setManualWCControl(!!((h=this.options)!=null&&h.manualWCControl)),this.universalProvider=this.options.universalProvider??await m$t.init(n),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",t=>{He.setUri(t)}),this.universalProvider.on("connect",He.finalizeWcConnection),this.universalProvider.on("disconnect",()=>
1052{this.chainNamespaces.forEach(t=>{this.resetAccount(t)}),He.resetWcConnection()}),this.universalProvider.on("chainChanged",t=>{const n=this.getCaipNetworks().find(s=>s.id==t),r=this.getCaipNetwork();if(!n){this.setUnsupportedNetwork(t);return}(r==null?void 0:r.id)!==(n==null?void 0:n.id)&&this.setCaipNetwork(n)}),this.universalProvider.on("session_event",t=>{if(DS.isSessionEventData(t)){const{name:n,data:r}=t.params.event;n==="accountsChanged"&&Array.isArray(r)&&Re.isCaipAddress(r[0])&&this.syncAccount(Eg.parseCaipAddress(r[0]))}}))}createUniversalProvider(){var t;return!this.universalProviderInitPromise&&Re.isClient()&&((t=this.options)!=null&&t.projectId)&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(t){bn.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:t instanceof Error?t.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",t)}return this.universalProvider}handleAlertError(t){const n=Object.entries(j2.UniversalProviderErrors).find(([,{message:a}])=>t.message.includes(a)),[r,s]=n??[],{message:i,alertErrorKey:o}=s??{};if(r&&i&&!this.reportedAlertErrors[r]){const a=j2.ALERT_ERRORS[o];a&&(vd.open(a,"error"),this.reportedAlertErrors[r]=!0)}}getAdapter(t){var n;if(t)return(n=this.chainAdapters)==null?void 0:n[t]}createAdapter(t){var s;if(!t)return;const n=t.namespace;if(!n)return;this.createClients();const r=t;r.namespace=n,r.construct({namespace:n,projectId:(s=this.options)==null?void 0:s.projectId,networks:this.getCaipNetworks()}),this.chainNamespaces.includes(n)||this.chainNamespaces.push(n),this.chainAdapters&&(this.chainAdapters[n]=r)}async open(t){if(await this.injectModalUi(),t!=null&&t.uri&&He.setUri(t.uri),t!=null&&t.arguments)switch(t==null?void 0:t.view){case"Swap":return ir.open({...t,data:{swap:t.arguments}})}return ir.open(t)}async close(){await this.injectModalUi(),ir.close()}setLoading(t,n){ir.setLoading(t,n)}async disconnect(t){await He.disconnect(t)}getSIWX(){return we.state.siwx}getError(){return""}getChainId(){var t;return(t=J.state.activeCaipNetwork)==null?void 0:t.id}async switchNetwork(t){const n=this.getCaipNetworks().find(r=>r.id===t.id);if(!n){vd.open(j2.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await J.switchActiveNetwork(n)}getWalletProvider(){return J.state.activeChain?rs.state.providers[J.state.activeChain]:null}getWalletProviderType(){return rs.getProviderId(J.state.activeChain)}subscribeProviders(t){return rs.subscribeProviders(t)}getThemeMode(){return Vi.state.themeMode}getThemeVariables(){return Vi.state.themeVariables}setThemeMode(t){Vi.setThemeMode(t),Zve(Vi.state.themeMode)}setTermsConditionsUrl(t){we.setTermsConditionsUrl(t)}setPrivacyPolicyUrl(t){we.setPrivacyPolicyUrl(t)}setThemeVariables(t){Vi.setThemeVariables(t),lxt(Vi.state.themeVariables)}subscribeTheme(t){return Vi.subscribe(t)}getWalletInfo(){return Et.state.connectedWalletInfo}getAccount(t){var o;const n=Pe.getAuthConnector(t),r=J.getAccountData(t),s=J.state.activeChain,i=lt.getConnectedConnectorId(t||s);if(r)return{allAccounts:r.allAccounts,caipAddress:r.caipAddress,address:Re.getPlainAddress(r.caipAddress),isConnected:!!r.caipAddress,status:r.status,embeddedWalletInfo:n&&i===$t.CONNECTOR_ID.AUTH?{user:r.user?{...r.user,username:lt.getConnectedSocialUsername()}:void 0,authProvider:r.socialProvider||"email",accountType:(o=r.preferredAccountTypes)==null?void 0:o[t||s],isSmartAccountDeployed:!!r.smartAccountDeployed}:void 0}}subscribeAccount(t,n){const r=()=>{const s=this.getAccount(n);s&&t(s)};n?J.subscribeChainProp("accountState",r,n):J.subscribe(r),Pe.subscribe(r)}subscribeNetwork(t){return J.subscribe(({activeCaipNetwork:n})=>{t({caipNetwork:n,chainId:n==null?void 0:n.id,caipNetworkId:n==null?void 0:n.caipNetworkId})})}subscribeWalletInfo(t){return Et.subscribeKey("connectedWalletInfo",t)}subscribeShouldUpdateToAddress(t){Et.subscribeKey("shouldUpdateToAddress",t)}subscribeCaipNetworkChange(t){J.subscribeKey("activeCaipNetwork",t)}getState(){return Sm.state}subscribeState(t){return Sm.subscribe(t)}showErrorMessage(t){vs.showError(t)}showSuccessMessage(t){vs.showSuccess(t)}getEvent(){return{...bn.state}}subscribeEvents(t){return bn.subscribe(t)}replace(t){Le.replace(t)}redirect(t){Le.push(t)}popTransactionStack(t){Le.popTransactionStack(t)}isOpen(){return ir.state.open}isTransactionStackEmpty(){return Le.state.transactionStack.length===0}static getInstance(){return this.instance}updateFeatures(t){we.setFeatures(t)}updateRemoteFeatures(t){we.setRemoteFeatures(t)}updateOptions(t){const r={...we.state||{},...t};we.setOptions(r)}setConnectMethodsOrder(t){we.setConnectMethodsOrder(t)}setWalletFeaturesOrder(t){we.setWalletFeaturesOrder(t)}setCollapseWallets(t){we.setCollapseWallets(t)}setSocialsOrder(t){we.setSocialsOrder(t)}getConnectMethodsOrder(){return hy.getConnectOrderMethod(we.state.features,Pe.getConnectors())}addNetwork(t,n){if(this.chainAdapters&&!this.chainAdapters[t])throw new Error(`Adapter for namespace ${t} doesn't exist`);const r=this.extendCaipNetwork(n,this.options);this.getCaipNetworks().find(s=>s.id===r.id)||J.addNetwork(r)}removeNetwork(t,n){if(this.chainAdapters&&!this.chainAdapters[t])throw new Error(`Adapter for namespace ${t} doesn't exist`);this.getCaipNetworks().find(s=>s.id===n)&&J.removeNetwork(t,n)}}let Eoe=!1;class n5e extends _xt{async open(t){Pe.isConnected()||await super.open(t)}async close(){await super.close(),this.options.manualWCControl&&He.finalizeWcConnection()}async syncIdentity(t){return Promise.resolve()}async syncBalance(t){return Promise.resolve()}
vendor: 6,001 bytes, lines 1052-1056
1052async injectModalUi(){if(!Eoe&&Re.isClient()){if(await te(()=>Promise.resolve().then(()=>DMt),void 0),await te(()=>Promise.resolve().then(()=>XMt),void 0),!document.querySelector("w3m-modal")){const n=document.createElement("w3m-modal");!we.state.disableAppend&&!we.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",n)}Eoe=!0}}}const Nxt="1.7.8";function Txt(e){return new n5e({...e,basic:!0,sdkVersion:`html-core-${Nxt}`})}const Pxt=Object.freeze(Object.defineProperty({__proto__:null,AppKit:n5e,createAppKit:Txt},Symbol.toStringTag,{value:"Module"}));class r5e{constructor(t){this.getNonce=t.getNonce}async createMessage(t){const n={accountAddress:t.accountAddress,chainId:t.chainId,version:"1",domain:typeof document>"u"?"Unknown Domain":document.location.host,uri:typeof document>"u"?"Unknown URI":document.location.href,resources:this.resources,nonce:await this.getNonce(t),issuedAt:this.stringifyDate(new Date),statement:void 0,expirationTime:void 0,notBefore:void 0};return Object.assign(n,{toString:()=>this.stringify(n)})}stringify(t){var r;const n=this.getNetworkName(t.chainId);return[`${t.domain} wants you to sign in with your ${n} account:`,t.accountAddress,t.statement?` 1053${t.statement} 1054`:"",`URI: ${t.uri}`,`Version: ${t.version}`,`Chain ID: ${t.chainId}`,`Nonce: ${t.nonce}`,t.issuedAt&&`Issued At: ${t.issuedAt}`,t.expirationTime&&`Expiration Time: ${t.expirationTime}`,t.notBefore&&`Not Before: ${t.notBefore}`,t.requestId&&`Request ID: ${t.requestId}`,((r=t.resources)==null?void 0:r.length)&&t.resources.reduce((s,i)=>`${s} 1055- ${i}`,"Resources:")].filter(s=>typeof s=="string").join(` 1056`).trim()}getNetworkName(t){const n=G.getAllRequestedCaipNetworks();return PW.getNetworkNameByCaipNetworkId(n,t)}stringifyDate(t){return t.toISOString()}}class Oxt{constructor(t={}){this.otpUuid=null,this.listeners={sessionChanged:[]},this.localAuthStorageKey=t.localAuthStorageKey||ft.SIWX_AUTH_TOKEN,this.localNonceStorageKey=t.localNonceStorageKey||ft.SIWX_NONCE_TOKEN,this.required=t.required??!0,this.messenger=new r5e({getNonce:this.getNonce.bind(this)})}async createMessage(t){return this.messenger.createMessage(t)}async addSession(t){const n=await this.request({method:"POST",key:"authenticate",body:{data:t.data,message:t.message,signature:t.signature,clientId:this.getClientId(),walletInfo:this.getWalletInfo()},headers:["nonce","otp"]});this.setStorageToken(n.token,this.localAuthStorageKey),this.emit("sessionChanged",t),this.setAppKitAccountUser(kxt(n.token)),this.otpUuid=null}async getSessions(t,n){try{if(!this.getStorageToken(this.localAuthStorageKey))return[];const r=await this.request({method:"GET",key:"me",query:{},headers:["auth"]});if(!r)return[];const s=r.address.toLowerCase()===n.toLowerCase(),i=r.caip2Network===t;if(!s||!i)return[];const o={data:{accountAddress:r.address,chainId:r.caip2Network},message:"",signature:""};return this.emit("sessionChanged",o),this.setAppKitAccountUser(r),[o]}catch{return[]}}async revokeSession(t,n){return Promise.resolve(this.clearStorageTokens())}async setSessions(t){if(t.length===0)this.clearStorageTokens();else{const n=t.find(r=>{var s;return r.data.chainId===((s=kE())==null?void 0:s.caipNetworkId)})||t[0];await this.addSession(n)}}getRequired(){return this.required}async getSessionAccount(){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"GET",key:"me",body:void 0,query:{includeAppKitAccount:!0},headers:["auth"]})}async setSessionAccountMetadata(t=null){if(!this.getStorageToken(this.localAuthStorageKey))throw new Error("Not authenticated");return this.request({method:"PUT",key:"account-metadata",body:{metadata:t},headers:["auth"]})}on(t,n){return this.listeners[t].push(n),()=>{this.listeners[t]=this.listeners[t].filter(r=>r!==n)}}removeAllListeners(){Object.keys(this.listeners).forEach(n=>{this.listeners[n]=[]})}async requestEmailOtp({email:t,account:n}){const r=await this.request({method:"POST",key:"otp",body:{email:t,account:n}});return this.otpUuid=r.uuid,this.messenger.resources=[`email:${t}`],r}confirmEmailOtp({code:t}){return this.request({method:"PUT",key:"otp",body:{code:t},headers:["otp"]})}async request({method:t,key:n,query:r,body:s,headers:i}){var d;const{projectId:o,st:a,sv:c}=this.getSDKProperties(),l=new URL(`${he.W3M_API_URL}/auth/v1/${String(n)}`);l.searchParams.set("projectId",o),l.searchParams.set("st",a),l.searchParams.set("sv",c),r&&Object.entries(r).forEach(([h,f])=>l.searchParams.set(h,String(f)));const u=await fetch(l,{method:t,body:s?JSON.stringify(s):void 0,headers:Array.isArray(i)?i.reduce((h,f)=>{switch(f){case"nonce":h["x-nonce-jwt"]=`Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;break;case"auth":h.Authorization=`Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;break;case"otp":this.otpUuid&&(h["x-otp"]=this.otpUuid);break}return h},{}):void 0});if(!u.ok)throw new Error(await u.text());return(d=u.headers.get("content-type"))!=null&&d.includes("application/json")?u.json():null}getStorageToken(t){return at.getItem(t)}setStorageToken(t,n){at.setItem(n,t)}clearStorageTokens(){this.otpUuid=null,at.removeItem(this.localAuthStorageKey),at.removeItem(this.localNonceStorageKey),this.emit("sessionChanged",void 0)}async getNonce(){const{nonce:t,token:n}=await this.request({method:"GET",key:"nonce"});return this.setStorageToken(n,this.localNonceStorageKey),t}getClientId(){return Pt.state.clientId}getWalletInfo(){var i;const t=(i=G.getAccountData())==null?void 0:i.connectedWalletInfo;if(!t)return;if("social"in t&&"identifier"in t){const o=t.social,a=t.identifier;return{type:"social",social:o,identifier:a}}const{name:n,icon:r}=t;let s="unknown";switch(t.type){case"EXTERNAL":case"INJECTED":case"ANNOUNCED":s="extension";break;case"WALLET_CONNECT":s="walletconnect";break;default:s="unknown"}return{type:s,name:n,icon:r}}getSDKProperties(){return it._getSdkProperties()}emit(t,n){this.listeners[t].forEach(r=>r(n))}setAppKitAccountUser(t){const{email:n}=t;
1056n&&Object.values(he.CHAIN).forEach(r=>{G.setAccountProp("user",{email:n},r)})}}function kxt(e){const t=e.split(".");if(t.length!==3)throw new Error("Invalid token");const n=t[1];if(typeof n!="string")throw new Error("Invalid token");const r=n.replace(/-/gu,"+").replace(/_/gu,"/"),s=r.padEnd(r.length+(4-r.length%4)%4,"=");return JSON.parse(atob(s))}const Rxt=Object.freeze(Object.defineProperty({__proto__:null,ReownAuthentication:Oxt,ReownAuthenticationMessenger:r5e},Symbol.toStringTag,{value:"Module"}));const Bxt={attribute:!0,type:String,converter:IA,reflect:!1,hasChanged:sV},Dxt=(e=Bxt,t,n)=>{const{kind:r,metadata:s}=n;let i=globalThis.litPropertyMetadata.get(s);if(i===void 0&&globalThis.litPropertyMetadata.set(s,i=new Map),r==="setter"&&((e=Object.create(e)).wrapped=!0),i.set(n.name,e),r==="accessor"){const{name:o}=n;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(r==="setter"){const{name:o}=n;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,e,!0,a)}}throw Error("Unsupported decorator location: "+r)};function z(e){return(t,n)=>typeof n=="object"?Dxt(e,t,n):((r,s,i)=>{const o=s.hasOwnProperty(i);return s.constructor.createProperty(i,r),o?Object.getOwnPropertyDescriptor(s,i):void 0})(e,t,n)}function se(e){return z({...e,state:!0,attribute:!1})}const Uxt=Symbol(),Coe=Object.getPrototypeOf,FF=new WeakMap,Lxt=e=>e&&(FF.has(e)?FF.get(e):Coe(e)===Object.prototype||Coe(e)===Array.prototype),Mxt=e=>Lxt(e)&&e[Uxt]||null,$oe=(e,t=!0)=>{FF.set(e,t)},qA={},DV=e=>typeof e=="object"&&e!==null,jxt=e=>DV(e)&&!$$.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise),s5e=(e,t)=>{const n=zF.get(e);if((n==null?void 0:n[0])===t)return n[1];const r=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return $oe(r,!0),zF.set(e,[t,r]),Reflect.ownKeys(e).forEach(s=>{if(Object.getOwnPropertyDescriptor(r,s))return;const i=Reflect.get(e,s),{enumerable:o}=Reflect.getOwnPropertyDescriptor(e,s),a={value:i,enumerable:o,configurable:!0};if($$.has(i))$oe(i,!1);else if(Zm.has(i)){const[c,l]=Zm.get(i);a.value=s5e(c,l())}Object.defineProperty(r,s,a)}),Object.preventExtensions(r)},Fxt=(e,t,n,r)=>({deleteProperty(s,i){const o=Reflect.get(s,i);n(i);const a=Reflect.deleteProperty(s,i);return a&&r(["delete",[i],o]),a},set(s,i,o,a){const c=!e()&&Reflect.has(s,i),l=Reflect.get(s,i,a);if(c&&(xoe(l,o)||$4.has(o)&&xoe(l,$4.get(o))))return!0;n(i),DV(o)&&(o=Mxt(o)||o);const u=!Zm.has(o)&&qxt(o)?qr(o):o;return t(i,u),Reflect.set(s,i,u,a),r(["set",[i],o,l]),!0}}),Zm=new WeakMap,$$=new WeakSet,zF=new WeakMap,US=[1],$4=new WeakMap;let xoe=Object.is,zxt=(e,t)=>new Proxy(e,t),qxt=jxt,Wxt=s5e,Hxt=Fxt;function qr(e={}){if(!DV(e))throw new Error("object required");const t=$4.get(e);if(t)return t;let n=US[0];const r=new Set,s=(m,w=++US[0])=>{n!==w&&(i=n=w,r.forEach(C=>C(m,w)))};let i=n;const o=(m=US[0])=>(i!==m&&(i=m,c.forEach(([w])=>{const C=w[1](m);C>n&&(n=C)})),n),a=m=>(w,C)=>{const E=[...w];E[1]=[m,...E[1]],s(E,C)},c=new Map,l=(m,w)=>{const C=!$$.has(w)&&Zm.get(w);if(C){if((qA?"production":void 0)!=="production"&&c.has(m))throw new Error("prop listener already exists");if(r.size){const E=C[2](a(m));c.set(m,[C,E])}else c.set(m,[C])}},u=m=>{var w;const C=c.get(m);C&&(c.delete(m),(w=C[1])==null||w.call(C))},d=m=>(r.add(m),r.size===1&&c.forEach(([C,E],b)=>{if((qA?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const S=C[2](a(b));c.set(b,[C,S])}),()=>{r.delete(m),r.size===0&&c.forEach(([C,E],b)=>{E&&(E(),c.set(b,[C]))})});let h=!0;const f=Hxt(()=>h,l,u,s),g=zxt(e,f);$4.set(e,g);const p=[e,o,d];return Zm.set(g,p),Reflect.ownKeys(e).forEach(m=>{const w=Object.getOwnPropertyDescriptor(e,m);"value"in w&&w.writable&&(g[m]=e[m])}),h=!1,g}function Ji(e,t,n){const r=Zm.get(e);(qA?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let s;const i=[],o=r[2];let a=!1;const l=o(u=>
1056{i.push(u),s||(s=Promise.resolve().then(()=>{s=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,l()}}function x4(e){const t=Zm.get(e);(qA?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[n,r]=t;return Wxt(n,r())}function I4(e){return $$.add(e),e}function Vxt(){return{proxyStateMap:Zm,refSet:$$,snapCache:zF,versionHolder:US,proxyCache:$4}}function Xi(e,t,n,r){let s=e[t];return Ji(e,()=>{const i=e[t];Object.is(s,i)||n(s=i)})}const{proxyStateMap:Kxt,snapCache:Gxt}=Vxt(),zI=e=>Kxt.has(e);function Zxt(e){const t=[];let n=0;const r=new Map,s=new WeakMap,i=()=>{const l=Gxt.get(a),u=l==null?void 0:l[1];if(u&&!s.has(u)){const d=new Map(r);s.set(u,d)}},o=l=>s.get(l)||r,a={data:t,index:n,epoch:0,get size(){return zI(this)||i(),o(this).size},get(l){const d=o(this).get(l);if(d===void 0){this.epoch;return}return this.data[d]},has(l){const u=o(this);return this.epoch,u.has(l)},set(l,u){if(!zI(this))throw new Error("Cannot perform mutations on a snapshot");const d=r.get(l);return d===void 0?(r.set(l,this.index),this.data[this.index++]=u):this.data[d]=u,this.epoch++,this},delete(l){if(!zI(this))throw new Error("Cannot perform mutations on a snapshot");const u=r.get(l);return u===void 0?!1:(delete this.data[u],r.delete(l),this.epoch++,!0)},clear(){if(!zI(this))throw new Error("Cannot perform mutations on a snapshot");this.data.length=0,this.index=0,this.epoch++,r.clear()},forEach(l){this.epoch,o(this).forEach((d,h)=>{l(this.data[d],h,this)})},*entries(){this.epoch;const l=o(this);for(const[u,d]of l)yield[u,this.data[d]]},*keys(){this.epoch;const l=o(this);for(const u of l.keys())yield u},*values(){this.epoch;const l=o(this);for(const u of l.values())yield this.data[u]},[Symbol.iterator](){return this.entries()},get[Symbol.toStringTag](){return"Map"},toJSON(){return new Map(this.entries())}},c=qr(a);return Object.defineProperties(c,{size:{enumerable:!1},index:{enumerable:!1},epoch:{enumerable:!1},data:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(c),c}const i5e={isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}};var Ioe={};const ye={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",BASE_ACCOUNT:"baseAccount",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122",TON:"ton",TRON:"tron"}
1056,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos",sui:"Sui",stacks:"Stacks",ton:"TON",tron:"TRON"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",TON:"ton",TRON:"tron"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],SOLANA_SPL_TOKEN_ADDRESSES:{SOL:"So11111111111111111111111111111111111111112"},NATIVE_IMAGE_IDS_BY_NAMESPACE:{eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"3e8119e5-2a6f-4818-c50c-1937011d5900",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},TOKEN_SYMBOLS_BY_ADDRESS:{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"USDC","0x833589fcd6edb6e08f4c7c32d4f71b54bda02913":"USDC","0x0b2c639c533813f4aa9d7837caf62653d097ff85":"USDC","0xaf88d065e77c8cc2239327c5edb3a432268e5831":"USDC","0x3c499c542cef5e3811e1192ce70d8cc03d5c3359":"USDC","0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"USDC",EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:"USDC","0xdac17f958d2ee523a2206206994597c13d831ec7":"USDT","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58":"USDT","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9":"USDT","0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"USDT",Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:"USDT"},HTTP_STATUS_CODES:{SERVER_ERROR:500,TOO_MANY_REQUESTS:429,SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof process<"u"&&typeof Ioe<"u"?Ioe.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",REMOTE_FEATURES_ALERTS:{MULTI_WALLET_NOT_ENABLED:{DEFAULT:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com."},CONNECTIONS_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnections hook."},CONNECTION_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnection hook."}},HEADLESS_NOT_ENABLED:{DEFAULT:{displayMessage:"",debugMessage:"Headless support is not enabled. Please enable it with the features.headless option in the AppKit configuration and make sure your current plan supports it."}}},IS_DEVELOPMENT:typeof process<"u"&&!1,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://localhost:*","http://127.0.0.1:*","https://127.0.0.1:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"],METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH"},Yxt={caipNetworkIdToNumber(e){return e?Number(e.split(":")[1]):void 0},parseEvmChainId(e){return typeof e=="string"?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace(e,t){return(e==null?void 0:e.filter(n=>n.chainNamespace===t))||[]},getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]},getNetworkNameByCaipNetworkId(e,t){var s;if(!t)return;const n=e.find(i=>i.caipNetworkId===t);if(n)return n.name;const[r]=t.split(":");return((s=ye.CHAIN_NAME_MAP)==null?void 0:s[r])||void 0}},o5e=["eip155","solana","polkadot","bip122","cosmos","sui","stacks"],hs={bigNumber(e,t={safe:!1}){try{return e?new An(e):new An(0)}catch(n){if(t.safe)return new An(0);throw n}},formatNumber(e,t){const{decimals:n,round:r=8,safe:s=!0}=t;return hs.bigNumber(e,{safe:s}).div(new An(10).pow(n)).round(r)},multiply(e,t){if(e===void 0||t===void 0)return new An(0);const n=new An(e),r=new An(t);return n.times(r)},toFixed(e,t=2){return e===void 0||e===""?new An(0).toFixed(t):new An(e).toFixed(t)},formatNumberToLocalString(e,t=2){return e===void 0||e===""?"0.00":typeof e=="number"?e.toLocaleStr
vendor: 4,570 bytes, line 1056
1056ing("en-US",{maximumFractionDigits:t,minimumFractionDigits:t,roundingMode:"floor"}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t,roundingMode:"floor"})},parseLocalStringToNumber(e){if(e===void 0||e==="")return 0;const t=e.replace(/,/gu,"");return new An(t).toNumber()}},Jxt=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],Xxt=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],Qxt=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],eIt={getERC20Abi:e=>ye.USDT_CONTRACT_ADDRESSES.includes(e)?Qxt:Jxt,getSwapAbi:()=>Xxt},F2={ConnectorExplorerIds:{[ye.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[ye.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[ye.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[ye.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[ye.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[ye.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[ye.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[ye.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[ye.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[ye.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[ye.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[ye.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[ye.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[ye.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[ye.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[ye.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[ye.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[ye.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[ye.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"}},jh={validateCaipAddress(e){var t;if(((t=e.split(":"))==null?void 0:t.length)!==3)throw new Error("Invalid CAIP Address");return e},parseCaipAddress(e){const t=e.split(":");if(t.length!==3)throw new Error(`Invalid CAIP-10 address: ${e}`);const[n,r,s]=t;if(!n||!r||!s)throw new Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:n,chainId:r,address:s}},parseCaipNetworkId(e){const t=e.split(":");if(t.length!==2)throw new Error(`Invalid CAIP-2 network id: ${e}`);const[n,r]=t;if(!n||!r)throw new Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:n,chainId:r}}},Ed={RPC_ERROR_CODE:{USER_REJECTED_REQUEST:4001,USER_REJECTED_METHODS:5002,USER_REJECTED:5e3,SEND_TRANSACTION_ERROR:5001},PROVIDER_RPC_ERROR_NAME:{PROVIDER_RPC:"ProviderRpcError",USER_REJECTED_REQUEST:"UserRejectedRequestError",SEND_TRANSACTION_ERROR:"SendTransactionError"},isRpcProviderError(e){try{if(typeof e=="object"&&e!==null){const t=e,n=typeof t.message=="string",r=typeof t.code=="number";return n&&r}return!1}catch{return!1}},isUserRejectedMessage(e){return e.toLowerCase().includes("user rejected")||e.toLowerCase().includes("user cancelled")||e.toLowerCase().includes("user canceled")},isUserRejectedRequestError(e){if(Ed.isRpcProviderError(e)){const t=e.code===Ed.RPC_ERROR_CODE.USER_REJECTED_REQUEST,n=e.code===Ed.RPC_ERROR_CODE.USER_REJECTED_METHODS;return t||n||Ed.isUserRejectedMessage(e.message)}return e instanceof Error?Ed.isUserRejectedMessage(e.message):!1}};
1056let tIt=class extends Error{constructor(t,n){super(n.message,{cause:t}),this.name=Ed.PROVIDER_RPC_ERROR_NAME.PROVIDER_RPC,this.code=n.code}},nIt=class extends tIt{constructor(t){super(t,{code:Ed.RPC_ERROR_CODE.USER_REJECTED_REQUEST,message:"User rejected the request"}),this.name=Ed.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST}};const wt={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",RECENT_WALLET:"@appkit/recent_wallet",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections",DISCONNECTED_CONNECTOR_IDS:"@appkit/disconnected_connector_ids",HISTORY_TRANSACTIONS_CACHE:"@appkit/history_transactions_cache",TOKEN_PRICE_CACHE:"@appkit/token_price_cache",RECENT_EMAILS:"@appkit/recent_emails",LATEST_APPKIT_VERSION:"@appkit/latest_version",TON_WALLETS_CACHE:"@appkit/ton_wallets_cache"};function qB(e){if(!e)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}const ut={setItem(e,t){qI()&&t!==void 0&&localStorage.setItem(e,t)},getItem(e){if(qI())return localStorage.getItem(e)||void 0},removeItem(e){qI()&&localStorage.removeItem(e)},clear(){qI()&&localStorage.clear()}};function qI(){return typeof window<"u"&&typeof localStorage<"u"}function WA(e,t){const n=(e==null?void 0:e["--apkt-accent"])??(e==null?void 0:e["--w3m-accent"]);return t==="light"?{"--w3m-accent":n||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":n||"hsla(230, 100%, 67%, 1)","--w3m-background":"#202020"}}var Soe={};const WB=(typeof process<"u"&&typeof Soe<"u"?Soe.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",is={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:WB,SECURE_SITE_DASHBOARD:`${WB}/dashboard`,SECURE_SITE_FAVICON:`${WB}/images/favicon.png`,SOLANA_NATIVE_TOKEN_ADDRESS:"So11111111111111111111111111111111111111111",RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],SUGGESTED_TOKENS_BY_CHAIN:{"eip155:42161":["USDâ®0"]},BALANCE_SUPPORTED_CHAINS:[ye.CHAIN.EVM,ye.CHAIN.SOLANA],SEND_PARAMS_SUPPORTED_CHAINS:[ye.CHAIN.EVM],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:[ye.CHAIN.EVM],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:[ye.CHAIN.EVM,ye.CHAIN.SOLANA],PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES:[ye.CHAIN.EVM,ye.CHAIN.SOLANA],ACTIVITY_ENABLED_CHAIN_NAMESPACES:[ye.CHAIN.EVM,ye.CHAIN.TON],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x",sui:"0x",stacks:"0x",ton:"0x",tron:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in the wallet app",WEB:"Open and continue in the wallet app"},SEND_SUPPORTED_NAMESPACES:[ye.CHAIN.EVM,ye.CHAIN.SOLANA],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0,multiWallet:!1,emailCapture:!1,payWithExchange:!1,payments:!1,reownAuthentication:!1,headless:!1},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1,emailCapture:!1,reownAuthentication:!1,headless:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","
1056injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1,reownAuthentication:!1,headless:!1},DEFAULT_SOCIALS:["google","x","farcaster","discord","apple","github","facebook"],DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa",ton:"eoa",tron:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"},SIWX_DEFAULTS:{signOutOnDisconnect:!0},MANDATORY_WALLET_IDS_ON_MOBILE:[F2.ConnectorExplorerIds[ye.CONNECTOR_ID.COINBASE],F2.ConnectorExplorerIds[ye.CONNECTOR_ID.COINBASE_SDK],F2.ConnectorExplorerIds[ye.CONNECTOR_ID.BASE_ACCOUNT],F2.ConnectorExplorerIds[ye.SOLFLARE_CONNECTOR_NAME],F2.ConnectorExplorerIds[ye.PHANTOM_CONNECTOR_NAME],F2.ConnectorExplorerIds[ye.BINANCE_CONNECTOR_NAME]],DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"]},Ye={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5,transactionsHistory:15e3,tokenPrice:15e3,latestAppKitVersion:6048e5,tonWallets:864e5},isCacheExpired(e,t){return Date.now()-e>t},getActiveNetworkProps(){const e=Ye.getActiveNamespace(),t=Ye.getActiveCaipNetworkId(),n=t?t.split(":")[1]:void 0,r=n?isNaN(Number(n))?n:Number(n):void 0;return{namespace:e,caipNetworkId:t,chainId:r}},setWalletConnectDeepLink({name:e,href:t}){try{ut.setItem(wt.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const e=ut.getItem(wt.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{ut.removeItem(wt.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{ut.setItem(wt.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{ut.setItem(wt.ACTIVE_CAIP_NETWORK_ID,e),Ye.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return ut.getItem(wt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{ut.removeItem(wt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{const t=qB(e);ut.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{const t=Ye.getRecentWallets();t.find(r=>r.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),ut.setItem(wt.RECENT_WALLETS,JSON.stringify(t)),ut.setItem(wt.RECENT_WALLET,JSON.stringify(e)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const e=ut.getItem(wt.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},getRecentWallet(){try{const e=ut.getItem(wt.RECENT_WALLET);return e?JSON.parse(e):null}catch{console.info("Unable to get AppKit recent")}return null},deleteRecentWallet(){try{ut.removeItem(wt.RECENT_WALLET)}catch{console.info("Unable to delete AppKit recent")}},setConnectedConnectorId(e,t){try{const n=qB(e);ut.setItem(n,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return ut.getItem(wt.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{const t=qB(e);return ut.getItem(t)}catch{console.info("Unable to get connected connector id in namespace",e)}},setConnectedSocialProvider(e){try{ut.setItem(wt.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return ut.getItem(wt.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{ut.removeItem(wt.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return ut.getItem(wt.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var n;const e=ut.getItem(wt.ACTIVE_CAIP_NETWORK_ID);return(n=e==null?void 0:e.split(":"))==null?void 0:n[1]},setConnectionStatus(e){try{ut.setItem(wt.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return ut.getItem(wt.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const e=ut.getItem(wt.CONNECTED_NAMESPACES);return e!=null&&e.length?e.split(","):[]}catch{return[]}},setConnectedNamespaces(e){try{const t=Array.from(new Set(e));ut.setItem(wt.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{const t=Ye.getConnectedNamespaces();t.includes(e)||(t.push(e),Ye.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{const t=Ye.getConnectedNamespaces(),n=t.indexOf(e);n>-1&&(t.splice(n,1),Ye.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return ut.getItem(wt.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{ut.setItem(wt.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{ut.removeItem(wt.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{const t=ut.getItem(wt.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{const t=Ye.getBalanceCache();ut.setItem(wt.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{const n=Ye.getBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.portfolio))return n.balance;Ye.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{const t=Ye.getBalanceCache();t[e.caipAddress]=e,ut.setItem(wt.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{const t=ut.getItem(wt.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{const t=Ye.getBalanceCache();ut.setItem(wt.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{const n=Ye.getNativeBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.nativeBalance))return n;console.info("Discarding cache for address",e),Ye.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{const t=Ye.getNativeBalanceCache();t[e.caipAddress]=e,ut.setItem(wt.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{const t=ut.getItem(wt.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e}
vendor: 5,174 bytes, line 1056
1056,getEnsFromCacheForAddress(e){try{const n=Ye.getEnsCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.ens))return n.ens;Ye.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{const t=Ye.getEnsCache();t[e.address]=e,ut.setItem(wt.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{const t=Ye.getEnsCache();ut.setItem(wt.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{const t=ut.getItem(wt.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{const n=Ye.getIdentityCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.identity))return n.identity;Ye.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{const t=Ye.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},ut.setItem(wt.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{const t=Ye.getIdentityCache();ut.setItem(wt.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},getTonWalletsCache(){try{const e=ut.getItem(wt.TON_WALLETS_CACHE),t=e?JSON.parse(e):void 0;if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.tonWallets))return t;Ye.removeTonWalletsCache()}catch{console.info("Unable to get ton wallets cache")}},updateTonWalletsCache(e){try{const t=Ye.getTonWalletsCache()||{timestamp:0,wallets:[]};t.timestamp=new Date().getTime(),t.wallets=e,ut.setItem(wt.TON_WALLETS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ton wallets cache",e)}},removeTonWalletsCache(){try{ut.removeItem(wt.TON_WALLETS_CACHE)}catch{console.info("Unable to remove ton wallets cache")}},clearAddressCache(){try{ut.removeItem(wt.PORTFOLIO_CACHE),ut.removeItem(wt.NATIVE_BALANCE_CACHE),ut.removeItem(wt.ENS_CACHE),ut.removeItem(wt.IDENTITY_CACHE),ut.removeItem(wt.HISTORY_TRANSACTIONS_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(e){try{ut.setItem(wt.PREFERRED_ACCOUNT_TYPES,JSON.stringify(e))}catch{console.info("Unable to set preferred account types",e)}},getPreferredAccountTypes(){try{const e=ut.getItem(wt.PREFERRED_ACCOUNT_TYPES);return e?JSON.parse(e):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(e,t){try{const n=Ye.getConnections(),r=n[t]??[],s=new Map;for(const o of r)s.set(o.connectorId,{...o});for(const o of e){const a=s.get(o.connectorId),c=o.connectorId===ye.CONNECTOR_ID.AUTH;if(a&&!c){const l=new Set(a.accounts.map(d=>d.address.toLowerCase())),u=o.accounts.filter(d=>!l.has(d.address.toLowerCase()));a.accounts.push(...u)}else s.set(o.connectorId,{...o})}const i={...n,[t]:Array.from(s.values())};ut.setItem(wt.CONNECTIONS,JSON.stringify(i))}catch(n){console.error("Unable to sync connections to storage",n)}},getConnections(){try{const e=ut.getItem(wt.CONNECTIONS);return e?JSON.parse(e):{}}catch(e){return console.error("Unable to get connections from storage",e),{}}},deleteAddressFromConnection({connectorId:e,address:t,namespace:n}){try{const r=Ye.getConnections(),s=r[n]??[],i=new Map(s.map(a=>[a.connectorId,a])),o=i.get(e);o&&(o.accounts.filter(c=>c.address.toLowerCase()!==t.toLowerCase()).length===0?i.delete(e):i.set(e,{...o,accounts:o.accounts.filter(c=>c.address.toLowerCase()!==t.toLowerCase())})),ut.setItem(wt.CONNECTIONS,JSON.stringify({...r,[n]:Array.from(i.values())}))}catch{console.error(`Unable to remove address "${t}" from connector "${e}" in namespace "${n}"`)}},getDisconnectedConnectorIds(){try{const e=ut.getItem(wt.DISCONNECTED_CONNECTOR_IDS);return e?JSON.parse(e):{}}catch{console.info("Unable to get disconnected connector ids")}return{}},addDisconnectedConnectorId(e,t){try{const n=Ye.getDisconnectedConnectorIds(),r=n[t]??[];r.push(e),ut.setItem(wt.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[t]:Array.from(new Set(r))}))}catch{console.error(`Unable to set disconnected connector id "${e}" for namespace "${t}"`)}},removeDisconnectedConnectorId(e,t){try{const n=Ye.getDisconnectedConnectorIds();let r=n[t]??[];r=r.filter(s=>s.toLowerCase()!==e.toLowerCase()),ut.setItem(wt.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[t]:Array.from(new Set(r))}))}catch{console.error(`Unable to remove disconnected connector id "${e}" for namespace "${t}"`)}},isConnectorDisconnected(e,t){try{return(Ye.getDisconnectedConnectorIds()[t]??[]).some(s=>s.toLowerCase()===e.toLowerCase())}catch{console.info(`Unable to get disconnected connector id "${e}" for namespace "${t}"`)}return!1},getTransactionsCache(){try{const e=ut.getItem(wt.HISTORY_TRANSACTIONS_CACHE);return e?JSON.parse(e):{}}catch{console.info("Unable to get transactions cache")}return{}},getTransactionsCacheForAddress({address:e,chainId:t=""}){var n;try{const s=(n=Ye.getTransactionsCache()[e])==null?void 0:n[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.transactionsHistory)
1056)return s.transactions;Ye.removeTransactionsCache({address:e,chainId:t})}catch{console.info("Unable to get transactions cache")}},updateTransactionsCache({address:e,chainId:t="",timestamp:n,transactions:r}){try{const s=Ye.getTransactionsCache();s[e]={...s[e],[t]:{timestamp:n,transactions:r}},ut.setItem(wt.HISTORY_TRANSACTIONS_CACHE,JSON.stringify(s))}catch{console.info("Unable to update transactions cache",{address:e,chainId:t,timestamp:n,transactions:r})}},removeTransactionsCache({address:e,chainId:t}){try{const n=Ye.getTransactionsCache(),r=(n==null?void 0:n[e])||{},{[t]:s,...i}=r;ut.setItem(wt.HISTORY_TRANSACTIONS_CACHE,JSON.stringify({...n,[e]:i}))}catch{console.info("Unable to remove transactions cache",{address:e,chainId:t})}},getTokenPriceCache(){try{const e=ut.getItem(wt.TOKEN_PRICE_CACHE);return e?JSON.parse(e):{}}catch{console.info("Unable to get token price cache")}return{}},getTokenPriceCacheForAddresses(e){try{const n=Ye.getTokenPriceCache()[e.join(",")];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.tokenPrice))return n.tokenPrice;Ye.removeTokenPriceCache(e)}catch{console.info("Unable to get token price cache for addresses",e)}},updateTokenPriceCache(e){try{const t=Ye.getTokenPriceCache();t[e.addresses.join(",")]={timestamp:e.timestamp,tokenPrice:e.tokenPrice},ut.setItem(wt.TOKEN_PRICE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update token price cache",e)}},removeTokenPriceCache(e){try{const t=Ye.getTokenPriceCache();ut.setItem(wt.TOKEN_PRICE_CACHE,JSON.stringify({...t,[e.join(",")]:void 0}))}catch{console.info("Unable to remove token price cache",e)}},getLatestAppKitVersion(){try{const e=this.getLatestAppKitVersionCache(),t=e==null?void 0:e.version;return t&&!this.isCacheExpired(e.timestamp,this.cacheExpiry.latestAppKitVersion)?t:void 0}catch{console.info("Unable to get latest AppKit version")}},getLatestAppKitVersionCache(){try{const e=ut.getItem(wt.LATEST_APPKIT_VERSION);return e?JSON.parse(e):{}}catch{console.info("Unable to get latest AppKit version cache")}return{}},updateLatestAppKitVersion(e){try{const t=Ye.getLatestAppKitVersionCache();t.timestamp=e.timestamp,t.version=e.version,ut.setItem(wt.LATEST_APPKIT_VERSION,JSON.stringify(t))}catch{console.info("Unable to update latest AppKit version on local storage",e)}}},Be={getWindow(){if(!(typeof window>"u"))return window},isMobile(){var e;return this.isClient()?!!(window!=null&&window.matchMedia&&typeof window.matchMedia=="function"&&((e=window.matchMedia("(pointer:coarse)"))!=null&&e.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(e,t=""){return e==null?void 0:e.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return Be.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(e){return e?e-Date.now()<=is.TEN_SEC_MS:!0},isAllowedRetry(e,t=is.ONE_SEC_MS){return Date.now()-e>=t},copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var e,t;if(Be.isClient()&&window.self!==window.top)try{const n=(t=(e=window==null?void 0:window.location)==null?void 0:e.ancestorOrigins)==null?void 0:t[0],r="https://app.safe.global";if(n){const s=new URL(n),i=new URL(r);return s.hostname===i.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+is.FOUR_MINUTES_MS},getNetworkId(e){return e==null?void 0:e.split(":")[1]},getPlainAddress(e){return e==null?void 0:e.split(":")[2]},async wait(e){return new Promise(t=>{setTimeout(t,e)})},debounce(e,t=500){let n;return(...r)=>{function s(){e(...r)}n&&clearTimeout(n),n=setTimeout(s,t)}},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},formatNativeUrl(e,t,n=null){if(Be.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e,s=n;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),s&&!(s!=null&&s.endsWith("/"))&&(s=`${s}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));const i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,redirectUniversalLink:s?`${s}wc?uri=${i}`:void 0,href:r}},formatUniversalUrl(e,t){if(!Be.isHttpUrl(e))return this.formatNativeUrl(e,t);let n=e;n.endsWith("/")||(n=`${n}/`);const r=encodeURIComponent(t);return{redirect:`${n}wc?uri=${r}`,href:n}},getOpenTargetForPlatform(e){return e==="popupWindow"?e:this.isTelegram()?Ye.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,n){window==null||window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},returnOpenHref(e,t,n){return window==null?void 0:window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var n,r;if(typeof window>"u")return!1;const e=window!=null&&window.matchMedia&&typeof window.matchMedia=="function"?(n=window.matchMedia("(display-mode: standalone)"))==null?void 0:n.matches:!1,t=(r=window==null?void 0:window.navigator)==null?void 0:r.standalone;return!!(e||t)},async preloadImage(e){const t=new Promise((n,r)=>{const s=new Image;s.onload=n,s.onerror=r,s.crossOrigin="anonymous",s.src=e});return Promise.race([t,Be.wait(2e3)])},parseBalance(e,t){let n="0.000";if(typeof e=="string"){const c=Number(e);if(!isNaN(c)){const l=(Math.floor(c*1e3)/1e3).toFixed(3);l&&(n=l)}}const[r,s]=n.split("."),i=r||"0",o=s||"000";return{formattedText:`${i}.${o}${t?` ${t}`:""}`,value:i,decimals:o,symbol:t}},getApiUrl(){return ye.W3M_API_URL},getBlockchainApiUrl(){return ye.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return ye.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},parseError(e){var t,n;return typeof e=="string"?e:typeof((n=(t=e==null?void 0:e.issues)==null?void 0:t[0])==null?void 0:n.message)=="str
1056ing"?e.issues[0].message:e instanceof Error?e.message:"Unknown error"},sortRequestedNetworks(e,t=[]){const n={};return t&&e&&(e.forEach((r,s)=>{n[r]=s}),t.sort((r,s)=>{const i=n[r.id],o=n[s.id];return i!==void 0&&o!==void 0?i-o:i!==void 0?-1:o!==void 0?1:0})),t},calculateBalance(e){let t=0;for(const n of e)t+=n.value??0;return t},formatTokenBalance(e){const t=e.toFixed(2),[n,r]=t.split(".");return{dollars:n,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);case"bip122":{const n=/^[1][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(e),r=/^[3][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(e),s=/^bc1[a-z0-9]{39,87}$/u.test(e),i=/^bc1p[a-z0-9]{58}$/u.test(e);return n||r||s||i}default:return!1}},uniqueBy(e,t){const n=new Set;return e.filter(r=>{const s=r[t];return n.has(s)?!1:(n.add(s),!0)})},generateSdkVersion(e,t,n){const s=e.length===0?is.ADAPTER_TYPES.UNIVERSAL:e.map(i=>i.adapterType).join(",");return`${t}-${s}-${n}`},createAccount(e){const{chainNamespace:t,chainId:n,address:r}=jh.parseCaipAddress(e.caipAddress);return{namespace:t,address:r,chainId:n,caipAddress:e.caipAddress,type:e.type,publicKey:e.publicKey,path:e.path}},isCaipAddress(e){if(typeof e!="string")return!1;const t=e.split(":"),n=t[0];return t.filter(Boolean).length===3&&n in ye.CHAIN_NAME_MAP},getAccount(e){return e?typeof e=="string"?{address:e,chainId:void 0}:{address:e.address,chainId:e.chainId}:{address:void 0,chainId:void 0}},isMac(){const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){const t=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,n="state=";if(new URL(e).host==="auth.magic.link"){const s="provider_authorization_url=",i=e.substring(e.indexOf(s)+s.length),o=this.injectIntoUrl(decodeURIComponent(i),n,t);return e.replace(i,encodeURIComponent(o))}return this.injectIntoUrl(e,n,t)},injectIntoUrl(e,t,n){const r=e.indexOf(t);if(r===-1)throw new Error(`${t} parameter not found in the URL: ${e}`);const s=e.indexOf("&",r),i=t.length,o=s!==-1?s:e.length,a=e.substring(0,r+i),c=e.substring(r+i,o),l=e.substring(s),u=c+n;return a+u+l},isNumber(e){return typeof e!="number"&&typeof e!="string"?!1:!isNaN(Number(e))},appendPayToUri(e,t){return t?`${e}&pay=${encodeURIComponent(t)}`:e}},LS={STORAGE_KEY:"@appkit-wallet/",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS"},sl={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}},rIt={set(e,t){HB.isClient&&localStorage.setItem(`${LS.STORAGE_KEY}${e}`,t)}
1056,get(e){return HB.isClient?localStorage.getItem(`${LS.STORAGE_KEY}${e}`):null},delete(e,t){HB.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${LS.STORAGE_KEY}${e}`))}},HB={isClient:typeof window<"u"};function At(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:i=>t(e,i)}function Fd(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new v5e(e.type);return`${e.name}(${MT(e.inputs,{includeName:t})})`}function MT(e,{includeName:t=!1}={}){return e?e.map(n=>sIt(n,{includeName:t})).join(t?", ":","):""}function sIt(e,{includeName:t}){return e.type.startsWith("tuple")?`(${MT(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Iu(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function es(e){return Iu(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const a5e="2.47.6";let gE={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${a5e}`},Ee=class qF extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof qF?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof qF&&n.cause.docsPath||n.docsPath,i=(a=gE.getDocsUrl)==null?void 0:a.call(gE,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...gE.version?[`Version: ${gE.version}`]:[]].join(` 1057`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=a5e}walk(t){return c5e(this,t)}};function c5e(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?c5e(e.cause,t):t?null:e}let l5e=class extends Ee{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` 1058`),{docsPath:t,name:"AbiConstructorNotFoundError"})}},WF=class extends Ee{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` 1059`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}},UV=class extends Ee{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(` 1060`),{metaMessages:[`Params: (${MT(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}},W6=class extends Ee{constructor({cause:t}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:t})}},u5e=class extends Ee{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(` 1061`),{name:"AbiEncodingArrayLengthMismatchError"})}},d5e=class extends Ee{constructor({expectedSize:t,value:n}
vendor: 4,259 bytes, lines 1061-1071
1061){super(`Size of bytes "${n}" (bytes${es(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},h5e=class extends Ee{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(` 1062`),{name:"AbiEncodingLengthMismatchError"})}},f5e=class extends Ee{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(` 1063`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}},HF=class extends Ee{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(` 1064`),{docsPath:n,name:"AbiErrorNotFoundError"})}},LV=class extends Ee{constructor(t,{docsPath:n,cause:r}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 1065`),{docsPath:n,name:"AbiErrorSignatureNotFoundError",cause:r}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}},p5e=class extends Ee{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}},g5e=class extends Ee{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 1066`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}},VF=class extends Ee{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(` 1067`),{docsPath:n,name:"AbiEventNotFoundError"})}},fy=class extends Ee{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` 1068`),{docsPath:n,name:"AbiFunctionNotFoundError"})}},MV=class extends Ee{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(` 1069`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}},m5e=class extends Ee{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 1070`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}},iIt=class extends Ee{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Fd(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Fd(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}},w5e=class extends Ee{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}},S4=class extends Ee{constructor({abiItem:t,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(` 1071`),{metaMessages:[`Params: (${MT(r,{includeName:!0})})`,`Data: ${n} (${s} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=s}}
1071,jT=class extends Ee{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Fd(t,{includeName:!0})}".`].join(` 1072`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}},y5e=class extends Ee{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` 1073`),{docsPath:n,name:"InvalidAbiEncodingType"})}},b5e=class extends Ee{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` 1074`),{docsPath:n,name:"InvalidAbiDecodingType"})}},jV=class extends Ee{constructor(t){super([`Value "${t}" is not a valid array.`].join(` 1075`),{name:"InvalidArrayError"})}},v5e=class extends Ee{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` 1076`),{name:"InvalidDefinitionTypeError"})}},E5e=class extends Ee{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}},FV=class extends Ee{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},zV=class extends Ee{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}},Aoe=class extends Ee{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}};function vb(e,{dir:t,size:n=32}={}){return typeof e=="string"?d0(e,{dir:t,size:n}):C5e(e,{dir:t,size:n})}function d0(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new zV({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function C5e(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new zV({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let FT=class extends Ee{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},$5e=class extends Ee{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}},x5e=class extends Ee{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}},I5e=class extends Ee{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function km(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function oh(e,{size:t}){if(es(e)>t)throw new I5e({givenSize:es(e),maxSize:t})}function zd(e,t={}){const{signed:n}=t;t.size&&oh(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function S5e(e,t={}){let n=e;if(t.size&&(oh(n,{size:t.size}),n=km(n)),km(n)==="0x00")return!1;if(km(n)==="0x01")return!0;throw new x5e(n)}function cf(e,t={}){const n=zd(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new FT({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const oIt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function $0(e,t={}){return typeof e=="number"||typeof e=="bigint"?Rt(e,t):typeof e=="string"?R5(e,t):typeof e=="boolean"?qV(e,t):Bs(e,t)}function qV(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(oh(n,{size:t.size}),vb(n,{size:t.size})):n}function Bs(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=oIt[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(oh(r,{size:t.size}),vb(r,{dir:"right",size:t.size})):r}function Rt(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new FT({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?vb(a,{size:r}):a}const aIt=new TextEncoder;function R5(e,t={}){const n=aIt.encode(e);return Bs(n,t)}const cIt=new TextEncoder;
1076function Eb(e,t={}){return typeof e=="number"||typeof e=="bigint"?_5e(e,t):typeof e=="boolean"?A5e(e,t):Iu(e)?qd(e,t):Rm(e,t)}function A5e(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(oh(n,{size:t.size}),vb(n,{size:t.size})):n}const Xf={zero:48,nine:57,A:65,F:70,a:97,f:102};function _oe(e){if(e>=Xf.zero&&e<=Xf.nine)return e-Xf.zero;if(e>=Xf.A&&e<=Xf.F)return e-(Xf.A-10);if(e>=Xf.a&&e<=Xf.f)return e-(Xf.a-10)}function qd(e,t={}){let n=e;t.size&&(oh(n,{size:t.size}),n=vb(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=_oe(r.charCodeAt(a++)),l=_oe(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new Ee(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[o]=c*16+l}return i}function _5e(e,t){const n=Rt(e,t);return qd(n)}function Rm(e,t={}){const n=cIt.encode(e);return typeof t.size=="number"?(oh(n,{size:t.size}),vb(n,{dir:"right",size:t.size})):n}function Ni(e,t){const n=t||"hex",r=U0(Iu(e,{strict:!1})?Eb(e):e);return n==="bytes"?r:$0(r)}const lIt=e=>Ni(Eb(e));function uIt(e){return lIt(e)}function dIt(e){let t=!0,n="",r=0,s="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new Ee("Unable to normalize signature.");return s}const VE=e=>{const t=typeof e=="string"?e:vu(e);return dIt(t)};function HA(e){return uIt(VE(e))}const B5=HA;let x0=class extends Ee{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},zT=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,n)),n}set(t,n){if(super.has(t)&&super.delete(t),super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=super.keys().next().value;r!==void 0&&super.delete(r)}return this}};const VB=new zT(8192);function x$(e,t){if(VB.has(`${e}.${t}`))return VB.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ni(Rm(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const i=`0x${s.join("")}`;return VB.set(`${e}.${t}`,i),i}function A4(e,t){if(!ml(e,{strict:!1}))throw new x0({address:e});return x$(e,t)}const hIt=/^0x[a-fA-F0-9]{40}$/,KB=new zT(8192);function ml(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(KB.has(r))return KB.get(r);const s=hIt.test(e)?e.toLowerCase()===e?!0:n?x$(e)===e:!0:!1;return KB.set(r,s),s}function Su(e){return typeof e[0]=="string"?Cb(e):N5e(e)}function N5e(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function Cb(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Ym(e,t,n,{strict:r}={}){return Iu(e,{strict:!1})?O5e(e,t,n,{strict:r}):WV(e,t,n,{strict:r})}function T5e(e,t){if(typeof t=="number"&&t>0&&t>es(e)-1)throw new FV({offset:t,position:"start",size:es(e)})}function P5e(e,t,n){if(typeof t=="number"&&typeof n=="number"&&es(e)!==n-t)throw new FV({offset:n,position:"end",size:es(e)})}function WV(e,t,n,{strict:r}={}){T5e(e,t);const s=e.slice(t,n);return r&&P5e(s,t,n),s}function O5e(e,t,n,{strict:r}={}){T5e(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&P5e(s,t,n),s}const fIt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,k5e=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function W0(e,t){if(e.length!==t.length)throw new h5e({expectedLength:e.length,givenLength:t.length});const n=pIt({params:e,values:t}),r=VV(n);return r.length===0?"0x":r}function pIt({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(HV({param:e[r],value:t[r]}));return n}function HV({param:e,value:t}){const n=KV(e.type);if(n){const[r,s]=n;return mIt(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return EIt(t,{param:e});if(e.type==="address")return gIt(t);if(e.type==="bool")return yIt(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=k5e.exec(e.type)??[];return bIt(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return wIt(t,{param:e});if(e.type==="string")return vIt(t);throw new y5e(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function VV(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=es(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(Rt(t+s,{size:32})),r.push(a),s+=es(a)):n.push(a)}return Su([...n,...r])}function gIt(e){if(!ml(e))throw new x0({address:e});return{dynamic:!1,encoded:d0(e.toLowerCase())}}function mIt(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new jV(e);if(!r&&e.length!==t)throw new u5e({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const i=[];for(let o=0;o<e.length;o++){const a=HV({param:n,value:e[o]});a.dynamic&&(s=!0),i.push(a)}if(r||s){const o=VV(i);if(r){const a=Rt(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?Su([a,o]):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Su(i.map(({encoded:o})=>o))}}function wIt(e,{param:t}){const[,n]=t.type.split("bytes"),r=es(e);if(!n){let s=e;return r%32!==0&&(s=d0(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Su([d0(Rt(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new d5e({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:d0(e,{dir:"right"})}}function yIt(e){if(typeof e!="boolean")throw new Ee(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:d0(qV(e))}}function bIt(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new FT({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Rt(e,{size:32,signed:t})}}function vIt(e){const t=R5(e),n=Math.ceil(es(t)/32),r=[];for(let s=0;s<n;s++)r.push(d0(Ym(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Su([d0(Rt(es(t),{size:32})),...r])}}function EIt(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;
1076s++){const i=t.components[s],o=Array.isArray(e)?s:i.name,a=HV({param:i,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?VV(r):Su(r.map(({encoded:s})=>s))}}function KV(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const py=e=>Ym(HA(e),0,4);function m1(e){const{abi:t,args:n=[],name:r}=e,s=Iu(r,{strict:!1}),i=t.filter(a=>s?a.type==="function"?py(a)===r:a.type==="event"?B5(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let o;for(const a of i){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((l,u)=>{const d="inputs"in a&&a.inputs[u];return d?KF(l,d):!1})){if(o&&"inputs"in o&&o.inputs){const l=R5e(a.inputs,o.inputs,n);if(l)throw new iIt({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||i[0]}function KF(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ml(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>n==="object"&&KF(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>KF(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function R5e(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return R5e(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?ml(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?ml(n[r],{strict:!1}):!1)return o}}const Noe="/docs/contract/encodeEventTopics";function H6(e){var c;const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const l=m1({abi:t,name:n});if(!l)throw new VF(n,{docsPath:Noe});s=l}if(s.type!=="event")throw new VF(void 0,{docsPath:Noe});const i=Fd(s),o=B5(i);let a=[];if(r&&"inputs"in s){const l=(c=s.inputs)==null?void 0:c.filter(d=>"indexed"in d&&d.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(d=>r[d.name]))??[]:[];u.length>0&&(a=(l==null?void 0:l.map((d,h)=>Array.isArray(u[h])?u[h].map((f,g)=>Toe({param:d,value:u[h][g]})):typeof u[h]<"u"&&u[h]!==null?Toe({param:d,value:u[h]}):null))??[])}return[o,...a]}function Toe({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Ni(Eb(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new E5e(e.type);return W0([e],[t])}function qT(e,{method:t}){var r,s;const n={};return e.transport.type==="fallback"&&((s=(r=e.transport).onResponse)==null||s.call(r,({method:i,response:o,status:a,transport:c})=>{a==="success"&&t===i&&(n[o]=c.request)})),(i=>n[i]||e.request)}async function B5e(e,t){const{address:n,abi:r,args:s,eventName:i,fromBlock:o,strict:a,toBlock:c}=t,l=qT(e,{method:"eth_newFilter"}),u=i?H6({abi:r,args:s,eventName:i}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?Rt(o):o,toBlock:typeof c=="bigint"?Rt(c):c,topics:u}]});return{abi:r,args:s,eventName:i,id:d,request:l(d),strict:!!a,type:"event"}}function wl(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Poe="/docs/contract/encodeFunctionData";function D5e(e){const{abi:t,args:n,functionName:r}=e;let s=t[0];if(r){const i=m1({abi:t,args:n,name:r});if(!i)throw new fy(r,{docsPath:Poe});s=i}if(s.type!=="function")throw new fy(void 0,{docsPath:Poe});return{abi:[s],functionName:py(Fd(s))}}function _l(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var a;return e.abi.length===1&&((a=e.functionName)!=null&&a.startsWith("0x"))?e:D5e(e)})(),s=n[0],i=r,o="inputs"in s&&s.inputs?W0(s.inputs,t??[]):void 0;return Cb([i,o??"0x"])}
vendor: 5,317 bytes, line 1076
1076const CIt={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},U5e={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},$It={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let Ooe=class extends Ee{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},L5e=class extends Ee{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},xIt=class extends Ee{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const IIt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new xIt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new L5e({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Ooe({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Ooe({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function GV(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(IIt);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function M5e(e,t={}){typeof t.size<"u"&&oh(e,{size:t.size});const n=Bs(e,t);return zd(n,t)}function j5e(e,t={}){let n=e;if(typeof t.size<"u"&&(oh(n,{size:t.size}),n=km(n)),n.length>1||n[0]>1)throw new $5e(n);return!!n[0]}function Xh(e,t={}){typeof t.size<"u"&&oh(e,{size:t.size});const n=Bs(e,t);return cf(n,t)}function F5e(e,t={}){let n=e;return typeof t.size<"u"&&(oh(n,{size:t.size}),n=km(n,{dir:"right"})),new TextDecoder().decode(n)}function V6(e,t){const n=typeof t=="string"?qd(t):t,r=GV(n);if(es(n)===0&&e.length>0)throw new W6;if(es(t)&&es(t)<32)throw new UV({data:typeof t=="string"?t:Bs(t),params:e,size:es(t)});let s=0;const i=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(s);const[c,l]=Xv(r,a,{staticPosition:0});s+=l,i.push(c)}return i}function Xv(e,t,{staticPosition:n}){const r=KV(t.type);if(r){const[s,i]=r;return AIt(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return PIt(e,t,{staticPosition:n});if(t.type==="address")return SIt(e);
1076if(t.type==="bool")return _It(e);if(t.type.startsWith("bytes"))return NIt(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return TIt(e,t);if(t.type==="string")return OIt(e,{staticPosition:n});throw new b5e(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const koe=32,GF=32;function SIt(e){const t=e.readBytes(32);return[x$(Bs(WV(t,-20))),32]}function AIt(e,t,{length:n,staticPosition:r}){if(!n){const o=Xh(e.readBytes(GF)),a=r+o,c=a+koe;e.setPosition(a);const l=Xh(e.readBytes(koe)),u=_4(t);let d=0;const h=[];for(let f=0;f<l;++f){e.setPosition(c+(u?f*32:d));const[g,p]=Xv(e,t,{staticPosition:c});d+=p,h.push(g)}return e.setPosition(r+32),[h,32]}if(_4(t)){const o=Xh(e.readBytes(GF)),a=r+o,c=[];for(let l=0;l<n;++l){e.setPosition(a+l*32);const[u]=Xv(e,t,{staticPosition:a});c.push(u)}return e.setPosition(r+32),[c,32]}let s=0;const i=[];for(let o=0;o<n;++o){const[a,c]=Xv(e,t,{staticPosition:r+s});s+=c,i.push(a)}return[i,s]}function _It(e){return[j5e(e.readBytes(32),{size:32}),32]}function NIt(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=Xh(e.readBytes(32));e.setPosition(n+o);const a=Xh(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Bs(c),32]}return[Bs(e.readBytes(Number.parseInt(s,10),32)),32]}function TIt(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?M5e(s,{signed:n}):Xh(s,{signed:n}),32]}function PIt(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),s=r?[]:{};let i=0;if(_4(t)){const o=Xh(e.readBytes(GF)),a=n+o;for(let c=0;c<t.components.length;++c){const l=t.components[c];e.setPosition(a+i);const[u,d]=Xv(e,l,{staticPosition:a});i+=d,s[r?c:l==null?void 0:l.name]=u}return e.setPosition(n+32),[s,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,l]=Xv(e,a,{staticPosition:n});s[r?o:a==null?void 0:a.name]=c,i+=l}return[s,i]}function OIt(e,{staticPosition:t}){const n=Xh(e.readBytes(32)),r=t+n;e.setPosition(r);const s=Xh(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=F5e(km(i));return e.setPosition(t+32),[o,32]}function _4(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(_4);const n=KV(e.type);return!!(n&&_4({...e,type:n[1]}))}function ZV(e){const{abi:t,data:n,cause:r}=e,s=Ym(n,0,4);if(s==="0x")throw new W6({cause:r});const o=[...t||[],U5e,$It].find(a=>a.type==="error"&&s===py(Fd(a)));if(!o)throw new LV(s,{docsPath:"/docs/contract/decodeErrorResult",cause:r});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?V6(o.inputs,Ym(n,4)):void 0,errorName:o.name}}const Os=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n);function z5e({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((s,i)=>`${r&&s.name?`${s.name}: `:""}${typeof t[i]=="object"?Os(t[i]):t[i]}`).join(", ")})`}const q5e={gwei:9,wei:18},W5e={ether:-9,wei:9};function I$(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${i?`.${i}`:""}`}function WT(e,t="wei"){return I$(e,q5e[t])}function ca(e,t="wei"){return I$(e,W5e[t])}let H5e=class extends Ee{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}},V5e=class extends Ee{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}};function Roe(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r} 1077`,"")}function kIt(e){return e.reduce((t,{address:n,...r})=>{let s=`${t} ${n}: 1078`;return r.nonce&&(s+=` nonce: ${r.nonce} 1079`),r.balance&&(s+=` balance: ${r.balance} 1080`),r.code&&(s+=` code: ${r.code} 1081`),r.state&&(s+=` state: 1082`,s+=Roe(r.state)),r.stateDiff&&(s+=` stateDiff: 1083`,s+=Roe(r.stateDiff)),s},` State Override: 1084`).slice(0,-1)}function S$(e){const t=Object.entries(e).map(([r,s])=>
1084s===void 0||s===!1?null:[r,s]).filter(Boolean),n=t.reduce((r,[s])=>Math.max(r,s.length),0);return t.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(` 1085`)}let K5e=class extends Ee{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",S$(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}},G5e=class extends Ee{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h}){var g;const f=S$({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${WT(h)} ${((g=s==null?void 0:s.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${ca(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ca(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ca(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",f].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},YV=class extends Ee{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i}){let o="Transaction";r&&i!==void 0&&(o=`Transaction at block time "${r}" at index "${i}"`),t&&i!==void 0&&(o=`Transaction at block hash "${t}" at index "${i}"`),n&&i!==void 0&&(o=`Transaction at block number "${n}" at index "${i}"`),s&&(o=`Transaction with hash "${s}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}},JV=class extends Ee{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}},RIt=class extends Ee{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}},Z5e=class extends Ee{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}};const BIt=e=>e,A$=e=>e;let XV=class extends Ee{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h,stateOverride:f}){var m;const g=n?wl(n):void 0;let p=S$({from:g==null?void 0:g.address,to:d,value:typeof h<"u"&&`${WT(h)} ${((m=s==null?void 0:s.nativeCurrency)==null?void 0:m.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${ca(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ca(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ca(l)} gwei`,nonce:u});f&&(p+=` 1086${kIt(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",p].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},QV=class extends Ee{constructor(t,{abi:n,args:r,contractAddress:s,docsPath:i,functionName:o,sender:a}){const c=m1({abi:n,args:r,name:o}),l=c?z5e({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=c?Fd(c,{includeName:!0}):void 0,d=S$({address:s&&BIt(s),function:u,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(
1086Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=s,this.functionName=o,this.sender=a}},VA=class extends Ee{constructor({abi:t,data:n,functionName:r,message:s,cause:i}){let o,a,c,l;if(n&&n!=="0x")try{a=ZV({abi:t,data:n,cause:i});const{abiItem:d,errorName:h,args:f}=a;if(h==="Error")l=f[0];else if(h==="Panic"){const[g]=f;l=CIt[g]}else{const g=d?Fd(d,{includeName:!0}):void 0,p=d&&f?z5e({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[g?`Error: ${g}`:"",p&&p!=="()"?` ${[...Array((h==null?void 0:h.length)??0).keys()].map(()=>" ").join("")}${p}`:""]}}catch(d){o=d}else s&&(l=s);let u;o instanceof LV&&(u=o.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${u}.`]),super(l&&l!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,l||u].join(` 1087`):`The contract function "${r}" reverted.`,{cause:o??i,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=n,this.reason=l,this.signature=u}},Y5e=class extends Ee{constructor({functionName:t,cause:n}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:n})}},J5e=class extends Ee{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}},_$=class extends Ee{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}},Bm=class extends Ee{constructor({body:t,cause:n,details:r,headers:s,status:i,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${A$(o)}`,t&&`Request body: ${Os(t)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=s,this.status=i,this.url=o}},HT=class extends Ee{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${A$(r)}`,`Request body: ${Os(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}
1087,ZF=class extends Ee{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${A$(n)}`,`Request body: ${Os(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}};const DIt=-1;let wa=class extends Ee{constructor(t,{code:n,docsPath:r,metaMessages:s,name:i,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:s||(t==null?void 0:t.metaMessages),name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||t.name,this.code=t instanceof HT?t.code:n??DIt}},ya=class extends wa{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}},KA=class X5e extends wa{constructor(t){super(t,{code:X5e.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}};Object.defineProperty(KA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let GA=class Q5e extends wa{constructor(t){super(t,{code:Q5e.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}};Object.defineProperty(GA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let ZA=class e6e extends wa{constructor(t,{method:n}={}){super(t,{code:e6e.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}};Object.defineProperty(ZA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let YA=class t6e extends wa{constructor(t){super(t,{code:t6e.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` 1088`)})}};Object.defineProperty(YA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let D5=class n6e extends wa{constructor(t){super(t,{code:n6e.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}};Object.defineProperty(D5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let gy=class r6e extends wa{constructor(t){super(t,{code:r6e.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` 1089`)})}};Object.defineProperty(gy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let JA=class s6e extends wa{constructor(t){super(t,{code:s6e.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(JA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let XA=class i6e extends wa{constructor(t){super(t,{code:i6e.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}};Object.defineProperty(XA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let N4=class o6e extends wa{constructor(t){super(t,{code:o6e.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}};Object.defineProperty(N4,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let _v=class a6e extends wa{constructor(t,{method:n}={}){super(t,{code:a6e.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}};Object.defineProperty(_v,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let T4=class c6e extends wa{constructor(t){super(t,{code:c6e.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}};Object.defineProperty(T4,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let QA=class l6e extends wa{constructor(t){super(t,{code:l6e.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}};Object.defineProperty(QA,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let Qv=class u6e extends ya{constructor(t){super(t,{code:u6e.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(Qv,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let e_=class d6e extends ya{constructor(t){super(t,{code:d6e.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}};Object.defineProperty(e_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let t_=class h6e extends ya{constructor(t,{method:n}={}){super(t,{code:h6e.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}};Object.defineProperty(t_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let n_=class f6e extends ya{constructor(t){super(t,{code:f6e.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}};Object.defineProperty(n_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let r_=class p6e extends ya{constructor(t){super(t,{code:p6e.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}};Object.defineProperty(r_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});
1089let s_=class g6e extends ya{constructor(t){super(t,{code:g6e.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}};Object.defineProperty(s_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let i_=class m6e extends ya{constructor(t){super(t,{code:m6e.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}};Object.defineProperty(i_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});let o_=class w6e extends ya{constructor(t){super(t,{code:w6e.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}};Object.defineProperty(o_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});let a_=class y6e extends ya{constructor(t){super(t,{code:y6e.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}};Object.defineProperty(a_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});let c_=class b6e extends ya{constructor(t){super(t,{code:b6e.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}};Object.defineProperty(c_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});let l_=class v6e extends ya{constructor(t){super(t,{code:v6e.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}};Object.defineProperty(l_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});let u_=class E6e extends ya{constructor(t){super(t,{code:E6e.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}};Object.defineProperty(u_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});let d_=class C6e extends ya{constructor(t){super(t,{code:C6e.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}};Object.defineProperty(d_,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});let h_=class $6e extends ya{constructor(t){super(t,{code:$6e.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}};Object.defineProperty(h_,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});let x6e=class extends wa{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}};const UIt=3;function my(e,{abi:t,address:n,args:r,docsPath:s,functionName:i,sender:o}){const a=e instanceof _$?e:e instanceof Ee?e.walk(g=>"data"in g)||e.walk():{},{code:c,data:l,details:u,message:d,shortMessage:h}=a,f=e instanceof W6?new Y5e({functionName:i,cause:e}):[UIt,D5.code].includes(c)&&(l||u||d||h)||c===gy.code&&u==="execution reverted"&&l?new VA({abi:t,data:typeof l=="object"?l.data:l,functionName:i,message:a instanceof HT?u:h??d,cause:e}):e;return new QV(f,{abi:t,args:r,contractAddress:n,docsPath:s,functionName:i,sender:o})}function LIt(e){const t=Ni(`0x${e.substring(4)}`).substring(26);return x$(`0x${t}`)}async function I6e({hash:e,signature:t}){const n=Iu(e)?e:$0(e),{secp256k1:r}=await te(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>UAt);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:d,yParity:h}=t,f=Number(h??d),g=Boe(f);return new r.Signature(zd(l),zd(u)).addRecoveryBit(g)}const o=Iu(t)?t:$0(t);if(es(o)!==65)throw new Error("invalid signature length");const a=cf(`0x${o.slice(130)}`),c=Boe(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Boe(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function f_({hash:e,signature:t}){return LIt(await I6e({hash:e,signature:t}))}function S6e(e,t="hex"){const n=A6e(e),r=GV(new Uint8Array(n.length));return n.encode(r),t==="hex"?Bs(r.bytes):r.bytes}function A6e(e){return Array.isArray(e)?MIt(e.map(t=>A6e(t))):jIt(e)}function MIt(e){const t=e.reduce((s,i)=>s+i.length,0),n=_6e(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:i}of e)i(s)}}}function jIt(e){const t=typeof e=="string"?qd(e):e,n=_6e(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function _6e(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new Ee("Length is too large.")}function FIt(e){const{chainId:t,nonce:n,to:r}=e,s=e.contractAddress??e.address,i=Ni(Cb(["0x05",S6e([t?Rt(t):"0x",s,n?Rt(n):"0x"])]));return r==="bytes"?qd(i):i}async function N6e(e){const{authorization:t,signature:n}=e;return f_({hash:FIt(t),signature:n??t})}
1089let T6e=class extends Ee{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h}){var g;const f=S$({from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${WT(h)} ${((g=s==null?void 0:s.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${ca(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ca(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ca(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},fm=class extends Ee{constructor({cause:t,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(fm,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(fm,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});let P4=class extends Ee{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ca(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(P4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});let p_=class extends Ee{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ca(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}};Object.defineProperty(p_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});let g_=class extends Ee{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}};
1089Object.defineProperty(g_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});let m_=class extends Ee{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` 1090`),{cause:t,name:"NonceTooLowError"})}};Object.defineProperty(m_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});let w_=class extends Ee{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}};Object.defineProperty(w_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let y_=class extends Ee{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` 1091`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(y_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});let b_=class extends Ee{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(b_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});let v_=class extends Ee{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(v_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});let E_=class extends Ee{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(E_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});let O4=class extends Ee{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${ca(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${ca(r)} gwei`:""}).`].join(` 1092`),{cause:t,name:"TipAboveFeeCapError"})}};Object.defineProperty(O4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});let K6=class extends Ee{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}};function VT(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof Ee?e.walk(s=>(s==null?void 0:s.code)===fm.code):e;return r instanceof Ee?new fm({cause:e,message:r.details}):fm.nodeMessage.test(n)?new fm({cause:e,message:e.details}):P4.nodeMessage.test(n)?new P4({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):p_.nodeMessage.test(n)?new p_({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):g_.nodeMessage.test(n)?new g_({cause:e,nonce:t==null?void 0:t.nonce}):m_.nodeMessage.test(n)?new m_({cause:e,nonce:t==null?void 0:t.nonce}):w_.nodeMessage.test(n)?new w_({cause:e,nonce:t==null?void 0:t.nonce}):y_.nodeMessage.test(n)?new y_({cause:e}):b_.nodeMessage.test(n)?new b_({cause:e,gas:t==null?void 0:t.gas}):v_.nodeMessage.test(n)?new v_({cause:e,gas:t==null?void 0:t.gas}):E_.nodeMessage.test(n)?new E_({cause:e}):O4.nodeMessage.test(n)?new O4({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new K6({cause:e})}function zIt(e,{docsPath:t,...n}){const r=(()=>{const s=VT(e,n);return s instanceof K6?e:s})();
1092return new T6e(r,{docsPath:t,...n})}function KT(e,{format:t}){if(!t)return{};const n={};function r(i){const o=Object.keys(i);for(const a of o)a in e&&(n[a]=e[a]),i[a]&&typeof i[a]=="object"&&!Array.isArray(i[a])&&r(i[a])}const s=t(e||{});return r(s),n}const P6e={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function G6(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=qIt(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Bs(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=Rt(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=Rt(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=Rt(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=Rt(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=Rt(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=Rt(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=P6e[e.type]),typeof e.value<"u"&&(n.value=Rt(e.value)),n}function qIt(e){return e.map(t=>({address:t.address,r:t.r?Rt(BigInt(t.r)):t.r,s:t.s?Rt(BigInt(t.s)):t.s,chainId:Rt(t.chainId),nonce:Rt(t.nonce),...typeof t.yParity<"u"?{yParity:Rt(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Rt(t.v)}:{}}))}function Doe(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Aoe({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Aoe({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function WIt(e){const{balance:t,nonce:n,state:r,stateDiff:s,code:i}=e,o={};if(i!==void 0&&(o.code=i),t!==void 0&&(o.balance=Rt(t)),n!==void 0&&(o.nonce=Rt(n)),r!==void 0&&(o.state=Doe(r)),s!==void 0){if(o.state)throw new V5e;o.stateDiff=Doe(s)}return o}function eK(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ml(n,{strict:!1}))throw new x0({address:n});if(t[n])throw new H5e({address:n});t[n]=WIt(r)}return t}const O6e=2n**256n-1n;function $b(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:s}=e,i=t?wl(t):void 0;if(i&&!ml(i.address))throw new x0({address:i.address});if(s&&!ml(s))throw new x0({address:s});if(n&&n>O6e)throw new P4({maxFeePerGas:n});if(r&&n&&r>n)throw new O4({maxFeePerGas:n,maxPriorityFeePerGas:r})}let tK=class extends Ee{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}},GT=class extends Ee{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}},k6e=class extends Ee{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ca(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}},nK=class extends Ee{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}};const rK={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ZT(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?cf(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?cf(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?rK[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=HIt(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function HIt(e){return e.map(t=>
1092({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function sK(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ZT(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Sd(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:s}={}){var l,u,d;const i=s??!1,o=n!==void 0?Rt(n):void 0;let a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,i]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[o||r,i]},{dedupe:!!o}),!a)throw new nK({blockHash:t,blockNumber:n});return(((d=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:d.format)||sK)(a,"getBlock")}async function iK(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function VIt(e,t){return R6e(e,t)}async function R6e(e,t){var i,o;const{block:n,chain:r=e.chain,request:s}=t||{};try{const a=((i=r==null?void 0:r.fees)==null?void 0:i.maxPriorityFeePerGas)??((o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=n||await At(e,Sd,"getBlock")({}),u=await a({block:l,client:e,request:s});if(u===null)throw new Error;return u}if(typeof a<"u")return a;const c=await e.request({method:"eth_maxPriorityFeePerGas"});return zd(c)}catch{const[a,c]=await Promise.all([n?Promise.resolve(n):At(e,Sd,"getBlock")({}),At(e,iK,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new GT;const l=c-a.baseFeePerGas;return l<0n?0n:l}}async function KIt(e,t){return YF(e,t)}async function YF(e,t){var h,f;const{block:n,chain:r=e.chain,request:s,type:i="eip1559"}=t||{},o=await(async()=>{var g,p;return typeof((g=r==null?void 0:r.fees)==null?void 0:g.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:s}):((p=r==null?void 0:r.fees)==null?void 0:p.baseFeeMultiplier)??1.2})();if(o<1)throw new tK;const c=10**(((h=o.toString().split(".")[1])==null?void 0:h.length)??0),l=g=>g*BigInt(Math.ceil(o*c))/BigInt(c),u=n||await At(e,Sd,"getBlock")({});if(typeof((f=r==null?void 0:r.fees)==null?void 0:f.estimateFeesPerGas)=="function"){const g=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:s,type:i});if(g!==null)return g}if(i==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new GT;const g=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await R6e(e,{block:u,chain:r,request:s}),p=l(u.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??p+g,maxPriorityFeePerGas:g}}return{gasPrice:(s==null?void 0:s.gasPrice)??l(await At(e,iK,"getGasPrice")({}))}}async function B6e(e,{address:t,blockTag:n="latest",blockNumber:r}){const s=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?Rt(r):n]},{dedupe:!!r});return cf(s)}function oK(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>qd(i)):e.blobs,s=[];for(const i of r)s.push(Uint8Array.from(t.blobToKzgCommitment(i)));return n==="bytes"?s:s.map(i=>Bs(i))}function aK(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(o=>qd(o)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(o=>qd(o)):e.commitments,i=[];for(let o=0;o<r.length;o++){const a=r[o],c=s[o];i.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return n==="bytes"?i:i.map(o=>Bs(o))}function D6e(e,t){return yq(Iu(e,{strict:!1})?Eb(e):e)}
1092function U6e(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),s=D6e(t);return s.set([n],0),r==="bytes"?s:Bs(s)}function L6e(e){const{commitments:t,version:n}=e,r=e.to,s=[];for(const i of t)s.push(U6e({commitment:i,to:r,version:n}));return s}const Uoe=6,M6e=32,cK=4096,j6e=M6e*cK,Loe=j6e*Uoe-1-1*cK*Uoe;let GIt=class extends Ee{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}},ZIt=class extends Ee{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}};function F6e(e){const t=typeof e.data=="string"?qd(e.data):e.data,n=es(t);if(!n)throw new ZIt;if(n>Loe)throw new GIt({maxSize:Loe,size:n});const r=[];let s=!0,i=0;for(;s;){const o=GV(new Uint8Array(j6e));let a=0;for(;a<cK;){const c=t.slice(i,i+(M6e-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),s=!1;break}a++,i+=31}r.push(o)}return r.map(o=>Bs(o.bytes))}function z6e(e){const{data:t,kzg:n,to:r}=e,s=e.blobs??F6e({data:t}),i=e.commitments??oK({blobs:s,kzg:n,to:r}),o=e.proofs??aK({blobs:s,commitments:i,kzg:n,to:r}),a=[];for(let c=0;c<s.length;c++)a.push({blob:s[c],commitment:i[c],proof:o[c]});return a}function q6e(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new K5e({transaction:e})}function YIt(e,{docsPath:t,...n}){const r=(()=>{const s=VT(e,n);return s instanceof K6?e:s})();return new G5e(r,{docsPath:t,...n})}async function lK(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return cf(t)}async function W6e(e,t){var A,I,O,N,T;const{account:n=e.account,accessList:r,authorizationList:s,chain:i=e.chain,blobVersionedHashes:o,blobs:a,data:c,gas:l,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:f,nonce:g,nonceManager:p,to:m,type:w,value:C,...E}=t,b=await(async()=>{if(!n||!p||typeof g<"u")return g;const P=wl(n),_=i?i.id:await At(e,lK,"getChainId")({});return await p.consume({address:P.address,chainId:_,client:e})})();$b(t);const S=(I=(A=i==null?void 0:i.formatters)==null?void 0:A.transactionRequest)==null?void 0:I.format,x=(S||G6)({...KT(E,{format:S}),account:n?wl(n):void 0,accessList:r,authorizationList:s,blobs:a,blobVersionedHashes:o,data:c,gas:l,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:f,nonce:b,to:m,type:w,value:C},"fillTransaction");try{const P=await e.request({method:"eth_fillTransaction",params:[x]}),y=(((N=(O=i==null?void 0:i.formatters)==null?void 0:O.transaction)==null?void 0:N.format)||ZT)(P.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const $=await(async()=>{var D,U;if(typeof((D=i==null?void 0:i.fees)==null?void 0:D.baseFeeMultiplier)=="function"){const F=await At(e,Sd,"getBlock")({});return i.fees.baseFeeMultiplier({block:F,client:e,request:t})}return((U=i==null?void 0:i.fees)==null?void 0:U.baseFeeMultiplier)??1.2})();if($<1)throw new tK;const B=10**(((T=$.toString().split(".")[1])==null?void 0:T.length)??0),k=D=>D*BigInt(Math.ceil($*B))/BigInt(B);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=k(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=k(y.gasPrice)),{raw:P.raw,transaction:{from:x.from,...y}}}catch(P){throw YIt(P,{...t,chain:e.chain})}}const JIt=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Moe=new Map,GB=new zT(128);async function H6e(e,t){var b,S,v;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=JIt);const{account:r,chain:s=e.chain,nonceManager:i,parameters:o}=n,a=(()=>
1092{if(typeof(s==null?void 0:s.prepareTransactionRequest)=="function")return{fn:s.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(s==null?void 0:s.prepareTransactionRequest))return{fn:s.prepareTransactionRequest[0],runAt:s.prepareTransactionRequest[1].runAt}})();let c;async function l(){return c||(typeof n.chainId<"u"?n.chainId:s?s.id:(c=await At(e,lK,"getChainId")({}),c))}const u=r&&wl(r);let d=n.nonce;if(o.includes("nonce")&&typeof d>"u"&&u&&i){const x=await l();d=await i.consume({address:u.address,chainId:x,client:e})}a!=null&&a.fn&&((b=a.runAt)!=null&&b.includes("beforeFillTransaction"))&&(n=await a.fn({...n,chain:s},{phase:"beforeFillTransaction"}),d??(d=n.nonce));const f=((o.includes("blobVersionedHashes")||o.includes("sidecars"))&&n.kzg&&n.blobs||GB.get(e.uid)===!1||!["fees","gas"].some(A=>o.includes(A))?!1:!!(o.includes("chainId")&&typeof n.chainId!="number"||o.includes("nonce")&&typeof d!="number"||o.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||o.includes("gas")&&typeof n.gas!="bigint"))?await At(e,W6e,"fillTransaction")({...n,nonce:d}).then(x=>{const{chainId:A,from:I,gas:O,gasPrice:N,nonce:T,maxFeePerBlobGas:P,maxFeePerGas:_,maxPriorityFeePerGas:y,type:$,...R}=x.transaction;return GB.set(e.uid,!0),{...n,...I?{from:I}:{},...$&&!n.type?{type:$}:{},...typeof A<"u"?{chainId:A}:{},...typeof O<"u"?{gas:O}:{},...typeof N<"u"?{gasPrice:N}:{},...typeof T<"u"?{nonce:T}:{},...typeof P<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:P}:{},...typeof _<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:_}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in R&&typeof R.nonceKey<"u"?{nonceKey:R.nonceKey}:{}}}).catch(x=>{var O;const A=x;return A.name!=="TransactionExecutionError"||((O=A.walk)==null?void 0:O.call(A,N=>{var P;const T=N;return T.name==="MethodNotFoundRpcError"||T.name==="MethodNotSupportedRpcError"||((P=T.message)==null?void 0:P.includes("eth_fillTransaction is not available"))}))&&GB.set(e.uid,!1),n}):n;d??(d=f.nonce),n={...f,...u?{from:u==null?void 0:u.address}:{},...d?{nonce:d}:{}};const{blobs:g,gas:p,kzg:m,type:w}=n;a!=null&&a.fn&&((S=a.runAt)!=null&&S.includes("beforeFillParameters"))&&(n=await a.fn({...n,chain:s},{phase:"beforeFillParameters"}));let C;async function E(){return C||(C=await At(e,Sd,"getBlock")({blockTag:"latest"}),C)}if(o.includes("nonce")&&typeof d>"u"&&u&&!i&&(n.nonce=await At(e,B6e,"getTransactionCount")({address:u.address,blockTag:"pending"})),(o.includes("blobVersionedHashes")||o.includes("sidecars"))&&g&&m){const x=oK({blobs:g,kzg:m});if(o.includes("blobVersionedHashes")){const A=L6e({commitments:x,to:"hex"});n.blobVersionedHashes=A}if(o.includes("sidecars")){const A=aK({blobs:g,commitments:x,kzg:m}),I=z6e({blobs:g,commitments:x,proofs:A,to:"hex"});n.sidecars=I}}if(o.includes("chainId")&&(n.chainId=await l()),(o.includes("fees")||o.includes("type"))&&typeof w>"u")try{n.type=q6e(n)}catch{let x=Moe.get(e.uid);if(typeof x>"u"){const A=await E();x=typeof(A==null?void 0:A.baseFeePerGas)=="bigint",Moe.set(e.uid,x)}n.type=x?"eip1559":"legacy"}
1092if(o.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const x=await E(),{maxFeePerGas:A,maxPriorityFeePerGas:I}=await YF(e,{block:x,chain:s,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<I)throw new k6e({maxPriorityFeePerGas:I});n.maxPriorityFeePerGas=I,n.maxFeePerGas=A}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new GT;if(typeof n.gasPrice>"u"){const x=await E(),{gasPrice:A}=await YF(e,{block:x,chain:s,request:n,type:"legacy"});n.gasPrice=A}}return o.includes("gas")&&typeof p>"u"&&(n.gas=await At(e,uK,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),a!=null&&a.fn&&((v=a.runAt)!=null&&v.includes("afterFillParameters"))&&(n=await a.fn({...n,chain:s},{phase:"afterFillParameters"})),$b(n),delete n.parameters,n}async function uK(e,t){var o,a,c;const{account:n=e.account,prepare:r=!0}=t,s=n?wl(n):void 0,i=(()=>{if(Array.isArray(r))return r;if((s==null?void 0:s.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await N6e({authorization:t.authorizationList[0]}).catch(()=>{throw new Ee("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:d,blobs:h,blobVersionedHashes:f,blockNumber:g,blockTag:p,data:m,gas:w,gasPrice:C,maxFeePerBlobGas:E,maxFeePerGas:b,maxPriorityFeePerGas:S,nonce:v,value:x,stateOverride:A,...I}=r?await H6e(e,{...t,parameters:i,to:l}):t;if(w&&t.gas!==w)return w;const N=(typeof g=="bigint"?Rt(g):void 0)||p,T=eK(A);$b(t);const P=(c=(a=(o=e.chain)==null?void 0:o.formatters)==null?void 0:a.transactionRequest)==null?void 0:c.format,y=(P||G6)({...KT(I,{format:P}),account:s,accessList:u,authorizationList:d,blobs:h,blobVersionedHashes:f,data:m,gasPrice:C,maxFeePerBlobGas:E,maxFeePerGas:b,maxPriorityFeePerGas:S,nonce:v,to:l,value:x},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:T?[y,N??e.experimental_blockTag??"latest",T]:N?[y,N]:[y]}))}catch(l){throw zIt(l,{...t,account:s,chain:e.chain})}}async function XIt(e,t){var l;const{abi:n,address:r,args:s,functionName:i,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(l=e.dataSuffix)==null?void 0:l.value,...a}=t,c=_l({abi:n,args:s,functionName:i});try{return await At(e,uK,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...a})}catch(u){const d=a.account?wl(a.account):void 0;throw my(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:d==null?void 0:d.address})}}function wy(e,t){if(!ml(e,{strict:!1}))throw new x0({address:e});if(!ml(t,{strict:!1}))throw new x0({address:t});return e.toLowerCase()===t.toLowerCase()}function Wd(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const joe="/docs/contract/decodeEventLog";function k4(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[o,...a]=s;if(!o)throw new p5e({docsPath:joe});const c=t.find(w=>w.type==="event"&&o===B5(Fd(w)));if(!(c&&"name"in c)||c.type!=="event")throw new g5e(o,{docsPath:joe});const{name:l,inputs:u}=c,d=u==null?void 0:u.some(w=>!("name"in w&&w.name)),h=d?[]:{},f=u.map((w,C)=>[w,C]).filter(([w])=>"indexed"in w&&w.indexed),g=[];for(let w=0;w<f.length;w++){const[C,E]=f[w],b=a[w];if(!b){if(i)throw new jT({abiItem:c,param:C});g.push([C,E]);continue}h[d?E:C.name||E]=QIt({param:C,value:b})}const p=u.filter(w=>!("indexed"in w&&w.indexed)),m=i?p:[...g.map(([w])=>w),...p];if(m.length>0){if(n&&n!=="0x")try{const w=V6(m,n);if(w){let C=0;if(!i)for(const[E,b]of g)h[d?b:E.name||b]=w[C++];if(d)for(let E=0;E<u.length;E++)h[E]===void 0&&C<w.length&&(h[E]=w[C++]);else for(let E=0;E<p.length;
1092E++)h[p[E].name]=w[C++]}}catch(w){if(i)throw w instanceof UV||w instanceof L5e?new S4({abiItem:c,data:n,params:m,size:es(n)}):w}else if(i)throw new S4({abiItem:c,data:"0x",params:m,size:0})}return{eventName:l,args:Object.values(h).length>0?h:void 0}}function QIt({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(V6([e],t)||[])[0]}function YT(e){const{abi:t,args:n,logs:r,strict:s=!0}=e,i=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),o=t.filter(a=>a.type==="event").map(a=>({abi:a,selector:B5(a)}));return r.map(a=>{var h;const c=typeof a.blockNumber=="string"?Wd(a):a,l=o.filter(f=>c.topics[0]===f.selector);if(l.length===0)return null;let u,d;for(const f of l)try{u=k4({...c,abi:[f.abi],strict:!0}),d=f;break}catch{}if(!u&&!s){d=l[0];try{u=k4({data:c.data,topics:c.topics,abi:[d.abi],strict:!1})}catch{const f=(h=d.abi.inputs)==null?void 0:h.some(g=>!("name"in g&&g.name));return{...c,args:f?[]:{},eventName:d.abi.name}}}return!u||!d||i&&!i.includes(u.eventName)||!eSt({args:u.args,inputs:d.abi.inputs,matchArgs:n})?null:{...u,...c}}).filter(Boolean)}function eSt(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function s(i,o,a){try{return i.type==="address"?wy(o,a):i.type==="string"||i.type==="bytes"?Ni(Eb(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((i,o)=>{if(i==null)return!0;const a=n[o];return a?(Array.isArray(i)?i:[i]).some(l=>s(a,l,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([i,o])=>{if(o==null)return!0;const a=n.find(l=>l.name===i);return a?(Array.isArray(o)?o:[o]).some(l=>s(a,l,t[i])):!1}):!1}async function dK(e,{address:t,blockHash:n,fromBlock:r,toBlock:s,event:i,events:o,args:a,strict:c}={}){const l=c??!1,u=o??(i?[i]:void 0);let d=[];u&&(d=[u.flatMap(p=>H6({abi:[p],eventName:p.name,args:o?void 0:a}))],i&&(d=d[0]));let h;n?h=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):h=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?Rt(r):r,toBlock:typeof s=="bigint"?Rt(s):s}]});const f=h.map(g=>Wd(g));return u?YT({abi:u,args:a,logs:f,strict:l}):f}async function V6e(e,t){const{abi:n,address:r,args:s,blockHash:i,eventName:o,fromBlock:a,toBlock:c,strict:l}=t,u=o?m1({abi:n,name:o}):void 0,d=u?void 0:n.filter(h=>h.type==="event");return At(e,dK,"getLogs")({address:r,args:s,blockHash:i,event:u,events:d,fromBlock:a,toBlock:c,strict:l})}const ZB="/docs/contract/decodeFunctionResult";function H0(e){const{abi:t,args:n,functionName:r,data:s}=e;let i=t[0];if(r){const a=m1({abi:t,args:n,name:r});if(!a)throw new fy(r,{docsPath:ZB});i=a}if(i.type!=="function")throw new fy(void 0,{docsPath:ZB});if(!i.outputs)throw new MV(i.name,{docsPath:ZB});const o=V6(i.outputs,s);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}const hK=BigInt(0),JF=BigInt(1);function N$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function fK(e){if(!N$(e))throw new Error("Uint8Array expected")}function R4(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function WI(e){const t=e.toString(16);return t.length&1?"0"+t:t}function K6e(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?hK:BigInt("0x"+e)}const G6e=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",tSt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function B4(e){if(fK(e),G6e)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=tSt[e[n]];return t}const Qf={_0:48,_9:57,A:65,F:70,a:97,f:102};function Foe(e){if(e>=Qf._0&&e<=Qf._9)return e-Qf._0;if(e>=Qf.A&&e<=Qf.F)return e-(Qf.A-10);if(e>=Qf.a&&e<=Qf.f)return e-(Qf.a-10)}function C_(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(G6e)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);
vendor: 6,629 bytes, lines 1092-1093
1092const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Foe(e.charCodeAt(i)),a=Foe(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function jw(e){return K6e(B4(e))}function Z6e(e){return fK(e),K6e(B4(Uint8Array.from(e).reverse()))}function T$(e,t){return C_(e.toString(16).padStart(t*2,"0"))}function Y6e(e,t){return T$(e,t).reverse()}function ou(e,t,n){let r;if(typeof t=="string")try{r=C_(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(N$(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function $_(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];fK(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const YB=e=>typeof e=="bigint"&&hK<=e;function pK(e,t,n){return YB(e)&&YB(t)&&YB(n)&&t<=e&&e<n}function e5(e,t,n,r){if(!pK(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function nSt(e){let t;for(t=0;e>hK;e>>=JF,t+=1);return t}const JT=e=>(JF<<BigInt(e))-JF,JB=e=>new Uint8Array(e),zoe=e=>Uint8Array.from(e);function rSt(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=JB(e),s=JB(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=JB(0))=>{s=a(zoe([0]),d),r=a(),d.length!==0&&(s=a(zoe([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return $_(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const sSt={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||N$(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function XT(e,t,n={}){const r=(s,i,o)=>{const a=sSt[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function qoe(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const iSt="0.1.1";function oSt(){return iSt}let fn=class wp extends Error{static setStaticOptions(t){wp.prototype.docsOrigin=t.docsOrigin,wp.prototype.showVersion=t.showVersion,wp.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof wp){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),s=n.cause instanceof wp&&n.cause.docsPath||n.docsPath,i=n.docsOrigin??wp.prototype.docsOrigin,o=`${i}${s??""}`,a=!!(n.version??wp.prototype.showVersion),c=n.version??wp.prototype.version,l=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s||a?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(u=>typeof u=="string").join(` 1093`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=i,this.docsPath=s,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return J6e(this,t)}};Object.defineProperty(fn,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${oSt()}`}});fn.setStaticOptions(fn.defaultStaticOptions);function J6e(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?J6e(e.cause,t):t?null:e}function P$(e,t){if(Nv(e)>t)throw new $St({givenSize:Nv(e),maxSize:t})}const ep={zero:48,nine:57,A:65,F:70,a:97,f:102};function Woe(e){if(e>=ep.zero&&e<=ep.nine)return e-ep.zero;if(e>=ep.A&&e<=ep.F)return e-(ep.A-10);if(e>=ep.a&&e<=ep.f)return e-(ep.a-10)}function aSt(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new xSt({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o=n==="right";s[o?i:r-i-1]=e[o?i:e.length-i-1]}return s}function X6e(e,t={}){const{dir:n="left"}=t;let r=e,s=0;for(let i=0;i<r.length-1&&r[n==="left"?i:r.length-i-1].toString()==="0";i++)s++;return r=n==="left"?r.slice(s):r.slice(0,r.length-s),r}function QT(e,t){if(yl(e)>t)throw new TSt({givenSize:yl(e),maxSize:t})}function cSt(e,t){if(typeof t=="number"&&t>0&&t>yl(e)-1)throw new a3e({offset:t,position:"start",size:yl(e)})}function lSt(e,t,n){if(typeof t=="number"&&typeof n=="number"&&yl(e)!==n-t)throw new a3e({offset:n,position:"end",size:yl(e)})}function Q6e(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new PSt({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const uSt="#__bigint";function e3e(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+uSt:s,n)}const dSt=new TextDecoder,hSt=new TextEncoder;function fSt(e){return e instanceof Uint8Array?e:typeof e=="string"?t3e(e):pSt(e)}function pSt(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function t3e(e,t={}){const{size:n}=t;let r=e;
1093n&&(QT(e,n),r=by(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const l=Woe(s.charCodeAt(c++)),u=Woe(s.charCodeAt(c++));if(l===void 0||u===void 0)throw new fn(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l<<4|u}return o}function gSt(e,t={}){const{size:n}=t,r=hSt.encode(e);return typeof n=="number"?(P$(r,n),mSt(r,n)):r}function mSt(e,t){return aSt(e,{dir:"right",size:t})}function Nv(e){return e.length}function wSt(e,t,n,r={}){const{strict:s}=r;return e.slice(t,n)}function ySt(e,t={}){const{size:n}=t;typeof n<"u"&&P$(e,n);const r=Vd(e,t);return s3e(r,t)}function bSt(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(P$(r,n),r=n3e(r)),r.length>1||r[0]>1)throw new CSt(r);return!!r[0]}function h0(e,t={}){const{size:n}=t;typeof n<"u"&&P$(e,n);const r=Vd(e,t);return i3e(r,t)}function vSt(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(P$(r,n),r=ESt(r)),dSt.decode(r)}function n3e(e){return X6e(e,{dir:"left"})}function ESt(e){return X6e(e,{dir:"right"})}let CSt=class extends fn{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}},$St=class extends fn{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},xSt=class extends fn{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const ISt=new TextEncoder,SSt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ASt(e,t={}){const{strict:n=!1}=t;if(!e)throw new Hoe(e);if(typeof e!="string")throw new Hoe(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Voe(e);if(!e.startsWith("0x"))throw new Voe(e)}function Hd(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function _St(e){return e instanceof Uint8Array?Vd(e):Array.isArray(e)?Vd(new Uint8Array(e)):e}function r3e(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(QT(n,t.size),yy(n,t.size)):n}function Vd(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=SSt[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(QT(r,t.size),by(r,t.size)):r}function Ko(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const l=typeof e=="bigint"?"n":"";throw new o3e({max:i?`${i}${l}`:void 0,min:`${o}${l}`,signed:n,size:r,value:`${e}${l}`})}const c=`0x${(n&&s<0?BigInt.asUintN(r*8,BigInt(s)):s).toString(16)}`;return r?yy(c,r):c}function gK(e,t={}){return Vd(ISt.encode(e),t)}function yy(e,t){return Q6e(e,{dir:"left",size:t})}function by(e,t){return Q6e(e,{dir:"right",size:t})}function Qh(e,t,n,r={}){const{strict:s}=r;cSt(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&lSt(i,t,n),i}function yl(e){return Math.ceil((e.length-2)/2)}function s3e(e,t={}){const{signed:n}=t;t.size&&QT(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,o=i>>1n;return r<=o?r:r-i-1n}function i3e(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:s3e(e,t))}function NSt(e,t={}){const{strict:n=!1}=t;try{return ASt(e,{strict:n}),!0}catch{return!1}}let o3e=class extends fn{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Hoe=class extends fn{constructor(t){super(`Value \`${typeof t=="object"?e3e(t):t}\` of type \`${typeof t}
1093\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},Voe=class extends fn{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},TSt=class extends fn{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},a3e=class extends fn{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},PSt=class extends fn{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};function OSt(e){return{address:e.address,amount:Ko(e.amount),index:Ko(e.index),validatorIndex:Ko(e.validatorIndex)}}function c3e(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Ko(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Ko(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient}
vendor: 5,884 bytes, line 1093
1093,...typeof e.gasLimit=="bigint"&&{gasLimit:Ko(e.gasLimit)},...typeof e.number=="bigint"&&{number:Ko(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Ko(e.prevRandao)},...typeof e.time=="bigint"&&{time:Ko(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(OSt)}}}const vy=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],XF=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],l3e=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],u3e=[...l3e,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],kSt=[...l3e,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Koe=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Goe=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],d3e=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],x_=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],KE=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],RSt="0x82ad56cb",mK="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b
1093602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",h3e="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",QF="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848
1093603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",wK="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9
1093150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";let I_=class extends Ee{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}
1093,yK=class extends Ee{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}};const XB="/docs/contract/encodeDeployData";function eP(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const s=t.find(o=>"type"in o&&o.type==="constructor");if(!s)throw new l5e({docsPath:XB});if(!("inputs"in s))throw new WF({docsPath:XB});if(!s.inputs||s.inputs.length===0)throw new WF({docsPath:XB});const i=W0(s.inputs,n);return Cb([r,i])}function xb({blockNumber:e,chain:t,contract:n}){var s;const r=(s=t==null?void 0:t.contracts)==null?void 0:s[n];if(!r)throw new I_({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new I_({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function f3e(e,{docsPath:t,...n}){const r=(()=>{const s=VT(e,n);return s instanceof K6?e:s})();return new XV(r,{docsPath:t,...n})}function p3e(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}const QB=new Map;function g3e({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:s}){const i=async()=>{const u=c();o();const d=u.map(({args:h})=>h);d.length!==0&&e(d).then(h=>{s&&Array.isArray(h)&&h.sort(s);for(let f=0;f<u.length;f++){const{resolve:g}=u[f];g==null||g([h[f],h])}}).catch(h=>{for(let f=0;f<u.length;f++){const{reject:g}=u[f];g==null||g(h)}})},o=()=>QB.delete(t),a=()=>c().map(({args:u})=>u),c=()=>QB.get(t)||[],l=u=>QB.set(t,[...c(),u]);return{flush:o,async schedule(u){const{promise:d,resolve:h,reject:f}=p3e();return(n==null?void 0:n([...a(),u]))&&i(),c().length>0?(l({args:u,resolve:h,reject:f}),d):(l({args:u,resolve:h,reject:f}),setTimeout(i,r),d)}}}async function Z6(e,t){var P,_,y,$;const{account:n=e.account,authorizationList:r,batch:s=!!((P=e.batch)!=null&&P.multicall),blockNumber:i,blockTag:o=e.experimental_blockTag??"latest",accessList:a,blobs:c,blockOverrides:l,code:u,data:d,factory:h,factoryData:f,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:C,nonce:E,to:b,value:S,stateOverride:v,...x}=t,A=n?wl(n):void 0;if(u&&(h||f))throw new Ee("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&b)throw new Ee("Cannot provide both `code` & `to` as parameters.");const I=u&&d,O=h&&f&&b&&d,N=I||O,T=I?m3e({code:u,data:d}):O?USt({data:d,factory:h,factoryData:f,to:b}):d;try{$b(t);const B=(typeof i=="bigint"?Rt(i):void 0)||o,k=l?c3e(l):void 0,D=eK(v),U=($=(y=(_=e.chain)==null?void 0:_.formatters)==null?void 0:y.transactionRequest)==null?void 0:$.format,K=(U||G6)({...KT(x,{format:U}),accessList:a,account:A,authorizationList:r,blobs:c,data:T,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:C,nonce:E,to:N?void 0:b,value:S},"call");if(s&&BSt({request:K})&&!D&&!k)try{return await DSt(e,{...K,blockNumber:i,blockTag:o})}
1093catch(Z){if(!(Z instanceof yK)&&!(Z instanceof I_))throw Z}const q=(()=>{const Z=[K,B];return D&&k?[...Z,D,k]:D?[...Z,D]:k?[...Z,{},k]:Z})(),H=await e.request({method:"eth_call",params:q});return H==="0x"?{data:void 0}:{data:H}}catch(R){const B=LSt(R),{offchainLookup:k,offchainLookupSignature:D}=await te(async()=>{const{offchainLookup:U,offchainLookupSignature:F}=await Promise.resolve().then(()=>N9t);return{offchainLookup:U,offchainLookupSignature:F}},void 0);if(e.ccipRead!==!1&&(B==null?void 0:B.slice(0,10))===D&&b)return{data:await k(e,{data:B,to:b})};throw N&&(B==null?void 0:B.slice(0,10))==="0x101bb98d"?new J5e({factory:h}):f3e(R,{...t,account:A,chain:e.chain})}}function BSt({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(RSt)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function DSt(e,t){var p;const{batchSize:n=1024,deployless:r=!1,wait:s=0}=typeof((p=e.batch)==null?void 0:p.multicall)=="object"?e.batch.multicall:{},{blockNumber:i,blockTag:o=e.experimental_blockTag??"latest",data:a,to:c}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return xb({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new yK})(),d=(typeof i=="bigint"?Rt(i):void 0)||o,{schedule:h}=g3e({id:`${e.uid}.${d}`,wait:s,shouldSplitBatch(m){return m.reduce((C,{data:E})=>C+(E.length-2),0)>n*2},fn:async m=>{const w=m.map(b=>({allowFailure:!0,callData:b.data,target:b.to})),C=_l({abi:vy,args:[w],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...l===null?{data:m3e({code:wK,data:C})}:{to:l,data:C}
1093},d]});return H0({abi:vy,args:[w],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:f,success:g}]=await h({data:a,to:c});if(!g)throw new _$({data:f});return f==="0x"?{data:void 0}:{data:f}}function m3e(e){const{code:t,data:n}=e;return eP({abi:j0(["constructor(bytes, bytes)"]),bytecode:mK,args:[t,n]})}function USt(e){const{data:t,factory:n,factoryData:r,to:s}=e;return eP({abi:j0(["constructor(address, bytes, address, bytes)"]),bytecode:h3e,args:[s,t,n,r]})}function LSt(e){var n;if(!(e instanceof Ee))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function Kd(e,t){const{abi:n,address:r,args:s,functionName:i,...o}=t,a=_l({abi:n,args:s,functionName:i});try{const{data:c}=await At(e,Z6,"call")({...o,data:a,to:r});return H0({abi:n,args:s,functionName:i,data:c||"0x"})}catch(c){throw my(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:i})}}async function MSt(e,t){var u;const{abi:n,address:r,args:s,functionName:i,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...a}=t,c=a.account?wl(a.account):e.account,l=_l({abi:n,args:s,functionName:i});try{const{data:d}=await At(e,Z6,"call")({batch:!1,data:`${l}${o?o.replace("0x",""):""}`,to:r,...a,account:c}),h=H0({abi:n,args:s,functionName:i,data:d||"0x"}),f=n.filter(g=>"name"in g&&g.name===t.functionName);return{result:h,request:{abi:f,address:r,args:s,dataSuffix:o,functionName:i,...a,account:c}}}catch(d){throw my(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:i,sender:c==null?void 0:c.address})}}const eD=new Map,Zoe=new Map;let jSt=0;function Jm(e,t,n){const r=++jSt,s=()=>eD.get(e)||[],i=()=>{const u=s();eD.set(e,u.filter(d=>d.id!==r))},o=()=>{const u=s();if(!u.some(h=>h.id===r))return;const d=Zoe.get(e);if(u.length===1&&d){const h=d();h instanceof Promise&&h.catch(()=>{})}i()},a=s();if(eD.set(e,[...a,{id:r,fns:t}]),a&&a.length>0)return o;const c={};for(const u in t)c[u]=((...d)=>{var f,g;const h=s();if(h.length!==0)for(const p of h)(g=(f=p.fns)[u])==null||g.call(f,...d)});const l=n(c);return typeof l=="function"&&Zoe.set(e,l),o}async function S_(e){return new Promise(t=>setTimeout(t,e))}function O$(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let s=!0;const i=()=>s=!1;return(async()=>{let a;t&&(a=await e({unpoll:i}));const c=await(n==null?void 0:n(a))??r;await S_(c);const l=async()=>{s&&(await e({unpoll:i}),await S_(r),l())};l()})(),i}const FSt=new Map,zSt=new Map;function qSt(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:o=>i.set(s,o)}),n=t(e,FSt),r=t(e,zSt);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function w3e(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=qSt(t),s=r.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let i=r.promise.get();i||(i=e(),r.promise.set(i));try{const o=await i;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const WSt=e=>`blockNumber.${e}`;async function k$(e,{cacheTime:t=e.cacheTime}={}){const n=await w3e(()=>e.request({method:"eth_blockNumber"}),{cacheKey:WSt(e.uid),cacheTime:t});return BigInt(n)}async function tP(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const s=r.map(i=>Wd(i));return!("abi"in t)||!t.abi?s:YT({abi:t.abi,logs:s,strict:n})}async function nP(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function HSt(e,t){const{abi:n,address:r,args:s,batch:i=!0,eventName:o,fromBlock:a,onError:c,onLogs:l,poll:u,pollingInterval:d=e.pollingInterval,strict:h}=t;return(typeof u<"u"?u:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
1093onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const m=h??!1,w=Os(["watchContractEvent",r,s,i,e.uid,o,d,m,a]);return Jm(w,{onLogs:l,onError:c},C=>{let E;a!==void 0&&(E=a-1n);let b,S=!1;const v=O$(async()=>{var x;if(!S){try{b=await At(e,B5e,"createContractEventFilter")({abi:n,address:r,args:s,eventName:o,strict:m,fromBlock:a})}catch{}S=!0;return}try{let A;if(b)A=await At(e,tP,"getFilterChanges")({filter:b});else{const I=await At(e,k$,"getBlockNumber")({});E&&E<I?A=await At(e,V6e,"getContractEvents")({abi:n,address:r,args:s,eventName:o,fromBlock:E+1n,toBlock:I,strict:m}):A=[],E=I}if(A.length===0)return;if(i)C.onLogs(A);else for(const I of A)C.onLogs([I])}catch(A){b&&A instanceof gy&&(S=!1),(x=C.onError)==null||x.call(C,A)}},{emitOnBegin:!0,interval:d});return async()=>{b&&await At(e,nP,"uninstallFilter")({filter:b}),v()}})})():(()=>{const m=h??!1,w=Os(["watchContractEvent",r,s,i,e.uid,o,d,m]);let C=!0,E=()=>C=!1;return Jm(w,{onLogs:l,onError:c},b=>((async()=>{try{const S=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(I=>I.config.type==="webSocket"||I.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),v=o?H6({abi:n,eventName:o,args:s}):[],{unsubscribe:x}=await S.subscribe({params:["logs",{address:r,topics:v}],onData(A){var O;if(!C)return;const I=A.result;try{const{eventName:N,args:T}=k4({abi:n,data:I.data,topics:I.topics,strict:h}),P=Wd(I,{args:T,eventName:N});b.onLogs([P])}catch(N){let T,P;if(N instanceof S4||N instanceof jT){if(h)return;T=N.abiItem.name,P=(O=N.abiItem.inputs)==null?void 0:O.some(y=>!("name"in y&&y.name))}const _=Wd(I,{args:P?[]:{},eventName:T});b.onLogs([_])}},onError(A){var I;(I=b.onError)==null||I.call(b,A)}});E=x,C||E()}catch(S){c==null||c(S)}})(),()=>E()))})()}async function VSt(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function A_(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,i)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const u=typeof t=="function"?t({count:a,error:l}):t;u&&await S_(u),o({count:a+1})};try{const l=await e();s(l)}catch(l){if(a<n&&await r({count:a,error:l}))return c({error:l});i(l)}};o()})}const KSt={"0x0":"reverted","0x1":"success"};function bK(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Wd(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?cf(e.transactionIndex):null,status:e.status?KSt[e.status]:null,type:e.type?rK[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const ez=256;let HI=ez,VI;function y3e(e=11){if(!VI||HI+e>ez*2){VI="",HI=0;for(let t=0;t<ez;t++)VI+=(256+Math.random()*256|0).toString(16).substring(1)}return VI.substring(HI,HI+++e)}function b3e(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:s,key:i="base",name:o="Base Client",type:a="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),l=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),d=e.pollingInterval??u,h=e.cacheTime??d,f=e.account?wl(e.account):void 0,{config:g,request:p,value:m}=e.transport({account:f,chain:n,pollingInterval:d}),w={...g,...m},C={account:f,batch:t,cacheTime:h,ccipRead:r,chain:n,dataSuffix:s,key:i,name:o,pollingInterval:d,request:p,transport:w,type:a,uid:y3e(),...c?{experimental_blockTag:c}:{}};function E(b){return S=>{const v=S(b);for(const A in C)delete v[A];const x={...b,...v};return Object.assign(x,{extend:E(x)})}}return Object.assign(C,{extend:E(C)})}function vK(e){var n,r,s,i,o,a;if(!(e instanceof Ee))return!1;const t=e.walk(c=>c instanceof VA);return t instanceof VA?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=t.data)==null?void 0:i.errorName)==="ResolverNotFound"||((o=t.data)==null?void 0:o.errorName)==="ReverseAddressMismatch"||((a=t.data)==null?void 0:a.errorName)==="UnsupportedResolverProfile":!1}function v3e(e){const{abi:t,data:n}=e,r=Ym(n,0,4),s=t.find(i=>i.type==="function"&&r===py(Fd(i)));if(!s)throw new m5e(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?V6(s.inputs,Ym(n,4)):void 0}}const tD="/docs/contract/encodeErrorResult";function tz(e){const{abi:t,errorName:n,args:r}=e;let s=t[0];if(n){const c=m1({abi:t,args:r,name:n});if(!c)throw new HF(n,{docsPath:tD});s=c}if(s.type!=="error")throw new HF(void 0,{docsPath:tD});const i=Fd(s),o=py(i);let a="0x";if(r&&r.length>0){if(!s.inputs)throw new f5e(s.name,{docsPath:tD});a=W0(s.inputs,r)}return Cb([o,a])}const nD="/docs/contract/encodeFunctionResult";function E3e(e){const{abi:t,functionName:n,result:r}=e;let s=t[0];if(n){const o=m1({abi:t,name:n});if(!o)throw new fy(n,{docsPath:nD});s=o}if(s.type!=="function")throw new fy(void 0,{docsPath:nD});if(!s.outputs)throw new MV(s.name,{docsPath:nD});const i=(()=>
1093{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new jV(r)})();return W0(s.outputs,i)}const R$="x-batch-gateway:true";async function C3e(e){const{data:t,ccipRequest:n}=e,{args:[r]}=v3e({abi:XF,data:t}),s=[],i=[];return await Promise.all(r.map(async(o,a)=>{try{i[a]=o.urls.includes(R$)?await C3e({data:o.data,ccipRequest:n}):await n(o),s[a]=!1}catch(c){s[a]=!0,i[a]=GSt(c)}})),E3e({abi:XF,functionName:"query",result:[s,i]})}function GSt(e){return e.name==="HttpRequestError"&&e.status?tz({abi:XF,errorName:"HttpError",args:[e.status,e.shortMessage]}):tz({abi:[U5e],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function $3e(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Iu(t)?t:null}function __(e){let t=new Uint8Array(32).fill(0);if(!e)return Bs(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=$3e(n[r]),i=s?Eb(s):Ni(Rm(n[r]),"bytes");t=Ni(Su([t,i]),"bytes")}return Bs(t)}function ZSt(e){return`[${e.slice(2)}]`}function x3e(e){const t=new Uint8Array(32).fill(0);return e?$3e(e)||Ni(Rm(e)):Bs(t)}function EK(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Rm(t).byteLength+2);let r=0;const s=t.split(".");for(let i=0;i<s.length;i++){let o=Rm(s[i]);o.byteLength>255&&(o=Rm(ZSt(x3e(s[i])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function YSt(e,t){const{blockNumber:n,blockTag:r,coinType:s,name:i,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return xb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c==null?void 0:c.ensTlds;if(u&&!u.some(h=>i.endsWith(h)))return null;const d=s!=null?[__(i),BigInt(s)]:[__(i)];try{const h=_l({abi:Goe,functionName:"addr",args:d}),f={address:l,abi:u3e,functionName:"resolveWithGateways",args:[$0(EK(i)),h,o??[R$]],blockNumber:n,blockTag:r},p=await At(e,Kd,"readContract")(f);if(p[0]==="0x")return null;const m=H0({abi:Goe,args:d,functionName:"addr",data:p[0]});return m==="0x"||km(m)==="0x00"?null:m}catch(h){if(a)throw h;if(vK(h))return null;throw h}}let JSt=class extends Ee{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}},ov=class extends Ee{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}},rP=class extends Ee{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}},I3e=class extends Ee{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}};const XSt=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,QSt=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,e9t=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,t9t=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function n9t(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Yoe(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function S3e({uri:e,gatewayUrls:t}){const n=e9t.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Yoe(t==null?void 0:t.ipfs,"https://ipfs.io"),s=Yoe(t==null?void 0:t.arweave,"https://arweave.net"),i=e.match(XSt),{protocol:o,subpath:a,target:c,subtarget:l=""}=(i==null?void 0:i.groups)||{},u=o==="ipns:/"||a==="ipns/",d=o==="ipfs:/"||a==="ipfs/"||QSt.test(e);
1093if(e.startsWith("http")&&!u&&!d){let f=e;return t!=null&&t.arweave&&(f=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((u||d)&&c)return{uri:`${r}/${u?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${s}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let h=e.replace(t9t,"");if(h.startsWith("<svg")&&(h=`data:image/svg+xml;base64,${btoa(h)}`),h.startsWith("data:")||h.startsWith("{"))return{uri:h,isOnChain:!0,isEncoded:!1};throw new rP({uri:e})}function A3e(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new JSt({data:e});return e.image||e.image_url||e.image_data}async function r9t({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await CK({gatewayUrls:e,uri:A3e(n)})}catch{throw new rP({uri:t})}}async function CK({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=S3e({uri:t,gatewayUrls:e});if(r||await n9t(n))return n;throw new rP({uri:t})}function s9t(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[i,o]=n.split(":"),[a,c]=r.split(":");if(!i||i.toLowerCase()!=="eip155")throw new ov({reason:"Only EIP-155 supported"});if(!o)throw new ov({reason:"Chain ID not found"});if(!c)throw new ov({reason:"Contract address not found"});if(!s)throw new ov({reason:"Token ID not found"});if(!a)throw new ov({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:s}}async function i9t(e,{nft:t}){if(t.namespace==="erc721")return Kd(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return Kd(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new I3e({namespace:t.namespace})}async function o9t(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?a9t(e,{gatewayUrls:t,record:n}):CK({uri:n,gatewayUrls:t})}async function a9t(e,{gatewayUrls:t,record:n}){const r=s9t(n),s=await i9t(e,{nft:r}),{uri:i,isOnChain:o,isEncoded:a}=S3e({uri:s,gatewayUrls:t});if(o&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=a?atob(i.replace("data:application/json;base64,","")):i,u=JSON.parse(l);return CK({uri:A3e(u),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),r9t({gatewayUrls:t,uri:i.replace(/(?:0x)?{id}/,c)})}async function _3e(e,t){const{blockNumber:n,blockTag:r,key:s,name:i,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return xb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c==null?void 0:c.ensTlds;if(u&&!u.some(d=>i.endsWith(d)))return null;try{const d={address:l,abi:u3e,args:[$0(EK(i)),_l({abi:Koe,functionName:"text",args:[__(i),s]}),o??[R$]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},f=await At(e,Kd,"readContract")(d);if(f[0]==="0x")return null;const g=H0({abi:Koe,functionName:"text",data:f[0]});return g===""?null:g}catch(d){if(a)throw d;if(vK(d))return null;throw d}}async function c9t(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:i,strict:o,universalResolverAddress:a}){const c=await At(e,_3e,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:a,gatewayUrls:i,strict:o});if(!c)return null;try{return await o9t(e,{record:c,gatewayUrls:r})}catch{return null}}async function l9t(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:i=60n,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return xb({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:kSt,args:[n,i,o??[R$]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},d=At(e,Kd,"readContract"),[h]=await d(u);return h||null}catch(u){if(a)throw u;if(vK(u))return null;throw u}}async function u9t(e,t){const{blockNumber:n,blockTag:r,name:s}=t,{chain:i}=e,o=(()=>
1093{if(t.universalResolverAddress)return t.universalResolverAddress;if(!i)throw new Error("client chain not configured. universalResolverAddress is required.");return xb({blockNumber:n,chain:i,contract:"ensUniversalResolver"})})(),a=i==null?void 0:i.ensTlds;if(a&&!a.some(l=>s.endsWith(l)))throw new Error(`${s} is not a valid ENS TLD (${a==null?void 0:a.join(", ")}) for chain "${i.name}" (id: ${i.id}).`);const[c]=await At(e,Kd,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[$0(EK(s))],blockNumber:n,blockTag:r});return c}async function N3e(e,t){var m,w,C;const{account:n=e.account,blockNumber:r,blockTag:s="latest",blobs:i,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:d,to:h,value:f,...g}=t,p=n?wl(n):void 0;try{$b(t);const b=(typeof r=="bigint"?Rt(r):void 0)||s,S=(C=(w=(m=e.chain)==null?void 0:m.formatters)==null?void 0:w.transactionRequest)==null?void 0:C.format,x=(S||G6)({...KT(g,{format:S}),account:p,blobs:i,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:d,to:h,value:f},"createAccessList"),A=await e.request({method:"eth_createAccessList",params:[x,b]});return{accessList:A.accessList,gasUsed:BigInt(A.gasUsed)}}catch(E){throw f3e(E,{...t,account:p,chain:e.chain})}}async function d9t(e){const t=qT(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function T3e(e,{address:t,args:n,event:r,events:s,fromBlock:i,strict:o,toBlock:a}={}){const c=s??(r?[r]:void 0),l=qT(e,{method:"eth_newFilter"});let u=[];c&&(u=[c.flatMap(f=>H6({abi:[f],eventName:f.name,args:n}))],r&&(u=u[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof i=="bigint"?Rt(i):i,toBlock:typeof a=="bigint"?Rt(a):a,...u.length?{topics:u}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:i,id:d,request:l(d),strict:!!o,toBlock:a,type:"event"}}async function P3e(e){const t=qT(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function h9t(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var o,a,c;if((o=e.batch)!=null&&o.multicall&&((c=(a=e.chain)==null?void 0:a.contracts)!=null&&c.multicall3)){const l=e.chain.contracts.multicall3.address,u=_l({abi:vy,functionName:"getEthBalance",args:[t]}),{data:d}=await At(e,Z6,"call")({to:l,data:u,blockNumber:n,blockTag:r});return H0({abi:vy,functionName:"getEthBalance",args:[t],data:d||"0x"})}const s=typeof n=="bigint"?Rt(n):void 0,i=await e.request({method:"eth_getBalance",params:[t,s||r]});return BigInt(i)}async function f9t(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function p9t(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?Rt(n):void 0;let i;return t?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),cf(i)}async function N_(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?Rt(n):void 0,i=await e.request({method:"eth_getCode",params:[t,s||r]},{dedupe:!!s});if(i!=="0x")return i}async function g9t(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=await N_(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(s&&es(s)===23&&s.startsWith("0xef0100"))return A4(Ym(s,3,23))}let m9t=class extends Ee{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}};async function w9t(e,t){const{address:n,factory:r,factoryData:s}=t;try{const[i,o,a,c,l,u,d]=await At(e,Kd,"readContract")({abi:y9t,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:o,version:a,chainId:Number(c),verifyingContract:l,salt:u},extensions:d,fields:i}}catch(i){const o=i;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new m9t({address:n}):o}}const y9t=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function b9t(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.olde
1093stBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function v9t(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const i=typeof n=="bigint"?Rt(n):void 0,o=await e.request({method:"eth_feeHistory",params:[Rt(t),i||r,s]},{dedupe:!!i});return b9t(o)}async function E9t(e,{filter:t}){const n=t.strict??!1,s=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(i=>Wd(i));return t.abi?YT({abi:t.abi,logs:s,strict:n}):s}async function C9t({address:e,authorization:t,signature:n}){return wy(A4(e),await N6e({authorization:t,signature:n}))}const KI=new zT(8192);function $9t(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(KI.get(n))return KI.get(n);const r=e().finally(()=>KI.delete(n));return KI.set(n,r),r}function x9t(e,t={}){return async(n,r={})=>{var d;const{dedupe:s=!1,methods:i,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...r},{method:l}=n;if((d=i==null?void 0:i.exclude)!=null&&d.includes(l))throw new _v(new Error("method not supported"),{method:l});if(i!=null&&i.include&&!i.include.includes(l))throw new _v(new Error("method not supported"),{method:l});const u=s?R5(`${c}.${Os(n)}`):void 0;return $9t(()=>A_(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case KA.code:throw new KA(f);case GA.code:throw new GA(f);case ZA.code:throw new ZA(f,{method:n.method});case YA.code:throw new YA(f);case D5.code:throw new D5(f);case gy.code:throw new gy(f);case JA.code:throw new JA(f);case XA.code:throw new XA(f);case N4.code:throw new N4(f);case _v.code:throw new _v(f,{method:n.method});case T4.code:throw new T4(f);case QA.code:throw new QA(f);case Qv.code:throw new Qv(f);case e_.code:throw new e_(f);case t_.code:throw new t_(f);case n_.code:throw new n_(f);case r_.code:throw new r_(f);case s_.code:throw new s_(f);case i_.code:throw new i_(f);case o_.code:throw new o_(f);case a_.code:throw new a_(f);case c_.code:throw new c_(f);case l_.code:throw new l_(f);case u_.code:throw new u_(f);case d_.code:throw new d_(f);case 5e3:throw new Qv(f);case h_.code:throw new h_(f);default:throw h instanceof Ee?h:new x6e(f)}}},{delay:({count:h,error:f})=>{var g;if(f&&f instanceof Bm){const p=(g=f==null?void 0:f.headers)==null?void 0:g.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*o},retryCount:a,shouldRetry:({error:h})=>I9t(h)}),{enabled:s,id:u})}}function I9t(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===T4.code||e.code===D5.code:e instanceof Bm&&e.status?e.status===403||e.status===408||e.status===4
109313||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}let S9t=class extends Ee{constructor({callbackSelector:t,cause:n,data:r,extraData:s,sender:i,urls:o}){var a;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(a=n.metaMessages)!=null&&a.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(c=>` ${A$(c)}`)],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${s}`].flat(),name:"OffchainLookupError"})}},A9t=class extends Ee{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${A$(n)}`,`Response: ${Os(t)}`],name:"OffchainLookupResponseMalformedError"})}},_9t=class extends Ee{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}};const O3e="0x556f1830",$K={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function k3e(e,{blockNumber:t,blockTag:n,data:r,to:s}){const{args:i}=ZV({data:r,abi:[$K]}),[o,a,c,l,u]=i,{ccipRead:d}=e,h=d&&typeof(d==null?void 0:d.request)=="function"?d.request:T_;try{if(!wy(s,o))throw new _9t({sender:o,to:s});const f=a.includes(R$)?await C3e({data:c,ccipRequest:h}):await h({data:c,sender:o,urls:a}),{data:g}=await Z6(e,{blockNumber:t,blockTag:n,data:Su([l,W0([{type:"bytes"},{type:"bytes"}],[f,u])]),to:s});return g}catch(f){throw new S9t({callbackSelector:l,cause:f,data:r,extraData:u,sender:o,urls:a})}}async function T_({data:e,sender:t,urls:n}){var s;let r=new Error("An unknown error occurred.");for(let i=0;i<n.length;i++){const o=n[i],a=o.includes("{data}")?"GET":"POST",c=a==="POST"?{data:e,sender:t}:void 0,l=a==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(o.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:l,method:a});let d;if((s=u.headers.get("Content-Type"))!=null&&s.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){r=new Bm({body:c,details:d!=null&&d.error?Os(d.error):u.statusText,headers:u.headers,status:u.status,url:o});continue}if(!Iu(d)){r=new A9t({result:d,url:o});continue}return d}catch(u){r=new Bm({body:c,details:u.message,url:o})}}throw r}const N9t=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:T_,offchainLookup:k3e,offchainLookupAbiItem:$K,offchainLookupSignature:O3e},Symbol.toStringTag,{value:"Module"}));function T9t(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return s=>{const i=typeof s=="function"?s(r):s,o={...r,...i};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}function R3e(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,i)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{r&&a.abort()},n)),s(await e({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&i(t),i(a)}finally{clearTimeout(o)}})()})}function P9t(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Joe=P9t();function O9t(e,t={}){const{url:n,headers:r}=k9t(e);return{async request(s){var g,p,m;const{body:i,fetchFn:o=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:c=t.onResponse,timeout:l=t.timeout??1e4}=s,u={...t.fetchOptions??{},...s.fetchOptions??{}},{headers:d,method:h,signal:f}=u;try{const w=await R3e(async({signal:E})=>{const b={...u,body:Array.isArray(i)?Os(i.map(A=>({jsonrpc:"2.0",id:A.id??Joe.take(),...A}))):Os({jsonrpc:"2.0",id:i.id??Joe.take(),...i}),headers:{...r,"Content-Type":"application/json",...d},method:h||"POST",signal:f||(l>0?E:null)},S=new Request(n,b),v=await(a==null?void 0:a(S,b))??{...b,url:n};return await o(v.url??n,v)},{errorInstance:new ZF({body:i,url:n}),timeout:l,signal:!0});c&&await c(w);let C;if((g=w.headers.get("Content-Type"))!=null&&g.startsWith("application/json"))C=await w.json();else{C=await w.text();try{C=JSON.parse(C||"{}")}
1093catch(E){if(w.ok)throw E;C={error:C}}}if(!w.ok){if(typeof((p=C.error)==null?void 0:p.code)=="number"&&typeof((m=C.error)==null?void 0:m.message)=="string")return C;throw new Bm({body:i,details:Os(C.error)||w.statusText,headers:w.headers,status:w.status,url:n})}return C}catch(w){throw w instanceof Bm||w instanceof ZF?w:new Bm({body:i,cause:w,url:n})}}}}function k9t(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const B3e=`�Ethereum Signed Message: 1094`;function D3e(e){const t=typeof e=="string"?R5(e):typeof e.raw=="string"?e.raw:Bs(e.raw),n=R5(`${B3e}${es(t)}`);return Su([n,t])}function xK(e,t){return Ni(D3e(e),t)}let U3e=class extends Ee{constructor({domain:t}){super(`Invalid domain "${Os(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}},L3e=class extends Ee{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}},M3e=class extends Ee{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}};function j3e(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(o,a)=>{for(const c of o){const{name:l,type:u}=c,d=a[l],h=u.match(k5e);if(h&&(typeof d=="number"||typeof d=="bigint")){const[p,m,w]=h;Rt(d,{signed:m==="int",size:Number.parseInt(w,10)/8})}if(u==="address"&&typeof d=="string"&&!ml(d))throw new x0({address:d});const f=u.match(fIt);if(f){const[p,m]=f;if(m&&es(d)!==Number.parseInt(m,10))throw new w5e({expectedSize:Number.parseInt(m,10),givenSize:es(d)})}const g=s[u];g&&(R9t(u),i(g,d))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new U3e({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new L3e({primaryType:r,types:s})}function F3e({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function R9t(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new M3e({type:e})}function z3e(e){const{domain:t={},message:n,primaryType:r}=e,s={EIP712Domain:F3e({domain:t}),...e.types};j3e({domain:t,message:n,primaryType:r,types:s});const i=["0x1901"];return t&&i.push(q3e({domain:t,types:s})),r!=="EIP712Domain"&&i.push(IK({data:n,primaryType:r,types:s})),Ni(Su(i))}function q3e({domain:e,types:t}){return IK({data:e,primaryType:"EIP712Domain",types:t})}function IK({data:e,primaryType:t,types:n}){const r=W3e({data:e,primaryType:t,types:n});return Ni(r)}function W3e({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],s=[B9t({primaryType:t,types:n})];for(const i of n[t]){const[o,a]=V3e({types:n,name:i.name,type:i.type,value:e[i.name]});r.push(o),s.push(a)}return W0(r,s)}function B9t({primaryType:e,types:t}){const n=$0(D9t({primaryType:e,types:t}));return Ni(n)}function D9t({primaryType:e,types:t}){let n="";const r=H3e({primaryType:e,types:t});r.delete(e);const s=[e,...Array.from(r).sort()];for(const i of s)n+=`${i}(${t[i].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function H3e({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),s=r==null?void 0:r[0];if(n.has(s)||t[s]===void 0)return n;n.add(s);for(const i of t[s])H3e({primaryType:i.type,types:t},n);return n}function V3e({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ni(W3e({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Ni(r)];if(n==="string")return[{type:"bytes32"},Ni($0(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(o=>V3e({name:t,type:s,types:e,value:o}));return[{type:"bytes32"},Ni(W0(i.map(([o])=>o),i.map(([,o])=>o)))]}return[{type:n},r]}let U9t=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const L9t={checksum:new U9t(8192)},rD=L9t.checksum;function K3e(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=U0(fSt(e));return n==="Bytes"?r:Vd(r)}const M9t=/^0x[a-fA-F0-9]{40}$/;function sP(e,t={}){const{strict:n=!0}=t;if(!M9t.test(e))throw new Xoe({address:e,cause:new j9t});if(n){if(e.toLowerCase()===e)return;if(G3e(e)!==e)throw new Xoe({address:e,cause:new F9t})}}function G3e(e){if(rD.has(e))return rD.get(e);sP(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=K3e(gSt(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return rD.set(e,s),s}
1094function nz(e,t={}){const{strict:n=!0}=t??{};try{return sP(e,{strict:n}),!0}catch{return!1}}let Xoe=class extends fn{constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},j9t=class extends fn{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},F9t=class extends fn{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}};const z9t=/^(.*)\[([0-9]*)\]$/,q9t=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Z3e=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Qoe=2n**256n-1n;function t5(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=_K(t.type);if(i){const[o,a]=i;return H9t(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:s})}if(t.type==="tuple")return Z9t(e,t,{checksumAddress:r,staticPosition:s});if(t.type==="address")return W9t(e,{checksum:r});if(t.type==="bool")return V9t(e);if(t.type.startsWith("bytes"))return K9t(e,t,{staticPosition:s});if(t.type.startsWith("uint")||t.type.startsWith("int"))return G9t(e,t);if(t.type==="string")return Y9t(e,{staticPosition:s});throw new TK(t.type)}const eae=32,rz=32;function W9t(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(i=>n?G3e(i):i)(Vd(wSt(r,-20))),32]}function H9t(e,t,n){const{checksumAddress:r,length:s,staticPosition:i}=n;if(!s){const c=h0(e.readBytes(rz)),l=i+c,u=l+eae;e.setPosition(l);const d=h0(e.readBytes(eae)),h=D4(t);let f=0;const g=[];for(let p=0;p<d;++p){e.setPosition(u+(h?p*32:f));const[m,w]=t5(e,t,{checksumAddress:r,staticPosition:u});f+=w,g.push(m)}return e.setPosition(i+32),[g,32]}if(D4(t)){const c=h0(e.readBytes(rz)),l=i+c,u=[];for(let d=0;d<s;++d){e.setPosition(l+d*32);const[h]=t5(e,t,{checksumAddress:r,staticPosition:l});u.push(h)}return e.setPosition(i+32),[u,32]}let o=0;const a=[];for(let c=0;c<s;++c){const[l,u]=t5(e,t,{checksumAddress:r,staticPosition:i+o});o+=u,a.push(l)}return[a,o]}function V9t(e){return[bSt(e.readBytes(32),{size:32}),32]}function K9t(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=h0(e.readBytes(32));e.setPosition(n+o);const a=h0(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Vd(c),32]}return[Vd(e.readBytes(Number.parseInt(s,10),32)),32]}function G9t(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?ySt(s,{signed:n}):h0(s,{signed:n}),32]}function Z9t(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=t.components.length===0||t.components.some(({name:c})=>!c),o=i?[]:{};let a=0;if(D4(t)){const c=h0(e.readBytes(rz)),l=s+c;for(let u=0;u<t.components.length;++u){const d=t.components[u];e.setPosition(l+a);const[h,f]=t5(e,d,{checksumAddress:r,staticPosition:l});a+=f,o[i?u:d==null?void 0:d.name]=h}return e.setPosition(s+32),[o,32]}for(let c=0;c<t.components.length;++c){const l=t.components[c],[u,d]=t5(e,l,{checksumAddress:r,staticPosition:s});o[i?c:l==null?void 0:l.name]=u,a+=d}return[o,a]}function Y9t(e,{staticPosition:t}){const n=h0(e.readBytes(32)),r=t+n;e.setPosition(r);const s=h0(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=vSt(n3e(i));return e.setPosition(t+32),[o,32]}function J9t({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(SK({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function SK({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=_K(r.type);if(s){const[i,o]=s;return Q9t(n,{checksumAddress:e,length:i,parameter:{...r,type:o}})}if(r.type==="tuple")return sAt(n,{checksumAddress:e,parameter:r});if(r.type==="address")return X9t(n,{checksum:e});if(r.type==="bool")return tAt(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,o="256"]=Z3e.exec(r.type)??[];return nAt(n,{signed:i,size:Number(o)})}if(r.type.startsWith("bytes"))return eAt(n,{type:r.type});if(r.type==="string")return rAt(n);throw new TK(r.type)}function AK(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=yl(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(Ko(t+s,{size:32})),r.push(a),s+=yl(a)):n.push(a)}return Hd(...n,...r)}function X9t(e,t){const{checksum:n=!1}=t;return sP(e,{strict:n}),{dynamic:!1,encoded:yy(e.toLowerCase())}}function Q9t(e,t){const{checksumAddress:n,length:r,parameter:s}
vendor: 5,718 bytes, line 1094
1094=t,i=r===null;if(!Array.isArray(e))throw new fAt(e);if(!i&&e.length!==r)throw new hAt({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const l=SK({checksumAddress:n,parameter:s,value:e[c]});l.dynamic&&(o=!0),a.push(l)}if(i||o){const c=AK(a);if(i){const l=Ko(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Hd(l,c):l}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Hd(...a.map(({encoded:c})=>c))}}function eAt(e,{type:t}){const[,n]=t.split("bytes"),r=yl(e);if(!n){let s=e;return r%32!==0&&(s=by(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Hd(yy(Ko(r,{size:32})),s)}}if(r!==Number.parseInt(n,10))throw new J3e({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:by(e)}}function tAt(e){if(typeof e!="boolean")throw new fn(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:yy(r3e(e))}}function nAt(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new o3e({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Ko(e,{size:32,signed:t})}}function rAt(e){const t=gK(e),n=Math.ceil(yl(t)/32),r=[];for(let s=0;s<n;s++)r.push(by(Qh(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:Hd(by(Ko(yl(t),{size:32})),...r)}}function sAt(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,l=SK({checksumAddress:n,parameter:a,value:e[c]});i.push(l),l.dynamic&&(s=!0)}return{dynamic:s,encoded:s?AK(i):Hd(...i.map(({encoded:o})=>o))}}function _K(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function D4(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(D4);const n=_K(e.type);return!!(n&&D4({...e,type:n[1]}))}const iAt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new cAt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new aAt({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new tae({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new tae({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function oAt(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(iAt);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}let tae=class extends fn{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}},aAt=class extends fn{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}},cAt=class extends fn{constructor({count:t,limit:n}
1094){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}};function lAt(e,t,n={}){const{as:r="Array",checksumAddress:s=!1}=n,i=typeof t=="string"?t3e(t):t,o=oAt(i);if(Nv(i)===0&&e.length>0)throw new dAt;if(Nv(i)&&Nv(i)<32)throw new uAt({data:typeof t=="string"?t:Vd(t),parameters:e,size:Nv(i)});let a=0;const c=r==="Array"?[]:{};for(let l=0;l<e.length;++l){const u=e[l];o.setPosition(a);const[d,h]=t5(o,u,{checksumAddress:s,staticPosition:0});a+=h,r==="Array"?c.push(d):c[u.name??l]=d}return c}function NK(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new X3e({expectedLength:e.length,givenLength:t.length});const s=J9t({checksumAddress:r,parameters:e,values:t}),i=AK(s);return i.length===0?"0x":i}function sz(e,t){if(e.length!==t.length)throw new X3e({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(sz.encode(s,i))}return Hd(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return sP(c),yy(c.toLowerCase(),s?32:0)}if(n==="string")return gK(r);if(n==="bytes")return r;if(n==="bool")return yy(r3e(r),s?32:1);const i=n.match(Z3e);if(i){const[c,l,u="256"]=i,d=Number.parseInt(u,10)/8;return Ko(r,{size:s?32:d,signed:l==="int"})}const o=n.match(q9t);if(o){const[c,l]=o;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new J3e({expectedSize:Number.parseInt(l,10),value:r});return by(r,s?32:0)}const a=n.match(z9t);if(a&&Array.isArray(r)){const[c,l]=a,u=[];for(let d=0;d<r.length;d++)u.push(t(l,r[d],!0));return u.length===0?"0x":Hd(...u)}throw new TK(n)}e.encode=t})(sz||(sz={}));function Y3e(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?y0(e):e}let uAt=class extends fn{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Xg(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}},dAt=class extends fn{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}},hAt=class extends fn{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}},J3e=class extends fn{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${yl(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}},X3e=class extends fn{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(` 1095`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},fAt=class extends fn{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}},TK=class extends fn{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}};const gc=BigInt(0),la=BigInt(1),$w=BigInt(2),pAt=BigInt(3),Q3e=BigInt(4),eEe=BigInt(5),tEe=BigInt(8);function sc(e,t){const n=e%t;return n>=gc?n:t+n}function Vl(e,t,n){let r=e;for(;t-- >gc;)r*=r,r%=n;return r}function iz(e,t){if(e===gc)throw new Error("invert: expected non-zero number");if(t<=gc)throw new Error("invert: expected positive modulus, got "+t);let n=sc(e,t),r=t,s=gc,i=la;for(;n!==gc;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==la)throw new Error("invert: does not exist");return sc(s,t)}function nEe(e,t){const n=(e.ORDER+la)/Q3e,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function gAt(e,t){const n=(e.ORDER-eEe)/tEe,r=e.mul(t,$w),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,$w),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function mAt(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-la,n=0;for(;t%$w===gc;)t/=$w,n++;let r=$w;const s=PK(e);for(;nae(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return nEe;let i=s.pow(r,t);const o=(t+la)/$w;return function(c,l){if(c.is0(l))return l;if(nae(c,l)!==1)throw new Error("Cannot find square root");let u=n,d=c.mul(c.ONE,i),h=c.pow(l,t),f=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let g=1,p=c.sqr(h);for(;!c.eql(p,c.ONE);)if(g++,p=c.sqr(p),g===u)throw new Error("Cannot find square root");const m=la<<BigInt(u-g-1),w=c.pow(d,m);u=g,d=c.sqr(w),h=c.mul(h,d),f=c.mul(f,w)}return f}}function wAt(e){return e%Q3e===pAt?nEe:e%tEe===eEe?gAt:mAt(e)}const yAt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bAt(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=yAt.reduce((r,s)=>(r[s]="function",r),t);return XT(e,n)}function vAt(e,t,n){if(n<gc)throw new Error("invalid exponent, negatives unsupported");if(n===gc)return e.ONE;if(n===la)return t;let r=e.ONE,s=t;for(;n>gc;)n&la&&(r=e.mul(r,s)),s=e.sqr(s),n>>=la;return r}function rEe(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function nae(e,t){const n=(e.ORDER-la)/$w,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function sEe(e,t){t!==void 0&&Mm(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function PK(e,t,n=!1,r={}){if(e<=gc)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=sEe(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:JT(s),ZERO:gc,ONE:la,create:c=>sc(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return gc<=c&&c<e},is0:c=>c===gc,isOdd:c=>(c&la)===la,neg:c=>sc(-c,e),eql:(c,l)=>c===l,sqr:c=>sc(c*c,e),add:(c,l)=>sc(c+l,e),sub:(c,l)=>sc(c-l,e),mul:(c,l)=>sc(c*l,e),pow:(c,l)=>vAt(a,c,l),div:(c,l)=>sc(c*iz(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>iz(c,e),sqrt:r.sqrt||(c=>(o||(o=wAt(e)),o(a,c))),toBytes:c=>n?Y6e(c,i):T$(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" b
1095ytes, got "+c.length);return n?Z6e(c):jw(c)},invertBatch:c=>rEe(a,c),cmov:(c,l,u)=>u?l:c});return Object.freeze(a)}function iEe(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function oEe(e){const t=iEe(e);return t+Math.ceil(t/2)}function EAt(e,t,n=!1){const r=e.length,s=iEe(t),i=oEe(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?Z6e(e):jw(e),a=sc(o,t-la)+la;return n?Y6e(a,s):T$(a,s)}const rae=BigInt(0),oz=BigInt(1);function sD(e,t){const n=t.negate();return e?n:t}function aEe(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function iD(e,t){aEe(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=JT(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function sae(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=oz);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function CAt(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function $At(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const oD=new WeakMap,cEe=new WeakMap;function aD(e){return cEe.get(e)||1}function xAt(e,t){return{constTimeNegate:sD,hasPrecomputes(n){return aD(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>rae;)r&oz&&(s=s.add(i)),i=i.double(),r>>=oz;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=iD(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=iD(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=sae(s,c,a);s=l,d?o=o.add(sD(f,r[g])):i=i.add(sD(h,r[u]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=iD(n,t);for(let a=0;a<o.windows&&s!==rae;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=sae(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return i},getPrecomputes(n,r,s){let i=oD.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&oD.set(r,s(i))),i},wNAFCached(n,r,s){const i=aD(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=aD(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){aEe(r,t),cEe.set(n,r),oD.delete(n)}}}function IAt(e,t,n,r){CAt(n,e),$At(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=nSt(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=JT(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function lEe(e){return bAt(e.Fp),XT(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...sEe(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function iae(e){e.lowS!==void 0&&R4("lowS",e.lowS),e.prehash!==void 0&&R4("prehash",e.prehash)}function SAt(e){const t=lEe(e);XT(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}let AAt=class extends Error{constructor(t=""){super(t)}};const kp={Err:AAt,_tlv:{encode:(e,t)=>{const{Err:n}=kp;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=WI(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?WI(s.length/2|128):"";return WI(e)+i+s+t},decode(e,t){const{Err:n}=kp;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);
vendor: 10,478 bytes, line 1095
1095if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=kp;if(e<Wp)throw new t("integer: negative integers are not allowed");let n=WI(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=kp;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return jw(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=kp,s=ou("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=kp,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function cD(e,t){return B4(T$(e,t))}const Wp=BigInt(0),mi=BigInt(1);BigInt(2);const lD=BigInt(3),_At=BigInt(4);function NAt(e){const t=SAt(e),{Fp:n}=t,r=PK(t.n,t.nBitLength),s=t.toBytes||((E,b,S)=>{const v=b.toAffine();return $_(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const b=E.subarray(1),S=n.fromBytes(b.subarray(0,n.BYTES)),v=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:S,y:v}});function o(E){const{a:b,b:S}=t,v=n.sqr(E),x=n.mul(v,E);return n.add(n.add(x,n.mul(E,b)),S)}function a(E,b){const S=n.sqr(b),v=o(E);return n.eql(S,v)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,lD),_At),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(E){return pK(E,mi,t.n)}function d(E){const{allowedPrivateKeyLengths:b,nByteLength:S,wrapPrivateKey:v,n:x}=t;if(b&&typeof E!="bigint"){if(N$(E)&&(E=B4(E)),typeof E!="string"||!b.includes(E.length))throw new Error("invalid private key");E=E.padStart(S*2,"0")}let A;try{A=typeof E=="bigint"?E:jw(ou("private key",E,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof E)}return v&&(A=sc(A,x)),e5("private key",A,mi,x),A}function h(E){if(!(E instanceof p))throw new Error("ProjectivePoint expected")}const f=qoe((E,b)=>{const{px:S,py:v,pz:x}=E;if(n.eql(x,n.ONE))return{x:S,y:v};const A=E.is0();b==null&&(b=A?n.ONE:n.inv(x));const I=n.mul(S,b),O=n.mul(v,b),N=n.mul(x,b);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:I,y:O}}),g=qoe(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:b,y:S}=E.toAffine();if(!n.isValid(b)||!n.isValid(S))throw new Error("bad point: x or y not FE");if(!a(b,S))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(b,S,v){if(b==null||!n.isValid(b))throw new Error("x required");if(S==null||!n.isValid(S)||n.is0(S))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=b,this.py=S,this.pz=v,Object.freeze(this)}static fromAffine(b){const{x:S,y:v}=b||{};if(!b||!n.isValid(S)||!n.isValid(v))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const x=A=>n.eql(A,n.ZERO);return x(S)&&x(v)?p.ZERO:new p(S,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const S=rEe(n,b.map(v=>v.pz));return b.map((v,x)=>v.toAffine(S[x])).map(p.fromAffine)}static fromHex(b){const S=p.fromAffine(i(ou("pointHex",b)));return S.assertValidity(),S}static fromPrivateKey(b){return p.BASE.multiply(d(b))}static msm(b,S){return IAt(p,r,b,S)}_setWindowSize(b){C.setWindowSize(this,b)}assertValidity(){g(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b,N=n.eql(n.mul(S,O),n.mul(A,x)),T=n.eql(n.mul(v,O),n.mul(I,x));return N&&T}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:S}=t,v=n.mul(S,lD),{px:x,py:A,pz:I}=this;let O=n.ZERO,N=n.ZERO,T=n.ZERO,P=n.mul(x,x),_=n.mul(A,A),y=n.mul(I,I),$=n.mul(x,A);return $=n.add($,$),T=n.mul(x,I),T=n.add(T,T),O=n.mul(b,T),N=n.mul(v,y),N=n.add(O,N),O=n.sub(_,N),N=n.add(_,N),N=n.mul(O,N),O=n.mul($,O),T=n.mul(v,T),y=n.mul(b,y),$=n.sub(P,y),$=n.mul(b,$),$=n.add($,T),T=n.add(P,P),P=n.add(T,P),P=n.add(P,y),P=n.mul(P,$),N=n.add(N,P),y=n.mul(A,I),y=n.add(y,y),P=n.mul(y,$),O=n.sub(O,P),T=n.mul(y,_),T=n.add(T,T),T=n.add(T,T),new p(O,N,T)}add(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b;let N=n.ZERO,T=n.ZERO,P=n.ZERO;const _=t.a,y=n.mul(t.b,lD);let $=n.mul(S,A),R=n.mul(v,I),B=n.mul(x,O),k=n.add(S,v),D=n.add(A,I);k=n.mul(k,D),D=n.add($,R),k=n.sub(k,D),D=n.add(S,x);let U=n.add(A,O);return D=n.mul(D,U),U=n.add($,B),D=n.sub(D,U),U=n.add(v,x),N=n.add(I,O),U=n.mul(U,N),N=n.add(R,B),U=n.sub(U,N),P=n.mul(_,D),N=n.mul(y,B),P=n.add(N,P),N=n.sub(R,P),P=n.add(R,P),T=n.mul(N,P),R=n.add($,$),R=n.add(R,$),B=n.mul(_,B),D=n.mul(y,D),R=n.add(R,B),B=n.sub($,B),B=n.mul(_,B),D=n.add(D,B),$=n.mul(R,D),T=n.add(T,$),$=n.mul(U,D),N=n.mul(k,N),N=n.sub(N,$),$=n.mul(k,R),P=n.mul(U,P),P=n.add(P,$),new p(N,T,P)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return C.wNAFCached(this,b,p.normalizeZ)}multiplyUnsafe(b){const{endo:S,n:v}=t;e5("scalar",b,Wp,v);const x=p.ZERO;if(b===Wp)return x;if(this.is0()||b===mi)return this;if(!S||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,b,p.normalizeZ);let{k1neg:A,k1:I,k2neg:O,k2:N}=S.splitScalar(b),T=x,P=x,_=this;for(;I>Wp||N>Wp;)I&mi&&(T=T.add(_)),N&mi&&(P=P.add(_)),_=_.double(),I>>=mi,N>>=mi;return A&&(T=T.negate()),O&&(P=P.negate()),P=new p(n.mul(P.px,S.beta),P.py,P.pz),T.add(P)}multiply(b){const{endo:S,n:v}=t;e5("scalar",b,mi,v);let x,A;if(S){const{k1neg:I,k1:O,k2neg:N,k2:T}=S.splitScalar(b);let{p:P,f:_}=this.wNAF(O),{p:y,f:$}=this.wNAF(T);P=C.constTimeNegate(I,P),y=C.constTimeNegate(N,y),y=new p(n.mul(y.px,S.beta),y.py,y.pz),x=P.add(y),A=_.add($)}else{const{p:I,f:O}=this.wNAF(b);x=I,A=O}return p.normalizeZ([x,A])[0]}multiplyAndAddUnsafe(b,S,v){const x=p.BASE,A=(O,N)=>N===Wp||N===mi||!O.equals(x)?O.multiplyUnsafe(N):O.multiply(N),I=A(this,S).add(A(b,v));return I.is0()?void 0:I}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:S}=t;if(b===mi)return!0;if(S)return S(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:S}=t;return b===mi?this:S?S(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return R4("isCompressed",b),this.assertValidity(),s(p,this,b)}toHex(b=!0){return R4("isCompressed",b),B4(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,C=xAt(p,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:u}}function TAt(e){const t=lEe(e);return XT(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function PAt(e){const t=TAt(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(y){return sc(y,r)}function l(y){return iz(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:h,isWithinCurveOrder:f}=NAt({...t,toBytes(y,$,R){const B=$.toAffine(),k=n.toBytes(B.x),D=$_;return R4("isCompressed",R),R?D(Uint8Array.from([$.hasEvenY()?2:3]),k):D(Uint8Array.from([4]),k,n.toBytes(B.y))},fromBytes(y){const $=y.length,R=y[0],B=y.subarray(1);if($===o&&(R===2||R===3)){const k=jw(B);if(!pK(k,mi,n.ORDER))throw new Error("Point is not on curve");const D=h(k);let U;try{U=n.sqrt(D)}catch(q){const H=q instanceof Error?": "+q.message:"";throw new Error("Point is not on curve"+H)}const F=(U&mi)===mi;return(R&1)===1!==F&&(U=n.neg(U)),{x:k,y:U}}else if($===a&&R===4){const k=n.fromBytes(B.subarray(0,n.BYTES)),D=n.fromBytes(B.subarray(n.BYTES,2*n.BYTES));return{x:k,y:D}}else{const k=o,D=a;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+D+", got "+$)}}});function g(y){const $=r>>mi;return y>$}function p(y){return g(y)?c(-y):y}const m=(y,$,R)=>jw(y.slice($,R));class w{constructor($,R,B){e5("r",$,mi,r),e5("s",R,mi,r),this.r=$,this.s=R,B!=null&&(this.recovery=B),Object.freeze(this)}static fromCompact($){const R=s;return $=ou("compactSignature",$,R*2),new w(m($,0,R),m($,R,2*R))}static fromDER($){const{r:R,s:B}=kp.toSig(ou("DER",$));return new w(R,B)}assertValidity(){}addRecoveryBit($){return new w(this.r,this.s,$)}recoverPublicKey($){const{r:R,s:B,recovery:k}=this,D=x(ou("msgHash",$));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const U=k===2||k===3?R+t.n:R;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=(k&1)===0?"02":"03",K=u.fromHex(F+cD(U,n.BYTES)),q=l(U),H=c(-D*q),Z=c(B*q),ee=u.BASE.multiplyAndAddUnsafe(K,H,Z);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return C_(this.toDERHex())}toDERHex(){return kp.hexFromSig(this)}toCompactRawBytes(){return C_(this.toCompactHex())}toCompactHex(){const $=s;return cD(this.r,$)+cD(this.s,$)}}const C={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=oEe(t.n);return EAt(t.randomBytes(y),t.n)},precompute(y=8,$=u.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}};function E(y,$=!0){return u.fromPrivateKey(y).toRawBytes($)}function b(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const R=ou("key",y).length,B=n.BYTES,k=B+1,D=2*B+1;if(!(t.allowedPrivateKeyLengths||s===k))return R===k||R===D}function S(y,$,R=!0){if(b(y)===!0)throw new Error("first arg must be private key");if(b($)===!1)throw new Error("second arg must be public key");return u.fromHex($).multiply(d(y)).toRawBytes(R)}const v=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");
1095const $=jw(y),R=y.length*8-i;return R>0?$>>BigInt(R):$},x=t.bits2int_modN||function(y){return c(v(y))},A=JT(i);function I(y){return e5("num < 2^"+i,y,Wp,A),T$(y,s)}function O(y,$,R=N){if(["recovered","canonical"].some(X=>X in R))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:k}=t;let{lowS:D,prehash:U,extraEntropy:F}=R;D==null&&(D=!0),y=ou("msgHash",y),iae(R),U&&(y=ou("prehashed msgHash",B(y)));const K=x(y),q=d($),H=[I(q),I(K)];if(F!=null&&F!==!1){const X=F===!0?k(n.BYTES):F;H.push(ou("extraEntropy",X))}const Z=$_(...H),ee=K;function ie(X){const le=v(X);if(!f(le))return;const _e=l(le),Ne=u.BASE.multiply(le).toAffine(),be=c(Ne.x);if(be===Wp)return;const Me=c(_e*c(ee+be*q));if(Me===Wp)return;let Ct=(Ne.x===be?0:2)|Number(Ne.y&mi),Wt=Me;return D&&g(Me)&&(Wt=p(Me),Ct^=1),new w(be,Wt,Ct)}return{seed:Z,k2sig:ie}}const N={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(y,$,R=N){const{seed:B,k2sig:k}=O(y,$,R),D=t;return rSt(D.hash.outputLen,D.nByteLength,D.hmac)(B,k)}u.BASE._setWindowSize(8);function _(y,$,R,B=T){var Ct;const k=y;$=ou("msgHash",$),R=ou("publicKey",R);const{lowS:D,prehash:U,format:F}=B;if(iae(B),"strict"in B)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw new Error("format must be compact or der");const K=typeof k=="string"||N$(k),q=!K&&!F&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!K&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,Z;try{if(q&&(H=new w(k.r,k.s)),K){try{F!=="compact"&&(H=w.fromDER(k))}catch(Wt){if(!(Wt instanceof kp.Err))throw Wt}!H&&F!=="der"&&(H=w.fromCompact(k))}Z=u.fromHex(R)}catch{return!1}if(!H||D&&H.hasHighS())return!1;U&&($=t.hash($));const{r:ee,s:ie}=H,X=x($),le=l(ie),_e=c(X*le),Ne=c(ee*le),be=(Ct=u.BASE.multiplyAndAddUnsafe(Z,_e,Ne))==null?void 0:Ct.toAffine();return be?c(be.x)===ee:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:S,sign:P,verify:_,ProjectivePoint:u,Signature:w,utils:C}}function OAt(e){return{hash:e,hmac:(t,...n)=>m6(e,t,w6(...n)),randomBytes:g6}}function kAt(e,t){const n=r=>PAt({...e,...OAt(r)});return{...n(t),create:n}}const uEe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),oae=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),RAt=BigInt(0),BAt=BigInt(1),az=BigInt(2),aae=(e,t)=>(e+t/az)/t;function DAt(e){const t=uEe,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Vl(u,n,t)*u%t,h=Vl(d,n,t)*u%t,f=Vl(h,az,t)*l%t,g=Vl(f,s,t)*f%t,p=Vl(g,i,t)*g%t,m=Vl(p,a,t)*p%t,w=Vl(m,c,t)*m%t,C=Vl(w,a,t)*p%t,E=Vl(C,n,t)*u%t,b=Vl(E,o,t)*g%t,S=Vl(b,r,t)*l%t,v=Vl(S,az,t);if(!cz.eql(cz.sqr(v),e))throw new Error("Cannot find square root");return v}const cz=PK(uEe,void 0,void 0,{sqrt:DAt}),dEe=kAt({a:RAt,b:BigInt(7),Fp:cz,n:oae,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=oae,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-BAt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=aae(i*e,t),c=aae(-r*e,t);let l=sc(e-a*n-c*s,t),u=sc(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},y6),UAt=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:dEe},Symbol.toStringTag,{value:"Module"}));function hEe(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new uD({signature:e});if(typeof e.s>"u")throw new uD({signature:e});if(n&&typeof e.yParity>"u")throw new uD({signature:e});if(e.r<0n||e.r>Qoe)throw new WAt({value:e.r});if(e.s<0n||e.s>Qoe)throw new HAt({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new kK({value:e.yParity})}function LAt(e){return fEe(Vd(e))}function fEe(e){if(e.length!==130&&e.length!==132)throw new qAt({signature:e});const t=BigInt(Qh(e,0,32)),n=BigInt(Qh(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return OK(s)}catch{throw new kK({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function MAt(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return jAt(e)}function jAt(e){const t=typeof e=="string"?fEe(e):e instanceof Uint8Array?LAt(e):typeof e.r=="string"?zAt(e):e.v?FAt(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return hEe(t),t}function FAt(e){return{r:e.r,s:e.s,yParity:OK(e.v)}}function zAt(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=OK(n)),typeof r!="number")throw new kK({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function OK(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new VAt({value:e})}let qAt=class extends fn{constructor({signature:t}){super(`Value \`${t}
1095\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${yl(_St(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},uD=class extends fn{constructor({signature:t}){super(`Signature \`${e3e(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},WAt=class extends fn{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},HAt=class extends fn{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},kK=class extends fn{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},VAt=class extends fn{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}};function KAt(e,t={}){return typeof e.chainId=="string"?GAt(e):{...e,...t.signature}}function GAt(e){const{address:t,chainId:n,nonce:r}=e,s=MAt(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...s}}const ZAt="0x8010801080108010801080108010801080108010801080108010801080108010",YAt=Y3e("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function pEe(e){if(typeof e=="string"){if(Qh(e,-32)!==ZAt)throw new QAt(e)}else hEe(e.authorization)}function JAt(e){pEe(e);const t=i3e(Qh(e,-64,-32)),n=Qh(e,-t-64,-64),r=Qh(e,0,-t-64),[s,i,o]=lAt(YAt,n);return{authorization:KAt({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:r,...o&&o!=="0x"?{data:o,to:i}:{}}}function XAt(e){try{return pEe(e),!0}catch{return!1}}let QAt=class extends fn{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};function e_t(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function t_t(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?cf(e.nonce):void 0,storageProof:e.storageProof?e_t(e.storageProof):void 0}}async function n_t(e,{address:t,blockNumber:n,blockTag:r,storageKeys:s}){const i=r??"latest",o=n!==void 0?Rt(n):void 0,a=await e.request({method:"eth_getProof",params:[t,s,o||i]});return t_t(a)}async function r_t(e,{address:t,blockNumber:n,blockTag:r="latest",slot:s}){const i=n!==void 0?Rt(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,s,i||r]})}async function RK(e,{blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i,sender:o,nonce:a}){var h,f,g;const c=r||"latest",l=n!==void 0?Rt(n):void 0;let u=null;if(s?u=await e.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Rt(i)]},{dedupe:!0}):typeof i=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||c,Rt(i)]},{dedupe:!!l}):o&&typeof a=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[o,Rt(a)]},{dedupe:!0})),!u)throw new YV({blockHash:t,blockNumber:n,blockTag:c,hash:s,index:i});return(((g=(f=(h=e.chain)==null?void 0:h.formatters)==null?void 0:f.transaction)==null?void 0:g.format)||ZT)(u,"getTransaction")}async function s_t(e,{hash:t,transactionReceipt:n}){const[r,s]=await Promise.all([At(e,k$,"getBlockNumber")({}),t?At(e,RK,"getTransaction")({hash:t}):void 0]),i=(n==null?void 0:n.blockNumber)||(s==null?void 0:s.blockNumber);return i?r-i+1n:0n}async function MS(e,{hash:t}){var s,i,o;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new JV({hash:t});return(((o=(i=(s=e.chain)==null?void 0:s.formatters)==null?void 0:i.transactionReceipt)==null?void 0:o.format)||bK)(n,"getTransactionReceipt")}
1095async function i_t(e,t){var C;const{account:n,authorizationList:r,allowFailure:s=!0,blockNumber:i,blockOverrides:o,blockTag:a,stateOverride:c}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof((C=e.batch)==null?void 0:C.multicall)=="object"?e.batch.multicall:{},h=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return xb({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),f=[[]];let g=0,p=0;for(let E=0;E<l.length;E++){const{abi:b,address:S,args:v,functionName:x}=l[E];try{const A=_l({abi:b,args:v,functionName:x});p+=(A.length-2)/2,u>0&&p>u&&f[g].length>0&&(g++,p=(A.length-2)/2,f[g]=[]),f[g]=[...f[g],{allowFailure:!0,callData:A,target:S}]}catch(A){const I=my(A,{abi:b,address:S,args:v,docsPath:"/docs/contract/multicall",functionName:x,sender:n});if(!s)throw I;f[g]=[...f[g],{allowFailure:!0,callData:"0x",target:S}]}}const m=await Promise.allSettled(f.map(E=>At(e,Kd,"readContract")({...h===null?{code:wK}:{address:h},abi:vy,account:n,args:[E],authorizationList:r,blockNumber:i,blockOverrides:o,blockTag:a,functionName:"aggregate3",stateOverride:c}))),w=[];for(let E=0;E<m.length;E++){const b=m[E];if(b.status==="rejected"){if(!s)throw b.reason;for(let v=0;v<f[E].length;v++)w.push({status:"failure",error:b.reason,result:void 0});continue}const S=b.value;for(let v=0;v<S.length;v++){const{returnData:x,success:A}=S[v],{callData:I}=f[E][v],{abi:O,address:N,functionName:T,args:P}=l[w.length];try{if(I==="0x")throw new W6;if(!A)throw new _$({data:x});const _=H0({abi:O,args:P,data:x,functionName:T});w.push(s?{result:_,status:"success"}:_)}catch(_){const y=my(_,{abi:O,address:N,args:P,docsPath:"/docs/contract/multicall",functionName:T});if(!s)throw y;w.push({error:y,result:void 0,status:"failure"})}}}if(w.length!==l.length)throw new Ee("multicall results mismatch");return w}async function lz(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:s,returnFullTransactions:i,traceTransfers:o,validation:a}=t;try{const c=[];for(const h of s){const f=h.blockOverrides?c3e(h.blockOverrides):void 0,g=h.calls.map(m=>{const w=m,C=w.account?wl(w.account):void 0,E=w.abi?_l(w):w.data,b={...w,account:C,data:w.dataSuffix?Su([E||"0x",w.dataSuffix]):E,from:w.from??(C==null?void 0:C.address)};return $b(b),G6(b)}),p=h.stateOverrides?eK(h.stateOverrides):void 0;c.push({blockOverrides:f,calls:g,stateOverrides:p})}const u=(typeof n=="bigint"?Rt(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:i,traceTransfers:o,validation:a},u]})).map((h,f)=>
1095({...sK(h),calls:h.calls.map((g,p)=>{var O,N;const{abi:m,args:w,functionName:C,to:E}=s[f].calls[p],b=((O=g.error)==null?void 0:O.data)??g.returnData,S=BigInt(g.gasUsed),v=(N=g.logs)==null?void 0:N.map(T=>Wd(T)),x=g.status==="0x1"?"success":"failure",A=m&&x==="success"&&b!=="0x"?H0({abi:m,data:b,functionName:C}):null,I=(()=>{if(x==="success")return;let T;if(b==="0x"?T=new W6:b&&(T=new _$({data:b})),!!T)return my(T,{abi:m??[],address:E??"0x",args:w,functionName:C??"<unknown>"})})();return{data:b,gasUsed:S,logs:v,status:x,...x==="success"?{result:A}:{error:I}}})}))}catch(c){const l=c,u=VT(l,{});throw u instanceof K6?l:u}}function uz(e){let t=!0,n="",r=0,s="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new fn("Unable to normalize signature.");return s}function dz(e,t){const n=typeof e,r=t.type;switch(r){case"address":return nz(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>dz(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>dz(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function gEe(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return gEe(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?nz(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?nz(n[r],{strict:!1}):!1)return o}}function mEe(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?w0(e):e;return{...r,...n?{hash:Tv(r)}:{}}}function iP(e,t,n){const{args:r=[],prepare:s=!0}=n??{},i=NSt(t,{strict:!1}),o=e.filter(l=>i?l.type==="function"||l.type==="error"?wEe(l)===Qh(t,0,4):l.type==="event"?Tv(l)===t:!1:"name"in l&&l.name===t);if(o.length===0)throw new P_({name:t});if(o.length===1)return{...o[0],...s?{hash:Tv(o[0])}:{}};let a;for(const l of o){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...s?{hash:Tv(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((d,h)=>{const f="inputs"in l&&l.inputs[h];return f?dz(d,f):!1})){if(a&&"inputs"in a&&a.inputs){const d=gEe(l.inputs,a.inputs,r);if(d)throw new a_t({abiItem:l,type:d[0]},{abiItem:a,type:d[1]})}a=l}}const c=(()=>{if(a)return a;const[l,...u]=o;return{...l,overloads:u}})();if(!c)throw new P_({name:t});return{...c,...s?{hash:Tv(c)}:{}}}function wEe(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return iP(n,r)}return e[0]})();return Qh(Tv(t),0,4)}function o_t(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,s]=e;return iP(r,s)}return e[0]})(),n=typeof t=="string"?t:vu(t);return uz(n)}function Tv(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return iP(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:K3e(gK(o_t(t)))}let a_t=class extends fn{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${uz(vu(t.abiItem))}\`, and`,`\`${n.type}\` in \`${uz(vu(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}},P_=class extends fn{constructor({name:t,data:n,type:r="item"}){const s=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}};function c_t(...e){var i;const[t,n]=(()=>
1095{if(Array.isArray(e[0])){const[o,a]=e;return[u_t(o),a]}return e})(),{bytecode:r,args:s}=n;return Hd(r,(i=t.inputs)!=null&&i.length&&(s!=null&&s.length)?NK(t.inputs,s):"0x")}function l_t(e){return mEe(e)}function u_t(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new P_({name:"constructor"});return t}function d_t(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,d]=e;return[cae(l,u,{args:d}),d]}const[a,c]=e;return[a,c]})(),{overloads:r}=t,s=r?cae([t,...r],t.name,{args:n}):t,i=h_t(s),o=n.length>0?NK(s.inputs,n):void 0;return o?Hd(i,o):i}function z2(e,t={}){return mEe(e,t)}function cae(e,t,n){const r=iP(e,t,n);if(r.type!=="function")throw new P_({name:t,type:"function"});return r}function h_t(e){return wEe(e)}const yEe="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Yl="0x0000000000000000000000000000000000000000",f_t="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function p_t(e,t){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:i,traceAssetChanges:o,traceTransfers:a,validation:c}=t,l=t.account?wl(t.account):void 0;if(o&&!l)throw new Ee("`account` is required when `traceAssetChanges` is true");const u=l?c_t(l_t("constructor(bytes, bytes)"),{bytecode:mK,args:[f_t,d_t(z2("function getBalance(address)"),[l.address])]}):void 0,d=o?await Promise.all(t.calls.map(async B=>{if(!B.data&&!B.abi)return;const{accessList:k}=await N3e(e,{account:l.address,...B,data:B.abi?_l(B):B.data});return k.map(({address:D,storageKeys:U})=>U.length>0?D:null)})).then(B=>B.flat().filter(Boolean)):[],h=await lz(e,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:u}],stateOverrides:i},{calls:d.map((B,k)=>({abi:[z2("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:B,from:Yl,nonce:k})),stateOverrides:[{address:Yl,nonce:0}]}]:[],{calls:[...s,{to:Yl}].map(B=>({...B,from:l==null?void 0:l.address})),stateOverrides:i},...o?[{calls:[{data:u}]},{calls:d.map((B,k)=>({abi:[z2("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:B,from:Yl,nonce:k})),stateOverrides:[{address:Yl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[z2("function decimals() returns (uint256)")],functionName:"decimals",from:Yl,nonce:k})),stateOverrides:[{address:Yl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[z2("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Yl,nonce:k})),stateOverrides:[{address:Yl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[z2("function symbol() returns (string)")],functionName:"symbol",from:Yl,nonce:k})),stateOverrides:[{address:Yl,nonce:0}]}]:[]],traceTransfers:a,validation:c}),f=o?h[2]:h[0],[g,p,,m,w,C,E,b]=o?h:[],{calls:S,...v}=f,x=S.slice(0,-1)??[],A=(g==null?void 0:g.calls)??[],I=(p==null?void 0:p.calls)??[],O=[...A,...I].map(B=>B.status==="success"?zd(B.data):null),N=(m==null?void 0:m.calls)??[],T=(w==null?void 0:w.calls)??[],P=[...N,...T].map(B=>B.status==="success"?zd(B.data):null),_=((C==null?void 0:C.calls)??[]).map(B=>B.status==="success"?B.result:null),y=((b==null?void 0:b.calls)??[]).map(B=>B.status==="success"?B.result:null),$=((E==null?void 0:E.calls)??[]).map(B=>B.status==="success"?B.result:null),R=[];for(const[B,k]of P.entries()){const D=O[B];if(typeof k!="bigint"||typeof D!="bigint")continue;const U=_[B-1],F=y[B-1],K=$[B-1],q=B===0?{address:yEe,decimals:18,symbol:"ETH"}:{address:d[B-1],decimals:K||U?Number(U??1):void 0,symbol:F??void 0};R.some(H=>H.token.address===q.address)||R.push({token:q,value:{pre:D,post:k,diff:k-D}})}return{assetChanges:R,block:v,results:x}}const bEe="0x6492649264926492649264926492649264926492649264926492649264926492";function g_t(e){if(Qh(e,-32)!==bEe)throw new y_t(e)}function m_t(e){const{data:t,signature:n,to:r}=e;return Hd(NK(Y3e("address, bytes, bytes"),[r,t,n]),bEe)}function w_t(e){try{return g_t(e),!0}catch{return!1}}let y_t=class extends fn{constructor(t){super(`Value \`${t}
1095\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}};function hz({r:e,s:t,to:n="hex",v:r,yParity:s}){const i=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new dEe.Signature(zd(e),zd(t)).toCompactHex()}${i===0?"1b":"1c"}`;return n==="hex"?o:qd(o)}async function oP(e,t){var l,u,d,h;const{address:n,chain:r=e.chain,hash:s,erc6492VerifierAddress:i=t.universalSignatureVerifierAddress??((u=(l=r==null?void 0:r.contracts)==null?void 0:l.erc6492Verifier)==null?void 0:u.address),multicallAddress:o=t.multicallAddress??((h=(d=r==null?void 0:r.contracts)==null?void 0:d.multicall3)==null?void 0:h.address),mode:a="auto"}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const c=(()=>{const f=t.signature;return Iu(f)?f:typeof f=="object"&&"r"in f&&"s"in f?hz(f):Bs(f)})();try{if(a==="eoa")try{if(wy(A4(n),await f_({hash:s,signature:c})))return!0}catch{}return XAt(c)?await b_t(e,{...t,multicallAddress:o,signature:c}):await v_t(e,{...t,verifierAddress:i,signature:c})}catch(f){if(a!=="eoa")try{if(wy(A4(n),await f_({hash:s,signature:c})))return!0}catch{}if(f instanceof Ey)return!1;throw f}}async function b_t(e,t){var m;const{address:n,blockNumber:r,blockTag:s,hash:i,multicallAddress:o}=t,{authorization:a,data:c,signature:l,to:u}=JAt(t.signature);if(await N_(e,{address:n,blockNumber:r,blockTag:s})===Cb(["0xef0100",a.address]))return await E_t(e,{address:n,blockNumber:r,blockTag:s,hash:i,signature:l});const h={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:Rt(a.r,{size:32}),s:Rt(a.s,{size:32}),yParity:a.yParity};if(!await C9t({address:n,authorization:h}))throw new Ey;const g=await At(e,Kd,"readContract")({...o?{address:o}:{code:wK},authorizationList:[h],abi:vy,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:u??n,callData:c}]:[],{allowFailure:!0,target:n,callData:_l({abi:d3e,functionName:"isValidSignature",args:[i,l]})}]]}),p=(m=g[g.length-1])==null?void 0:m.returnData;if(p!=null&&p.startsWith("0x1626ba7e"))return!0;throw new Ey}async function v_t(e,t){const{address:n,factory:r,factoryData:s,hash:i,signature:o,verifierAddress:a,...c}=t,l=await(async()=>!r&&!s||w_t(o)?o:m_t({data:s,signature:o,to:r}))(),u=a?{to:a,data:_l({abi:x_,functionName:"isValidSig",args:[n,i,l]}),...c}:{data:eP({abi:x_,args:[n,i,l],bytecode:QF}),...c},{data:d}=await At(e,Z6,"call")(u).catch(h=>{throw h instanceof XV?new Ey:h});if(S5e(d??"0x0"))return!0;throw new Ey}async function E_t(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,signature:o}=t;if((await At(e,Kd,"readContract")({address:n,abi:d3e,args:[i,o],blockNumber:r,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof QV?new Ey:c})).startsWith("0x1626ba7e"))return!0;throw new Ey}let Ey=class extends Error{};async function C_t(e,{address:t,message:n,factory:r,factoryData:s,signature:i,...o}){const a=xK(n);return At(e,oP,"verifyHash")({address:t,factory:r,factoryData:s,hash:a,signature:i,...o})}async function $_t(e,t){const{address:n,factory:r,factoryData:s,signature:i,message:o,primaryType:a,types:c,domain:l,...u}=t,d=z3e({message:o,primaryType:a,types:c,domain:l});return At(e,oP,"verifyHash")({address:n,factory:r,factoryData:s,hash:d,signature:i,...u})}function vEe(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:s,poll:i,pollingInterval:o=e.pollingInterval}){const a=typeof i<"u"?i:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
1095onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let c;return a?(()=>{const d=Os(["watchBlockNumber",e.uid,t,n,o]);return Jm(d,{onBlockNumber:r,onError:s},h=>O$(async()=>{var f;try{const g=await At(e,k$,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(g===c)return;if(g-c>1&&n)for(let p=c+1n;p<g;p++)h.onBlockNumber(p,c),c=p}(c===void 0||g>c)&&(h.onBlockNumber(g,c),c=g)}catch(g){(f=h.onError)==null||f.call(h,g)}},{emitOnBegin:t,interval:o}))})():(()=>{const d=Os(["watchBlockNumber",e.uid,t,n]);return Jm(d,{onBlockNumber:r,onError:s},h=>{let f=!0,g=()=>f=!1;return(async()=>{try{const p=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find(C=>C.config.type==="webSocket"||C.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:m}=await p.subscribe({params:["newHeads"],onData(w){var E;if(!f)return;const C=zd((E=w.result)==null?void 0:E.number);h.onBlockNumber(C,c),c=C},onError(w){var C;(C=h.onError)==null||C.call(h,w)}});g=m,f||g()}catch(p){s==null||s(p)}})(),()=>g()})})()}async function x_t(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:s,onReplaced:i,retryCount:o=6,retryDelay:a=({count:S})=>~~(1<<S)*200,timeout:c=18e4}=t,l=Os(["waitForTransactionReceipt",e.uid,s]),u=(()=>{var S;return t.pollingInterval?t.pollingInterval:(S=e.chain)!=null&&S.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let d,h,f,g=!1,p,m;const{promise:w,resolve:C,reject:E}=p3e(),b=c?setTimeout(()=>{m==null||m(),p==null||p(),E(new Z5e({hash:s}))},c):void 0;return p=Jm(l,{onReplaced:i,resolve:C,reject:E},async S=>{if(f=await At(e,MS,"getTransactionReceipt")({hash:s}).catch(()=>{}),f&&r<=1){clearTimeout(b),S.resolve(f),p==null||p();return}m=At(e,vEe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(v){const x=I=>{clearTimeout(b),m==null||m(),I(),p==null||p()};let A=v;if(!g)try{if(f){if(r>1&&(!f.blockNumber||A-f.blockNumber+1n<r))return;x(()=>S.resolve(f));return}if(n&&!d&&(g=!0,await A_(async()=>{d=await At(e,RK,"getTransaction")({hash:s}),d.blockNumber&&(A=d.blockNumber)},{delay:a,retryCount:o}),g=!1),f=await At(e,MS,"getTransactionReceipt")({hash:s}),r>1&&(!f.blockNumber||A-f.blockNumber+1n<r))return;x(()=>S.resolve(f))}catch(I){if(I instanceof YV||I instanceof JV){if(!d){g=!1;return}try{h=d,g=!0;const O=await A_(()=>At(e,Sd,"getBlock")({blockNumber:A,includeTransactions:!0}),{delay:a,retryCount:o,shouldRetry:({error:P})=>P instanceof nK});g=!1;const N=O.transactions.find(({from:P,nonce:_})=>P===h.from&&_===h.nonce);if(!N||(f=await At(e,MS,"getTransactionReceipt")({hash:N.hash}),r>1&&(!f.blockNumber||A-f.blockNumber+1n<r)))return;let T="replaced";N.to===h.to&&N.value===h.value&&N.input===h.input?T="repriced":N.from===N.to&&N.value===0n&&(T="cancelled"),x(()=>{var P;(P=S.onReplaced)==null||P.call(S,{reason:T,replacedTransaction:h,transaction:N,transactionReceipt:f}),S.resolve(f)})}catch(O){x(()=>S.reject(O))}}else x(()=>S.reject(I))}}})}),w}function I_t(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:i,includeTransactions:o,poll:a,pollingInterval:c=e.pollingInterval}){const l=typeof a<"u"?a:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
1095onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=o??!1;let d;return l?(()=>{const g=Os(["watchBlocks",e.uid,t,n,r,u,c]);return Jm(g,{onBlock:s,onError:i},p=>O$(async()=>{var m;try{const w=await At(e,Sd,"getBlock")({blockTag:t,includeTransactions:u});if(w.number!==null&&(d==null?void 0:d.number)!=null){if(w.number===d.number)return;if(w.number-d.number>1&&n)for(let C=(d==null?void 0:d.number)+1n;C<w.number;C++){const E=await At(e,Sd,"getBlock")({blockNumber:C,includeTransactions:u});p.onBlock(E,d),d=E}}((d==null?void 0:d.number)==null||t==="pending"&&(w==null?void 0:w.number)==null||w.number!==null&&w.number>d.number)&&(p.onBlock(w,d),d=w)}catch(w){(m=p.onError)==null||m.call(p,w)}},{emitOnBegin:r,interval:c}))})():(()=>{let g=!0,p=!0,m=()=>g=!1;return(async()=>{try{r&&At(e,Sd,"getBlock")({blockTag:t,includeTransactions:u}).then(E=>{g&&p&&(s(E,void 0),p=!1)}).catch(i);const w=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),{unsubscribe:C}=await w.subscribe({params:["newHeads"],async onData(E){var S;if(!g)return;const b=await At(e,Sd,"getBlock")({blockNumber:(S=E.result)==null?void 0:S.number,includeTransactions:u}).catch(()=>{});g&&(s(b,d),p=!1,d=b)},onError(E){i==null||i(E)}});m=C,g||m()}catch(w){i==null||i(w)}})(),()=>m()})()}function S_t(e,{address:t,args:n,batch:r=!0,event:s,events:i,fromBlock:o,onError:a,onLogs:c,poll:l,pollingInterval:u=e.pollingInterval,strict:d}){const h=typeof l<"u"?l:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
1095onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=d??!1;return h?(()=>{const m=Os(["watchEvent",t,n,r,e.uid,s,u,o]);return Jm(m,{onLogs:c,onError:a},w=>{let C;o!==void 0&&(C=o-1n);let E,b=!1;const S=O$(async()=>{var v;if(!b){try{E=await At(e,T3e,"createEventFilter")({address:t,args:n,event:s,events:i,strict:f,fromBlock:o})}catch{}b=!0;return}try{let x;if(E)x=await At(e,tP,"getFilterChanges")({filter:E});else{const A=await At(e,k$,"getBlockNumber")({});C&&C!==A?x=await At(e,dK,"getLogs")({address:t,args:n,event:s,events:i,fromBlock:C+1n,toBlock:A}):x=[],C=A}if(x.length===0)return;if(r)w.onLogs(x);else for(const A of x)w.onLogs([A])}catch(x){E&&x instanceof gy&&(b=!1),(v=w.onError)==null||v.call(w,x)}},{emitOnBegin:!0,interval:u});return async()=>{E&&await At(e,nP,"uninstallFilter")({filter:E}),S()}})})():(()=>{let m=!0,w=()=>m=!1;return(async()=>{try{const C=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),E=i??(s?[s]:void 0);let b=[];E&&(b=[E.flatMap(x=>H6({abi:[x],eventName:x.name,args:n}))],s&&(b=b[0]));const{unsubscribe:S}=await C.subscribe({params:["logs",{address:t,topics:b}],onData(v){var A;if(!m)return;const x=v.result;try{const{eventName:I,args:O}=k4({abi:E??[],data:x.data,topics:x.topics,strict:f}),N=Wd(x,{args:O,eventName:I});c([N])}catch(I){let O,N;if(I instanceof S4||I instanceof jT){if(d)return;O=I.abiItem.name,N=(A=I.abiItem.inputs)==null?void 0:A.some(P=>!("name"in P&&P.name))}const T=Wd(x,{args:N?[]:{},eventName:O});c([T])}},onError(v){a==null||a(v)}});w=S,m||w()}catch(C){a==null||a(C)}})(),()=>w()})()}function A_t(e,{batch:t=!0,onError:n,onTransactions:r,poll:s,pollingInterval:i=e.pollingInterval}){return(typeof s<"u"?s:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const l=Os(["watchPendingTransactions",e.uid,t,i]);return Jm(l,{onTransactions:r,onError:n},u=>{let d;const h=O$(async()=>{var f;try{if(!d)try{d=await At(e,P3e,"createPendingTransactionFilter")({});return}catch(p){throw h(),p}const g=await At(e,tP,"getFilterChanges")({filter:d});if(g.length===0)return;if(t)u.onTransactions(g);else for(const p of g)u.onTransactions([p])}catch(g){(f=u.onError)==null||f.call(u,g)}},{emitOnBegin:!0,interval:i});return async()=>{d&&await At(e,nP,"uninstallFilter")({filter:d}),h()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(h){if(!l)return;const f=h.result;r([f])},onError(h){n==null||n(h)}});u=d,l||u()}catch(d){n==null||n(d)}})(),()=>u()})()}function __t(e){var d,h,f;const{scheme:t,statement:n,...r}=((d=e.match(N_t))==null?void 0:d.groups)??{},{chainId:s,expirationTime:i,issuedAt:o,notBefore:a,requestId:c,...l}=((h=e.match(T_t))==null?void 0:h.groups)??{},u=(f=e.split("Resources:")[1])==null?void 0:f.split(` 1096- `).slice(1);return{...r,...l,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const N_t=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,T_t=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function P_t(e){const{address:t,domain:n,message:r,nonce:s,scheme:i,time:o=new Date}=e;if(n&&r.domain!==n||s&&r.nonce!==s||i&&r.scheme!==i||r.expirationTime&&o>=r.expirationTime||r.notBefore&&o<r.notBefore)return!1;try{if(!r.address||!ml(r.address,{strict:!1})||t&&!wy(r.address,t))return!1}catch{return!1}return!0}async function O_t(e,t){const{address:n,domain:r,message:s,nonce:i,scheme:o,signature:a,time:c=new Date,...l}=t,u=__t(s);
1096if(!u.address||!P_t({address:n,domain:r,message:u,nonce:i,scheme:o,time:c}))return!1;const h=xK(s);return oP(e,{address:u.address,hash:h,signature:a,...l})}async function k_t(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var a,c,l;const s=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),o=(((l=(c=(a=e.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:l.format)||bK)(s);if(o.status==="reverted"&&n)throw new RIt({receipt:o});return o}function EEe(e){return{call:t=>Z6(e,t),createAccessList:t=>N3e(e,t),createBlockFilter:()=>d9t(e),createContractEventFilter:t=>B5e(e,t),createEventFilter:t=>T3e(e,t),createPendingTransactionFilter:()=>P3e(e),estimateContractGas:t=>XIt(e,t),estimateGas:t=>uK(e,t),getBalance:t=>h9t(e,t),getBlobBaseFee:()=>f9t(e),getBlock:t=>Sd(e,t),getBlockNumber:t=>k$(e,t),getBlockTransactionCount:t=>p9t(e,t),getBytecode:t=>N_(e,t),getChainId:()=>lK(e),getCode:t=>N_(e,t),getContractEvents:t=>V6e(e,t),getDelegation:t=>g9t(e,t),getEip712Domain:t=>w9t(e,t),getEnsAddress:t=>YSt(e,t),getEnsAvatar:t=>c9t(e,t),getEnsName:t=>l9t(e,t),getEnsResolver:t=>u9t(e,t),getEnsText:t=>_3e(e,t),getFeeHistory:t=>v9t(e,t),estimateFeesPerGas:t=>KIt(e,t),getFilterChanges:t=>tP(e,t),getFilterLogs:t=>E9t(e,t),getGasPrice:()=>iK(e),getLogs:t=>dK(e,t),getProof:t=>n_t(e,t),estimateMaxPriorityFeePerGas:t=>VIt(e,t),fillTransaction:t=>W6e(e,t),getStorageAt:t=>r_t(e,t),getTransaction:t=>RK(e,t),getTransactionConfirmations:t=>s_t(e,t),getTransactionCount:t=>B6e(e,t),getTransactionReceipt:t=>MS(e,t),multicall:t=>i_t(e,t),prepareTransactionRequest:t=>H6e(e,t),readContract:t=>Kd(e,t),sendRawTransaction:t=>VSt(e,t),sendRawTransactionSync:t=>k_t(e,t),simulate:t=>lz(e,t),simulateBlocks:t=>lz(e,t),simulateCalls:t=>p_t(e,t),simulateContract:t=>MSt(e,t),verifyHash:t=>oP(e,t),verifyMessage:t=>C_t(e,t),verifySiweMessage:t=>O_t(e,t),verifyTypedData:t=>$_t(e,t),uninstallFilter:t=>nP(e,t),waitForTransactionReceipt:t=>x_t(e,t),watchBlocks:t=>I_t(e,t),watchBlockNumber:t=>vEe(e,t),watchContractEvent:t=>HSt(e,t),watchEvent:t=>S_t(e,t),watchPendingTransactions:t=>A_t(e,t)}}function R_t(e){const{key:t="public",name:n="Public Client"}=e;return b3e({...e,key:t,name:n,type:"publicClient"}).extend(EEe)}function BK({key:e,methods:t,name:n,request:r,retryCount:s=3,retryDelay:i=150,timeout:o,type:a},c){const l=y3e();return{config:{key:e,methods:t,name:n,request:r,retryCount:s,retryDelay:i,timeout:o,type:a},request:x9t(r,{methods:t,retryCount:s,retryDelay:i,uid:l}),value:c}}function fz(e,t={}){const{key:n="fallback",name:r="Fallback",rank:s=!1,shouldThrow:i=CEe,retryCount:o,retryDelay:a}=t;return(({chain:c,pollingInterval:l=4e3,timeout:u,...d})=>{let h=e,f=()=>{};const g=BK({key:n,name:r,async request({method:p,params:m}){let w;const C=async(E=0)=>{const b=h[E]({...d,chain:c,retryCount:0,timeout:u});try{const S=await b.request({method:p,params:m});return f({method:p,params:m,response:S,transport:b,status:"success"}),S}catch(S){if(f({error:S,method:p,params:m,transport:b,status:"error"}),i(S)||E===h.length-1||(w??(w=h.slice(E+1).some(v=>{const{include:x,exclude:A}=v({chain:c}).config.methods||{};return x?x.includes(p):A?!A.includes(p):!0})),!w))throw S;return C(E+1)}};return C()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:p=>f=p,transports:h.map(p=>p({chain:c,retryCount:0}))});if(s){const p=typeof s=="object"?s:{};B_t({chain:c,interval:p.interval??l,onTransports:m=>h=m,ping:p.ping,sampleCount:p.sampleCount,timeout:p.timeout,transports:h,weights:p.weights})}return g})}function CEe(e){return!!("code"in e&&typeof e.code=="number"&&(e.code===N4.code||e.code===Qv.code||e.code===h_.code||fm.nodeMessage.test(e.message)||e.code===5e3))}function B_t({chain:e,interval:t=4e3,onTransports:n,ping:r,sampleCount:s=10,timeout:i=1e3,transports:o,weights:a={}}){const{stability:c=.7,latency:l=.3}=a,u=[],d=async()=>{const h=await Promise.all(o.map(async p=>{const m=p({chain:e,retryCount:0,timeout:i}),w=Date.now();let C,E;try{await(r?r({transport:m}):m.request({method:"net_listening"})),E=1}catch{E=0}finally{C=Date.now()}return{latency:C-w,success:E}}));u.push(h),u.length>s&&u.shift();const f=Math.max(...u.map(p=>Math.max(...p.map(({latency:m})=>m)))),g=o.map((p,m)=>{const w=u.map(v=>v[m].latency),E=1-w.reduce((v,x)=>v+x,0)/w.length/f,b=u.map(v=>v[m].success),S=b.reduce((v,x)=>v+x,0)/b.length;return S===0?[0,m]:[l*E+c*S,m]}).sort((p,m)=>m[0]-p[0]);n(g.map(([,p])=>o[p])),await S_(t),d()};d()}
1096let $Ee=class extends Ee{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}};function GE(e,t={}){const{batch:n,fetchFn:r,fetchOptions:s,key:i="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:u,raw:d}=t;return({chain:h,retryCount:f,timeout:g})=>{const{batchSize:p=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??f,C=g??t.timeout??1e4,E=e||(h==null?void 0:h.rpcUrls.default.http[0]);if(!E)throw new $Ee;const b=O9t(E,{fetchFn:r,fetchOptions:s,onRequest:c,onResponse:l,timeout:C});return BK({key:i,methods:o,name:a,async request({method:S,params:v}){const x={method:S,params:v},{schedule:A}=g3e({id:E,wait:m,shouldSplitBatch(T){return T.length>p},fn:T=>b.request({body:T}),sort:(T,P)=>T.id-P.id}),I=async T=>n?A(T):[await b.request({body:T})],[{error:O,result:N}]=await I(x);if(d)return{error:O,result:N};if(O)throw new HT({body:x,error:O,url:E});return N},retryCount:w,retryDelay:u,timeout:C,type:"http"},{fetchOptions:s,url:E})}}const D_t=Object.freeze(Object.defineProperty({__proto__:null,AbiConstructorNotFoundError:l5e,AbiConstructorParamsNotFoundError:WF,AbiDecodingDataSizeTooSmallError:UV,AbiDecodingZeroDataError:W6,AbiEncodingArrayLengthMismatchError:u5e,AbiEncodingBytesSizeMismatchError:d5e,AbiEncodingLengthMismatchError:h5e,AbiErrorInputsNotFoundError:f5e,AbiErrorNotFoundError:HF,AbiErrorSignatureNotFoundError:LV,AbiEventNotFoundError:VF,AbiEventSignatureEmptyTopicsError:p5e,AbiEventSignatureNotFoundError:g5e,AbiFunctionNotFoundError:fy,AbiFunctionOutputsNotFoundError:MV,AbiFunctionSignatureNotFoundError:m5e,AccountStateConflictError:H5e,AtomicReadyWalletRejectedUpgradeError:u_,AtomicityNotSupportedError:d_,BaseError:Ee,BaseFeeScalarError:tK,BlockNotFoundError:nK,BundleTooLargeError:l_,BytesSizeMismatchError:w5e,CallExecutionError:XV,ChainDisconnectedError:r_,ChainDoesNotSupportContract:I_,CircularReferenceError:v7,ClientChainNotConfiguredError:yK,ContractFunctionExecutionError:QV,ContractFunctionRevertedError:VA,ContractFunctionZeroDataError:Y5e,CounterfactualDeploymentFailedError:J5e,DecodeLogDataMismatch:S4,DecodeLogTopicsMismatch:jT,DuplicateIdError:a_,Eip1559FeesNotSupportedError:GT,EnsAvatarInvalidNftUriError:ov,EnsAvatarUnsupportedNamespaceError:I3e,EnsAvatarUriResolutionError:rP,EstimateGasExecutionError:T6e,ExecutionRevertedError:fm,FeeCapTooHighError:P4,FeeCapTooLowError:p_,FilterTypeNotSupportedError:E5e,HttpRequestError:Bm,InsufficientFundsError:y_,IntegerOutOfRangeError:FT,InternalRpcError:D5,IntrinsicGasTooHighError:b_,IntrinsicGasTooLowError:v_,InvalidAbiDecodingTypeError:b5e,InvalidAbiEncodingTypeError:y5e,InvalidAbiItemError:u7,InvalidAbiParametersError:h7,InvalidAbiTypeParameterError:w7,InvalidAddressError:x0,InvalidArrayError:jV,InvalidBytesBooleanError:$5e,InvalidDefinitionTypeError:v5e,InvalidDomainError:U3e,InvalidFunctionModifierError:m7,InvalidHexBooleanError:x5e,InvalidInputRpcError:gy,InvalidModifierError:g7,InvalidParameterError:f7,InvalidParamsRpcError:YA,InvalidParenthesisError:E7,InvalidPrimaryTypeError:L3e,InvalidRequestRpcError:GA,InvalidSerializableTransactionError:K5e,InvalidSignatureError:M0,InvalidStructSignatureError:b7,InvalidStructTypeError:M3e,JsonRpcVersionUnsupportedError:QA,LimitExceededRpcError:T4,MaxFeePerGasTooLowError:k6e,MethodNotFoundRpcError:ZA,MethodNotSupportedRpcError:_v,NonceMaxValueError:w_,NonceTooHighError:g_,NonceTooLowError:m_,ParseRpcError:KA,ProviderDisconnectedError:n_,ProviderRpcError:ya,RawContractError:_$,ResourceNotFoundRpcError:JA,ResourceUnavailableRpcError:XA,RpcError:wa,RpcRequestError:HT,SizeExceedsPaddingSizeError:zV,SizeOverflowError:I5e,SliceOffsetOutOfBoundsError:FV,SolidityProtectedKeywordError:p7,StateAssignmentConflictError:V5e,SwitchChainError:s_,TimeoutError:ZF,TipAboveFeeCapError:O4,TransactionExecutionError:G5e,TransactionNotFoundError:YV,TransactionReceiptNotFoundError:JV,TransactionRejectedRpcError:N4,TransactionTypeNotSupportedError:E_,UnauthorizedProviderError:e_,UnknownBundleIdError:c_,UnknownNodeError:K6,UnknownRpcError:x6e,UnknownSignatureError:y7,UnknownTypeError:d7,UnsupportedChainIdError:o_,UnsupportedNonOptionalCapabilityError:i_,
1096UnsupportedProviderMethodError:t_,UrlRequiredError:$Ee,UserRejectedRequestError:Qv,WaitForTransactionReceiptTimeoutError:Z5e,assertRequest:$b,blobsToCommitments:oK,blobsToProofs:aK,boolToBytes:A5e,boolToHex:qV,bytesToBigInt:M5e,bytesToBool:j5e,bytesToHex:Bs,bytesToNumber:Xh,bytesToString:F5e,ccipFetch:T_,ccipRequest:T_,checksumAddress:x$,commitmentToVersionedHash:U6e,commitmentsToVersionedHashes:L6e,concat:Su,concatBytes:N5e,concatHex:Cb,createClient:b3e,createPublicClient:R_t,createTransport:BK,decodeAbiParameters:V6,decodeErrorResult:ZV,decodeEventLog:k4,decodeFunctionData:v3e,decodeFunctionResult:H0,defineChain:T9t,deploylessCallViaBytecodeBytecode:mK,deploylessCallViaFactoryBytecode:h3e,encodeAbiParameters:W0,encodeDeployData:eP,encodeErrorResult:tz,encodeEventTopics:H6,encodeFunctionData:_l,encodeFunctionResult:E3e,erc20Abi:KE,erc6492SignatureValidatorAbi:x_,erc6492SignatureValidatorByteCode:QF,ethAddress:yEe,etherUnits:q5e,fallback:fz,formatBlock:sK,formatEther:WT,formatGwei:ca,formatLog:Wd,formatTransaction:ZT,formatTransactionReceipt:bK,formatTransactionRequest:G6,formatUnits:I$,getAbiItem:m1,getAddress:A4,getChainContractAddress:xb,getContractError:my,getEventSelector:B5,getEventSignature:VE,getFunctionSelector:py,getFunctionSignature:VE,getTransactionType:q6e,getTypesForEIP712Domain:F3e,gweiUnits:W5e,hashDomain:q3e,hashMessage:xK,hashStruct:IK,hashTypedData:z3e,hexToBigInt:zd,hexToBool:S5e,hexToBytes:qd,hexToNumber:cf,http:GE,isAddress:ml,isAddressEqual:wy,isHex:Iu,keccak256:Ni,labelhash:x3e,maxUint256:O6e,multicall3Abi:vy,namehash:__,numberToBytes:_5e,numberToHex:Rt,offchainLookup:k3e,offchainLookupAbiItem:$K,offchainLookupSignature:O3e,pad:vb,padBytes:C5e,padHex:d0,parseAbi:j0,parseAbiItem:w0,parseAbiParameters:y0,parseEventLogs:YT,prepareEncodeFunctionData:D5e,presignMessagePrefix:B3e,publicActions:EEe,recoverAddress:f_,recoverPublicKey:I6e,rpcTransactionType:P6e,serializeSignature:hz,sha256:D6e,shouldThrow:CEe,signatureToHex:hz,size:es,slice:Ym,sliceBytes:WV,sliceHex:O5e,stringToBytes:Rm,stringToHex:R5,stringify:Os,toBlobSidecars:z6e,toBlobs:F6e,toBytes:Eb,toEventHash:HA,toEventSelector:B5,toEventSignature:VE,toFunctionHash:HA,toFunctionSelector:py,toFunctionSignature:VE,toHex:$0,toPrefixedMessage:D3e,toRlp:S6e,transactionType:rK,trim:km,universalSignatureValidatorAbi:x_,universalSignatureValidatorByteCode:QF,validateTypedData:j3e,withCache:w3e,withRetry:A_,withTimeout:R3e,zeroAddress:Yl},Symbol.toStringTag,{value:"Module"}));async function mE(...e){const t=await fetch(...e);if(!t.ok)throw new Error(`HTTP status code: ${t.status}`,{cause:t});return t}let B$=class{constructor({baseUrl:t,clientId:n}){this.baseUrl=t,this.clientId=n}async get({headers:t,signal:n,cache:r,...s}){const i=this.createUrl(s);return(await mE(i,{method:"GET",headers:t,signal:n,cache:r})).json()}async getBlob({headers:t,signal:n,...r}){const s=this.createUrl(r);return(await mE(s,{method:"GET",headers:t,signal:n})).blob()}async post({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await mE(i,{method:"POST",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async put({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await mE(i,{method:"PUT",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async delete({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await mE(i,{method:"DELETE",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}createUrl({path:t,params:n}){const r=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,i])=>{i&&r.searchParams.append(s,i)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}sendBeacon({body:t,...n}){const r=this.createUrl(n);return navigator.sendBeacon(r.toString(),t?JSON.stringify(t):void 0)}};const pz={getFeatureValue(e,t){const n=t==null?void 0:t[e];return n===void 0?is.DEFAULT_FEATURES[e]:n},filterSocialsByPlatform(e){if(!e||!e.length)return e;let t=e;return Be.isTelegram()&&(Be.isIos()&&(t=t.filter(n=>n!=="google")),Be.isMac()&&(t=t.filter(n=>n!=="x")),Be.isAndroid()&&(t=t.filter(n=>!["facebook","x"].includes(n)))),Be.isMobile()&&(t=t.filter(n=>n!=="facebook")),t},isSocialsEnabled(){var e,t,n,r;return Array.isArray((e=ke.state.features)==null?void 0:e.socials)&&((t=ke.state.features)==null?void 0:t.socials.length)>0||Array.isArray((n=ke.state.remoteFeatures)==null?void 0:n.socials)&&((r=ke.state.remoteFeatures)==null?void 0:r.socials.length)>0},isEmailEnabled(){var e,t;return!!((e=ke.state.features)!=null&&e.email||(t=ke.state.remoteFeatures)!=null&&t.email)}},yt=qr({features:is.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:is.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{},enableMobileFullScreen:!1,coinbasePreference:"all"}),ke={state:yt,subscribeKey(e,t){return Xi(yt,e,t)},setOptions(e){Object.assign(yt,e)},setRemoteFeatures(e){var n,r;if(!e)return;const t={...yt.remoteFeatures,...e};yt.remoteFeatures=t,(n=yt.remoteFeatures)!=null&&n.socials&&(yt.remoteFeatures.socials=pz.filterSocialsByPlatform(yt.remoteFeatures.socials)),(r=yt.features)!=null&&r.pay&&(yt.remoteFeatures.email=!1,yt.remoteFeatures.socials=!1)},setFeatures(e){var n;if(!e)return;yt.features||(yt.features=is.DEFAULT_FEATURES);const t={...yt.features,...e};yt.features=t,(n=yt.features)!=null&&n.pay&&yt.remoteFeatures&&(yt.remoteFeatures.email=!1,yt.remoteFeatures.socials=!1)},setProjectId(e){yt.projectId=e},setCustomRpcUrls(e){yt.customRpcUrls=e},setAllWallets(e){yt.allWallets=e},setIncludeWalletIds(e){yt.includeWalletIds=e},setExcludeWalletIds(e){yt.excludeWalletIds=e},setFeaturedWalletIds(e){yt.featuredWalletIds=e},setTokens(e){yt.tokens=e},setTermsConditionsUrl(e){yt.termsConditionsUrl=e},setPrivacyPolicyUrl(e){yt.privacyPolicyUrl=e},setCustomWallets(e){yt.customWallets=e},setIsSiweEnabled(e){yt.isSiweEnabled=e},setIsUniversalProvider(e){yt.isUniversalProvider=e},setSdkVersion(e){yt.sdkVersion=e},setMetadata(e){yt.metadata=e},setDisableAppend(e){yt.disableAppend=e},setEIP6963Enabled(e){yt.enableEIP6963=e},setEnableCoinbase(e){yt.enableCoinbase=e},setDebug(e){yt.debug=e},setEnableWalletGuide(e){yt.enableWalletGuide=e},setEnableAuthLogger(e){yt.enableAuthLogger=e},setEnableWallets(e){yt.enableWallets=e},setPreferUniversalLinks(e){yt.experimental_preferUniversalLinks=e},setSIWX(e){if(e)for(const[t,n]of Object.entries(is.SIWX_DEFAULTS))e[t]??(e[t]=n);yt.siwx=e},setConnectMethodsOrder(e){yt.features={...yt.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){yt.features={...yt.features,walletFeaturesOrder:e}},setSocialsOrder(e){yt.remoteFeatures={...yt.remoteFeatures,socials:e}},setCollapseWallets(e){yt.features={...yt.features,collapseWallets:e}},setEnableEmbedded(e){yt.enableEmbedded=e},setAllowUnsupportedChain(e){yt.allowUnsupportedChain=e},setManualWCControl(e){yt.manualWCControl=e},setEnableNetworkSwitch(e){yt.enableNetworkSwitch=e},setEnableMobileFullScreen(e){yt.enableMobileFullScreen=Be.isMobile()&&e},setEnableReconnect(e){yt.enableReconnect=e},setCoinbasePreference(e){yt.coinbasePreference=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([t,n])=>{n&&(yt.defaultAccountTypes[t]=n)})},setUniversalProviderConfigOverride(e){yt.universalProviderConfigOverride=e},getUniversalProviderConfigOverride(){return yt.universalProviderConfigOverride}
vendor: 4,158 bytes, line 1096
1096,getSnapshot(){return x4(yt)}},K1=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),Hs=qr({...K1}),U_t={state:Hs,subscribeKey(e,t){return Xi(Hs,e,t)},showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){const t=Be.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){Hs.message=K1.message,Hs.variant=K1.variant,Hs.svg=K1.svg,Hs.open=K1.open,Hs.autoClose=K1.autoClose},_showMessage({message:e,svg:t,variant:n="success",autoClose:r=K1.autoClose}){Hs.open?(Hs.open=!1,setTimeout(()=>{Hs.message=e,Hs.variant=n,Hs.svg=t,Hs.open=!0,Hs.autoClose=r},150)):(Hs.message=e,Hs.variant=n,Hs.svg=t,Hs.open=!0,Hs.autoClose=r)}},Xn=U_t,L_t={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},xEe=Be.getBlockchainApiUrl(),Mo=qr({clientId:null,api:new B$({baseUrl:xEe,clientId:null}),supportedChains:{http:[],ws:[]}}),Mt={state:Mo,async get(e){const{st:t,sv:n}=Mt.getSdkProperties(),r=ke.state.projectId,s={...e.params||{},st:t,sv:n,projectId:r};return Mo.api.get({...e,params:s})},getSdkProperties(){const{sdkType:e,sdkVersion:t}=ke.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{Mo.supportedChains.http.length||await Mt.getSupportedNetworks()}catch{return!1}return Mo.supportedChains.http.includes(e)},async getSupportedNetworks(){try{const e=await Mt.get({path:"v1/supported-chains"});return Mo.supportedChains=e,e}catch{return Mo.supportedChains}},async fetchIdentity({address:e}){const t=Ye.getIdentityFromCacheForAddress(e);if(t)return t;const n=await Mt.get({path:`/v1/identity/${e}`,params:{sender:Q.state.activeCaipAddress?Be.getPlainAddress(Q.state.activeCaipAddress):void 0}});return Ye.updateIdentityCache({address:e,identity:n,timestamp:Date.now()}),n},async fetchTransactions({account:e,cursor:t,signal:n,cache:r,chainId:s}){var c;if(!await Mt.isNetworkSupported((c=Q.state.activeCaipNetwork)==null?void 0:c.caipNetworkId))return{data:[],next:void 0};const o=Ye.getTransactionsCacheForAddress({address:e,chainId:s});if(o)return o;const a=await Mt.get({path:`/v1/account/${e}/history`,params:{cursor:t,chainId:s},signal:n,cache:r});return Ye.updateTransactionsCache({address:e,chainId:s,timestamp:Date.now(),transactions:a}),a},async fetchSwapQuote({amount:e,userAddress:t,from:n,to:r,gasPrice:s}){var o;return await Mt.isNetworkSupported((o=Q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?Mt.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:n,to:r,gasPrice:s}}):{quotes:[]}},async fetchSwapTokens({chainId:e}){var n;return await Mt.isNetworkSupported((n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Mt.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]}},async getAddressBalance({caipNetworkId:e,address:t,method:n="getAddressBalance",params:r}){return Mo.api.post({path:`/v1?chainId=${e}&projectId=${ke.state.projectId}`,body:{id:"1",jsonrpc:"2.0",method:n,params:r??{address:t}}}).then(s=>s.result)},async fetchTokenPrice({addresses:e,caipNetworkId:t=(n=>(n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)()}
1096){if(!await Mt.isNetworkSupported(t))return{fungibles:[]};const s=Ye.getTokenPriceCacheForAddresses(e);if(s)return s;const i=await Mo.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:ke.state.projectId},headers:{"Content-Type":"application/json"}});return Ye.updateTokenPriceCache({addresses:e,timestamp:Date.now(),tokenPrice:i}),i},async fetchSwapAllowance({tokenAddress:e,userAddress:t}){var r;return await Mt.isNetworkSupported((r=Q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?Mt.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:e}){var s;const{st:t,sv:n}=Mt.getSdkProperties();if(!await Mt.isNetworkSupported((s=Q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))throw new Error("Network not supported for Gas Price");return Mt.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:n}})},async generateSwapCalldata({amount:e,from:t,to:n,userAddress:r,disableEstimate:s}){var o;if(!await Mt.isNetworkSupported((o=Q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Mo.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:is.CONVERT_SLIPPAGE_TOLERANCE},projectId:ke.state.projectId,from:t,to:n,userAddress:r,disableEstimate:s}})},async generateApproveCalldata({from:e,to:t,userAddress:n}){var o;const{st:r,sv:s}=Mt.getSdkProperties();if(!await Mt.isNetworkSupported((o=Q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Mt.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:n,from:e,to:t,st:r,sv:s}})},async getBalance(e,t,n){var l;const{st:r,sv:s}=Mt.getSdkProperties();if(!await Mt.isNetworkSupported((l=Q.state.activeCaipNetwork)==null?void 0:l.caipNetworkId))return Xn.showError("Token Balance Unavailable"),{balances:[]};const o=`${t}:${e}`,a=Ye.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await Mt.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:n,st:r,sv:s}});return Ye.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(e){var n;return await Mt.isNetworkSupported((n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Mt.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:e}){var r,s;if(!await Mt.isNetworkSupported((r=Q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId))return[];const n=(s=Q.getAccountData())==null?void 0:s.address;return Mt.get({path:`/v1/profile/reverse/${e}`,params:{sender:n,apiVersion:"2"}})},async getEnsNameSuggestions(e){var n;return await Mt.isNetworkSupported((n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Mt.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:e,address:t,message:n,signature:r}){var i;return await Mt.isNetworkSupported((i=Q.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?Mo.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:n,signature:r},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:e,partnerUserId:t,defaultNetwork:n,purchaseAmount:r,paymentAmount:s}){var a;return await Mt.isNetworkSupported((a=Q.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await Mo.api.post({path:"/v1/generators/onrampurl",params:{projectId:ke.state.projectId},body:{destinationWallets:e,defaultNetwork:n,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:r,presetFiatAmount:s}})).url:""},async getOnrampOptions(){var t;if(!await Mt.isNetworkSupported((t=Q.state.activeCaipNetwork)==null?void 0:t.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await Mt.get({path:"/v1/onramp/options"})}catch{return L_t}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}){var s;try{return await Mt.isNetworkSupported((s=Q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?await Mo.api.post({path:"/v1/onramp/quote",params:{projectId:ke.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}}):null}catch{return{networkFee:{amount:n,currency:t.id},paymentSubtotal:{amount:n,currency:t.id},paymentTotal:{amount:n,currency:t.id},purchaseAmount:{amount:n,currency:t.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(e){var n;return await Mt.isNetworkSupported((n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?Mt.get({path:`/v1/sessions/${e}`}):[]},async revokeSmartSession(e,t,n){var s;return await Mt.isNetworkSupported((s=Q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?Mo.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:ke.state.projectId},body:{pci:t,signature:n}}):{success:!1}},setClientId(e){Mo.clientId=e,Mo.api=new B$({baseUrl:xEe,clientId:e})}},M_t=Object.freeze({enabled:!0,events:[]}),j_t=new B$({baseUrl:Be.getAnalyticsUrl(),clientId:null}),F_t=5,z_t=60*1e3,Tg=qr({...M_t}),q_t={state:Tg,subscribeKey(e,t){return Xi(Tg,e,t)},async sendError(e,t){if(!Tg.enabled)return;const n=Date.now();if(Tg.events.filter(i=>{const o=new Date(i.properties.timestamp||"").getTime();return n-o<z_t}).length>=F_t)return;const s={type:"error",event:t,properties:{errorType:e.name,errorMessage:e.message,stackTrace:e.stack,timestamp:new Date().toISOString()}};Tg.events.push(s);try{if(typeof window>"u")return;const{projectId:i,sdkType:o,sdkVersion:a}=ke.state;await j_t.post({path:"/e",params:{projectId:i,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:Be.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:t,errorType:e.name,errorMessage:e.message,stackTrace:e.stack}}})}catch{}},enable(){Tg.enabled=!0},disable(){Tg.enabled=!1},clearEvents(){Tg.events=[]}};
vendor: 5,117 bytes, lines 1096-1098
1096let U5=class gz extends Error{constructor(t,n,r){super(t),this.originalName="AppKitError",this.name="AppKitError",this.category=n,this.originalError=r,r&&r instanceof Error&&(this.originalName=r.name),Object.setPrototypeOf(this,gz.prototype);let s=!1;if(r instanceof Error&&typeof r.stack=="string"&&r.stack){const i=r.stack,o=i.indexOf(` 1097`);if(o>-1){const a=i.substring(o+1);this.stack=`${this.name}: ${this.message} 1098${a}`,s=!0}}s||(Error.captureStackTrace?Error.captureStackTrace(this,gz):this.stack||(this.stack=`${this.name}: ${this.message}`))}};function lae(e,t){let n="";try{e instanceof Error?n=e.message:typeof e=="string"?n=e:typeof e=="object"&&e!==null?Object.keys(e).length===0?n="Unknown error":n=(e==null?void 0:e.message)||JSON.stringify(e):n=String(e)}catch(s){n="Unknown error",console.error("Error parsing error message",s)}const r=e instanceof U5?e:new U5(n,t,e);throw q_t.sendError(r,r.category),r}function ju(e,t="INTERNAL_SDK_ERROR"){const n={};return Object.keys(e).forEach(r=>{const s=e[r];if(typeof s=="function"){let i=s;s.constructor.name==="AsyncFunction"?i=async(...o)=>{try{return await s(...o)}catch(a){return lae(a,t)}}:i=(...o)=>{try{return s(...o)}catch(a){return lae(a,t)}},n[r]=i}else n[r]=s}),n}const Fc=qr({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),W_t={state:Fc,subscribeNetworkImages(e){return Ji(Fc.networkImages,()=>e(Fc.networkImages))},subscribeKey(e,t){return Xi(Fc,e,t)},subscribe(e){return Ji(Fc,()=>e(Fc))},setWalletImage(e,t){Fc.walletImages[e]=t},setNetworkImage(e,t){Fc.networkImages[e]=t},setChainImage(e,t){Fc.chainImages[e]=t},setConnectorImage(e,t){Fc.connectorImages={...Fc.connectorImages,[e]:t}},setTokenImage(e,t){Fc.tokenImages[e]=t},setCurrencyImage(e,t){Fc.currencyImages[e]=t}},Ho=ju(W_t),uae={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:"",sui:"",stacks:"",ton:"20f673c0-095e-49b2-07cf-eb5049dcf600",tron:"3502bb86-cc4e-420f-a387-59ea63a28b00"},q2=qr({networkImagePromises:{},tokenImagePromises:{}}),wc={async fetchWalletImage(e){if(e)return await De._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(!e)return;const t=this.getNetworkImageById(e);return t||(q2.networkImagePromises[e]||(q2.networkImagePromises[e]=De._fetchNetworkImage(e)),await q2.networkImagePromises[e],this.getNetworkImageById(e))},async fetchTokenImage(e){if(e)return q2.tokenImagePromises[e]||(q2.tokenImagePromises[e]=De._fetchTokenImage(e)),await q2.tokenImagePromises[e],this.getTokenImage(e)},getWalletImageById(e){if(e)return Ho.state.walletImages[e]},getWalletImage(e){if(e!=null&&e.image_url)return e==null?void 0:e.image_url;if(e!=null&&e.image_id)return Ho.state.walletImages[e.image_id]},getNetworkImage(e){var t,n,r;if((t=e==null?void 0:e.assets)!=null&&t.imageUrl)return(n=e==null?void 0:e.assets)==null?void 0:n.imageUrl;if((r=e==null?void 0:e.assets)!=null&&r.imageId)return Ho.state.networkImages[e.assets.imageId]},getNetworkImageById(e){if(e)return Ho.state.networkImages[e]},getConnectorImage(e){var t;if(e!=null&&e.imageUrl)return e.imageUrl;if((t=e==null?void 0:e.info)!=null&&t.icon)return e.info.icon;if(e!=null&&e.imageId)return Ho.state.connectorImages[e.imageId]},getChainImage(e){return Ho.state.networkImages[uae[e]]},getTokenImage(e){if(e)return Ho.state.tokenImages[e]},getWalletImageUrl(e){if(!e)return"";const{projectId:t,sdkType:n,sdkVersion:r}=ke.state,s=new URL(`${ye.W3M_API_URL}/getWalletImage/${e}`);return s.searchParams.set("projectId",t),s.searchParams.set("st",n),s.searchParams.set("sv",r),s.toString()},getAssetImageUrl(e){if(!e)return"";const{projectId:t,sdkType:n,sdkVersion:r}=ke.state,s=new URL(`${ye.W3M_API_URL}/public/getAssetImage/${e}`);return s.searchParams.set("projectId",t),s.searchParams.set("st",n),s.searchParams.set("sv",r),s.toString()},getChainNamespaceImageUrl(e){return this.getAssetImageUrl(uae[e])},async getImageByToken(e,t){if(e==="native"){const r=ye.NATIVE_IMAGE_IDS_BY_NAMESPACE[t]??null;return r?wc.fetchNetworkImage(r):void 0}const[,n]=Object.entries(ye.TOKEN_SYMBOLS_BY_ADDRESS).find(([r])=>r.toLowerCase()===e.toLowerCase())??[];if(n)return wc.fetchTokenImage(n)}},Gs={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app",androidPackage:"app.phantom"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com",evmDeeplink:"cbwallet://miniapp"},BINANCE:{id:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25",appId:"yFK5FCqYprrXDiVFbhyRx7",deeplink:"bnc://app.binance.com/mp/app",url:"https://app.binance.com/en/download"}},IEe={isCustomDeeplinkWallet(e,t){return e===Gs.PHANTOM.id?t===ye.CHAIN.SOLANA||t===ye.CHAIN.EVM||t===ye.CHAIN.BITCOIN:e===Gs.SOLFLARE.id?t===ye.CHAIN.SOLANA:e===Gs.COINBASE.id?t===ye.CHAIN.SOLANA||t===ye.CHAIN.EVM:e===Gs.BINANCE.id?t===ye.CHAIN.BITCOIN:!1}
1098,handleMobileDeeplinkRedirect(e,t,n){const r=window.location.href,s=encodeURIComponent(r),i=(n==null?void 0:n.isCoinbaseDisabled)??!1;if(e===Gs.PHANTOM.id&&!("phantom"in window)){const o=r.startsWith("https")?"https":"http",a=r.split("/")[2],c=encodeURIComponent(`${o}://${a}`),l=`${Gs.PHANTOM.url}/ul/browse/${s}?ref=${c}`;if(Be.isAndroid()){const u=`intent://browse/${s}?ref=${c}#Intent;scheme=phantom;package=${Gs.PHANTOM.androidPackage};end`;window.location.href=u}else window.location.href=l}if(e===Gs.SOLFLARE.id&&t===ye.CHAIN.SOLANA&&!("solflare"in window)&&(window.location.href=`${Gs.SOLFLARE.url}/ul/v1/browse/${s}?ref=${s}`),t===ye.CHAIN.SOLANA&&e===Gs.COINBASE.id&&(i||!("coinbaseSolana"in window))&&(window.location.href=`${Gs.COINBASE.url}/dapp?cb_url=${s}`),t===ye.CHAIN.EVM&&e===Gs.COINBASE.id&&(i||!("coinbaseWalletExtension"in window))&&(window.location.href=`${Gs.COINBASE.evmDeeplink}?url=${s}`),t===ye.CHAIN.BITCOIN&&e===Gs.BINANCE.id&&!("binancew3w"in window)){const o=Q.state.activeCaipNetwork,a=window.btoa("/pages/browser/index"),c=window.btoa(`url=${s}&defaultChainId=${(o==null?void 0:o.id)??1}`),l=new URL(Gs.BINANCE.deeplink);l.searchParams.set("appId",Gs.BINANCE.appId),l.searchParams.set("startPagePath",a),l.searchParams.set("startPageQuery",c);const u=new URL(Gs.BINANCE.url);u.searchParams.set("_dp",window.btoa(l.toString())),window.location.href=u.toString()}}},H_t=Be.getAnalyticsUrl(),V_t=new B$({baseUrl:H_t,clientId:null}),K_t=["MODAL_CREATED"],G_t=45,dae=1e3*10,us=qr({timestamp:Date.now(),lastFlush:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"},pendingEvents:[],subscribedToVisibilityChange:!1,walletImpressions:[]}),It={state:us,subscribe(e){return Ji(us,()=>e(us))},getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=ke.state;return{projectId:e,st:t,sv:n||"html-wagmi-4.2.2"}},shouldFlushEvents(){const e=JSON.stringify(us.pendingEvents).length/1024>G_t,t=us.lastFlush+dae<Date.now();return e||t},_setPendingEvent(e){var t,n;try{let r=(t=Q.getAccountData())==null?void 0:t.address;if("address"in e.data&&e.data.address&&(r=e.data.address),K_t.includes(e.data.event)||typeof window>"u")return;const s=(n=Q.getActiveCaipNetwork())==null?void 0:n.caipNetworkId;this.state.pendingEvents.push({eventId:Be.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:r,properties:{..."properties"in e.data?e.data.properties:{},caipNetworkId:s}}}),us.reportedErrors.FORBIDDEN=!1,It.shouldFlushEvents()&&It._submitPendingEvents()}catch(r){console.warn("_setPendingEvent",r)}},sendEvent(e){var n;us.timestamp=Date.now(),us.data=e;const t=["INITIALIZE","CONNECT_SUCCESS","SOCIAL_LOGIN_SUCCESS"];((n=ke.state.features)!=null&&n.analytics||t.includes(e.event))&&It._setPendingEvent(us),this.subscribeToFlushTriggers()},sendWalletImpressionEvent(e){us.walletImpressions.push(e)},_transformPendingEventsForBatch(e){try{return e.filter(t=>t.props.event!=="WALLET_IMPRESSION_V2")}catch{return e}},_submitPendingEvents(){if(us.lastFlush=Date.now(),!(us.pendingEvents.length===0&&us.walletImpressions.length===0))try{const e=It._transformPendingEventsForBatch(us.pendingEvents);us.walletImpressions.length&&e.push({eventId:Be.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:Date.now(),props:{type:"track",event:"WALLET_IMPRESSION_V2",items:[...us.walletImpressions]}}),V_t.sendBeacon({path:"/batch",params:It.getSdkProperties(),body:e}),us.reportedErrors.FORBIDDEN=!1,us.pendingEvents=[],us.walletImpressions=[]}catch{us.reportedErrors.FORBIDDEN=!0}},subscribeToFlushTriggers(){var e,t,n;us.subscribedToVisibilityChange||typeof document>"u"||(us.subscribedToVisibilityChange=!0,(e=document==null?void 0:document.addEventListener)==null||e.call(document,"visibilitychange",()=>{document.visibilityState==="hidden"&&It._submitPendingEvents()}),(t=document==null?void 0:document.addEventListener)==null||t.call(document,"freeze",()=>{It._submitPendingEvents()}),(n=window==null?void 0:window.addEventListener)==null||n.call(window,"pagehide",()=>{It._submitPendingEvents()}),setInterval(()=>{It._submitPendingEvents()},dae))}},Z_t=Be.getApiUrl(),jo=new B$({baseUrl:Z_t,clientId:null}),Y_t=40,hae=4,J_t=20,zt=qr({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1,explorerWallets:[],explorerFilteredWallets:[],plan:{tier:"none",hasExceededUsageLimit:!1,limits:{isAboveRpcLim
1098it:!1,isAboveMauLimit:!1}}}),De={state:zt,subscribeKey(e,t){return Xi(zt,e,t)},_getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=ke.state;return{projectId:e,st:t||"appkit",sv:n||"html-wagmi-4.2.2"}},_filterOutExtensions(e){return ke.state.isUniversalProvider?e.filter(t=>!!(t.mobile_link||t.desktop_link||t.webapp_link)):e},async _fetchWalletImage(e){const t=`${jo.baseUrl}/getWalletImage/${e}`,n=await jo.getBlob({path:t,params:De._getSdkProperties()});Ho.setWalletImage(e,URL.createObjectURL(n))},async _fetchNetworkImage(e){const t=`${jo.baseUrl}/public/getAssetImage/${e}`,n=await jo.getBlob({path:t,params:De._getSdkProperties()});Ho.setNetworkImage(e,URL.createObjectURL(n))},async _fetchConnectorImage(e){const t=`${jo.baseUrl}/public/getAssetImage/${e}`,n=await jo.getBlob({path:t,params:De._getSdkProperties()});Ho.setConnectorImage(e,URL.createObjectURL(n))},async _fetchCurrencyImage(e){const t=`${jo.baseUrl}/public/getCurrencyImage/${e}`,n=await jo.getBlob({path:t,params:De._getSdkProperties()});Ho.setCurrencyImage(e,URL.createObjectURL(n))},async _fetchTokenImage(e){const t=`${jo.baseUrl}/public/getTokenImage/${e}`,n=await jo.getBlob({path:t,params:De._getSdkProperties()});Ho.setTokenImage(e,URL.createObjectURL(n))},_filterWalletsByPlatform(e){const t=e.length,n=Be.isMobile()?e==null?void 0:e.filter(s=>s.mobile_link||s.webapp_link?!0:Object.values(Gs).map(o=>o.id).includes(s.id)):e,r=t-n.length;return{filteredWallets:n,mobileFilteredOutWalletsLength:r}},async fetchProjectConfig(){return(await jo.get({path:"/appkit/v1/config",params:De._getSdkProperties()})).features},async fetchUsage(){try{const e=await jo.get({path:"/appkit/v1/project-limits",params:De._getSdkProperties()}),{tier:t,isAboveMauLimit:n,isAboveRpcLimit:r}=e.planLimits,s=t==="starter",i=n||r;De.state.plan={tier:t,hasExceededUsageLimit:s&&i,limits:{isAboveRpcLimit:r,isAboveMauLimit:n}}}catch(e){console.warn("Failed to fetch usage",e)}},async fetchAllowedOrigins(){try{const{allowedOrigins:e}=await jo.get({path:"/projects/v1/origins",params:De._getSdkProperties()});return e}catch(e){if(e instanceof Error&&e.cause instanceof Response){const t=e.cause.status;if(t===ye.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)throw new Error("RATE_LIMITED",{cause:e});if(t>=ye.HTTP_STATUS_CODES.SERVER_ERROR&&t<600)throw new Error("SERVER_ERROR",{cause:e});return[]}return[]}},async fetchNetworkImages(){const e=Q.getAllRequestedCaipNetworks(),t=e==null?void 0:e.map(({assets:n})=>n==null?void 0:n.imageId).filter(Boolean).filter(n=>!wc.getNetworkImageById(n));t&&await Promise.allSettled(t.map(n=>De._fetchNetworkImage(n)))},async fetchConnectorImages(){const{connectors:e}=qe.state,t=e.map(({imageId:n})=>n).filter(Boolean);await Promise.allSettled(t.map(n=>De._fetchConnectorImage(n)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(t=>De._fetchCurrencyImage(t)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(t=>De._fetchTokenImage(t)))},async fetchWallets(e){var o;const t=e.exclude??[];De._getSdkProperties().sv.startsWith("html-core-")&&t.push(...Object.values(Gs).map(a=>a.id));const r=await jo.get({path:"/getWallets",params:{...De._getSdkProperties(),...e,page:String(e.page),entries:String(e.entries),include:(o=e.include)==null?void 0:o.join(","),exclude:t.join(",")}}),{filteredWallets:s,mobileFilteredOutWalletsLength:i}=De._filterWalletsByPlatform(r==null?void 0:r.data);return{data:s||[],count:r==null?void 0:r.count,mobileFilteredOutWalletsLength:i}},async prefetchWalletRanks(){const e=qe.state.connectors;if(!(e!=null&&e.length))return;const t={page:1,entries:20,badge:"certified"};if(t.names=e.map(s=>s.name).join(","),Q.state.activeChain===ye.CHAIN.EVM){const s=[...e.flatMap(i=>{var o;return((o=i.connectors)==null?void 0:o.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}))||[]}),...e.map(i=>{var o;return(o=i.info)==null?void 0:o.rdns})].filter(i=>typeof i=="string"&&i.length>0);s.length&&(t.rdns=s.join(","))}const{data:n}=await De.fetchWallets(t);zt.explorerWallets=n,qe.extendConnectorsWithExplorerWallets(n);const r=Q.getRequestedCaipNetworkIds().join(",");zt.explorerFilteredWallets=n.filter(s=>{var i;return(i=s.chains)==null?void 0:i.some(o=>r.includes(o))})},async fetchFeaturedWallets(){const{featuredWalletIds:e}=ke.state;
vendor: 8,958 bytes, line 1098
1098if(e!=null&&e.length){const t={...De._getSdkProperties(),page:1,entries:(e==null?void 0:e.length)??hae,include:e},{data:n}=await De.fetchWallets(t),r=[...n].sort((i,o)=>e.indexOf(i.id)-e.indexOf(o.id)),s=r.map(i=>i.image_id).filter(Boolean);await Promise.allSettled(s.map(i=>De._fetchWalletImage(i))),zt.featured=r,zt.allFeatured=r}},async fetchRecommendedWallets(){try{zt.isFetchingRecommendedWallets=!0;const{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:n}=ke.state,r=[...t??[],...n??[]].filter(Boolean),s=Q.getRequestedCaipNetworkIds().join(","),i={page:1,entries:hae,include:e,exclude:r,chains:s},{data:o,count:a}=await De.fetchWallets(i),c=Ye.getRecentWallets(),l=o.map(d=>d.image_id).filter(Boolean),u=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...l,...u].map(d=>De._fetchWalletImage(d))),zt.recommended=o,zt.allRecommended=o,zt.count=a??0}catch{}finally{zt.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:e,entries:t,badge:n,include:r,exclude:s}){const{includeWalletIds:i,excludeWalletIds:o,featuredWalletIds:a}=ke.state,c=Q.getRequestedCaipNetworkIds().join(","),l=[...zt.recommended.map(({id:p})=>p),...o??[],...a??[]].filter(Boolean),u={page:e,entries:t??Y_t,include:r??i,exclude:s??l,badge_type:n,chains:c},{data:d,count:h,mobileFilteredOutWalletsLength:f}=await De.fetchWallets(u);zt.mobileFilteredOutWalletsLength=f+(zt.mobileFilteredOutWalletsLength??0);const g=d.slice(0,J_t).map(p=>p.image_id).filter(Boolean);await Promise.allSettled(g.map(p=>De._fetchWalletImage(p))),zt.wallets=Be.uniqueBy([...zt.wallets,...De._filterOutExtensions(d)],"id").filter(p=>{var m;return(m=p.chains)==null?void 0:m.some(w=>c.includes(w))}),zt.count=h>zt.count?h:zt.count,zt.page=e},async initializeExcludedWallets({ids:e}){const t={page:1,entries:e.length,include:e},{data:n}=await De.fetchWallets(t);n&&n.forEach(r=>{zt.excludedWallets.push({rdns:r.rdns,name:r.name})})},async searchWallet({search:e,badge:t,entries:n,page:r,include:s,exclude:i}){const{includeWalletIds:o,excludeWalletIds:a}=ke.state,c=Q.getRequestedCaipNetworkIds().join(",");zt.search=[];const l={page:r??1,entries:n??100,search:e==null?void 0:e.trim(),badge_type:t,include:s??o,exclude:i??a,chains:c},{data:u}=await De.fetchWallets(l);It.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});const d=u.map(h=>h.image_id).filter(Boolean);await Promise.allSettled([...d.map(h=>De._fetchWalletImage(h)),Be.wait(300)]),zt.search=De._filterOutExtensions(u)},initPromise(e,t){const n=zt.promises[e];return n||(zt.promises[e]=t())},prefetch({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:n=!0,fetchNetworkImages:r=!0,fetchWalletRanks:s=!0}={}){const i=[e&&De.initPromise("connectorImages",De.fetchConnectorImages),t&&De.initPromise("featuredWallets",De.fetchFeaturedWallets),n&&De.initPromise("recommendedWallets",De.fetchRecommendedWallets),r&&De.initPromise("networkImages",De.fetchNetworkImages),s&&De.initPromise("walletRanks",De.prefetchWalletRanks)].filter(Boolean);return Promise.allSettled(i)},prefetchAnalyticsConfig(){var e;(e=ke.state.features)!=null&&e.analytics&&De.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:e}=await jo.get({path:"/getAnalyticsConfig",params:De._getSdkProperties()});ke.setFeatures({analytics:e})}catch{ke.setFeatures({analytics:!1})}},filterByNamespaces(e){if(!(e!=null&&e.length)){zt.featured=zt.allFeatured,zt.recommended=zt.allRecommended;return}const t=Q.getRequestedCaipNetworkIds().join(",");zt.featured=zt.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),zt.recommended=zt.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),zt.filteredWallets=zt.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})},clearFilterByNamespaces(){zt.filteredWallets=[]},setFilterByNamespace(e){if(!e){zt.featured=zt.allFeatured,zt.recommended=zt.allRecommended;return}const t=Q.getRequestedCaipNetworkIds().join(",");zt.featured=zt.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),zt.recommended=zt.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),zt.filteredWallets=zt.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})}},Fh={filterOutDuplicatesByRDNS(e){const t=ke.state.enableEIP6963?qe.state.connectors:[],n=Ye.getRecentWallets(),r=t.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),s=n.map(a=>a.rdns).filter(Boolean),i=r.concat(s);if(i.includes("io.metamask.mobile")&&Be.isMobile()){const a=i.indexOf("io.metamask.mobile");i[a]="io.metamask"}return e.filter(a=>!(a!=null&&a.rdns&&i.includes(String(a.rdns))||!(a!=null&&a.rdns)&&t.some(l=>l.name===a.name)))},filterOutDuplicatesByIds(e){const t=qe.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"||a.type==="MULTI_CHAIN"),n=Ye.getRecentWallets(),r=t.map(a=>{var c;return a.explorerId||((c=a.explorerWallet)==null?void 0:c.id)||a.id}),s=n.map(a=>a.id),i=r.concat(s);return e.filter(a=>!i.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(e){const t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){const{connectors:t}=qe.state,{featuredWalletIds:n}=ke.state,r=t.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return e.map(o=>({...o,installed:!!o.rdns&&!!r[o.rdns??""]})).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(n!=null&&n.length){const l=n.indexOf(o.id),u=n.indexOf(a.id);if(l!==-1&&u!==-1)return l-u;if(l!==-1)return-1;if(u!==-1)return 1}return 0})},getConnectOrderMethod(e,t){var c;const n=(e==null?void 0:e.connectMethodsOrder)||((c=ke.state.features)==null?void 0:c.connectMethodsOrder),r=t||qe.state.connectors;if(n)return n;const{injected:s,announced:i}=Wo.getConnectorsByType(r,De.state.recommended,De.state.featured),o=s.filter(Wo.showConnector),a=i.filter(Wo.showConnector);return o.length||a.length?["wallet","email","social"]:is.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(e){const t=!!e.rdns&&De.state.excludedWallets.some(r=>r.rdns===e.rdns),n=!!e.name&&De.state.excludedWallets.some(r=>i5e.isLowerCaseMatch(r.name,e.name));return t||n},markWalletsWithDisplayIndex(e){return e.map((t,n)=>({...t,display_index:n}))},filterWalletsByWcSupport(e){return Ae.state.wcBasic?e.filter(t=>t.supports_wc):Be.isMobile()?e.filter(t=>t.supports_wc||is.MANDATORY_WALLET_IDS_ON_MOBILE.includes(t.id)):e},getWalletConnectWallets(e){var i;const t=[...De.state.featured,...De.state.recommended];((i=De.state.filteredWallets)==null?void 0:i.length)>0?t.push(...De.state.filteredWallets):t.push(...e);const n=Be.uniqueBy(t,"id"),r=Fh.markWalletsAsInstalled(n),s=Fh.filterWalletsByWcSupport(r);return Fh.markWalletsWithDisplayIndex(s)}},Wo={getConnectorsByType(e,t,n){const{customWallets:r}=ke.state,s=Ye.getRecentWallets(),i=Fh.filterOutDuplicateWallets(t),o=Fh.filterOutDuplicateWallets(n),a=e.filter(d=>d.type==="MULTI_CHAIN"),c=e.filter(d=>d.type==="ANNOUNCED"),l=e.filter(d=>d.type==="INJECTED"),u=e.filter(d=>d.type==="EXTERNAL");return{custom:r,recent:s,external:u,multiChain:a,announced:c,injected:l,recommended:i,featured:o}},showConnector(e){var s;const t=(s=e.info)==null?void 0:s.rdns,n=!!t&&De.state.excludedWallets.some(i=>!!i.rdns&&i.rdns===t),r=!!e.name&&De.state.excludedWallets.some(i=>i5e.isLowerCaseMatch(i.name,e.name));return!(e.type==="INJECTED"&&(e.name==="Browser Wallet"&&(!Be.isMobile()||Be.isMobile()&&!t&&!Ae.checkInstalled())||n||r)||(e.type==="ANNOUNCED"||e.type==="EXTERNAL")&&(n||r))},getIsConnectedWithWC(){return Array.from(Q.state.chains.values()).some(n=>qe.getConnectorId(n.namespace)===ye.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:e,featured:t,custom:n,recent:r,announced:s,injected:i,multiChain:o,external:a,overriddenConnectors:c=(l=>(l=ke.state.features)==null?void 0:l.connectorTypeOrder)()??[]}){const d=[{type:"walletConnect",isEnabled:!0},{type:"recent",isEnabled:r.length>0},{type:"injected",isEnabled:[...i,...s,...o].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:n&&n.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:e.length>0}].filter(p=>p.isEnabled),h=new Set(d.map(p=>p.type)),f=c.filter(p=>h.has(p)).map(p=>({type:p,isEnabled:!0})),g=d.filter(({type:p})=>!f.some(({type:w})=>w===p));return Array.from(new Set([...f,...g].map(({type:p})=>p)))},sortConnectorsByExplorerWallet(e){return[...e].sort((t,n)=>t.explorerWallet&&n.explorerWallet?(t.explorerWallet.order??0)-(n.explorerWallet.order??0):t.explorerWallet?-1:n.explorerWallet?1:0)},getPriority(e){return e.id===ye.CONNECTOR_ID.BASE_ACCOUNT?0:e.id===ye.CONNECTOR_ID.COINBASE||e.id===ye.CONNECTOR_ID.COINBASE_SDK?1:2},sortConnectorsByPriority(e){return[...e].sort((t,n)=>
1098Wo.getPriority(t)-Wo.getPriority(n))},getAuthName({email:e,socialUsername:t,socialProvider:n}){return t?n&&n==="discord"&&t.endsWith("0")?t.slice(0,-1):t:e.length>30?`${e.slice(0,-3)}...`:e},async fetchProviderData(e){var t,n;try{if(e.name==="Browser Wallet"&&!Be.isMobile())return{accounts:[],chainId:void 0};if(e.id===ye.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};const[r,s]=await Promise.all([(t=e.provider)==null?void 0:t.request({method:"eth_accounts"}),(n=e.provider)==null?void 0:n.request({method:"eth_chainId"}).then(i=>Number(i))]);return{accounts:r,chainId:s}}catch(r){return console.warn(`Failed to fetch provider data for ${e.name}`,r),{accounts:[],chainId:void 0}}},getFilteredCustomWallets(e){const t=Ye.getRecentWallets(),n=qe.state.connectors.map(o=>{var a;return(a=o.info)==null?void 0:a.rdns}).filter(Boolean),r=t.map(o=>o.rdns).filter(Boolean),s=n.concat(r);if(s.includes("io.metamask.mobile")&&Be.isMobile()){const o=s.indexOf("io.metamask.mobile");s[o]="io.metamask"}return e.filter(o=>!s.includes(String(o==null?void 0:o.rdns)))},hasWalletConnector(e){return qe.state.connectors.some(t=>t.id===e.id||t.name===e.name)},isWalletCompatibleWithCurrentChain(e){const t=Q.state.activeChain;return t&&e.chains?e.chains.some(n=>{const r=n.split(":")[0];return t===r}):!0},getFilteredRecentWallets(){return Ye.getRecentWallets().filter(n=>!Fh.isExcluded(n)).filter(n=>!this.hasWalletConnector(n)).filter(n=>this.isWalletCompatibleWithCurrentChain(n))},getCappedRecommendedWallets(e){const{connectors:t}=qe.state,{customWallets:n,featuredWalletIds:r}=ke.state,s=t.find(C=>C.id==="walletConnect"),i=t.filter(C=>C.type==="INJECTED"||C.type==="ANNOUNCED"||C.type==="MULTI_CHAIN");if(!s&&!i.length&&!(n!=null&&n.length))return[];const o=pz.isEmailEnabled(),a=pz.isSocialsEnabled(),c=i.filter(C=>C.name!=="Browser Wallet"&&C.name!=="WalletConnect"),l=(r==null?void 0:r.length)||0,u=(n==null?void 0:n.length)||0,d=c.length||0,h=o?1:0,f=a?1:0,g=l+u+d+h+f,m=Math.max(0,4-g);return m<=0?[]:Fh.filterOutDuplicateWallets(e).slice(0,m)},processConnectorsByType(e,t=!0){const n=Wo.sortConnectorsByExplorerWallet([...e]);return t?n.filter(Wo.showConnector):n},connectorList(){const e=Wo.getConnectorsByType(qe.state.connectors,De.state.recommended,De.state.featured),t=this.processConnectorsByType(e.announced.filter(f=>f.id!=="walletConnect")),n=this.processConnectorsByType(e.injected),r=this.processConnectorsByType(e.multiChain.filter(f=>f.name!=="WalletConnect"),!1),s=e.custom,i=e.recent,o=this.processConnectorsByType(e.external.filter(f=>f.id!==ye.CONNECTOR_ID.COINBASE_SDK&&f.id!==ye.CONNECTOR_ID.BASE_ACCOUNT)),a=e.recommended,c=e.featured,l=Wo.getConnectorTypeOrder({custom:s,recent:i,announced:t,injected:n,multiChain:r,recommended:a,featured:c,external:o}),u=qe.state.connectors.find(f=>f.id==="walletConnect"),d=Be.isMobile(),h=[];for(const f of l)switch(f){case"walletConnect":{!d&&u&&h.push({kind:"connector",subtype:"walletConnect",connector:u});break}case"recent":{Wo.getFilteredRecentWallets().forEach(p=>h.push({kind:"wallet",subtype:"recent",wallet:p}));break}case"injected":{r.forEach(g=>h.push({kind:"connector",subtype:"multiChain",connector:g})),t.forEach(g=>h.push({kind:"connector",subtype:"announced",connector:g})),n.forEach(g=>h.push({kind:"connector",subtype:"injected",connector:g}));break}
1098case"featured":{c.forEach(g=>h.push({kind:"wallet",subtype:"featured",wallet:g}));break}case"custom":{Wo.getFilteredCustomWallets(s??[]).forEach(p=>h.push({kind:"wallet",subtype:"custom",wallet:p}));break}case"external":{o.forEach(g=>h.push({kind:"connector",subtype:"external",connector:g}));break}case"recommended":{Wo.getCappedRecommendedWallets(a).forEach(p=>h.push({kind:"wallet",subtype:"recommended",wallet:p}));break}default:console.warn(`Unknown connector type: ${f}`)}return h},hasInjectedConnectors(){return qe.state.connectors.filter(e=>(e.type==="INJECTED"||e.type==="ANNOUNCED"||e.type==="MULTI_CHAIN")&&e.name!=="Browser Wallet"&&e.name!=="WalletConnect").length}},X_t=["ConnectingExternal","ConnectingMultiChain","ConnectingSocial","ConnectingFarcaster"],tr=qr({view:"Connect",history:["Connect"],transactionStack:[]}),Q_t={state:tr,subscribeKey(e,t){return Xi(tr,e,t)},pushTransactionStack(e){tr.transactionStack.push(e)},popTransactionStack(e){const t=tr.transactionStack.pop();if(!t)return;const{onSuccess:n,onError:r,onCancel:s}=t;switch(e){case"success":n==null||n();break;case"error":r==null||r(),fe.goBack();break;case"cancel":s==null||s(),fe.goBack();break}},push(e,t){let n=e,r=t;De.state.plan.hasExceededUsageLimit&&X_t.includes(e)&&(n="UsageExceeded",r=void 0),n!==tr.view&&(tr.view=n,tr.history.push(n),tr.data=r)},reset(e,t){tr.view=e,tr.history=[e],tr.data=t},replace(e,t){tr.history.at(-1)===e||(tr.view=e,tr.history[tr.history.length-1]=e,tr.data=t)},goBack(){var r,s;const e=Q.state.activeCaipAddress,t=fe.state.view==="ConnectingFarcaster",n=!e&&t;if(tr.history.length>1){tr.history.pop();const[i]=tr.history.slice(-1);i&&(e&&i==="Connect"?tr.view="Account":tr.view=i)}else Zt.close();(r=tr.data)!=null&&r.wallet&&(tr.data.wallet=void 0),(s=tr.data)!=null&&s.redirectView&&(tr.data.redirectView=void 0),setTimeout(()=>{var i,o,a;if(n){Q.setAccountProp("farcasterUrl",void 0,Q.state.activeChain);const c=qe.getAuthConnector();(i=c==null?void 0:c.provider)==null||i.reload();const l=x4(ke.state);(a=(o=c==null?void 0:c.provider)==null?void 0:o.syncDappData)==null||a.call(o,{metadata:l.metadata,sdkVersion:l.sdkVersion,projectId:l.projectId,sdkType:l.sdkType})}},100)},goBackToIndex(e){if(tr.history.length>1){tr.history=tr.history.slice(0,e+1);const[t]=tr.history.slice(-1);t&&(tr.view=t)}},goBackOrCloseModal(){fe.state.history.length>1?fe.goBack():Zt.close()}},fe=ju(Q_t),tp=qr({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),mz={state:tp,subscribe(e){return Ji(tp,()=>e(tp))},setThemeMode(e){tp.themeMode=e;try{const t=qe.getAuthConnector();if(t){const n=mz.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:n,w3mThemeVariables:WA(n,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){tp.themeVariables={...tp.themeVariables,...e};try{const t=qe.getAuthConnector();if(t){const n=mz.getSnapshot().themeVariables;t.provider.syncTheme({themeVariables:n,w3mThemeVariables:WA(tp.themeVariables,tp.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return x4(tp)}},Zp=ju(mz),SEe=Object.fromEntries(o5e.map(e=>[e,void 0])),eNt=Object.fromEntries(o5e.map(e=>[e,!0])),Pn=qr({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:SEe,filterByNamespaceMap:eNt}),tNt={state:Pn,subscribe(e){return Ji(Pn,()=>{e(Pn)})},subscribeKey(e,t){return Xi(Pn,e,t)},initialize(e){e.forEach(t=>{const n=Ye.getConnectedConnectorId(t);n&&qe.setConnectorId(n,t)})},setActiveConnector(e){e&&(Pn.activeConnector=I4(e))},setConnectors(e){e.filter(s=>!Pn.allConnectors.some(i=>i.id===s.id&&qe.getConnectorName(i.name)===qe.getConnectorName(s.name)&&i.chain===s.chain)).forEach(s=>{s.type!=="MULTI_CHAIN"&&Pn.allConnectors.push(I4(s))});const n=qe.getEnabledNamespaces(),r=qe.getEnabledConnectors(n);Pn.connectors=qe.mergeMultiChainConnectors(r)},filterByNamespaces(e){Object.keys(Pn.filterByNamespaceMap).forEach(t=>{Pn.filterByNamespaceMap[t]=!1}),e.forEach(t=>{Pn.filterByNamespaceMap[t]=!0}),qe.updateConnectorsForEnabledNamespaces()},filterByNamespace(e,t){Pn.filterByNamespaceMap[e]=t,qe.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const e=qe.getEnabledNamespaces(),t=qe.getEnabledConnectors(e),n=qe.areAllNamespacesEnabled();Pn.connectors=qe.mergeMultiChainConnectors(t),n?De.clearFilterByNamespaces():De.filterByNamespaces(e)},getEnabledNamespaces(){return Object.entries(Pn.filterByNamespaceMap).filter(([e,t])=>t).map(([e])=>e)},getEnabledConnectors(e){return Pn.allConnectors.filter(t=>e.includes(t.chain))},areAllNamespacesEnabled(){return Object.values(Pn.filterByNamespaceMap).every(e=>e)},mergeMultiChainConnectors(e){const t=qe.generateConnectorMapByName(e),n=[];return t.forEach(r=>{const s=r[0],i=(s==null?void 0:s.id)===ye.CONNECTOR_ID.AUTH;r.length>1&&s?n.push({name:s.name,imageUrl:s.imageUrl,imageId:s.imageId,connectors:[...r],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(s==null?void 0:s.id)||""}):s&&n.push(s)}),n},generateConnectorMapByName(e){const t=new Map;return e.forEach(n=>{const{name:r}=n,s=qe.getConnectorName(r);if(!s)return;const i=t.get(s)||[];
1098i.find(a=>a.chain===n.chain)||i.push(n),t.set(s,i)}),t},getConnectorName(e){return e&&({"Trust Wallet":"Trust"}[e]||e)},getUniqueConnectorsByName(e){const t=[];return e.forEach(n=>{t.find(r=>r.chain===n.chain)||t.push(n)}),t},addConnector(e){var t,n,r;if(e.id===ye.CONNECTOR_ID.AUTH){const s=e,i=x4(ke.state),o=Zp.getSnapshot().themeMode,a=Zp.getSnapshot().themeVariables;(n=(t=s==null?void 0:s.provider)==null?void 0:t.syncDappData)==null||n.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),(r=s==null?void 0:s.provider)==null||r.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:WA(a,o)}),qe.setConnectors([e])}else qe.setConnectors([e])},getAuthConnector(e){var r;const t=e||Q.state.activeChain,n=Pn.connectors.find(s=>s.id===ye.CONNECTOR_ID.AUTH);if(n)return(r=n==null?void 0:n.connectors)!=null&&r.length?n.connectors.find(i=>i.chain===t):n},getAnnouncedConnectorRdns(){return Pn.connectors.filter(e=>e.type==="ANNOUNCED").map(e=>{var t;return(t=e.info)==null?void 0:t.rdns})},getConnectorById(e){return Wo.sortConnectorsByPriority(Pn.allConnectors).find(n=>n.id===e)},getConnector({id:e,namespace:t}){const n=t||Q.state.activeChain,r=Pn.allConnectors.filter(o=>o.chain===n);return Wo.sortConnectorsByPriority(r).find(o=>o.id===e||o.explorerId===e)},syncIfAuthConnector(e){var i,o;if(e.id!=="AUTH")return;const t=e,n=x4(ke.state),r=Zp.getSnapshot().themeMode,s=Zp.getSnapshot().themeVariables;(o=(i=t==null?void 0:t.provider)==null?void 0:i.syncDappData)==null||o.call(i,{metadata:n.metadata,sdkVersion:n.sdkVersion,sdkType:n.sdkType,projectId:n.projectId}),t.provider.syncTheme({themeMode:r,themeVariables:s,w3mThemeVariables:WA(s,r)})},getConnectorsByNamespace(e){const t=Pn.allConnectors.filter(n=>n.chain===e);return qe.mergeMultiChainConnectors(t)},canSwitchToSmartAccount(e){return Q.checkIfSmartAccountEnabled()&&cl(e)===sl.ACCOUNT_TYPES.EOA},selectWalletConnector(e){var s;const t=(s=fe.state.data)==null?void 0:s.redirectView,n=Q.state.activeChain,r=n?qe.getConnector({id:e.id,namespace:n}):void 0;IEe.handleMobileDeeplinkRedirect((r==null?void 0:r.explorerId)||e.id,Q.state.activeChain,{isCoinbaseDisabled:ke.state.enableCoinbase===!1}),r?fe.push("ConnectingExternal",{connector:r,wallet:e,redirectView:t}):fe.push("ConnectingWalletConnect",{wallet:e,redirectView:t})},getConnectors(e){return e?qe.getConnectorsByNamespace(e):qe.mergeMultiChainConnectors(Pn.allConnectors)},setFilterByNamespace(e){Pn.filterByNamespace=e,Pn.connectors=qe.getConnectors(e),De.setFilterByNamespace(e)},setConnectorId(e,t){e&&(Pn.activeConnectorIds={...Pn.activeConnectorIds,[t]:e},Ye.setConnectedConnectorId(t,e))},removeConnectorId(e){Pn.activeConnectorIds={...Pn.activeConnectorIds,[e]:void 0},Ye.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return Pn.activeConnectorIds[e]},isConnected(e){return e?!!Pn.activeConnectorIds[e]:Object.values(Pn.activeConnectorIds).some(t=>!!t)},resetConnectorIds(){Pn.activeConnectorIds={...SEe}},extendConnectorsWithExplorerWallets(e){Pn.allConnectors.forEach(r=>{const s=e.find(i=>{var o;return i.id===r.id||i.rdns&&i.rdns===((o=r.info)==null?void 0:o.rdns)});s&&(r.explorerWallet=s)});const t=qe.getEnabledNamespaces(),n=qe.getEnabledConnectors(t);Pn.connectors=qe.mergeMultiChainConnectors(n)},async connect(e={}){const{namespace:t}=e;return qe.setFilterByNamespace(t),fe.push("Connect",{addWalletForNamespace:t}),new Promise((n,r)=>{if(t){const s=Q.subscribeChainProp("accountState",o=>{o!=null&&o.caipAddress&&(n({caipAddress:o==null?void 0:o.caipAddress}),s())},t),i=Zt.subscribeKey("open",o=>{o||(r(new Error("Modal closed")),i())})}else{const s=Q.subscribeKey("activeCaipAddress",o=>{o&&(n({caipAddress:o}),s())}),i=Zt.subscribeKey("open",o=>{o||(r(new Error("Modal closed")),i())})}})}},qe=ju(tNt),nNt=1e3,wE={checkNamespaceConnectorId(e,t){return qe.getConnectorId(e)===t},isSocialProvider(e){return is.DEFAULT_REMOTE_FEATURES.socials.includes(e)},connectWalletConnect({walletConnect:e,connector:t,closeModalOnConnect:n=!0,redirectViewOnModalClose:r="Connect",onOpen:s,onConnect:i}){return new Promise((o,a)=>
vendor: 5,068 bytes, line 1098
1098{if(e&&qe.setActiveConnector(t),s==null||s(Be.isMobile()&&e),r){const l=Zt.subscribeKey("open",u=>{u||(fe.state.view!==r&&fe.replace(r),l(),a(new Error("Modal closed")))})}const c=Q.subscribeKey("activeCaipAddress",l=>{l&&(i==null||i(),n&&Zt.close(),c(),o(jh.parseCaipAddress(l)))})})},connectExternal(e){return new Promise((t,n)=>{const r=Q.subscribeKey("activeCaipAddress",s=>{s&&(Zt.close(),r(),t(jh.parseCaipAddress(s)))});Ae.connectExternal(e,e.chain).catch(()=>{r(),n(new Error("Connection rejected"))})})},connectSocial({social:e,namespace:t,closeModalOnConnect:n=!0,onOpenFarcaster:r,onConnect:s}){let i,o=!1,a=null;const c=t||Q.state.activeChain,l=Q.subscribeKey("activeCaipAddress",u=>{u&&(n&&Zt.close(),l())});return new Promise((u,d)=>{async function h(g){var p;if((p=g.data)!=null&&p.resultUri)if(g.origin===ye.SECURE_SITE_SDK_ORIGIN){window.removeEventListener("message",h,!1);try{const m=qe.getAuthConnector(c);if(m&&!o){i&&i.close(),o=!0;const w=g.data.resultUri;It.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:e}}),Ye.setConnectedSocialProvider(e),await Ae.connectExternal({id:m.id,type:m.type,socialUri:w},m.chain);const C=Q.state.activeCaipAddress;if(!C){d(new Error("Failed to connect"));return}u(jh.parseCaipAddress(C)),It.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:e}})}}catch(m){It.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:e,message:Be.parseError(m)}}),d(new Error("Failed to connect"))}}else It.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:e,message:"Untrusted Origin"}})}async function f(){if(It.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:e}}),e==="farcaster"){r==null||r();const g=Zt.subscribeKey("open",m=>{!m&&e==="farcaster"&&(d(new Error("Popup closed")),s==null||s(),g())}),p=qe.getAuthConnector();if(p){const m=Q.getAccountData(c);if(!(m!=null&&m.farcasterUrl))try{const{url:w}=await p.provider.getFarcasterUri();Q.setAccountProp("farcasterUrl",w,c)}catch{d(new Error("Failed to connect to farcaster"))}}}else{const g=qe.getAuthConnector();a=Be.returnOpenHref(`${ye.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes");try{if(g){const{uri:p}=await g.provider.getSocialRedirectUri({provider:e});if(a&&p){a.location.href=p,i=a;const m=setInterval(()=>{i!=null&&i.closed&&!o&&(d(new Error("Popup closed")),clearInterval(m))},1e3);window.addEventListener("message",h,!1)}else a==null||a.close(),d(new Error("Failed to initiate social connection"))}}catch{d(new Error("Failed to initiate social connection")),a==null||a.close()}}}f()})},connectEmail({closeModalOnConnect:e=!0,redirectViewOnModalClose:t="Connect",onOpen:n,onConnect:r}){return new Promise((s,i)=>{if(n==null||n(),t){const a=Zt.subscribeKey("open",c=>{c||(fe.state.view!==t&&fe.replace(t),a(),i(new Error("Modal closed")))})}const o=Q.subscribeKey("activeCaipAddress",a=>{a&&(r==null||r(),e&&Zt.close(),o(),s(jh.parseCaipAddress(a)))})})},async updateEmail(){const e=Ye.getConnectedConnectorId(Q.state.activeChain),t=qe.getAuthConnector();if(!t)throw new Error("No auth connector found");if(e!==ye.CONNECTOR_ID.AUTH)throw new Error("Not connected to email or social");const n=t.provider.getEmail()??"";return await Zt.open({view:"UpdateEmailWallet",data:{email:n,redirectView:void 0}}),new Promise((r,s)=>{const i=setInterval(()=>{const a=t.provider.getEmail()??"";a!==n&&(Zt.close(),clearInterval(i),o(),r({email:a}))},nNt),o=Zt.subscribeKey("open",a=>{a||(fe.state.view!=="Connect"&&fe.push("Connect"),clearInterval(i),o(),s(new Error("Modal closed")))})})},canSwitchToSmartAccount(e){return Q.checkIfSmartAccountEnabled()&&cl(e)===sl.ACCOUNT_TYPES.EOA}};function DK(){var r,s;const e=((r=Q.state.activeCaipNetwork)==null?void 0:r.chainNamespace)||"eip155",t=((s=Q.state.activeCaipNetwork)==null?void 0:s.id)||1,n=is.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${n}`}function cl(e){var n;return(n=Q.getAccountData(e))==null?void 0:n.preferredAccountType}function GI(e){return Q.state.activeCaipNetwork}const UK={getConnectionStatus(e,t){const n=qe.state.activeConnectorIds[t],r=Ae.getConnections(t);return!!n&&e.connectorId===n?"connected":r.some(o=>o.connectorId.toLowerCase()===e.connectorId.toLowerCase())?"active":"disconnected"},excludeConnectorAddressFromConnections({connections:e,connectorId:t,addresses:n}){return e.map(r=>{if((t?r.connectorId.toLowerCase()===t.toLowerCase():!1)&&n){const i=r.accounts.filter(o=>!n.some(c=>c.toLowerCase()===o.address.toLowerCase()));return{...r,accounts:i}}return r})},excludeExistingConnections(e,t){const n=new Set(e);return t.filter(r=>!n.has(r.connectorId))},getConnectionsByConnectorId(e,t){return e.filter(n=>n.connectorId.toLowerCase()===t.toLowerCase())},getConnectionsData(e){var a;const t=!!((a=ke.state.remoteFeatures)!=null&&a.multiWallet),n=qe.state.activeConnectorIds[e],r=Ae.getConnections(e),i=(Ae.state.recentConnections.get(e)??[]).filter(c=>qe.getConnectorById(c.connectorId)),o=UK.excludeExistingConnections([...r.map(c=>
1098c.connectorId),...n?[n]:[]],i);return t?{connections:r,recentConnections:o}:{connections:r.filter(c=>c.connectorId.toLowerCase()===(n==null?void 0:n.toLowerCase())),recentConnections:[]}},onConnectMobile(e,t){const n=Ae.state.wcUri;if(e!=null&&e.mobile_link&&n)try{Ae.setWcError(!1);const{mobile_link:r,link_mode:s,name:i}=e,o=Be.appendPayToUri(n,t),{redirect:a,redirectUniversalLink:c,href:l}=Be.formatNativeUrl(r,o,s),u=a,d=c,h=Be.isIframe()?"_top":"_self";Ae.setWcLinking({name:i,href:l}),Ae.setRecentWallet(e),ke.state.experimental_preferUniversalLinks&&d?Be.openHref(d,h):Be.openHref(u,h)}catch(r){It.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:r instanceof Error?r.message:"Error parsing the deep link",uri:n,mobile_link:e.mobile_link,name:e.name}}),Ae.setWcError(!0)}}},W2=qr({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1,connectingWallet:void 0}),Yp={state:W2,subscribe(e){return Ji(W2,()=>e(W2))},subscribeOpen(e){return Xi(W2,"open",e)},set(e){Object.assign(W2,{...W2,...e})}},Gr=qr({transactions:[],transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),rNt={state:Gr,subscribe(e){return Ji(Gr,()=>e(Gr))},setLastNetworkInView(e){Gr.lastNetworkInView=e},async fetchTransactions(e){var t;if(!e)throw new Error("Transactions can't be fetched without an accountAddress");Gr.loading=!0;try{const n=await Mt.fetchTransactions({account:e,cursor:Gr.next,chainId:(t=Q.state.activeCaipNetwork)==null?void 0:t.caipNetworkId}),r=jS.filterSpamTransactions(n.data),s=jS.filterByConnectedChain(r),i=[...Gr.transactions,...s];Gr.loading=!1,Gr.transactions=i,Gr.transactionsByYear=jS.groupTransactionsByYearAndMonth(Gr.transactionsByYear,s),Gr.empty=i.length===0,Gr.next=n.next?n.next:void 0}catch{const r=Q.state.activeChain;It.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:ke.state.projectId,cursor:Gr.next,isSmartAccount:cl(r)===sl.ACCOUNT_TYPES.SMART_ACCOUNT}}),Xn.showError("Failed to fetch transactions"),Gr.loading=!1,Gr.empty=!0,Gr.next=void 0}},groupTransactionsByYearAndMonth(e={},t=[]){const n=e;return t.forEach(r=>{const s=new Date(r.metadata.minedAt).getFullYear(),i=new Date(r.metadata.minedAt).getMonth(),o=n[s]??{},c=(o[i]??[]).filter(l=>l.id!==r.id);n[s]={...o,[i]:[...c,r].sort((l,u)=>new Date(u.metadata.minedAt).getTime()-new Date(l.metadata.minedAt).getTime())}}),n},filterSpamTransactions(e){return e.filter(t=>{var r;return!((r=t.transfers)==null?void 0:r.every(s=>{var i;return((i=s.nft_info)==null?void 0:i.flags.is_spam)===!0}))})},filterByConnectedChain(e){var r;const t=(r=Q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId;return e.filter(s=>s.metadata.chain===t)},clearCursor(){Gr.next=void 0},resetTransactions(){Gr.transactions=[],Gr.transactionsByYear={},Gr.lastNetworkInView=void 0,Gr.loading=!1,Gr.empty=!1,Gr.next=void 0}},jS=ju(rNt,"API_ERROR"),Qt=qr({connections:new Map,recentConnections:new Map,isSwitchingConnection:!1,wcError:!1,wcFetchingUri:!1,buffering:!1,status:"disconnected"});let Pg;const sNt={state:Qt,subscribe(e){return Ji(Qt,()=>e(Qt))},subscribeKey(e,t){return Xi(Qt,e,t)},_getClient(){return Qt._client},setClient(e){Qt._client=I4(e)},initialize(e){const t=e.filter(n=>!!n.namespace).map(n=>n.namespace);Ae.syncStorageConnections(t)},syncStorageConnections(e){const t=Ye.getConnections(),n=e??Array.from(Q.state.chains.keys());
1098for(const r of n){const s=t[r]??[],i=new Map(Qt.recentConnections);i.set(r,s),Qt.recentConnections=i}},getConnections(e){return e?Qt.connections.get(e)??[]:[]},hasAnyConnection(e){const t=Ae.state.connections;return Array.from(t.values()).flatMap(n=>n).some(({connectorId:n})=>n===e)},async connectWalletConnect({cache:e="auto"}={}){var n,r,s,i;Qt.wcFetchingUri=!0;const t=Be.isTelegram()||Be.isSafari()&&Be.isIos();try{if(e==="always"||e==="auto"&&t){if(Pg){await Pg,Pg=void 0;return}if(!Be.isPairingExpired(Qt==null?void 0:Qt.wcPairingExpiry)){const o=Qt.wcUri;Qt.wcUri=o;return}Pg=(r=(n=Ae._getClient())==null?void 0:n.connectWalletConnect)==null?void 0:r.call(n),Ae.state.status="connecting",await Pg,Pg=void 0,Qt.wcPairingExpiry=void 0,Ae.state.status="connected"}else await((i=(s=Ae._getClient())==null?void 0:s.connectWalletConnect)==null?void 0:i.call(s))}catch(o){throw Qt.wcError=!0,Qt.wcFetchingUri=!1,Qt.status="disconnected",Pg=void 0,o}},async connectExternal(e,t,n=!0){var o,a,c;const r=await((a=(o=Ae._getClient())==null?void 0:o.connectExternal)==null?void 0:a.call(o,e));n&&Q.setActiveNamespace(t);const s=qe.state.allConnectors.find(l=>l.id===(e==null?void 0:e.id)),i=e.type==="AUTH"?"email":"browser";return It.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:i,name:(s==null?void 0:s.name)||"Unknown",view:fe.state.view,walletRank:(c=s==null?void 0:s.explorerWallet)==null?void 0:c.order}}),r},async reconnectExternal(e){var n,r;await((r=(n=Ae._getClient())==null?void 0:n.reconnectExternal)==null?void 0:r.call(n,e));const t=e.chain||Q.state.activeChain;t&&qe.setConnectorId(e.id,t)},async setPreferredAccountType(e,t){var r;if(!t)return;Zt.setLoading(!0,Q.state.activeChain);const n=qe.getAuthConnector();n&&(Q.setAccountProp("preferredAccountType",e,t),await n.provider.setPreferredAccount(e),Ye.setPreferredAccountTypes(Object.entries(Q.state.chains).reduce((s,[i,o])=>{const a=i,c=cl(a);return c!==void 0&&(s[a]=c),s},{})),await Ae.reconnectExternal(n),Zt.setLoading(!1,Q.state.activeChain),It.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:((r=Q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}}))},async signMessage(e){var t;return(t=Ae._getClient())==null?void 0:t.signMessage(e)},parseUnits(e,t){var n;return(n=Ae._getClient())==null?void 0:n.parseUnits(e,t)},formatUnits(e,t){var n;return(n=Ae._getClient())==null?void 0:n.formatUnits(e,t)},updateBalance(e){var t;return(t=Ae._getClient())==null?void 0:t.updateBalance(e)},async sendTransaction(e){var t;return(t=Ae._getClient())==null?void 0:t.sendTransaction(e)},async getCapabilities(e){var t;return(t=Ae._getClient())==null?void 0:t.getCapabilities(e)},async grantPermissions(e){var t;return(t=Ae._getClient())==null?void 0:t.grantPermissions(e)},async walletGetAssets(e){var t;return((t=Ae._getClient())==null?void 0:t.walletGetAssets(e))??{}},async estimateGas(e){var t;return(t=Ae._getClient())==null?void 0:t.estimateGas(e)},async writeContract(e){var t;return(t=Ae._getClient())==null?void 0:t.writeContract(e)},async writeSolanaTransaction(e){var t;return(t=Ae._getClient())==null?void 0:t.writeSolanaTransaction(e)},async getEnsAddress(e){var t;return(t=Ae._getClient())==null?void 0:t.getEnsAddress(e)},async getEnsAvatar(e){var t;return(t=Ae._getClient())==null?void 0:t.getEnsAvatar(e)},checkInstalled(e){var t,n;return((n=(t=Ae._getClient())==null?void 0:t.checkInstalled)==null?void 0:n.call(t,e))||!1},resetWcConnection(){Qt.wcUri=void 0,Qt.wcPairingExpiry=void 0,Qt.wcLinking=void 0,Qt.recentWallet=void 0,Qt.wcFetchingUri=!1,Qt.status="disconnected",jS.resetTransactions(),Ye.deleteWalletConnectDeepLink(),Ye.deleteRecentWallet(),Yp.set({connectingWallet:void 0})},resetUri(){Qt.wcUri=void 0,Qt.wcPairingExpiry=void 0,Pg=void 0,Qt.wcFetchingUri=!1,Yp.set({connectingWallet:void 0})},finalizeWcConnection(e){var r,s;const{wcLinking:t,recentWallet:n}=Ae.state;t&&Ye.setWalletConnectDeepLink(t),n&&Ye.setAppKitRecent(n),e&&It.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:e,properties:{method:t?"mobile":"qrcode",name:((s=(r=fe.state.data)==null?void 0:r.wallet)==null?void 0:s.name)||"Unknown",view:fe.state.view,walletRank:n==null?void 0:n.order}})},setWcBasic(e){Qt.wcBasic=e},setUri(e){Qt.wcUri=e,Qt.wcFetchingUri=!1,Qt.wcPairingExpiry=Be.getPairingExpiry()},setWcLinking(e){Qt.wcLinking=e},setWcError(e){Qt.wcError=e,Qt.wcFetchingUri=!1,Qt.buffering=!1},setRecentWallet(e){Qt.recentWallet=e},setBuffering(e){Qt.buffering=e},setStatus(e){Qt.status=e},setIsSwitchingConnection(e){Qt.isSwitchingConnection=e},async disconnect({id:e,namespace:t,initialDisconnect:n}={}){var r;try{await((r=Ae._getClient())==null?void 0:r.disconnect({id:e,chainNamespace:t,initialDisconnect:n}))}catch(s){throw new U5("Failed to disconnect","INTERNAL_SDK_ERROR",s)}},async disconnectConnector({id:e,namespace:t}){var n;try{await((n=Ae._getClient())==null?void 0:n.disconnectConnector({id:e,namespace:t}))}catch(r){throw new U5("Failed to disconnect connector","INTERNAL_SDK_ERROR",r)}},setConnections(e,t){const n=new Map(Qt.connections);n.set(t,e),Qt.connections=n},async handleAuthAccountSwitch({address:e,namespace:t}){var i,o;const n=Q.getAccountData(t),r=(o=(i=n==null?void 0:n.user)==null?void 0:i.accounts)==null?void 0:o.find(a=>a.type==="smartAccount"),s=r&&r.address.toLowerCase()===e.toLowerCase()&&wE.canSwitchToSmartAccount(t)?"smartAccount":"eoa";await Ae.setPreferredAccountType(s,t)},async handleActiveConnection({connection:e,namespace:t,address:n}){const r=qe.getConnectorById(e.connectorId),s=e.connectorId===ye.CONNECTOR_ID.AUTH;if(!r)throw new Error(`No connector found for connection: ${e.connectorId}`);if(s)n&&await Ae.handleAuthAccountSwitch({address:n,namespace:t});else{const i=await Ae.connectExternal({id:r.id,type:r.type,provider:r.provider,address:n,chain:t},t);return i==null?void 0:i.address}return n},async handleDisconnectedConnection({connection:e,namespace:t,address:n,closeModalOnConnect:r}){var l,u;const s=qe.getConnectorById(e.connectorId),i=(u=(l=e.auth)==null?void 0:l.name)==null?void 0:u.toLowerCase(),o=e.connectorId===ye.CONNECTOR_ID.AUTH,a=e.connectorId===ye.CONNECTOR_ID.WALLET_CONNECT;if(!s)throw new Error(`No connector found for connection: ${e.connectorId}`);let c;if(o)if(i&&wE.isSocialProvider(i)){const{address:d}=await wE.connectSocial({social:i,closeModalOnConnect:r,onOpenFarcaster(){Zt.open({view:"ConnectingFarcaster"})},onConnect(){fe.replace("ProfileWallets")}});c=d}else{const{address:d}=await wE.connectEmail({closeModalOnConnect:r,onOpen(){Zt.open({view:"EmailLogin"})},onConnect(){fe.replace("ProfileWallets")}});c=d}else if(a){const{address:d}=await wE.connectWalletConnect({walletConnect:!0,connector:s,closeModalOnConnect:r,onOpen(h){const f=h?"AllWallets":"ConnectingWalletConnect";Zt.state.open?fe.push(f):Zt.open({view:f})},onConnect(){fe.replace("ProfileWallets")}});c=d}else{const d=await Ae.connectExternal({id:s.id,type:s.type,provider:s.provider,chain:t},t);d&&(c=d.address)}return o&&n&&await Ae.handleAuthAccountSwitch({address:n,namespace:t}),c},async switchConnection({connection:e,address:t,namespace:n,closeModalOnConnect:r,onChange:s}){var c;let i;const o=(c=Q.getAccountData(n))==null?void 0:c.caipAddress;if(o){const{address:l}=jh.parseCaipAddress(o);i=l}
1098const a=UK.getConnectionStatus(e,n);switch(a){case"connected":case"active":{const l=await Ae.handleActiveConnection({connection:e,namespace:n,address:t});if(i&&l){const u=l.toLowerCase()!==i.toLowerCase();s==null||s({address:l,namespace:n,hasSwitchedAccount:u,hasSwitchedWallet:a==="active"})}break}case"disconnected":{const l=await Ae.handleDisconnectedConnection({connection:e,namespace:n,address:t,closeModalOnConnect:r});l&&(s==null||s({address:l,namespace:n,hasSwitchedAccount:!0,hasSwitchedWallet:!0}));break}default:throw new Error(`Invalid connection status: ${a}`)}}},Ae=ju(sNt),dD={createBalance(e,t){const n={name:e.metadata.name||"",symbol:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:n.name,symbol:n.symbol,chainId:t,address:e.address==="native"?void 0:this.convertAddressToCAIP10Address(e.address,t),value:n.value,price:n.price,quantity:{decimals:n.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:n.decimals})},iconUrl:n.iconUrl}},convertHexToBalance({hex:e,decimals:t}){return I$(BigInt(e),t)},convertAddressToCAIP10Address(e,t){return`${t}:${e}`},createCAIP2ChainId(e,t){return`${t}:${parseInt(e,16)}`},getChainIdHexFromCAIP2ChainId(e){const t=e.split(":");if(t.length<2||!t[1])return"0x0";const n=t[1],r=parseInt(n,10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return typeof e!="object"||e===null?!1:Object.values(e).every(t=>Array.isArray(t)&&t.every(n=>this.isValidAsset(n)))},isValidAsset(e){return typeof e=="object"&&e!==null&&typeof e.address=="string"&&typeof e.balance=="string"&&(e.type==="ERC20"||e.type==="NATIVE")&&typeof e.metadata=="object"&&e.metadata!==null&&typeof e.metadata.name=="string"&&typeof e.metadata.symbol=="string"&&typeof e.metadata.decimals=="number"&&typeof e.metadata.price=="number"&&typeof e.metadata.iconUrl=="string"}};let hD;async function fae(){if(!hD){const{createPublicClient:e,http:t,defineChain:n}=await te(async()=>{const{createPublicClient:r,http:s,defineChain:i}=await Promise.resolve().then(()=>D_t);return{createPublicClient:r,http:s,defineChain:i}},void 0);hD={createPublicClient:e,http:t,defineChain:n}}return hD}const wz={getBlockchainApiRpcUrl(e,t){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",e),n.searchParams.set("projectId",t),n.toString()},async getViemChain(e){const{defineChain:t}=await fae(),{chainId:n}=jh.parseCaipNetworkId(e.caipNetworkId);return t({...e,id:Number(n)})},async createViemPublicClient(e){const{createPublicClient:t,http:n}=await fae(),r=ke.state.projectId,s=await wz.getViemChain(e);if(!s)throw new Error(`Chain ${e.caipNetworkId} not found in viem/chains`);return t({chain:s,transport:n(wz.getBlockchainApiRpcUrl(e.caipNetworkId,r))})}},aP={async getMyTokensWithBalance(e={forceUpdate:void 0,caipNetwork:Q.state.activeCaipNetwork,address:(t=>(t=Q.getAccountData())==null?void 0:t.address)()}){const{forceUpdate:n,caipNetwork:r,address:s}=e,i=qe.getConnectorId("eip155")===ye.CONNECTOR_ID.AUTH;if(!s)return[];const o=r?`${r.caipNetworkId}:${s}`:s,a=Ye.getBalanceCacheForCaipAddress(o);if(a)return a.balances;if(r&&r.chainNamespace===ye.CHAIN.EVM&&i){const l=await this.getEIP155Balances(s,r);if(l)return this.filterLowQualityTokens(l)}const c=await Mt.getBalance(s,r==null?void 0:r.caipNetworkId,n);return this.filterLowQualityTokens(c.balances)},async getEIP155Balances(e,t){var n,r;try{const s=dD.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await Ae.getCapabilities(e);if(!((r=(n=i==null?void 0:i[s])==null?void 0:n.assetDiscovery)!=null&&r.supported))return null;const o=await Ae.walletGetAssets({account:e,chainFilter:[s]});if(!dD.isWalletGetAssetsResponse(o))return null;const c=(o[s]||[]).map(l=>dD.createBalance(l,t.caipNetworkId));return Ye.updateBalanceCache({caipAddress:`${t.caipNetworkId}:${e}`,balance:{balances:c},timestamp:Date.now()}),c}catch{return null}},filterLowQualityTokens(e){return e.filter(t=>t.quantity.decimals!=="0")},async fetchERC20Balance({caipAddress:e,assetAddress:t,caipNetwork:n}){const r=await wz.createViemPublicClient(n),{address:s}=jh.parseCaipAddress(e),[{result:i},{result:o},{result:a},{result:c}]=await r.multicall({contracts:[{address:t,functionName:"name",args:[],abi:KE},{address:t,functionName:"symbol",args:[],abi:KE},{address:t,functionName:"balanceOf",args:[s],abi:KE},{address:t,functionName:"decimals",args:[],abi:KE}]});return{name:i,symbol:o,decimals:c,balance:a&&c?I$(a,c):"0"}}},fD={adapters:{}},AEe={state:fD,initialize(e){fD.adapters={...e}},get(e){return fD.adapters[e]}},O_={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:void 0,tron:void 0},Ba=qr({providers:{...O_},providerIds:{...O_}}),iNt={state:Ba,subscribeKey(e,t){return Xi(Ba,e,t)},subscribe(e){return Ji(Ba,()=>{e(Ba)})},subscribeProviders(e){return Ji(Ba.providers,()=>e(Ba.providers))},setProvider(e,t){e&&t&&(Ba.providers[e]=I4(t))},getProvider(e){if(e)return Ba.providers[e]},setProviderId(e,t){t&&(Ba.providerIds[e]=t)},getProviderId(e){if(e)return Ba.providerIds[e]},reset(){Ba.providers={...O_},Ba.providerIds={...O_}},resetChain(e){Ba.providers[e]=void 0,Ba.providerIds[e]=void 0}},av={async getTokenList(e){var r;const t=await Mt.fetchSwapTokens({chainId:e});return((r=t==null?void 0:t.tokens)==null?void 0:r.map(s=>({...s,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){var t;const e=Q.state.activeCaipNetwork;if(!e)return null;try{switch(e.chainNamespace){case"solana":const n=(t=await(Ae==null?void 0:Ae.estimateGas({chainNamespace:"solana"})))==null?void 0:t.toString();return{standard:n,fast:n,instant:n};case"eip155":default:return await Mt.fetchGasPrice({chainId:e.caipNetworkId})}}catch{return null}},async fetchSwapAllowance({tokenAddress:e,userAddress:t,sourceTokenAmount:n,sourceTokenDecimals:r}){const s=await Mt.fetchSwapAllowance({tokenAddress:e,userAddress:t});if(s!=null&&s.allowance&&n&&r){const i=Ae.parseUnits(n,r)||0;return BigInt(s.allowance)>=i}return!1},async getMyTokensWithBalance(e){var n;const t=await aP.getMyTokensWithBalance({forceUpdate:e,caipNetwork:Q.state.activeCaipNetwork,address:(n=Q.getAccountData())==null?void 0:n.address});return Q.setAccountProp("tokenBalance",t,Q.state.activeChain),this.mapBalancesToSwapTokens(t)},mapBalancesToSwapTokens(e){return(e==null?void 0:e.map(t=>({...t,address:t!=null&&t.address?t.address:DK(),decimals:parseInt(t.quantity.decimals,10),logoUri:t.iconUrl,eip2612:!1})))||[]},async handleSwapError(e){var t,n;try{const r=e==null?void 0:e.cause;if(!(r!=null&&r.json))return;const s=await r.json(),i=(n=(t=s==null?void 0:s.reasons)==null?void 0:t[0])==null?void 0:n.description;return i!=null&&i.includes("insufficient liquidity")?"Insufficient liquidity":void 0}catch{return}}},On=qr({tokenBalances:[],loading:!1}),oNt={state:On,subscribe(e){return Ji(On,()=>e(On))},subscribeKey(e,t){return Xi(On,e,t)},setToken(e){e&&(On.token=I4(e))},setTokenAmount(e){On.sendTokenAmount=e},setReceiverAddress(e){On.receiverAddress=e},setReceiverProfileImageUrl(e){On.receiverProfileImageUrl=e},setReceiverProfileName(e){On.receiverProfileName=e},setNetworkBalanceInUsd(e){On.networkBalanceInUSD=e},setLoading(e){On.loading=e},getSdkEventProperties(e){var t,n;return{message:Be.parseError(e),isSmartAccount:cl(Q.state.activeChain)===sl.ACCOUNT_TYPES.SMART_ACCOUNT,token:((t=On.token)==null?void 0:t.symbol)||"",amount:On.sendTokenAmount??0,network:((n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}},async sendToken(){var e;
1098try{switch(ln.setLoading(!0),(e=Q.state.activeCaipNetwork)==null?void 0:e.chainNamespace){case"eip155":await ln.sendEvmToken();return;case"solana":await ln.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}catch(t){throw Ed.isUserRejectedRequestError(t)?new nIt(t):t}finally{ln.setLoading(!1)}},async sendEvmToken(){var n,r,s;const e=Q.state.activeChain;if(!e)throw new Error("SendController:sendEvmToken - activeChainNamespace is required");const t=cl(e);if(!ln.state.sendTokenAmount||!ln.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!ln.state.token)throw new Error("A token is required");if((n=ln.state.token)!=null&&n.address){It.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===sl.ACCOUNT_TYPES.SMART_ACCOUNT,token:ln.state.token.address,amount:ln.state.sendTokenAmount,network:((r=Q.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}});const{hash:i}=await ln.sendERC20Token({receiverAddress:ln.state.receiverAddress,tokenAddress:ln.state.token.address,sendTokenAmount:ln.state.sendTokenAmount,decimals:ln.state.token.quantity.decimals});i&&(On.hash=i)}else{It.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===sl.ACCOUNT_TYPES.SMART_ACCOUNT,token:ln.state.token.symbol||"",amount:ln.state.sendTokenAmount,network:((s=Q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}});const{hash:i}=await ln.sendNativeToken({receiverAddress:ln.state.receiverAddress,sendTokenAmount:ln.state.sendTokenAmount,decimals:ln.state.token.quantity.decimals});i&&(On.hash=i)}},async fetchTokenBalance(e){var o,a,c;On.loading=!0;const t=Q.state.activeChain,n=(o=Q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,r=(a=Q.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=((c=Q.getAccountData(t))==null?void 0:c.caipAddress)??Q.state.activeCaipAddress,i=s?Be.getPlainAddress(s):void 0;if(On.lastRetry&&!Be.isAllowedRetry(On.lastRetry,30*is.ONE_SEC_MS))return On.loading=!1,[];try{if(i&&n&&r){const l=await aP.getMyTokensWithBalance();return On.tokenBalances=l,On.lastRetry=void 0,l}}catch(l){On.lastRetry=Date.now(),e==null||e(l),Xn.showError("Token Balance Unavailable")}finally{On.loading=!1}return[]},fetchNetworkBalance(){if(On.tokenBalances.length===0)return;const e=av.mapBalancesToSwapTokens(On.tokenBalances);if(!e)return;const t=e.find(n=>n.address===DK());t&&(On.networkBalanceInUSD=t?hs.multiply(t.quantity.numeric,t.price).toString():"0")},async sendNativeToken(e){var o,a,c,l;fe.pushTransactionStack({});const t=e.receiverAddress,n=(o=Q.getAccountData())==null?void 0:o.address,r=Ae.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals)),i=await Ae.sendTransaction({chainNamespace:ye.CHAIN.EVM,to:t,address:n,data:"0x",value:r??BigInt(0)});return It.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:cl("eip155")===sl.ACCOUNT_TYPES.SMART_ACCOUNT,token:((a=ln.state.token)==null?void 0:a.symbol)||"",amount:e.sendTokenAmount,network:((c=Q.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",hash:i||""}}),(l=Ae._getClient())==null||l.updateBalance("eip155"),ln.resetSend(),{hash:i}},async sendERC20Token(e){var r,s,i;fe.pushTransactionStack({onSuccess(){fe.replace("Account")}});const t=Ae.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals)),n=(r=Q.getAccountData())==null?void 0:r.address;if(n&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){const o=Be.getPlainAddress(e.tokenAddress);if(!o)throw new Error("SendController:sendERC20Token - tokenAddress is required");const a=await Ae.writeContract({fromAddress:n,tokenAddress:o,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:eIt.getERC20Abi(o),chainNamespace:ye.CHAIN.EVM});return It.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:cl("eip155")===sl.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=ln.state.token)==null?void 0:s.symbol)||"",amount:e.sendTokenAmount,network:((i=Q.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||"",hash:a||""}}),ln.resetSend(),{hash:a}}return{hash:void 0}},async sendSolanaToken(){var n,r,s;if(!ln.state.sendTokenAmount||!ln.state.receiverAddress)throw new Error("An amount and receiver address are required");fe.pushTransactionStack({onSuccess(){fe.replace("Account")}});let e;ln.state.token&&ln.state.token.address!==is.SOLANA_NATIVE_TOKEN_ADDRESS&&(Be.isCaipAddress(ln.state.token.address)?e=Be.getPlainAddress(ln.state.token.address):e=ln.state.token.address);const t=await Ae.sendTransaction({chainNamespace:"solana",tokenMint:e,to:ln.state.receiverAddress,value:ln.state.sendTokenAmount});t&&(On.hash=t),(n=Ae._getClient())==null||n.updateBalance("solana"),It.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:!1,token:((r=ln.state.token)==null?void 0:r.symbol)||"",amount:ln.state.sendTokenAmount,network:((s=Q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||"",hash:t||""}}),ln.resetSend()},resetSend(){On.token=void 0,On.sendTokenAmount=void 0,On.receiverAddress=void 0,On.receiverProfileImageUrl=void 0,On.receiverProfileName=void 0,On.loading=!1,On.tokenBalances=[]}},ln=ju(oNt),pD={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,user:void 0,preferredAccountType:void 0},ZI={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},Ge=qr({chains:Zxt(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter
1098:{connectionControllerClient:void 0},isSwitchingNamespace:!1}),_Ee={state:Ge,subscribe(e){return Ji(Ge,()=>{e(Ge)})},subscribeKey(e,t){return Xi(Ge,e,t)},subscribeAccountStateProp(e,t,n){var s;const r=n||Ge.activeChain;return r?Xi(((s=Ge.chains.get(r))==null?void 0:s.accountState)||{},e,t):()=>{}},subscribeChainProp(e,t,n){let r;return Ji(Ge.chains,()=>{var i;const s=n||Ge.activeChain;if(s){const o=(i=Ge.chains.get(s))==null?void 0:i[e];r!==o&&(r=o,t(o))}})},initialize(e,t,n){const{chainId:r,namespace:s}=Ye.getActiveNetworkProps(),i=t==null?void 0:t.find(u=>u.id.toString()===(r==null?void 0:r.toString())),a=e.find(u=>(u==null?void 0:u.namespace)===s)||(e==null?void 0:e[0]),c=e.map(u=>u.namespace).filter(u=>u!==void 0),l=ke.state.enableEmbedded?new Set([...c]):new Set([...(t==null?void 0:t.map(u=>u.chainNamespace))??[]]);((e==null?void 0:e.length)===0||!a)&&(Ge.noAdapters=!0),Ge.noAdapters||(Ge.activeChain=a==null?void 0:a.namespace,Ge.activeCaipNetwork=i,Q.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:i}),Ge.activeChain&&Yp.set({activeChain:a==null?void 0:a.namespace})),l.forEach(u=>{const d=t==null?void 0:t.filter(g=>g.chainNamespace===u),h=Ye.getPreferredAccountTypes()||{},f={...ke.state.defaultAccountTypes,...h};Q.state.chains.set(u,{namespace:u,networkState:qr({...ZI,caipNetwork:d==null?void 0:d[0]}),accountState:qr({...pD,preferredAccountType:f[u]}),caipNetworks:d??[],...n}),Q.setRequestedCaipNetworks(d??[],u)})},removeAdapter(e){var t,n;if(Ge.activeChain===e){const r=Array.from(Ge.chains.entries()).find(([s])=>s!==e);if(r){const s=(n=(t=r[1])==null?void 0:t.caipNetworks)==null?void 0:n[0];s&&Q.setActiveCaipNetwork(s)}}Ge.chains.delete(e)},addAdapter(e,{connectionControllerClient:t},n){if(!e.namespace)throw new Error("ChainController:addAdapter - adapter must have a namespace");Ge.chains.set(e.namespace,{namespace:e.namespace,networkState:{...ZI,caipNetwork:n[0]},accountState:{...pD},caipNetworks:n,connectionControllerClient:t}),Q.setRequestedCaipNetworks((n==null?void 0:n.filter(r=>r.chainNamespace===e.namespace))??[],e.namespace)},addNetwork(e){var n;const t=Ge.chains.get(e.chainNamespace);if(t){const r=[...t.caipNetworks||[]];(n=t.caipNetworks)!=null&&n.find(s=>s.id===e.id)||r.push(e),Ge.chains.set(e.chainNamespace,{...t,caipNetworks:r}),Q.setRequestedCaipNetworks(r,e.chainNamespace),qe.filterByNamespace(e.chainNamespace,!0)}},removeNetwork(e,t){var r,s,i;const n=Ge.chains.get(e);if(n){const o=((r=Ge.activeCaipNetwork)==null?void 0:r.id)===t,a=[...((s=n.caipNetworks)==null?void 0:s.filter(c=>c.id!==t))||[]];o&&((i=n==null?void 0:n.caipNetworks)!=null&&i[0])&&Q.setActiveCaipNetwork(n.caipNetworks[0]),Ge.chains.set(e,{...n,caipNetworks:a}),Q.setRequestedCaipNetworks(a||[],e),a.length===0&&qe.filterByNamespace(e,!1)}},setAdapterNetworkState(e,t){const n=Ge.chains.get(e);n&&(n.networkState={...n.networkState||ZI,...t},Ge.chains.set(e,n))},setChainAccountData(e,t,n=!0){if(!e)throw new Error("Chain is required to update chain account data");const r=Ge.chains.get(e);if(r){const s={...r.accountState||pD,...t};Ge.chains.set(e,{...r,accountState:s}),(Ge.chains.size===1||Ge.activeChain===e)&&t.caipAddress&&(Ge.activeCaipAddress=t.caipAddress)}},setChainNetworkData(e,t){if(!e)return;const n=Ge.chains.get(e);if(n){const r={...n.networkState||ZI,...t};Ge.chains.set(e,{...n,networkState:r})}},setAccountProp(e,t,n,r=!0){Q.setChainAccountData(n,{[e]:t},r)},setActiveNamespace(e){var r,s;Ge.activeChain=e;const t=e?Ge.chains.get(e):void 0,n=(r=t==null?void 0:t.networkState)==null?void 0:r.caipNetwork;n!=null&&n.id&&e&&(Ge.activeCaipAddress=(s=t==null?void 0:t.accountState)==null?void 0:s.caipAddress,Ge.activeCaipNetwork=n,Q.setChainNetworkData(e,{caipNetwork:n}),Ye.setActiveCaipNetworkId(n==null?void 0:n.caipNetworkId),Yp.set({activeChain:e,selectedNetworkId:n==null?void 0:n.caipNetworkId}))},setActiveCaipNetwork(e){var i,o;if(!e)return;const t=Ge.activeChain===e.chainNamespace;t||Q.setIsSwitchingNamespace(!0);const n=Ge.chains.get(e.chainNamespace);Ge.activeChain=e.chainNamespace,Ge.activeCaipNetwork=e,Q.setChainNetworkData(e.chainNamespace,{caipNetwork:e});let r=(i=n==null?void 0:n.accountState)==null?void 0:i.address;if(r)Ge.activeCaipAddress=`${e.chainNamespace}:${e.id}:${r}`;else if(t&&Ge.activeCaipAddress){const{address:a}=jh.parseCaipAddress(Ge.activeCaipAddress);r=a,Ge.activeCaipAddress=`${e.caipNetworkId}:${r}`}else Ge.activeCaipAddress=void 0;Q.setChainAccountData(e.chainNamespace,{address:r,caipAddress:Ge.activeCaipAddress}),ln.resetSend(),Yp.set({activeChain:Ge.activeChain,selectedNetworkId:(o=Ge.activeCaipNetwork)==null?void 0:o.caipNetworkId}),Ye.setActiveCaipNetworkId(e.caipNetworkId),!Q.checkIfSupportedNetwork(e.chainNamespace)&&ke.state.enableNetworkSwitch&&!ke.state.allowUnsupportedChain&&!Ae.state.wcBasic&&Q.showUnsupportedChainUI()},addCaipNetwork(e){var n;if(!e)return;const t=Ge.chains.get(e.chainNamespace);t&&((n=t==null?void 0:t.caipNetworks)==null||n.push(e))},async switchActiveNamespace(e){var s;if(!e)return;const t=e!==Q.state.activeChain,n=(s=Q.getNetworkData(e))==null?void 0:s.caipNetwork,r=Q.getCaipNetworkByNamespace(e,n==null?void 0:n.id);t&&r&&await Q.switchActiveNetwork(r)},async switchActiveNetwork(e,{throwOnFailure:t=!1}={}){var o;const n=Q.state.activeChain;if(!n)throw new Error("ChainController:switchActiveNetwork - namespace is required");const r=iNt.getProviderId(Ge.activeChain)==="AUTH",s=(o=Q.getAccountData(n))==null?void 0:o.address,i=ye.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e.chainNamespace);try{if(s&&e.chainNamespace===n||r&&i){const a=AEe.get(e.chainNamespace);if(!a)throw new Error("Adapter not found");await a.switchNetwork({caipNetwork:e})}Q.setActiveCaipNetwork(e)}catch(a){if(t)throw a}It.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}})},getConnectionControllerClient(e){const t=e||Ge.activeChain;if(!t)throw new Error("Chain is required to get connection controller client");const n=Ge.chains.get(t);if(!(n!=null&&n.connectionControllerClient))throw new Error("ConnectionController client not set");return n.connectionControllerClient},getNetworkProp(e,t){var r;const n=(r=Ge.chains.get(t))==null?void 0:r.networkState;if(n)return n[e]},getRequestedCaipNetworks(e){const t=Ge.chains.get(e),{approvedCaipNetworkIds:n=[],requestedCaipNetworks:r=[]}=(t==null?void 0:t.networkState)||{};return Be.sortRequestedNetworks(n,r).filter(o=>o==null?void 0:o.id)},getAllRequestedCaipNetworks(){const e=[];return Ge.chains.forEach(t=>{if(!t.namespace)throw new Error("ChainController:getAllRequestedCaipNetworks - chainAdapter must have a namespace");const n=Q.getRequestedCaipNetworks(t.namespace);e.push(...n)}),e},setRequestedCaipNetworks(e,t){Q.setAdapterNetworkState(t,{requestedCaipNetworks:e});const r=Q.getAllRequestedCaipNetworks().map(i=>i.chainNamespace),s=Array.from(new Set(r));qe.filterByNamespaces(s)},getAllApprovedCaipNetworkIds(){const e=[];return Ge.chains.forEach(t=>{if(!t.namespace)throw new Error("ChainController:getAllApprovedCaipNetworkIds - chainAdapter must have a namespace");const n=Q.getApprovedCaipNetworkIds(t.namespace);e.push(...n)}),e},getActiveCaipNetwork(e){var t,n;return e?(n=(t=Ge.chains.get(e))==null?void 0:t.networkState)==null?void 0:n.caipNetwork:Ge.activeCaipNetwork},getActiveCaipAddress(){return Ge.activeCaipAddress},getApprovedCaipNetworkIds(e){var r;const t=Ge.chains.get(e);return((r=t==null?void 0:t.networkState)==null?void 0:r.approvedCaipNetworkIds)||[]},setApprovedCaipNetworksData(e,t){Q.setAdapterNetworkState(e,t)},checkIfSupportedNetwork(e,t){var s;const n=t||((s=Ge.activeCaipNetwork)==null?void 0:s.caipNetworkId),r=Q.getRequestedCaipNetworks(e);return r.length?r==null?void 0:r.some(i=>i.caipNetworkId===n):!0},checkIfSupportedChainId(e){if(!Ge.activeChain)return!0;const t=Q.getRequestedCaipNetworks(Ge.activeChain);return t==null?void 0:t.some(n=>n.id===e)},checkIfSmartAccountEnabled(){var r,s;const e=Yxt.caipNetworkIdToNumber((r=Ge.activeCaipNetwork)==null?void 0:r.caipNetworkId);if(!Ge.activeChain||!e)return!1;const n=((s=rIt.get(LS.SMART_ACCOUNT_ENABLED_NETWORKS))==null?void 0:s.split(","))||[];return!!(n!=null&&n.includes(e.toString()))},showUnsupportedChainUI(){Zt.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const e=Ge.activeCaipNetwork;return!!(e!=null&&e.chainNamespace&&is.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){Q.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})},resetAccount(e){var s,i;const t=e;if(!t)throw new Error("Chain is required to set account prop");const n=(i=(s=Q.state.chains.get(t))==null?void 0:s.accountState)==null?void 0:i.preferredAccountType,r=ke.state.defaultAccountTypes[t];Ge.activeCaipAddress=void 0,Q.setChainAccountData(t,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol
1098:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:r||n,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,user:void 0,status:"disconnected"}),qe.removeConnectorId(t)},setIsSwitchingNamespace(e){Ge.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){var n,r;const e=[];let t;if(Ge.chains.forEach(s=>{ye.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(i=>i===s.namespace)&&s.namespace&&e.push(s.namespace)}),e.length>0){const s=e[0];return t=s?(r=(n=Ge.chains.get(s))==null?void 0:n.caipNetworks)==null?void 0:r[0]:void 0,t}},getAccountData(e){var n;const t=e||Ge.activeChain;if(t)return(n=Q.state.chains.get(t))==null?void 0:n.accountState},getNetworkData(e){var n;const t=e||Ge.activeChain;if(t)return(n=Q.state.chains.get(t))==null?void 0:n.networkState},getCaipNetworkByNamespace(e,t){var s,i,o;if(!e)return;const n=Q.state.chains.get(e),r=(s=n==null?void 0:n.caipNetworks)==null?void 0:s.find(a=>a.id.toString()===(t==null?void 0:t.toString()));return r||((i=n==null?void 0:n.networkState)==null?void 0:i.caipNetwork)||((o=n==null?void 0:n.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const e=qe.state.filterByNamespace;return(e?[Ge.chains.get(e)]:Array.from(Ge.chains.values())).flatMap(n=>(n==null?void 0:n.caipNetworks)||[]).map(n=>n.caipNetworkId)},getCaipNetworks(e){return e?Q.getRequestedCaipNetworks(e):Q.getAllRequestedCaipNetworks()},getCaipNetworkById(e,t){return _Ee.getCaipNetworks(t).find(n=>n.id.toString()===e.toString()||n.caipNetworkId.toString()===e.toString())},setLastConnectedSIWECaipNetwork(e){Ge.lastConnectedSIWECaipNetwork=e},getLastConnectedSIWECaipNetwork(){return Ge.lastConnectedSIWECaipNetwork},async fetchTokenBalance(e){var o,a;const t=Q.getAccountData();if(!t)return[];const n=(o=Q.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,r=(a=Q.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=Q.state.activeCaipAddress,i=s?Be.getPlainAddress(s):void 0;if(Q.setAccountProp("balanceLoading",!0,r),t.lastRetry&&!Be.isAllowedRetry(t.lastRetry,30*is.ONE_SEC_MS))return Q.setAccountProp("balanceLoading",!1,r),[];try{if(i&&n&&r){const c=await aP.getMyTokensWithBalance();return Q.setAccountProp("tokenBalance",c,r),Q.setAccountProp("lastRetry",void 0,r),Q.setAccountProp("balanceLoading",!1,r),c}}catch(c){Q.setAccountProp("lastRetry",Date.now(),r),e==null||e(c),Xn.showError("Token Balance Unavailable")}finally{Q.setAccountProp("balanceLoading",!1,r)}return[]},isCaipNetworkDisabled(e){var c;const t=e.chainNamespace,n=!!((c=Q.getAccountData(t))!=null&&c.caipAddress),r=Q.getAllApprovedCaipNetworkIds(),s=Q.getNetworkProp("supportsAllNetworks",t)!==!1,i=qe.getConnectorId(t),o=qe.getAuthConnector(),a=i===ye.CONNECTOR_ID.AUTH&&o;return!n||s||a?!1:!(r!=null&&r.includes(e.caipNetworkId))}},Q=ju(_Ee),aNt={onSwitchNetwork({network:e,ignoreSwitchConfirmation:t=!1}){var h,f;const n=Q.state.activeCaipNetwork,r=Q.state.activeChain,s=fe.state.data;if(e.id===(n==null?void 0:n.id))return;const o=!!((h=Q.getAccountData(r))!=null&&h.address),a=!!((f=Q.getAccountData(e.chainNamespace))!=null&&f.address),c=e.chainNamespace!==r,u=qe.getConnectorId(r)===ye.CONNECTOR_ID.AUTH,d=ye.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(g=>g===e.chainNamespace);t||u&&d?fe.push("SwitchNetwork",{...s,network:e}):o&&c&&!a?fe.push("SwitchActiveChain",{switchToChain:e.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:e}):fe.push("SwitchNetwork",{...s,network:e})}},Da=qr({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),cNt={state:Da,subscribe(e){return Ji(Da,()=>e(Da))},subscribeKey(e,t){return Xi(Da,e,t)},async open(e){var o,a;const t=e==null?void 0:e.namespace,n=Q.state.activeChain,r=t&&t!==n,s=(o=Q.getAccountData(e==null?void 0:e.namespace))==null?void 0:o.caipAddress,i=Q.state.noAdapters;if(Ae.state.wcBasic?De.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1}):await De.prefetch(),qe.setFilterByNamespace(e==null?void 0:e.namespace),Zt.setLoading(!0,t),t&&r){const c=((a=Q.getNetworkData(t))==null?void 0:a.caipNetwork)||Q.getRequestedCaipNetworks(t)[0];c&&(i?(await Q.switchActiveNetwork(c),fe.push("ConnectingWalletConnectBasic")):aNt.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0}))}else ke.state.manualWCControl||i&&!s?Be.isMobile()?fe.reset("AllWallets"):fe.reset("ConnectingWalletConnectBasic"):e!=null&&e.view?fe.reset(e.view,e.data):s?fe.reset("Account"):fe.reset("Connect");Da.open=!0,Yp.set({open:!0}),It.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!s}})},close(){const e=ke.state.enableEmbedded,t=!!Q.state.activeCaipAddress;Da.open&&It.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),Da.open=!1,fe.reset("Connect"),Zt.clearLoading(),e?t?fe.replace("Account"):fe.push("Connect"):Yp.set({open:!1}),Ae.resetUri()}
1098,setLoading(e,t){t&&Da.loadingNamespaceMap.set(t,e),Da.loading=e,Yp.set({loading:e})},clearLoading(){Da.loadingNamespaceMap.clear(),Da.loading=!1,Yp.set({loading:!1})},shake(){Da.shake||(Da.shake=!0,setTimeout(()=>{Da.shake=!1},500))}},Zt=ju(cNt);let j1=null;const Ep={getSIWX(){return ke.state.siwx},async initializeIfEnabled(e=Q.getActiveCaipAddress()){var i,o,a;const t=ke.state.siwx;if(!(t&&e))return;const[n,r,s]=e.split(":");if(Q.checkIfSupportedNetwork(n,`${n}:${r}`))try{if((i=ke.state.remoteFeatures)!=null&&i.emailCapture){const l=(o=Q.getAccountData(n))==null?void 0:o.user;await Zt.open({view:"DataCapture",data:{email:(l==null?void 0:l.email)??void 0}});return}if(j1&&await j1,(await t.getSessions(`${n}:${r}`,s)).length)return;await Zt.open({view:"SIWXSignMessage"})}catch(c){console.error("SIWXUtil:initializeIfEnabled",c),It.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(c)}),await((a=Ae._getClient())==null?void 0:a.disconnect().catch(console.error)),fe.reset("Connect"),Xn.showError("A problem occurred while trying initialize authentication")}},async isAuthenticated(e=Q.getActiveCaipAddress()){if(!ke.state.siwx||!e)return!0;const{chainNamespace:n,chainId:r,address:s}=jh.parseCaipAddress(e),i=`${n}:${r}`;return(await Ep.getSessions({address:s,caipNetworkId:i})).length>0},async requestSignMessage(){const e=ke.state.siwx,t=Be.getPlainAddress(Q.getActiveCaipAddress()),n=GI();if(!e)throw new Error("SIWX is not enabled");if(!t)throw new Error("No ActiveCaipAddress found");if(!n)throw new Error("No ActiveCaipNetwork or client found");try{const r=await e.createMessage({chainId:n.caipNetworkId,accountAddress:t}),s=r.toString();let i="";e.signMessage?i=await e.signMessage({message:s,chainId:n.caipNetworkId,accountAddress:t}):(qe.getConnectorId(n.chainNamespace)===ye.CONNECTOR_ID.AUTH&&fe.pushTransactionStack({}),i=await Ae.signMessage(s)||""),await e.addSession({data:r,message:s,signature:i}),Q.setLastConnectedSIWECaipNetwork(n),Zt.close(),It.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(r){(!Zt.state.open||fe.state.view==="ApproveTransaction")&&await Zt.open({view:"SIWXSignMessage"}),Xn.showError("Error signing message"),It.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties(r)}),console.error("SWIXUtil:requestSignMessage",r)}},async cancelSignMessage(){var e;try{const t=this.getSIWX();if((e=t==null?void 0:t.getRequired)==null?void 0:e.call(t)){const r=Q.getLastConnectedSIWECaipNetwork();if(r){const s=await(t==null?void 0:t.getSessions(r==null?void 0:r.caipNetworkId,Be.getPlainAddress(Q.getActiveCaipAddress())||""));s&&s.length>0?await Q.switchActiveNetwork(r):await Ae.disconnect()}else await Ae.disconnect()}else Zt.close();Zt.close(),It.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(t){console.error("SIWXUtil:cancelSignMessage",t)}},async getAllSessions(){const e=this.getSIWX(),t=Q.getAllRequestedCaipNetworks(),n=[];return await Promise.all(t.map(async r=>{const s=await(e==null?void 0:e.getSessions(r.caipNetworkId,Be.getPlainAddress(Q.getActiveCaipAddress())||""));s&&n.push(...s)})),n},async getSessions(e){const t=ke.state.siwx;let n=e==null?void 0:e.address;if(!n){const s=Q.getActiveCaipAddress();n=Be.getPlainAddress(s)}let r=e==null?void 0:e.caipNetworkId;if(!r){const s=Q.getActiveCaipNetwork();r=s==null?void 0:s.caipNetworkId}return t&&n&&r?t.getSessions(r,n):[]},async isSIWXCloseDisabled(){var t;const e=this.getSIWX();if(e){const n=fe.state.view==="ApproveTransaction",r=fe.state.view==="SIWXSignMessage";if(n||r)return((t=e.getRequired)==null?void 0:t.call(e))&&(await this.get
1098Sessions()).length===0}return!1},async authConnectorAuthenticate({authConnector:e,chainId:t,socialUri:n,preferredAccountType:r,chainNamespace:s}){var d;const i=Ep.getSIWX(),o=GI();if(!i||!s.includes(ye.CHAIN.EVM)||(d=ke.state.remoteFeatures)!=null&&d.emailCapture){const h=await e.connect({chainId:t,socialUri:n,preferredAccountType:r});return{address:h.address,chainId:h.chainId,accounts:h.accounts}}const a=`${s}:${t}`,c=await i.createMessage({chainId:a,accountAddress:"<<AccountAddress>>"}),l={accountAddress:c.accountAddress,chainId:c.chainId,domain:c.domain,uri:c.uri,version:c.version,nonce:c.nonce,notBefore:c.notBefore,statement:c.statement,resources:c.resources,requestId:c.requestId,issuedAt:c.issuedAt,expirationTime:c.expirationTime,serializedMessage:c.toString()},u=await e.connect({chainId:t,socialUri:n,siwxMessage:l,preferredAccountType:r});return l.accountAddress=u.address,l.serializedMessage=u.message||"",u.signature&&u.message&&await Ep.addEmbeddedWalletSession(l,u.message,u.signature),Q.setLastConnectedSIWECaipNetwork(o),{address:u.address,chainId:u.chainId,accounts:u.accounts}},async addEmbeddedWalletSession(e,t,n){if(j1)return j1;const r=Ep.getSIWX();return r?(j1=r.addSession({data:e,message:t,signature:n}).finally(()=>{j1=null}),j1):Promise.resolve()},async universalProviderAuthenticate({universalProvider:e,chains:t,methods:n}){var l,u,d;const r=Ep.getSIWX(),s=GI(),i=new Set(t.map(h=>h.split(":")[0]));if(!r||i.size!==1||!i.has("eip155"))return!1;const o=await r.createMessage({chainId:((l=GI())==null?void 0:l.caipNetworkId)||"",accountAddress:""}),a=await e.authenticate({nonce:o.nonce,domain:o.domain,uri:o.uri,exp:o.expirationTime,iat:o.issuedAt,nbf:o.notBefore,requestId:o.requestId,version:o.version,resources:o.resources,statement:o.statement,chainId:o.chainId,methods:n,chains:[o.chainId,...t.filter(h=>h!==o.chainId)]});Xn.showLoading("Authenticating...",{autoClose:!1});const c={...a.session.peer.metadata,name:a.session.peer.metadata.name,icon:(u=a.session.peer.metadata.icons)==null?void 0:u[0],type:"WALLET_CONNECT"};if(Q.setAccountProp("connectedWalletInfo",c,Array.from(i)[0]),(d=a==null?void 0:a.auths)!=null&&d.length){const h=a.auths.map(f=>{const g=e.client.formatAuthMessage({request:f.p,iss:f.p.iss});return{data:{...f.p,accountAddress:f.p.iss.split(":").slice(-1).join(""),chainId:f.p.iss.split(":").slice(2,4).join(":"),uri:f.p.aud??"",version:f.p.version||o.version,expirationTime:f.p.exp,issuedAt:f.p.iat,notBefore:f.p.nbf},message:g,signature:f.s.s,cacao:f}});try{await r.setSessions(h),s&&Q.setLastConnectedSIWECaipNetwork(s),It.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:Ep.getSIWXEventProperties()})}catch(f){throw console.error("SIWX:universalProviderAuth - failed to set sessions",f),It.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:Ep.getSIWXEventProperties(f)}),await e.disconnect().catch(console.error),f}finally{Xn.hide()}}return!0},getSIWXEventProperties(e){var n;const t=Q.state.activeChain;if(!t)throw new Error("SIWXUtil:getSIWXEventProperties - namespace is required");return{network:((n=Q.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||"",isSmartAccount:cl(t)===sl.ACCOUNT_TYPES.SMART_ACCOUNT,message:e?Be.parseError(e):void 0}},async clearSessions(){const e=this.getSIWX();e&&await e.setSessions([])}},Ug={getGasPriceInEther(e,t){const n=t*e;return Number(n)/1e18},getGasPriceInUSD(e,t,n){const r=Ug.getGasPriceInEther(t,n);return hs.bigNumber(e).times(r).toNumber()},getPriceImpact({sourceTokenAmount:e,sourceTokenPriceInUSD:t,toTokenPriceInUSD:n,toTokenAmount:r}){const s=hs.bigNumber(e).times(t),i=hs.bigNumber(r).times(n);return s.minus(i).div(s).times(100).toNumber()},getMaxSlippage(e,t){const n=hs.bigNumber(e).div(100);return hs.multiply(t,n).toNumber()},getProviderFee(e,t=.0085){return hs.bigNumber(e).times(t).toString()},isInsufficientNetworkTokenForGas(e,t){const n=t||"0";return hs.bigNumber(e).eq(0)?!0:hs.bigNumber(hs.bigNumber(n)).gt(e)},isInsufficientSourceTokenForSwap(e,t,n){var i,o;const r=(o=(i=n==null?void 0:n.find(a=>a.address===t))==null?void 0:i.quantity)==null?void 0:o.numeric;return hs.bigNumber(r||"0").lt(e)}},od=qr({message:"",variant:"info",open:!1}),lNt={state:od,subscribeKey(e,t){return Xi(od,e,t)},open(e,t){const{debug:n}=ke.state,{code:r,displayMessage:s,debugMessage:i}=e;
1098s&&n&&(od.message=s,od.variant=t,od.open=!0)},warn(e,t,n){od.open=!0,od.message=e,od.variant="warning",t&&console.warn(t,n)},close(){od.open=!1,od.message="",od.variant="info"}},A8=ju(lNt),pae=15e4,uNt=6,Co={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:is.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},oe=qr({...Co}),FS={state:oe,subscribe(e){return Ji(oe,()=>e(oe))},subscribeKey(e,t){return Xi(oe,e,t)},getParams(){var c,l,u,d,h,f,g,p,m;const e=Q.state.activeChain,t=((c=Q.getAccountData(e))==null?void 0:c.caipAddress)??Q.state.activeCaipAddress,n=Be.getPlainAddress(t),r=DK(),s=qe.getConnectorId(Q.state.activeChain);if(!n)throw new Error("No address found to swap the tokens from.");const i=!((l=oe.toToken)!=null&&l.address)||!((u=oe.toToken)!=null&&u.decimals),o=!((d=oe.sourceToken)!=null&&d.address)||!((h=oe.sourceToken)!=null&&h.decimals)||!hs.bigNumber(oe.sourceTokenAmount).gt(0),a=!oe.sourceTokenAmount;return{networkAddress:r,fromAddress:n,fromCaipAddress:t,sourceTokenAddress:(f=oe.sourceToken)==null?void 0:f.address,toTokenAddress:(g=oe.toToken)==null?void 0:g.address,toTokenAmount:oe.toTokenAmount,toTokenDecimals:(p=oe.toToken)==null?void 0:p.decimals,sourceTokenAmount:oe.sourceTokenAmount,sourceTokenDecimals:(m=oe.sourceToken)==null?void 0:m.decimals,invalidToToken:i,invalidSourceToken:o,invalidSourceTokenAmount:a,availableToSwap:t&&!i&&!o&&!a,isAuthConnector:s===ye.CONNECTOR_ID.AUTH}},async setSourceToken(e){if(!e){oe.sourceToken=e,oe.sourceTokenAmount="",oe.sourceTokenPriceInUSD=0;return}oe.sourceToken=e,await Dt.setTokenPrice(e.address,"sourceToken")},setSourceTokenAmount(e){oe.sourceTokenAmount=e},async setToToken(e){if(!e){oe.toToken=e,oe.toTokenAmount="",oe.toTokenPriceInUSD=0;return}oe.toToken=e,await Dt.setTokenPrice(e.address,"toToken")},setToTokenAmount(e){oe.toTokenAmount=e?hs.toFixed(e,uNt):""},async setTokenPrice(e,t){let n=oe.tokensPriceMap[e]||0;n||(oe.loadingPrices=!0,n=await Dt.getAddressPrice(e)),t==="sourceToken"?oe.sourceTokenPriceInUSD=n:t==="toToken"&&(oe.toTokenPriceInUSD=n),oe.loadingPrices&&(oe.loadingPrices=!1),Dt.getParams().availableToSwap&&!oe.switchingTokens&&Dt.swapTokens()},async switchTokens(){if(!(oe.initializing||!oe.initialized||oe.switchingTokens)){oe.switchingTokens=!0;try{const e=oe.toToken?{...oe.toToken}:void 0,t=oe.sourceToken?{...oe.sourceToken}:void 0,n=e&&oe.toTokenAmount===""?"1":oe.toTokenAmount;Dt.setSourceTokenAmount(n),Dt.setToTokenAmount(""),await Dt.setSourceToken(e),await Dt.setToToken(t),oe.switchingTokens=!1,Dt.swapTokens()}catch(e){throw oe.switchingTokens=!1,e}}},resetState(){oe.myTokensWithBalance=Co.myTokensWithBalance,oe.tokensPriceMap=Co.tokensPriceMap,oe.initialized=Co.initialized,oe.initializing=Co.initializing,oe.switchingTokens=Co.switchingTokens,oe.sourceToken=Co.sourceToken,oe.sourceTokenAmount=Co.sourceTokenAmount,oe.sourceTokenPriceInUSD=Co.sourceTokenPriceInUSD,oe.toToken=Co.toToken,oe.toTokenAmount=Co.toTokenAmount,oe.toTokenPriceInUSD=Co.toTokenPriceInUSD,oe.networkPrice=Co.networkPrice,oe.networkTokenSymbol=Co.networkTokenSymbol,oe.networkBalanceInUSD=Co.networkBalanceInUSD,oe.inputError=Co.inputError},resetValues(){var n;const{networkAddress:e}=Dt.getParams(),t=(n=oe.tokens)==null?void 0:n.find(r=>r.address===e);Dt.setSourceToken(t),Dt.setToToken(void 0)},getApprovalLoadingState(){return oe.loadingApprovalTransaction},clearError(){oe.transactionError=void 0},async initializeState(){if(!oe.initializing){if(oe.initializing=!0,!oe.initialized)try{await Dt.fetchTokens(),oe.initialized=!0}catch{oe.initialized=!1,Xn.showError("Failed to initialize swap"),fe.goBack()}oe.initializing=!1}},async fetchTokens(){var n;const{networkAddress:e}=Dt.getParams();await Dt.getNetworkTokenPrice(),await Dt.getMyTokensWithBalance();const t=(n=oe.myTokensWithBalance)==null?void 0:n.find(r=>r.address===e);t&&(oe.networkTokenSymbol=t.symbol,Dt.setSourceToken(t),Dt.setSourceTokenAmount("0"))},async getTokenList(){var t,n;const e=(t=Q.state.activeCaipNetwork)==null?void 0:t.caipNetworkId;if(!(oe.caipNetworkId===e&&oe.tokens))try{oe.tokensLoading=!0;const r=await av.getTokenList(e);oe.tokens=r,oe.caipNetworkId=e,oe.popularTokens=r.sort((c,l)=>c.symbol<l.symbol?-1:c.symbol>l.symbol?1:0);const i=(e&&((n=is.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:n[e])||[]).map(c=>r.find(l=>l.symbol===c)).filter(c=>!!c),a=(is.SWAP_SUGGESTED_TOKENS||[]).map(c=>r.find(l=>l.symbol===c)).filter(c=>!!c).filter(c=>!i.some(l=>l.address===c.address));oe.suggestedTokens=[...i,...a]}catch{oe.tokens=[],oe.popularTokens=[],oe.suggestedTokens=[]}finally{oe.tokensLoading=!1}},async getAddressPrice(e){var c,l;const t=oe.tokensPriceMap[e];if(t)return t;const n=await Mt.fetchTokenPrice({addresses:[e]}),r=(n==null?void 0:n.fungibles)||[],s=[...oe.tokens||[],...oe.myTokensWithBalance||[]],i=(c=s==null?void 0:s.find(u=>u.address===e))==null?void 0:c.symbol,o=((l=r.find(u=>u.symbol.toLowerCase()===(i==null?void 0:i.toLowerCase())))==null?void 0:l.price)||0,a=parseFloat(o.toString());return oe.tokensPriceMap[e]=a,a},async getNetworkTokenPrice(){var s;const{networkAddress:e}=Dt.getParams(),n=(s=(await Mt.fetchTokenPrice({addresses:[e]}).catch(()=>(Xn.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:s[0],r=(n==null?void 0:n.price.toString())||"0";
vendor: 24,948 bytes, lines 1098-1102
1098oe.tokensPriceMap[e]=parseFloat(r),oe.networkTokenSymbol=(n==null?void 0:n.symbol)||"",oe.networkPrice=r},async getMyTokensWithBalance(e){var r;const t=await aP.getMyTokensWithBalance({forceUpdate:e,caipNetwork:Q.state.activeCaipNetwork,address:(r=Q.getAccountData())==null?void 0:r.address}),n=av.mapBalancesToSwapTokens(t);n&&(await Dt.getInitialGasPrice(),Dt.setBalances(n))},setBalances(e){const{networkAddress:t}=Dt.getParams(),n=Q.state.activeCaipNetwork;if(!n)return;const r=e.find(s=>s.address===t);e.forEach(s=>{oe.tokensPriceMap[s.address]=s.price||0}),oe.myTokensWithBalance=e.filter(s=>s.address.startsWith(n.caipNetworkId)),oe.networkBalanceInUSD=r?hs.multiply(r.quantity.numeric,r.price).toString():"0"},async getInitialGasPrice(){var t,n;const e=await av.fetchGasPrice();if(!e)return{gasPrice:null,gasPriceInUSD:null};switch((n=(t=Q.state)==null?void 0:t.activeCaipNetwork)==null?void 0:n.chainNamespace){case ye.CHAIN.SOLANA:return oe.gasFee=e.standard??"0",oe.gasPriceInUSD=hs.multiply(e.standard,oe.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(oe.gasFee),gasPriceInUSD:Number(oe.gasPriceInUSD)};case ye.CHAIN.EVM:default:const r=e.standard??"0",s=BigInt(r),i=BigInt(pae),o=Ug.getGasPriceInUSD(oe.networkPrice,i,s);return oe.gasFee=r,oe.gasPriceInUSD=o,{gasPrice:s,gasPriceInUSD:o}}},async swapTokens(){var i,o,a;const e=(i=Q.getAccountData())==null?void 0:i.address,t=oe.sourceToken,n=oe.toToken,r=hs.bigNumber(oe.sourceTokenAmount).gt(0);if(r||Dt.setToTokenAmount(""),!n||!t||oe.loadingPrices||!r||!e)return;oe.loadingQuote=!0;const s=hs.bigNumber(oe.sourceTokenAmount).times(10**t.decimals).round(0).toFixed(0);try{const c=await Mt.fetchSwapQuote({userAddress:e,from:t.address,to:n.address,gasPrice:oe.gasFee,amount:s.toString()});oe.loadingQuote=!1;const l=(a=(o=c==null?void 0:c.quotes)==null?void 0:o[0])==null?void 0:a.toAmount;if(!l){A8.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const u=hs.bigNumber(l).div(10**n.decimals).toString();Dt.setToTokenAmount(u),Dt.hasInsufficientToken(oe.sourceTokenAmount,t.address)?oe.inputError="Insufficient balance":(oe.inputError=void 0,Dt.setTransactionDetails())}catch(c){const l=await av.handleSwapError(c);oe.loadingQuote=!1,oe.inputError=l||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:e,availableToSwap:t}=Dt.getParams(),n=oe.sourceToken,r=oe.toToken;if(!(!e||!t||!n||!r||oe.loadingQuote))try{oe.loadingBuildTransaction=!0;const s=await av.fetchSwapAllowance({userAddress:e,tokenAddress:n.address,sourceTokenAmount:oe.sourceTokenAmount,sourceTokenDecimals:n.decimals});let i;return s?i=await Dt.createSwapTransaction():i=await Dt.createAllowanceTransaction(),oe.loadingBuildTransaction=!1,oe.fetchError=!1,i}catch{fe.goBack(),Xn.showError("Failed to check allowance"),oe.loadingBuildTransaction=!1,oe.approvalTransaction=void 0,oe.swapTransaction=void 0,oe.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:e,sourceTokenAddress:t,toTokenAddress:n}=Dt.getParams();if(!(!e||!n)){if(!t)throw new Error("createAllowanceTransaction - No source token address found.");try{const r=await Mt.generateApproveCalldata({from:t,to:n,userAddress:e}),s=Be.getPlainAddress(r.tx.from);if(!s)throw new Error("SwapController:createAllowanceTransaction - address is required");const i={data:r.tx.data,to:s,gasPrice:BigInt(r.tx.eip155.gasPrice),value:BigInt(r.tx.value),toAmount:oe.toTokenAmount};return oe.swapTransaction=void 0,oe.approvalTransaction={data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount},{data:i.data,to:i.to,gasPrice:i.gasPrice,value:i.value,toAmount:i.toAmount}}catch{fe.goBack(),Xn.showError("Failed to create approval transaction"),oe.approvalTransaction=void 0,oe.swapTransaction=void 0,oe.fetchError=!0;return}}},async createSwapTransaction(){var o;const{networkAddress:e,fromCaipAddress:t,sourceTokenAmount:n}=Dt.getParams(),r=oe.sourceToken,s=oe.toToken;if(!t||!n||!r||!s)return;const i=(o=Ae.parseUnits(n,r.decimals))==null?void 0:o.toString();try{const a=await Mt.generateSwapCalldata({userAddress:t,from:r.address,to:s.address,amount:i,disableEstimate:!0}),c=r.address===e,l=BigInt(a.tx.eip155.gas),u=BigInt(a.tx.eip155.gasPrice),d=Be.getPlainAddress(a.tx.to);if(!d)throw new Error("SwapController:createSwapTransaction - address is required");const h={data:a.tx.data,to:d,gas:l,gasPrice:u,value:BigInt(c?i??"0":"0"),toAmount:oe.toTokenAmount};return oe.gasPriceInUSD=Ug.getGasPriceInUSD(oe.networkPrice,l,u),oe.approvalTransaction=void 0,oe.swapTransaction=h,h}catch{fe.goBack(),Xn.showError("Failed to create transaction"),oe.approvalTransaction=void 0,oe.swapTransaction=void 0,oe.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){Xn.showLoading("Approve limit increase in your wallet"),fe.replace("SwapPreview")},async sendTransactionForApproval(e){var s,i,o;const{fromAddress:t,isAuthConnector:n}=Dt.getParams();oe.loadingApprovalTransaction=!0,n?fe.pushTransactionStack({onSuccess:Dt.onEmbeddedWalletApprovalSuccess}):Xn.showLoading("Approve limit increase in your wallet");try{await Ae.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:ye.CHAIN.EVM}),await Dt.swapTokens(),await Dt.getTransaction(),oe.approvalTransaction=void 0,oe.loadingApprovalTransaction=!1}catch(a){const c=a;oe.transactionError=c==null?void 0:c.displayMessage,oe.loadingApprovalTransaction=!1,Xn.showError((c==null?void 0:c.displayMessage)||"Transaction error"),It.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(c==null?void 0:c.displayMessage)||(c==null?void 0:c.message)||"Unknown",network:((s=Q.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||"",swapFromToken:((i=Dt.state.sourceToken)==null?void 0:i.symbol)||"",swapToToken:((o=Dt.state.toToken)==null?void 0:o.symbol)||"",swapFromAmount:Dt.state.sourceTokenAmount||"",swapToAmount:Dt.state.toTokenAmount||"",isSmartAccount:cl(ye.CHAIN.EVM)===sl.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(e){var o,a,c,l,u,d,h,f,g,p,m,w;if(!e)return;const{fromAddress:t,toTokenAmount:n,isAuthConnector:r}=Dt.getParams();oe.loadingTransaction=!0;const s=`Swapping ${(o=oe.sourceToken)==null?void 0:o.symbol} to ${hs.formatNumberToLocalString(n,3)} ${(a=oe.toToken)==null?void 0:a.symbol}`,i=`Swapped ${(c=oe.sourceToken)==null?void 0:c.symbol} to ${hs.formatNumberToLocalString(n,3)} ${(l=oe.toToken)==null?void 0:l.symbol}`;r?fe.pushTransactionStack({onSuccess(){fe.replace("Account"),Xn.showLoading(s),FS.resetState()}}):Xn.showLoading("Confirm transaction in your wallet");try{const C=[(u=oe.sourceToken)==null?void 0:u.address,(d=oe.toToken)==null?void 0:d.address].join(","),E=await Ae.sendTransaction({address:t,to:e.to,data:e.data,value:e.value,chainNamespace:ye.CHAIN.EVM});return oe.loadingTransaction=!1,Xn.showSuccess(i),It.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((h=Q.state.activeCaipNetwork)==null?void 0:h.caipNetworkId)||"",swapFromToken:((f=Dt.state.sourceToken)==null?void 0:f.symbol)||"",swapToToken:((g=Dt.state.toToken)==null?void 0:g.symbol)||"",swapFromAmount:Dt.state.sourceTokenAmount||"",swapToAmount:Dt.state.toTokenAmount||"",isSmartAccount:cl(ye.CHAIN.EVM)===sl.ACCOUNT_TYPES.SMART_ACCOUNT}}),FS.resetState(),r||fe.replace("Account"),FS.getMyTokensWithBalance(C),E}catch(C){const E=C;oe.transactionError=E==null?void 0:E.displayMessage,oe.loadingTransaction=!1,Xn.showError((E==null?void 0:E.displayMessage)||"Transaction error"),It.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(E==null?void 0:E.displayMessage)||(E==null?void 0:E.message)||"Unknown",network:((p=Q.state.activeCaipNetwork)==null?void 0:p.caipNetworkId)||"",swapFromToken:((m=Dt.state.sourceToken)==null?void 0:m.symbol)||"",swapToToken:((w=Dt.state.toToken)==null?void 0:w.symbol)||"",swapFromAmount:Dt.state.sourceTokenAmount||"",swapToAmount:Dt.state.toTokenAmount||"",isSmartAccount:cl(ye.CHAIN.EVM)===sl.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(e,t){return Ug.isInsufficientSourceTokenForSwap(e,t,oe.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:e,toTokenDecimals:t}=Dt.getParams();!e||!t||(oe.gasPriceInUSD=Ug.getGasPriceInUSD(oe.networkPrice,BigInt(oe.gasFee),BigInt(pae)),oe.priceImpact=Ug.getPriceImpact({sourceTokenAmount:oe.sourceTokenAmount,sourceTokenPriceInUSD:oe.sourceTokenPriceInUSD,toTokenPriceInUSD:oe.toTokenPriceInUSD,toTokenAmount:oe.toTokenAmount}),oe.maxSlippage=Ug.getMaxSlippage(oe.slippage,oe.toTokenAmount),oe.providerFee=Ug.getProviderFee(oe.sourceTokenAmount))}},Dt=ju(FS),ad=qr({message:"",open:!1,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"}),dNt={state:ad,subscribe(e){return Ji(ad,()=>e(ad))},subscribeKey(e,t){return Xi(ad,e,t)},showTooltip({message:e,triggerRect:t,variant:n}){ad.open=!0,ad.message=e,ad.triggerRect=t,ad.variant=n},hide(){ad.open=!1,ad.message="",ad.triggerRect={width:0,height:0,top:0,left:0}}},hu=ju(dNt),NEe={isUnsupportedChainView(){return fe.state.view==="UnsupportedChain"||fe.state.view==="SwitchNetwork"&&fe.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){Zt.shake();return}if(await Ep.isSIWXCloseDisabled()){Zt.shake();return}(fe.state.view==="DataCapture"||fe.state.view==="DataCaptureOtpConfirm")&&Ae.disconnect(),Zt.close()}},hNt={black:"#202020",white:"#FFFFFF",white010:"rgba(255, 255, 255, 0.1)",accent010:"rgba(9, 136, 240, 0.1)",accent020:"rgba(9, 136, 240, 0.2)",accent030:"rgba(9, 136, 240, 0.3)",accent040:"rgba(9, 136, 240, 0.4)",accent050:"rgba(9, 136, 240, 0.5)",accent060:"rgba(9, 136, 240, 0.6)",accent070:"rgba(9, 136, 240, 0.7)",accent080:"rgba(9, 136, 240, 0.8)",accent090:"rgba(9, 136, 240, 0.9)",accent100:"rgba(9, 136, 240, 1.0)",accentSecondary010:"rgba(199, 185, 148, 0.1)",accentSecondary020:"rgba(199, 185, 148, 0.2)",accentSecondary030:"rgba(199, 185, 148, 0.3)",accentSecondary040:"rgba(199, 185, 148, 0.4)",accentSecondary050:"rgba(199, 185, 148, 0.5)",accentSecondary060:"rgba(199, 185, 148, 0.6)",accentSecondary070:"rgba(199, 185, 148, 0.7)",accentSecondary080:"rgba(199, 185, 148, 0.8)",accentSecondary090:"rgba(199, 185, 148, 0.9)",accentSecondary100:"rgba(199, 185, 148, 1.0)",productWalletKit:"#FFB800",productAppKit:"#FF573B",productCloud:"#0988F0",productDocumentation:"#008847",neutrals050:"#F6F6F6",neutrals100:"#F3F3F3",neutrals200:"#E9E9E9",neutrals300:"#D0D0D0",neutrals400:"#BBB",neutrals500:"#9A9A9A",neutrals600:"#6C6C6C",neutrals700:"#4F4F4F",neutrals800:"#363636",neutrals900:"#2A2A2A",neutrals1000:"#252525",semanticSuccess010:"rgba(48, 164, 107, 0.1)",semanticSuccess020:"rgba(48, 164, 107, 0.2)",semanticSuccess030:"rgba(48, 164, 107, 0.3)",semanticSuccess040:"rgba(48, 164, 107, 0.4)",semanticSuccess050:"rgba(48, 164, 107, 0.5)",semanticSuccess060:"rgba(48, 164, 107, 0.6)",semanticSuccess070:"rgba(48, 164, 107, 0.7)",semanticSuccess080:"rgba(48, 164, 107, 0.8)",semanticSuccess090:"rgba(48, 164, 107, 0.9)",semanticSuccess100:"rgba(48, 164, 107, 1.0)",semanticError010:"rgba(223, 74, 52, 0.1)",semanticError020:"rgba(223, 74, 52, 0.2)",semanticError030:"rgba(223, 74, 52, 0.3)",semanticError040:"rgba(223, 74, 52, 0.4)",semanticError050:"rgba(223, 74, 52, 0.5)",semanticError060:"rgba(223, 74, 52, 0.6)",semanticError070:"rgba(223, 74, 52, 0.7)",semanticError080:"rgba(223, 74, 52, 0.8)",semanticError090:"rgba(223, 74, 52, 0.9)",semanticError100:"rgba(223, 74, 52, 1.0)",semanticWarning010:"rgba(243, 161, 63, 0.1)",semanticWarning020:"rgba(243, 161, 63, 0.2)",semanticWarning030:"rgba(243, 161, 63, 0.3)",semanticWarning040:"rgba(243, 161, 63, 0.4)",semanticWarning050:"rgba(243, 161, 63, 0.5)",semanticWarning060:"rgba(243, 161, 63, 0.6)",semanticWarning070:"rgba(243, 161, 63, 0.7)",semanticWarning080:"rgba(243, 161, 63, 0.8)",semanticWarning090:"rgba(243, 161, 63, 0.9)",semanticWarning100:"rgba(243, 161, 63, 1.0)"},k_={core:{backgroundAccentPrimary:"#0988F0",backgroundAccentCertified:"#C7B994",backgroundWalletKit:"#FFB800",backgroundAppKit:"#FF573B",backgroundCloud:"#0988F0",backgroundDocumentation:"#008847",backgroundSuccess:"rgba(48, 164, 107, 0.20)",backgroundError:"rgba(223, 74, 52, 0.20)",backgroundWarning:"rgba(243, 161, 63, 0.20)",textAccentPrimary:"#0988F0",textAccentCertified:"#C7B994",textWalletKit:"#FFB800",textAppKit:"#FF573B",textCloud:"#0988F0",textDocumentation:"#008847",textSuccess:"#30A46B",textError:"#DF4A34",textWarning:"#F3A13F",borderAccentPrimary:"#0988F0",borderSecondary:"#C7B994",borderSuccess:"#30A46B",borderError:"#DF4A34",borderWarning:"#F3A13F",foregroundAccent010:"rgba(9, 136, 240, 0.1)",foregroundAccent020:"rgba(9, 136, 240, 0.2)",foregroundAccent040:"rgba(9, 136, 240, 0.4)",foregroundAccent060:"rgba(9, 136, 240, 0.6)",foregroundSecondary020:"rgba(199, 185, 148, 0.2)",foregroundSecondary040:"rgba(199, 185, 148, 0.4)",foregroundSecondary060:"rgba(199, 185, 148, 0.6)",iconAccentPrimary:"#0988F0",iconAccentCertified:"#C7B994",iconSuccess:"#30A46B",iconError:"#DF4A34",iconWarning:"#F3A13F",glass010:"rgba(255, 255, 255, 0.1)",zIndex:"9999"},dark:{overlay:"rgba(0, 0, 0, 0.50)",backgroundPrimary:"#202020",backgroundInvert:"#FFFFFF",textPrimary:"#FFFFFF",textSecondary:"#9A9A9A",textTertiary:"#BBBBBB",textInvert:"#202020",borderPrimary:"#2A2A2A",borderPrimaryDark:"#363636",borderSecondary:"#4F4F4F",foregroundPrimary:"#252525",foregroundSecondary:"#2A2A2A",foregroundTertiary:"#363636",iconDefault:"#9A9A9A",iconInverse:"#FFFFFF"},light:{overlay:"rgba(230 , 230, 230, 0.5)",backgroundPrimary:"#FFFFFF",borderPrimaryDark:"#E9E9E9",backgroundInvert:"#202020",textPrimary:"#202020",textSecondary:"#9A9A9A",textTertiary:"#6C6C6C",textInvert:"#FFFFFF",borderPrimary:"#E9E9E9",borderSecondary:"#D0D0D0",foregroundPrimary:"#F3F3F3",foregroundSecondary:"#E9E9E9",foregroundTertiary:"#D0D0D0",iconDefault:"#9A9A9A",iconInverse:"#202020"}},fNt={1:"4px",2:"8px",10:"10px",3:"12px",4:"16px",6:"24px",5:"20px",8:"32px",16:"64px",20:"80px",32:"128px",64:"256px",128:"512px",round:"9999px"},pNt={0:"0px","01":"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",12:"48px",14:"56px",16:"64px",20:"80px",32:"128px",64:"256px"},gNt={regular:"KHTeka",mono:"KHTekaMono"},mNt={regular:"400",medium:"500"},wNt={h1:"50px",h2:"44px",h3:"38px",h4:"32px",h5:"26px",h6:"20px",large:"16px",medium:"14px",small:"12px"},yNt={"h1-regular-mono":{lineHeight:"50px",letterSpacing:"-3px"},"h1-regular":{lineHeight:"50px",letterSpacing:"-1px"},"h1-medium":{lineHeight:"50px",letterSpacing:"-0.84px"},"h2-regular-mono":{lineHeight:"44px",letterSpacing:"-2.64px"},"h2-regular":{lineHeight:"44px",letterSpacing:"-0.88px"},"h2-medium":{lineHeight:"44px",letterSpacing:"-0.88px"},"h3-regular-mono":{lineHeight:"38px",letterSpacing:"-2.28px"},"h3-regular":{lineHeight:"38px",letterSpacing:"-0.76px"},"h3-medium":{lineHeight:"38px",letterSpacing:"-0.76px"},"h4-regular-mono":{lineHeight:"32px",letterSpacing:"-1.92px"},"h4-regular":{lineHeight:"32px",letterSpacing:"-0.32px"},"h4-medium":{lineHeight:"32px",letterSpacing:"-0.32px"},"h5-regular-mono":{lineHeight:"26px",letterSpacing:"-1.56px"},"h5-regular":{lineHeight:"26px",letterSpacing:"-0.26px"},"h5-medium":{lineHeight:"26px",letterSpacing:"-0.26px"},"h6-regular-mono":{lineHeight:"20px",letterSpacing:"-1.2px"},"h6-regular":{lineHeight:"20px",letterSpacing:"-0.6px"},"h6-medium":{lineHeight:"20px",letterSpacing:"-0.6px"},"lg-regular-mono":{lineHeight:"16px",letterSpacing:"-0.96px"},"lg-regular":{lineHeight:"18px",letterSpacing:"-0.16px"},"lg-medium":{lineHeight:"18px",letterSpacing:"-0.16px"},"md-regular-mono":{lineHeight:"14px",letterSpacing:"-0.84px"},"md-regular":{lineHeight:"16px",letterSpacing:"-0.14px"},"md-medium":{lineHeight:"16px",letterSpacing:"-0.14px"},"sm-regular-mono":{lineHeight:"12px",letterSpacing:"-0.72px"},"sm-regular":{lineHeight:"14px",letterSpacing:"-0.12px"},"sm-medium":{lineHeight:"14px",letterSpacing:"-0.12px"}},bNt={"ease-out-power-2":"cubic-bezier(0.23, 0.09, 0.08, 1.13)","ease-out-power-1":"cubic-bezier(0.12, 0.04, 0.2, 1.06)","ease-in-power-2":"cubic-bezier(0.92, -0.13, 0.77, 0.91)","ease-in-power-1":"cubic-bezier(0.88, -0.06, 0.8, 0.96)","ease-inout-power-2":"cubic-bezier(0.77, 0.09, 0.23, 1.13)","ease-inout-power-1":"cubic-bezier(0.88, 0.04, 0.12, 1.06)"},vNt={xl:"400ms",lg:"200ms",md:"125ms",sm:"75ms"},yz={colors:hNt,fontFamily:gNt,fontWeight:mNt,textSize:wNt,typography:yNt,tokens:{core:k_.core,theme:k_.dark},borderRadius:fNt,spacing:pNt,durations:vNt,easings:bNt},gae="--apkt";function YI(e){if(!e)return{};const t={};return t["font-family"]=e["--apkt-font-family"]??e["--w3m-font-family"]??"KHTeka",t.accent=e["--apkt-accent"]??e["--w3m-accent"]??"#0988F0",t["color-mix"]=e["--apkt-color-mix"]??e["--w3m-color-mix"]??"#000",t["color-mix-strength"]=e["--apkt-color-mix-strength"]??e["--w3m-color-mix-strength"]??0,t["font-size-master"]=e["--apkt-font-size-master"]??e["--w3m-font-size-master"]??"10px",t["border-radius-master"]=e["--apkt-border-radius-master"]??e["--w3m-border-radius-master"]??"4px",e["--apkt-z-index"]!==void 0?t["z-index"]=e["--apkt-z-index"]:e["--w3m-z-index"]!==void 0&&(t["z-index"]=e["--w3m-z-index"]),t}const Cp={createCSSVariables(e){const t={},n={};function r(i,o,a=""){for(const[c,l]of Object.entries(i)){const u=a?`${a}-${c}`:c;l&&typeof l=="object"&&Object.keys(l).length?(o[c]={},r(l,o[c],u)):typeof l=="string"&&(o[c]=`${gae}-${u}`)}}function s(i,o){for(const[a,c]of Object.entries(i))c&&typeof c=="object"?(o[a]={},s(c,o[a])):typeof c=="string"&&(o[a]=`var(${c})`)}return r(e,t),s(t,n),{cssVariables:t,cssVariablesVarPrefix:n}},assignCSSVariables(e,t){const n={};function r(s,i,o){for(const[a,c]of Object.entries(s)){const l=o?`${o}-${a}`:a,u=i[a];c&&typeof c=="object"?r(c,u,l):typeof u=="string"&&(n[`${gae}-${l}`]=u)}}return r(e,t),n},createRootStyles(e,t){const n={...yz,tokens:{...yz.tokens,theme:e==="light"?k_.light:k_.dark}},{cssVariables:r}=Cp.createCSSVariables(n),s=Cp.assignCSSVariables(r,n),i=Cp.generateW3MVariables(t),o=Cp.generateW3MOverrides(t),a=Cp.generateScaledVariables(t),c=Cp.generateBaseVariables(s),l={...s,...c,...i,...o,...a},u=Cp.applyColorMixToVariables(t,l),d={...l,...u};return`:root {${Object.entries(d).map(([f,g])=>`${f}:${g.replace("/[:;{}</>]/g","")};`).join("")}}`},generateW3MVariables(e){if(!e)return{};const t=YI(e),n={};return n["--w3m-font-family"]=t["font-family"],n["--w3m-accent"]=t.accent,n["--w3m-color-mix"]=t["color-mix"],n["--w3m-color-mix-strength"]=`${t["color-mix-strength"]}%`,n["--w3m-font-size-master"]=t["font-size-master"],n["--w3m-border-radius-master"]=t["border-radius-master"],n},generateW3MOverrides(e){if(!e)return{};const t=YI(e),n={};if(e["--apkt-accent"]||e["--w3m-accent"]){const r=t.accent;n["--apkt-tokens-core-iconAccentPrimary"]=r,n["--apkt-tokens-core-borderAccentPrimary"]=r,n["--apkt-tokens-core-textAccentPrimary"]=r,n["--apkt-tokens-core-backgroundAccentPrimary"]=r}return(e["--apkt-font-family"]||e["--w3m-font-family"])&&(n["--apkt-fontFamily-regular"]=t["font-family"]),t["z-index"]!==void 0&&(n["--apkt-tokens-core-zIndex"]=`${t["z-index"]}`),n},generateScaledVariables(e){if(!e)return{};const t=YI(e),n={};if(e["--apkt-font-size-master"]||e["--w3m-font-size-master"]){const r=parseFloat(t["font-size-master"].replace("px",""));n["--apkt-textSize-h1"]=`${Number(r)*5}px`,n["--apkt-textSize-h2"]=`${Number(r)*4.4}px`,n["--apkt-textSize-h3"]=`${Number(r)*3.8}px`,n["--apkt-textSize-h4"]=`${Number(r)*3.2}px`,n["--apkt-textSize-h5"]=`${Number(r)*2.6}px`,n["--apkt-textSize-h6"]=`${Number(r)*2}px`,n["--apkt-textSize-large"]=`${Number(r)*1.6}px`,n["--apkt-textSize-medium"]=`${Number(r)*1.4}px`,n["--apkt-textSize-small"]=`${Number(r)*1.2}px`}if(e["--apkt-border-radius-master"]||e["--w3m-border-radius-master"]){const r=parseFloat(t["border-radius-master"].replace("px",""));n["--apkt-borderRadius-1"]=`${Number(r)}px`,n["--apkt-borderRadius-2"]=`${Number(r)*2}px`,n["--apkt-borderRadius-3"]=`${Number(r)*3}px`,n["--apkt-borderRadius-4"]=`${Number(r)*4}px`,n["--apkt-borderRadius-5"]=`${Number(r)*5}px`,n["--apkt-borderRadius-6"]=`${Number(r)*6}px`,n["--apkt-borderRadius-8"]=`${Number(r)*8}px`,n["--apkt-borderRadius-16"]=`${Number(r)*16}px`,n["--apkt-borderRadius-20"]=`${Number(r)*20}px`,n["--apkt-borderRadius-32"]=`${Number(r)*32}px`,n["--apkt-borderRadius-64"]=`${Number(r)*64}px`,n["--apkt-borderRadius-128"]=`${Number(r)*128}px`}return n},generateColorMixCSS(e,t){if(!(e!=null&&e["--w3m-color-mix"])||!e["--w3m-color-mix-strength"])return"";const n=e["--w3m-color-mix"],r=e["--w3m-color-mix-strength"];if(!r||r===0)return"";const s=Object.keys(t||{}).filter(o=>{const a=o.includes("-tokens-core-background")||o.includes("-tokens-core-text")||o.includes("-tokens-core-border")||o.includes("-tokens-core-foreground")||o.includes("-tokens-core-icon")||o.includes("-tokens-theme-background")||o.includes("-tokens-theme-text")||o.includes("-tokens-theme-border")||o.includes("-tokens-theme-foreground")||o.includes("-tokens-theme-icon"),c=o.includes("-borderRadius-")||o.includes("-spacing-")||o.includes("-textSize-")||o.includes("-fontFamily-")||o.includes("-fontWeight-")||o.includes("-typography-")||o.includes("-duration-")||o.includes("-ease-")||o.includes("-path-")||o.includes("-width-")||o.includes("-height-")||o.includes("-visual-size-")||o.includes("-modal-width")||o.includes("-cover");return a&&!c});return s.length===0?"":` @supports (background: color-mix(in srgb, white 50%, black)) { 1099 :root { 1100 ${s.map(o=>{const a=(t==null?void 0:t[o])||"";return a.includes("color-mix")||a.startsWith("#")||a.startsWith("rgb")?`${o}: color-mix(in srgb, ${n} ${r}%, ${a});`:`${o}: color-mix(in srgb, ${n} ${r}%, var(${o}-base, ${a}));`}).join("")} 1101 } 1102 }`},generateBaseVariables(e){const t={},n=e["--apkt-tokens-theme-backgroundPrimary"];n&&(t["--apkt-tokens-theme-backgroundPrimary-base"]=n);const r=e["--apkt-tokens-core-backgroundAccentPrimary"];return r&&(t["--apkt-tokens-core-backgroundAccentPrimary-base"]=r),t},applyColorMixToVariables(e,t){const n={};t!=null&&t["--apkt-tokens-theme-backgroundPrimary"]&&(n["--apkt-tokens-theme-backgroundPrimary"]="var(--apkt-tokens-theme-backgroundPrimary-base)"),t!=null&&t["--apkt-tokens-core-backgroundAccentPrimary"]&&(n["--apkt-tokens-core-backgroundAccentPrimary"]="var(--apkt-tokens-core-backgroundAccentPrimary-base)");const r=YI(e),s=r["color-mix"],i=r["color-mix-strength"];if(!i||i===0)return n;const o=Object.keys(t||{}).filter(a=>{const c=a.includes("-tokens-core-background")||a.includes("-tokens-core-text")||a.includes("-tokens-core-border")||a.includes("-tokens-core-foreground")||a.includes("-tokens-core-icon")||a.includes("-tokens-theme-background")||a.includes("-tokens-theme-text")||a.includes("-tokens-theme-border")||a.includes("-tokens-theme-foreground")||a.includes("-tokens-theme-icon")||a.includes("-tokens-theme-overlay"),l=a.includes("-borderRadius-")||a.includes("-spacing-")||a.includes("-textSize-")||a.includes("-fontFamily-")||a.includes("-fontWeight-")||a.includes("-typography-")||a.includes("-duration-")||a.includes("-ease-")||a.includes("-path-")||a.includes("-width-")||a.includes("-height-")||a.includes("-visual-size-")||a.includes("-modal-width")||a.includes("-cover");return c&&!l});return o.length===0||o.forEach(a=>{const c=(t==null?void 0:t[a])||"";a.endsWith("-base")||(a==="--apkt-tokens-theme-backgroundPrimary"||a==="--apkt-tokens-core-backgroundAccentPrimary"?n[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base))`:c.includes("color-mix")||c.startsWith("#")||c.startsWith("rgb")?n[a]=`color-mix(in srgb, ${s} ${i}%, ${c})`:n[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base, ${c}))`)}),n}},{cssVariablesVarPrefix:gr}=Cp.createCSSVariables(yz);function Gt(e,...t){return Xe(e,...t.map(n=>Xr(typeof n=="function"?n(gr):n)))}let cv,gD,n5,r5,bz;const yp={"KHTeka-500-woff2":"https://fonts.reown.com/KHTeka-Medium.woff2","KHTeka-400-woff2":"https://fonts.reown.com/KHTeka-Regular.woff2","KHTeka-300-woff2":"https://fonts.reown.com/KHTeka-Light.woff2","KHTekaMono-400-woff2":"https://fonts.reown.com/KHTekaMono-Regular.woff2","KHTeka-500-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTeka-400-woff":"https://fonts.reown.com/KHTeka-Regular.woff","KHTeka-300-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTekaMono-400-woff":"https://fonts.reown.com/KHTekaMono-Regular.woff"};function vz(e,t="dark"){cv&&document.head.removeChild(cv),cv=document.createElement("style"),cv.textContent=Cp.createRootStyles(t,e),document.head.appendChild(cv)}function ENt(e,t="dark"){if(bz=e,gD=document.createElement("style"),n5=document.createElement("style"),r5=document.createElement("style"),gD.textContent=mD(e).core.cssText,n5.textContent=mD(e).dark.cssText,r5.textContent=mD(e).light.cssText,document.head.appendChild(gD),document.head.appendChild(n5),document.head.appendChild(r5),vz(e,t),mae(t),!((e==null?void 0:e["--apkt-font-family"])||(e==null?void 0:e["--w3m-font-family"]))
1102)for(const[r,s]of Object.entries(yp)){const i=document.createElement("link");i.rel="preload",i.href=s,i.as="font",i.type=r.includes("woff2")?"font/woff2":"font/woff",i.crossOrigin="anonymous",document.head.appendChild(i)}mae(t)}function mae(e="dark"){n5&&r5&&cv&&(e==="light"?(vz(bz,e),n5.removeAttribute("media"),r5.media="enabled"):(vz(bz,e),r5.removeAttribute("media"),n5.media="enabled"))}function mD(e){const t=!!(e!=null&&e["--apkt-font-family"]||e!=null&&e["--w3m-font-family"]);return{core:Xe` 1103 ${t?Xe``:Xe` 1104 @font-face { 1105 font-family: 'KHTeka'; 1106 src: 1107 url(${Xr(yp["KHTeka-400-woff2"])}) format('woff2'), 1108 url(${Xr(yp["KHTeka-400-woff"])}) format('woff'); 1109 font-weight: 400; 1110 font-style: normal; 1111 font-display: swap; 1112 } 1113 1114 @font-face { 1115 font-family: 'KHTeka'; 1116 src: 1117 url(${Xr(yp["KHTeka-300-woff2"])}) format('woff2'), 1118 url(${Xr(yp["KHTeka-300-woff"])}) format('woff'); 1119 font-weight: 300; 1120 font-style: normal; 1121 } 1122 1123 @font-face { 1124 font-family: 'KHTekaMono'; 1125 src: 1126 url(${Xr(yp["KHTekaMono-400-woff2"])}) format('woff2'), 1127 url(${Xr(yp["KHTekaMono-400-woff"])}) format('woff'); 1128 font-weight: 400; 1129 font-style: normal; 1130 } 1131 1132 @font-face { 1133 font-family: 'KHTeka'; 1134 src: 1135 url(${Xr(yp["KHTeka-400-woff2"])}) format('woff2'), 1136 url(${Xr(yp["KHTeka-400-woff"])}) format('woff'); 1137 font-weight: 400; 1138 font-style: normal; 1139 } 1140 `} 1141 1142 @keyframes w3m-shake { 1143 0% { 1144 transform: scale(1) rotate(0deg); 1145 } 1146 20% { 1147 transform: scale(1) rotate(-1deg); 1148 } 1149 40% { 1150 transform: scale(1) rotate(1.5deg); 1151 } 1152 60% { 1153 transform: scale(1) rotate(-1.5deg); 1154 } 1155 80% { 1156 transform: scale(1) rotate(1deg); 1157 } 1158 100% { 1159 transform: scale(1) rotate(0deg); 1160 } 1161 } 1162 @keyframes w3m-iframe-fade-out { 1163 0% { 1164 opacity: 1; 1165 } 1166 100% { 1167 opacity: 0; 1168 } 1169 } 1170 @keyframes w3m-iframe-zoom-in { 1171 0% { 1172 transform: translateY(50px); 1173 opacity: 0; 1174 } 1175 100% { 1176 transform: translateY(0px); 1177 opacity: 1; 1178 } 1179 } 1180 @keyframes w3m-iframe-zoom-in-mobile { 1181 0% { 1182 transform: scale(0.95); 1183 opacity: 0; 1184 } 1185 100% { 1186 transform: scale(1); 1187 opacity: 1; 1188 } 1189 } 1190 :root { 1191 --apkt-modal-width: 370px; 1192 1193 --apkt-visual-size-inherit: inherit; 1194 --apkt-visual-size-sm: 40px; 1195 --apkt-visual-size-md: 55px; 1196 --apkt-visual-size-lg: 80px; 1197 1198 --apkt-path-network-sm: path( 1199 'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z' 1200 ); 1201 1202 --apkt-path-network-md: path( 1203 'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z' 1204 ); 1205 1206 --apkt-path-network-lg: path( 1207 'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z' 1208 ); 1209 1210 --apkt-width-network-sm: 36px; 1211 --apkt-width-network-md: 48px; 1212 --apkt-width-network-lg: 86px; 1213 1214 --apkt-duration-dynamic: 0ms; 1215 --apkt-height-network-sm: 40px; 1216 --apkt-height-network-md: 54px; 1217 --apkt-height-network-lg: 96px; 1218 } 1219 `,dark:Xe` 1220 :root { 1221 } 1222 `,light:Xe` 1223 :root { 1224 } 1225 `}}const ar=Xe` 1226 div, 1227 span, 1228 iframe, 1229 a, 1230 img, 1231 form, 1232 button, 1233 label, 1234 *::after, 1235 *::before { 1236 margin: 0; 1237 padding: 0; 1238 box-sizing: border-box; 1239 font-style: normal; 1240 text-rendering: optimizeSpeed; 1241 -webkit-font-smoothing: antialiased; 1242 -moz-osx-font-smoothing: grayscale; 1243 -webkit-tap-highlight-color: transparent; 1244 backface-visibility: hidden; 1245 } 1246 1247 :host { 1248 font-family: var(--apkt-fontFamily-regular); 1249 } 1250`,ba=Xe` 1251 button, 1252 a { 1253 cursor: pointer; 1254 display: flex; 1255 justify-content: center;
1256 align-items: center; 1257 position: relative; 1258 1259 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 1260 outline: none; 1261 border: none; 1262 text-decoration: none; 1263 transition: 1264 background-color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1265 color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1266 border var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1267 box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1268 width var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1269 height var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1270 transform var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1271 opacity var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1272 scale var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 1273 border-radius var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2); 1274 will-change: 1275 background-color, color, border, box-shadow, width, height, transform, opacity, scale, 1276 border-radius; 1277 } 1278 1279 a:active:not([disabled]), 1280 button:active:not([disabled]) { 1281 scale: 0.975; 1282 transform-origin: center; 1283 } 1284 1285 button:disabled { 1286 cursor: default; 1287 } 1288 1289 input { 1290 border: none; 1291 outline: none; 1292 appearance: none; 1293 } 1294`,JI=".",Xs={getSpacingStyles(e,t){if(Array.isArray(e))return e[t]?`var(--apkt-spacing-${e[t]})`:void 0;if(typeof e=="string")return`var(--apkt-spacing-${e})`},getFormattedDate(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e)},formatCurrency(e=0,t={}){const n=Number(e);return isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2,...t}).format(n)},getHostName(e){try{return new URL(e).hostname}catch{return""}},getTruncateString({string:e,charsStart:t,charsEnd:n,truncate:r}){return e.length<=t+n?e:r==="end"?`${e.substring(0,t)}...`:r==="start"?`...${e.substring(e.length-n)}`:`${e.substring(0,Math.floor(t))}...${e.substring(e.length-Math.floor(n))}`},generateAvatarColors(e){const n=e.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),r=this.hexToRgb(n),s=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),o=100-3*Number(s==null?void 0:s.replace("px","")),a=`${o}% ${o}% at 65% 40%`,c=[];for(let l=0;l<5;l+=1){const u=this.tintColor(r,.15*l);c.push(`rgb(${u[0]}, ${u[1]}, ${u[2]})`)}return` 1295 --local-color-1: ${c[0]}; 1296 --local-color-2: ${c[1]}; 1297 --local-color-3: ${c[2]}; 1298 --local-color-4: ${c[3]}; 1299 --local-color-5: ${c[4]}; 1300 --local-radial-circle: ${a} 1301 `},hexToRgb(e){const t=parseInt(e,16),n=t>>16&255,r=t>>8&255,s=t&255;return[n,r,s]},tintColor(e,t){const[n,r,s]=e,i=Math.round(n+(255-n)*t),o=Math.round(r+(255-r)*t),a=Math.round(s+(255-s)*t);return[i,o,a]},isNumber(e){return{number:/^[0-9]+$/u}.number.test(e)},getColorTheme(e){var t;return e||(typeof window<"u"&&window.matchMedia&&typeof window.matchMedia=="function"?(t=window.matchMedia("(prefers-color-scheme: dark)"))!=null&&t.matches?"dark":"light":"dark")},splitBalance(e){const t=e.split(".");return t.length===2?[t[0],t[1]]:["0","00"]},roundNumber(e,t,n){return e.toString().length>=t?Number(e).toFixed(n):e},cssDurationToNumber(e){return e.endsWith("s")?Number(e.replace("s",""))*1e3:e.endsWith("ms")?Number(e.replace("ms","")):0},maskInput({value:e,decimals:t,integers:n}){if(e=e.replace(",","."),e===JI)return`0${JI}`;const[r="",s]=e.split(JI).map(u=>u.replace(/[^0-9]/gu,"")),i=n?r.substring(0,n):r,o=i.length===2?String(Number(i)):i,a=typeof t=="number"?s==null?void 0:s.substring(0,t):s,c=typeof t!="number"||t>0;return(typeof a=="string"&&c?[o,a].join(JI):o)??""},capitalize(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}};function CNt(e,t){const{kind:n,elements:r}=t;return{kind:n,elements:r,finisher(s){customElements.get(e)||customElements.define(e,s)}}}function $Nt(e,t){return customElements.get(e)||customElements.define(e,t),t}function pt(e){return function(n){return typeof n=="function"?$Nt(e,n):CNt(e,n)}}const xNt=Xe` 1302 :host { 1303 display: flex; 1304 width: inherit; 1305 height: inherit; 1306 box-sizing: border-box; 1307 } 1308`;var Ac=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let _o=class extends ce{render(){return this.style.cssText=` 1309 flex-direction: ${this.flexDirection}; 1310 flex-wrap: ${this.flexWrap}; 1311 flex-basis: ${this.flexBasis}; 1312 flex-grow: ${this.flexGrow}; 1313 flex-shrink: ${this.flexShrink}; 1314 align-items: ${this.alignItems}; 1315 justify-content: ${this.justifyContent}; 1316 column-gap: ${this.columnGap&&`var(--apkt-spacing-${this.columnGap})`}; 1317 row-gap: ${this.rowGap&&`var(--apkt-spacing-${this.rowGap})`}; 1318 gap: ${this.gap&&`var(--apkt-spacing-${this.gap})`}; 1319 padding-top: ${this.padding&&Xs.getSpacingStyles(this.padding,0)}; 1320 padding-right: ${this.padding&&Xs.getSpacingStyles(this.padding,1)}; 1321 padding-bottom: ${this.padding&&Xs.getSpacingStyles(this.padding,2)}; 1322 padding-left: ${this.padding&&Xs.getSpacingStyles(this.padding,3)}; 1323 margin-top: ${this.margin&&Xs.getSpacingStyles(this.margin,
13230)}; 1324 margin-right: ${this.margin&&Xs.getSpacingStyles(this.margin,1)}; 1325 margin-bottom: ${this.margin&&Xs.getSpacingStyles(this.margin,2)}; 1326 margin-left: ${this.margin&&Xs.getSpacingStyles(this.margin,3)}; 1327 width: ${this.width}; 1328 `,j`<slot></slot>`}};_o.styles=[ar,xNt];Ac([z()],_o.prototype,"flexDirection",void 0);Ac([z()],_o.prototype,"flexWrap",void 0);Ac([z()],_o.prototype,"flexBasis",void 0);Ac([z()],_o.prototype,"flexGrow",void 0);Ac([z()],_o.prototype,"flexShrink",void 0);Ac([z()],_o.prototype,"alignItems",void 0);Ac([z()],_o.prototype,"justifyContent",void 0);Ac([z()],_o.prototype,"columnGap",void 0);Ac([z()],_o.prototype,"rowGap",void 0);Ac([z()],_o.prototype,"gap",void 0);Ac([z()],_o.prototype,"padding",void 0);Ac([z()],_o.prototype,"margin",void 0);Ac([z()],_o.prototype,"width",void 0);_o=Ac([pt("wui-flex")],_o);const ge=e=>e??ms;const TEe=Symbol.for(""),INt=e=>{if((e==null?void 0:e.r)===TEe)return e==null?void 0:e._$litStatic$},PEe=e=>({_$litStatic$:e,r:TEe}),wae=new Map,SNt=e=>(t,...n)=>{const r=n.length;let s,i;const o=[],a=[];let c,l=0,u=!1;for(;l<r;){for(c=t[l];l<r&&(i=n[l],(s=INt(i))!==void 0);)c+=s+t[++l],u=!0;l!==r&&a.push(i),o.push(c),l++}if(l===r&&o.push(t[r]),u){const d=o.join("$$lit$$");(t=wae.get(d))===void 0&&(o.raw=o,wae.set(d,t=o)),n=a}return e(t,...n)},R_=SNt(j),ANt=ae`<svg width="30" height="30" viewBox="0 0 30 30" fill="none"> 1329 <g clip-path="url(#clip0_87_33)"> 1330 <path d="M23.9367 2.29447e-07H6.05917C5.26333 -0.000218805 4.47526 0.156384 3.73997 0.46086C3.00469 0.765337 2.33661 1.21172 1.77391 1.7745C1.21121 2.33727 0.7649
133017 3.00542 0.460542 3.74074C0.156167 4.47607 -0.000327963 5.26417 5.16031e-07 6.06V23.9433C4.48257e-07 24.7389 0.156744 25.5267 0.461276 26.2617C0.765808 26.9967 1.21216 27.6645 1.77484 28.2269C2.33752 28.7894 3.0055 29.2355 3.74061 29.5397C4.47573 29.8439 5.26358 30.0003 6.05917 30H23.9417C25.5486 29.9996 27.0895 29.3609 28.2257 28.2245C29.3618 27.0881 30 25.5469 30 23.94V6.06C29.9993 4.45241 29.3602 2.91091 28.2232 1.77449C27.0861 0.638064 25.5443 -0.000220881 23.9367 2.29447e-07Z" fill="url(#paint0_linear_87_33)"/> 1331 <path d="M14.8708 6.89259L15.4783 5.84259C15.5679 5.68703 15.6873 5.55064 15.8296 5.44122C15.9719 5.3318 16.1344 5.25148 16.3078 5.20486C16.4812 5.15824 16.662 5.14622 16.8401 5.1695C17.0181 5.19277 17.1898 5.25088 17.3453 5.34051C17.5009 5.43013 17.6373 5.54952 17.7467 5.69186C17.8561 5.83419 17.9364 5.99669 17.9831 6.17006C18.0297 6.34344 18.0417 6.5243 18.0184 6.70232C17.9952 6.88034 17.9371 7.05203 17.8474 7.20759L11.9949 17.3401H16.2283C17.5999 17.3401 18.3691 18.9526 17.7724 20.0701H5.36159C5.18215 20.0707 5.00436 20.0359 4.83845 19.9675C4.67254 19.8992 4.5218 19.7986 4.39492 19.6718C4.26803 19.5449 4.16751 19.3941 4.09915 19.2282C4.03079 19.0623 3.99593 18.8845 3.99659 18.7051C3.99659 17.9476 4.60492 17.3401 5.36159 17.3401H8.84159L13.2958 9.61926L11.9041 7.20426C11.738 6.89096 11.7 6.52543 11.7982 6.18469C11.8963 5.84395 12.1229 5.5546 12.4301 5.37763C12.7374 5.20065 13.1014 5.14987 13.4454 5.23599C13.7893 5.3221 14.0864 5.53838 14.2741 5.83926L14.8708 6.89259ZM9.60659 21.4759L8.29409 23.7526C8.20446 23.9082 8.08506 24.0446 7.94271 24.1541C7.80035 24.2636 7.63783 24.344 7.46441 24.3906C7.291 24.4373 7.11009 24.4493 6.93202 24.4261C6.75395 24.4028 6.58221 24.3447 6.42659 24.2551C6.27097 24.1655 6.13454 24.0461 6.02506 23.9037C5.91559 23.7613 5.83523 23.5988 5.78857 23.4254C5.74191 23.252 5.72986 23.0711 5.75311 22.893C5.77637 22.715 5.83446 22.5432 5.92409 22.3876L6.89909 20.7001C8.00159 20.3584 8.89742 20.6209 9.60659 21.4759ZM20.9066 17.3476H24.4583C25.2158 17.3476 25.8233 17.9551 25.8233 18.7126C25.8233 19.4701 25.2149 20.0776 24.4583 20.0776H22.4858L23.8166 22.3876C24.1916 23.0443 23.9708 23.8726 23.3149 24.2551C23.0006 24.4359 22.6274 24.4845 22.2772 24.3903C21.927 24.2961 21.6286 24.0667 21.4474 23.7526C19.2058 19.8643 17.5216 16.9534 16.4041 15.0151C15.2608 13.0426 16.0783 11.0626 16.8841 10.3909C17.7799 11.9293 19.1191 14.2501 20.9074 17.3476H20.9066Z" fill="white"/> 1332 </g> 1333 <defs> 1334 <linearGradient id="paint0_linear_87_33" x1="15" y1="2.29447e-07" x2="15" y2="30" gradientUnits="userSpaceOnUse"> 1335 <stop stop-color="#18BFFB"/> 1336 <stop offset="1" stop-color="#2072F3"/> 1337 </linearGradient> 1338 <clipPath id="clip0_87_33"> 1339 <rect width="30" height="30" fill="white"/> 1340 </clipPath> 1341 </defs> 1342</svg>`,_Nt=ae`<svg fill="none" viewBox="0 0 40 40"> 1343 <g clip-path="url(#a)"> 1344 <g clip-path="url(#b)"> 1345 <circle cx="20" cy="19.89" r="20" fill="#000" /> 1346 <g clip-path="url(#c)"> 1347 <path 1348 fill="#fff" 1349 d="M28.77 23.3c-.69 1.99-2.75 5.52-4.87 5.56-1.4.03-1.86-.84-3.46-.84-1.61 0-2.12.81-3.45.86-2.25.1-5.72-5.1-5.72-9.62 0-4.15 2.9-6.2 5.42-6.25 1.36-.02 2.64.92 3.47.92.83 0 2.38-1.13 4.02-.97.68.03 2.6.28 3.84 2.08-3.27 2.14-2.76 6.61.75 8.25ZM24.2 7.88c-2.47.1-4.49 2.69-4.2 4.84 2.28.17 4.47-2.39 4.2-4.84Z" 1350 /> 1351 </g> 1352 </g> 1353 </g> 1354 <defs> 1355 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 1356 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 1357 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 1358 </defs> 1359</svg>`,NNt=ae` 1360 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 8 11"> 1361 <path 1362 fill="var(--apkt-tokens-theme-textPrimary)" 1363 d="M7.862 4.86c.159-1.064-.652-1.637-1.76-2.018l.36-1.443-.879-.218-.35 1.404c-.23-.058-.468-.112-.703-.166l.352-1.413-.877-.219-.36 1.442a29.02 29.02 0 0 1-.56-.132v-.005l-1.21-.302-.234.938s.652.15.638.158c.356.089.42.324.41.51l-.41 1.644a.715.715 0 0 1 .09.03l-.092-.024-.574 2.302c-.044.108-.154.27-.402.208.008.013-.639-.16-.639-.16L.227 8.403l1.142.285c.213.053.42.109.626.161l-.363 1.459.877.218.36-1.443c.239.065.472.125.7.
1363182l-.36 1.436.879.219.363-1.456c1.497.283 2.623.17 3.097-1.185.381-1.09-.02-1.719-.807-2.129.574-.132 1.006-.51 1.12-1.289ZM5.856 7.673c-.272 1.09-2.107.5-2.702.353l.482-1.933c.595.149 2.503.443 2.22 1.58Zm.271-2.829c-.247.992-1.775.488-2.27.365l.436-1.753c.496.124 2.092.354 1.834 1.388Z" 1364 /> 1365 </svg> 1366`,TNt=ae`<svg viewBox="0 0 32 32" fill="none"> 1367<path d="M29.0612 10.0613L13.0612 26.0613C12.9218 26.2011 12.7563 26.3121 12.5739 26.3878C12.3916 26.4635 12.1961 26.5024 11.9987 26.5024C11.8013 26.5024 11.6058 26.4635 11.4235 26.3878C11.2411 26.3121 11.0756 26.2011 10.9362 26.0613L3.9362 19.0613C3.79667 18.9217 3.68599 18.7561 3.61047 18.5738C3.53496 18.3915 3.49609 18.1961 3.49609 17.9988C3.49609 17.8014 3.53496 17.606 3.61047 17.4237C3.68599 17.2414 3.79667 17.0758 3.9362 16.9363C4.07573 16.7967 4.24137 16.686 4.42367 16.6105C4.60598 16.535 4.80137 16.4962 4.9987 16.4962C5.19602 16.4962 5.39141 16.535 5.57372 16.6105C5.75602 16.686 5.92167 16.7967 6.0612 16.9363L11.9999 22.875L26.9387 7.93876C27.2205 7.65697 27.6027 7.49866 28.0012 7.49866C28.3997 7.49866 28.7819 7.65697 29.0637 7.93876C29.3455 8.22055 29.5038 8.60274 29.5038 9.00126C29.5038 9.39977 29.3455 9.78197 29.0637 10.0638L29.0612 10.0613Z" fill="currentColor"/> 1368</svg> 1369`,PNt=ae`<svg width="30" height="30" viewBox="0 0 30 30" fill="none"> 1370<path d="M14.9978 7.80003H27.4668C26.2032 5.61107 24.3857 3.79333 22.1968 2.52955C20.008 1.26577 17.525 0.600485 14.9975 0.600586C12.47 0.600687 9.98712 1.26617 7.79838 2.53012C5.60964 3.79408 3.79221 5.61197 2.52881 7.80103L8.76281 18.599L8.76881 18.598C8.13412 17.5044 7.79906 16.2628 7.79743 14.9983C7.79579 13.7339 8.12764 12.4914 8.7595 11.3961C9.39136 10.3008 10.3009 9.39159 11.3963 8.76005C12.4918 8.12851 13.7344 7.79702 14.9988 7.79903L14.9978 7.80003Z" fill="url(#paint0_linear_87_32)"/> 1371<path d="M21.237 18.5981L15.003 29.3961C17.5305 29.3961 20.0134 28.7308 22.2022 27.467C24.391 26.2032 26.2086 24.3854 27.4721 22.1965C28.7356 20.0075 29.4006 17.5245 29.4003 14.997C29.3999 12.4695 28.7342 9.9867 27.47 7.7981H15.002L15 7.8041C16.2642 7.80168 17.5067 8.13257 18.6022 8.76342C19.6977 9.39428 20.6076 10.3028 21.2401 11.3974C21.8726 12.492 22.2053 13.734 22.2048 14.9982C22.2042 16.2623 21.8704 17.504 21.237 18.5981Z" fill="url(#paint1_linear_87_32)"/> 1372<path d="M8.76502 18.601L2.53102 7.80298C1.26664 9.99172 0.600848 12.4748 0.600586 15.0025C0.600324 17.5302 1.2656 20.0134 2.52953 22.2024C3.79345 24.3914 5.61145 26.209 7.80071 27.4725C9.98998 28.736 12.4733 29.4008 15.001 29.4L21.236 18.602L21.232 18.598C20.6022 19.6941 19.6944 20.6049 18.6003 21.2383C17.5062 21.8717 16.2644 22.2055 15.0002 22.2059C13.7359 22.2063 12.4939 21.8733 11.3994 21.2406C10.3049 20.6079 9.39657 19.6977 8.76602 18.602L8.76502 18.601Z" fill="url(#paint2_linear_87_32)"/> 1373<path d="M14.9998 22.2C16.9094 22.2 18.7407 21.4415 20.091 20.0912C21.4412 18.741 22.1998 16.9096 22.1998 15C22.1998 13.0905 21.4412 11.2591 20.091 9.90888C18.7407 8.55862 16.9094 7.80005 14.9998 7.80005C13.0902 7.80005 11.2589 8.55862 9.90864 9.90888C8.55837 11.2591 7.7998 13.0905 7.7998 15C7.7998 16.9096 8.55837 18.741 9.90864 20.0912C11.2589 21.4415 13.0902 22.2 14.9998 22.2Z" fill="white"/> 1374<path d="M14.9998 20.7C16.5115 20.7 17.9614 20.0995 19.0303 19.0306C20.0993 17.9616 20.6998 16.5118 20.6998 15C20.6998 13.4883 20.0993 12.0385 19.0303 10.9695C17.9614 9.90058 16.5115 9.30005 14.9998 9.30005C13.4881 9.30005 12.0383 9.90058 10.9693 10.9695C9.90034 12.0385 9.2998 13.4883 9.2998 15C9.2998 16.5118 9.90034 17.9616 10.9693 19.0306C12.0383 20.0995 13.4881 20.7 14.9998 20.7Z" fill="#1A73E8"/> 1375<defs> 1376 <linearGradient id="paint0_linear_87_32" x1="3.29381" y1="2.99503" x2="38.0998" y2="2.99503" gradientUnits="userSpaceOnUse"> 1377 <stop stop-color="#D93025"/> 1378 <stop offset="1" stop-color="#EA4335"/> 1379 </linearGradient> 1380 <linearGradient id="paint1_linear_87_32" x1="17.953" y1="29.1431" x2="34.194" y2="-0.298904" gradientUnits="userSpaceOnUse"> 1381 <stop stop-color="#FCC934"/> 1382 <stop offset="1" stop-color="#FBBC04"/> 1383 </linearGradient> 1384 <linearGradient id="paint2_linear_87_32" x1="22.873" y1="28.2" x2="6.63202" y2="-1.24102" gradientUnits="userSpaceOnUse"> 1385 <stop stop-color="#1E8E3E"/> 1386 <stop offset="1" stop-color="#34A853"/> 1387 </linearGradient> 1388</defs> 1389</svg>`,ONt=ae`<svg width="32" height="32" viewBox="0 0 32 32" fill="none"> 1390<path d="M23 11.1962V10.5C23 7.365 18.2712 5 12 5C5.72875 5 1 7.365 1 10.5V15.5C1 18.1112 4.28125 20.1863 9 20.8075V21.5C9 24.635 13.7288 27 20 27C26.2712 27 31 24.635 31 21.5V16.5C31 13.9125 27.8225 11.835 23 11.1962ZM7 18.3587C4.55125 17.675 3 16.5487 3 15.5V13.7413C4.02 14.4637 5.38625 15.0463 7 15.4375V18.3587ZM17 15.4375C18.6138 15.0463 19.98 14.4637 21 13.7413V15.5C21 16.5487 19.4487 17.675 17 18.3587V15.4375ZM15 24.3587C12.5513 23.675 11 22.5487 11 21.5V20.9788C11.3287 20.9913 11.6613 21 12 21C12.485 21 12.9587 20.9837 13.4237 20.9562C13.9403 21.1412 14.4665 21.2981 15 21.4263V24.3587ZM15 18.7812C14.0068 18.928 13.004 19.0011 12 19C10.996 19.0011 9.99324 18.928 9 18.7812V15.8075C9.99472 15.9371 10.9969 16.0014 12 16C13.0031 16.0014 14.0053 15.9371 15 15.8075V18.7812ZM23 24.7812C21.0106 25.0729 18.9894 25.0729 17 24.7812V21.8C17.9944 21.9337 18.9967 22.0005 20 22C21.0031 22.0014 22.0053 21.9371 23 21.8075V24.7812ZM29 21.5C29 22.5487 27.4487 23.675 25 24.3587V21.4375C26.6138 21.0462 27.98 20.4637 29 19.7412V21.5Z" fill="currentColor"/> 1391</svg> 1392`,kNt=ae` <svg fill="none" viewBox="0 0 13 4">
1393 <path fill="currentColor" d="M.5 0h12L8.9 3.13a3.76 3.76 0 0 1-4.8 0L.5 0Z" /> 1394</svg>`,RNt=ae`<svg fill="none" viewBox="0 0 40 40"> 1395 <g clip-path="url(#a)"> 1396 <g clip-path="url(#b)"> 1397 <circle cx="20" cy="19.89" r="20" fill="#5865F2" /> 1398 <path 1399 fill="#fff" 1400 fill-rule="evenodd" 1401 d="M25.71 28.15C30.25 28 32 25.02 32 25.02c0-6.61-2.96-11.98-2.96-11.98-2.96-2.22-5.77-2.15-5.77-2.15l-.29.32c3.5 1.07 5.12 2.61 5.12 2.61a16.75 16.75 0 0 0-10.34-1.93l-.35.04a15.43 15.43 0 0 0-5.88 1.9s1.71-1.63 5.4-2.7l-.2-.24s-2.81-.07-5.77 2.15c0 0-2.96 5.37-2.96 11.98 0 0 1.73 2.98 6.27 3.13l1.37-1.7c-2.6-.79-3.6-2.43-3.6-2.43l.58.35.09.06.08.04.02.01.08.05a17.25 17.25 0 0 0 4.52 1.58 14.4 14.4 0 0 0 8.3-.86c.72-.27 1.52-.66 2.37-1.21 0 0-1.03 1.68-3.72 2.44.61.78 1.35 1.67 1.35 1.67Zm-9.55-9.6c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28.01-1.25-.93-2.28-2.1-2.28Zm7.5 0c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28 0-1.25-.93-2.28-2.1-2.28Z" 1402 clip-rule="evenodd" 1403 /> 1404 </g> 1405 </g> 1406 <defs> 1407 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 1408 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 1409 </defs> 1410</svg>`,BNt=ae`<svg 1411 xmlns="http://www.w3.org/2000/svg" 1412 fill="none" 1413 viewBox="0 0 9 12" 1414> 1415 <path 1416 fill="var(--apkt-tokens-theme-textPrimary)" 1417 d="M4.666.001v4.435l3.748 1.675L4.666.001Zm0 0L.917 6.111l3.749-1.675V.001Zm0 8.984V12l3.75-5.19-3.75 2.176Zm0 3.014V8.985L.917 6.81 4.666 12Zm0-3.712 3.748-2.176-3.748-1.675v3.851Z" 1418 /> 1419 <path fill="var(--apkt-tokens-theme-textPrimary)" d="m.917 6.111 3.749 2.176v-3.85L.917 6.11Z" /> 1420</svg>`,DNt=ae`<svg fill="none" viewBox="0 0 16 16"> 1421 <path 1422 fill="currentColor" 1423 d="M4.25 7a.63.63 0 0 0-.63.63v3.97c0 .28-.2.51-.47.54l-.75.07a.93.93 0 0 1-.9-.47A7.51 7.51 0 0 1 5.54.92a7.5 7.5 0 0 1 9.54 4.62c.12.35.06.72-.16 1-.74.97-1.68 1.78-2.6 2.44V4.44a.64.64 0 0 0-.63-.64h-1.06c-.35 0-.63.3-.63.64v5.5c0 .23-.12.42-.32.5l-.52.23V6.05c0-.36-.3-.64-.64-.64H7.45c-.35 0-.64.3-.64.64v4.97c0 .25-.17.46-.4.52a5.8 5.8 0 0 0-.45.11v-4c0-.36-.3-.65-.64-.65H4.25ZM14.07 12.4A7.49 7.49 0 0 1 3.6 14.08c4.09-.58 9.14-2.5 11.87-6.6v.03a7.56 7.56 0 0 1-1.41 4.91Z" 1424 /> 1425</svg>`,UNt=ae`<svg fill="none" viewBox="0 0 40 40"> 1426 <g clip-path="url(#a)"> 1427 <g clip-path="url(#b)"> 1428 <circle cx="20" cy="19.89" r="20" fill="#1877F2" /> 1429 <g clip-path="url(#c)"> 1430 <path 1431 fill="#fff" 1432 d="M26 12.38h-2.89c-.92 0-1.61.38-1.61 1.34v1.66H26l-.36 4.5H2
14321.5v12H17v-12h-3v-4.5h3V12.5c0-3.03 1.6-4.62 5.2-4.62H26v4.5Z" 1433 /> 1434 </g> 1435 </g> 1436 <path 1437 fill="#1877F2" 1438 d="M40 20a20 20 0 1 0-23.13 19.76V25.78H11.8V20h5.07v-4.4c0-5.02 3-7.79 7.56-7.79 2.19 0 4.48.4 4.48.4v4.91h-2.53c-2.48 0-3.25 1.55-3.25 3.13V20h5.54l-.88 5.78h-4.66v13.98A20 20 0 0 0 40 20Z" 1439 /> 1440 <path 1441 fill="#fff" 1442 d="m27.79 25.78.88-5.78h-5.55v-3.75c0-1.58.78-3.13 3.26-3.13h2.53V8.2s-2.3-.39-4.48-.39c-4.57 0-7.55 2.77-7.55 7.78V20H11.8v5.78h5.07v13.98a20.15 20.15 0 0 0 6.25 0V25.78h4.67Z" 1443 /> 1444 </g> 1445 <defs> 1446 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 1447 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 1448 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 1449 </defs> 1450</svg>`,LNt=ae`<svg style="border-radius: 9999px; overflow: hidden;" fill="none" viewBox="0 0 1000 1000"> 1451 <rect width="1000" height="1000" rx="9999" ry="9999" fill="#855DCD"/> 1452 <path fill="#855DCD" d="M0 0h1000v1000H0V0Z" /> 1453 <path 1454 fill="#fff" 1455 d="M320 248h354v504h-51.96V521.13h-.5c-5.76-63.8-59.31-113.81-124.54-113.81s-118.78 50-124.53 113.81h-.5V752H320V248Z" 1456 /> 1457 <path 1458 fill="#fff" 1459 d="m225 320 21.16 71.46h17.9v289.09a16.29 16.29 0 0 0-16.28 16.24v19.49h-3.25a16.3 16.3 0 0 0-16.28 16.24V752h182.26v-19.48a16.22 16.22 0 0 0-16.28-16.24h-3.25v-19.5a16.22 16.22 0 0 0-16.28-16.23h-19.52V320H225Zm400.3 360.55a16.3 16.3 0 0 0-15.04 10.02 16.2 16.2 0 0 0-1.24 6.22v19.49h-3.25a16.29 16.29 0 0 0-16.27 16.24V752h182.24v-19.48a16.23 16.23 0 0 0-16.27-16.24h-3.25v-19.5a16.2 16.2 0 0 0-10.04-15 16.3 16.3 0 0 0-6.23-1.23v-289.1h17.9L775 320H644.82v360.55H625.3Z" 1460 /> 1461</svg>`,MNt=ae`<svg fill="none" viewBox="0 0 40 40"> 1462 <g clip-path="url(#a)"> 1463 <g clip-path="url(#b)"> 1464 <circle cx="20" cy="19.89" r="20" fill="#1B1F23" /> 1465 <g clip-path="url(#c)"> 1466 <path 1467 fill="#fff" 1468 d="M8 19.89a12 12 0 1 1 15.8 11.38c-.6.12-.8-.26-.8-.57v-3.3c0-1.12-.4-1.85-.82-2.22 2.67-.3 5.48-1.31 5.48-5.92 0-1.31-.47-2.38-1.24-3.22.13-.3.54-1.52-.12-3.18 0 0-1-.32-3.3 1.23a11.54 11.54 0 0 0-6 0c-2.3-1.55-3.3-1.23-3.3-1.23a4.32 4.32 0 0 0-.12 3.18 4.64 4.64 0 0 0-1.24 3.22c0 4.6 2.8 5.63 5.47 5.93-.34.3-.65.83-.76 1.6-.69.31-2.42.84-3.5-1 0 0-.63-1.15-1.83-1.23 0 0-1.18-.02-.09.73 0 0 .8.37 1.34 1.76 0 0 .7 2.14 4.03 1.41v2.24c0 .31-.2.68-.8.57A12 12 0 0 1 8 19.9Z" 1469 /> 1470 </g> 1471 </g> 1472 </g> 1473 <defs> 1474 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 1475 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 1476 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 1477 </defs> 1478</svg>`,jNt=ae`<svg fill="none" viewBox="0 0 40 40"> 1479 <path 1480 fill="#4285F4" 1481 d="M32.74 20.3c0-.93-.08-1.81-.24-2.66H20.26v5.03h7a6 6 0 0 1-2.62 3.91v3.28h4.22c2.46-2.27 3.88-5.6 3.88-9.56Z" 1482 /> 1483 <path 1484 fill="#34A853" 1485 d="M20.26 33a12.4 12.4 0 0 0 8.6-3.14l-4.22-3.28a7.74 7.74 0 0 1-4.38 1.26 7.76 7.76 0 0 1-7.28-5.36H8.65v3.36A12.99 12.99 0 0 0 20.26 33Z" 1486 /> 1487 <path 1488 fill="#FBBC05" 1489 d="M12.98 22.47a7.79 7.79 0 0 1 0-4.94v-3.36H8.65a12.84 12.84 0 0 0 0 11.66l3.37-2.63.96-.73Z" 1490 /> 1491 <path 1492 fill="#EA4335" 1493 d="M20.26 12.18a7.1 7.1 0 0 1 4.98 1.93l3.72-3.72A12.47 12.47 0 0 0 20.26 7c-5.08 0-9.47 2.92-11.6 7.17l4.32 3.36a7.76 7.76 0 0 1 7.28-5.35Z" 1494 /> 1495</svg>`,FNt=ae`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> 1496<path d="M4.875 0C3.91082 0 2.96829 0.285914 2.1666 0.821586C1.36491 1.35726 0.740067 2.11863 0.371089 3.00942C0.00211226 3.90021 -0.094429 4.88041 0.093674 5.82607C0.281777 6.77172 0.746076 7.64036 1.42786 8.32215C2.10964 9.00393 2.97828 9.46823 3.92394 9.65633C4.86959 9.84443 5.84979 9.74789 6.74058 9.37891C7.63137 9.00994 8.39274 8.38509 8.92842 7.5834C9.46409 6.78171 9.75 5.83918 9.75 4.875C9.74864 3.58249 9.23458 2.34331 8.32064 1.42936C7.4067 0.515418 6.16751 0.00136492 4.875 0ZM4.6875 2.25C4.79875 2.25 4.90751 2.28299 5.00001 2.3448C5.09251 2.40661 5.16461 2.49446 5.20718 2.59724C5.24976 2.70002 5.2609 2.81312 5.23919 2.92224C5.21749 3.03135 5.16392 3.13158 5.08525 3.21025C5.00658 3.28891 4.90635 3.34249 4.79724 3.36419C4.68813 3.3859 4.57503 3.37476 4.47224 3.33218C4.36946 3.28961 4.28161 3.21751 4.2198 3.12501C4.15799 3.03251 4.125 2.92375 4.125 2.8125C4.125 2.66332 4.18427 2.52024 4.28975 2.41475C4.39524 2.30926 4.53832 2.25 4.6875 2.25ZM5.25 7.5C5.05109 7.5 4.86032 7.42098 4.71967 7.28033C4.57902 7.13968 4.5 6.94891 4.5 6.75V4.875C4.40055 4.875 4.30516 4.83549 4.23484 4.76516C4.16451 4.69484 4.125 4.59946 4.125 4.5C4.125 4.40054 4.16451 4.30516 4.23484 4.23484C4.30516 4.16451 4.40055 4.125 4.5 4.125C4.69891 4.125 4.88968 4.20402 5.03033 4.34467C5.17098 4.48532 5.25 4.67609 5.25 4.875V6.75C5.34946 6.75 5.44484 6.78951 5.51517 6.85983C5.58549 6.93016 5.625 7.02554 5.625 7.125C5.625 7.22446 5.58549 7.31984 5.51517 7.39017C5.44484 7.46049 5.34946 7.5 5.25 7.5Z" fill="#9A9A9A"/> 1497</svg> 1498`,zNt=ae`<svg width="32" height="32" viewBox="0 0 32 32" fill="none"> 1499<path d="M28.925 5.5425C28.925 5.5425 28.925 5.555 28.925 5.56125L21.65 29.5537C21.5399 29.9434 21.3132 30.2901 21.0004 30.5473C20.6876 30.8045 20.3036 3
14990.9598 19.9 30.9925C19.8425 30.9975 19.785 31 19.7275 31C19.3493 31.0012 18.9786 30.8941 18.6592 30.6915C18.3398 30.4888 18.085 30.199 17.925 29.8563L13.375 20.5187C13.3295 20.4252 13.3143 20.3197 13.3315 20.2171C13.3488 20.1145 13.3976 20.0198 13.4713 19.9463L20.7113 12.7063C20.8909 12.5172 20.9895 12.2654 20.9862 12.0047C20.9829 11.7439 20.8778 11.4948 20.6934 11.3104C20.509 11.126 20.2599 11.0209 19.9991 11.0176C19.7383 11.0142 19.4866 11.1129 19.2975 11.2925L12.0538 18.5325C11.9802 18.6061 11.8855 18.655 11.7829 18.6722C11.6803 18.6895 11.5748 18.6743 11.4813 18.6287L2.13502 14.08C1.76954 13.9047 1.46598 13.6224 1.26454 13.2706C1.06311 12.9189 0.973316 12.5142 1.00707 12.1102C1.04082 11.7063 1.19652 11.3221 1.45354 11.0087C1.71056 10.6952 2.05676 10.4673 2.44627 10.355L26.4388 3.08H26.4575C26.7991 2.98403 27.1601 2.98066 27.5034 3.07025C27.8468 3.15984 28.1601 3.33916 28.4113 3.58981C28.6624 3.84045 28.8424 4.15341 28.9326 4.49656C29.0229 4.83971 29.0203 5.2007 28.925 5.5425Z" fill="currentColor"/> 1500</svg> 1501`,qNt=ae` <svg width="27" height="30" viewBox="0 0 27 30" fill="none"> 1502 <path d="M12.5395 14.3237L0.116699 27.5049V27.5188C0.251527 28.0177 0.49972 28.4788 0.841941 28.866C1.18416 29.2533 1.61117 29.5563 2.0897 29.7515C2.56823 29.9467 3.08536 30.0287 3.60081 29.9913C4.11625 29.9538 4.61609 29.7979 5.06139 29.5356L5.0975 29.512L19.0718 21.4519L12.5395 14.3237Z" fill="#EA4335"/> 1503 <path d="M25.103 12.0833L25.0919 12.0722L19.0611 8.57202L12.2607 14.6279L19.0847 21.4504L25.0919 17.9864C25.6229 17.6983 26.0665 17.2725 26.376 16.7537C26.6854 16.2349 26.8493 15.6422 26.8505 15.0381C26.8516 14.434 26.6899 13.8408 26.3824 13.3208C26.0749 12.8008 25.633 12.3734 25.103 12.0833Z" fill="#FBBC04"/> 1504 <path d="M0.116672 2.49553C0.047224 2.7761 0 3.05528 0 3.35946V26.6537C0 26.9565 0.0347234 27.237 0.116672 27.5162L12.959 14.6725L0.116672 2.49553Z" fill="#4285F4"/> 1505 <path d="M12.634 15.0001L19.0607 8.57198L5.0975 0.477133C4.65115 0.210463 4.14916 0.0506574 3.63079 0.0102139C3.11242 -0.0302296 2.59172 0.0497852 2.10941 0.244001C1.6271 0.438216 1.19625 0.741368 0.850556 1.12975C0.504864 1.51813 0.253698 1.98121 0.116699 2.48279L12.634 15.0001Z" fill="#34A853"/> 1506</svg>`,WNt=ae`<svg width="75" height="20" viewBox="0 0 75 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 1507<path d="M11.6666 5.83334C11.6666 2.61168 14.2783 0 17.5 0H25.8334C29.055 0 31.6666 2.61168 31.6666 5.83334V14.1666C31.6666 17.3883 29.055 20 25.8334 20H17.5C14.2783 20 11.6666 17.3883 11.6666 14.1666V5.83334Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 1508<path d="M19.5068 13.7499L22.4309 5.83331H23.2895L20.3654 13.7499H19.5068Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1509<path d="M0 5.41666C0 2.42513 2.42513 0 5.41666 0C8.40821 0 10.8334 2.42513 10.8334 5.41666V14.5833C10.8334 17.5748 8.40821 20 5.41666 20C2.42513 20 0 17.5748 0 14.5833V5.41666Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 1510<path d="M4.89581 12.4997V11.458H5.93747V12.4997H4.89581Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1511<path d="M32.5 10C32.5 4.47715 36.6896 0 41.8578 0H65.6422C70.8104 0 75 4.47715 75 10C75 15.5229 70.8104 20 65.6422 20H41.8578C36.6896 20 32.5 15.5229 32.5 10Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 1512<path d="M61.7108 12.4475V7.82751H62.5266V8.52418C62.8199 8.01084 63.4157 7.70834 64.0757 7.70834C65.0749 7.70834 65.7715 8.34084 65.7715 9.56918V12.4475H64.9649V9.61503C64.9649 8.80831 64.5066 8.38668 63.8374 8.38668C63.1132 8.38668 62.5266 8.9642 62.5266 9.78001V12.4475H61.7108Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1513<path d="M56.5671 12.4475L55.7147 7.82748H56.4846L57.0896 11.6409L57.8871 9.12916H58.6479L59.4363 11.6134L60.0505 7.82748H60.8204L59.9679 12.4475H59.0513L58.2721 10.0458L57.4838 12.4475H56.5671Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1514<path d="M52.9636 12.5666C51.5611 12.5666 50.7361 11.5217 50.7361 10.1375C50.7361 8.76254 51.5611 7.70834 52.9636 7.70834C54.3661 7.70834 55.1911 8.76254 55.1911 10.1375C55.1911 11.5217 54.3661 12.5666 52.9636 12.5666ZM52.9636 11.8883C53.9719 11.8883 54.357 11.0266 54.357 10.1283C54.357 9.23914 53.9719 8.38668 52.9636 8.38668C51.9552 8.38668 51.5702 9.23914 51.5702 10.1283C51.5702 11.0266 51.9552 11.8883 52.9636 11.8883Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1515<path d="M47.8507 12.5666C46.494 12.5666 45.6415 11.5308 45.6415 10.1375C45.6415 8.75337 46.494 7.70834 47.8507 7.70834C48.9965 7.70834 50.0048 8.35917 49.8948 10.3483H46.4756C46.5398 11.2009 46.934 11.8975 47.8507 11.8975C48.4648 11.8975 48.8681 11.5217 49.0057 11.0908H49.8123C49.684 11.8609 48.9598 12.5666 47.8507 12.5666ZM46.494 9.73416H49.1065C49.0423 8.80831 48.6114 8.37751 47.8507 8.37751C47.0165 8.37751 46.604 8.98254 46.494 9.73416Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1516<path d="M41.7284 12.4475V7.82748H42.5625V8.60665C42.8559 8.09332 43.3601 7.82748 43.8825 7.82748H44.9917V8.60665H43.8184C43.0851 8.60665 42.5625 9.08331 42.5625 10.0092V12.4475H41.7284Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1517</svg> 1518 1519`,HNt=ae` 1520 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 8"> 1521 <path 1522 fill="var(--apkt-tokens-theme-textPrimary)" 1523 d="m9.524 6.307-1.51 1.584A.35.35 0 0 1 7.76 8H.604a.178.178 0 0 1-.161-.103.168.168 0 0 1 .033-.186l1.51-1.583a.35.35 0 0 1 .256-.11h7.154c.034 0 .068.01.096.029a.168.168 0 0 1 .032.26Zm-1.51-3.189a.35.35 0 0 0-.255-.109H.604a.178.178 0 0 0-.161.103.168.168 0 0 0 .033.186l1.51 1.583a.35.35 0 0 0 .256.11h7.154a.178.178 0 0 0 .16-.104.168.168 0 0 0-.032-.185l-1.51-1.584ZM.605 1.981H7.76a.357.357 0 0 0 .256-.11L9.525.289a.17.17 0 0 0 .032-.185.173.173 0 0 0-.16-.103H2.241a.357.357 0 0 0-.256.109L.476 1.692a.17.17 0 0 0-.033.185.178.178 0 0 0 .16.103Z" 1524 /> 1525 </svg> 1526`,VNt=ae`<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"> 1527 <g clip-path="url(#a)"> 1528 <path fill="url(#b)" d="M0 0h32v32H0z"/> 1529 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.034 15.252c4.975-2.167 8.293-3.596 9.953-4.287 4.74-1.971 5.725-2.314 6.366-2.325.142-.002.457.033.662.198.172.14.22.33.243.463.022.132.05.435.028.671-.257 2.7-1.368 9.248-1.933 12.27-.24 1.28-.71 1.708-1.167 1.75-.99.091-1.743-.655-2.703-1.284-1.502-.985-2.351-1.598-3.81-2.558-1.684-1.11-.592-1.721.368-2.718.252-.261 4.619-4.233 4.703-4.594.01-.045.02-.213-.08-.301-.1-.09-.246-.059-.353-.035-.15.034-2.55 1.62-7.198 4.758-.682.468-1.298.696-1.851.684-.61-.013-1.782-.344-2.653-.628-1.069-.347-1.918-.53-1.845-1.12.039-.308.462-.623 1.27-.944Z" fill="#fff"/> 1530 </g> 1531 <path d="M.5 16C.5 7.44 7.44.5 16 .5 24.56.5 31.5 7.44 31.5 16c0 8.56-6.94 15.5-15.5 15.5C7.44 31.5.5 24.56.5 16Z" stroke="#141414" stroke-opacity=".05"/> 1532 <defs> 1533 <linearGradient id="b" x1="1600" y1="0" x2="1600" y2="3176.27" gradientUnits="userSpaceOnUse"> 1534 <stop stop-color="#2AABEE"/> 1535 <stop offset="1" stop-color="#229ED9"/> 1536 </linearGradient> 1537 <clipPath id="a"> 1538 <path d="M0 16C0 7.163 7.163 0 16 0s16 7.163 16 16-7.163 16-16 16S0 24.837 0 16Z" fill="#fff"/> 1539 </clipPath> 1540 </defs> 1541</svg>`,KNt=ae` 1542 <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewB
1542ox="0 0 10 10"> 1543 <path d="M8.37651 0H1.62309C0.381381 0 -0.405611 1.33944 0.219059 2.42225L4.38701 9.64649C4.659 10.1182 5.3406 10.1182 5.61259 9.64649L9.78139 2.42225C10.4052 1.34117 9.61822 0 8.37736 0H8.37651ZM4.38362 7.48005L3.47591 5.72329L1.2857 1.80606C1.14121 1.55534 1.31968 1.23405 1.62225 1.23405H4.38278V7.4809L4.38362 7.48005ZM8.71221 1.80521L6.52284 5.72414L5.61513 7.48005V1.2332H8.37566C8.67823 1.2332 8.85669 1.55449 8.71221 1.80521Z" fill="var(--apkt-tokens-theme-textPrimary)" /> 1544</svg> 1545`,GNt=ae` 1546 <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 64 64"> 1547 <path fill="var(--apkt-tokens-theme-textPrimary)" d="M61.55 19.28c-3-2.77-7.15-7-10.53-10l-.2-.14a3.82 3.82 0 0 0-1.11-.62l0 0C41.56 7 3.63-.09 2.89 0a1.4 1.4 0 0 0-.58.22L2.12.37a2.23 2.23 0 0 0-.52.84l-.05.13v.71l0 .11C5.82 14.05 22.68 53 26 62.14c.2.62.58 1.8 1.29 1.86h.16c.38 0 2-2.14 2-2.14S58.41 26.74 61.34 23a9.46 9.46 0 0 0 1-1.48A2.41 2.41 0 0 0 61.55 19.28ZM36.88 23.37 49.24 13.12l7.25 6.68Zm-4.8-.67L10.8 5.26l34.43 6.35ZM34 27.27l21.78-3.51-24.9 30ZM7.91 7 30.3 26 27.06 53.78Z"/> 1548 </svg> 1549`,ZNt=ae`<svg fill="none" viewBox="0 0 40 40"> 1550 <g clip-path="url(#a)"> 1551 <g clip-path="url(#b)"> 1552 <circle cx="20" cy="19.89" r="20" fill="#5A3E85" /> 1553 <g clip-path="url(#c)"> 1554 <path 1555 fill="#fff" 1556 d="M18.22 25.7 20 23.91h3.34l2.1-2.1v-6.68H15.4v8.78h2.82v1.77Zm3.87-8.16h1.25v3.66H22.1v-3.66Zm-3.34 0H20v3.66h-1.25v-3.66ZM20 7.9a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.69 14.56-3.66 3.66h-2.72l-1.77 1.78h-1.88V26.1H13.3v-9.82l.94-2.4H26.7v8.56Z" 1557 /> 1558 </g> 1559 </g> 1560 </g> 1561 <defs> 1562 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 1563 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 1564 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 1565 </defs> 1566</svg>`,YNt=ae`<svg fill="none" viewBox="0 0 16 16"> 1567 <path 1568 fill="currentColor" 1569 d="m14.36 4.74.01.42c0 4.34-3.3 9.34-9.34 9.34A9.3 9.3 0 0 1 0 13.03a6.6 6.6 0 0 0 4.86-1.36 3.29 3.29 0 0 1-3.07-2.28c.5.1 1 .07 1.48-.06A3.28 3.28 0 0 1 .64 6.11v-.04c.46.26.97.4 1.49.41A3.29 3.29 0 0 1 1.11 2.1a9.32 9.32 0 0 0 6.77 3.43 3.28 3.28 0 0 1 5.6-3 6.59 6.59 0 0 0 2.08-.8 3.3 3.3 0 0 1-1.45 1.82A6.53 6.53 0 0 0 16 3.04c-.44.66-1 1.23-1.64 1.7Z" 1570 /> 1571</svg>`,JNt=ae` 1572<svg xmlns="http://www.w3.org/2000/svg" width="89" height="89" viewBox="0 0 89 89" fill="none"> 1573<path d="M60.0468 39.2502L65.9116 33.3854C52.6562 20.13 36.1858 20.13 22.9304 33.3854L28.7952 39.2502C38.8764 29.169 49.9725 29.169 60.0536 39.2502H60.0468Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1574<path d="M58.0927 52.9146L44.415 39.2369L30.7373 52.9146L17.0596 39.2369L11.2017 45.0949L30.7373 64.6374L44.415 50.9597L58.0927 64.6374L77.6284 45.0949L71.7704 39.2369L58.0927 52.9146Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 1575</svg>`,XNt=ae` 1576<svg xmlns="http://www.w3.org/2000/svg" width="89" height="89" viewBox="0 0 89 89" fill="none"> 1577<path d="M60.0468 39.2502L65.9116 33.3854C52.6562 20.13 36.1858 20.13 22.9304 33.3854L28.7952 39.2502C38.8764 29.169 49.9725 29.169 60.0536 39.2502H60.0468Z" fill="var(--apkt-tokens-theme-textInvert)"/> 1578<path d="M58.0927 52.9146L44.415 39.2369L30.7373 52.9146L17.0596 39.2369L11.2017 45.0949L30.7373 64.6374L44.415 50.9597L58.0927 64.6374L77.6284 45.0949L71.7704 39.2369L58.0927 52.9146Z" fill="var(--apkt-tokens-theme-textInvert)"/> 1579</svg>`,QNt=ae` 1580<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 1581<g clip-path="url(#clip0_22274_4692)"> 1582<path d="M0 6.64C0 4.17295 0 2.93942 0.525474 2.01817C0.880399 1.39592 1.39592 0.880399 2.01817 0.525474C2.93942 0 4.17295 0 6.64 0H9.36C11.8271 0 13.0606 0 13.9818 0.525474C14.6041 0.880399 15.1196 1.39592 15.4745 2.01817C16 2.93942 16 4.17295 16 6.64V9.36C16 11.8271 16 13.0606 15.4745 13.9818C15.1196 14.6041 14.6041 15.1196 13.9818 15.4745C13.0606 16 11.8271 16 9.36 16H6.64C4.17295 16 2.93942 16 2.01817 15.4745C1.39592 15.1196 0.880399 14.6041 0.525474 13.9818C0 13.0606 0 11.8271 0 9.36V6.64Z" fill="#C7B994"/> 1583<path d="M4.49038 5.76609C6.42869 3.86833 9.5713 3.86833 11.5096 5.76609L11.7429 5.99449C11.8398 6.08938 11.8398 6.24323 11.7429 6.33811L10.9449 7.11942C10.8964 7.16686 10.8179 7.16686 10.7694 7.11942L10.4484 6.80512C9.09617 5.48119 6.90381 5.48119 5.5516 6.80512L5.20782 7.14171C5.15936 7.18915 5.08079 7.18915 5.03234 7.14171L4.23434 6.3604C4.13742 6.26552 4.13742 6.11167 4.23434 6.01678L4.49038 5.76609ZM13.1599 7.38192L13.8702 8.07729C13.9671 8.17217 13.9671 8.32602 13.8702 8.4209L10.6677 11.5564C10.5708 11.6513 10.4137 11.6513 10.3168 11.5564L8.04388 9.33105C8.01965 9.30733 7.98037 9.30733 7.95614 9.33105L5.6833 11.5564C5.58638 11.6513 5.42925 11.6513 5.33234 11.5564L2.12982 8.42087C2.0329 8.32598 2.0329 8.17213 2.12982 8.07724L2.84004 7.38188C2.93695 7.28699 3.09408 7.28699 3.191 7.38188L5.46392 9.60726C5.48815 9.63098 5.52743 9.63098 5.55166 9.60726L7.82447 7.38188C7.92138 7.28699 8.07851 7.28699 8.17543 7.38187L10.4484 9.60726C10.4726 9.63098 10.5119 9.63098 10.5361 9.60726L12.809 7.38192C12.9059 7.28703 13.063 7.28703 13.1599 7.38192Z" fill="currentColor"/> 1584</g> 1585<defs> 1586<clipPath id="clip0_22274_4692"> 1587<path d="M0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8Z" fill="white"/> 1588</clipPath> 1589</defs> 1590</svg> 1591`,e7t=ae` 1592<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 1593<circle cx="11" cy="11" r="11" transform="matrix(-1 0 0 1 23 1)" fill="#202020"/> 1594<circle cx="11" cy="11" r="11.5" transform="matrix(-1 0 0 1 23 1)" stroke="#C7B994" stroke-opacity="0.7"/> 1595<path d="M15.4523 11.0686L16.7472 9.78167C13.8205 6.87297 10.1838 6.87297 7.25708 9.78167L8.55201 11.0686C10.7779 8.85645 13.2279 8.85645 15.4538 11.0686H15.4523Z" fill="#C7B994"/> 1596<path d="M15.0199 14.067L12 11.0656L8.98 14.067L5.96004 11.0656L4.66663 12.3511L8.98 16.6393L12 13.638L15.0199 16.6393L19.3333 12.3511L18.0399 11.0656L15.0199 14.067Z" fill="#C7B994"/> 1597</svg> 1598`,yae=ae`<svg fill="none" viewBox="0 0 41 40"> 1599 <g clip-path="url(#a)"> 1600 <path fill="#000" d="M.8 0h40v40H.8z" /> 1601 <path 1602 fill="#fff" 1603 d="m22.63 18.46 7.14-8.3h-1.69l-6.2 7.2-4.96-7.2H11.2l7.5 10.9-7.5 8.71h1.7l6.55-7.61 5.23 7.61h5.72l-7.77-11.31Zm-9.13-7.03h2.6l11.98 17.13h-2.6L13.5 11.43Z" 1604 /> 1605 </g>
1606 <defs> 1607 <clipPath id="a"><path fill="#fff" d="M.8 20a20 20 0 1 1 40 0 20 20 0 0 1-40 0Z" /></clipPath> 1608 </defs> 1609</svg>`,t7t=Xe` 1610 :host { 1611 display: flex; 1612 justify-content: center; 1613 align-items: center; 1614 aspect-ratio: 1 / 1; 1615 color: var(--local-color); 1616 width: var(--local-width); 1617 } 1618 1619 svg { 1620 height: inherit; 1621 width: inherit; 1622 object-fit: contain; 1623 object-position: center; 1624 } 1625`;var D$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const n7t={add:"ph-plus",allWallets:"ph-dots-three",arrowBottom:"ph-arrow-down",arrowBottomCircle:"ph-arrow-circle-down",arrowClockWise:"ph-arrow-clockwise",arrowLeft:"ph-arrow-left",arrowRight:"ph-arrow-right",arrowTop:"ph-arrow-up",arrowTopRight:"ph-arrow-up-right",bank:"ph-bank",bin:"ph-trash",browser:"ph-browser",card:"ph-credit-card",checkmarkBold:"ph-check",chevronBottom:"ph-caret-down",chevronLeft:"ph-caret-left",chevronRight:"ph-caret-right",chevronTop:"ph-caret-up",clock:"ph-clock",close:"ph-x",coinPlaceholder:"ph-circle-half",compass:"ph-compass",copy:"ph-copy",desktop:"ph-desktop",dollar:"ph-currency-dollar",download:"ph-vault",exclamationCircle:"ph-warning-circle",extension:"ph-puzzle-piece",externalLink:"ph-arrow-square-out",filters:"ph-funnel-simple",helpCircle:"ph-question",id:"ph-identification-card",image:"ph-image",info:"ph-info",lightbulb:"ph-lightbulb",mail:"ph-envelope",mobile:"ph-device-mobile",more:"ph-dots-three",networkPlaceholder:"ph-globe",nftPlaceholder:"ph-image",plus:"ph-plus",power:"ph-power",qrCode:"ph-qr-code",questionMark:"ph-question",refresh:"ph-arrow-clockwise",recycleHorizontal:"ph-arrows-clockwise",search:"ph-magnifying-glass",sealCheck:"ph-seal-check",send:"ph-paper-plane-right",signOut:"ph-sign-out",spinner:"ph-spinner",swapHorizontal:"ph-arrows-left-right",swapVertical:"ph-arrows-down-up",threeDots:"ph-dots-three",user:"ph-user",verify:"ph-seal-check",verifyFilled:"ph-seal-check",wallet:"ph-wallet",warning:"ph-warning",warningCircle:"ph-warning-circle",appStore:"",apple:"",bitcoin:"",coins:"",chromeStore:"",cursor:"",discord:"",ethereum:"",etherscan:"",facebook:"",farcaster:"",github:"",google:"",playStore:"",paperPlaneTitle:"",reown:"",solana:"",ton:"",tron:"",telegram:"",twitch:"",twitterIcon:"",twitter:"",walletConnect:"",walletConnectBrown:"",walletConnectLightBrown:"",x:"",infoSeal:"",checkmark:""},r7t={"ph-arrow-circle-down":()=>te(()=>import("./PhArrowCircleDown-C8sfqb_q.js"),__vite__mapDeps([0,1])),"ph-arrow-clockwise":()=>te(()=>import("./PhArrowClockwise-DtPSkNiy.js"),__vite__mapDeps([2,1])),"ph-arrow-down":()=>te(()=>import("./PhArrowDown-BA6bqI-h.js"),__vite__mapDeps([3,1])),"ph-arrow-left":()=>te(()=>import("./PhArrowLeft-BagVykqk.js"),__vite__mapDeps([4,1])),"ph-arrow-right":()=>te(()=>import("./PhArrowRight-meiNum-s.js"),__vite__mapDeps([5,1])),"ph-arrow-square-out":()=>te(()=>import("./PhArrowSquareOut-DuB9-oNy.js"),__vite__mapDeps([6,1])),"ph-arrows-down-up":()=>te(()=>import("./PhArrowsDownUp-Bwprpk5p.js"),__vite__mapDeps([7,1])),"ph-arrows-left-right":()=>te(()=>import("./PhArrowsLeftRight-CBa1AHPv.js"),__vite__mapDeps([8,1])),"ph-arrow-up":()=>te(()=>import("./PhArrowUp-BNML-ssX.js"),__vite__mapDeps([9,1])),"ph-arrow-up-right":()=>te(()=>import("./PhArrowUpRight-E9p7twEV.js"),__vite__mapDeps([10,1])),"ph-arrows-clockwise":()=>te(()=>import("./PhArrowsClockwise-DPavEfmI.js"),__vite__mapDeps([11,1])),"ph-bank":()=>te(()=>import("./PhBank-ChEGvcrG.js"),__vite__mapDeps([12,1])),"ph-browser":()=>te(()=>import("./PhBrowser-DAHUmQYP.js"),__vite__mapDeps([13,1])),"ph-caret-down":()=>te(()=>import("./PhCaretDown-CVPAhONG.js"),__vite__mapDeps([14,1])),"ph-caret-left":()=>te(()=>import("./PhCaretLeft-Cjnn7efI.js"),__vite__mapDeps([15,1])),"ph-caret-right":()=>te(()=>import("./PhCaretRight-BOw6b8E-.js"),__vite__mapDeps([16,1])),"ph-caret-up":()=>te(()=>import("./PhCaretUp-CRyMReh0.js"),__vite__mapDeps([17,1])),"ph-check":()=>te(()=>import("./PhCheck-BjfM-ObM.js"),__vite__mapDeps([18,1])),"ph-circle-half":()=>te(()=>import("./PhCircleHalf-Dw6KHNdh.js"),__vite__mapDeps([19,1])),"ph-clock":()=>te(()=>import("./PhClock-DgL7-xE_.js"),__vite__mapDeps([20,1])),"ph-compass":()=>te(()=>import("./PhCompass-Dfw_iYBq.js"),__vite__mapDeps([21,1])),"ph-copy":()=>te(()=>import("./PhCopy-CBFzCcT0.js"),__vite__mapDeps([22,1])),"ph-credit-card":()=>te(()=>import("./PhCreditCard-DxzeozHs.js"),__vite__mapDeps([23,1])),"ph-currency-dollar":()=>te(()=>import("./PhCurrencyDollar-DBM7izx7.js"),__vite__mapDeps([24,1])
1625),"ph-desktop":()=>te(()=>import("./PhDesktop-BQJ0jJEw.js"),__vite__mapDeps([25,1])),"ph-device-mobile":()=>te(()=>import("./PhDeviceMobile-B5SC4g2S.js"),__vite__mapDeps([26,1])),"ph-dots-three":()=>te(()=>import("./PhDotsThree-89amEoiE.js"),__vite__mapDeps([27,1])),"ph-vault":()=>te(()=>import("./PhVault-tuRA-lQz.js"),__vite__mapDeps([28,1])),"ph-envelope":()=>te(()=>import("./PhEnvelope-DheiVAl2.js"),__vite__mapDeps([29,1])),"ph-funnel-simple":()=>te(()=>import("./PhFunnelSimple-D2VcnCQ3.js"),__vite__mapDeps([30,1])),"ph-globe":()=>te(()=>import("./PhGlobe-BOWfnrZq.js"),__vite__mapDeps([31,1])),"ph-identification-card":()=>te(()=>import("./PhIdentificationCard-CoKk3ytY.js"),__vite__mapDeps([32,1])),"ph-image":()=>te(()=>import("./PhImage-DYKjtKeZ.js"),__vite__mapDeps([33,1])),"ph-info":()=>te(()=>import("./PhInfo-Wr7tBEGO.js"),__vite__mapDeps([34,1])),"ph-lightbulb":()=>te(()=>import("./PhLightbulb-DfclYvXe.js"),__vite__mapDeps([35,1])),"ph-magnifying-glass":()=>te(()=>import("./PhMagnifyingGlass-ptT4GDlT.js"),__vite__mapDeps([36,1])),"ph-paper-plane-right":()=>te(()=>import("./PhPaperPlaneRight-DlGPga9t.js"),__vite__mapDeps([37,1])),"ph-plus":()=>te(()=>import("./PhPlus-Bv1d-A17.js"),__vite__mapDeps([38,1])),"ph-power":()=>te(()=>import("./PhPower-i0OFmFkP.js"),__vite__mapDeps([39,1])),"ph-puzzle-piece":()=>te(()=>import("./PhPuzzlePiece-BIQHBxgR.js"),__vite__mapDeps([40,1])),"ph-qr-code":()=>te(()=>import("./PhQrCode-DYymT0U6.js"),__vite__mapDeps([41,1])),"ph-question":()=>te(()=>import("./PhQuestion-V-t4d9L8.js"),__vite__mapDeps([42,1])),"ph-question-circle":()=>te(()=>import("./PhQuestionMark-BlrV0OLv.js"),__vite__mapDeps([43,1])),"ph-seal-check":()=>te(()=>import("./PhSealCheck-DJg6zkcd.js"),__vite__mapDeps([44,1])),"ph-sign-out":()=>te(()=>import("./PhSignOut-3LIUMyak.js"),__vite__mapDeps([45,1])),"ph-spinner":()=>te(()=>import("./PhSpinner-CgS0DtZv.js"),__vite__mapDeps([46,1])),"ph-trash":()=>te(()=>import("./PhTrash-Bjt7wbP4.js"),__vite__mapDeps([47,1])),"ph-user":()=>te(()=>import("./PhUser-DHlhekvv.js"),__vite__mapDeps([48,1])),"ph-wallet":()=>te(()=>import("./PhWallet-CzKiZSmU.js"),__vite__mapDeps([49,1])),"ph-warning":()=>te(()=>import("./PhWarning-VwPb-1BV.js"),__vite__mapDeps([50,1])),"ph-warning-circle":()=>te(()=>import("./PhWarningCircle-B82beykt.js"),__vite__mapDeps([51,1])),"ph-x":()=>te(()=>import("./PhX-iUNICe98.js"),__vite__mapDeps([52,1]))},s7t={appStore:ANt,apple:_Nt,bitcoin:NNt,coins:ONt,chromeStore:PNt,cursor:kNt,discord:RNt,ethereum:BNt,etherscan:DNt,facebook:UNt,farcaster:LNt,github:MNt,google:jNt,playStore:qNt,paperPlaneTitle:zNt,reown:WNt,solana:HNt,ton:KNt,tron:GNt,telegram:VNt,twitch:ZNt,twitter:yae,twitterIcon:YNt,walletConnect:JNt,walletConnectInvert:XNt,walletConnectBrown:e7t,walletConnectLightBrown:QNt,x:yae,infoSeal:FNt,checkmark:TNt},i7t={"accent-primary":gr.tokens.core.iconAccentPrimary,"accent-certified":gr.tokens.core.iconAccentCertified,"foreground-secondary":gr.tokens.theme.foregroundSecondary,default:gr.tokens.theme.iconDefault,success:gr.tokens.core.iconSuccess,error:gr.tokens.core.iconError,warning:gr.tokens.core.iconWarning,inverse:gr.tokens.theme.iconInverse};let Cy=class extends ce{constructor(){super(...arguments),this.size="md",this.name="copy",this.weight="bold",this.color="inherit"}render(){const t={xxs:"2",xs:"3",sm:"3",md:"4",mdl:"5",lg:"5",xl:"6",xxl:"7",inherit:"inherit"};this.style.cssText=` 1626 --local-width: ${this.size==="inherit"?"inherit":`var(--apkt-spacing-${t[this.size]})`}; 1627 --local-color: ${this.color==="inherit"?"inherit":i7t[this.color]} 1628 `;const n=n7t[this.name];if(n&&n!==""){const r=r7t[n];r&&r();const s=PEe(n);return R_`<${s} size=${{xxs:"0.5em",xs:"0.75em",sm:"0.75em",md:"1em",mdl:"1.25em",lg:"1.25em",xl:"1.5em",xxl:"1.75em"}[this.size]} weight="${this.weight}"></${s}>`}return s7t[this.name]||R_``}};Cy.styles=[ar,t7t];D$([z()],Cy.prototype,"size",void 0);D$([z()],Cy.prototype,"name",void 0);D$([z()],Cy.prototype,"weight",void 0);D$([z()],Cy.prototype,"color",void 0);Cy=D$([pt("wui-icon")],Cy);const OEe={ATTRIBUTE:1,CHILD:2},LK=e=>(...t)=>({_$litDirective$:e,values:t});let kEe=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,n,r){this._$Ct=t,this._$AM=n,this._$Ci=r}_$AS(t,n){return this.update(t,n)}update(t,n){return this.render(...n)}};const Y6=LK(class extends kEe{constructor(e){var t;if(super(e),e.type!==OEe.ATTRIBUTE||e.name!=="class"||((t=e.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){var r,s;
vendor: 11,375 bytes, lines 1628-1923
1628if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(const i in t)t[i]&&!((r=this.nt)!=null&&r.has(i))&&this.st.add(i);return this.render(t)}const n=e.element.classList;for(const i of this.st)i in t||(n.remove(i),this.st.delete(i));for(const i in t){const o=!!t[i];o===this.st.has(i)||(s=this.nt)!=null&&s.has(i)||(o?(n.add(i),this.st.add(i)):(n.remove(i),this.st.delete(i)))}return C0}}),o7t=Gt` 1629 slot { 1630 width: 100%; 1631 display: inline-block; 1632 font-style: normal; 1633 overflow: inherit; 1634 text-overflow: inherit; 1635 text-align: var(--local-align); 1636 color: var(--local-color); 1637 } 1638 1639 .wui-line-clamp-1 { 1640 overflow: hidden; 1641 display: -webkit-box; 1642 -webkit-box-orient: vertical; 1643 -webkit-line-clamp: 1; 1644 } 1645 1646 .wui-line-clamp-2 { 1647 overflow: hidden; 1648 display: -webkit-box; 1649 -webkit-box-orient: vertical; 1650 -webkit-line-clamp: 2; 1651 } 1652 1653 /* -- Headings --------------------------------------------------- */ 1654 .wui-font-h1-regular-mono { 1655 font-size: ${({textSize:e})=>e.h1}; 1656 line-height: ${({typography:e})=>e["h1-regular-mono"].lineHeight}; 1657 letter-spacing: ${({typography:e})=>e["h1-regular-mono"].letterSpacing}; 1658 font-weight: ${({fontWeight:e})=>e.regular}; 1659 font-family: ${({fontFamily:e})=>e.mono}; 1660 } 1661 1662 .wui-font-h1-regular { 1663 font-size: ${({textSize:e})=>e.h1}; 1664 line-height: ${({typography:e})=>e["h1-regular"].lineHeight}; 1665 letter-spacing: ${({typography:e})=>e["h1-regular"].letterSpacing}; 1666 font-weight: ${({fontWeight:e})=>e.regular}; 1667 font-family: ${({fontFamily:e})=>e.regular}; 1668 font-feature-settings: 1669 'liga' off, 1670 'clig' off; 1671 } 1672 1673 .wui-font-h1-medium { 1674 font-size: ${({textSize:e})=>e.h1}; 1675 line-height: ${({typography:e})=>e["h1-medium"].lineHeight}; 1676 letter-spacing: ${({typography:e})=>e["h1-medium"].letterSpacing}; 1677 font-weight: ${({fontWeight:e})=>e.medium}; 1678 font-family: ${({fontFamily:e})=>e.regular}; 1679 font-feature-settings: 1680 'liga' off, 1681 'clig' off; 1682 } 1683 1684 .wui-font-h2-regular-mono { 1685 font-size: ${({textSize:e})=>e.h2}; 1686 line-height: ${({typography:e})=>e["h2-regular-mono"].lineHeight}; 1687 letter-spacing: ${({typography:e})=>e["h2-regular-mono"].letterSpacing}; 1688 font-weight: ${({fontWeight:e})=>e.regular}; 1689 font-family: ${({fontFamily:e})=>e.mono}; 1690 } 1691 1692 .wui-font-h2-regular { 1693 font-size: ${({textSize:e})=>e.h2}; 1694 line-height: ${({typography:e})=>e["h2-regular"].lineHeight}; 1695 letter-spacing: ${({typography:e})=>e["h2-regular"].letterSpacing}; 1696 font-weight: ${({fontWeight:e})=>e.regular}; 1697 font-family: ${({fontFamily:e})=>e.regular}; 1698 font-feature-settings: 1699 'liga' off, 1700 'clig' off; 1701 } 1702 1703 .wui-font-h2-medium { 1704 font-size: ${({textSize:e})=>e.h2}; 1705 line-height: ${({typography:e})=>e["h2-medium"].lineHeight}; 1706 letter-spacing: ${({typography:e})=>e["h2-medium"].letterSpacing}; 1707 font-weight: ${({fontWeight:e})=>e.medium}; 1708 font-family: ${({fontFamily:e})=>e.regular}; 1709 font-feature-settings: 1710 'liga' off, 1711 'clig' off; 1712 } 1713 1714 .wui-font-h3-regular-mono { 1715 font-size: ${({textSize:e})=>e.h3}; 1716 line-height: ${({typography:e})=>e["h3-regular-mono"].lineHeight}; 1717 letter-spacing: ${({typography:e})=>e["h3-regular-mono"].letterSpacing}; 1718 font-weight: ${({fontWeight:e})=>e.regular}; 1719 font-family: ${({fontFamily:e})=>e.mono}; 1720 } 1721 1722 .wui-font-h3-regular { 1723 font-size: ${({textSize:e})=>e.h3}; 1724 line-height: ${({typography:e})=>e["h3-regular"].lineHeight}; 1725 letter-spacing: ${({typography:e})=>e["h3-regular"].letterSpacing}; 1726 font-weight: ${({fontWeight:e})=>e.regular}; 1727 font-family: ${({fontFamily:e})=>e.regular}; 1728 font-feature-settings: 1729 'liga' off, 1730 'clig' off; 1731 } 1732 1733 .wui-font-h3-medium { 1734 font-size: ${({textSize:e})=>e.h3}; 1735 line-height: ${({typography:e})=>e["h3-medium"].lineHeight}; 1736 letter-spacing: ${({typography:e})=>e["h3-medium"].letterSpacing}; 1737 font-weight: ${({fontWeight:e})=>e.medium}; 1738 font-family: ${({fontFamily:e})=>e.regular}; 1739 font-feature-settings: 1740 'liga' off, 1741 'clig' off; 1742 } 1743 1744 .wui-font-h4-regular-mono { 1745 font-size: ${({textSize:e})=>e.h4}; 1746 line-height: ${({typography:e})=>e["h4-regular-mono"].lineHeight}; 1747 letter-spacing: ${({typography:e})=>e["h4-regular-mono"].letterSpacing}; 1748 font-weight: ${({fontWeight:e})=>e.regular}; 1749 font-family: ${({fontFamily:e})=>e.mono}; 1750 } 1751 1752 .wui-font-h4-regular { 1753 font-size: ${({textSize:e})=>e.h4}; 1754 line-height: ${({typography:e})=>e["h4-regular"].lineHeight}; 1755 letter-spacing: ${({typography:e})=>e["h4-regular"].letterSpacing}; 1756 font-weight: ${({fontWeight:e})=>e.regular}; 1757 font-family: ${({fontFamily:e})=>e.regular}; 1758 font-feature-settings: 1759 'liga' off, 1760 'clig' off; 1761 } 1762 1763 .wui-font-h4-medium { 1764 font-size: ${({textSize:e})=>e.h4}; 1765 line-height: ${({typography:e})=>e["h4-medium"].lineHeight}; 1766 letter-spacing: ${({typography:e})=>e["h4-medium"].letterSpacing}; 1767 font-weight: ${({fontWeight:e})=>e.medium}; 1768 font-family: ${({fontFamily:e})=>e.regular}; 1769 font-feature-settings: 1770 'liga' off, 1771 'clig' off; 1772 } 1773 1774 .wui-font-h5-regular-mono { 1775 font-size: ${({textSize:e})=>e.h5}; 1776 line-height: ${({typography:e})=>e["h5-regular-mono"].lineHeight}; 1777 letter-spacing: ${({typography:e})=>e["h5-regular-mono"].letterSpacing}; 1778 font-weight: ${({fontWeight:e})=>e.regular}; 1779 font-family: ${({fontFamily:e})=>e.mono}; 1780 } 1781 1782 .wui-font-h5-regular { 1783 font-size: ${({textSize:e})=>e.h5}; 1784 line-height: ${({typography:e})=>e["h5-regular"].lineHeight}; 1785 letter-spacing: ${({typography:e})=>e["h5-regular"].letterSpacing}; 1786 font-weight: ${({fontWeight:e})=>e.regular}; 1787 font-family: ${({fontFamily:e})=>e.regular}; 1788 font-feature-settings: 1789 'liga' off, 1790 'clig' off; 1791 } 1792 1793 .wui-font-h5-medium { 1794 font-size: ${({textSize:e})=>e.h5}; 1795 line-height: ${({typography:e})=>e["h5-medium"].lineHeight}; 1796 letter-spacing: ${({typography:e})=>e["h5-medium"].letterSpacing}; 1797 font-weight: ${({fontWeight:e})=>e.medium}; 1798 font-family: ${({fontFamily:e})=>e.regular}; 1799 font-feature-settings: 1800 'liga' off, 1801 'clig' off; 1802 } 1803 1804 .wui-font-h6-regular-mono { 1805 font-size: ${({textSize:e})=>e.h6}; 1806 line-height: ${({typography:e})=>e["h6-regular-mono"].lineHeight}; 1807 letter-spacing: ${({typography:e})=>e["h6-regular-mono"].letterSpacing}; 1808 font-weight: ${({fontWeight:e})=>e.regular}; 1809 font-family: ${({fontFamily:e})=>e.mono}; 1810 } 1811 1812 .wui-font-h6-regular { 1813 font-size: ${({textSize:e})=>e.h6}; 1814 line-height: ${({typography:e})=>e["h6-regular"].lineHeight}; 1815 letter-spacing: ${({typography:e})=>e["h6-regular"].letterSpacing}; 1816 font-weight: ${({fontWeight:e})=>e.regular}; 1817 font-family: ${({fontFamily:e})=>e.regular}; 1818 font-feature-settings: 1819 'liga' off, 1820 'clig' off; 1821 } 1822 1823 .wui-font-h6-medium { 1824 font-size: ${({textSize:e})=>e.h6}; 1825 line-height: ${({typography:e})=>e["h6-medium"].lineHeight}; 1826 letter-spacing: ${({typography:e})=>e["h6-medium"].letterSpacing}; 1827 font-weight: ${({fontWeight:e})=>e.medium}; 1828 font-family: ${({fontFamily:e})=>e.regular}; 1829 font-feature-settings: 1830 'liga' off, 1831 'clig' off; 1832 } 1833 1834 .wui-font-lg-regular-mono { 1835 font-size: ${({textSize:e})=>e.large}; 1836 line-height: ${({typography:e})=>e["lg-regular-mono"].lineHeight}; 1837 letter-spacing: ${({typography:e})=>e["lg-regular-mono"].letterSpacing}; 1838 font-weight: ${({fontWeight:e})=>e.regular}; 1839 font-family: ${({fontFamily:e})=>e.mono}; 1840 } 1841 1842 .wui-font-lg-regular { 1843 font-size: ${({textSize:e})=>e.large}; 1844 line-height: ${({typography:e})=>e["lg-regular"].lineHeight}; 1845 letter-spacing: ${({typography:e})=>e["lg-regular"].letterSpacing}; 1846 font-weight: ${({fontWeight:e})=>e.regular}; 1847 font-family: ${({fontFamily:e})=>e.regular}; 1848 font-feature-settings: 1849 'liga' off, 1850 'clig' off; 1851 } 1852 1853 .wui-font-lg-medium { 1854 font-size: ${({textSize:e})=>e.large}; 1855 line-height: ${({typography:e})=>e["lg-medium"].lineHeight}; 1856 letter-spacing: ${({typography:e})=>e["lg-medium"].letterSpacing}; 1857 font-weight: ${({fontWeight:e})=>e.medium}; 1858 font-family: ${({fontFamily:e})=>e.regular}; 1859 font-feature-settings: 1860 'liga' off, 1861 'clig' off; 1862 } 1863 1864 .wui-font-md-regular-mono { 1865 font-size: ${({textSize:e})=>e.medium}; 1866 line-height: ${({typography:e})=>e["md-regular-mono"].lineHeight}; 1867 letter-spacing: ${({typography:e})=>e["md-regular-mono"].letterSpacing}; 1868 font-weight: ${({fontWeight:e})=>e.regular}; 1869 font-family: ${({fontFamily:e})=>e.mono}; 1870 } 1871 1872 .wui-font-md-regular { 1873 font-size: ${({textSize:e})=>e.medium}; 1874 line-height: ${({typography:e})=>e["md-regular"].lineHeight}; 1875 letter-spacing: ${({typography:e})=>e["md-regular"].letterSpacing}; 1876 font-weight: ${({fontWeight:e})=>e.regular}; 1877 font-family: ${({fontFamily:e})=>e.regular}; 1878 font-feature-settings: 1879 'liga' off, 1880 'clig' off; 1881 } 1882 1883 .wui-font-md-medium { 1884 font-size: ${({textSize:e})=>e.medium}; 1885 line-height: ${({typography:e})=>e["md-medium"].lineHeight}; 1886 letter-spacing: ${({typography:e})=>e["md-medium"].letterSpacing}; 1887 font-weight: ${({fontWeight:e})=>e.medium}; 1888 font-family: ${({fontFamily:e})=>e.regular}; 1889 font-feature-settings: 1890 'liga' off, 1891 'clig' off; 1892 } 1893 1894 .wui-font-sm-regular-mono { 1895 font-size: ${({textSize:e})=>e.small}; 1896 line-height: ${({typography:e})=>e["sm-regular-mono"].lineHeight}; 1897 letter-spacing: ${({typography:e})=>e["sm-regular-mono"].letterSpacing}; 1898 font-weight: ${({fontWeight:e})=>e.regular}; 1899 font-family: ${({fontFamily:e})=>e.mono}; 1900 } 1901 1902 .wui-font-sm-regular { 1903 font-size: ${({textSize:e})=>e.small}; 1904 line-height: ${({typography:e})=>e["sm-regular"].lineHeight}; 1905 letter-spacing: ${({typography:e})=>e["sm-regular"].letterSpacing}; 1906 font-weight: ${({fontWeight:e})=>e.regular}; 1907 font-family: ${({fontFamily:e})=>e.regular}; 1908 font-feature-settings: 1909 'liga' off, 1910 'clig' off; 1911 } 1912 1913 .wui-font-sm-medium { 1914 font-size: ${({textSize:e})=>e.small}; 1915 line-height: ${({typography:e})=>e["sm-medium"].lineHeight}; 1916 letter-spacing: ${({typography:e})=>e["sm-medium"].letterSpacing}; 1917 font-weight: ${({fontWeight:e})=>e.medium}; 1918 font-family: ${({fontFamily:e})=>e.regular}; 1919 font-feature-settings: 1920 'liga' off, 1921 'clig' off; 1922 } 1923`;var J6=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const a7t={primary:gr.tokens.theme.textPrimary,secondary:gr.tokens.theme.textSecondary,tertiary:gr.tokens.theme.textTertiary,invert:gr.tokens.theme.textInvert,error:gr.tokens.core.textError,success:gr.tokens.core.textSuccess,warning:gr.tokens.core.textWarning,"accent-primary":gr.tokens.core.textAccentPrimary};let Xm=class extends ce{constructor(){super(...arguments),this.variant="md-regular",this.color="inherit",this.align="left",this.lineClamp=void 0,this.display="inline-flex"}render(){const t={[`wui-font-${this.variant}
1923`]:!0,[`wui-line-clamp-${this.lineClamp}`]:!!this.lineClamp};return this.style.cssText=` 1924 display: ${this.display}; 1925 --local-align: ${this.align}; 1926 --local-color: ${this.color==="inherit"?"inherit":a7t[this.color??"primary"]}; 1927 `,j`<slot class=${Y6(t)}></slot>`}};Xm.styles=[ar,o7t];J6([z()],Xm.prototype,"variant",void 0);J6([z()],Xm.prototype,"color",void 0);J6([z()],Xm.prototype,"align",void 0);J6([z()],Xm.prototype,"lineClamp",void 0);J6([z()],Xm.prototype,"display",void 0);Xm=J6([pt("wui-text")],Xm);const c7t=Gt` 1928 :host { 1929 display: inline-flex; 1930 justify-content: center; 1931 align-items: center; 1932 border-radius: ${({borderRadius:e})=>e[2]}; 1933 padding: ${({spacing:e})=>e[1]} !important; 1934 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 1935 position: relative; 1936 } 1937 1938 :host([data-padding='2']) { 1939 padding: ${({spacing:e})=>e[2]} !important; 1940 } 1941 1942 :host:after { 1943 content: ''; 1944 position: absolute; 1945 top: 0; 1946 left: 0; 1947 width: 100%; 1948 height: 100%; 1949 border-radius: ${({borderRadius:e})=>e[2]}; 1950 } 1951 1952 :host > wui-icon { 1953 z-index: 10; 1954 } 1955 1956 /* -- Colors --------------------------------------------------- */ 1957 :host([data-color='accent-primary']) { 1958 color: ${({tokens:e})=>e.core.iconAccentPrimary}; 1959 } 1960 1961 :host([data-color='accent-primary']):after { 1962 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 1963 } 1964 1965 :host([data-color='default']), 1966 :host([data-color='secondary']) { 1967 color: ${({tokens:e})=>e.theme.iconDefault}; 1968 } 1969 1970 :host([data-color='default']):after { 1971 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 1972 } 1973 1974 :host([data-color='secondary']):after { 1975 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 1976 } 1977 1978 :host([data-color='success']) { 1979 color: ${({tokens:e})=>e.core.iconSuccess}; 1980 } 1981 1982 :host([data-color='success']):after { 1983 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 1984 } 1985 1986 :host([data-color='error']) { 1987 color: ${({tokens:e})=>e.core.iconError}; 1988 } 1989 1990 :host([data-color='error']):after { 1991 background-color: ${({tokens:e})=>e.core.backgroundError}; 1992 } 1993 1994 :host([data-color='warning']) { 1995 color: ${({tokens:e})=>e.core.iconWarning}; 1996 } 1997 1998 :host([data-color='warning']):after { 1999 background-color: ${({tokens:e})=>e.core.backgroundWarning}; 2000 } 2001 2002 :host([data-color='inverse']) { 2003 color: ${({tokens:e})=>e.theme.iconInverse}; 2004 } 2005 2006 :host([data-color='inverse']):after { 2007 background-color: transparent; 2008 } 2009`;var U$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let $y=class extends ce{constructor(){super(...arguments),this.icon="copy",this.size="md",this.padding="1",this.color="default"}render(){return this.dataset.padding=this.padding,this.dataset.color=this.color,j` 2010 <wui-icon size=${ge(this.size)} name=${this.icon} color="inherit"></wui-icon> 2011 `}};$y.styles=[ar,ba,c7t];U$([z()],$y.prototype,"icon",void 0);U$([z()],$y.prototype,"size",void 0);U$([z()],$y.prototype,"padding",void 0);U$([z()],$y.prototype,"color",void 0);$y=U$([pt("wui-icon-box")],$y);const l7t=Gt` 2012 :host { 2013 display: block; 2014 width: var(--local-width); 2015 height: var(--local-height); 2016 } 2017 2018 img { 2019 display: block; 2020 width: 100%; 2021 height: 100%; 2022 object-fit: cover; 2023 object-position: center center; 2024 border-radius: inherit; 2025 user-select: none; 2026 user-drag: none; 2027 -webkit-user-drag: none; 2028 -khtml-user-drag: none; 2029 -moz-user-drag: none; 2030 -o-user-drag: none; 2031 } 2032 2033 :host([data-boxed='true']) { 2034 width: 40px; 2035 height: 40px; 2036 display: flex; 2037 align-items: center; 2038 justify-content: center; 2039 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2040 border-radius: ${({borderRadius:e})=>e[2]}; 2041 } 2042 2043 :host([data-boxed='true']) img { 2044 width: 20px; 2045 height: 20px; 2046 border-radius: ${({borderRadius:e})=>e[16]}; 2047 } 2048 2049 :host([data-full='true']) img { 2050 width: 100%; 2051 height: 100%; 2052 } 2053 2054 :host([data-boxed='true']) wui-icon {
2055 width: 20px; 2056 height: 20px; 2057 } 2058 2059 :host([data-icon='error']) { 2060 background-color: ${({tokens:e})=>e.core.backgroundError}; 2061 } 2062 2063 :host([data-rounded='true']) { 2064 border-radius: ${({borderRadius:e})=>e[16]}; 2065 } 2066`;var bf=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Au=class extends ce{constructor(){super(...arguments),this.src="./path/to/image.jpg",this.alt="Image",this.size=void 0,this.boxed=!1,this.rounded=!1,this.fullSize=!1}render(){const t={inherit:"inherit",xxs:"2",xs:"3",sm:"4",md:"4",mdl:"5",lg:"5",xl:"6",xxl:"7","3xl":"8","4xl":"9","5xl":"10"};return this.style.cssText=` 2067 --local-width: ${this.size?`var(--apkt-spacing-${t[this.size]});`:"100%"}; 2068 --local-height: ${this.size?`var(--apkt-spacing-${t[this.size]});`:"100%"}; 2069 `,this.dataset.boxed=this.boxed?"true":"false",this.dataset.rounded=this.rounded?"true":"false",this.dataset.full=this.fullSize?"true":"false",this.dataset.icon=this.iconColor||"inherit",this.icon?j`<wui-icon 2070 color=${this.iconColor||"inherit"} 2071 name=${this.icon} 2072 size="lg" 2073 ></wui-icon> `:this.logo?j`<wui-icon size="lg" color="inherit" name=${this.logo}></wui-icon> `:j`<img src=${ge(this.src)} alt=${this.alt} @error=${this.handleImageError} />`}handleImageError(){this.dispatchEvent(new CustomEvent("onLoadError",{bubbles:!0,composed:!0}))}};Au.styles=[ar,l7t];bf([z()],Au.prototype,"src",void 0);bf([z()],Au.prototype,"logo",void 0);bf([z()],Au.prototype,"icon",void 0);bf([z()],Au.prototype,"iconColor",void 0);bf([z()],Au.prototype,"alt",void 0);bf([z()],Au.prototype,"size",void 0);bf([z({type:Boolean})],Au.prototype,"boxed",void 0);bf([z({type:Boolean})],Au.prototype,"rounded",void 0);bf([z({type:Boolean})],Au.prototype,"fullSize",void 0);Au=bf([pt("wui-image")],Au);const u7t=Gt` 2074 :host { 2075 position: relative; 2076 background-color: ${({tokens:e})=>e.theme.foregroundTertiary}; 2077 display: flex; 2078 justify-content: center; 2079 align-items: center; 2080 border-radius: inherit; 2081 border-radius: var(--local-border-radius); 2082 } 2083 2084 :host([data-image='true']) { 2085 background-color: transparent; 2086 } 2087 2088 :host > wui-flex { 2089 overflow: hidden; 2090 border-radius: inherit; 2091 border-radius: var(--local-border-radius); 2092 } 2093 2094 :host([data-size='sm']) { 2095 width: 32px; 2096 height: 32px; 2097 } 2098 2099 :host([data-size='md']) { 2100 width: 40px; 2101 height: 40px; 2102 } 2103 2104 :host([data-size='lg']) { 2105 width: 56px; 2106 height: 56px; 2107 } 2108 2109 :host([name='Extension'])::after { 2110 border: 1px solid ${({colors:e})=>e.accent010}; 2111 } 2112 2113 :host([data-wallet-icon='allWallets'])::after { 2114 border: 1px solid ${({colors:e})=>e.accent010}; 2115 } 2116 2117 wui-icon[data-parent-size='inherit'] { 2118 width: 75%; 2119 height: 75%; 2120 align-items: center; 2121 } 2122 2123 wui-icon { 2124 color: ${({tokens:e})=>e.theme.iconDefault}; 2125 } 2126 2127 wui-icon[data-parent-size='sm'] { 2128 width: 24px; 2129 height: 24px; 2130 } 2131 2132 wui-icon[data-parent-size='md'] { 2133 width: 32px; 2134 height: 32px; 2135 } 2136 2137 :host > wui-icon-box { 2138 position: absolute; 2139 overflow: hidden; 2140 right: -1px; 2141 bottom: -2px; 2142 z-index: 1; 2143 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 2144 padding: 1px; 2145 } 2146`;var Ib=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let I0=class extends ce{constructor(){super(...arguments),this.size="md",this.name="",this.installed=!1,this.badgeSize="xs"}render(){let t="1";return this.size==="lg"?t="4":this.size==="md"?t="2":this.size==="sm"&&(t="1"),this.style.cssText=` 2147 --local-border-radius: var(--apkt-borderRadius-${t}); 2148 `,this.dataset.size=this.size,this.imageSrc&&(this.dataset.image="true"),this.walletIcon&&(this.dataset.walletIcon=this.walletIcon),j` 2149 <wui-flex justifyContent="center" alignItems="center"> ${this.templateVisual()} </wui-flex> 2150 `}templateVisual(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:this.walletIcon?j`<wui-icon size="md" color="default" name=${this.walletIcon}></wui-icon>`:j`<wui-icon 2151 data-parent-size=${this.size} 2152 size="inherit" 2153 color="inherit" 2154 name="wallet" 2155 ></wui-icon>`}};I0.styles=[ar,u7t];Ib([z()],I0.prototype,"size",void 0);Ib([z()],I0.prototype,"name",void 0);Ib([z()],I0.prototype,"imageSrc",void 0);Ib([z()],I0.prototype,"walletIcon",void 0);Ib([z({type:Boolean})],I0.prototype,"installed",void 0);Ib([z()],I0.prototype,"badgeSize",void 0);I0=Ib([pt("wui-wallet-image")],I0);const d7t=Gt` 2156 :host { 2157 position: relative; 2158 border-radius: ${({borderRadius:e})=>e[2]}; 2159 width: 40px; 2160 height: 40px; 2161 overflow: hidden; 2162 background: ${({tokens:e})=>e.theme.foregroundPrimary}; 2163 display: flex; 2164 justify-content: center;
2165 align-items: center; 2166 flex-wrap: wrap; 2167 column-gap: ${({spacing:e})=>e[1]}; 2168 padding: ${({spacing:e})=>e[1]}; 2169 } 2170 2171 :host > wui-wallet-image { 2172 width: 14px; 2173 height: 14px; 2174 border-radius: 2px; 2175 } 2176`;var REe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const wD=4;let B_=class extends ce{constructor(){super(...arguments),this.walletImages=[]}render(){const t=this.walletImages.length<wD;return j`${this.walletImages.slice(0,wD).map(({src:n,walletName:r})=>j` 2177 <wui-wallet-image 2178 size="sm" 2179 imageSrc=${n} 2180 name=${ge(r)} 2181 ></wui-wallet-image> 2182 `)} 2183 ${t?[...Array(wD-this.walletImages.length)].map(()=>j` <wui-wallet-image size="sm" name=""></wui-wallet-image>`):null} `}};B_.styles=[ar,d7t];REe([z({type:Array})],B_.prototype,"walletImages",void 0);B_=REe([pt("wui-all-wallets-image")],B_);const h7t=Gt` 2184 :host { 2185 display: flex; 2186 justify-content: center; 2187 align-items: center; 2188 gap: ${({spacing:e})=>e[1]}; 2189 text-transform: uppercase; 2190 white-space: nowrap; 2191 } 2192 2193 :host([data-variant='accent']) { 2194 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 2195 color: ${({tokens:e})=>e.core.textAccentPrimary}; 2196 } 2197 2198 :host([data-variant='info']) { 2199 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2200 color: ${({tokens:e})=>e.theme.textSecondary}; 2201 } 2202 2203 :host([data-variant='success']) { 2204 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 2205 color: ${({tokens:e})=>e.core.textSuccess}; 2206 } 2207 2208 :host([data-variant='warning']) { 2209 background-color: ${({tokens:e})=>e.core.backgroundWarning}; 2210 color: ${({tokens:e})=>e.core.textWarning}; 2211 } 2212 2213 :host([data-variant='error']) { 2214 background-color: ${({tokens:e})=>e.core.backgroundError}; 2215 color: ${({tokens:e})=>e.core.textError}; 2216 } 2217 2218 :host([data-variant='certified']) { 2219 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2220 color: ${({tokens:e})=>e.theme.textSecondary}; 2221 } 2222 2223 :host([data-size='md']) { 2224 height: 30px; 2225 padding: 0 ${({spacing:e})=>e[2]}; 2226 border-radius: ${({borderRadius:e})=>e[2]}; 2227 } 2228 2229 :host([data-size='sm']) { 2230 height: 20px; 2231 padding: 0 ${({spacing:e})=>e[1]}; 2232 border-radius: ${({borderRadius:e})=>e[1]}; 2233 } 2234`;var cP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let L5=class extends ce{constructor(){super(...arguments),this.variant="accent",this.size="md",this.icon=void 0}render(){this.dataset.variant=this.variant,this.dataset.size=this.size;const t=this.size==="md"?"md-medium":"sm-medium",n=this.size==="md"?"md":"sm";return j` 2235 ${this.icon?j`<wui-icon size=${n} name=${this.icon}></wui-icon>`:null} 2236 <wui-text 2237 display="inline" 2238 data-variant=${this.variant} 2239 variant=${t} 2240 color="inherit" 2241 > 2242 <slot></slot> 2243 </wui-text> 2244 `}};L5.styles=[ar,h7t];cP([z()],L5.prototype,"variant",void 0);cP([z()],L5.prototype,"size",void 0);cP([z()],L5.prototype,"icon",void 0);L5=cP([pt("wui-tag")],L5);const f7t=Gt` 2245 :host { 2246 width: 100%; 2247 } 2248 2249 button { 2250 column-gap: ${({spacing:e})=>e[2]}; 2251 padding: ${({spacing:e})=>e[3]}; 2252 width: 100%; 2253 background-color: transparent; 2254 border-radius: ${({borderRadius:e})=>e[4]}; 2255 color: ${({tokens:e})=>e.theme.textPrimary}; 2256 } 2257 2258 button > wui-wallet-image { 2259 background: ${({tokens:e})=>e.theme.foregroundSecondary}; 2260 } 2261 2262 button > wui-text:nth-child(2) { 2263 display: flex; 2264 flex: 1; 2265 } 2266 2267 button:hover:enabled { 2268 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2269 } 2270 2271 button[data-all-wallets='true'] { 2272 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2273 } 2274 2275 button[data-all-wallets='true']:hover:enabled { 2276 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2277 } 2278 2279 button:focus-visible:enabled { 2280 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2281 box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020}; 2282 } 2283 2284 button:disabled { 2285 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2286 opacity: 0.5;
2287 cursor: not-allowed; 2288 } 2289 2290 button:disabled > wui-tag { 2291 background-color: ${({tokens:e})=>e.core.glass010}; 2292 color: ${({tokens:e})=>e.theme.foregroundTertiary}; 2293 } 2294 2295 wui-flex.namespace-icon { 2296 width: 16px; 2297 height: 16px; 2298 border-radius: ${({borderRadius:e})=>e.round}; 2299 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2300 box-shadow: 0 0 0 2px ${({tokens:e})=>e.theme.backgroundPrimary}; 2301 transition: box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2); 2302 } 2303 2304 button:hover:enabled wui-flex.namespace-icon { 2305 box-shadow: 0 0 0 2px ${({tokens:e})=>e.theme.foregroundPrimary}; 2306 } 2307 2308 wui-flex.namespace-icon > wui-icon { 2309 width: 10px; 2310 height: 10px; 2311 } 2312 2313 wui-flex.namespace-icon:not(:first-child) { 2314 margin-left: -4px; 2315 } 2316`;var _c=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const p7t={eip155:"ethereum",solana:"solana",bip122:"bitcoin",polkadot:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:"ton",tron:"tron"};let No=class extends ce{constructor(){super(...arguments),this.walletImages=[],this.imageSrc="",this.name="",this.size="md",this.tabIdx=void 0,this.namespaces=[],this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100"}render(){return this.dataset.size=this.size,j` 2317 <button 2318 ?disabled=${this.disabled} 2319 data-all-wallets=${this.showAllWallets} 2320 tabindex=${ge(this.tabIdx)} 2321 > 2322 ${this.templateAllWallets()} ${this.templateWalletImage()} 2323 <wui-flex flexDirection="column" justifyContent="center" alignItems="flex-start" gap="1"> 2324 <wui-text variant="lg-regular" color="inherit">${this.name}</wui-text> 2325 ${this.templateNamespaces()} 2326 </wui-flex> 2327 ${this.templateStatus()} 2328 <wui-icon name="chevronRight" size="lg" color="default"></wui-icon> 2329 </button> 2330 `}templateNamespaces(){var t;return(t=this.namespaces)!=null&&t.length?j`<wui-flex alignItems="center" gap="0"> 2331 ${this.namespaces.map((n,r)=>{var s;return j`<wui-flex 2332 alignItems="center" 2333 justifyContent="center" 2334 zIndex=${(((s=this.namespaces)==null?void 0:s.length)??0)*2-r} 2335 class="namespace-icon" 2336 > 2337 <wui-icon 2338 name=${ge(p7t[n])} 2339 size="sm" 2340 color="default" 2341 ></wui-icon> 2342 </wui-flex>`})} 2343 </wui-flex>`:null}templateAllWallets(){return this.showAllWallets&&this.imageSrc?j` <wui-all-wallets-image .imageeSrc=${this.imageSrc}> </wui-all-wallets-image> `:this.showAllWallets&&this.walletIcon?j` <wui-wallet-image .walletIcon=${this.walletIcon} size="sm"> </wui-wallet-image> `:null}templateWalletImage(){return!this.showAllWallets&&this.imageSrc?j`<wui-wallet-image 2344 size=${ge(this.size==="sm"?"sm":"md")} 2345 imageSrc=${this.imageSrc} 2346 name=${this.name} 2347 ></wui-wallet-image>`:!this.showAllWallets&&!this.imageSrc?j`<wui-wallet-image size="sm" name=${this.name}></wui-wallet-image>`:null}templateStatus(){return this.loading?j`<wui-loading-spinner size="lg" color="accent-primary"></wui-loading-spinner>`:this.tagLabel&&this.tagVariant?j`<wui-tag size="sm" variant=${this.tagVariant}>${this.tagLabel}</wui-tag>`:null}};No.styles=[ar,ba,f7t];_c([z({type:Array})],No.prototype,"walletImages",void 0);_c([z()],No.prototype,"imageSrc",void 0);_c([z()],No.prototype,"name",void 0);_c([z()],No.prototype,"size",void 0);_c([z()],No.prototype,"tagLabel",void 0);_c([z()],No.prototype,"tagVariant",void 0);_c([z()],No.prototype,"walletIcon",void 0);_c([z()],No.prototype,"tabIdx",void 0);_c([z({type:Array})],No.prototype,"namespaces",void 0);_c([z({type:Boolean})],No.prototype,"disabled",void 0);_c([z({type:Boolean})],No.prototype,"showAllWallets",void 0);_c([z({type:Boolean})],No.prototype,"loading",void 0);_c([z({type:String})],No.prototype,"loadingSpinnerColor",void 0);No=_c([pt("wui-list-wallet")],No);var X6=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let xy=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=qe.state.connectors,this.count=De.state.count,this.filteredCount=De.state.filteredWallets.length,this.isFetchingRecommendedWallets=De.state.isFetchingRecommendedWallets,this.unsubscribe.push(qe.subscribeKey("connectors",t=>this.connectors=t),De.subscribeKey("count",t=>this.count=t),De.subscribeKey("filteredWallets",t=>this.filteredCount=t.length),De.subscribeKey("isFetchingRecommendedWallets",t=>this.isFetchingRecommendedWallets=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=this.connectors.find(l=>l.id==="walletConnect"),{allWallets:n}=ke.state;if(!t||n==="HIDE"||n==="ONLY_MOBILE"&&!Be.isMobile())return null;const r=De.state.featured.length,s=this.count+r,i=s<10?s:Math.floor(s/10)*10,o=this.filteredCount>0?this.filteredCount:i;let a=`${o}`;this.filteredCount>0?a=`${this.filteredCount}`:o<s&&(a=`${o}+`);const c=Ae.hasAnyConnection(ye.CONNECTOR_ID.WALLET_CONNECT);return j` 2348 <wui-list-wallet 2349 name="Search Wallet" 2350 walletIcon="search" 2351 showAllWallets 2352 @click=${this.onAllWallets.bind(this)} 2353 tagLabel=${a} 2354 tagVariant="info" 2355 data-testid="all-wallets" 2356 tabIdx=${ge(this.tabIdx)} 2357 .loading=${this.isFetchingRecommendedWallets} 2358 ?disabled=${c} 2359 size="sm" 2360 ></wui-list-wallet> 2361 `}onAllWallets(){var t;It.sendEvent({type:"track",event:"CLICK_ALL_WALLETS"}),fe.push("AllWallets",{redirectView:(t=fe.state.data)==null?void 0:t.redirectView})}};X6([z()],xy.prototype,"tabIdx",void 0);X6([se()],xy.prototype,"connectors",void 0);X6([se()],xy.prototype,"count",void 0);X6([se()],xy.prototype,"filteredCount",void 0);X6([se()],xy.prototype,"isFetchingRecommendedWallets",void 0);xy=X6([pt("w3m-all-wallets-widget")],xy);const g7t={EIP155:ye.CHAIN.EVM},m7t={NetworkImageIds:{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",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",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",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200","00000008819873e925422c1ff0f99f7c":"b3406e4a-bbfc-44fb-e3a6-89673c78b700","-239":"20f673c0-095e-49b2-07cf-eb5049dcf600","-3":"20f673c0-095e-49b2-07cf-eb5049dcf600","0x2b6653dc":"3502bb86-cc4e-420f-a387-59ea63a28b00","0x94a9059e":"3502bb86-cc4e-420f-a387-59ea63a28b00","0xcd8690dc":"3502bb86-cc4e-420f-a387-59ea63a28b00"}},BEe={getCaipTokens(e){if(!e)return;const t={};return Object.entries(e).forEach(([n,r])=>{t[`${g7t.EIP155}:${n}`]=r}),t},isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())},getActiveNamespaceConnectedToAuth(){const e=Q.state.activeChain;return ye.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(t=>qe.getConnectorId(t)===ye.CONNECTOR_ID.AUTH&&t===e)},withRetry({conditionFn:e,intervalMs:t,maxRetries:n}){let r=0;return new Promise(s=>{async function i(){return r+=1,await e()?s(!0):r>=n?s(!1):(setTimeout(i,t),null)}i()})},userChainIdToChainNamespace(e){if(typeof e=="number")return ye.CHAIN.EVM;const[t]=e.split(":");return t},getOtherAuthNamespaces(e){return e?ye.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(r=>r!==e):[]},getConnectorStorageInfo(e,t){const r=Ye.getConnections()[t]??[];return{hasDisconnected:Ye.isConnectorDisconnected(e,t),hasConnected:r.some(s=>BEe.isLowerCaseMatch(s.connectorId,e))}}},w7t="rpc.walletconnect.org";function bae(e,t){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",e),n.searchParams.set("projectId",t),n.toString()}const yD=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:
236156","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","eip155:80094","eip155:80069","eip155:560048","eip155:31","eip155:2818","eip155:57054","eip155:911867","eip155:534351","eip155:1112","eip155:534352","eip155:1111","eip155:146","eip155:130","eip155:1284","eip155:30","eip155:2810","eip155:55931","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],DEe={extendRpcUrlWithProjectId(e,t){let n=!1;try{n=new URL(e).host===w7t}catch{n=!1}if(n){const r=new URL(e);return r.searchParams.has("projectId")||r.searchParams.set("projectId",t),r.toString()}return e},isCaipNetwork(e){return"chainNamespace"in e&&"caipNetworkId"in e},getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:ye.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${ye.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,n){var s,i,o;const r=(o=(i=(s=e.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null?void 0:o[0];return yD.includes(t)?bae(t,n):r||""},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){var h,f,g,p,m,w,C;const s=this.getChainNamespace(e),i=this.getCaipNetworkId(e),o=(g=(f=(h=e.rpcUrls)==null?void 0:h.default)==null?void 0:f.http)==null?void 0:g[0],a=this.getDefaultRpcUrl(e,i,n),c=((w=(m=(
2361p=e==null?void 0:e.rpcUrls)==null?void 0:p.chainDefault)==null?void 0:m.http)==null?void 0:w[0])||o,l=((C=r==null?void 0:r[i])==null?void 0:C.map(E=>E.url))||[],u=[...l,...a?[a]:[]],d=[...l];return c&&!d.includes(c)&&d.push(c),{...e,chainNamespace:s,caipNetworkId:i,assets:{imageId:m7t.NetworkImageIds[e.id],imageUrl:t==null?void 0:t[e.id]},rpcUrls:{...e.rpcUrls,default:{http:u},chainDefault:{http:d}}}},extendCaipNetworks(e,{customNetworkImageUrls:t,projectId:n,customRpcUrls:r}){return e.map(s=>DEe.extendCaipNetwork(s,{customNetworkImageUrls:t,customRpcUrls:r,projectId:n}))},getViemTransport(e,t,n){var s,i,o;const r=[];return n==null||n.forEach(a=>{r.push(GE(a.url,a.config))}),yD.includes(e.caipNetworkId)&&r.push(GE(bae(e.caipNetworkId,t),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),(o=(i=(s=e==null?void 0:e.rpcUrls)==null?void 0:s.default)==null?void 0:i.http)==null||o.forEach(a=>{r.push(GE(a))}),fz(r)},extendWagmiTransports(e,t,n){if(yD.includes(e.caipNetworkId)){const r=this.getDefaultRpcUrl(e,e.caipNetworkId,t);return fz([n,GE(r)])}return n},getUnsupportedNetwork(e){return{id:e.split(":")[1],caipNetworkId:e,name:ye.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}},getCaipNetworkFromStorage(e){var c;const t=Ye.getActiveCaipNetworkId(),n=Q.getAllRequestedCaipNetworks(),r=Array.from(((c=Q.state.chains)==null?void 0:c.keys())||[]),s=t==null?void 0:t.split(":")[0],i=s?r.includes(s):!1,o=n==null?void 0:n.find(l=>l.caipNetworkId===t);return i&&!o&&t?this.getUnsupportedNetwork(t):o||e||(n==null?void 0:n[0])}},y7t=Gt` 2362 :host { 2363 margin-top: ${({spacing:e})=>e[1]}; 2364 } 2365 wui-separator { 2366 margin: ${({spacing:e})=>e[3]} calc(${({spacing:e})=>e[3]} * -1) 2367 ${({spacing:e})=>e[2]} calc(${({spacing:e})=>e[3]} * -1); 2368 width: calc(100% + ${({spacing:e})=>e[3]} * 2); 2369 } 2370`;var Q6=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Qm=class extends ce{constructor(){super(),this.unsubscribe=[],this.explorerWallets=De.state.explorerWallets,this.connections=Ae.state.connections,this.connectorImages=Ho.state.connectorImages,this.loadingTelegram=!1,this.unsubscribe.push(Ae.subscribeKey("connections",t=>this.connections=t),Ho.subscribeKey("connectorImages",t=>this.connectorImages=t),De.subscribeKey("explorerFilteredWallets",t=>{this.explorerWallets=t!=null&&t.length?t:De.state.explorerWallets}),De.subscribeKey("explorerWallets",t=>{var n;(n=this.explorerWallets)!=null&&n.length||(this.explorerWallets=t)})),Be.isTelegram()&&Be.isIos()&&(this.loadingTelegram=!Ae.state.wcUri,this.unsubscribe.push(Ae.subscribeKey("wcUri",t=>this.loadingTelegram=!t)))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return j` 2371 <wui-flex flexDirection="column" gap="2"> ${this.connectorListTemplate()} </wui-flex> 2372 `}connectorListTemplate(){return Wo.connectorList().map((t,n)=>t.kind==="connector"?this.renderConnector(t,n):this.renderWallet(t,n))}getConnectorNamespaces(t){var n;return t.subtype==="walletConnect"?[]:t.subtype==="multiChain"?((n=t.connector.connectors)==null?void 0:n.map(r=>r.chain))||[]:[t.connector.chain]}renderConnector(t,n){var d,h;const r=t.connector,s=wc.getConnectorImage(r)||this.connectorImages[(r==null?void 0:r.imageId)??""],o=(this.connections.get(r.chain)??[]).some(f=>BEe.isLowerCaseMatch(f.connectorId,r.id));let a,c;t.subtype==="walletConnect"?(a="qr code",c="accent"):t.subtype==="injected"||t.subtype==="announced"?(a=o?"connected":"installed",c=o?"info":"success"):(a=void 0,c=void 0);const l=Ae.hasAnyConnection(ye.CONNECTOR_ID.WALLET_CONNECT),u=t.subtype==="walletConnect"||t.subtype==="external"?l:!1;return j` 2373 <w3m-list-wallet 2374 displayIndex=${n} 2375 imageSrc=${ge(s)} 2376 .installed=${!0} 2377 name=${r.name??"Unknown"} 2378 .tagVariant=${c} 2379 tagLabel=${ge(a)} 2380 data-testid=${`wallet-selector-${r.id.toLowerCase()}`} 2381 size="sm" 2382 @click=${()=>this.onClickConnector(t)} 2383 tabIdx=${ge(this.tabIdx)} 2384 ?disabled=${u} 2385 rdnsId=${ge(((d=r.explorerWallet)==null?void 0:d.rdns)||void 0)} 2386 walletRank=${ge((h=r.explorerWallet)==null?void 0:h.order)} 2387 .namespaces=${this.getConnectorNamespaces(t)} 2388 > 2389 </w3m-list-wallet> 2390 `}onClickConnector(t){var r;const n=(r=fe.state.data)==null?void 0:r.redirectView;if(t.subtype==="walletConnect"){qe.setActiveConnector(t.connector),Be.isMobile()?fe.push("AllWallets"):fe.push("ConnectingWalletConnect",{redirectView:n});return}if(t.subtype==="multiChain"){qe.setActiveConnector(t.connector),fe.push("ConnectingMultiChain",{redirectView:n});return}if(t.subtype==="injected"){qe.setActiveConnector(t.connector),fe.push("ConnectingExter
2390nal",{connector:t.connector,redirectView:n,wallet:t.connector.explorerWallet});return}if(t.subtype==="announced"){if(t.connector.id==="walletConnect"){Be.isMobile()?fe.push("AllWallets"):fe.push("ConnectingWalletConnect",{redirectView:n});return}fe.push("ConnectingExternal",{connector:t.connector,redirectView:n,wallet:t.connector.explorerWallet});return}fe.push("ConnectingExternal",{connector:t.connector,redirectView:n})}renderWallet(t,n){const r=t.wallet,s=wc.getWalletImage(r),o=Ae.hasAnyConnection(ye.CONNECTOR_ID.WALLET_CONNECT),a=this.loadingTelegram,c=t.subtype==="recent"?"recent":void 0,l=t.subtype==="recent"?"info":void 0;return j` 2391 <w3m-list-wallet 2392 displayIndex=${n} 2393 imageSrc=${ge(s)} 2394 name=${r.name??"Unknown"} 2395 @click=${()=>this.onClickWallet(t)} 2396 size="sm" 2397 data-testid=${`wallet-selector-${r.id}`} 2398 tabIdx=${ge(this.tabIdx)} 2399 ?loading=${a} 2400 ?disabled=${o} 2401 rdnsId=${ge(r.rdns||void 0)} 2402 walletRank=${ge(r.order)} 2403 tagLabel=${ge(c)} 2404 .tagVariant=${l} 2405 > 2406 </w3m-list-wallet> 2407 `}onClickWallet(t){var i;const n=(i=fe.state.data)==null?void 0:i.redirectView,r=Q.state.activeChain;if(t.subtype==="featured"){qe.selectWalletConnector(t.wallet);return}if(t.subtype==="recent"){if(this.loadingTelegram)return;qe.selectWalletConnector(t.wallet);return}if(t.subtype==="custom"){if(this.loadingTelegram)return;fe.push("ConnectingWalletConnect",{wallet:t.wallet,redirectView:n});return}if(this.loadingTelegram)return;const s=r?qe.getConnector({id:t.wallet.id,namespace:r}):void 0;s?fe.push("ConnectingExternal",{connector:s,redirectView:n}):fe.push("ConnectingWalletConnect",{wallet:t.wallet,redirectView:n})}};Qm.styles=y7t;Q6([z({type:Number})],Qm.prototype,"tabIdx",void 0);Q6([se()],Qm.prototype,"explorerWallets",void 0);Q6([se()],Qm.prototype,"connections",void 0);Q6([se()],Qm.prototype,"connectorImages",void 0);Q6([se()],Qm.prototype,"loadingTelegram",void 0);Qm=Q6([pt("w3m-connector-list")],Qm);const b7t=Gt` 2408 :host { 2409 flex: 1; 2410 height: 100%; 2411 } 2412 2413 button { 2414 width: 100%; 2415 height: 100%; 2416 display: inline-flex; 2417 align-items: center; 2418 padding: ${({spacing:e})=>e[1]} ${({spacing:e})=>e[2]}; 2419 column-gap: ${({spacing:e})=>e[1]}; 2420 color: ${({tokens:e})=>e.theme.textSecondary}; 2421 border-radius: ${({borderRadius:e})=>e[20]}; 2422 background-color: transparent; 2423 transition: background-color ${({durations:e})=>e.lg} 2424 ${({easings:e})=>e["ease-out-power-2"]}; 2425 will-change: background-color; 2426 } 2427 2428 /* -- Hover & Active states ----------------------------------------------------------- */ 2429 button[data-active='true'] { 2430 color: ${({tokens:e})=>e.theme.textPrimary}; 2431 background-color: ${({tokens:e})=>e.theme.foregroundTertiary}; 2432 } 2433 2434 button:hover:enabled:not([data-active='true']), 2435 button:active:enabled:not([data-active='true']) { 2436 wui-text, 2437 wui-icon { 2438 color: ${({tokens:e})=>e.theme.textPrimary}; 2439 } 2440 } 2441`;var L$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const v7t={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},E7t={lg:"md",md:"sm",sm:"sm"};let Iy=class extends ce{constructor(){super(...arguments),this.icon="mobile",this.size="md",this.label="",this.active=!1}render(){return j` 2442 <button data-active=${this.active}> 2443 ${this.icon?j`<wui-icon size=${E7t[this.size]} name=${this.icon}></wui-icon>`:""} 2444 <wui-text variant=${v7t[this.size]}> ${this.label} </wui-text> 2445 </button> 2446 `}};Iy.styles=[ar,ba,b7t];L$([z()],Iy.prototype,"icon",void 0);L$([z()],Iy.prototype,"size",void 0);L$([z()],Iy.prototype,"label",void 0);L$([z({type:Boolean})],Iy.prototype,"active",void 0);Iy=L$([pt("wui-tab-item")],Iy);const C7t=Gt` 2447 :host { 2448 display: inline-flex; 2449 align-items: center; 2450 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2451 border-radius: ${({borderRadius:e})=>e[32]}; 2452 padding: ${({spacing:e})=>e["01"]}; 2453 box-sizing: border-box; 2454 } 2455 2456 :host([data-size='sm']) {
2457 height: 26px; 2458 } 2459 2460 :host([data-size='md']) { 2461 height: 36px; 2462 } 2463`;var M$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Sy=class extends ce{constructor(){super(...arguments),this.tabs=[],this.onTabChange=()=>null,this.size="md",this.activeTab=0}render(){return this.dataset.size=this.size,this.tabs.map((t,n)=>{var s;const r=n===this.activeTab;return j` 2464 <wui-tab-item 2465 @click=${()=>this.onTabClick(n)} 2466 icon=${t.icon} 2467 size=${this.size} 2468 label=${t.label} 2469 ?active=${r} 2470 data-active=${r} 2471 data-testid="tab-${(s=t.label)==null?void 0:s.toLowerCase()}" 2472 ></wui-tab-item> 2473 `})}onTabClick(t){this.activeTab=t,this.onTabChange(t)}};Sy.styles=[ar,ba,C7t];M$([z({type:Array})],Sy.prototype,"tabs",void 0);M$([z()],Sy.prototype,"onTabChange",void 0);M$([z()],Sy.prototype,"size",void 0);M$([se()],Sy.prototype,"activeTab",void 0);Sy=M$([pt("wui-tabs")],Sy);var MK=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let D_=class extends ce{constructor(){super(...arguments),this.platformTabs=[],this.unsubscribe=[],this.platforms=[],this.onSelectPlatfrom=void 0}disconnectCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=this.generateTabs();return j` 2474 <wui-flex justifyContent="center" .padding=${["0","0","4","0"]}> 2475 <wui-tabs .tabs=${t} .onTabChange=${this.onTabChange.bind(this)}></wui-tabs> 2476 </wui-flex> 2477 `}generateTabs(){const t=this.platforms.map(n=>n==="browser"?{label:"Browser",icon:"extension",platform:"browser"}:n==="mobile"?{label:"Mobile",icon:"mobile",platform:"mobile"}:n==="qrcode"?{label:"Mobile",icon:"mobile",platform:"qrcode"}:n==="web"?{label:"Webapp",icon:"browser",platform:"web"}:n==="desktop"?{label:"Desktop",icon:"desktop",platform:"desktop"}:{label:"Browser",icon:"extension",platform:"unsupported"});return this.platformTabs=t.map(({platform:n})=>n),t}onTabChange(t){var r;const n=this.platformTabs[t];n&&((r=this.onSelectPlatfrom)==null||r.call(this,n))}};MK([z({type:Array})],D_.prototype,"platforms",void 0);MK([z()],D_.prototype,"onSelectPlatfrom",void 0);D_=MK([pt("w3m-connecting-header")],D_);const $7t=Xe` 2478 :host { 2479 display: flex; 2480 } 2481 2482 :host([data-size='sm']) > svg { 2483 width: 12px; 2484 height: 12px; 2485 } 2486 2487 :host([data-size='md']) > svg { 2488 width: 16px; 2489 height: 16px; 2490 } 2491 2492 :host([data-size='lg']) > svg { 2493 width: 24px; 2494 height: 24px; 2495 } 2496 2497 :host([data-size='xl']) > svg { 2498 width: 32px; 2499 height: 32px; 2500 } 2501 2502 svg { 2503 animation: rotate 1.4s linear infinite; 2504 color: var(--local-color); 2505 } 2506 2507 :host([data-size='md']) > svg > circle { 2508 stroke-width: 6px; 2509 } 2510 2511 :host([data-size='sm']) > svg > circle { 2512 stroke-width: 8px; 2513 } 2514 2515 @keyframes rotate { 2516 100% { 2517 transform: rotate(360deg); 2518 } 2519 } 2520`;var jK=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let U4=class extends ce{constructor(){super(...arguments),this.color="primary",this.size="lg"}render(){const t={primary:gr.tokens.theme.textPrimary,secondary:gr.tokens.theme.textSecondary,tertiary:gr.tokens.theme.textTertiary,invert:gr.tokens.theme.textInvert,error:gr.tokens.core.textError,warning:gr.tokens.core.textWarning,"accent-primary":gr.tokens.core.textAccentPrimary};return this.style.cssText=` 2521 --local-color: ${this.color==="inherit"?"inherit":t[this.color]}; 2522 `,this.dataset.size=this.size,j`<svg viewBox="0 0 16 17" fill="none"> 2523 <path 2524 d="M8.75 2.65625V4.65625C8.75 4.85516 8.67098 5.04593 8.53033 5.18658C8.38968 5.32723 8.19891 5.40625 8 5.40625C7.80109 5.40625 7.61032 5.32723 7.46967 5.18658C7.32902 5.04593 7.25 4.85516 7.25 4.65625V2.65625C7.25 2.45734 7.32902 2.26657 7.46967 2.12592C7.61032 1.98527 7.80109 1.90625 8 1.90625C8.19891 1.90625 8.38968 1.98527 8.53033 2.12592C8.67098 2.26657 8.75 2.45734 8.75 2.65625ZM14 7.90625H12C11.8011 7.90625 11.6103 7.98527 11.4697 8.12592C11.329 8.26657 11.25 8.45734 11.25 8.65625C11.25 8.85516 11.329 9.04593 11.4697 9.18658C11.6103 9.32723 11.8011 9.40625 12 9.40625H14C14.1989 9.40625 14.3897 9.32723 14.5303 9.18658C14.671 9.04593 14.75 8.85516 14.75 8.65625C14.75 8.45734 14.671 8.26657 14.5303 8.12592C14.3897 7.98527 14.1989 7.90625 14 7.90625ZM11.3588 10.9544C11.289 10.8846 11.2062 10.8293 11.115 10.7915C11.0239 10.7538 10.9262 10.7343 10.8275 10.7343C10.7288 10.7343 10.6311 10.7538 10.54 10.7915C10.4488 10.8293 10.366 10.8846 10.2963 10.9544C10.2265 11.0241 10.1711 11.107 10.1334 11.1981C10.0956 11.2893 10.0762 11.387 10.0762 11.4856C10.0762 11.5843 10.0956 11.682 10.1334 11.7731C10.1711 11.8643 10.2265 11.9471 10.2963 12.0169L11.7106 13.4312C11.8515 13.5721 12.0426 13.6513 12.2419 13.6513C12.4411 13.6513 12.6322 13.5721 12.7731 13.4312C12.914 13.2904 12.9932 13.0993 12.9932 12.9C12.9932 12.7007 12.914 12.5096 12.7731 12.3687L11.3588 10.9544ZM8 11.9062C7.80109 11.9062 7.61032 11.9853 7.46967 12.1259C7.32902 12.2666 7.25 12.4573 7.25 12.6562V14.6562C7.25 14.8552 7.32902 15.0459 7.46967 15.1866C7.61032 15.3272 7.80109 15.4062 8 15.4062C8.19891 15.4062 8.38968 15.3272 8.53033 15.1866C8.67098 15.0459 8.75 14.8552 8.75 14.6562V12.6562C8.75 12.4573 8.67098 12.2666 8.53033 12.1259C8.38968 11.9853 8.19891 11.9062 8 11.9062ZM4.64125 10.9544L3.22688 12.3687C3.08598 12.5096 3.00682 12.7007 3.00682 12.9C3.00682 13.0993 3.08598 13.2904 3.22688 13.4312C3.36777 13.5721 3.55887 13.6513 3.75813 13.6513C3.95738 13.6513 4.14848 13.5721 4.28937 13.4312L5.70375 12.0169C5.84465 11.876 5.9238 11.6849 5.9238 11.4856C5.9238 11.2864 5.84465 11.0953 5.70375 10.9544C5.56285 10.8135 5.37176 10.7343 5.1725 10.7343C4.97324 10.7343 4.78215 10.8135 4.64125 10.9544ZM4.75 8.65625C4.75 8.45734 4.67098 8.26657 4.53033 8.12592C4.38968 7.98527 4.19891 7.90625 4 7.90625H2C1.80109 7.90625 1.61032 7.98527 1.46967 8.12592C1.32902 8.26657 1.25 8.45734 1.25 8.65625C1.25 8.85516 1.32902 9.04593 1.46967 9.18658C1.61032 9.32723 1.80109 9.40625 2 9.40625H4C4.19891 9.40625 4.38968 9.32723 4.53033 9.18658C4.67098 9.04593 4.75 8.85516 4.75 8.65625ZM4.2875 3.88313C4.1466 3.74223 3.95551 3.66307 3.75625 3.66307C3.55699 3.66307 3.3659 3.74223 3.225 3.88313C3.0841 4.02402 3.00495 4.21512 3.00495 4.41438C3.00495 4.61363 3.0841 4.80473 3.225 4.94562L4.64125 6.35813C4.78215 6.49902 4.97324 6.57818 5.1725 6.57818C5.37176 6.57818 5.56285 6.49902 5.70375 6.35813C5.84465 6.21723 5.9238 6.02613 5.9238 5.82688C5.9238 5.62762 5.84465 5.43652 5.70375 5.29563L4.2875 3.88313Z" 2525 fill="currentColor" 2526 /> 2527 </svg>`}};U4.styles=[ar,$7t];jK([z()],U4.prototype,"color",void 0);jK([z()],U4.prototype,"size",void 0);U4=jK([pt("wui-loading-spinner")],U4);const x7t=Gt` 2528 :host { 2529 width: var(--local-width); 2530 } 2531 2532 button { 2533 width: var(--local-width); 2534 white-space: nowrap; 2535 column-gap: ${({spacing:e})=>e[2]}; 2536 transition: 2537 scale ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-1"]}, 2538 background-color ${({durations:e})=>e.lg} 2539 ${({easings:e})=>e["ease-out-power-2"]}, 2540 border-radius ${({durations:e})=>e.lg} 2541 ${({easings:e})=>e["ease-out-power-1"]}; 2542 will-change: scale, background-color, border-radius; 2543 cursor: pointer; 2544 } 2545 2546 /* -- Sizes --------------------------------------------------- */ 2547 button[data-size='sm'] { 2548 border-radius: ${({borderRadius:e})=>e[2]}; 2549 padding: 0 ${({spacing:e})=>e[2]}; 2550 height: 28px; 2551 } 2552 2553 button[data-size='md'] { 2554 border-radius: ${({borderRadius:e})=>e[3]}; 2555 padding: 0 ${({spacing:e})=>e[4]}; 2556 height: 38px; 2557 } 2558 2559 button[data-size='lg'] { 2560 border-radius: ${({borderRadius:e})=>e[4]}; 2561 padding: 0 ${({spacing:e})=>e[5]}; 2562 height: 48px; 2563 } 2564 2565 /* -- Variants --------------------------------------------------------- */ 2566 button[data-variant='accent-primary'] { 2567 background-color: ${({tokens:e})=>e.core.backgroundAccentPrimary}; 2568 color: ${({tokens:e})=>e.theme.textInvert}; 2569 } 2570 2571 button[data-variant='accent-secondary'] { 2572 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 2573 color: ${({tokens:e})=>e.core.textAccentPrimary}; 2574 } 2575 2576 button[data-variant='neutral-primary'] { 2577 background-color: ${({tokens:e})=>e.theme.backgroundInvert}; 2578 color: ${({tokens:e})=>e.theme.textInvert}; 2579 } 2580 2581 button[data-variant='neutral-secondary'] { 2582 background-color: transparent; 2583 border: 1px solid ${({tokens:e})=>e.theme.borderSecondary}; 2584 color: ${({tokens:e})=>e.theme.textPrimary}; 2585 } 2586 2587 button[data-variant='neutral-tertiary'] { 2588 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2589 color: ${({tokens:e})=>e.theme.textPrimary}; 2590 } 2591 2592 button[data-variant='error-primary'] { 2593 background-color: ${({tokens:e})=>e.core.textError}; 2594 color: ${({tokens:e})=>e.theme.textInvert}; 2595 } 2596 2597 button[data-variant='error-secondary'] { 2598 background-color: ${({tokens:e})=>e.core.backgroundError}; 2599 color: ${({tokens:e})=>e.core.textError}; 2600 } 2601 2602 button[data-variant='shade'] { 2603 background: var(--wui-color-gray-glass-002); 2604 color: var(--wui-color-fg-200); 2605 border: none; 2606 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 2607 } 2608 2609 /* -- Focus states --------------------------------------------------- */ 2610 button[data-size='sm']:focus-visible:enabled { 2611 border-radius: 28px; 2612 } 2613 2614 button[data-size='md']:focus-visible:enabled { 2615 border-radius: 38px; 2616 } 2617 2618 button[data-size='lg']:focus-visible:enabled { 2619 border-radius: 48px; 2620 } 2621 button[data-variant='shade']:focus-visible:enabled { 2622 background: var(--wui-color-gray-glass-005); 2623 box-shadow: 2624 inset 0 0 0 1px var(--wui-color-gray-glass-010), 2625 0 0 0 4px var(--wui-color-gray-glass-002); 2626 } 2627 2628 /* -- Hover & Active states ----------------------------------------------------------- */ 2629 @media (hover: hover) { 2630 button[data-size='sm']:hover:enabled { 2631 border-radius: 28px; 2632 } 2633 2634 button[data-size='md']:hover:enabled { 2635 border-radius: 38px; 2636 } 2637 2638 button[data-size='lg']:hover:enabled { 2639 border-radius: 48px; 2640 } 2641 2642 button[data-variant='shade']:hover:enabled { 2643 background: var(--wui-color-gray-glass-002); 2644 } 2645 2646 button[data-variant='shade']:active:enabled { 2647 background: var(--wui-color-gray-glass-005); 2648 } 2649 } 2650 2651 button[data-size='sm']:active:enabled { 2652 border-radius: 28px; 2653 } 2654 2655 button[data-size='md']:active:enabled { 2656 border-radius: 38px; 2657 } 2658 2659 button[data-size='lg']:active:enabled { 2660 border-radius: 48px; 2661 } 2662 2663 /* -- Disabled states --------------------------------------------------- */ 2664 button:disabled { 2665 opacity: 0.3; 2666 } 2667`;var Sb=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const I7t={lg:"lg-regular-mono",md:"md-regular-mono",sm:"sm-regular-mono"},S7t={lg:"md",md:"md",sm:"sm"};let S0=class extends ce{constructor(){super(...arguments),this.size="lg",this.disabled=!1,this.fullWidth=!1,this.loading=!1,this.variant="accent-primary"}render(){this.style.cssText=` 2668 --local-width: ${this.fullWidth?"100%":"auto"}; 2669 `;const t=this.textVariant??I7t[this.size];return j` 2670 <button data-variant=${this.variant} data-size=${this.size} ?disabled=${this.disabled}> 2671 ${this.loadingTemplate()} 2672 <slot name="iconLeft"></slot> 2673 <wui-text variant=${t} color="inherit"> 2674 <slot></slot> 2675 </wui-text> 2676 <slot name="iconRight"></slot> 2677 </button> 2678 `}loadingTemplate(){if(this.loading){const t=S7t[this.size],n=this.variant==="neutral-primary"||this.variant==="accent-primary"?"invert":"primary";return j`<wui-loading-spinner color=${n} size=${t}></wui-loading-spinner>`}return null}};S0.styles=[ar,ba,x7t];Sb([z()],S0.prototype,"size",void 0);Sb([z({type:Boolean})],S0.prototype,"disabled",void 0);Sb([z({type:Boolean})],S0.prototype,"fullWidth",void 0);Sb([z({type:Boolean})],S0.prototype,"loading",void 0);Sb([z()],S0.prototype,"variant",void 0);Sb([z()],S0.prototype,"textVariant",void 0);S0=Sb([pt("wui-button")],S0);const A7t=Gt` 2679 button { 2680 border: none; 2681 background: transparent; 2682 height: 20px; 2683 padding: ${({spacing:e})=>e[2]}; 2684 column-gap: ${({spacing:e})=>e[1]}; 2685 border-radius: ${({borderRadius:e})=>e[1]}; 2686 padding: 0 ${({spacing:e})=>e[1]}; 2687 border-radius: ${({spacing:e})=>e[1]}; 2688 } 2689 2690 /* -- Variants --------------------------------------------------------- */ 2691 button[data-variant='accent'] { 2692 color: ${({tokens:e})=>e.core.textAccentPrimary}; 2693 } 2694 2695 button[data-variant='secondary'] { 2696 color: ${({tokens:e})=>e.theme.textSecondary}; 2697 } 2698 2699 /* -- Focus states --------------------------------------------------- */ 2700 button:focus-visible:enabled { 2701 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 2702 } 2703 2704 button[data-variant='accent']:focus-visible:enabled { 2705 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 2706 } 2707 2708 button[data-variant='secondary']:focus-visible:enabled { 2709 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2710 } 2711 2712 /* -- Hover & Active states ----------------------------------------------------------- */ 2713 button[data-variant='accent']:hover:enabled { 2714 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 2715 } 2716 2717 button[data-variant='secondary']:hover:enabled { 2718 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2719 } 2720 2721 button[data-variant='accent']:focus-visible { 2722 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 2723 } 2724 2725 button[data-variant='secondary']:focus-visible { 2726 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 2727 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 2728 } 2729 2730 button[disabled] { 2731 opacity: 0.5;
2732 cursor: not-allowed; 2733 } 2734`;var j$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const _7t={sm:"sm-medium",md:"md-medium"},N7t={accent:"accent-primary",secondary:"secondary"};let Ay=class extends ce{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.variant="accent",this.icon=void 0}render(){return j` 2735 <button ?disabled=${this.disabled} data-variant=${this.variant}> 2736 <slot name="iconLeft"></slot> 2737 <wui-text 2738 color=${N7t[this.variant]} 2739 variant=${_7t[this.size]} 2740 > 2741 <slot></slot> 2742 </wui-text> 2743 ${this.iconTemplate()} 2744 </button> 2745 `}iconTemplate(){return this.icon?j`<wui-icon name=${this.icon} size="sm"></wui-icon>`:null}};Ay.styles=[ar,ba,A7t];j$([z()],Ay.prototype,"size",void 0);j$([z({type:Boolean})],Ay.prototype,"disabled",void 0);j$([z()],Ay.prototype,"variant",void 0);j$([z()],Ay.prototype,"icon",void 0);Ay=j$([pt("wui-link")],Ay);const T7t=Gt` 2746 :host { 2747 display: block; 2748 width: 100px; 2749 height: 100px; 2750 } 2751 2752 svg { 2753 width: 100px; 2754 height: 100px; 2755 } 2756 2757 rect { 2758 fill: none; 2759 stroke: ${e=>e.colors.accent100}; 2760 stroke-width: 3px; 2761 stroke-linecap: round; 2762 animation: dash 1s linear infinite; 2763 } 2764 2765 @keyframes dash { 2766 to { 2767 stroke-dashoffset: 0px; 2768 } 2769 } 2770`;var UEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let U_=class extends ce{constructor(){super(...arguments),this.radius=36}render(){return this.svgLoaderTemplate()}svgLoaderTemplate(){const t=this.radius>50?50:this.radius,r=36-t,s=116+r,i=245+r,o=360+r*1.75;return j` 2771 <svg viewBox="0 0 110 110" width="110" height="110"> 2772 <rect 2773 x="2" 2774 y="2" 2775 width="106" 2776 height="106" 2777 rx=${t} 2778 stroke-dasharray="${s} ${i}" 2779 stroke-dashoffset=${o} 2780 /> 2781 </svg> 2782 `}};U_.styles=[ar,T7t];UEe([z({type:Number})],U_.prototype,"radius",void 0);U_=UEe([pt("wui-loading-thumbnail")],U_);const P7t=Gt` 2783 wui-flex { 2784 width: 100%; 2785 height: 52px; 2786 box-sizing: border-box; 2787 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 2788 border-radius: ${({borderRadius:e})=>e[5]}; 2789 padding-left: ${({spacing:e})=>e[3]}; 2790 padding-right: ${({spacing:e})=>e[3]}; 2791 display: flex; 2792 align-items: center; 2793 justify-content: space-between; 2794 gap: ${({spacing:e})=>e[6]}; 2795 } 2796 2797 wui-text { 2798 color: ${({tokens:e})=>e.theme.textSecondary}; 2799 } 2800 2801 wui-icon { 2802 width: 12px; 2803 height: 12px; 2804 } 2805`;var lP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let M5=class extends ce{constructor(){super(...arguments),this.disabled=!1,this.label="",this.buttonLabel=""}render(){return j` 2806 <wui-flex justifyContent="space-between" alignItems="center"> 2807 <wui-text variant="lg-regular" color="inherit">${this.label}</wui-text> 2808 <wui-button variant="accent-secondary" size="sm"> 2809 ${this.buttonLabel} 2810 <wui-icon name="chevronRight" color="inherit" size="inherit" slot="iconRight"></wui-icon> 2811 </wui-button> 2812 </wui-flex> 2813 `}};M5.styles=[ar,ba,P7t];lP([z({type:Boolean})],M5.prototype,"disabled",void 0);lP([z()],M5.prototype,"label",void 0);lP([z()],M5.prototype,"buttonLabel",void 0);M5=lP([pt("wui-cta-button")],M5);const O7t=Gt` 2814 :host { 2815 display: block; 2816 padding: 0 ${({spacing:e})=>e[5]} ${({spacing:e})=>e[5]}; 2817 } 2818`;var LEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let L_=class extends ce{constructor(){super(...arguments),this.wallet=void 0}
2818render(){if(!this.wallet)return this.style.display="none",null;const{name:t,app_store:n,play_store:r,chrome_store:s,homepage:i}=this.wallet,o=Be.isMobile(),a=Be.isIos(),c=Be.isAndroid(),l=[n,r,i,s].filter(Boolean).length>1,u=Xs.getTruncateString({string:t,charsStart:12,charsEnd:0,truncate:"end"});return l&&!o?j` 2819 <wui-cta-button 2820 label=${`Don't have ${u}?`} 2821 buttonLabel="Get" 2822 @click=${()=>fe.push("Downloads",{wallet:this.wallet})} 2823 ></wui-cta-button> 2824 `:!l&&i?j` 2825 <wui-cta-button 2826 label=${`Don't have ${u}?`} 2827 buttonLabel="Get" 2828 @click=${this.onHomePage.bind(this)} 2829 ></wui-cta-button> 2830 `:n&&a?j` 2831 <wui-cta-button 2832 label=${`Don't have ${u}?`} 2833 buttonLabel="Get" 2834 @click=${this.onAppStore.bind(this)} 2835 ></wui-cta-button> 2836 `:r&&c?j` 2837 <wui-cta-button 2838 label=${`Don't have ${u}?`} 2839 buttonLabel="Get" 2840 @click=${this.onPlayStore.bind(this)} 2841 ></wui-cta-button> 2842 `:(this.style.display="none",null)}onAppStore(){var t;(t=this.wallet)!=null&&t.app_store&&Be.openHref(this.wallet.app_store,"_blank")}onPlayStore(){var t;(t=this.wallet)!=null&&t.play_store&&Be.openHref(this.wallet.play_store,"_blank")}onHomePage(){var t;(t=this.wallet)!=null&&t.homepage&&Be.openHref(this.wallet.homepage,"_blank")}};L_.styles=[O7t];LEe([z({type:Object})],L_.prototype,"wallet",void 0);L_=LEe([pt("w3m-mobile-download-links")],L_);const k7t=Gt` 2843 @keyframes shake { 2844 0% { 2845 transform: translateX(0); 2846 } 2847 25% { 2848 transform: translateX(3px); 2849 } 2850 50% { 2851 transform: translateX(-3px); 2852 } 2853 75% { 2854 transform: translateX(3px); 2855 } 2856 100% { 2857 transform: translateX(0); 2858 } 2859 } 2860 2861 wui-flex:first-child:not(:only-child) { 2862 position: relative; 2863 } 2864 2865 wui-wallet-image { 2866 width: 56px; 2867 height: 56px; 2868 } 2869 2870 wui-loading-thumbnail { 2871 position: absolute; 2872 } 2873 2874 wui-icon-box { 2875 position: absolute; 2876 right: calc(${({spacing:e})=>e[1]} * -1); 2877 bottom: calc(${({spacing:e})=>e[1]} * -1); 2878 opacity: 0; 2879 transform: scale(0.5); 2880 transition-property: opacity, transform; 2881 transition-duration: ${({durations:e})=>e.lg}; 2882 transition-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 2883 will-change: opacity, transform; 2884 } 2885 2886 wui-text[align='center'] { 2887 width: 100%; 2888 padding: 0px ${({spacing:e})=>e[4]}; 2889 } 2890 2891 [data-error='true'] wui-icon-box { 2892 opacity: 1; 2893 transform: scale(1); 2894 } 2895 2896 [data-error='true'] > wui-flex:first-child { 2897 animation: shake 250ms ${({easings:e})=>e["ease-out-power-2"]} both; 2898 } 2899 2900 [data-retry='false'] wui-link { 2901 display: none; 2902 } 2903 2904 [data-retry='true'] wui-link { 2905 display: block; 2906 opacity: 1; 2907 } 2908 2909 w3m-mobile-download-links { 2910 padding: 0px; 2911 width: 100%; 2912 } 2913`;var ah=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let ao=class extends ce{constructor(){var t,n,r,s,i;super(),this.wallet=(t=fe.state.data)==null?void 0:t.wallet,this.connector=(n=fe.state.data)==null?void 0:n.connector,this.timeout=void 0,this.secondaryBtnIcon="refresh",this.onConnect=void 0,this.onRender=void 0,this.onAutoConnect=void 0,this.isWalletConnect=!0,this.unsubscribe=[],this.imageSrc=wc.getConnectorImage(this.connector)??wc.getWalletImage(this.wallet),this.name=((r=this.wallet)==null?void 0:r.name)??((s=this.connector)==null?void 0:s.name)??"Wallet",this.isRetrying=!1,this.uri=Ae.state.wcUri,this.error=Ae.state.wcError,this.ready=!1,this.showRetry=!1,this.label=void 0,this.secondaryBtnLabel="Try again",this.secondaryLabel="Accept connection request in the wallet",this.isLoading=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(Ae.subscribeKey("wcUri",o=>{var a;this.uri=o,this.isRetrying&&this.onRetry&&(this.isRetrying=!1,(a=this.onConnect)==null||a.call(this))}),Ae.subscribeKey("wcError",o=>this.error=o)),(Be.isTelegram()||Be.isSafari())&&Be.isIos()&&Ae.state.wcUri&&((i=this.onConnect)==null||i.call(this))}firstUpdated(){var t;(t=this.onAutoConnect)==null||t.call(this),this.showRetry=!this.onAutoConnect}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),Ae.setWcError(!1),clearTimeout(this.timeout)}render(){var r;(r=this.onRender)==null||r.call(this),this.onShowRetry();const t=this.error?"Connection can be declined if a previous request is still active":this.secondaryLabel;let n="";return this.label?n=this.label:(n=`Continue in ${this.name}`,this.error&&(n="Connection declined")),j` 2914 <wui-flex 2915 data-error=${ge(this.error)} 2916 data-retry=${this.showRetry} 2917 flexDirection="column" 2918 alignItems="center" 2919 .padding=${["10","5","5","5"]} 2920 gap="6" 2921 > 2922 <wui-flex gap="2" justifyContent="center" alignItems="center"> 2923 <wui-wallet-image size="lg" imageSrc=${ge(this.imageSrc)}></wui-wallet-image> 2924 2925 ${this.error?null:this.loaderTemplate()} 2926 2927 <wui-icon-box 2928 color="error" 2929 icon="close" 2930 size="sm" 2931 border 2932 borderColor="wui-color-bg-125" 2933 ></wui-icon-box> 2934 </wui-flex> 2935 2936 <wui-flex flexDirection="column" alignItems="center" gap="6"> <wui-flex 2937 flexDirection="column" 2938 alignItems="center" 2939 gap="2" 2940 .padding=${["2","0","0","0"]} 2941 > 2942 <wui-text align="center" variant="lg-medium" color=${this.error?"error":"primary"}> 2943 ${n} 2944 </wui-text> 2945 <wui-text align="center" variant="lg-regular" color="secondary">${t}</wui-text> 2946 </wui-flex> 2947 2948 ${this.secondaryBtnLabel?j` 2949 <wui-button 2950 variant="neutral-secondary" 2951 size="md" 2952 ?disabled=${this.isRetrying||this.isLoading} 2953 @click=${this.onTryAgain.bind(this)} 2954 data-testid="w3m-connecting-widget-secondary-button" 2955 > 2956 <wui-icon 2957 color="inherit" 2958 slot="iconLeft" 2959 name=${this.secondaryBtnIcon} 2960 ></wui-icon> 2961 ${this.secondaryBtnLabel} 2962 </wui-button>
2962 2963 `:null} 2964 </wui-flex> 2965 2966 ${this.isWalletConnect?j` 2967 <wui-flex .padding=${["0","5","5","5"]} justifyContent="center"> 2968 <wui-link 2969 @click=${this.onCopyUri} 2970 variant="secondary" 2971 icon="copy" 2972 data-testid="wui-link-copy" 2973 > 2974 Copy link 2975 </wui-link> 2976 </wui-flex> 2977 `:null} 2978 2979 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links></wui-flex> 2980 </wui-flex> 2981 `}onShowRetry(){var t;if(this.error&&!this.showRetry){this.showRetry=!0;const n=(t=this.shadowRoot)==null?void 0:t.querySelector("wui-button");n==null||n.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}onTryAgain(){var t,n;Ae.setWcError(!1),this.onRetry?(this.isRetrying=!0,(t=this.onRetry)==null||t.call(this)):(n=this.onConnect)==null||n.call(this)}loaderTemplate(){const t=Zp.state.themeVariables["--w3m-border-radius-master"],n=t?parseInt(t.replace("px",""),10):4;return j`<wui-loading-thumbnail radius=${n*9}></wui-loading-thumbnail>`}onCopyUri(){try{this.uri&&(Be.copyToClopboard(this.uri),Xn.showSuccess("Link copied"))}catch{Xn.showError("Failed to copy")}}};ao.styles=k7t;ah([se()],ao.prototype,"isRetrying",void 0);ah([se()],ao.prototype,"uri",void 0);ah([se()],ao.prototype,"error",void 0);ah([se()],ao.prototype,"ready",void 0);ah([se()],ao.prototype,"showRetry",void 0);ah([se()],ao.prototype,"label",void 0);ah([se()],ao.prototype,"secondaryBtnLabel",void 0);ah([se()],ao.prototype,"secondaryLabel",void 0);ah([se()],ao.prototype,"isLoading",void 0);ah([z({type:Boolean})],ao.prototype,"isMobile",void 0);ah([z()],ao.prototype,"onRetry",void 0);var R7t=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let vae=class extends ao{constructor(){var t;if(super(),!this.wallet)throw new Error("w3m-connecting-wc-browser: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),It.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser",displayIndex:(t=this.wallet)==null?void 0:t.display_index,walletRank:this.wallet.order,view:fe.state.view}})}async onConnectProxy(){try{this.error=!1;const{connectors:t}=qe.state,n=t.find(r=>{var s,i,o;return r.type==="ANNOUNCED"&&((s=r.info)==null?void 0:s.rdns)===((i=this.wallet)==null?void 0:i.rdns)||r.type==="INJECTED"||r.name===((o=this.wallet)==null?void 0:o.name)});if(n)await Ae.connectExternal(n,n.chain);else throw new Error("w3m-connecting-wc-browser: No connector found");Zt.close()}catch(t){t instanceof U5&&t.originalName===Ed.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST?It.sendEvent({type:"track",event:"USER_REJECTED",properties:{message:t.message}}):It.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(t==null?void 0:t.message)??"Unknown"}}),this.error=!0}}};vae=R7t([pt("w3m-connecting-wc-browser")],vae);var B7t=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Eae=class extends ao{constructor(){var t;if(super(),!this.wallet)throw new Error("w3m-connecting-wc-desktop: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onRender=this.onRenderProxy.bind(this),It.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"desktop",displayIndex:(t=this.wallet)==null?void 0:t.display_index,walletRank:this.wallet.order,view:fe.state.view}})}onRenderProxy(){var t;!this.ready&&this.uri&&(this.ready=!0,(t=this.onConnect)==null||t.call(this))}onConnectProxy(){var t;if((t=this.wallet)!=null&&t.desktop_link&&this.uri)try{this.error=!1;const{desktop_link:n,name:r}=this.wallet,{redirect:s,href:i}=Be.formatNativeUrl(n,this.uri);Ae.setWcLinking({name:r,href:i}),Ae.setRecentWallet(this.wallet),Be.openHref(s,"_blank")}catch{this.error=!0}}};Eae=B7t([pt("w3m-connecting-wc-desktop")],Eae);var e3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let _y=class extends ao{constructor(){var t;if(super(),this.btnLabelTimeout=void 0,this.redirectDeeplink=void 0,this.redirectUniversalLink=void 0,this.target=void 0,this.preferUniversalLinks=ke.state.experimental_preferUniversalLinks,this.isLoading=!0,this.onConnect=()=>{UK.onConnectMobile(this.wallet)},!this.wallet)throw new Error("w3m-connecting-wc-mobile: No wallet provided");this.secondaryBtnLabel="Open",this.secondaryLabel=is.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.onHandleURI(),this.unsubscribe.push(Ae.subscribeKey("wcUri",()=>{this.onHandleURI()})),It.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"mobile",displayIndex:(t=this.wallet)==null?void 0:t.display_index,walletRank:this.wallet.order,view:fe.state.view}})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.btnLabelTimeout)}onHandleURI(){var t;this.isLoading=!this.uri,!this.ready&&this.uri&&(this.ready=!0,(t=this.onConnect)==null||t.call(this))}onTryAgain(){var t;Ae.setWcError(!1),(t=this.onConnect)==null||t.call(this)}};e3([se()],_y.prototype,"redirectDeeplink",void 0);e3([se()],_y.prototype,"redirectUniversalLink",void 0);e3([se()],_y.prototype,"target",void 0);e3([se()],_y.prototype,"preferUniversalLinks",void 0);e3([se()],_y.prototype,"isLoading",void 0);_y=e3([pt("w3m-connecting-wc-mobile")],_y);var H2={},bD,Cae;function D7t(){return Cae||(Cae=1,bD=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),bD}var vD={},Og={},$ae;function Ab(){if($ae)return Og;$ae=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Og.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},Og.getSymbolTotalCodewords=function(r){return t[r]},Og.getBCHDigit=function(n){let r=0;for(;n!==0;)r++,n>>>=1;return r},Og.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},Og.isKanjiModeEnabled=function(){return typeof e<"u"},Og.toSJIS=function(r){return e(r)},Og}var ED={},xae;function FK(){return xae||(xae=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};
vendor: 21,536 bytes, lines 2981-2987
2981function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,s){if(e.isValid(r))return r;try{return t(r)}catch{return s}}})(ED)),ED}var CD,Iae;function U7t(){if(Iae)return CD;Iae=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let r=0;r<n;r++)this.putBit((t>>>n-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},CD=e,CD}var $D,Sae;function L7t(){if(Sae)return $D;Sae=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,n,r,s){const i=t*this.size+n;this.data[i]=r,s&&(this.reservedBit[i]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,r){this.data[t*this.size+n]^=r},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},$D=e,$D}var xD={},Aae;function M7t(){return Aae||(Aae=1,(function(e){const t=Ab().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const s=Math.floor(r/7)+2,i=t(r),o=i===145?26:Math.ceil((i-13)/(2*s-2))*2,a=[i-7];for(let c=1;c<s-1;c++)a[c]=a[c-1]-o;return a.push(6),a.reverse()},e.getPositions=function(r){const s=[],i=e.getRowColCoords(r),o=i.length;for(let a=0;a<o;a++)for(let c=0;c<o;c++)a===0&&c===0||a===0&&c===o-1||a===o-1&&c===0||s.push([i[a],i[c]]);return s}})(xD)),xD}var ID={},_ae;function j7t(){if(_ae)return ID;_ae=1;const e=Ab().getSymbolSize,t=7;return ID.getPositions=function(r){const s=e(r);return[[0,0],[s-t,0],[0,s-t]]},ID}var SD={},Nae;function F7t(){return Nae||(Nae=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const i=s.size;let o=0,a=0,c=0,l=null,u=null;for(let d=0;d<i;d++){a=c=0,l=u=null;for(let h=0;h<i;h++){let f=s.get(d,h);f===l?a++:(a>=5&&(o+=t.N1+(a-5)),l=f,a=1),f=s.get(h,d),f===u?c++:(c>=5&&(o+=t.N1+(c-5)),u=f,c=1)}a>=5&&(o+=t.N1+(a-5)),c>=5&&(o+=t.N1+(c-5))}return o},e.getPenaltyN2=function(s){const i=s.size;let o=0;for(let a=0;a<i-1;a++)for(let c=0;c<i-1;c++){const l=s.get(a,c)+s.get(a,c+1)+s.get(a+1,c)+s.get(a+1,c+1);(l===4||l===0)&&o++}return o*t.N2},e.getPenaltyN3=function(s){const i=s.size;let o=0,a=0,c=0;for(let l=0;l<i;l++){a=c=0;for(let u=0;u<i;u++)a=a<<1&2047|s.get(l,u),u>=10&&(a===1488||a===93)&&o++,c=c<<1&2047|s.get(u,l),u>=10&&(c===1488||c===93)&&o++}return o*t.N3},e.getPenaltyN4=function(s){let i=0;const o=s.data.length;for(let c=0;c<o;c++)i+=s.data[c];return Math.abs(Math.ceil(i*100/o/5)-10)*t.N4};function n(r,s,i){switch(r){case e.Patterns.PATTERN000:return(s+i)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return i%3===0;case e.Patterns.PATTERN011:return(s+i)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(i/3))%2===0;case e.Patterns.PATTERN101:return s*i%2+s*i%3===0;case e.Patterns.PATTERN110:return(s*i%2+s*i%3)%2===0;case e.Patterns.PATTERN111:return(s*i%3+(s+i)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(s,i){const o=i.size;for(let a=0;a<o;a++)for(let c=0;c<o;c++)i.isReserved(c,a)||i.xor(c,a,n(s,c,a))},e.getBestMask=function(s,i){const o=Object.keys(e.Patterns).length;let a=0,c=1/0;for(let l=0;l<o;l++){i(l),e.applyMask(l,s);const u=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(l,s),u<c&&(c=u,a=l)}return a}})(SD)),SD}var XI={},Tae;function MEe(){if(Tae)return XI;Tae=1;const e=FK(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return XI.getBlocksCount=function(s,i){switch(i){case e.L:return t[(s-1)*4+0];case e.M:return t[(s-1)*4+1];case e.Q:return t[(s-1)*4+2];case e.H:return t[(s-1)*4+3];default:return}},XI.getTotalCodewordsCount=function(s,i){switch(i){case e.L:return n[(s-1)*4+0];case e.M:return n[(s-1)*4+1];case e.Q:return n[(s-1)*4+2];case e.H:return n[(s-1)*4+3];default:return}},XI}var AD={},yE={},Pae;function z7t(){if(Pae)return yE;Pae=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let r=1;for(let s=0;s<255;s++)e[s]=r,t[r]=s,r<<=1,r&256&&(r^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),yE.log=function(r){if(r<1)throw new Error("log("+r+")");return t[r]},yE.exp=function(r){return e[r]},yE.mul=function(r,s){return r===0||s===0?0:e[t[r]+t[s]]},yE}var Oae;function q7t(){return Oae||(Oae=1,(function(e){const t=z7t();e.mul=function(r,s){const i=new Uint8Array(r.length+s.length-1);for(let o=0;o<r.length;o++)for(let a=0;a<s.length;a++)i[o+a]^=t.mul(r[o],s[a]);return i},e.mod=function(r,s){let i=new Uint8Array(r);for(;i.length-s.length>=0;){const o=i[0];for(let c=0;c<s.length;c++)i[c]^=t.mul(s[c],o);let a=0;for(;a<i.length&&i[a]===0;)a++;i=i.slice(a)}return i},e.generateECPolynomial=function(r){let s=new Uint8Array([1]);for(let i=0;i<r;i++)s=e.mul(s,new Uint8Array([1,t.exp(i)]));return s}})(AD)),AD}var _D,kae;function W7t(){if(kae)return _D;kae=1;const e=q7t();function t(n){this.genPoly=void 0,this.degree=n,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(r.length+this.degree);s.set(r);const i=e.mod(s,this.genPoly),o=this.degree-i.length;if(o>0){const a=new Uint8Array(this.degree);return a.set(i,o),a}return i},_D=t,_D}var ND={},TD={},PD={},Rae;function jEe(){return Rae||(Rae=1,PD.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),PD}var Ih={},Bae;function FEe(){if(Bae)return Ih;Bae=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+`)(?:.|[\r 2982]))+`;Ih.KANJI=new RegExp(n,"g"),Ih.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Ih.BYTE=new RegExp(r,"g"),Ih.NUMERIC=new RegExp(e,"g"),Ih.ALPHANUMERIC=new RegExp(t,"g");const s=new RegExp("^"+n+"$"),i=new RegExp("^"+e+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Ih.testKanji=function(c){return s.test(c)},Ih.testNumeric=function(c){return i.test(c)},Ih.testAlphanumeric=function(c){return o.test(c)},Ih}var Dae;function _b(){return Dae||(Dae=1,(function(e){const t=jEe(),n=FEe();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,o){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!t.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?i.ccBits[0]:o<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return n.testNumeric(i)?e.NUMERIC:n.testAlphanumeric(i)?e.ALPHANUMERIC:n.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function r(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(i,o){if(e.isValid(i))return i;try{return r(i)}catch{return o}}})(TD)),TD}var Uae;function H7t(){return Uae||(Uae=1,(function(e){const t=Ab(),n=MEe(),r=FK(),s=_b(),i=jEe(),o=7973,a=t.getBCHDigit(o);function c(h,f,g){for(let p=1;p<=40;p++)if(f<=e.getCapacity(p,g,h))return p}function l(h,f){return s.getCharCountIndicator(h,f)+4}function u(h,f){let g=0;return h.forEach(function(p){const m=l(p.mode,f);g+=m+p.getBitsLength()}),g}function d(h,f){for(let g=1;g<=40;g++)if(u(h,g)<=e.getCapacity(g,f,s.MIXED))return g}e.from=function(f,g){return i.isValid(f)?parseInt(f,10):g},e.getCapacity=function(f,g,p){if(!i.isValid(f))throw new Error("Invalid QR Code version");typeof p>"u"&&(p=s.BYTE);const m=t.getSymbolTotalCodewords(f),w=n.getTotalCodewordsCount(f,g),C=(m-w)*8;if(p===s.MIXED)return C;const E=C-l(p,f);switch(p){case s.NUMERIC:return Math.floor(E/10*3);case s.ALPHANUMERIC:return Math.floor(E/11*2);case s.KANJI:return Math.floor(E/13);case s.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(f,g){let p;const m=r.from(g,r.M);if(Array.isArray(f)){if(f.length>1)return d(f,m);if(f.length===0)return 1;p=f[0]}else p=f;return c(p.mode,p.getLength(),m)},e.getEncodedBits=function(f){if(!i.isValid(f)||f<7)throw new Error("Invalid QR Code version");let g=f<<12;for(;t.getBCHDigit(g)-a>=0;)g^=o<<t.getBCHDigit(g)-a;return f<<12|g}})(ND)),ND}var OD={},Lae;function V7t(){if(Lae)return OD;Lae=1;const e=Ab(),t=1335,n=21522,r=e.getBCHDigit(t);return OD.getEncodedBits=function(i,o){const a=i.bit<<3|o;let c=a<<10;for(;e.getBCHDigit(c)-r>=0;)c^=t<<e.getBCHDigit(c)-r;return(a<<10|c)^n},OD}var kD={},RD,Mae;function K7t(){if(Mae)return RD;Mae=1;const e=_b();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let s,i,o;for(s=0;s+3<=this.data.length;s+=3)i=this.data.substr(s,3),o=parseInt(i,10),r.put(o,10);const a=this.data.length-s;a>0&&(i=this.data.substr(s),o=parseInt(i,10),r.put(o,a*3+1))},RD=t,RD}var BD,jae;function G7t(){if(jae)return BD;jae=1;const e=_b(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(r){this.mode=e.ALPHANUMERIC,this.data=r}return n.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){let i;for(i=0;i+2<=this.data.length;i+=2){let o=t.indexOf(this.data[i])*45;o+=t.indexOf(this.data[i+1]),s.put(o,11)}this.data.length%2&&s.put(t.indexOf(this.data[i]),6)},BD=n,BD}var DD,Fae;function Z7t(){if(Fae)return DD;Fae=1;const e=J$e(),t=_b();function n(r){this.mode=t.BYTE,typeof r=="string"&&(r=e(r)),this.data=new Uint8Array(r)}return n.getBitsLength=function(s){return s*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){for(let s=0,i=this.data.length;s<i;s++)r.put(this.data[s],8)},DD=n,DD}var UD,zae;function Y7t(){if(zae)return UD;zae=1;const e=_b(),t=Ab();function n(r){this.mode=e.KANJI,this.data=r}return n.getBitsLength=function(s){return s*13},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){let s;for(s=0;s<this.data.length;s++){let i=t.toSJIS(this.data[s]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+` 2983Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),r.put(i,13)}},UD=n,UD}var qae;function J7t(){return qae||(qae=1,(function(e){const t=_b(),n=K7t(),r=G7t(),s=Z7t(),i=Y7t(),o=FEe(),a=Ab(),c=X$e();function l(w){return unescape(encodeURIComponent(w)).length}function u(w,C,E){const b=[];let S;for(;(S=w.exec(E))!==null;)b.push({data:S[0],index:S.index,mode:C,length:S[0].length});return b}function d(w){const C=u(o.NUMERIC,t.NUMERIC,w),E=u(o.ALPHANUMERIC,t.ALPHANUMERIC,w);let b,S;return a.isKanjiModeEnabled()?(b=u(o.BYTE,t.BYTE,w),S=u(o.KANJI,t.KANJI,w)):(b=u(o.BYTE_KANJI,t.BYTE,w),S=[]),C.concat(E,b,S).sort(function(x,A){return x.index-A.index}).map(function(x){return{data:x.data,mode:x.mode,length:x.length}})}function h(w,C){switch(C){case t.NUMERIC:return n.getBitsLength(w);case t.ALPHANUMERIC:return r.getBitsLength(w);case t.KANJI:return i.getBitsLength(w);case t.BYTE:return s.getBitsLength(w)}}function f(w){return w.reduce(function(C,E){const b=C.length-1>=0?C[C.length-1]:null;return b&&b.mode===E.mode?(C[C.length-1].data+=E.data,C):(C.push(E),C)},[])}function g(w){const C=[];for(let E=0;E<w.length;E++){const b=w[E];switch(b.mode){case t.NUMERIC:C.push([b,{data:b.data,mode:t.ALPHANUMERIC,length:b.length},{data:b.data,mode:t.BYTE,length:b.length}]);break;case t.ALPHANUMERIC:C.push([b,{data:b.data,mode:t.BYTE,length:b.length}]);break;case t.KANJI:C.push([b,{data:b.data,mode:t.BYTE,length:l(b.data)}]);break;case t.BYTE:C.push([{data:b.data,mode:t.BYTE,length:l(b.data)}])}}return C}function p(w,C){const E={},b={start:{}};let S=["start"];for(let v=0;v<w.length;v++){const x=w[v],A=[];for(let I=0;I<x.length;I++){const O=x[I],N=""+v+I;A.push(N),E[N]={node:O,lastCount:0},b[N]={};for(let T=0;T<S.length;T++){const P=S[T];E[P]&&E[P].node.mode===O.mode?(b[P][N]=h(E[P].lastCount+O.length,O.mode)-h(E[P].lastCount,O.mode),E[P].lastCount+=O.length):(E[P]&&(E[P].lastCount=O.length),b[P][N]=h(O.length,O.mode)+4+t.getCharCountIndicator(O.mode,C))}}S=A}for(let v=0;v<S.length;v++)b[S[v]].end=0;return{map:b,table:E}}function m(w,C){let E;const b=t.getBestModeForData(w);if(E=t.from(C,b),E!==t.BYTE&&E.bit<b.bit)throw new Error('"'+w+'" cannot be encoded with mode '+t.toString(E)+`. 2984 Suggested mode is: `+t.toString(b));switch(E===t.KANJI&&!a.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new n(w);case t.ALPHANUMERIC:return new r(w);case t.KANJI:return new i(w);case t.BYTE:return new s(w)}}e.fromArray=function(C){return C.reduce(function(E,b){return typeof b=="string"?E.push(m(b,null)):b.data&&E.push(m(b.data,b.mode)),E},[])},e.fromString=function(C,E){const b=d(C,a.isKanjiModeEnabled()),S=g(b),v=p(S,E),x=c.find_path(v.map,"start","end"),A=[];for(let I=1;I<x.length-1;I++)A.push(v.table[x[I]].node);return e.fromArray(f(A))},e.rawSplit=function(C){return e.fromArray(d(C,a.isKanjiModeEnabled()))}})(kD)),kD}var Wae;function X7t(){if(Wae)return vD;Wae=1;const e=Ab(),t=FK(),n=U7t(),r=L7t(),s=M7t(),i=j7t(),o=F7t(),a=MEe(),c=W7t(),l=H7t(),u=V7t(),d=_b(),h=J7t();function f(v,x){const A=v.size,I=i.getPositions(x);for(let O=0;O<I.length;O++){const N=I[O][0],T=I[O][1];for(let P=-1;P<=7;P++)if(!(N+P<=-1||A<=N+P))for(let _=-1;_<=7;_++)T+_<=-1||A<=T+_||(P>=0&&P<=6&&(_===0||_===6)||_>=0&&_<=6&&(P===0||P===6)||P>=2&&P<=4&&_>=2&&_<=4?v.set(N+P,T+_,!0,!0):v.set(N+P,T+_,!1,!0))}}function g(v){const x=v.size;for(let A=8;A<x-8;A++){const I=A%2===0;v.set(A,6,I,!0),v.set(6,A,I,!0)}}function p(v,x){const A=s.getPositions(x);for(let I=0;I<A.length;I++){const O=A[I][0],N=A[I][1];for(let T=-2;T<=2;T++)for(let P=-2;P<=2;P++)T===-2||T===2||P===-2||P===2||T===0&&P===0?v.set(O+T,N+P,!0,!0):v.set(O+T,N+P,!1,!0)}}function m(v,x){const A=v.size,I=l.getEncodedBits(x);let O,N,T;for(let P=0;P<18;P++)O=Math.floor(P/3),N=P%3+A-8-3,T=(I>>P&1)===1,v.set(O,N,T,!0),v.set(N,O,T,!0)}function w(v,x,A){const I=v.size,O=u.getEncodedBits(x,A);let N,T;for(N=0;N<15;N++)T=(O>>N&1)===1,N<6?v.set(N,8,T,!0):N<8?v.set(N+1,8,T,!0):v.set(I-15+N,8,T,!0),N<8?v.set(8,I-N-1,T,!0):N<9?v.set(8,15-N-1+1,T,!0):v.set(8,15-N-1,T,!0);v.set(I-8,8,1,!0)}function C(v,x){const A=v.size;let I=-1,O=A-1,N=7,T=0;for(let P=A-1;P>0;P-=2)for(P===6&&P--;;){for(let _=0;_<2;_++)if(!v.isReserved(O,P-_)){let y=!1;T<x.length&&(y=(x[T]>>>N&1)===1),v.set(O,P-_,y),N--,N===-1&&(T++,N=7)}if(O+=I,O<0||A<=O){O-=I,I=-I;break}}}function E(v,x,A){const I=new n;A.forEach(function(_){I.put(_.mode.bit,4),I.put(_.getLength(),d.getCharCountIndicator(_.mode,v)),_.write(I)});const O=e.getSymbolTotalCodewords(v),N=a.getTotalCodewordsCount(v,x),T=(O-N)*8;for(I.getLengthInBits()+4<=T&&I.put(0,4);I.getLengthInBits()%8!==0;)I.putBit(0);const P=(T-I.getLengthInBits())/8;for(let _=0;_<P;_++)I.put(_%2?17:236,8);return b(I,v,x)}function b(v,x,A){const I=e.getSymbolTotalCodewords(x),O=a.getTotalCodewordsCount(x,A),N=I-O,T=a.getBlocksCount(x,A),P=I%T,_=T-P,y=Math.floor(I/T),$=Math.floor(N/T),R=$+1,B=y-$,k=new c(B);let D=0;const U=new Array(T),F=new Array(T);let K=0;const q=new Uint8Array(v.buffer);for(let X=0;X<T;X++){const le=X<_?$:R;U[X]=q.slice(D,D+le),F[X]=k.encode(U[X]),D+=le,K=Math.max(K,le)}const H=new Uint8Array(I);let Z=0,ee,ie;for(ee=0;ee<K;ee++)for(ie=0;ie<T;ie++)ee<U[ie].length&&(H[Z++]=U[ie][ee]);for(ee=0;ee<B;ee++)for(ie=0;ie<T;ie++)H[Z++]=F[ie][ee];return H}function S(v,x,A,I){let O;if(Array.isArray(v))O=h.fromArray(v);else if(typeof v=="string"){let y=x;if(!y){const $=h.rawSplit(v);y=l.getBestVersionForData($,A)}O=h.fromString(v,y||40)}else throw new Error("Invalid data");const N=l.getBestVersionForData(O,A);if(!N)throw new Error("The amount of data is too big to be stored in a QR Code");if(!x)x=N;else if(x<N)throw new Error(` 2985The chosen QR Code version cannot contain this amount of data. 2986Minimum version required to store current data is: `+N+`. 2987`);const T=E(x,A,O),P=e.getSymbolSize(x),_=new r(P);return f(_,x),g(_),p(_,x),w(_,A,0),x>=7&&m(_,x),C(_,T),isNaN(I)&&(I=o.getBestMask(_,w.bind(null,_,A))),o.applyMask(I,_),w(_,A,I),{modules:_,version:x,errorCorrectionLevel:A,maskPattern:I,segments:O}}return vD.create=function(x,A){if(typeof x>"u"||x==="")throw new Error("No input text");let I=t.M,O,N;return typeof A<"u"&&(I=t.from(A.errorCorrectionLevel,t.M),O=l.from(A.version),N=o.from(A.maskPattern),A.toSJISFunc&&e.setToSJISFunction(A.toSJISFunc)),S(x,O,I,N)},vD}var LD={},MD={},Hae;function zEe(){return Hae||(Hae=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let r=n.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+n);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(i){return[i,i]}))),r.length===6&&r.push("F","F");const s=parseInt(r.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const s=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,i=r.width&&r.width>=21?r.width:void 0,o=r.scale||4;return{width:i,scale:i?4:o,margin:s,color:{dark:t(r.color.dark||"#000000ff"),light:t(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,s){return s.width&&s.width>=r+s.margin*2?s.width/(r+s.margin*2):s.scale},e.getImageWidth=function(r,s){const i=e.getScale(r,s);return Math.floor((r+s.margin*2)*i)},e.qrToImageData=function(r,s,i){const o=s.modules.size,a=s.modules.data,c=e.getScale(o,i),l=Math.floor((o+i.margin*2)*c),u=i.margin*c,d=[i.color.light,i.color.dark];for(let h=0;h<l;h++)for(let f=0;f<l;f++){let g=(h*l+f)*4,p=i.color.light;if(h>=u&&f>=u&&h<l-u&&f<l-u){const m=Math.floor((h-u)/c),w=Math.floor((f-u)/c);p=d[a[m*o+w]?1:0]}r[g++]=p.r,r[g++]=p.g,r[g++]=p.b,r[g]=p.a}}})(MD)),MD}var Vae;function Q7t(){return Vae||(Vae=1,(function(e){const t=zEe();function n(s,i,o){s.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=o,i.width=o,i.style.height=o+"px",i.style.width=o+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(i,o,a){let c=a,l=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(l=r()),c=t.getOptions(c);const u=t.getImageWidth(i.modules.size,c),d=l.getContext("2d"),h=d.createImageData(u,u);return t.qrToImageData(h.data,i,c),n(d,l,u),d.putImageData(h,0,0),l},e.renderToDataURL=function(i,o,a){let c=a;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const l=e.render(i,o,c),u=c.type||"image/png",d=c.rendererOpts||{};return l.toDataURL(u,d.quality)}})(LD)),LD}var jD={},Kae;function eTt(){if(Kae)return jD;
2987Kae=1;const e=zEe();function t(s,i){const o=s.a/255,a=i+'="'+s.hex+'"';return o<1?a+" "+i+'-opacity="'+o.toFixed(2).slice(1)+'"':a}function n(s,i,o){let a=s+i;return typeof o<"u"&&(a+=" "+o),a}function r(s,i,o){let a="",c=0,l=!1,u=0;for(let d=0;d<s.length;d++){const h=Math.floor(d%i),f=Math.floor(d/i);!h&&!l&&(l=!0),s[d]?(u++,d>0&&h>0&&s[d-1]||(a+=l?n("M",h+o,.5+f+o):n("m",c,0),c=0,l=!1),h+1<i&&s[d+1]||(a+=n("h",u),u=0)):c++}return a}return jD.render=function(i,o,a){const c=e.getOptions(o),l=i.modules.size,u=i.modules.data,d=l+c.margin*2,h=c.color.light.a?"<path "+t(c.color.light,"fill")+' d="M0 0h'+d+"v"+d+'H0z"/>':"",f="<path "+t(c.color.dark,"stroke")+' d="'+r(u,l,c.margin)+'"/>',g='viewBox="0 0 '+d+" "+d+'"',m='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+g+' shape-rendering="crispEdges">'+h+f+`</svg> 2988`;return typeof a=="function"&&a(null,m),m},jD}var Gae;function tTt(){if(Gae)return H2;Gae=1;const e=D7t(),t=X7t(),n=Q7t(),r=eTt();function s(i,o,a,c,l){const u=[].slice.call(arguments,1),d=u.length,h=typeof u[d-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(d<2)throw new Error("Too few arguments provided");d===2?(l=a,a=o,o=c=void 0):d===3&&(o.getContext&&typeof l>"u"?(l=c,c=void 0):(l=c,c=a,a=o,o=void 0))}else{if(d<1)throw new Error("Too few arguments provided");return d===1?(a=o,o=c=void 0):d===2&&!o.getContext&&(c=a,a=o,o=void 0),new Promise(function(f,g){try{const p=t.create(a,c);f(i(p,o,c))}catch(p){g(p)}})}try{const f=t.create(a,c);l(null,i(f,o,c))}catch(f){l(f)}}return H2.create=t.create,H2.toCanvas=s.bind(null,n.render),H2.toDataURL=s.bind(null,n.renderToDataURL),H2.toString=s.bind(null,function(i,o,a){return r.render(i,a)}),H2}var nTt=tTt();const qEe=mf(nTt),rTt=.1,Zae=2.5,np=7;function FD(e,t,n){return e===t?!1:(e-t<0?t-e:e-t)<=n+rTt}function sTt(e,t){const n=Array.prototype.slice.call(qEe.create(e,{errorCorrectionLevel:t}).modules.data,0),r=Math.sqrt(n.length);return n.reduce((s,i,o)=>(o%r===0?s.push([i]):s[s.length-1].push(i))&&s,[])}const iTt={generate({uri:e,size:t,logoSize:n,padding:r=8,dotColor:s="var(--apkt-colors-black)"}){const o=[],a=sTt(e,"Q"),c=(t-2*r)/a.length,l=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];l.forEach(({x:p,y:m})=>{const w=(a.length-np)*c*p+r,C=(a.length-np)*c*m+r,E=.45;for(let b=0;b<l.length;b+=1){const S=c*(np-b*2);o.push(ae` 2989 <rect 2990 fill=${b===2?"var(--apkt-colors-black)":"var(--apkt-colors-white)"} 2991 width=${b===0?S-10:S} 2992 rx= ${b===0?(S-10)*E:S*E} 2993 ry= ${b===0?(S-10)*E:S*E} 2994 stroke=${s} 2995 stroke-width=${b===0?10:0} 2996 height=${b===0?S-10:S} 2997 x= ${b===0?C+c*b+10/2:C+c*b} 2998 y= ${b===0?w+c*b+10/2:w+c*b} 2999 /> 3000 `)}});const u=Math.floor((n+25)/c),d=a.length/2-u/2,h=a.length/2+u/2-1,f=[];a.forEach((p,m)=>{p.forEach((w,C)=>{if(a[m][C]&&!(m<np&&C<np||m>a.length-(np+1)&&C<np||m<np&&C>a.length-(np+1))&&!(m>d&&m<h&&C>d&&C<h)){const E=m*c+c/2+r,b=C*c+c/2+r;f.push([E,b])}})});const g={};return f.forEach(([p,m])=>{var w;
3000g[p]?(w=g[p])==null||w.push(m):g[p]=[m]}),Object.entries(g).map(([p,m])=>{const w=m.filter(C=>m.every(E=>!FD(C,E,c)));return[Number(p),w]}).forEach(([p,m])=>{m.forEach(w=>{o.push(ae`<circle cx=${p} cy=${w} fill=${s} r=${c/Zae} />`)})}),Object.entries(g).filter(([p,m])=>m.length>1).map(([p,m])=>{const w=m.filter(C=>m.some(E=>FD(C,E,c)));return[Number(p),w]}).map(([p,m])=>{m.sort((C,E)=>C<E?-1:1);const w=[];for(const C of m){const E=w.find(b=>b.some(S=>FD(C,S,c)));E?E.push(C):w.push([C])}return[p,w.map(C=>[C[0],C[C.length-1]])]}).forEach(([p,m])=>{m.forEach(([w,C])=>{o.push(ae` 3001 <line 3002 x1=${p} 3003 x2=${p} 3004 y1=${w} 3005 y2=${C} 3006 stroke=${s} 3007 stroke-width=${c/(Zae/2)} 3008 stroke-linecap="round" 3009 /> 3010 `)})}),o}},oTt=Gt` 3011 :host { 3012 position: relative; 3013 user-select: none; 3014 display: block; 3015 overflow: hidden; 3016 aspect-ratio: 1 / 1; 3017 width: 100%; 3018 height: 100%; 3019 background-color: ${({colors:e})=>e.white}; 3020 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 3021 } 3022 3023 :host { 3024 border-radius: ${({borderRadius:e})=>e[4]}; 3025 display: flex; 3026 align-items: center; 3027 justify-content: center; 3028 } 3029 3030 :host([data-clear='true']) > wui-icon { 3031 display: none; 3032 } 3033 3034 svg:first-child, 3035 wui-image, 3036 wui-icon { 3037 position: absolute; 3038 top: 50%; 3039 left: 50%; 3040 transform: translateY(-50%) translateX(-50%); 3041 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 3042 box-shadow: inset 0 0 0 4px ${({tokens:e})=>e.theme.backgroundPrimary}; 3043 border-radius: ${({borderRadius:e})=>e[6]}; 3044 } 3045 3046 wui-image { 3047 width: 25%; 3048 height: 25%; 3049 border-radius: ${({borderRadius:e})=>e[2]}; 3050 } 3051 3052 wui-icon { 3053 width: 100%; 3054 height: 100%; 3055 color: #3396ff !important; 3056 transform: translateY(-50%) translateX(-50%) scale(0.25); 3057 } 3058 3059 wui-icon > svg { 3060 width: inherit; 3061 height: inherit; 3062 } 3063`;var w1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let lf=class extends ce{constructor(){super(...arguments),this.uri="",this.size=500,this.theme="dark",this.imageSrc=void 0,this.alt=void 0,this.arenaClear=void 0,this.farcaster=void 0}render(){return this.dataset.theme=this.theme,this.dataset.clear=String(this.arenaClear),j`<wui-flex 3064 alignItems="center" 3065 justifyContent="center" 3066 class="wui-qr-code" 3067 direction="column" 3068 gap="4" 3069 width="100%" 3070 style="height: 100%" 3071 > 3072 ${this.templateVisual()} ${this.templateSvg()} 3073 </wui-flex>`}templateSvg(){return ae` 3074 <svg viewBox="0 0 ${this.size} ${this.size}" width="100%" height="100%"> 3075 ${iTt.generate({uri:this.uri,size:this.size,logoSize:this.arenaClear?0:this.size/4})} 3076 </svg> 3077 `}templateVisual(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt=${this.alt??"logo"}></wui-image>`:this.farcaster?j`<wui-icon 3078 class="farcaster" 3079 size="inherit" 3080 color="inherit" 3081 name="farcaster" 3082 ></wui-icon>`:j`<wui-icon size="inherit" color="inherit" name="walletConnect"></wui-icon>`}};lf.styles=[ar,oTt];w1([z()],lf.prototype,"uri",void 0);w1([z({type:Number})],lf.prototype,"size",void 0);w1([z()],lf.prototype,"theme",void 0);w1([z()],lf.prototype,"imageSrc",void 0);w1([z()],lf.prototype,"alt",void 0);w1([z({type:Boolean})],lf.prototype,"arenaClear",void 0);w1([z({type:Boolean})],lf.prototype,"farcaster",void 0);lf=w1([pt("wui-qr-code")],lf);const aTt=Gt` 3083 :host { 3084 display: block; 3085 background: linear-gradient( 3086 90deg, 3087 ${({tokens:e})=>e.theme.foregroundPrimary} 0%, 3088 ${({tokens:e})=>e.theme.foregroundSecondary} 50%, 3089 ${({tokens:e})=>e.theme.foregroundPrimary} 100% 3090 ); 3091 background-size: 200% 100%; 3092 animation: shimmer 2s linear infinite; 3093 border-radius: ${({borderRadius:e})=>e[1]}; 3094 } 3095 3096 :host([data-rounded='true']) { 3097 border-radius: ${({borderRadius:e})=>e[16]}; 3098 } 3099 3100 @keyframes shimmer { 3101 0% { 3102 background-position: 100% 0; 3103 } 3104 100% { 3105 background-position: -100% 0; 3106 } 3107 } 3108`;var F$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Ny=class extends ce{constructor(){super(...arguments),this.width="",this.height="",this.variant="default",this.rounded=!1}render(){return this.style.cssText=` 3109 width: ${this.width}; 3110 height: ${this.height}; 3111 `,this.dataset.rounded=this.rounded?"true":"false",j`<slot></slot>`}};Ny.styles=[aTt];F$([z()],Ny.prototype,"width",void 0);F$([z()],Ny.prototype,"height",void 0);F$([z()],Ny.prototype,"variant",void 0);F$([z({type:Boolean})],Ny.prototype,"rounded",void 0);Ny=F$([pt("wui-shimmer")],Ny);const cTt="https://reown.com",lTt=Gt` 3112 .reown-logo { 3113 height: 24px; 3114 } 3115 3116 a { 3117 text-decoration: none; 3118 cursor: pointer; 3119 color: ${({tokens:e})=>e.theme.textSecondary}; 3120 } 3121 3122 a:hover { 3123 opacity: 0.9; 3124 } 3125`;var uTt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Ez=class extends ce{render(){return j` 3126 <a 3127 data-testid="ux-branding-reown" 3128 href=${cTt} 3129 rel="noreferrer" 3130 target="_blank" 3131 style="text-decoration: none;" 3132 > 3133 <wui-flex 3134 justifyContent="center" 3135 alignItems="center" 3136 gap="1" 3137 .padding=${["01","0","3","0"]} 3138 > 3139 <wui-text variant="sm-regular" color="inherit"> UX by </wui-text> 3140 <wui-icon name="reown" size="inherit" class="reown-logo"></wui-icon> 3141 </wui-flex> 3142 </a> 3143 `}};Ez.styles=[ar,ba,lTt];Ez=uTt([pt("wui-ux-by-reown")],Ez);const dTt=Gt` 3144 wui-shimmer { 3145 width: 100%; 3146 aspect-ratio: 1 / 1; 3147 border-radius: ${({borderRadius:e})=>e[4]}; 3148 } 3149 3150 wui-qr-code { 3151 opacity: 0; 3152 animation-duration: ${({durations:e})=>e.xl}; 3153 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 3154 animation-name: fade-in; 3155 animation-fill-mode: forwards; 3156 } 3157 3158 @keyframes fade-in { 3159 from { 3160 opacity: 0; 3161 } 3162 to { 3163 opacity: 1; 3164 } 3165 } 3166`;var WEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let M_=class extends ao{constructor(){super(),this.basic=!1}firstUpdated(){var t,n,r;this.basic||It.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:((t=this.wallet)==null?void 0:t.name)??"WalletConnect",platform:"qrcode",dis
3166playIndex:(n=this.wallet)==null?void 0:n.display_index,walletRank:(r=this.wallet)==null?void 0:r.order,view:fe.state.view}})}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.unsubscribe)==null||t.forEach(n=>n())}render(){return this.onRenderProxy(),j` 3167 <wui-flex 3168 flexDirection="column" 3169 alignItems="center" 3170 .padding=${["0","5","5","5"]} 3171 gap="5" 3172 > 3173 <wui-shimmer width="100%"> ${this.qrCodeTemplate()} </wui-shimmer> 3174 <wui-text variant="lg-medium" color="primary"> Scan this QR Code with your phone </wui-text> 3175 ${this.copyTemplate()} 3176 </wui-flex> 3177 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 3178 `}onRenderProxy(){!this.ready&&this.uri&&(this.ready=!0)}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const t=this.wallet?this.wallet.name:void 0;Ae.setWcLinking(void 0),Ae.setRecentWallet(this.wallet);const n=Zp.state.themeVariables["--apkt-qr-color"]??Zp.state.themeVariables["--w3m-qr-color"];return j` <wui-qr-code 3179 theme=${Zp.state.themeMode} 3180 uri=${this.uri} 3181 imageSrc=${ge(wc.getWalletImage(this.wallet))} 3182 color=${ge(n)} 3183 alt=${ge(t)} 3184 data-testid="wui-qr-code" 3185 ></wui-qr-code>`}copyTemplate(){const t=!this.uri||!this.ready;return j`<wui-button 3186 .disabled=${t} 3187 @click=${this.onCopyUri} 3188 variant="neutral-secondary" 3189 size="sm" 3190 data-testid="copy-wc2-uri" 3191 > 3192 Copy link 3193 <wui-icon size="sm" color="inherit" name="copy" slot="iconRight"></wui-icon> 3194 </wui-button>`}};M_.styles=dTt;WEe([z({type:Boolean})],M_.prototype,"basic",void 0);M_=WEe([pt("w3m-connecting-wc-qrcode")],M_);var hTt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Yae=class extends ce{constructor(){var t,n,r;if(super(),this.wallet=(t=fe.state.data)==null?void 0:t.wallet,!this.wallet)throw new Error("w3m-connecting-wc-unsupported: No wallet provided");It.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser",displayIndex:(n=this.wallet)==null?void 0:n.display_index,walletRank:(r=this.wallet)==null?void 0:r.order,view:fe.state.view}})}render(){return j` 3195 <wui-flex 3196 flexDirection="column" 3197 alignItems="center" 3198 .padding=${["10","5","5","5"]} 3199 gap="5" 3200 > 3201 <wui-wallet-image 3202 size="lg" 3203 imageSrc=${ge(wc.getWalletImage(this.wallet))} 3204 ></wui-wallet-image> 3205 3206 <wui-text variant="md-regular" color="primary">Not Detected</wui-text> 3207 </wui-flex> 3208 3209 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 3210 `}};Yae=hTt([pt("w3m-connecting-wc-unsupported")],Yae);var HEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Cz=class extends ao{constructor(){var t,n;if(super(),this.isLoading=!0,!this.wallet)throw new Error("w3m-connecting-wc-web: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.secondaryBtnLabel="Open",this.secondaryLabel=is.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.updateLoadingState(),this.unsubscribe.push(Ae.subscribeKey("wcUri",()=>{this.updateLoadingState()})),It.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"web",displayIndex:(t=this.wallet)==null?void 0:t.display_index,walletRank:(n=this.wallet)==null?void 0:n.order,view:fe.state.view}})}updateLoadingState(){this.isLoading=!this.uri}onConnectProxy(){var t;
3210if((t=this.wallet)!=null&&t.webapp_link&&this.uri)try{this.error=!1;const{webapp_link:n,name:r}=this.wallet,{redirect:s,href:i}=Be.formatUniversalUrl(n,this.uri);Ae.setWcLinking({name:r,href:i}),Ae.setRecentWallet(this.wallet),Be.openHref(s,"_blank")}catch{this.error=!0}}};HEe([se()],Cz.prototype,"isLoading",void 0);Cz=HEe([pt("w3m-connecting-wc-web")],Cz);const fTt=Gt` 3211 :host([data-mobile-fullscreen='true']) { 3212 height: 100%; 3213 display: flex; 3214 flex-direction: column; 3215 } 3216 3217 :host([data-mobile-fullscreen='true']) wui-ux-by-reown { 3218 margin-top: auto; 3219 } 3220`;var Nb=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let A0=class extends ce{constructor(){var t;super(),this.wallet=(t=fe.state.data)==null?void 0:t.wallet,this.unsubscribe=[],this.platform=void 0,this.platforms=[],this.isSiwxEnabled=!!ke.state.siwx,this.remoteFeatures=ke.state.remoteFeatures,this.displayBranding=!0,this.basic=!1,this.determinePlatforms(),this.initializeConnection(),this.unsubscribe.push(ke.subscribeKey("remoteFeatures",n=>this.remoteFeatures=n))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return ke.state.enableMobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),j` 3221 ${this.headerTemplate()} 3222 <div class="platform-container">${this.platformTemplate()}</div> 3223 ${this.reownBrandingTemplate()} 3224 `}reownBrandingTemplate(){var t;return!((t=this.remoteFeatures)!=null&&t.reownBranding)||!this.displayBranding?null:j`<wui-ux-by-reown></wui-ux-by-reown>`}async initializeConnection(t=!1){var n,r;if(!(this.platform==="browser"||ke.state.manualWCControl&&!t))try{const{wcPairingExpiry:s,status:i}=Ae.state,{redirectView:o}=fe.state.data??{};if(t||ke.state.enableEmbedded||Be.isPairingExpired(s)||i==="connecting"){const a=Ae.getConnections(Q.state.activeChain),c=(n=this.remoteFeatures)==null?void 0:n.multiWallet,l=a.length>0;await Ae.connectWalletConnect({cache:"never"}),this.isSiwxEnabled||(l&&c?(fe.replace("ProfileWallets"),Xn.showSuccess("New Wallet Added")):o?fe.replace(o):Zt.close())}}catch(s){if(s instanceof Error&&s.message.includes("An error occurred when attempting to switch chain")&&!ke.state.enableNetworkSwitch&&Q.state.activeChain){Q.setActiveCaipNetwork(DEe.getUnsupportedNetwork(`${Q.state.activeChain}:${(r=Q.state.activeCaipNetwork)==null?void 0:r.id}`)),Q.showUnsupportedChainUI();return}s instanceof U5&&s.originalName===Ed.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST?It.sendEvent({type:"track",event:"USER_REJECTED",properties:{message:s.message}}):It.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(s==null?void 0:s.message)??"Unknown"}}),Ae.setWcError(!0),Xn.showError(s.message??"Connection error"),Ae.resetWcConnection(),fe.goBack()}}determinePlatforms(){if(!this.wallet){this.platforms.push("qrcode"),this.platform="qrcode";return}if(this.platform)return;const{mobile_link:t,desktop_link:n,webapp_link:r,injected:s,rdns:i}=this.wallet,o=s==null?void 0:s.map(({injected_id:p})=>p).filter(Boolean),a=[...i?[i]:o??[]],c=ke.state.isUniversalProvider?!1:a.length,l=t,u=r,d=Ae.checkInstalled(a),h=c&&d,f=n&&!Be.isMobile();h&&!Q.state.noAdapters&&this.platforms.push("browser"),l&&this.platforms.push(Be.isMobile()?"mobile":"qrcode"),u&&this.platforms.push("web"),f&&this.platforms.push("desktop");const g=IEe.isCustomDeeplinkWallet(this.wallet.id,Q.state.activeChain);!h&&c&&!Q.state.noAdapters&&!g&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return j`<w3m-connecting-wc-browser></w3m-connecting-wc-browser>`;case"web":return j`<w3m-connecting-wc-web></w3m-connecting-wc-web>`;case"desktop":return j` 3225 <w3m-connecting-wc-desktop .onRetry=${()=>this.initializeConnection(!0)}> 3226 </w3m-connecting-wc-desktop> 3227 `;case"mobile":return j` 3228 <w3m-connecting-wc-mobile isMobile .onRetry=${()=>this.initializeConnection(!0)}> 3229 </w3m-connecting-wc-mobile> 3230 `;case"qrcode":return j`<w3m-connecting-wc-qrcode ?basic=${this.basic}></w3m-connecting-wc-qrcode>`;default:return j`<w3m-connecting-wc-unsupported></w3m-connecting-wc-unsupported>`}}headerTemplate(){return this.platforms.length>1?j` 3231 <w3m-connecting-header 3232 .platforms=${this.platforms} 3233 .onSelectPlatfrom=${this.onSelectPlatform.bind(this)} 3234 > 3235 </w3m-connecting-header> 3236 `:null}async onSelectPlatform(t){var r;const n=(r=this.shadowRoot)==null?void 0:r.querySelector("div");n&&(await n.animate([{opacity:1},{opacity:0}
vendor: 6,969 bytes, lines 3236-3336
3236],{duration:200,fill:"forwards",easing:"ease"}).finished,this.platform=t,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}};A0.styles=fTt;Nb([se()],A0.prototype,"platform",void 0);Nb([se()],A0.prototype,"platforms",void 0);Nb([se()],A0.prototype,"isSiwxEnabled",void 0);Nb([se()],A0.prototype,"remoteFeatures",void 0);Nb([z({type:Boolean})],A0.prototype,"displayBranding",void 0);Nb([z({type:Boolean})],A0.prototype,"basic",void 0);A0=Nb([pt("w3m-connecting-wc-view")],A0);var zK=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let L4=class extends ce{constructor(){super(),this.unsubscribe=[],this.isMobile=Be.isMobile(),this.remoteFeatures=ke.state.remoteFeatures,this.unsubscribe.push(ke.subscribeKey("remoteFeatures",t=>this.remoteFeatures=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){if(this.isMobile){const{featured:t,recommended:n}=De.state,{customWallets:r}=ke.state,s=Ye.getRecentWallets(),i=t.length||n.length||(r==null?void 0:r.length)||s.length;return j`<wui-flex flexDirection="column" gap="2" .margin=${["1","3","3","3"]}> 3237 ${i?j`<w3m-connector-list></w3m-connector-list>`:null} 3238 <w3m-all-wallets-widget></w3m-all-wallets-widget> 3239 </wui-flex>`}return j`<wui-flex flexDirection="column" .padding=${["0","0","4","0"]}> 3240 <w3m-connecting-wc-view ?basic=${!0} .displayBranding=${!1}></w3m-connecting-wc-view> 3241 <wui-flex flexDirection="column" .padding=${["0","3","0","3"]}> 3242 <w3m-all-wallets-widget></w3m-all-wallets-widget> 3243 </wui-flex> 3244 </wui-flex> 3245 ${this.reownBrandingTemplate()} `}reownBrandingTemplate(){var t;return(t=this.remoteFeatures)!=null&&t.reownBranding?j` <wui-flex flexDirection="column" .padding=${["1","0","1","0"]}> 3246 <wui-ux-by-reown></wui-ux-by-reown> 3247 </wui-flex>`:null}};zK([se()],L4.prototype,"isMobile",void 0);zK([se()],L4.prototype,"remoteFeatures",void 0);L4=zK([pt("w3m-connecting-wc-basic-view")],L4);const pTt=e=>e===null||typeof e!="object"&&typeof e!="function",gTt=e=>e.strings===void 0;const _8=(e,t)=>{var r;const n=e._$AN;if(n===void 0)return!1;for(const s of n)(r=s._$AO)==null||r.call(s,t,!1),_8(s,t);return!0},j_=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while((n==null?void 0:n.size)===0)},VEe=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),yTt(t)}};function mTt(e){this._$AN!==void 0?(j_(this),this._$AM=e,VEe(this)):this._$AM=e}function wTt(e,t=!1,n=0){const r=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(r))for(let i=n;i<r.length;i++)_8(r[i],!1),j_(r[i]);else r!=null&&(_8(r,!1),j_(r));else _8(this,e)}const yTt=e=>{e.type==OEe.CHILD&&(e._$AP??(e._$AP=wTt),e._$AQ??(e._$AQ=mTt))};class KEe extends kEe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,n,r){super._$AT(t,n,r),VEe(this),this.isConnected=t._$AU}_$AO(t,n=!0){var r,s;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(s=this.disconnected)==null||s.call(this)),n&&(_8(this,t),j_(this))}setValue(t){if(gTt(this._$Ct))this._$Ct._$AI(t,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=t,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}const t3=()=>new bTt;let bTt=class{};const zD=new WeakMap,n3=LK(class extends KEe{render(e){return ms}update(e,[t]){var r;const n=t!==this.G;return n&&this.G!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=(r=e.options)==null?void 0:r.host,this.rt(this.ct=e.element)),ms}rt(e){if(this.isConnected||(e=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let n=zD.get(t);n===void 0&&(n=new WeakMap,zD.set(t,n)),n.get(this.G)!==void 0&&this.G.call(this.ht,void 0),n.set(this.G,e),e!==void 0&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){var e,t;return typeof this.G=="function"?(e=zD.get(this.ht??globalThis))==null?void 0:e.get(this.G):(t=this.G)==null?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),vTt=Gt` 3248 :host { 3249 display: flex; 3250 align-items: center; 3251 justify-content: center; 3252 } 3253 3254 label { 3255 position: relative; 3256 display: inline-block; 3257 user-select: none; 3258 transition: 3259 background-color ${({durations:e})=>e.lg} 3260 ${({easings:e})=>e["ease-out-power-2"]}, 3261 color ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3262 border ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3263 box-shadow ${({durations:e})=>e.lg} 3264 ${({easings:e})=>e["ease-out-power-2"]}, 3265 width ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3266 height ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3267 transform ${({durations:e})=>e.lg} 3268 ${({easings:e})=>e["ease-out-power-2"]}, 3269 opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; 3270 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 3271 } 3272 3273 input { 3274 width: 0; 3275 height: 0; 3276 opacity: 0; 3277 } 3278 3279 span { 3280 position: absolute; 3281 cursor: pointer; 3282 top: 0; 3283 left: 0; 3284 right: 0; 3285 bottom: 0; 3286 background-color: ${({colors:e})=>e.neutrals300}; 3287 border-radius: ${({borderRadius:e})=>e.round}; 3288 border: 1px solid transparent; 3289 will-change: border; 3290 transition: 3291 background-color ${({durations:e})=>e.lg} 3292 ${({easings:e})=>e["ease-out-power-2"]}, 3293 color ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3294 border ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3295 box-shadow ${({durations:e})=>e.lg} 3296 ${({easings:e})=>e["ease-out-power-2"]}, 3297 width ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3298 height ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 3299 transform ${({durations:e})=>e.lg} 3300 ${({easings:e})=>e["ease-out-power-2"]}, 3301 opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; 3302 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 3303 } 3304 3305 span:before { 3306 content: ''; 3307 position: absolute; 3308 background-color: ${({colors:e})=>e.white}; 3309 border-radius: 50%; 3310 } 3311 3312 /* -- Sizes --------------------------------------------------------- */ 3313 label[data-size='lg'] { 3314 width: 48px; 3315 height: 32px; 3316 } 3317 3318 label[data-size='md'] { 3319 width: 40px; 3320 height: 28px; 3321 } 3322 3323 label[data-size='sm'] { 3324 width: 32px; 3325 height: 22px; 3326 } 3327 3328 label[data-size='lg'] > span:before { 3329 height: 24px; 3330 width: 24px; 3331 left: 4px; 3332 top: 3px; 3333 } 3334 3335 label[data-size='md'] > span:before { 3336 height: 20px;
3337 width: 20px; 3338 left: 4px; 3339 top: 3px; 3340 } 3341 3342 label[data-size='sm'] > span:before { 3343 height: 16px; 3344 width: 16px; 3345 left: 3px; 3346 top: 2px; 3347 } 3348 3349 /* -- Focus states --------------------------------------------------- */ 3350 input:focus-visible:not(:checked) + span, 3351 input:focus:not(:checked) + span { 3352 border: 1px solid ${({tokens:e})=>e.core.iconAccentPrimary}; 3353 background-color: ${({tokens:e})=>e.theme.textTertiary}; 3354 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 3355 } 3356 3357 input:focus-visible:checked + span, 3358 input:focus:checked + span { 3359 border: 1px solid ${({tokens:e})=>e.core.iconAccentPrimary}; 3360 box-shadow: 0px 0px 0px 4px rgba(9, 136, 240, 0.2); 3361 } 3362 3363 /* -- Checked states --------------------------------------------------- */ 3364 input:checked + span { 3365 background-color: ${({tokens:e})=>e.core.iconAccentPrimary}; 3366 } 3367 3368 label[data-size='lg'] > input:checked + span:before { 3369 transform: translateX(calc(100% - 9px)); 3370 } 3371 3372 label[data-size='md'] > input:checked + span:before { 3373 transform: translateX(calc(100% - 9px)); 3374 } 3375 3376 label[data-size='sm'] > input:checked + span:before { 3377 transform: translateX(calc(100% - 7px)); 3378 } 3379 3380 /* -- Hover states ------------------------------------------------------- */ 3381 label:hover > input:not(:checked):not(:disabled) + span { 3382 background-color: ${({colors:e})=>e.neutrals400}; 3383 } 3384 3385 label:hover > input:checked:not(:disabled) + span { 3386 background-color: ${({colors:e})=>e.accent080}; 3387 } 3388 3389 /* -- Disabled state --------------------------------------------------- */ 3390 label:has(input:disabled) { 3391 pointer-events: none; 3392 user-select: none; 3393 } 3394 3395 input:not(:checked):disabled + span { 3396 background-color: ${({colors:e})=>e.neutrals700}; 3397 } 3398 3399 input:checked:disabled + span { 3400 background-color: ${({colors:e})=>e.neutrals700}; 3401 } 3402 3403 input:not(:checked):disabled + span::before { 3404 background-color: ${({colors:e})=>e.neutrals400}; 3405 } 3406 3407 input:checked:disabled + span::before { 3408 background-color: ${({tokens:e})=>e.theme.textTertiary}; 3409 } 3410`;var uP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let j5=class extends ce{constructor(){super(...arguments),this.inputElementRef=t3(),this.checked=!1,this.disabled=!1,this.size="md"}render(){return j` 3411 <label data-size=${this.size}> 3412 <input 3413 ${n3(this.inputElementRef)} 3414 type="checkbox" 3415 ?checked=${this.checked} 3416 ?disabled=${this.disabled} 3417 @change=${this.dispatchChangeEvent.bind(this)} 3418 /> 3419 <span></span> 3420 </label> 3421 `}dispatchChangeEvent(){var t;this.dispatchEvent(new CustomEvent("switchChange",{detail:(t=this.inputElementRef.value)==null?void 0:t.checked,bubbles:!0,composed:!0}))}};j5.styles=[ar,ba,vTt];uP([z({type:Boolean})],j5.prototype,"checked",void 0);uP([z({type:Boolean})],j5.prototype,"disabled",void 0);uP([z()],j5.prototype,"size",void 0);j5=uP([pt("wui-toggle")],j5);const ETt=Gt` 3422 :host { 3423 height: auto; 3424 } 3425 3426 :host > wui-flex { 3427 height: 100%; 3428 display: flex; 3429 align-items: center; 3430 justify-content: center; 3431 column-gap: ${({spacing:e})=>e[2]}; 3432 padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]}; 3433 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 3434 border-radius: ${({borderRadius:e})=>e[4]}; 3435 box-shadow: inset 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary}; 3436 transition: background-color ${({durations:e})=>e.lg} 3437 ${({easings:e})=>e["ease-out-power-2"]}; 3438 will-change: background-color; 3439 cursor: pointer; 3440 } 3441 3442 wui-switch { 3443 pointer-events: none; 3444 } 3445`;var GEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let F_=class extends ce{constructor(){super(...arguments),this.checked=!1}
3445render(){return j` 3446 <wui-flex> 3447 <wui-icon size="xl" name="walletConnectBrown"></wui-icon> 3448 <wui-toggle 3449 ?checked=${this.checked} 3450 size="sm" 3451 @switchChange=${this.handleToggleChange.bind(this)} 3452 ></wui-toggle> 3453 </wui-flex> 3454 `}handleToggleChange(t){t.stopPropagation(),this.checked=t.detail,this.dispatchSwitchEvent()}dispatchSwitchEvent(){this.dispatchEvent(new CustomEvent("certifiedSwitchChange",{detail:this.checked,bubbles:!0,composed:!0}))}};F_.styles=[ar,ba,ETt];GEe([z({type:Boolean})],F_.prototype,"checked",void 0);F_=GEe([pt("wui-certified-switch")],F_);const CTt=Gt` 3455 :host { 3456 position: relative; 3457 width: 100%; 3458 display: inline-flex; 3459 flex-direction: column; 3460 gap: ${({spacing:e})=>e[3]}; 3461 color: ${({tokens:e})=>e.theme.textPrimary}; 3462 caret-color: ${({tokens:e})=>e.core.textAccentPrimary}; 3463 } 3464 3465 .wui-input-text-container { 3466 position: relative; 3467 display: flex; 3468 } 3469 3470 input { 3471 width: 100%; 3472 border-radius: ${({borderRadius:e})=>e[4]}; 3473 color: inherit; 3474 background: transparent; 3475 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 3476 caret-color: ${({tokens:e})=>e.core.textAccentPrimary}; 3477 padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[3]} 3478 ${({spacing:e})=>e[3]} ${({spacing:e})=>e[10]}; 3479 font-size: ${({textSize:e})=>e.large}; 3480 line-height: ${({typography:e})=>e["lg-regular"].lineHeight}; 3481 letter-spacing: ${({typography:e})=>e["lg-regular"].letterSpacing}; 3482 font-weight: ${({fontWeight:e})=>e.regular}; 3483 font-family: ${({fontFamily:e})=>e.regular}; 3484 } 3485 3486 input[data-size='lg'] { 3487 padding: ${({spacing:e})=>e[4]} ${({spacing:e})=>e[3]} 3488 ${({spacing:e})=>e[4]} ${({spacing:e})=>e[10]}; 3489 } 3490 3491 @media (hover: hover) and (pointer: fine) { 3492 input:hover:enabled { 3493 border: 1px solid ${({tokens:e})=>e.theme.borderSecondary}; 3494 } 3495 } 3496 3497 input:disabled { 3498 cursor: unset; 3499 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 3500 } 3501 3502 input::placeholder { 3503 color: ${({tokens:e})=>e.theme.textSecondary}; 3504 } 3505 3506 input:focus:enabled { 3507 border: 1px solid ${({tokens:e})=>e.theme.borderSecondary}; 3508 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 3509 -webkit-box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent040}; 3510 -moz-box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent040}; 3511 box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent040}; 3512 } 3513 3514 div.wui-input-text-container:has(input:disabled) { 3515 opacity: 0.5; 3516 } 3517 3518 wui-icon.wui-input-text-left-icon { 3519 position: absolute; 3520 top: 50%; 3521 transform: translateY(-50%); 3522 pointer-events: none; 3523 left: ${({spacing:e})=>e[4]}; 3524 color: ${({tokens:e})=>e.theme.iconDefault}; 3525 } 3526 3527 button.wui-input-text-submit-button { 3528 position: absolute; 3529 top: 50%; 3530 transform: translateY(-50%); 3531 right: ${({spacing:e})=>e[3]}; 3532 width: 24px; 3533 height: 24px; 3534 border: none; 3535 background: transparent; 3536 border-radius: ${({borderRadius:e})=>e[2]}; 3537 color: ${({tokens:e})=>e.core.textAccentPrimary}; 3538 } 3539 3540 button.wui-input-text-submit-button:disabled { 3541 opacity: 1; 3542 } 3543 3544 button.wui-input-text-submit-button.loading wui-icon { 3545 animation: spin 1s linear infinite; 3546 } 3547 3548 button.wui-input-text-submit-button:hover { 3549 background: ${({tokens:e})=>e.core.foregroundAccent010}; 3550 } 3551 3552 input:has(+ .wui-input-text-submit-button) { 3553 padding-right: ${({spacing:e})=>e[12]}; 3554 } 3555 3556 input[type='number'] { 3557 -moz-appearance: textfield; 3558 } 3559 3560 input[type='search']::-webkit-search-decoration, 3561 input[type='search']::-webkit-search-cancel-button, 3562 input[type='search']::-webkit-search-results-button, 3563 input[type='search']::-webkit-search-results-decoration { 3564 -webkit-appearance: none; 3565 } 3566 3567 /* -- Keyframes --------------------------------------------------- */ 3568 @keyframes spin { 3569 from { 3570 transform: rotate(0deg); 3571 } 3572 to { 3573 transform: rotate(360deg); 3574 } 3575 } 3576`;var Fu=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let yc=class extends ce{constructor(){super(...arguments),this.inputElementRef=t3(),this.disabled=!1,this.loading=!1,this.placeholder="",this.type="text",this.value="",this.size="md"}render(){return j` <div class="wui-input-text-container"> 3577 ${this.templateLeftIcon()} 3578 <input 3579 data-size=${this.size} 3580 ${n3(this.inputElementRef)} 3581 data-testid="wui-input-text" 3582 type=${this.type} 3583 enterkeyhint=${ge(this.enterKeyHint)} 3584 ?disabled=${this.disabled} 3585 placeholder=${this.placeholder}
3586 @input=${this.dispatchInputChangeEvent.bind(this)} 3587 @keydown=${this.onKeyDown} 3588 .value=${this.value||""} 3589 /> 3590 ${this.templateSubmitButton()} 3591 <slot class="wui-input-text-slot"></slot> 3592 </div> 3593 ${this.templateError()} ${this.templateWarning()}`}templateLeftIcon(){return this.icon?j`<wui-icon 3594 class="wui-input-text-left-icon" 3595 size="md" 3596 data-size=${this.size} 3597 color="inherit" 3598 name=${this.icon} 3599 ></wui-icon>`:null}templateSubmitButton(){var t;return this.onSubmit?j`<button 3600 class="wui-input-text-submit-button ${this.loading?"loading":""}" 3601 @click=${(t=this.onSubmit)==null?void 0:t.bind(this)} 3602 ?disabled=${this.disabled||this.loading} 3603 > 3604 ${this.loading?j`<wui-icon name="spinner" size="md"></wui-icon>`:j`<wui-icon name="chevronRight" size="md"></wui-icon>`} 3605 </button>`:null}templateError(){return this.errorText?j`<wui-text variant="sm-regular" color="error">${this.errorText}</wui-text>`:null}templateWarning(){return this.warningText?j`<wui-text variant="sm-regular" color="warning">${this.warningText}</wui-text>`:null}dispatchInputChangeEvent(){var t;this.dispatchEvent(new CustomEvent("inputChange",{detail:(t=this.inputElementRef.value)==null?void 0:t.value,bubbles:!0,composed:!0}))}};yc.styles=[ar,ba,CTt];Fu([z()],yc.prototype,"icon",void 0);Fu([z({type:Boolean})],yc.prototype,"disabled",void 0);Fu([z({type:Boolean})],yc.prototype,"loading",void 0);Fu([z()],yc.prototype,"placeholder",void 0);Fu([z()],yc.prototype,"type",void 0);Fu([z()],yc.prototype,"value",void 0);Fu([z()],yc.prototype,"errorText",void 0);Fu([z()],yc.prototype,"warningText",void 0);Fu([z()],yc.prototype,"onSubmit",void 0);Fu([z()],yc.prototype,"size",void 0);Fu([z({attribute:!1})],yc.prototype,"onKeyDown",void 0);yc=Fu([pt("wui-input-text")],yc);const $Tt=Gt` 3606 :host { 3607 position: relative; 3608 display: inline-block; 3609 width: 100%; 3610 } 3611 3612 wui-icon { 3613 position: absolute; 3614 top: 50%; 3615 transform: translateY(-50%); 3616 right: ${({spacing:e})=>e[3]}; 3617 color: ${({tokens:e})=>e.theme.iconDefault}; 3618 cursor: pointer; 3619 padding: ${({spacing:e})=>e[2]}; 3620 background-color: transparent; 3621 border-radius: ${({borderRadius:e})=>e[4]}; 3622 transition: background-color ${({durations:e})=>e.lg} 3623 ${({easings:e})=>e["ease-out-power-2"]}; 3624 } 3625 3626 @media (hover: hover) { 3627 wui-icon:hover { 3628 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 3629 } 3630 } 3631`;var ZEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let z_=class extends ce{constructor(){super(...arguments),this.inputComponentRef=t3(),this.inputValue=""}render(){return j` 3632 <wui-input-text 3633 ${n3(this.inputComponentRef)} 3634 placeholder="Search wallet" 3635 icon="search" 3636 type="search" 3637 enterKeyHint="search" 3638 size="sm" 3639 @inputChange=${this.onInputChange} 3640 > 3641 ${this.inputValue?j`<wui-icon 3642 @click=${this.clearValue} 3643 color="inherit" 3644 size="sm" 3645 name="close" 3646 ></wui-icon>`:null} 3647 </wui-input-text> 3648 `}onInputChange(t){this.inputValue=t.detail||""}clearValue(){const t=this.inputComponentRef.value,n=t==null?void 0:t.inputElementRef.value;n&&(n.value="",this.inputValue="",n.focus(),n.dispatchEvent(new Event("input")))}};z_.styles=[ar,$Tt];ZEe([z()],z_.prototype,"inputValue",void 0);z_=ZEe([pt("wui-search-bar")],z_);const xTt=ae`<svg viewBox="0 0 48 54" fill="none"> 3649 <path 3650 d="M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z" 3651 /> 3652</svg>`,ITt=Gt` 3653 :host { 3654 display: flex; 3655 flex-direction: column; 3656 justify-content: center;
3657 align-items: center; 3658 height: 104px; 3659 width: 104px; 3660 row-gap: ${({spacing:e})=>e[2]}; 3661 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 3662 border-radius: ${({borderRadius:e})=>e[5]}; 3663 position: relative; 3664 } 3665 3666 wui-shimmer[data-type='network'] { 3667 border: none; 3668 -webkit-clip-path: var(--apkt-path-network); 3669 clip-path: var(--apkt-path-network); 3670 } 3671 3672 svg { 3673 position: absolute; 3674 width: 48px; 3675 height: 54px; 3676 z-index: 1; 3677 } 3678 3679 svg > path { 3680 stroke: ${({tokens:e})=>e.theme.foregroundSecondary}; 3681 stroke-width: 1px; 3682 } 3683 3684 @media (max-width: 350px) { 3685 :host { 3686 width: 100%; 3687 } 3688 } 3689`;var YEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let q_=class extends ce{constructor(){super(...arguments),this.type="wallet"}render(){return j` 3690 ${this.shimmerTemplate()} 3691 <wui-shimmer width="80px" height="20px"></wui-shimmer> 3692 `}shimmerTemplate(){return this.type==="network"?j` <wui-shimmer data-type=${this.type} width="48px" height="54px"></wui-shimmer> 3693 ${xTt}`:j`<wui-shimmer width="56px" height="56px"></wui-shimmer>`}};q_.styles=[ar,ba,ITt];YEe([z()],q_.prototype,"type",void 0);q_=YEe([pt("wui-card-select-loader")],q_);const STt=Xe` 3694 :host { 3695 display: grid; 3696 width: inherit; 3697 height: inherit; 3698 } 3699`;var zu=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let bc=class extends ce{render(){return this.style.cssText=` 3700 grid-template-rows: ${this.gridTemplateRows}; 3701 grid-template-columns: ${this.gridTemplateColumns}; 3702 justify-items: ${this.justifyItems}; 3703 align-items: ${this.alignItems}; 3704 justify-content: ${this.justifyContent}; 3705 align-content: ${this.alignContent}; 3706 column-gap: ${this.columnGap&&`var(--apkt-spacing-${this.columnGap})`}; 3707 row-gap: ${this.rowGap&&`var(--apkt-spacing-${this.rowGap})`}; 3708 gap: ${this.gap&&`var(--apkt-spacing-${this.gap})`}; 3709 padding-top: ${this.padding&&Xs.getSpacingStyles(this.padding,0)}; 3710 padding-right: ${this.padding&&Xs.getSpacingStyles(this.padding,1)}; 3711 padding-bottom: ${this.padding&&Xs.getSpacingStyles(this.padding,2)}; 3712 padding-left: ${this.padding&&Xs.getSpacingStyles(this.padding,3)}; 3713 margin-top: ${this.margin&&Xs.getSpacingStyles(this.margin,0)}; 3714 margin-right: ${this.margin&&Xs.getSpacingStyles(this.margin,1)}; 3715 margin-bottom: ${this.margin&&Xs.getSpacingStyles(this.margin,2)}; 3716 margin-left: ${this.margin&&Xs.getSpacingStyles(this.margin,3)}; 3717 `,j`<slot></slot>`}};bc.styles=[ar,STt];zu([z()],bc.prototype,"gridTemplateRows",void 0);zu([z()],bc.prototype,"gridTemplateColumns",void 0);zu([z()],bc.prototype,"justifyItems",void 0);zu([z()],bc.prototype,"alignItems",void 0);zu([z()],bc.prototype,"justifyContent",void 0);zu([z()],bc.prototype,"alignContent",void 0);zu([z()],bc.prototype,"columnGap",void 0);zu([z()],bc.prototype,"rowGap",void 0);zu([z()],bc.prototype,"gap",void 0);zu([z()],bc.prototype,"padding",void 0);zu([z()],bc.prototype,"margin",void 0);bc=zu([pt("wui-grid")],bc);const ATt=Gt` 3718 button { 3719 display: flex; 3720 flex-direction: column; 3721 justify-content: center; 3722 align-items: center; 3723 cursor: pointer; 3724 width: 104px; 3725 row-gap: ${({spacing:e})=>e[2]}; 3726 padding: ${({spacing:e})=>e[3]} ${({spacing:e})=>e[0]}; 3727 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 3728 border-radius: clamp(0px, ${({borderRadius:e})=>e[4]}, 20px); 3729 transition: 3730 color ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-1"]}, 3731 background-color ${({durations:e})=>e.lg} 3732 ${({easings:e})=>e["ease-out-power-1"]}, 3733 border-radius ${({durations:e})=>e.lg} 3734 ${({easings:e})=>e["ease-out-power-1"]}; 3735 will-change: background-color, color, border-radius; 3736 outline: none; 3737 border: none; 3738 } 3739 3740 button > wui-flex > wui-text { 3741 color: ${({tokens:e})=>e.theme.textPrimary}; 3742 max-width: 86px; 3743 white-space: nowrap; 3744 overflow: hidden; 3745 text-overflow: ellipsis; 3746 justify-content: center; 3747 } 3748 3749 button > wui-flex > wui-text.certified { 3750 max-width: 66px; 3751 } 3752 3753 @media (hover: hover) and (pointer: fine) { 3754 button:hover:enabled { 3755 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 3756 } 3757 } 3758 3759 button:disabled > wui-flex > wui-text { 3760 color: ${({tokens:e})=>e.core.glass010}; 3761 } 3762 3763 [data-selected='true'] { 3764 background-color: ${({colors:e})=>e.accent020}; 3765 } 3766 3767 @media (hover: hover) and (pointer: fine) { 3768 [data-selected='true']:hover:enabled { 3769 background-color: ${({colors:e})=>e.accent010}; 3770 } 3771 } 3772 3773 [data-selected='true']:active:enabled { 3774 background-color: ${({colors:e})=>e.accent010}; 3775 } 3776 3777 @media (max-width: 350px) { 3778 button { 3779 width: 100%; 3780 } 3781 } 3782`;var vf=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let _u=class extends ce{constructor(){super(),this.observer=new IntersectionObserver(()=>{}),this.visible=!1,this.imageSrc=void 0,this.imageLoading=!1,this.isImpressed=!1,this.explorerId="",this.walletQuery="",this.certified=!1,this.displayIndex=0,this.wallet=void 0,this.observer=new IntersectionObserver(t=>{t.forEach(n=>
3782{n.isIntersecting?(this.visible=!0,this.fetchImageSrc(),this.sendImpressionEvent()):this.visible=!1})},{threshold:.01})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){var n,r;const t=((n=this.wallet)==null?void 0:n.badge_type)==="certified";return j` 3783 <button> 3784 ${this.imageTemplate()} 3785 <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="1"> 3786 <wui-text 3787 variant="md-regular" 3788 color="inherit" 3789 class=${ge(t?"certified":void 0)} 3790 >${(r=this.wallet)==null?void 0:r.name}</wui-text 3791 > 3792 ${t?j`<wui-icon size="sm" name="walletConnectBrown"></wui-icon>`:null} 3793 </wui-flex> 3794 </button> 3795 `}imageTemplate(){var t,n;return!this.visible&&!this.imageSrc||this.imageLoading?this.shimmerTemplate():j` 3796 <wui-wallet-image 3797 size="lg" 3798 imageSrc=${ge(this.imageSrc)} 3799 name=${ge((t=this.wallet)==null?void 0:t.name)} 3800 .installed=${((n=this.wallet)==null?void 0:n.installed)??!1} 3801 badgeSize="sm" 3802 > 3803 </wui-wallet-image> 3804 `}shimmerTemplate(){return j`<wui-shimmer width="56px" height="56px"></wui-shimmer>`}async fetchImageSrc(){this.wallet&&(this.imageSrc=wc.getWalletImage(this.wallet),!this.imageSrc&&(this.imageLoading=!0,this.imageSrc=await wc.fetchWalletImage(this.wallet.image_id),this.imageLoading=!1))}sendImpressionEvent(){!this.wallet||this.isImpressed||(this.isImpressed=!0,It.sendWalletImpressionEvent({name:this.wallet.name,walletRank:this.wallet.order,explorerId:this.explorerId,view:fe.state.view,query:this.walletQuery,certified:this.certified,displayIndex:this.displayIndex}))}};_u.styles=ATt;vf([se()],_u.prototype,"visible",void 0);vf([se()],_u.prototype,"imageSrc",void 0);vf([se()],_u.prototype,"imageLoading",void 0);vf([se()],_u.prototype,"isImpressed",void 0);vf([z()],_u.prototype,"explorerId",void 0);vf([z()],_u.prototype,"walletQuery",void 0);vf([z()],_u.prototype,"certified",void 0);vf([z()],_u.prototype,"displayIndex",void 0);vf([z({type:Object})],_u.prototype,"wallet",void 0);_u=vf([pt("w3m-all-wallets-list-item")],_u);const _Tt=Gt` 3805 wui-grid { 3806 max-height: clamp(360px, 400px, 80vh); 3807 overflow: scroll; 3808 scrollbar-width: none; 3809 grid-auto-rows: min-content; 3810 grid-template-columns: repeat(auto-fill, 104px); 3811 } 3812 3813 :host([data-mobile-fullscreen='true']) wui-grid { 3814 max-height: none; 3815 } 3816 3817 @media (max-width: 350px) { 3818 wui-grid { 3819 grid-template-columns: repeat(2, 1fr); 3820 } 3821 } 3822 3823 wui-grid[data-scroll='false'] { 3824 overflow: hidden; 3825 } 3826 3827 wui-grid::-webkit-scrollbar {
3828 display: none; 3829 } 3830 3831 w3m-all-wallets-list-item { 3832 opacity: 0; 3833 animation-duration: ${({durations:e})=>e.xl}; 3834 animation-timing-function: ${({easings:e})=>e["ease-inout-power-2"]}; 3835 animation-name: fade-in; 3836 animation-fill-mode: forwards; 3837 } 3838 3839 @keyframes fade-in { 3840 from { 3841 opacity: 0; 3842 } 3843 to { 3844 opacity: 1; 3845 } 3846 } 3847 3848 wui-loading-spinner { 3849 padding-top: ${({spacing:e})=>e[4]}; 3850 padding-bottom: ${({spacing:e})=>e[4]}; 3851 justify-content: center; 3852 grid-column: 1 / span 4; 3853 } 3854`;var z$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const Jae="local-paginator";let Ty=class extends ce{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.loading=!De.state.wallets.length,this.wallets=De.state.wallets,this.mobileFullScreen=ke.state.enableMobileFullScreen,this.unsubscribe.push(De.subscribeKey("wallets",t=>this.wallets=t))}firstUpdated(){this.initialFetch(),this.createPaginationObserver()}disconnectedCallback(){var t;this.unsubscribe.forEach(n=>n()),(t=this.paginationObserver)==null||t.disconnect()}render(){return this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),j` 3855 <wui-grid 3856 data-scroll=${!this.loading} 3857 .padding=${["0","3","3","3"]} 3858 gap="2" 3859 justifyContent="space-between" 3860 > 3861 ${this.loading?this.shimmerTemplate(16):this.walletsTemplate()} 3862 ${this.paginationLoaderTemplate()} 3863 </wui-grid> 3864 `}async initialFetch(){var n;this.loading=!0;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("wui-grid");t&&(await De.fetchWalletsByPage({page:1}),await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.loading=!1,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}shimmerTemplate(t,n){return[...Array(t)].map(()=>j` 3865 <wui-card-select-loader type="wallet" id=${ge(n)}></wui-card-select-loader> 3866 `)}walletsTemplate(){return Fh.getWalletConnectWallets(this.wallets).map((t,n)=>j` 3867 <w3m-all-wallets-list-item 3868 data-testid="wallet-search-item-${t.id}" 3869 @click=${()=>this.onConnectWallet(t)} 3870 .wallet=${t} 3871 explorerId=${t.id} 3872 certified=${this.badge==="certified"} 3873 displayIndex=${n} 3874 ></w3m-all-wallets-list-item> 3875 `)}paginationLoaderTemplate(){const{wallets:t,recommended:n,featured:r,count:s,mobileFilteredOutWalletsLength:i}=De.state,o=window.innerWidth<352?3:4,a=t.length+n.length;let l=Math.ceil(a/o)*o-a+o;return l-=t.length?r.length%o:0,s===0&&r.length>0?null:s===0||[...r,...t,...n].length<s-(i??0)?this.shimmerTemplate(l,Jae):null}createPaginationObserver(){var n;const t=(n=this.shadowRoot)==null?void 0:n.querySelector(`#${Jae}`);t&&(this.paginationObserver=new IntersectionObserver(([r])=>{if(r!=null&&r.isIntersecting&&!this.loading){const{page:s,count:i,wallets:o}=De.state;o.length<i&&De.fetchWalletsByPage({page:s+1})}}),this.paginationObserver.observe(t))}onConnectWallet(t){qe.selectWalletConnector(t)}};Ty.styles=_Tt;z$([se()],Ty.prototype,"loading",void 0);z$([se()],Ty.prototype,"wallets",void 0);z$([se()],Ty.prototype,"badge",void 0);z$([se()],Ty.prototype,"mobileFullScreen",void 0);Ty=z$([pt("w3m-all-wallets-list")],Ty);const NTt=Xe` 3876 wui-grid, 3877 wui-loading-spinner, 3878 wui-flex { 3879 height: 360px; 3880 } 3881 3882 wui-grid { 3883 overflow: scroll; 3884 scrollbar-width: none; 3885 grid-auto-rows: min-content; 3886 grid-template-columns: repeat(auto-fill, 104px); 3887 } 3888 3889 :host([data-mobile-fullscreen='true']) wui-grid { 3890 max-height: none; 3891 height: auto; 3892 } 3893 3894 wui-grid[data-scroll='false'] { 3895 overflow: hidden; 3896 } 3897 3898 wui-grid::-webkit-scrollbar {
3899 display: none; 3900 } 3901 3902 wui-loading-spinner { 3903 justify-content: center; 3904 align-items: center; 3905 } 3906 3907 @media (max-width: 350px) { 3908 wui-grid { 3909 grid-template-columns: repeat(2, 1fr); 3910 } 3911 } 3912`;var q$=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Py=class extends ce{constructor(){super(...arguments),this.prevQuery="",this.prevBadge=void 0,this.loading=!0,this.mobileFullScreen=ke.state.enableMobileFullScreen,this.query=""}render(){return this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.onSearch(),this.loading?j`<wui-loading-spinner color="accent-primary"></wui-loading-spinner>`:this.walletsTemplate()}async onSearch(){(this.query.trim()!==this.prevQuery.trim()||this.badge!==this.prevBadge)&&(this.prevQuery=this.query,this.prevBadge=this.badge,this.loading=!0,await De.searchWallet({search:this.query,badge:this.badge}),this.loading=!1)}walletsTemplate(){const{search:t}=De.state,n=Fh.markWalletsAsInstalled(t),r=Fh.filterWalletsByWcSupport(n);return r.length?j` 3913 <wui-grid 3914 data-testid="wallet-list" 3915 .padding=${["0","3","3","3"]} 3916 rowGap="4" 3917 columngap="2" 3918 justifyContent="space-between" 3919 > 3920 ${r.map((s,i)=>j` 3921 <w3m-all-wallets-list-item 3922 @click=${()=>this.onConnectWallet(s)} 3923 .wallet=${s} 3924 data-testid="wallet-search-item-${s.id}" 3925 explorerId=${s.id} 3926 certified=${this.badge==="certified"} 3927 walletQuery=${this.query} 3928 displayIndex=${i} 3929 ></w3m-all-wallets-list-item> 3930 `)} 3931 </wui-grid> 3932 `:j` 3933 <wui-flex 3934 data-testid="no-wallet-found" 3935 justifyContent="center" 3936 alignItems="center" 3937 gap="3" 3938 flexDirection="column" 3939 > 3940 <wui-icon-box size="lg" color="default" icon="wallet"></wui-icon-box> 3941 <wui-text data-testid="no-wallet-found-text" color="secondary" variant="md-medium"> 3942 No Wallet found 3943 </wui-text> 3944 </wui-flex> 3945 `}onConnectWallet(t){qe.selectWalletConnector(t)}};Py.styles=NTt;q$([se()],Py.prototype,"loading",void 0);q$([se()],Py.prototype,"mobileFullScreen",void 0);q$([z()],Py.prototype,"query",void 0);q$([z()],Py.prototype,"badge",void 0);Py=q$([pt("w3m-all-wallets-search")],Py);var qK=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let M4=class extends ce{constructor(){super(...arguments),this.search="",this.badge=void 0,this.onDebouncedSearch=Be.debounce(t=>{this.search=t})}render(){const t=this.search.length>=2;return j` 3946 <wui-flex .padding=${["1","3","3","3"]} gap="2" alignItems="center"> 3947 <wui-search-bar @inputChange=${this.onInputChange.bind(this)}></wui-search-bar> 3948 <wui-certified-switch 3949 ?checked=${this.badge==="certified"} 3950 @certifiedSwitchChange=${this.onCertifiedSwitchChange.bind(this)} 3951 data-testid="wui-certified-switch" 3952 ></wui-certified-switch> 3953 ${this.qrButtonTemplate()} 3954 </wui-flex> 3955 ${t||this.badge?j`<w3m-all-wallets-search 3956 query=${this.search} 3957 .badge=${this.badge} 3958 ></w3m-all-wallets-search>`:j`<w3m-all-wallets-list .badge=${this.badge}></w3m-all-wallets-list>`} 3959 `}onInputChange(t){this.onDebouncedSearch(t.detail)}onCertifiedSwitchChange(t){t.detail?(this.badge="certified",Xn.showSvg("Only WalletConnect certified",{icon:"walletConnectBrown",iconColor:"accent-100"})):this.badge=void 0}qrButtonTemplate(){return Be.isMobile()?j` 3960 <wui-icon-box 3961 size="xl" 3962 iconSize="xl" 3963 color="accent-primary" 3964 icon="qrCode" 3965 border 3966 borderColor="wui-accent-glass-010" 3967 @click=${this.onWalletConnectQr.bind(this)} 3968 ></wui-icon-box> 3969 `:null}onWalletConnectQr(){fe.push("ConnectingWalletConnect")}};qK([se()],M4.prototype,"search",void 0);qK([se()],M4.prototype,"badge",void 0);M4=qK([pt("w3m-all-wallets-view")],M4);const TTt=Gt` 3970 :host { 3971 width: 100%; 3972 } 3973 3974 :host([data-type='primary']) > button { 3975 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 3976 } 3977 3978 :host([data-type='secondary']) > button { 3979 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 3980 } 3981 3982 button { 3983 display: flex; 3984 align-items: center; 3985 justify-content: space-between; 3986 padding: ${({spacing:e})=>e[3]}; 3987 width: 100%; 3988 border-radius: ${({borderRadius:e})=>e[4]}; 3989 transition: 3990 background-color ${({durations:e})=>e.lg} 3991 ${({easings:e})=>e["ease-out-power-2"]}, 3992 scale ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; 3993 will-change: background-color, scale; 3994 } 3995 3996 wui-text { 3997 text-transform: capitalize; 3998 } 3999 4000 wui-image { 4001 color: ${({tokens:e})=>e.theme.textPrimary}; 4002 } 4003 4004 @media (hover: hover) { 4005 :host([data-type='primary']) > button:hover:enabled { 4006 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 4007 } 4008 4009 :host([data-type='secondary']) > button:hover:enabled { 4010 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4011 } 4012 } 4013 4014 button:disabled { 4015 opacity: 0.5;
4016 cursor: not-allowed; 4017 } 4018`;var Nc=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let To=class extends ce{constructor(){super(...arguments),this.type="primary",this.imageSrc="google",this.imageSize=void 0,this.loading=!1,this.boxColor="foregroundPrimary",this.disabled=!1,this.rightIcon=!0,this.boxed=!0,this.rounded=!1,this.fullSize=!1}render(){return this.dataset.rounded=this.rounded?"true":"false",this.dataset.type=this.type,j` 4019 <button 4020 ?disabled=${this.loading?!0:!!this.disabled} 4021 data-loading=${this.loading} 4022 tabindex=${ge(this.tabIdx)} 4023 > 4024 <wui-flex gap="2" alignItems="center"> 4025 ${this.templateLeftIcon()} 4026 <wui-flex gap="1"> 4027 <slot></slot> 4028 </wui-flex> 4029 </wui-flex> 4030 ${this.templateRightIcon()} 4031 </button> 4032 `}templateLeftIcon(){return this.icon?j`<wui-image 4033 icon=${this.icon} 4034 iconColor=${ge(this.iconColor)} 4035 ?boxed=${this.boxed} 4036 ?rounded=${this.rounded} 4037 boxColor=${this.boxColor} 4038 ></wui-image>`:j`<wui-image 4039 ?boxed=${this.boxed} 4040 ?rounded=${this.rounded} 4041 ?fullSize=${this.fullSize} 4042 size=${ge(this.imageSize)} 4043 src=${this.imageSrc} 4044 boxColor=${this.boxColor} 4045 ></wui-image>`}templateRightIcon(){return this.rightIcon?this.loading?j`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:j`<wui-icon name="chevronRight" size="lg" color="default"></wui-icon>`:null}};To.styles=[ar,ba,TTt];Nc([z()],To.prototype,"type",void 0);Nc([z()],To.prototype,"imageSrc",void 0);Nc([z()],To.prototype,"imageSize",void 0);Nc([z()],To.prototype,"icon",void 0);Nc([z()],To.prototype,"iconColor",void 0);Nc([z({type:Boolean})],To.prototype,"loading",void 0);Nc([z()],To.prototype,"tabIdx",void 0);Nc([z()],To.prototype,"boxColor",void 0);Nc([z({type:Boolean})],To.prototype,"disabled",void 0);Nc([z({type:Boolean})],To.prototype,"rightIcon",void 0);Nc([z({type:Boolean})],To.prototype,"boxed",void 0);Nc([z({type:Boolean})],To.prototype,"rounded",void 0);Nc([z({type:Boolean})],To.prototype,"fullSize",void 0);To=Nc([pt("wui-list-item")],To);var PTt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let $z=class extends ce{constructor(){var t;super(...arguments),this.wallet=(t=fe.state.data)==null?void 0:t.wallet}render(){if(!this.wallet)throw new Error("w3m-downloads-view");return j` 4046 <wui-flex gap="2" flexDirection="column" .padding=${["3","3","4","3"]}> 4047 ${this.chromeTemplate()} ${this.iosTemplate()} ${this.androidTemplate()} 4048 ${this.homepageTemplate()} 4049 </wui-flex> 4050 `}chromeTemplate(){var t;return(t=this.wallet)!=null&&t.chrome_store?j`<wui-list-item 4051 variant="icon" 4052 icon="chromeStore" 4053 iconVariant="square" 4054 @click=${this.onChromeStore.bind(this)} 4055 chevron 4056 > 4057 <wui-text variant="md-medium" color="primary">Chrome Extension</wui-text> 4058 </wui-list-item>`:null}iosTemplate(){var t;return(t=this.wallet)!=null&&t.app_store?j`<wui-list-item 4059 variant="icon" 4060 icon="appStore" 4061 iconVariant="square" 4062 @click=${this.onAppStore.bind(this)} 4063 chevron 4064 > 4065 <wui-text variant="md-medium" color="primary">iOS App</wui-text> 4066 </wui-list-item>`:null}androidTemplate(){var t;return(t=this.wallet)!=null&&t.play_store?j`<wui-list-item 4067 variant="icon" 4068 icon="playStore" 4069 iconVariant="square" 4070 @click=${this.onPlayStore.bind(this)} 4071 chevron 4072 > 4073 <wui-text variant="md-medium" color="primary">Android App</wui-text> 4074 </wui-list-item>`:null}homepageTemplate(){var t;return(t=this.wallet)!=null&&t.homepage?j` 4075 <wui-list-item 4076 variant="icon" 4077 icon="browser" 4078 iconVariant="square-blue" 4079 @click=${this.onHomePage.bind(this)} 4080 chevron 4081 > 4082 <wui-text variant="md-medium" color="primary">Website</wui-text> 4083 </wui-list-item> 4084 `:null}openStore(t){t.href&&this.wallet&&(It.sendEvent({type:"track",event:"GET_WALLET",properties:{name:this.wallet.name,walletRank:this.wallet.order,explorerId:this.wallet.id,type:t.type}}),Be.openHref(t.href,"_blank"))}onChromeStore(){var t;(t=this.wallet)!=null&&t.chrome_store&&this.openStore({href:this.wallet.chrome_store,type:"chrome_store"})}onAppStore(){var t;(t=this.wallet)!=null&&t.app_store&&this.openStore({href:this.wallet.app_store,type:"app_store"})}onPlayStore(){var t;(t=this.wallet)!=null&&t.play_store&&this.openStore({href:this.wallet.play_store,type:"play_store"})}onHomePage(){var t;(t=this.wallet)!=null&&t.homepage&&this.openStore({href:this.wallet.homepage,type:"homepage"})}};$z=PTt([pt("w3m-downloads-view")],$z);const OTt=Object.freeze(Object.defineProperty({__proto__:null,get W3mAllWalletsView(){return M4},get W3mConnectingWcBasicView(){return L4},get W3mDownloadsView(){return $z}},Symbol.toStringTag,{value:"Module"})),kTt=Gt`
4085 :host { 4086 display: block; 4087 border-radius: clamp(0px, ${({borderRadius:e})=>e[8]}, 44px); 4088 box-shadow: 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary}; 4089 overflow: hidden; 4090 } 4091`;var RTt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let xz=class extends ce{render(){return j`<slot></slot>`}};xz.styles=[ar,kTt];xz=RTt([pt("wui-card")],xz);const BTt=Gt` 4092 :host { 4093 width: 100%; 4094 } 4095 4096 :host > wui-flex { 4097 width: 100%; 4098 display: flex; 4099 align-items: center; 4100 justify-content: center; 4101 gap: ${({spacing:e})=>e[2]}; 4102 padding: ${({spacing:e})=>e[3]}; 4103 border-radius: ${({borderRadius:e})=>e[6]}; 4104 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 4105 box-sizing: border-box; 4106 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 4107 box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25); 4108 color: ${({tokens:e})=>e.theme.textPrimary}; 4109 } 4110 4111 :host > wui-flex[data-type='info'] { 4112 .icon-box { 4113 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4114 4115 wui-icon { 4116 color: ${({tokens:e})=>e.theme.iconDefault}; 4117 } 4118 } 4119 } 4120 :host > wui-flex[data-type='success'] { 4121 .icon-box { 4122 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 4123 4124 wui-icon { 4125 color: ${({tokens:e})=>e.core.borderSuccess}; 4126 } 4127 } 4128 } 4129 :host > wui-flex[data-type='warning'] { 4130 .icon-box { 4131 background-color: ${({tokens:e})=>e.core.backgroundWarning}; 4132 4133 wui-icon { 4134 color: ${({tokens:e})=>e.core.borderWarning}; 4135 } 4136 } 4137 } 4138 :host > wui-flex[data-type='error'] { 4139 .icon-box { 4140 background-color: ${({tokens:e})=>e.core.backgroundError}; 4141 4142 wui-icon { 4143 color: ${({tokens:e})=>e.core.borderError}; 4144 } 4145 } 4146 } 4147 4148 wui-flex { 4149 width: 100%; 4150 } 4151 4152 wui-text { 4153 word-break: break-word; 4154 flex: 1; 4155 } 4156 4157 .close { 4158 cursor: pointer; 4159 color: ${({tokens:e})=>e.theme.iconDefault}; 4160 } 4161 4162 .icon-box { 4163 height: 40px; 4164 width: 40px; 4165 border-radius: ${({borderRadius:e})=>e[2]}; 4166 background-color: var(--local-icon-bg-value); 4167 } 4168`;var WK=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const DTt={info:"info",success:"checkmark",warning:"warningCircle",error:"warning"};let j4=class extends ce{constructor(){super(...arguments),this.message="",this.type="info"}render(){return j` 4169 <wui-flex 4170 data-type=${ge(this.type)} 4171 flexDirection="row" 4172 justifyContent="space-between" 4173 alignItems="center" 4174 gap="2" 4175 > 4176 <wui-flex columnGap="2" flexDirection="row" alignItems="center"> 4177 <wui-flex 4178 flexDirection="row" 4179 alignItems="center" 4180 justifyContent="center" 4181 class="icon-box" 4182 > 4183 <wui-icon color="inherit" size="md" name=${DTt[this.type]}></wui-icon> 4184 </wui-flex> 4185 <wui-text variant="md-medium" color="inherit" data-testid="wui-alertbar-text" 4186 >${this.message}</wui-text 4187 > 4188 </wui-flex> 4189 <wui-icon 4190 class="close" 4191 color="inherit" 4192 size="sm" 4193 name="close" 4194 @click=${this.onClose} 4195 ></wui-icon> 4196 </wui-flex> 4197 `}onClose(){A8.close()}};j4.styles=[ar,BTt];WK([z()],j4.prototype,"message",void 0);WK([z()],j4.prototype,"type",void 0);j4=WK([pt("wui-alertbar")],j4);const UTt=Gt` 4198 :host { 4199 display: block; 4200 position: absolute; 4201 top: ${({spacing:e})=>e[3]}; 4202 left: ${({spacing:e})=>e[4]}; 4203 right: ${({spacing:e})=>e[4]}; 4204 opacity: 0; 4205 pointer-events: none; 4206 } 4207`;var JEe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const LTt={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"warning"}};let W_=class extends ce{constructor(){super(),this.unsubscribe=[],this.open=A8.state.open,this.onOpen(!0),this.unsubscribe.push(A8.subscribeKey("open",t=>{this.open=t,this.onOpen(!1)}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:n}=A8.state,r=LTt[n];return j` 4208 <wui-alertbar 4209 message=${t} 4210 backgroundColor=${r==null?void 0:r.backgroundColor} 4211 iconColor=${r==null?void 0:r.iconColor} 4212 icon=${r==null?void 0:r.icon} 4213 type=${n} 4214 ></wui-alertbar> 4215 `}onOpen(t){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):t||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};W_.styles=UTt;JEe([se()],W_.prototype,"open",void 0);W_=JEe([pt("w3m-alertbar")],W_);const MTt=Gt` 4216 :host { 4217 position: relative; 4218 } 4219 4220 button { 4221 display: flex; 4222 justify-content: center;
4223 align-items: center; 4224 background-color: transparent; 4225 padding: ${({spacing:e})=>e[1]}; 4226 } 4227 4228 /* -- Colors --------------------------------------------------- */ 4229 button[data-type='accent'] wui-icon { 4230 color: ${({tokens:e})=>e.core.iconAccentPrimary}; 4231 } 4232 4233 button[data-type='neutral'][data-variant='primary'] wui-icon { 4234 color: ${({tokens:e})=>e.theme.iconInverse}; 4235 } 4236 4237 button[data-type='neutral'][data-variant='secondary'] wui-icon { 4238 color: ${({tokens:e})=>e.theme.iconDefault}; 4239 } 4240 4241 button[data-type='success'] wui-icon { 4242 color: ${({tokens:e})=>e.core.iconSuccess}; 4243 } 4244 4245 button[data-type='error'] wui-icon { 4246 color: ${({tokens:e})=>e.core.iconError}; 4247 } 4248 4249 /* -- Sizes --------------------------------------------------- */ 4250 button[data-size='xs'] { 4251 width: 16px; 4252 height: 16px; 4253 4254 border-radius: ${({borderRadius:e})=>e[1]}; 4255 } 4256 4257 button[data-size='sm'] { 4258 width: 20px; 4259 height: 20px; 4260 border-radius: ${({borderRadius:e})=>e[1]}; 4261 } 4262 4263 button[data-size='md'] { 4264 width: 24px; 4265 height: 24px; 4266 border-radius: ${({borderRadius:e})=>e[2]}; 4267 } 4268 4269 button[data-size='lg'] { 4270 width: 28px; 4271 height: 28px; 4272 border-radius: ${({borderRadius:e})=>e[2]}; 4273 } 4274 4275 button[data-size='xs'] wui-icon { 4276 width: 8px; 4277 height: 8px; 4278 } 4279 4280 button[data-size='sm'] wui-icon { 4281 width: 12px; 4282 height: 12px; 4283 } 4284 4285 button[data-size='md'] wui-icon { 4286 width: 16px; 4287 height: 16px; 4288 } 4289 4290 button[data-size='lg'] wui-icon { 4291 width: 20px; 4292 height: 20px; 4293 } 4294 4295 /* -- Hover --------------------------------------------------- */ 4296 @media (hover: hover) { 4297 button[data-type='accent']:hover:enabled { 4298 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 4299 } 4300 4301 button[data-variant='primary'][data-type='neutral']:hover:enabled { 4302 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4303 } 4304 4305 button[data-variant='secondary'][data-type='neutral']:hover:enabled { 4306 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4307 } 4308 4309 button[data-type='success']:hover:enabled { 4310 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 4311 } 4312 4313 button[data-type='error']:hover:enabled { 4314 background-color: ${({tokens:e})=>e.core.backgroundError}; 4315 } 4316 } 4317 4318 /* -- Focus --------------------------------------------------- */ 4319 button:focus-visible { 4320 box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020}; 4321 } 4322 4323 /* -- Properties --------------------------------------------------- */ 4324 button[data-full-width='true'] { 4325 width: 100%; 4326 } 4327 4328 :host([fullWidth]) { 4329 width: 100%; 4330 } 4331 4332 button[disabled] { 4333 opacity: 0.5; 4334 cursor: not-allowed; 4335 } 4336`;var y1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let uf=class extends ce{constructor(){super(...arguments),this.icon="card",this.variant="primary",this.type="accent",this.size="md",this.iconSize=void 0,this.fullWidth=!1,this.disabled=!1}render(){return j`<button 4337 data-variant=${this.variant} 4338 data-type=${this.type} 4339 data-size=${this.size} 4340 data-full-width=${this.fullWidth} 4341 ?disabled=${this.disabled} 4342 > 4343 <wui-icon color="inherit" name=${this.icon} size=${ge(this.iconSize)}></wui-icon> 4344 </button>`}};uf.styles=[ar,ba,MTt];y1([z()],uf.prototype,"icon",void 0);y1([z()],uf.prototype,"variant",void 0);y1([z()],uf.prototype,"type",void 0);y1([z()],uf.prototype,"size",void 0);y1([z()],uf.prototype,"iconSize",void 0);y1([z({type:Boolean})],uf.prototype,"fullWidth",void 0);y1([z({type:Boolean})],uf.prototype,"disabled",void 0);uf=y1([pt("wui-icon-button")],uf);const jTt=Gt` 4345 button { 4346 display: block; 4347 display: flex; 4348 align-items: center; 4349 padding: ${({spacing:e})=>e[1]}; 4350 transition: background-color ${({durations:e})=>e.lg} 4351 ${({easings:e})=>e["ease-out-power-2"]}; 4352 will-change: background-color; 4353 border-radius: ${({borderRadius:e})=>e[32]}; 4354 } 4355 4356 wui-image { 4357 border-radius: 100%; 4358 } 4359 4360 wui-text { 4361 padding-left: ${({spacing:e})=>e[1]}; 4362 } 4363 4364 .left-icon-container, 4365 .right-icon-container { 4366 width: 24px; 4367 height: 24px; 4368 justify-content: center;
4369 align-items: center; 4370 } 4371 4372 wui-icon { 4373 color: ${({tokens:e})=>e.theme.iconDefault}; 4374 } 4375 4376 /* -- Sizes --------------------------------------------------- */ 4377 button[data-size='lg'] { 4378 height: 32px; 4379 } 4380 4381 button[data-size='md'] { 4382 height: 28px; 4383 } 4384 4385 button[data-size='sm'] { 4386 height: 24px; 4387 } 4388 4389 button[data-size='lg'] wui-image { 4390 width: 24px; 4391 height: 24px; 4392 } 4393 4394 button[data-size='md'] wui-image { 4395 width: 20px; 4396 height: 20px; 4397 } 4398 4399 button[data-size='sm'] wui-image { 4400 width: 16px; 4401 height: 16px; 4402 } 4403 4404 button[data-size='lg'] .left-icon-container { 4405 width: 24px; 4406 height: 24px; 4407 } 4408 4409 button[data-size='md'] .left-icon-container { 4410 width: 20px; 4411 height: 20px; 4412 } 4413 4414 button[data-size='sm'] .left-icon-container { 4415 width: 16px; 4416 height: 16px; 4417 } 4418 4419 /* -- Variants --------------------------------------------------------- */ 4420 button[data-type='filled-dropdown'] { 4421 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 4422 } 4423 4424 button[data-type='text-dropdown'] { 4425 background-color: transparent; 4426 } 4427 4428 /* -- Focus states --------------------------------------------------- */ 4429 button:focus-visible:enabled { 4430 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4431 box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040}; 4432 } 4433 4434 /* -- Hover & Active states ----------------------------------------------------------- */ 4435 @media (hover: hover) and (pointer: fine) { 4436 button:hover:enabled, 4437 button:active:enabled { 4438 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4439 } 4440 } 4441 4442 /* -- Disabled states --------------------------------------------------- */ 4443 button:disabled { 4444 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 4445 opacity: 0.5; 4446 } 4447`;var r3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const FTt={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},zTt={lg:"lg",md:"md",sm:"sm"};let e1=class extends ce{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size="lg",this.type="text-dropdown",this.disabled=!1}render(){return j`<button ?disabled=${this.disabled} data-size=${this.size} data-type=${this.type}> 4448 ${this.imageTemplate()} ${this.textTemplate()} 4449 <wui-flex class="right-icon-container"> 4450 <wui-icon name="chevronBottom"></wui-icon> 4451 </wui-flex> 4452 </button>`}textTemplate(){const t=FTt[this.size];return this.text?j`<wui-text color="primary" variant=${t}>${this.text}</wui-text>`:null}imageTemplate(){if(this.imageSrc)return j`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`;const t=zTt[this.size];return j` <wui-flex class="left-icon-container"> 4453 <wui-icon size=${t} name="networkPlaceholder"></wui-icon> 4454 </wui-flex>`}};e1.styles=[ar,ba,jTt];r3([z()],e1.prototype,"imageSrc",void 0);r3([z()],e1.prototype,"text",void 0);r3([z()],e1.prototype,"size",void 0);r3([z()],e1.prototype,"type",void 0);r3([z({type:Boolean})],e1.prototype,"disabled",void 0);e1=r3([pt("wui-select")],e1);const xw={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]},XEe={isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())}};var Xae={};const Oe={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",BASE_ACCOUNT:"baseAccount",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122",TON:"ton",TRON:"tron"}
4454,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin",cosmos:"Cosmos",sui:"Sui",stacks:"Stacks",ton:"TON",tron:"TRON"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",TON:"ton",TRON:"tron"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],SOLANA_SPL_TOKEN_ADDRESSES:{SOL:"So11111111111111111111111111111111111111112"},NATIVE_IMAGE_IDS_BY_NAMESPACE:{eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"3e8119e5-2a6f-4818-c50c-1937011d5900",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},TOKEN_SYMBOLS_BY_ADDRESS:{"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48":"USDC","0x833589fcd6edb6e08f4c7c32d4f71b54bda02913":"USDC","0x0b2c639c533813f4aa9d7837caf62653d097ff85":"USDC","0xaf88d065e77c8cc2239327c5edb3a432268e5831":"USDC","0x3c499c542cef5e3811e1192ce70d8cc03d5c3359":"USDC","0x2791bca1f2de4661ed88a30c99a7a9449aa84174":"USDC",EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v:"USDC","0xdac17f958d2ee523a2206206994597c13d831ec7":"USDT","0x94b008aa00579c1307b0ef2c499ad98a8ce58e58":"USDT","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9":"USDT","0xc2132d05d31c914a87c6611c10748aeb04b58e8f":"USDT",Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB:"USDT"},HTTP_STATUS_CODES:{SERVER_ERROR:500,TOO_MANY_REQUESTS:429,SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network",SECURE_SITE_SDK_ORIGIN:(typeof process<"u"&&typeof Xae<"u"?Xae.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",REMOTE_FEATURES_ALERTS:{MULTI_WALLET_NOT_ENABLED:{DEFAULT:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com."},CONNECTIONS_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnections hook."},CONNECTION_HOOK:{displayMessage:"Multi-Wallet Not Enabled",debugMessage:"Multi-wallet support is not enabled. Please enable it in your AppKit configuration at cloud.reown.com to use the useAppKitConnection hook."}},HEADLESS_NOT_ENABLED:{DEFAULT:{displayMessage:"",debugMessage:"Headless support is not enabled. Please enable it with the features.headless option in the AppKit configuration and make sure your current plan supports it."}}},IS_DEVELOPMENT:typeof process<"u"&&!1,DEFAULT_ALLOWED_ANCESTORS:["http://localhost:*","https://localhost:*","http://127.0.0.1:*","https://127.0.0.1:*","https://*.pages.dev","https://*.vercel.app","https://*.ngrok-free.app","https://secure-mobile.walletconnect.com","https://secure-mobile.walletconnect.org"],METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"AUTH"},qTt={caipNetworkIdToNumber(e){return e?Number(e.split(":")[1]):void 0},parseEvmChainId(e){return typeof e=="string"?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace(e,t){return(e==null?void 0:e.filter(n=>n.chainNamespace===t))||[]},getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]},getNetworkNameByCaipNetworkId(e,t){var s;if(!t)return;const n=e.find(i=>i.caipNetworkId===t);if(n)return n.name;const[r]=t.split(":");return((s=Oe.CHAIN_NAME_MAP)==null?void 0:s[r])||void 0}},QEe=["eip155","solana","polkadot","bip122","cosmos","sui","stacks"],Io={bigNumber(e,t={safe:!1}){try{return e?new An(e):new An(0)}catch(n){if(t.safe)return new An(0);throw n}},formatNumber(e,t){const{decimals:n,round:r=8,safe:s=!0}=t;return Io.bigNumber(e,{safe:s}).div(new An(10).pow(n)).round(r)},multiply(e,t){if(e===void 0||t===void 0)return new An(0);const n=new An(e),r=new An(t);return n.times(r)},toFixed(e,t=2){return e===void 0||e===""?new An(0).toFixed(t):new An(e).toFixed(t)},formatNumberToLocalString(e,t=2){return e===void 0||e===""?"0.00":typeof e=="number"?e.toLocaleStr
vendor: 4,570 bytes, line 4454
4454ing("en-US",{maximumFractionDigits:t,minimumFractionDigits:t,roundingMode:"floor"}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t,roundingMode:"floor"})},parseLocalStringToNumber(e){if(e===void 0||e==="")return 0;const t=e.replace(/,/gu,"");return new An(t).toNumber()}},WTt=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],HTt=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],VTt=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],e8e={getERC20Abi:e=>Oe.USDT_CONTRACT_ADDRESSES.includes(e)?VTt:WTt,getSwapAbi:()=>HTt},V2={ConnectorExplorerIds:{[Oe.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[Oe.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[Oe.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[Oe.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[Oe.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[Oe.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[Oe.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[Oe.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[Oe.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[Oe.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[Oe.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[Oe.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[Oe.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[Oe.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[Oe.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[Oe.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[Oe.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[Oe.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[Oe.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"}},mr={validateCaipAddress(e){var t;if(((t=e.split(":"))==null?void 0:t.length)!==3)throw new Error("Invalid CAIP Address");return e},parseCaipAddress(e){const t=e.split(":");if(t.length!==3)throw new Error(`Invalid CAIP-10 address: ${e}`);const[n,r,s]=t;if(!n||!r||!s)throw new Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:n,chainId:r,address:s}},parseCaipNetworkId(e){const t=e.split(":");if(t.length!==2)throw new Error(`Invalid CAIP-2 network id: ${e}`);const[n,r]=t;if(!n||!r)throw new Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:n,chainId:r}}},Hp={RPC_ERROR_CODE:{USER_REJECTED_REQUEST:4001,USER_REJECTED_METHODS:5002,USER_REJECTED:5e3,SEND_TRANSACTION_ERROR:5001},PROVIDER_RPC_ERROR_NAME:{PROVIDER_RPC:"ProviderRpcError",USER_REJECTED_REQUEST:"UserRejectedRequestError",SEND_TRANSACTION_ERROR:"SendTransactionError"},isRpcProviderError(e){try{if(typeof e=="object"&&e!==null){const t=e,n=typeof t.message=="string",r=typeof t.code=="number";return n&&r}return!1}catch{return!1}},isUserRejectedMessage(e){return e.toLowerCase().includes("user rejected")||e.toLowerCase().includes("user cancelled")||e.toLowerCase().includes("user canceled")},isUserRejectedRequestError(e){if(Hp.isRpcProviderError(e)){const t=e.code===Hp.RPC_ERROR_CODE.USER_REJECTED_REQUEST,n=e.code===Hp.RPC_ERROR_CODE.USER_REJECTED_METHODS;return t||n||Hp.isUserRejectedMessage(e.message)}return e instanceof Error?Hp.isUserRejectedMessage(e.message):!1}};
4454let KTt=class extends Error{constructor(t,n){super(n.message,{cause:t}),this.name=Hp.PROVIDER_RPC_ERROR_NAME.PROVIDER_RPC,this.code=n.code}},GTt=class extends KTt{constructor(t){super(t,{code:Hp.RPC_ERROR_CODE.USER_REJECTED_REQUEST,message:"User rejected the request"}),this.name=Hp.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST}};const bt={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",RECENT_WALLET:"@appkit/recent_wallet",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections",DISCONNECTED_CONNECTOR_IDS:"@appkit/disconnected_connector_ids",HISTORY_TRANSACTIONS_CACHE:"@appkit/history_transactions_cache",TOKEN_PRICE_CACHE:"@appkit/token_price_cache",RECENT_EMAILS:"@appkit/recent_emails",LATEST_APPKIT_VERSION:"@appkit/latest_version",TON_WALLETS_CACHE:"@appkit/ton_wallets_cache"};function qD(e){if(!e)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}const dt={setItem(e,t){QI()&&t!==void 0&&localStorage.setItem(e,t)},getItem(e){if(QI())return localStorage.getItem(e)||void 0},removeItem(e){QI()&&localStorage.removeItem(e)},clear(){QI()&&localStorage.clear()}};function QI(){return typeof window<"u"&&typeof localStorage<"u"}function H_(e,t){const n=(e==null?void 0:e["--apkt-accent"])??(e==null?void 0:e["--w3m-accent"]);return t==="light"?{"--w3m-accent":n||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":n||"hsla(230, 100%, 67%, 1)","--w3m-background":"#202020"}}const ZTt=Symbol(),Qae=Object.getPrototypeOf,Iz=new WeakMap,YTt=e=>e&&(Iz.has(e)?Iz.get(e):Qae(e)===Object.prototype||Qae(e)===Array.prototype),JTt=e=>YTt(e)&&e[ZTt]||null,ece=(e,t=!0)=>{Iz.set(e,t)},V_={},HK=e=>typeof e=="object"&&e!==null,XTt=e=>HK(e)&&!W$.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise),t8e=(e,t)=>{const n=Sz.get(e);if((n==null?void 0:n[0])===t)return n[1];const r=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return ece(r,!0),Sz.set(e,[t,r]),Reflect.ownKeys(e).forEach(s=>{if(Object.getOwnPropertyDescriptor(r,s))return;const i=Reflect.get(e,s),{enumerable:o}=Reflect.getOwnPropertyDescriptor(e,s),a={value:i,enumerable:o,configurable:!0};if(W$.has(i))ece(i,!1);else if(t1.has(i)){const[c,l]=t1.get(i);a.value=t8e(c,l())}Object.defineProperty(r,s,a)}),Object.preventExtensions(r)},QTt=(e,t,n,r)=>({deleteProperty(s,i){const o=Reflect.get(s,i);n(i);const a=Reflect.deleteProperty(s,i);return a&&r(["delete",[i],o]),a},set(s,i,o,a){const c=!e()&&Reflect.has(s,i),l=Reflect.get(s,i,a);if(c&&(tce(l,o)||F4.has(o)&&tce(l,F4.get(o))))return!0;n(i),HK(o)&&(o=JTt(o)||o);const u=!t1.has(o)&&tPt(o)?os(o):o;return t(i,u),Reflect.set(s,i,u,a),r(["set",[i],o,l]),!0}}),t1=new WeakMap,W$=new WeakSet,Sz=new WeakMap,zS=[1],F4=new WeakMap;let tce=Object.is,ePt=(e,t)=>new Proxy(e,t),tPt=XTt,nPt=t8e,rPt=QTt;function os(e={}){if(!HK(e))throw new Error("object required");const t=F4.get(e);if(t)return t;let n=zS[0];const r=new Set,s=(m,w=++zS[0])=>{n!==w&&(i=n=w,r.forEach(C=>C(m,w)))};let i=n;const o=(m=zS[0])=>(i!==m&&(i=m,c.forEach(([w])=>{const C=w[1](m);C>n&&(n=C)})),n),a=m=>(w,C)=>{const E=[...w];E[1]=[m,...E[1]],s(E,C)},c=new Map,l=(m,w)=>{const C=!W$.has(w)&&t1.get(w);if(C){if((V_?"production":void 0)!=="production"&&c.has(m))throw new Error("prop listener already exists");if(r.size){const E=C[2](a(m));c.set(m,[C,E])}else c.set(m,[C])}},u=m=>{var w;const C=c.get(m);C&&(c.delete(m),(w=C[1])==null||w.call(C))},d=m=>
4454(r.add(m),r.size===1&&c.forEach(([C,E],b)=>{if((V_?"production":void 0)!=="production"&&E)throw new Error("remove already exists");const S=C[2](a(b));c.set(b,[C,S])}),()=>{r.delete(m),r.size===0&&c.forEach(([C,E],b)=>{E&&(E(),c.set(b,[C]))})});let h=!0;const f=rPt(()=>h,l,u,s),g=ePt(e,f);F4.set(e,g);const p=[e,o,d];return t1.set(g,p),Reflect.ownKeys(e).forEach(m=>{const w=Object.getOwnPropertyDescriptor(e,m);"value"in w&&w.writable&&(g[m]=e[m])}),h=!1,g}function Po(e,t,n){const r=t1.get(e);(V_?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let s;const i=[],o=r[2];let a=!1;const l=o(u=>{i.push(u),s||(s=Promise.resolve().then(()=>{s=void 0,a&&t(i.splice(0))}))});return a=!0,()=>{a=!1,l()}}function z4(e){const t=t1.get(e);(V_?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[n,r]=t;return nPt(n,r())}function q4(e){return W$.add(e),e}function sPt(){return{proxyStateMap:t1,refSet:W$,snapCache:Sz,versionHolder:zS,proxyCache:F4}}function ha(e,t,n,r){let s=e[t];return Po(e,()=>{const i=e[t];Object.is(s,i)||n(s=i)})}const{proxyStateMap:iPt,snapCache:oPt}=sPt(),eS=e=>iPt.has(e);function aPt(e){const t=[];let n=0;const r=new Map,s=new WeakMap,i=()=>{const l=oPt.get(a),u=l==null?void 0:l[1];if(u&&!s.has(u)){const d=new Map(r);s.set(u,d)}},o=l=>s.get(l)||r,a={data:t,index:n,epoch:0,get size(){return eS(this)||i(),o(this).size},get(l){const d=o(this).get(l);if(d===void 0){this.epoch;return}return this.data[d]},has(l){const u=o(this);return this.epoch,u.has(l)},set(l,u){if(!eS(this))throw new Error("Cannot perform mutations on a snapshot");const d=r.get(l);return d===void 0?(r.set(l,this.index),this.data[this.index++]=u):this.data[d]=u,this.epoch++,this},delete(l){if(!eS(this))throw new Error("Cannot perform mutations on a snapshot");const u=r.get(l);return u===void 0?!1:(delete this.data[u],r.delete(l),this.epoch++,!0)},clear(){if(!eS(this))throw new Error("Cannot perform mutations on a snapshot");this.data.length=0,this.index=0,this.epoch++,r.clear()},forEach(l){this.epoch,o(this).forEach((d,h)=>{l(this.data[d],h,this)})},*entries(){this.epoch;const l=o(this);for(const[u,d]of l)yield[u,this.data[d]]},*keys(){this.epoch;const l=o(this);for(const u of l.keys())yield u},*values(){this.epoch;const l=o(this);for(const u of l.values())yield this.data[u]},[Symbol.iterator](){return this.entries()},get[Symbol.toStringTag](){return"Map"},toJSON(){return new Map(this.entries())}},c=os(a);return Object.defineProperties(c,{size:{enumerable:!1},index:{enumerable:!1},epoch:{enumerable:!1},data:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(c),c}const ei={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,ONE_SEC_MS:1e3,SOLANA_NATIVE_TOKEN_ADDRESS:"So11111111111111111111111111111111111111111",NAMES_SUPPORTED_CHAIN_NAMESPACES:[Oe.CHAIN.EVM],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x",sui:"0x",stacks:"0x",ton:"0x",tron:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,DEFAULT_REMOTE_FEATURES:{socials:["google","x","discord","farcaster","github","apple","facebook"]},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1,reownAuthentication:!1,headless:!1},DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa",ton:"eoa",tron:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal"},SIWX_DEFAULTS:{signOutOnDisconnect:!0},MANDATORY_WALLET_IDS_ON_MOBILE:[V2.ConnectorExplorerIds[Oe.CONNECTOR_ID.COINBASE],V2.ConnectorExplorerIds[Oe.CONNECTOR_ID.COINBASE_SDK],V2.ConnectorExplorerIds[Oe.CONNECTOR_ID.BASE_ACCOUNT],V2.ConnectorExplorerIds[Oe.SOLFLARE_CONNECTOR_NAME],V2.ConnectorExplorerIds[Oe.PHANTOM_CONNECTOR_NAME],V2.ConnectorExplorerIds[Oe.BINANCE_CONNECTOR_NAME]],DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"]},Qe={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5,transactionsHistory:15e3,tokenPrice:15e3,latestAppKitVersion:6048e5,tonWallets:864e5},isCacheExpired(e,t){return Date.now()-e>t},getActiveNetworkProps(){const e=Qe.getActiveNamespace(),t=Qe.getActiveCaipNetworkId(),n=t?t.split(":")[1]:void 0,r=n?isNaN(Number(n))?n:Number(n):void 0;return{namespace:e,caipNetworkId:t,chainId:r}},setWalletConnectDeepLink({name:e,href:t}){try{dt.setItem(bt.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const e=dt.getItem(bt.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{dt.removeItem(bt.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{dt.setItem(bt.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{dt.setItem(bt.ACTIVE_CAIP_NETWORK_ID,e),Qe.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return dt.getItem(bt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{dt.removeItem(bt.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{const t=qD(e);dt.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{const t=Qe.getRecentWallets();t.find(r=>r.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),dt.setItem(bt.RECENT_WALLETS,JSON.stringify(t)),dt.setItem(bt.RECENT_WALLET,JSON.stringify(e)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const e=dt.getItem(bt.RECENT_WALLETS);return e?JSON.parse(e):[]}
vendor: 9,695 bytes, line 4454
4454catch{console.info("Unable to get AppKit recent")}return[]},getRecentWallet(){try{const e=dt.getItem(bt.RECENT_WALLET);return e?JSON.parse(e):null}catch{console.info("Unable to get AppKit recent")}return null},deleteRecentWallet(){try{dt.removeItem(bt.RECENT_WALLET)}catch{console.info("Unable to delete AppKit recent")}},setConnectedConnectorId(e,t){try{const n=qD(e);dt.setItem(n,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return dt.getItem(bt.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{const t=qD(e);return dt.getItem(t)}catch{console.info("Unable to get connected connector id in namespace",e)}},setConnectedSocialProvider(e){try{dt.setItem(bt.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return dt.getItem(bt.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{dt.removeItem(bt.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return dt.getItem(bt.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){var n;const e=dt.getItem(bt.ACTIVE_CAIP_NETWORK_ID);return(n=e==null?void 0:e.split(":"))==null?void 0:n[1]},setConnectionStatus(e){try{dt.setItem(bt.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return dt.getItem(bt.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const e=dt.getItem(bt.CONNECTED_NAMESPACES);return e!=null&&e.length?e.split(","):[]}catch{return[]}},setConnectedNamespaces(e){try{const t=Array.from(new Set(e));dt.setItem(bt.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{const t=Qe.getConnectedNamespaces();t.includes(e)||(t.push(e),Qe.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{const t=Qe.getConnectedNamespaces(),n=t.indexOf(e);n>-1&&(t.splice(n,1),Qe.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return dt.getItem(bt.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{dt.setItem(bt.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{dt.removeItem(bt.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{const t=dt.getItem(bt.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{const t=Qe.getBalanceCache();dt.setItem(bt.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{const n=Qe.getBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.portfolio))return n.balance;Qe.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{const t=Qe.getBalanceCache();t[e.caipAddress]=e,dt.setItem(bt.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{const t=dt.getItem(bt.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{const t=Qe.getBalanceCache();dt.setItem(bt.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{const n=Qe.getNativeBalanceCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.nativeBalance))return n;console.info("Discarding cache for address",e),Qe.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{const t=Qe.getNativeBalanceCache();t[e.caipAddress]=e,dt.setItem(bt.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{const t=dt.getItem(bt.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e},getEnsFromCacheForAddress(e){try{const n=Qe.getEnsCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.ens))return n.ens;Qe.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{const t=Qe.getEnsCache();t[e.address]=e,dt.setItem(bt.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{const t=Qe.getEnsCache();dt.setItem(bt.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{const t=dt.getItem(bt.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{const n=Qe.getIdentityCache()[e];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.identity))return n.identity;Qe.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{const t=Qe.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},dt.setItem(bt.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{const t=Qe.getIdentityCache();dt.setItem(bt.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},getTonWalletsCache(){try{const e=dt.getItem(bt.TON_WALLETS_CACHE),t=e?JSON.parse(e):void 0;if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.tonWallets))return t;Qe.removeTonWalletsCache()}catch{console.info("Unable to get ton wallets cache")}},updateTonWalletsCache(e){try{const t=Qe.getTonWalletsCache()||{timestamp:0,wallets:[]};t.timestamp=new Date().getTime(),t.wallets=e,dt.setItem(bt.TON_WALLETS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ton wallets cache",e)}},removeTonWalletsCache(){try{dt.removeItem(bt.TON_WALLETS_CACHE)}catch{console.info("Unable to remove ton wallets cache")}},clearAddressCache(){try{dt.removeItem(bt.PORTFOLIO_CACHE),dt.removeItem(bt.NATIVE_BALANCE_CACHE),dt.removeItem(bt.ENS_CACHE),dt.removeItem(bt.IDENTITY_CACHE),dt.removeItem(bt.HISTORY_TRANSACTIONS_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(e){try{dt.setItem(bt.PREFERRED_ACCOUNT_TYPES,JSON.stringify(e))}catch{console.info("Unable to set preferred account types",e)}},getPreferredAccountTypes(){try{const e=dt.getItem(bt.PREFERRED_ACCOUNT_TYPES);return e?JSON.parse(e):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(e,t){try{const n=Qe.getConnections(),r=n[t]??[],s=new Map;for(const o of r)s.set(o.connectorId,{...o});for(const o of e){const a=s.get(o.connectorId),c=o.connectorId===Oe.CONNECTOR_ID.AUTH;if(a&&!c){const l=new Set(a.accounts.map(d=>d.address.toLowerCase())),u=o.accounts.filter(d=>!l.has(d.address.toLowerCase()));a.accounts.push(...u)}else s.set(o.connectorId,{...o})}const i={...n,[t]:Array.from(s.values())};dt.setItem(bt.CONNECTIONS,JSON.stringify(i))}catch(n){console.error("Unable to sync connections to storage",n)}},getConnections(){try{const e=dt.getItem(bt.CONNECTIONS);return e?JSON.parse(e):{}}catch(e){return console.error("Unable to get connections from storage",e),{}}},deleteAddressFromConnection({connectorId:e,address:t,namespace:n}){try{const r=Qe.getConnections(),s=r[n]??[],i=new Map(s.map(a=>[a.connectorId,a])),o=i.get(e);o&&(o.accounts.filter(c=>c.address.toLowerCase()!==t.toLowerCase()).length===0?i.delete(e):i.set(e,{...o,accounts:o.accounts.filter(c=>c.address.toLowerCase()!==t.toLowerCase())})),dt.setItem(bt.CONNECTIONS,JSON.stringify({...r,[n]:Array.from(i.values())}))}catch{console.error(`Unable to remove address "${t}" from connector "${e}" in namespace "${n}"`)}},getDisconnectedConnectorIds(){try{const e=dt.getItem(bt.DISCONNECTED_CONNECTOR_IDS);return e?JSON.parse(e):{}}catch{console.info("Unable to get disconnected connector ids")}return{}},addDisconnectedConnectorId(e,t){try{const n=Qe.getDisconnectedConnectorIds(),r=n[t]??[];r.push(e),dt.setItem(bt.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[t]:Array.from(new Set(r))}))}catch{console.error(`Unable to set disconnected connector id "${e}" for namespace "${t}"`)}},removeDisconnectedConnectorId(e,t){try{const n=Qe.getDisconnectedConnectorIds();let r=n[t]??[];r=r.filter(s=>s.toLowerCase()!==e.toLowerCase()),dt.setItem(bt.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...n,[t]:Array.from(new Set(r))}))}catch{console.error(`Unable to remove disconnected connector id "${e}" for namespace "${t}"`)}},isConnectorDisconnected(e,t){try{return(Qe.getDisconnectedConnectorIds()[t]??[]).some(s=>s.toLowerCase()===e.toLowerCase())}catch{console.info(`Unable to get disconnected connector id "${e}" for namespace "${t}"`)}return!1},getTransactionsCache(){try{const e=dt.getItem(bt.HISTORY_TRANSACTIONS_CACHE);return e?JSON.parse(e):{}}catch{console.info("Unable to get transactions cache")}return{}},getTransactionsCacheForAddress({address:e,chainId:t=""}){var n;try{const s=(n=Qe.getTransactionsCache()[e])==null?void 0:n[t];if(s&&!this.isCacheExpired(s.timestamp,this.cacheExpiry.transactionsHistory)
4454)return s.transactions;Qe.removeTransactionsCache({address:e,chainId:t})}catch{console.info("Unable to get transactions cache")}},updateTransactionsCache({address:e,chainId:t="",timestamp:n,transactions:r}){try{const s=Qe.getTransactionsCache();s[e]={...s[e],[t]:{timestamp:n,transactions:r}},dt.setItem(bt.HISTORY_TRANSACTIONS_CACHE,JSON.stringify(s))}catch{console.info("Unable to update transactions cache",{address:e,chainId:t,timestamp:n,transactions:r})}},removeTransactionsCache({address:e,chainId:t}){try{const n=Qe.getTransactionsCache(),r=(n==null?void 0:n[e])||{},{[t]:s,...i}=r;dt.setItem(bt.HISTORY_TRANSACTIONS_CACHE,JSON.stringify({...n,[e]:i}))}catch{console.info("Unable to remove transactions cache",{address:e,chainId:t})}},getTokenPriceCache(){try{const e=dt.getItem(bt.TOKEN_PRICE_CACHE);return e?JSON.parse(e):{}}catch{console.info("Unable to get token price cache")}return{}},getTokenPriceCacheForAddresses(e){try{const n=Qe.getTokenPriceCache()[e.join(",")];if(n&&!this.isCacheExpired(n.timestamp,this.cacheExpiry.tokenPrice))return n.tokenPrice;Qe.removeTokenPriceCache(e)}catch{console.info("Unable to get token price cache for addresses",e)}},updateTokenPriceCache(e){try{const t=Qe.getTokenPriceCache();t[e.addresses.join(",")]={timestamp:e.timestamp,tokenPrice:e.tokenPrice},dt.setItem(bt.TOKEN_PRICE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update token price cache",e)}},removeTokenPriceCache(e){try{const t=Qe.getTokenPriceCache();dt.setItem(bt.TOKEN_PRICE_CACHE,JSON.stringify({...t,[e.join(",")]:void 0}))}catch{console.info("Unable to remove token price cache",e)}},getLatestAppKitVersion(){try{const e=this.getLatestAppKitVersionCache(),t=e==null?void 0:e.version;return t&&!this.isCacheExpired(e.timestamp,this.cacheExpiry.latestAppKitVersion)?t:void 0}catch{console.info("Unable to get latest AppKit version")}},getLatestAppKitVersionCache(){try{const e=dt.getItem(bt.LATEST_APPKIT_VERSION);return e?JSON.parse(e):{}}catch{console.info("Unable to get latest AppKit version cache")}return{}},updateLatestAppKitVersion(e){try{const t=Qe.getLatestAppKitVersionCache();t.timestamp=e.timestamp,t.version=e.version,dt.setItem(bt.LATEST_APPKIT_VERSION,JSON.stringify(t))}catch{console.info("Unable to update latest AppKit version on local storage",e)}}},ht={getWindow(){if(!(typeof window>"u"))return window},isMobile(){var e;return this.isClient()?!!(window!=null&&window.matchMedia&&typeof window.matchMedia=="function"&&((e=window.matchMedia("(pointer:coarse)"))!=null&&e.matches)||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},checkCaipNetwork(e,t=""){return e==null?void 0:e.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase())},isAndroid(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return ht.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return this.isClient()?(window==null?void 0:window.navigator.userAgent.toLowerCase()).includes("safari"):!1},isClient(){return typeof window<"u"},isPairingExpired(e){return e?e-Date.now()<=ei.TEN_SEC_MS:!0},isAllowedRetry(e,t=ei.ONE_SEC_MS){return Date.now()-e>=t},copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return(window==null?void 0:window.self)!==(window==null?void 0:window.top)}catch{return!1}},isSafeApp(){var e,t;if(ht.isClient()&&window.self!==window.top)try{const n=(t=(e=window==null?void 0:window.location)==null?void 0:e.ancestorOrigins)==null?void 0:t[0],r="https://app.safe.global";if(n){const s=new URL(n),i=new URL(r);return s.hostname===i.hostname}}catch{return!1}return!1},getPairingExpiry(){return Date.now()+ei.FOUR_MINUTES_MS},getNetworkId(e){return e==null?void 0:e.split(":")[1]},getPlainAddress(e){return e==null?void 0:e.split(":")[2]},async wait(e){return new Promise(t=>{setTimeout(t,e)})},debounce(e,t=500){let n;return(...r)=>{function s(){e(...r)}n&&clearTimeout(n),n=setTimeout(s,t)}},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},formatNativeUrl(e,t,n=null){if(ht.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e,s=n;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),s&&!(s!=null&&s.endsWith("/"))&&(s=`${s}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));const i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,redirectUniversalLink:s?`${s}wc?uri=${i}`:void 0,href:r}},formatUniversalUrl(e,t){if(!ht.isHttpUrl(e))return this.formatNativeUrl(e,t);let n=e;n.endsWith("/")||(n=`${n}/`);const r=encodeURIComponent(t);return{redirect:`${n}wc?uri=${r}`,href:n}},getOpenTargetForPlatform(e){return e==="popupWindow"?e:this.isTelegram()?Qe.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,n){window==null||window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},returnOpenHref(e,t,n){return window==null?void 0:window.open(e,this.getOpenTargetForPlatform(t),n||"noreferrer noopener")},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},isPWA(){var n,r;if(typeof window>"u")return!1;const e=window!=null&&window.matchMedia&&typeof window.matchMedia=="function"?(n=window.matchMedia("(display-mode: standalone)"))==null?void 0:n.matches:!1,t=(r=window==null?void 0:window.navigator)==null?void 0:r.standalone;return!!(e||t)},async preloadImage(e){const t=new Promise((n,r)=>{const s=new Image;s.onload=n,s.onerror=r,s.crossOrigin="anonymous",s.src=e});
4454return Promise.race([t,ht.wait(2e3)])},parseBalance(e,t){let n="0.000";if(typeof e=="string"){const c=Number(e);if(!isNaN(c)){const l=(Math.floor(c*1e3)/1e3).toFixed(3);l&&(n=l)}}const[r,s]=n.split("."),i=r||"0",o=s||"000";return{formattedText:`${i}.${o}${t?` ${t}`:""}`,value:i,decimals:o,symbol:t}},getApiUrl(){return Oe.W3M_API_URL},getBlockchainApiUrl(){return Oe.BLOCKCHAIN_API_RPC_URL},getAnalyticsUrl(){return Oe.PULSE_API_URL},getUUID(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},parseError(e){var t,n;return typeof e=="string"?e:typeof((n=(t=e==null?void 0:e.issues)==null?void 0:t[0])==null?void 0:n.message)=="string"?e.issues[0].message:e instanceof Error?e.message:"Unknown error"},sortRequestedNetworks(e,t=[]){const n={};return t&&e&&(e.forEach((r,s)=>{n[r]=s}),t.sort((r,s)=>{const i=n[r.id],o=n[s.id];return i!==void 0&&o!==void 0?i-o:i!==void 0?-1:o!==void 0?1:0})),t},calculateBalance(e){let t=0;for(const n of e)t+=n.value??0;return t},formatTokenBalance(e){const t=e.toFixed(2),[n,r]=t.split(".");return{dollars:n,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)){if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e))return!0}else return!1;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);case"bip122":{const n=/^[1][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(e),r=/^[3][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(e),s=/^bc1[a-z0-9]{39,87}$/u.test(e),i=/^bc1p[a-z0-9]{58}$/u.test(e);return n||r||s||i}default:return!1}},uniqueBy(e,t){const n=new Set;return e.filter(r=>{const s=r[t];return n.has(s)?!1:(n.add(s),!0)})},generateSdkVersion(e,t,n){const s=e.length===0?ei.ADAPTER_TYPES.UNIVERSAL:e.map(i=>i.adapterType).join(",");return`${t}-${s}-${n}`},createAccount(e){const{chainNamespace:t,chainId:n,address:r}=mr.parseCaipAddress(e.caipAddress);return{namespace:t,address:r,chainId:n,caipAddress:e.caipAddress,type:e.type,publicKey:e.publicKey,path:e.path}},isCaipAddress(e){if(typeof e!="string")return!1;const t=e.split(":"),n=t[0];return t.filter(Boolean).length===3&&n in Oe.CHAIN_NAME_MAP},getAccount(e){return e?typeof e=="string"?{address:e,chainId:void 0}:{address:e.address,chainId:e.chainId}:{address:void 0,chainId:void 0}},isMac(){const e=window==null?void 0:window.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){const t=`--${encodeURIComponent(window==null?void 0:window.location.href)}`,n="state=";if(new URL(e).host==="auth.magic.link"){const s="provider_authorization_url=",i=e.substring(e.indexOf(s)+s.length),o=this.injectIntoUrl(decodeURIComponent(i),n,t);return e.replace(i,encodeURIComponent(o))}return this.injectIntoUrl(e,n,t)},injectIntoUrl(e,t,n){const r=e.indexOf(t);if(r===-1)throw new Error(`${t} parameter not found in the URL: ${e}`);const s=e.indexOf("&",r),i=t.length,o=s!==-1?s:e.length,a=e.substring(0,r+i),c=e.substring(r+i,o),l=e.substring(s),u=c+n;return a+u+l},isNumber(e){return typeof e!="number"&&typeof e!="string"?!1:!isNaN(Number(e))},appendPayToUri(e,t){return t?`${e}&pay=${encodeURIComponent(t)}`:e}},qS={STORAGE_KEY:"@appkit-wallet/",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS"},im={ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}},cPt={set(e,t){WD.isClient&&localStorage.setItem(`${qS.STORAGE_KEY}${e}`,t)},get(e){return WD.isClient?localStorage.getItem(`${qS.STORAGE_KEY}${e}`):null},delete(e,t){WD.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${qS.STORAGE_KEY}${e}`))}},WD={isClient:typeof window<"u"};function _t(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:i=>t(e,i)}function Gd(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new g8e(e.type);return`${e.name}(${dP(e.inputs,{includeName:t})})`}function dP(e,{includeName:t=!1}={}){return e?e.map(n=>lPt(n,{includeName:t})).join(t?", ":","):""}function lPt(e,{includeName:t}){return e.type.startsWith("tuple")?`(${dP(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Nu(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ts(e){return Nu(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const n8e="2.47.6";let bE={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${n8e}`}
4454,Ce=class Az extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof Az?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof Az&&n.cause.docsPath||n.docsPath,i=(a=bE.getDocsUrl)==null?void 0:a.call(bE,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...bE.version?[`Version: ${bE.version}`]:[]].join(` 4455`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=n8e}walk(t){return r8e(this,t)}};function r8e(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?r8e(e.cause,t):t?null:e}class s8e extends Ce{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` 4456`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class _z extends Ce{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` 4457`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class VK extends Ce{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(` 4458`),{metaMessages:[`Params: (${dP(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class s3 extends Ce{constructor({cause:t}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:t})}}class i8e extends Ce{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(` 4459`),{name:"AbiEncodingArrayLengthMismatchError"})}}class o8e extends Ce{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${ts(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class a8e extends Ce{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(` 4460`),{name:"AbiEncodingLengthMismatchError"})}}class c8e extends Ce{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(` 4461`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Nz extends Ce{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(` 4462`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class KK extends Ce{constructor(t,{docsPath:n,cause:r}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 4463`),{docsPath:n,name:"AbiErrorSignatureNotFoundError",cause:r}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class l8e extends Ce{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class u8e extends Ce{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 4464`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Tz extends Ce{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(` 4465`),{docsPath:n,name:"AbiEventNotFoundError"})}}class Oy extends Ce{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` 4466`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class GK extends Ce{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(` 4467`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class d8e extends Ce{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(` 4468`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class uPt extends Ce{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Gd(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Gd(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}let h8e=class extends Ce{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};class W4 extends Ce{constructor({abiItem:t,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(` 4469`),{metaMessages:[`Params: (${dP(r,{includeName:!0})})`,`Data: ${n} (${s} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=s}}class hP extends Ce{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Gd(t,{includeName:!0})}".`].join(` 4470`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class f8e extends Ce{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` 4471`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class p8e extends Ce{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` 4472`),{docsPath:n,name:"InvalidAbiDecodingType"})}}let ZK=class extends Ce{constructor(t){super([`Value "${t}" is not a valid array.`].join(` 4473`),{name:"InvalidArrayError"})}};class g8e extends Ce{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` 4474`),{name:"InvalidDefinitionTypeError"})}}class m8e extends Ce{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}let YK=class extends Ce{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},JK=class extends Ce{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};
4474class nce extends Ce{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Tb(e,{dir:t,size:n=32}={}){return typeof e=="string"?f0(e,{dir:t,size:n}):w8e(e,{dir:t,size:n})}function f0(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new JK({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function w8e(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new JK({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}let fP=class extends Ce{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},y8e=class extends Ce{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class b8e extends Ce{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let v8e=class extends Ce{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Dm(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function ch(e,{size:t}){if(ts(e)>t)throw new v8e({givenSize:ts(e),maxSize:t})}function Zd(e,t={}){const{signed:n}=t;t.size&&ch(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function E8e(e,t={}){let n=e;if(t.size&&(ch(n,{size:t.size}),n=Dm(n)),Dm(n)==="0x00")return!1;if(Dm(n)==="0x01")return!0;throw new b8e(n)}function df(e,t={}){const n=Zd(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new fP({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const dPt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _0(e,t={}){return typeof e=="number"||typeof e=="bigint"?Bt(e,t):typeof e=="string"?F5(e,t):typeof e=="boolean"?XK(e,t):Ds(e,t)}function XK(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(ch(n,{size:t.size}),Tb(n,{size:t.size})):n}function Ds(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=dPt[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(ch(r,{size:t.size}),Tb(r,{dir:"right",size:t.size})):r}function Bt(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new fP({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?Tb(a,{size:r}):a}const hPt=new TextEncoder;function F5(e,t={}){const n=hPt.encode(e);return Ds(n,t)}const fPt=new TextEncoder;function Pb(e,t={}){return typeof e=="number"||typeof e=="bigint"?$8e(e,t):typeof e=="boolean"?C8e(e,t):Nu(e)?Yd(e,t):Um(e,t)}function C8e(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(ch(n,{size:t.size}),Tb(n,{size:t.size})):n}const rp={zero:48,nine:57,A:65,F:70,a:97,f:102};function rce(e){if(e>=rp.zero&&e<=rp.nine)return e-rp.zero;if(e>=rp.A&&e<=rp.F)return e-(rp.A-10);if(e>=rp.a&&e<=rp.f)return e-(rp.a-10)}function Yd(e,t={}){let n=e;t.size&&(ch(n,{size:t.size}),n=Tb(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=rce(r.charCodeAt(a++)),l=rce(r.charCodeAt(a++));if(c===void 0||l===void 0)throw new Ce(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[o]=c*16+l}return i}
4474function $8e(e,t){const n=Bt(e,t);return Yd(n)}function Um(e,t={}){const n=fPt.encode(e);return typeof t.size=="number"?(ch(n,{size:t.size}),Tb(n,{dir:"right",size:t.size})):n}function Ti(e,t){const n=t||"hex",r=U0(Nu(e,{strict:!1})?Pb(e):e);return n==="bytes"?r:_0(r)}const pPt=e=>Ti(Pb(e));function gPt(e){return pPt(e)}function mPt(e){let t=!0,n="",r=0,s="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new Ce("Unable to normalize signature.");return s}const ZE=e=>{const t=typeof e=="string"?e:vu(e);return mPt(t)};function K_(e){return gPt(ZE(e))}const z5=K_;let N0=class extends Ce{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},pP=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,n)),n}set(t,n){if(super.has(t)&&super.delete(t),super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=super.keys().next().value;r!==void 0&&super.delete(r)}return this}};const HD=new pP(8192);function H$(e,t){if(HD.has(`${e}.${t}`))return HD.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Ti(Um(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const i=`0x${s.join("")}`;return HD.set(`${e}.${t}`,i),i}function H4(e,t){if(!bl(e,{strict:!1}))throw new N0({address:e});return H$(e,t)}const wPt=/^0x[a-fA-F0-9]{40}$/,VD=new pP(8192);function bl(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(VD.has(r))return VD.get(r);const s=wPt.test(e)?e.toLowerCase()===e?!0:n?H$(e)===e:!0:!1;return VD.set(r,s),s}function Tu(e){return typeof e[0]=="string"?Ob(e):x8e(e)}function x8e(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function Ob(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function n1(e,t,n,{strict:r}={}){return Nu(e,{strict:!1})?A8e(e,t,n,{strict:r}):QK(e,t,n,{strict:r})}function I8e(e,t){if(typeof t=="number"&&t>0&&t>ts(e)-1)throw new YK({offset:t,position:"start",size:ts(e)})}function S8e(e,t,n){if(typeof t=="number"&&typeof n=="number"&&ts(e)!==n-t)throw new YK({offset:n,position:"end",size:ts(e)})}function QK(e,t,n,{strict:r}={}){I8e(e,t);const s=e.slice(t,n);return r&&S8e(s,t,n),s}function A8e(e,t,n,{strict:r}={}){I8e(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&S8e(s,t,n),s}const yPt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,_8e=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function V0(e,t){if(e.length!==t.length)throw new a8e({expectedLength:e.length,givenLength:t.length});const n=bPt({params:e,values:t}),r=tG(n);return r.length===0?"0x":r}function bPt({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(eG({param:e[r],value:t[r]}));return n}function eG({param:e,value:t}){const n=nG(e.type);if(n){const[r,s]=n;return EPt(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return SPt(t,{param:e});if(e.type==="address")return vPt(t);if(e.type==="bool")return $Pt(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=_8e.exec(e.type)??[];return xPt(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return CPt(t,{param:e});if(e.type==="string")return IPt(t);throw new f8e(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function tG(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=ts(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(Bt(t+s,{size:32}
4474)),r.push(a),s+=ts(a)):n.push(a)}return Tu([...n,...r])}function vPt(e){if(!bl(e))throw new N0({address:e});return{dynamic:!1,encoded:f0(e.toLowerCase())}}function EPt(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new ZK(e);if(!r&&e.length!==t)throw new i8e({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const i=[];for(let o=0;o<e.length;o++){const a=eG({param:n,value:e[o]});a.dynamic&&(s=!0),i.push(a)}if(r||s){const o=tG(i);if(r){const a=Bt(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?Tu([a,o]):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:Tu(i.map(({encoded:o})=>o))}}function CPt(e,{param:t}){const[,n]=t.type.split("bytes"),r=ts(e);if(!n){let s=e;return r%32!==0&&(s=f0(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:Tu([f0(Bt(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new o8e({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:f0(e,{dir:"right"})}}function $Pt(e){if(typeof e!="boolean")throw new Ce(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:f0(XK(e))}}function xPt(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new fP({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Bt(e,{size:32,signed:t})}}function IPt(e){const t=F5(e),n=Math.ceil(ts(t)/32),r=[];for(let s=0;s<n;s++)r.push(f0(n1(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:Tu([f0(Bt(ts(t),{size:32})),...r])}}function SPt(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const i=t.components[s],o=Array.isArray(e)?s:i.name,a=eG({param:i,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?tG(r):Tu(r.map(({encoded:s})=>s))}}function nG(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const ky=e=>n1(K_(e),0,4);function b1(e){const{abi:t,args:n=[],name:r}=e,s=Nu(r,{strict:!1}),i=t.filter(a=>s?a.type==="function"?ky(a)===r:a.type==="event"?z5(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let o;for(const a of i){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((l,u)=>{const d="inputs"in a&&a.inputs[u];return d?Pz(l,d):!1})){if(o&&"inputs"in o&&o.inputs){const l=N8e(a.inputs,o.inputs,n);if(l)throw new uPt({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||i[0]}function Pz(e,t){const n=typeof e,r=t.type;switch(r){case"address":return bl(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>n==="object"&&Pz(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>Pz(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function N8e(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return N8e(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?bl(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?bl(n[r],{strict:!1}):!1)return o}}const sce="/docs/contract/encodeEventTopics";function i3(e){var c;const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const l=b1({abi:t,name:n});if(!l)throw new Tz(n,{docsPath:sce});s=l}if(s.type!=="event")throw new Tz(void 0,{docsPath:sce});const i=Gd(s),o=z5(i);let a=[];if(r&&"inputs"in s){const l=(c=s.inputs)==null?void 0:c.filter(d=>"indexed"in d&&d.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?(l==null?void 0:l.map(d=>r[d.name]))??[]:[];u.length>0&&(a=(l==null?void 0:l.map((d,h)=>Array.isArray(u[h])?u[h].map((f,g)=>ice({param:d,value:u[h][g]})):typeof u[h]<"u"&&u[h]!==null?ice({param:d,value:u[h]}):null))??[])}return[o,...a]}function ice({param:e,value:t}
4474){if(e.type==="string"||e.type==="bytes")return Ti(Pb(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new m8e(e.type);return V0([e],[t])}function gP(e,{method:t}){var r,s;const n={};return e.transport.type==="fallback"&&((s=(r=e.transport).onResponse)==null||s.call(r,({method:i,response:o,status:a,transport:c})=>{a==="success"&&t===i&&(n[o]=c.request)})),(i=>n[i]||e.request)}async function T8e(e,t){const{address:n,abi:r,args:s,eventName:i,fromBlock:o,strict:a,toBlock:c}=t,l=gP(e,{method:"eth_newFilter"}),u=i?i3({abi:r,args:s,eventName:i}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof o=="bigint"?Bt(o):o,toBlock:typeof c=="bigint"?Bt(c):c,topics:u}]});return{abi:r,args:s,eventName:i,id:d,request:l(d),strict:!!a,type:"event"}}function vl(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const oce="/docs/contract/encodeFunctionData";function P8e(e){const{abi:t,args:n,functionName:r}=e;let s=t[0];if(r){const i=b1({abi:t,args:n,name:r});if(!i)throw new Oy(r,{docsPath:oce});s=i}if(s.type!=="function")throw new Oy(void 0,{docsPath:oce});return{abi:[s],functionName:ky(Gd(s))}}function Nl(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var a;return e.abi.length===1&&((a=e.functionName)!=null&&a.startsWith("0x"))?e:P8e(e)})(),s=n[0],i=r,o="inputs"in s&&s.inputs?V0(s.inputs,t??[]):void 0;return Ob([i,o??"0x"])}const APt={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},O8e={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},_Pt={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let ace=class extends Ce{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},k8e=class extends Ce{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},NPt=class extends Ce{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const TPt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new NPt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new k8e({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ace({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new ace({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function rG(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(TPt);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function R8e(e,t={}){typeof t.size<"u"&&ch(e,{size:t.size});const n=Ds(e,t);return Zd(n,t)}function B8e(e,t={}){let n=e;if(typeof t.size<"u"&&(ch(n,{size:t.size}),n=Dm(n)),n.length>1||n[0]>1)throw new y8e(n);return!!n[0]}function ef(e,t={}){typeof t.size<"u"&&ch(e,{size:t.size});const n=Ds(e,t);return df(n,t)}function D8e(e,t={}){let n=e;return typeof t.size<"u"&&(ch(n,{size:t.size}),n=Dm(n,{dir:"right"})),new TextDecoder().decode(n)}function o3(e,t){const n=typeof t=="string"?Yd(t):t,r=rG(n);if(ts(n)===0&&e.length>0)throw new s3;if(ts(t)&&ts(t)<32)throw new VK({data:typeof t=="string"?t:Ds(t),params:e,size:ts(t)});let s=0;const i=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(s);const[c,l]=s5(r,a,{staticPosition:0});s+=l,i.push(c)}return i}function s5(e,t,{staticPosition:n}){const r=nG(t.type);if(r){const[s,i]=r;return OPt(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return DPt(e,t,{staticPosition:n});if(t.type==="address")return PPt(e);if(t.type==="bool")return kPt(e);if(t.type.startsWith("bytes"))return RPt(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return BPt(e,t);if(t.type==="string")return UPt(e,{staticPosition:n});throw new p8e(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const cce=32,Oz=32;function PPt(e){const t=e.readBytes(32);return[H$(Ds(QK(t,-20))),32]}function OPt(e,t,{length:n,staticPosition:r}){if(!n){const o=ef(e.readBytes(Oz)),a=r+o,c=a+cce;e.setPosition(a);const l=ef(e.readBytes(cce)),u=V4(t);let d=0;const h=[];for(let f=0;f<l;++f){e.setPosition(c+(u?f*32:d));const[g,p]=s5(e,t,{staticPosition:c});d+=p,h.push(g)}return e.setPosition(r+32),[h,32]}if(V4(t)){const o=ef(e.readBytes(Oz)),a=r+o,c=[];for(let l=0;l<n;++l){e.setPosition(a+l*32);const[u]=s5(e,t,{staticPosition:a});c.push(u)}return e.setPosition(r+32),[c,32]}let s=0;const i=[];for(let o=0;o<n;++o){const[a,c]=s5(e,t,{staticPosition:r+s});s+=c,i.push(a)}return[i,s]}function kPt(e){return[B8e(e.readBytes(32),{size:32}),32]}function RPt(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=ef(e.readBytes(32));e.setPosition(n+o);const a=ef(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Ds(c),32]}return[Ds(e.readBytes(Number.parseInt(s,10),32)),32]}function BPt(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?R8e(s,{signed:n}):ef(s,{signed:n}),32]}function DPt(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),s=r?[]:{};let i=0;if(V4(t)){const o=ef(e.readBytes(Oz)),a=n+o;for(let c=0;c<t.components.length;++c){const l=t.components[c];e.setPosition(a+i);const[u,d]=s5(e,l,{staticPosition:a});i+=d,s[r?c:l==null?void 0:l.name]=u}return e.setPosition(n+32),[s,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,l]=s5(e,a,{staticPosition:n});s[r?o:a==null?void 0:a.name]=c,i+=l}return[s,i]}function UPt(e,{staticPosition:t}){const n=ef(e.readBytes(32)),r=t+n;e.setPosition(r);const s=ef(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=D8e(Dm(i));return e.setPosition(t+32),[o,32]}function V4(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;
4474if(t==="tuple")return(r=e.components)==null?void 0:r.some(V4);const n=nG(e.type);return!!(n&&V4({...e,type:n[1]}))}function sG(e){const{abi:t,data:n,cause:r}=e,s=n1(n,0,4);if(s==="0x")throw new s3({cause:r});const o=[...t||[],O8e,_Pt].find(a=>a.type==="error"&&s===ky(Gd(a)));if(!o)throw new KK(s,{docsPath:"/docs/contract/decodeErrorResult",cause:r});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?o3(o.inputs,n1(n,4)):void 0,errorName:o.name}}const ks=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n);function U8e({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((s,i)=>`${r&&s.name?`${s.name}: `:""}${typeof t[i]=="object"?ks(t[i]):t[i]}`).join(", ")})`}const L8e={gwei:9,wei:18},M8e={ether:-9,wei:9};function V$(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[s,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${i?`.${i}`:""}`}function mP(e,t="wei"){return V$(e,L8e[t])}function ua(e,t="wei"){return V$(e,M8e[t])}class j8e extends Ce{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class F8e extends Ce{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function lce(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r} 4475`,"")}function LPt(e){return e.reduce((t,{address:n,...r})=>{let s=`${t} ${n}: 4476`;return r.nonce&&(s+=` nonce: ${r.nonce} 4477`),r.balance&&(s+=` balance: ${r.balance} 4478`),r.code&&(s+=` code: ${r.code} 4479`),r.state&&(s+=` state: 4480`,s+=lce(r.state)),r.stateDiff&&(s+=` stateDiff: 4481`,s+=lce(r.stateDiff)),s},` State Override: 4482`).slice(0,-1)}function K$(e){const t=Object.entries(e).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=t.reduce((r,[s])=>Math.max(r,s.length),0);return t.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(` 4483`)}class z8e extends Ce{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",K$(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class q8e extends Ce{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h}){var g;const f=K$({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${mP(h)} ${((g=s==null?void 0:s.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${ua(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ua(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ua(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",f].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class iG extends Ce{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i}){let o="Transaction";r&&i!==void 0&&(o=`Transaction at block time "${r}" at index "${i}"`),t&&i!==void 0&&(o=`Transaction at block hash "${t}" at index "${i}"`),n&&i!==void 0&&(o=`Transaction at block number "${n}" at index "${i}"`),s&&(o=`Transaction with hash "${s}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class oG extends Ce{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class MPt extends Ce{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class W8e extends Ce{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const jPt=e=>e,G$=e=>e;class aG extends Ce{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h,stateOverride:f}){var m;const g=n?vl(n):void 0;let p=K$({from:g==null?void 0:g.address,to:d,value:typeof h<"u"&&`${mP(h)} ${((m=s==null?void 0:s.nativeCurrency)==null?void 0:m.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${ua(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ua(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ua(l)} gwei`,nonce:u});f&&(p+=` 4484${LPt(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",p].filter(
4484Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class cG extends Ce{constructor(t,{abi:n,args:r,contractAddress:s,docsPath:i,functionName:o,sender:a}){const c=b1({abi:n,args:r,name:o}),l=c?U8e({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=c?Gd(c,{includeName:!0}):void 0,d=K$({address:s&&jPt(s),function:u,args:l&&l!=="()"&&`${[...Array((o==null?void 0:o.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=t,this.contractAddress=s,this.functionName=o,this.sender=a}}class G_ extends Ce{constructor({abi:t,data:n,functionName:r,message:s,cause:i}){let o,a,c,l;if(n&&n!=="0x")try{a=sG({abi:t,data:n,cause:i});const{abiItem:d,errorName:h,args:f}=a;if(h==="Error")l=f[0];else if(h==="Panic"){const[g]=f;l=APt[g]}else{const g=d?Gd(d,{includeName:!0}):void 0,p=d&&f?U8e({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[g?`Error: ${g}`:"",p&&p!=="()"?` ${[...Array((h==null?void 0:h.length)??0).keys()].map(()=>" ").join("")}${p}`:""]}}catch(d){o=d}else s&&(l=s);let u;o instanceof KK&&(u=o.signature,c=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${u}.`]),super(l&&l!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,l||u].join(` 4485`):`The contract function "${r}" reverted.`,{cause:o??i,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=n,this.reason=l,this.signature=u}}class H8e extends Ce{constructor({functionName:t,cause:n}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:n})}}class V8e extends Ce{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Z$ extends Ce{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}class Lm extends Ce{constructor({body:t,cause:n,details:r,headers:s,status:i,url:o}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${G$(o)}`,t&&`Request body: ${ks(t)}
4485`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=s,this.status=i,this.url=o}}class wP extends Ce{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${G$(r)}`,`Request body: ${ks(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data,this.url=r}}class kz extends Ce{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${G$(n)}`,`Request body: ${ks(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=n}}const FPt=-1;class va extends Ce{constructor(t,{code:n,docsPath:r,metaMessages:s,name:i,shortMessage:o}){super(o,{cause:t,docsPath:r,metaMessages:s||(t==null?void 0:t.metaMessages),name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||t.name,this.code=t instanceof wP?t.code:n??FPt}}class Ea extends va{constructor(t,n){super(t,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class q5 extends va{constructor(t){super(t,{code:q5.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(q5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class W5 extends va{constructor(t){super(t,{code:W5.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(W5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class H5 extends va{constructor(t,{method:n}={}){super(t,{code:H5.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(H5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class V5 extends va{constructor(t){super(t,{code:V5.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` 4486`)})}}Object.defineProperty(V5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class r1 extends va{constructor(t){super(t,{code:r1.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(r1,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class T0 extends va{constructor(t){super(t,{code:T0.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` 4487`)})}}Object.defineProperty(T0,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class K5 extends va{constructor(t){super(t,{code:K5.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(K5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class G5 extends va{constructor(t){super(t,{code:G5.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(G5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Z5 extends va{constructor(t){super(t,{code:Z5.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Z5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class pm extends va{constructor(t,{method:n}={}){super(t,{code:pm.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not supported.`})}}Object.defineProperty(pm,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Ry extends va{constructor(t){super(t,{code:Ry.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Ry,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Y5 extends va{constructor(t){super(t,{code:Y5.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Y5,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});
4487class Fw extends Ea{constructor(t){super(t,{code:Fw.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Fw,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class J5 extends Ea{constructor(t){super(t,{code:J5.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(J5,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class X5 extends Ea{constructor(t,{method:n}={}){super(t,{code:X5.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(X5,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Q5 extends Ea{constructor(t){super(t,{code:Q5.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Q5,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class e6 extends Ea{constructor(t){super(t,{code:e6.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(e6,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class t6 extends Ea{constructor(t){super(t,{code:t6.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(t6,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class n6 extends Ea{constructor(t){super(t,{code:n6.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(n6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class r6 extends Ea{constructor(t){super(t,{code:r6.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(r6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class s6 extends Ea{constructor(t){super(t,{code:s6.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(s6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class i6 extends Ea{constructor(t){super(t,{code:i6.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(i6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class o6 extends Ea{constructor(t){super(t,{code:o6.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(o6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class a6 extends Ea{constructor(t){super(t,{code:a6.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(a6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class c6 extends Ea{constructor(t){super(t,{code:c6.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(c6,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class K4 extends Ea{constructor(t){super(t,{code:K4.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(K4,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class K8e extends va{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const zPt=3;function By(e,{abi:t,address:n,args:r,docsPath:s,functionName:i,sender:o}){const a=e instanceof Z$?e:e instanceof Ce?e.walk(g=>"data"in g)||e.walk():{},{code:c,data:l,details:u,message:d,shortMessage:h}=a,f=e instanceof s3?new H8e({functionName:i,cause:e}):[zPt,r1.code].includes(c)&&(l||u||d||h)||c===T0.code&&u==="execution reverted"&&l?new G_({abi:t,data:typeof l=="object"?l.data:l,functionName:i,message:a instanceof wP?u:h??d,cause:e}):e;return new cG(f,{abi:t,args:r,contractAddress:n,docsPath:s,functionName:i,sender:o})}function qPt(e){const t=Ti(`0x${e.substring(4)}`).substring(26);return H$(`0x${t}`)}async function G8e({hash:e,signature:t}){const n=Nu(e)?e:_0(e),{secp256k1:r}=await te(async()=>{const{secp256k1:o}=await Promise.resolve().then(()=>zRt);return{secp256k1:o}},void 0);return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:l,s:u,v:d,yParity:h}=t,f=Number(h??d),g=uce(f);return new r.Signature(Zd(l),Zd(u)).addRecoveryBit(g)}const o=Nu(t)?t:_0(t);if(ts(o)!==65)throw new Error("invalid signature length");const a=df(`0x${o.slice(130)}`),c=uce(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function uce(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function Z_({hash:e,signature:t}){return qPt(await G8e({hash:e,signature:t}))}
4487function Z8e(e,t="hex"){const n=Y8e(e),r=rG(new Uint8Array(n.length));return n.encode(r),t==="hex"?Ds(r.bytes):r.bytes}function Y8e(e){return Array.isArray(e)?WPt(e.map(t=>Y8e(t))):HPt(e)}function WPt(e){const t=e.reduce((s,i)=>s+i.length,0),n=J8e(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:i}of e)i(s)}}}function HPt(e){const t=typeof e=="string"?Yd(e):e,n=J8e(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function J8e(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new Ce("Length is too large.")}function VPt(e){const{chainId:t,nonce:n,to:r}=e,s=e.contractAddress??e.address,i=Ti(Ob(["0x05",Z8e([t?Bt(t):"0x",s,n?Bt(n):"0x"])]));return r==="bytes"?Yd(i):i}async function X8e(e){const{authorization:t,signature:n}=e;return Z_({hash:VPt(t),signature:n??t})}class Q8e extends Ce{constructor(t,{account:n,docsPath:r,chain:s,data:i,gas:o,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:u,to:d,value:h}){var g;const f=K$({from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${mP(h)} ${((g=s==null?void 0:s.nativeCurrency)==null?void 0:g.symbol)||"ETH"}`,data:i,gas:o,gasPrice:typeof a<"u"&&`${ua(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${ua(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ua(l)} gwei`,nonce:u});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class Iw extends Ce{constructor({cause:t,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(Iw,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Iw,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class G4 extends Ce{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ua(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}}Object.defineProperty(G4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Y_ extends Ce{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${ua(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(Y_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class J_ extends Ce{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}
4487Object.defineProperty(J_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class X_ extends Ce{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` 4488`),{cause:t,name:"NonceTooLowError"})}}Object.defineProperty(X_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Q_ extends Ce{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}}Object.defineProperty(Q_,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class eN extends Ce{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` 4489`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(eN,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class tN extends Ce{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(tN,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class nN extends Ce{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(nN,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class rN extends Ce{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(rN,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Z4 extends Ce{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${ua(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${ua(r)} gwei`:""}).`].join(` 4490`),{cause:t,name:"TipAboveFeeCapError"})}}Object.defineProperty(Z4,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class a3 extends Ce{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}function yP(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof Ce?e.walk(s=>(s==null?void 0:s.code)===Iw.code):e;return r instanceof Ce?new Iw({cause:e,message:r.details}):Iw.nodeMessage.test(n)?new Iw({cause:e,message:e.details}):G4.nodeMessage.test(n)?new G4({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Y_.nodeMessage.test(n)?new Y_({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):J_.nodeMessage.test(n)?new J_({cause:e,nonce:t==null?void 0:t.nonce}):X_.nodeMessage.test(n)?new X_({cause:e,nonce:t==null?void 0:t.nonce}):Q_.nodeMessage.test(n)?new Q_({cause:e,nonce:t==null?void 0:t.nonce}):eN.nodeMessage.test(n)?new eN({cause:e}):tN.nodeMessage.test(n)?new tN({cause:e,gas:t==null?void 0:t.gas}):nN.nodeMessage.test(n)?new nN({cause:e,gas:t==null?void 0:t.gas}):rN.nodeMessage.test(n)?new rN({cause:e}):Z4.nodeMessage.test(n)?new Z4({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new a3({cause:e})}function KPt(e,{docsPath:t,...n}){const r=(()=>{const s=yP(e,n);return s instanceof a3?e:s})();return new Q8e(r,{docsPath:t,...n})}function bP(e,{format:t}){if(!t)return{};const n={};function r(i){const o=Object.keys(i);for(const a of o)a in e&&(n[a]=e[a]),i[a]&&typeof i[a]=="object"&&!Array.isArray(i[a])&&r(i[a])}const s=t(e||{});return r(s),n}const e4e={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function c3(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=GPt(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="str
4490ing"?n.blobs=e.blobs.map(r=>Ds(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=Bt(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=Bt(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=Bt(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=Bt(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=Bt(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=Bt(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=e4e[e.type]),typeof e.value<"u"&&(n.value=Bt(e.value)),n}function GPt(e){return e.map(t=>({address:t.address,r:t.r?Bt(BigInt(t.r)):t.r,s:t.s?Bt(BigInt(t.s)):t.s,chainId:Bt(t.chainId),nonce:Bt(t.nonce),...typeof t.yParity<"u"?{yParity:Bt(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:Bt(t.v)}:{}}))}function dce(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new nce({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new nce({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function ZPt(e){const{balance:t,nonce:n,state:r,stateDiff:s,code:i}=e,o={};if(i!==void 0&&(o.code=i),t!==void 0&&(o.balance=Bt(t)),n!==void 0&&(o.nonce=Bt(n)),r!==void 0&&(o.state=dce(r)),s!==void 0){if(o.state)throw new F8e;o.stateDiff=dce(s)}return o}function lG(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!bl(n,{strict:!1}))throw new N0({address:n});if(t[n])throw new j8e({address:n});t[n]=ZPt(r)}return t}const t4e=2n**256n-1n;function kb(e){const{account:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:s}=e,i=t?vl(t):void 0;if(i&&!bl(i.address))throw new N0({address:i.address});if(s&&!bl(s))throw new N0({address:s});if(n&&n>t4e)throw new G4({maxFeePerGas:n});if(r&&n&&r>n)throw new Z4({maxFeePerGas:n,maxPriorityFeePerGas:r})}class uG extends Ce{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class vP extends Ce{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class n4e extends Ce{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ua(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class dG extends Ce{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const hG={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function EP(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?df(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?df(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?hG[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=YPt(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}function YPt(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function fG(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:EP(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLim
4490it?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Ad(e,{blockHash:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",includeTransactions:s}={}){var l,u,d;const i=s??!1,o=n!==void 0?Bt(n):void 0;let a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,i]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[o||r,i]},{dedupe:!!o}),!a)throw new dG({blockHash:t,blockNumber:n});return(((d=(u=(l=e.chain)==null?void 0:l.formatters)==null?void 0:u.block)==null?void 0:d.format)||fG)(a,"getBlock")}async function pG(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function JPt(e,t){return r4e(e,t)}async function r4e(e,t){var i,o;const{block:n,chain:r=e.chain,request:s}=t||{};try{const a=((i=r==null?void 0:r.fees)==null?void 0:i.maxPriorityFeePerGas)??((o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee);if(typeof a=="function"){const l=n||await _t(e,Ad,"getBlock")({}),u=await a({block:l,client:e,request:s});if(u===null)throw new Error;return u}if(typeof a<"u")return a;const c=await e.request({method:"eth_maxPriorityFeePerGas"});return Zd(c)}catch{const[a,c]=await Promise.all([n?Promise.resolve(n):_t(e,Ad,"getBlock")({}),_t(e,pG,"getGasPrice")({})]);if(typeof a.baseFeePerGas!="bigint")throw new vP;const l=c-a.baseFeePerGas;return l<0n?0n:l}}async function XPt(e,t){return Rz(e,t)}async function Rz(e,t){var h,f;const{block:n,chain:r=e.chain,request:s,type:i="eip1559"}=t||{},o=await(async()=>{var g,p;return typeof((g=r==null?void 0:r.fees)==null?void 0:g.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:s}):((p=r==null?void 0:r.fees)==null?void 0:p.baseFeeMultiplier)??1.2})();if(o<1)throw new uG;const c=10**(((h=o.toString().split(".")[1])==null?void 0:h.length)??0),l=g=>g*BigInt(Math.ceil(o*c))/BigInt(c),u=n||await _t(e,Ad,"getBlock")({});if(typeof((f=r==null?void 0:r.fees)==null?void 0:f.estimateFeesPerGas)=="function"){const g=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:l,request:s,type:i});if(g!==null)return g}if(i==="eip1559"){if(typeof u.baseFeePerGas!="bigint")throw new vP;const g=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await r4e(e,{block:u,chain:r,request:s}),p=l(u.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??p+g,maxPriorityFeePerGas:g}}return{gasPrice:(s==null?void 0:s.gasPrice)??l(await _t(e,pG,"getGasPrice")({}))}}async function s4e(e,{address:t,blockTag:n="latest",blockNumber:r}){const s=await e.request({method:"eth_getTransactionCount",params:[t,typeof r=="bigint"?Bt(r):n]},{dedupe:!!r});return df(s)}function gG(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>Yd(i)):e.blobs,s=[];for(const i of r)s.push(Uint8Array.from(t.blobToKzgCommitment(i)));return n==="bytes"?s:s.map(i=>Ds(i))}function mG(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(o=>Yd(o)):e.blobs,s=typeof e.commitments[0]=="string"?e.commitments.map(o=>Yd(o)):e.commitments,i=[];for(let o=0;o<r.length;o++){const a=r[o],c=s[o];i.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return n==="bytes"?i:i.map(o=>Ds(o))}function i4e(e,t){return yq(Nu(e,{strict:!1})?Pb(e):e)}function o4e(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),s=i4e(t);return s.set([n],0),r==="bytes"?s:Ds(s)}function a4e(e){const{commitments:t,version:n}=e,r=e.to,s=[];for(const i of t)s.push(o4e({commitment:i,to:r,version:n}));return s}const hce=6,c4e=32,wG=4096,l4e=c4e*wG,fce=l4e*hce-1-1*wG*hce;class QPt extends Ce{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class eOt extends Ce{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}
4490function u4e(e){const t=typeof e.data=="string"?Yd(e.data):e.data,n=ts(t);if(!n)throw new eOt;if(n>fce)throw new QPt({maxSize:fce,size:n});const r=[];let s=!0,i=0;for(;s;){const o=rG(new Uint8Array(l4e));let a=0;for(;a<wG;){const c=t.slice(i,i+(c4e-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),s=!1;break}a++,i+=31}r.push(o)}return r.map(o=>Ds(o.bytes))}function d4e(e){const{data:t,kzg:n,to:r}=e,s=e.blobs??u4e({data:t}),i=e.commitments??gG({blobs:s,kzg:n,to:r}),o=e.proofs??mG({blobs:s,commitments:i,kzg:n,to:r}),a=[];for(let c=0;c<s.length;c++)a.push({blob:s[c],commitment:i[c],proof:o[c]});return a}function h4e(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new z8e({transaction:e})}function tOt(e,{docsPath:t,...n}){const r=(()=>{const s=yP(e,n);return s instanceof a3?e:s})();return new q8e(r,{docsPath:t,...n})}async function yG(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return df(t)}async function f4e(e,t){var A,I,O,N,T;const{account:n=e.account,accessList:r,authorizationList:s,chain:i=e.chain,blobVersionedHashes:o,blobs:a,data:c,gas:l,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:f,nonce:g,nonceManager:p,to:m,type:w,value:C,...E}=t,b=await(async()=>{if(!n||!p||typeof g<"u")return g;const P=vl(n),_=i?i.id:await _t(e,yG,"getChainId")({});return await p.consume({address:P.address,chainId:_,client:e})})();kb(t);const S=(I=(A=i==null?void 0:i.formatters)==null?void 0:A.transactionRequest)==null?void 0:I.format,x=(S||c3)({...bP(E,{format:S}),account:n?vl(n):void 0,accessList:r,authorizationList:s,blobs:a,blobVersionedHashes:o,data:c,gas:l,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:h,maxPriorityFeePerGas:f,nonce:b,to:m,type:w,value:C},"fillTransaction");try{const P=await e.request({method:"eth_fillTransaction",params:[x]}),y=(((N=(O=i==null?void 0:i.formatters)==null?void 0:O.transaction)==null?void 0:N.format)||EP)(P.tx);delete y.blockHash,delete y.blockNumber,delete y.r,delete y.s,delete y.transactionIndex,delete y.v,delete y.yParity,y.data=y.input,y.gas&&(y.gas=t.gas??y.gas),y.gasPrice&&(y.gasPrice=t.gasPrice??y.gasPrice),y.maxFeePerBlobGas&&(y.maxFeePerBlobGas=t.maxFeePerBlobGas??y.maxFeePerBlobGas),y.maxFeePerGas&&(y.maxFeePerGas=t.maxFeePerGas??y.maxFeePerGas),y.maxPriorityFeePerGas&&(y.maxPriorityFeePerGas=t.maxPriorityFeePerGas??y.maxPriorityFeePerGas),y.nonce&&(y.nonce=t.nonce??y.nonce);const $=await(async()=>{var D,U;if(typeof((D=i==null?void 0:i.fees)==null?void 0:D.baseFeeMultiplier)=="function"){const F=await _t(e,Ad,"getBlock")({});return i.fees.baseFeeMultiplier({block:F,client:e,request:t})}return((U=i==null?void 0:i.fees)==null?void 0:U.baseFeeMultiplier)??1.2})();if($<1)throw new uG;const B=10**(((T=$.toString().split(".")[1])==null?void 0:T.length)??0),k=D=>D*BigInt(Math.ceil($*B))/BigInt(B);return y.maxFeePerGas&&!t.maxFeePerGas&&(y.maxFeePerGas=k(y.maxFeePerGas)),y.gasPrice&&!t.gasPrice&&(y.gasPrice=k(y.gasPrice)),{raw:P.raw,transaction:{from:x.from,...y}}}catch(P){throw tOt(P,{...t,chain:e.chain})}}const nOt=["blobVersionedHashes","chainId","fees","gas","nonce","type"],pce=new Map,KD=new pP(128);async function p4e(e,t){var b,S,v;let n=t;n.account??(n.account=e.account),n.parameters??(n.parameters=nOt);const{account:r,chain:s=e.chain,nonceManager:i,parameters:o}=n,a=(()=>{if(typeof(s==null?void 0:s.prepareTransactionRequest)=="function")return{fn:s.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(s==null?void 0:s.prepareTransactionRequest))return{fn:s.prepareTransactionRequest[0],runAt:s.prepareTransactionRequest[1].runAt}})();let c;async function l(){return c||(typeof n.chainId<"u"?n.chainId:s?s.id:(c=await _t(e,yG,"getChainId")({}),c))}const u=r&&vl(r);let d=n.nonce;if(o.includes("nonce")&&typeof d>"u"&&u&&i){const x=await l();d=await i.consume({address:u.address,chainId:x,client:e})}a!=null&&a.fn&&((b=a.runAt)!=null&&b.includes("beforeFillTransaction"))&&(n=await a.fn({...n,chain:s},{phase:"beforeFillTransaction"}),d??(d=n.nonce));const f=((o.includes("blobVersionedHashes")||o.includes("sidecars"))&&n.kzg&&n.blobs||KD.get(e.uid)===!1||!["fees","gas"].some(A=>o.includes(A))?!1:!!(o.includes("chainId")&&typeof n.chainId!="number"||o.includes("nonce")&&typeof d!="number"||o.includes("fees")&&typeof n.gasPrice!="bigint"&&(typeof n.maxFeePerGas!="bigint"||typeof n.maxPriorityFeePerGas!="bigint")||o.includes("gas")&&typeof n.gas!="bigint"))?await _t(e,f4e,"fillTransaction")({...n,nonce:
4490d}).then(x=>{const{chainId:A,from:I,gas:O,gasPrice:N,nonce:T,maxFeePerBlobGas:P,maxFeePerGas:_,maxPriorityFeePerGas:y,type:$,...R}=x.transaction;return KD.set(e.uid,!0),{...n,...I?{from:I}:{},...$&&!n.type?{type:$}:{},...typeof A<"u"?{chainId:A}:{},...typeof O<"u"?{gas:O}:{},...typeof N<"u"?{gasPrice:N}:{},...typeof T<"u"?{nonce:T}:{},...typeof P<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerBlobGas:P}:{},...typeof _<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxFeePerGas:_}:{},...typeof y<"u"&&n.type!=="legacy"&&n.type!=="eip2930"?{maxPriorityFeePerGas:y}:{},..."nonceKey"in R&&typeof R.nonceKey<"u"?{nonceKey:R.nonceKey}:{}}}).catch(x=>{var O;const A=x;return A.name!=="TransactionExecutionError"||((O=A.walk)==null?void 0:O.call(A,N=>{var P;const T=N;return T.name==="MethodNotFoundRpcError"||T.name==="MethodNotSupportedRpcError"||((P=T.message)==null?void 0:P.includes("eth_fillTransaction is not available"))}))&&KD.set(e.uid,!1),n}):n;d??(d=f.nonce),n={...f,...u?{from:u==null?void 0:u.address}:{},...d?{nonce:d}:{}};const{blobs:g,gas:p,kzg:m,type:w}=n;a!=null&&a.fn&&((S=a.runAt)!=null&&S.includes("beforeFillParameters"))&&(n=await a.fn({...n,chain:s},{phase:"beforeFillParameters"}));let C;async function E(){return C||(C=await _t(e,Ad,"getBlock")({blockTag:"latest"}),C)}if(o.includes("nonce")&&typeof d>"u"&&u&&!i&&(n.nonce=await _t(e,s4e,"getTransactionCount")({address:u.address,blockTag:"pending"})),(o.includes("blobVersionedHashes")||o.includes("sidecars"))&&g&&m){const x=gG({blobs:g,kzg:m});if(o.includes("blobVersionedHashes")){const A=a4e({commitments:x,to:"hex"});n.blobVersionedHashes=A}if(o.includes("sidecars")){const A=mG({blobs:g,commitments:x,kzg:m}),I=d4e({blobs:g,commitments:x,proofs:A,to:"hex"});n.sidecars=I}}if(o.includes("chainId")&&(n.chainId=await l()),(o.includes("fees")||o.includes("type"))&&typeof w>"u")try{n.type=h4e(n)}catch{let x=pce.get(e.uid);if(typeof x>"u"){const A=await E();x=typeof(A==null?void 0:A.baseFeePerGas)=="bigint",pce.set(e.uid,x)}n.type=x?"eip1559":"legacy"}
4490if(o.includes("fees"))if(n.type!=="legacy"&&n.type!=="eip2930"){if(typeof n.maxFeePerGas>"u"||typeof n.maxPriorityFeePerGas>"u"){const x=await E(),{maxFeePerGas:A,maxPriorityFeePerGas:I}=await Rz(e,{block:x,chain:s,request:n});if(typeof n.maxPriorityFeePerGas>"u"&&n.maxFeePerGas&&n.maxFeePerGas<I)throw new n4e({maxPriorityFeePerGas:I});n.maxPriorityFeePerGas=I,n.maxFeePerGas=A}}else{if(typeof n.maxFeePerGas<"u"||typeof n.maxPriorityFeePerGas<"u")throw new vP;if(typeof n.gasPrice>"u"){const x=await E(),{gasPrice:A}=await Rz(e,{block:x,chain:s,request:n,type:"legacy"});n.gasPrice=A}}return o.includes("gas")&&typeof p>"u"&&(n.gas=await _t(e,bG,"estimateGas")({...n,account:u,prepare:(u==null?void 0:u.type)==="local"?[]:["blobVersionedHashes"]})),a!=null&&a.fn&&((v=a.runAt)!=null&&v.includes("afterFillParameters"))&&(n=await a.fn({...n,chain:s},{phase:"afterFillParameters"})),kb(n),delete n.parameters,n}async function bG(e,t){var o,a,c;const{account:n=e.account,prepare:r=!0}=t,s=n?vl(n):void 0,i=(()=>{if(Array.isArray(r))return r;if((s==null?void 0:s.type)!=="local")return["blobVersionedHashes"]})();try{const l=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await X8e({authorization:t.authorizationList[0]}).catch(()=>{throw new Ce("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:u,authorizationList:d,blobs:h,blobVersionedHashes:f,blockNumber:g,blockTag:p,data:m,gas:w,gasPrice:C,maxFeePerBlobGas:E,maxFeePerGas:b,maxPriorityFeePerGas:S,nonce:v,value:x,stateOverride:A,...I}=r?await p4e(e,{...t,parameters:i,to:l}):t;if(w&&t.gas!==w)return w;const N=(typeof g=="bigint"?Bt(g):void 0)||p,T=lG(A);kb(t);const P=(c=(a=(o=e.chain)==null?void 0:o.formatters)==null?void 0:a.transactionRequest)==null?void 0:c.format,y=(P||c3)({...bP(I,{format:P}),account:s,accessList:u,authorizationList:d,blobs:h,blobVersionedHashes:f,data:m,gasPrice:C,maxFeePerBlobGas:E,maxFeePerGas:b,maxPriorityFeePerGas:S,nonce:v,to:l,value:x},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:T?[y,N??e.experimental_blockTag??"latest",T]:N?[y,N]:[y]}))}catch(l){throw KPt(l,{...t,account:s,chain:e.chain})}}async function rOt(e,t){var l;const{abi:n,address:r,args:s,functionName:i,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(l=e.dataSuffix)==null?void 0:l.value,...a}=t,c=Nl({abi:n,args:s,functionName:i});try{return await _t(e,bG,"estimateGas")({data:`${c}${o?o.replace("0x",""):""}`,to:r,...a})}catch(u){const d=a.account?vl(a.account):void 0;throw By(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:d==null?void 0:d.address})}}function Dy(e,t){if(!bl(e,{strict:!1}))throw new N0({address:e});if(!bl(t,{strict:!1}))throw new N0({address:t});return e.toLowerCase()===t.toLowerCase()}function Jd(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const gce="/docs/contract/decodeEventLog";function Y4(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[o,...a]=s;if(!o)throw new l8e({docsPath:gce});const c=t.find(w=>w.type==="event"&&o===z5(Gd(w)));if(!(c&&"name"in c)||c.type!=="event")throw new u8e(o,{docsPath:gce});const{name:l,inputs:u}=c,d=u==null?void 0:u.some(w=>!("name"in w&&w.name)),h=d?[]:{},f=u.map((w,C)=>[w,C]).filter(([w])=>"indexed"in w&&w.indexed),g=[];for(let w=0;w<f.length;w++){const[C,E]=f[w],b=a[w];if(!b){if(i)throw new hP({abiItem:c,param:C});g.push([C,E]);continue}h[d?E:C.name||E]=sOt({param:C,value:b})}const p=u.filter(w=>!("indexed"in w&&w.indexed)),m=i?p:[...g.map(([w])=>w),...p];if(m.length>0){if(n&&n!=="0x")try{const w=o3(m,n);if(w){let C=0;if(!i)for(const[E,b]of g)h[d?b:E.name||b]=w[C++];if(d)for(let E=0;E<u.length;E++)h[E]===void 0&&C<w.length&&(h[E]=w[C++]);else for(let E=0;E<p.length;
4490E++)h[p[E].name]=w[C++]}}catch(w){if(i)throw w instanceof VK||w instanceof k8e?new W4({abiItem:c,data:n,params:m,size:ts(n)}):w}else if(i)throw new W4({abiItem:c,data:"0x",params:m,size:0})}return{eventName:l,args:Object.values(h).length>0?h:void 0}}function sOt({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(o3([e],t)||[])[0]}function CP(e){const{abi:t,args:n,logs:r,strict:s=!0}=e,i=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),o=t.filter(a=>a.type==="event").map(a=>({abi:a,selector:z5(a)}));return r.map(a=>{var h;const c=typeof a.blockNumber=="string"?Jd(a):a,l=o.filter(f=>c.topics[0]===f.selector);if(l.length===0)return null;let u,d;for(const f of l)try{u=Y4({...c,abi:[f.abi],strict:!0}),d=f;break}catch{}if(!u&&!s){d=l[0];try{u=Y4({data:c.data,topics:c.topics,abi:[d.abi],strict:!1})}catch{const f=(h=d.abi.inputs)==null?void 0:h.some(g=>!("name"in g&&g.name));return{...c,args:f?[]:{},eventName:d.abi.name}}}return!u||!d||i&&!i.includes(u.eventName)||!iOt({args:u.args,inputs:d.abi.inputs,matchArgs:n})?null:{...u,...c}}).filter(Boolean)}function iOt(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function s(i,o,a){try{return i.type==="address"?Dy(o,a):i.type==="string"||i.type==="bytes"?Ti(Pb(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((i,o)=>{if(i==null)return!0;const a=n[o];return a?(Array.isArray(i)?i:[i]).some(l=>s(a,l,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([i,o])=>{if(o==null)return!0;const a=n.find(l=>l.name===i);return a?(Array.isArray(o)?o:[o]).some(l=>s(a,l,t[i])):!1}):!1}async function vG(e,{address:t,blockHash:n,fromBlock:r,toBlock:s,event:i,events:o,args:a,strict:c}={}){const l=c??!1,u=o??(i?[i]:void 0);let d=[];u&&(d=[u.flatMap(p=>i3({abi:[p],eventName:p.name,args:o?void 0:a}))],i&&(d=d[0]));let h;n?h=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):h=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?Bt(r):r,toBlock:typeof s=="bigint"?Bt(s):s}]});const f=h.map(g=>Jd(g));return u?CP({abi:u,args:a,logs:f,strict:l}):f}async function g4e(e,t){const{abi:n,address:r,args:s,blockHash:i,eventName:o,fromBlock:a,toBlock:c,strict:l}=t,u=o?b1({abi:n,name:o}):void 0,d=u?void 0:n.filter(h=>h.type==="event");return _t(e,vG,"getLogs")({address:r,args:s,blockHash:i,event:u,events:d,fromBlock:a,toBlock:c,strict:l})}const GD="/docs/contract/decodeFunctionResult";function K0(e){const{abi:t,args:n,functionName:r,data:s}=e;let i=t[0];if(r){const a=b1({abi:t,args:n,name:r});if(!a)throw new Oy(r,{docsPath:GD});i=a}if(i.type!=="function")throw new Oy(void 0,{docsPath:GD});if(!i.outputs)throw new GK(i.name,{docsPath:GD});const o=o3(i.outputs,s);if(o&&o.length>1)return o;if(o&&o.length===1)return o[0]}const EG=BigInt(0),Bz=BigInt(1);function Y$(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function CG(e){if(!Y$(e))throw new Error("Uint8Array expected")}function J4(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function tS(e){const t=e.toString(16);return t.length&1?"0"+t:t}function m4e(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?EG:BigInt("0x"+e)}const w4e=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",oOt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function X4(e){if(CG(e),w4e)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=oOt[e[n]];return t}const sp={_0:48,_9:57,A:65,F:70,a:97,f:102};function mce(e){if(e>=sp._0&&e<=sp._9)return e-sp._0;if(e>=sp.A&&e<=sp.F)return e-(sp.A-10);if(e>=sp.a&&e<=sp.f)return e-(sp.a-10)}function sN(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(w4e)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);
vendor: 5,037 bytes, lines 4490-4491
4490const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=mce(e.charCodeAt(i)),a=mce(e.charCodeAt(i+1));if(o===void 0||a===void 0){const c=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}r[s]=o*16+a}return r}function zw(e){return m4e(X4(e))}function y4e(e){return CG(e),m4e(X4(Uint8Array.from(e).reverse()))}function J$(e,t){return sN(e.toString(16).padStart(t*2,"0"))}function b4e(e,t){return J$(e,t).reverse()}function au(e,t,n){let r;if(typeof t=="string")try{r=sN(t)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(Y$(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}function iN(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];CG(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}const ZD=e=>typeof e=="bigint"&&EG<=e;function $G(e,t,n){return ZD(e)&&ZD(t)&&ZD(n)&&t<=e&&e<n}function i5(e,t,n,r){if(!$G(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function aOt(e){let t;for(t=0;e>EG;e>>=Bz,t+=1);return t}const $P=e=>(Bz<<BigInt(e))-Bz,YD=e=>new Uint8Array(e),wce=e=>Uint8Array.from(e);function cOt(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=YD(e),s=YD(e),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...d)=>n(s,r,...d),c=(d=YD(0))=>{s=a(wce([0]),d),r=a(),d.length!==0&&(s=a(wce([1]),d),r=a())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=a();const f=r.slice();h.push(f),d+=r.length}return iN(...h)};return(d,h)=>{o(),c(d);let f;for(;!(f=h(l()));)c();return o(),f}}const lOt={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Y$(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function xP(e,t,n={}){const r=(s,i,o)=>{const a=lOt[i];if(typeof a!="function")throw new Error("invalid validator function");const c=e[s];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(t))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return e}function yce(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const i=e(n,...r);return t.set(n,i),i}}const uOt="0.1.1";function dOt(){return uOt}class jt extends Error{static setStaticOptions(t){jt.prototype.docsOrigin=t.docsOrigin,jt.prototype.showVersion=t.showVersion,jt.prototype.version=t.version}constructor(t,n={}){const r=(()=>{var u;if(n.cause instanceof jt){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),s=n.cause instanceof jt&&n.cause.docsPath||n.docsPath,i=n.docsOrigin??jt.prototype.docsOrigin,o=`${i}${s??""}`,a=!!(n.version??jt.prototype.showVersion),c=n.version??jt.prototype.version,l=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s||a?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(u=>typeof u=="string").join(` 4491`);super(l,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=n.cause,this.details=r,this.docs=o,this.docsOrigin=i,this.docsPath=s,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return v4e(this,t)}}Object.defineProperty(jt,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${dOt()}`}});jt.setStaticOptions(jt.defaultStaticOptions);function v4e(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?v4e(e.cause,t):t?null:e}
4491function X$(e,t){if(Pv(e)>t)throw new _Ot({givenSize:Pv(e),maxSize:t})}const ip={zero:48,nine:57,A:65,F:70,a:97,f:102};function bce(e){if(e>=ip.zero&&e<=ip.nine)return e-ip.zero;if(e>=ip.A&&e<=ip.F)return e-(ip.A-10);if(e>=ip.a&&e<=ip.f)return e-(ip.a-10)}function hOt(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new NOt({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o=n==="right";s[o?i:r-i-1]=e[o?i:e.length-i-1]}return s}function E4e(e,t={}){const{dir:n="left"}=t;let r=e,s=0;for(let i=0;i<r.length-1&&r[n==="left"?i:r.length-i-1].toString()==="0";i++)s++;return r=n==="left"?r.slice(s):r.slice(0,r.length-s),r}function IP(e,t){if(El(e)>t)throw new BOt({givenSize:El(e),maxSize:t})}function fOt(e,t){if(typeof t=="number"&&t>0&&t>El(e)-1)throw new T4e({offset:t,position:"start",size:El(e)})}function pOt(e,t,n){if(typeof t=="number"&&typeof n=="number"&&El(e)!==n-t)throw new T4e({offset:n,position:"end",size:El(e)})}function C4e(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new DOt({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const gOt="#__bigint";function $4e(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+gOt:s,n)}const mOt=new TextDecoder,wOt=new TextEncoder;function yOt(e){return e instanceof Uint8Array?e:typeof e=="string"?x4e(e):bOt(e)}function bOt(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function x4e(e,t={}){const{size:n}=t;let r=e;n&&(IP(e,n),r=Ly(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const l=bce(s.charCodeAt(c++)),u=bce(s.charCodeAt(c++));if(l===void 0||u===void 0)throw new jt(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=l<<4|u}return o}function vOt(e,t={}){const{size:n}=t,r=wOt.encode(e);return typeof n=="number"?(X$(r,n),EOt(r,n)):r}function EOt(e,t){return hOt(e,{dir:"right",size:t})}function Pv(e){return e.length}function COt(e,t,n,r={}){const{strict:s}=r;return e.slice(t,n)}function $Ot(e,t={}){const{size:n}=t;typeof n<"u"&&X$(e,n);const r=Qd(e,t);return A4e(r,t)}function xOt(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(X$(r,n),r=I4e(r)),r.length>1||r[0]>1)throw new AOt(r);return!!r[0]}function p0(e,t={}){const{size:n}=t;typeof n<"u"&&X$(e,n);const r=Qd(e,t);return _4e(r,t)}function IOt(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(X$(r,n),r=SOt(r)),mOt.decode(r)}function I4e(e){return E4e(e,{dir:"left"})}function SOt(e){return E4e(e,{dir:"right"})}class AOt extends jt{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}let _Ot=class extends jt{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},NOt=class extends jt{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};const TOt=new TextEncoder,POt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function OOt(e,t={}){const{strict:n=!1}=t;if(!e)throw new vce(e);if(typeof e!="string")throw new vce(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Ece(e);if(!e.startsWith("0x"))throw new Ece(e)}function Xd(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function kOt(e){return e instanceof Uint8Array?Qd(e):Array.isArray(e)?Qd(new Uint8Array(e)):e}function S4e(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(IP(n,t.size),Uy(n,t.size)):n}function Qd(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=POt[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(IP(r,t.size),Ly(r,t.size)):r}function Go(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const l=typeof e=="bigint"?"n":"";throw new N4e({max:i?`${i}${l}`:void 0,min:`${o}${l}`,signed:n,size:r,value:`${e}${l}`})}
4491const c=`0x${(n&&s<0?BigInt.asUintN(r*8,BigInt(s)):s).toString(16)}`;return r?Uy(c,r):c}function xG(e,t={}){return Qd(TOt.encode(e),t)}function Uy(e,t){return C4e(e,{dir:"left",size:t})}function Ly(e,t){return C4e(e,{dir:"right",size:t})}function tf(e,t,n,r={}){const{strict:s}=r;fOt(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&pOt(i,t,n),i}function El(e){return Math.ceil((e.length-2)/2)}function A4e(e,t={}){const{signed:n}=t;t.size&&IP(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,o=i>>1n;return r<=o?r:r-i-1n}function _4e(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:A4e(e,t))}function ROt(e,t={}){const{strict:n=!1}=t;try{return OOt(e,{strict:n}),!0}catch{return!1}}class N4e extends jt{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class vce extends jt{constructor(t){super(`Value \`${typeof t=="object"?$4e(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Ece extends jt{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class BOt extends jt{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class T4e extends jt{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class DOt extends jt{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function UOt(e){return{address:e.address,amount:Go(e.amount),index:Go(e.index),validatorIndex:Go(e.validatorIndex)}}function P4e(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:Go(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:Go(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:Go(e.gasLimit)},...typeof e.number=="bigint"&&{number:Go(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:Go(e.prevRandao)},...typeof e.time=="bigint"&&{time:Go(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(UOt)}}}const My=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],Dz=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],O4e=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"}
vendor: 4,296 bytes, line 4491
4491,{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],k4e=[...O4e,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],LOt=[...O4e,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],Cce=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],$ce=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],R4e=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],oN=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],YE=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],MOt="0x82ad56cb",IG="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b
4491602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",B4e="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Uz="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848
4491603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",SG="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9
4491150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";class aN extends Ce{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class AG extends Ce{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}const JD="/docs/contract/encodeDeployData";function SP(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const s=t.find(o=>"type"in o&&o.type==="constructor");if(!s)throw new s8e({docsPath:JD});if(!("inputs"in s))throw new _z({docsPath:JD});if(!s.inputs||s.inputs.length===0)throw new _z({docsPath:JD});const i=V0(s.inputs,n);return Ob([r,i])}function Rb({blockNumber:e,chain:t,contract:n}){var s;const r=(s=t==null?void 0:t.contracts)==null?void 0:s[n];if(!r)throw new aN({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new aN({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function D4e(e,{docsPath:t,...n}){const r=(()=>{const s=yP(e,n);return s instanceof a3?e:s})();return new aG(r,{docsPath:t,...n})}function U4e(){let e=()=>{},t=()=>{};return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}const XD=new Map;function L4e({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:s}){const i=async()=>{const u=c();o();const d=u.map(({args:h})=>h);d.length!==0&&e(d).then(h=>{s&&Array.isArray(h)&&h.sort(s);for(let f=0;f<u.length;f++){const{resolve:g}=u[f];g==null||g([h[f],h])}}).catch(h=>{for(let f=0;f<u.length;f++){const{reject:g}=u[f];g==null||g(h)}})},o=()=>XD.delete(t),a=()=>c().map(({args:u})=>u),c=()=>XD.get(t)||[],l=u=>XD.set(t,[...c(),u]);return{flush:o,async schedule(u){const{promise:d,resolve:h,reject:f}
4491=U4e();return(n==null?void 0:n([...a(),u]))&&i(),c().length>0?(l({args:u,resolve:h,reject:f}),d):(l({args:u,resolve:h,reject:f}),setTimeout(i,r),d)}}}async function l3(e,t){var P,_,y,$;const{account:n=e.account,authorizationList:r,batch:s=!!((P=e.batch)!=null&&P.multicall),blockNumber:i,blockTag:o=e.experimental_blockTag??"latest",accessList:a,blobs:c,blockOverrides:l,code:u,data:d,factory:h,factoryData:f,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:C,nonce:E,to:b,value:S,stateOverride:v,...x}=t,A=n?vl(n):void 0;if(u&&(h||f))throw new Ce("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&b)throw new Ce("Cannot provide both `code` & `to` as parameters.");const I=u&&d,O=h&&f&&b&&d,N=I||O,T=I?M4e({code:u,data:d}):O?zOt({data:d,factory:h,factoryData:f,to:b}):d;try{kb(t);const B=(typeof i=="bigint"?Bt(i):void 0)||o,k=l?P4e(l):void 0,D=lG(v),U=($=(y=(_=e.chain)==null?void 0:_.formatters)==null?void 0:y.transactionRequest)==null?void 0:$.format,K=(U||c3)({...bP(x,{format:U}),accessList:a,account:A,authorizationList:r,blobs:c,data:T,gas:g,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:w,maxPriorityFeePerGas:C,nonce:E,to:N?void 0:b,value:S},"call");if(s&&jOt({request:K}
4491)&&!D&&!k)try{return await FOt(e,{...K,blockNumber:i,blockTag:o})}catch(Z){if(!(Z instanceof AG)&&!(Z instanceof aN))throw Z}const q=(()=>{const Z=[K,B];return D&&k?[...Z,D,k]:D?[...Z,D]:k?[...Z,{},k]:Z})(),H=await e.request({method:"eth_call",params:q});return H==="0x"?{data:void 0}:{data:H}}catch(R){const B=qOt(R),{offchainLookup:k,offchainLookupSignature:D}=await te(async()=>{const{offchainLookup:U,offchainLookupSignature:F}=await Promise.resolve().then(()=>Rkt);return{offchainLookup:U,offchainLookupSignature:F}},void 0);if(e.ccipRead!==!1&&(B==null?void 0:B.slice(0,10))===D&&b)return{data:await k(e,{data:B,to:b})};throw N&&(B==null?void 0:B.slice(0,10))==="0x101bb98d"?new V8e({factory:h}):D4e(R,{...t,account:A,chain:e.chain})}}function jOt({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(MOt)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function FOt(e,t){var p;const{batchSize:n=1024,deployless:r=!1,wait:s=0}=typeof((p=e.batch)==null?void 0:p.multicall)=="object"?e.batch.multicall:{},{blockNumber:i,blockTag:o=e.experimental_blockTag??"latest",data:a,to:c}=t,l=(()=>{if(r)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return Rb({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new AG})(),d=(typeof i=="bigint"?Bt(i):void 0)||o,{schedule:h}=L4e({id:`${e.uid}.${d}`,wait:s,shouldSplitBatch(m){return m.reduce((C,{data:E})=>C+(E.length-2),0)>n*2},fn:async m=>{const w=m.map(b=>({allowFailure:!0,callData:b.data,target:b.to})),C=Nl({abi:My,args:[w],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...l===null?{data:M4e({code:SG,data:C})}:{to:l,data:C}
4491},d]});return K0({abi:My,args:[w],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:f,success:g}]=await h({data:a,to:c});if(!g)throw new Z$({data:f});return f==="0x"?{data:void 0}:{data:f}}function M4e(e){const{code:t,data:n}=e;return SP({abi:j0(["constructor(bytes, bytes)"]),bytecode:IG,args:[t,n]})}function zOt(e){const{data:t,factory:n,factoryData:r,to:s}=e;return SP({abi:j0(["constructor(address, bytes, address, bytes)"]),bytecode:B4e,args:[s,t,n,r]})}function qOt(e){var n;if(!(e instanceof Ce))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function eh(e,t){const{abi:n,address:r,args:s,functionName:i,...o}=t,a=Nl({abi:n,args:s,functionName:i});try{const{data:c}=await _t(e,l3,"call")({...o,data:a,to:r});return K0({abi:n,args:s,functionName:i,data:c||"0x"})}catch(c){throw By(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:i})}}async function WOt(e,t){var u;const{abi:n,address:r,args:s,functionName:i,dataSuffix:o=typeof e.dataSuffix=="string"?e.dataSuffix:(u=e.dataSuffix)==null?void 0:u.value,...a}=t,c=a.account?vl(a.account):e.account,l=Nl({abi:n,args:s,functionName:i});try{const{data:d}=await _t(e,l3,"call")({batch:!1,data:`${l}${o?o.replace("0x",""):""}`,to:r,...a,account:c}),h=K0({abi:n,args:s,functionName:i,data:d||"0x"}),f=n.filter(g=>"name"in g&&g.name===t.functionName);return{result:h,request:{abi:f,address:r,args:s,dataSuffix:o,functionName:i,...a,account:c}}}catch(d){throw By(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:i,sender:c==null?void 0:c.address})}}const QD=new Map,xce=new Map;let HOt=0;function s1(e,t,n){const r=++HOt,s=()=>QD.get(e)||[],i=()=>{const u=s();QD.set(e,u.filter(d=>d.id!==r))},o=()=>{const u=s();if(!u.some(h=>h.id===r))return;const d=xce.get(e);if(u.length===1&&d){const h=d();h instanceof Promise&&h.catch(()=>{})}i()},a=s();if(QD.set(e,[...a,{id:r,fns:t}]),a&&a.length>0)return o;const c={};for(const u in t)c[u]=((...d)=>{var f,g;const h=s();if(h.length!==0)for(const p of h)(g=(f=p.fns)[u])==null||g.call(f,...d)});const l=n(c);return typeof l=="function"&&xce.set(e,l),o}async function Lz(e){return new Promise(t=>setTimeout(t,e))}function Q$(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let s=!0;const i=()=>s=!1;return(async()=>{let a;t&&(a=await e({unpoll:i}));const c=await(n==null?void 0:n(a))??r;await Lz(c);const l=async()=>{s&&(await e({unpoll:i}),await Lz(r),l())};l()})(),i}const VOt=new Map,KOt=new Map;function GOt(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:o=>i.set(s,o)}),n=t(e,VOt),r=t(e,KOt);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function j4e(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=GOt(t),s=r.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let i=r.promise.get();i||(i=e(),r.promise.set(i));try{const o=await i;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const ZOt=e=>`blockNumber.${e}`;async function ex(e,{cacheTime:t=e.cacheTime}={}){const n=await j4e(()=>e.request({method:"eth_blockNumber"}),{cacheKey:ZOt(e.uid),cacheTime:t});return BigInt(n)}async function AP(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const s=r.map(i=>Jd(i));return!("abi"in t)||!t.abi?s:CP({abi:t.abi,logs:s,strict:n})}async function _P(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function YOt(e,t){const{abi:n,address:r,args:s,batch:i=!0,eventName:o,fromBlock:a,onError:c,onLogs:l,poll:u,pollingInterval:d=e.pollingInterval,strict:h}=t;return(typeof u<"u"?u:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
4491onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const m=h??!1,w=ks(["watchContractEvent",r,s,i,e.uid,o,d,m,a]);return s1(w,{onLogs:l,onError:c},C=>{let E;a!==void 0&&(E=a-1n);let b,S=!1;const v=Q$(async()=>{var x;if(!S){try{b=await _t(e,T8e,"createContractEventFilter")({abi:n,address:r,args:s,eventName:o,strict:m,fromBlock:a})}catch{}S=!0;return}try{let A;if(b)A=await _t(e,AP,"getFilterChanges")({filter:b});else{const I=await _t(e,ex,"getBlockNumber")({});E&&E<I?A=await _t(e,g4e,"getContractEvents")({abi:n,address:r,args:s,eventName:o,fromBlock:E+1n,toBlock:I,strict:m}):A=[],E=I}if(A.length===0)return;if(i)C.onLogs(A);else for(const I of A)C.onLogs([I])}catch(A){b&&A instanceof T0&&(S=!1),(x=C.onError)==null||x.call(C,A)}},{emitOnBegin:!0,interval:d});return async()=>{b&&await _t(e,_P,"uninstallFilter")({filter:b}),v()}})})():(()=>{const m=h??!1,w=ks(["watchContractEvent",r,s,i,e.uid,o,d,m]);let C=!0,E=()=>C=!1;return s1(w,{onLogs:l,onError:c},b=>((async()=>{try{const S=(()=>{if(e.transport.type==="fallback"){const A=e.transport.transports.find(I=>I.config.type==="webSocket"||I.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),v=o?i3({abi:n,eventName:o,args:s}):[],{unsubscribe:x}=await S.subscribe({params:["logs",{address:r,topics:v}],onData(A){var O;if(!C)return;const I=A.result;try{const{eventName:N,args:T}=Y4({abi:n,data:I.data,topics:I.topics,strict:h}),P=Jd(I,{args:T,eventName:N});b.onLogs([P])}catch(N){let T,P;if(N instanceof W4||N instanceof hP){if(h)return;T=N.abiItem.name,P=(O=N.abiItem.inputs)==null?void 0:O.some(y=>!("name"in y&&y.name))}const _=Jd(I,{args:P?[]:{},eventName:T});b.onLogs([_])}},onError(A){var I;(I=b.onError)==null||I.call(b,A)}});E=x,C||E()}catch(S){c==null||c(S)}})(),()=>E()))})()}async function JOt(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}function cN(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,i)=>{const o=async({count:a=0}={})=>{const c=async({error:l})=>{const u=typeof t=="function"?t({count:a,error:l}):t;u&&await Lz(u),o({count:a+1})};try{const l=await e();s(l)}catch(l){if(a<n&&await r({count:a,error:l}))return c({error:l});i(l)}};o()})}const XOt={"0x0":"reverted","0x1":"success"};function _G(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Jd(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?df(e.transactionIndex):null,status:e.status?XOt[e.status]:null,type:e.type?hG[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Mz=256;let nS=Mz,rS;function F4e(e=11){if(!rS||nS+e>Mz*2){rS="",nS=0;for(let t=0;t<Mz;t++)rS+=(256+Math.random()*256|0).toString(16).substring(1)}return rS.substring(nS,nS+++e)}function z4e(e){const{batch:t,chain:n,ccipRead:r,dataSuffix:s,key:i="base",name:o="Base Client",type:a="base"}=e,c=e.experimental_blockTag??(typeof(n==null?void 0:n.experimental_preconfirmationTime)=="number"?"pending":void 0),l=(n==null?void 0:n.blockTime)??12e3,u=Math.min(Math.max(Math.floor(l/2),500),4e3),d=e.pollingInterval??u,h=e.cacheTime??d,f=e.account?vl(e.account):void 0,{config:g,request:p,value:m}=e.transport({account:f,chain:n,pollingInterval:d}),w={...g,...m},C={account:f,batch:t,cacheTime:h,ccipRead:r,chain:n,dataSuffix:s,key:i,name:o,pollingInterval:d,request:p,transport:w,type:a,uid:F4e(),...c?{experimental_blockTag:c}:{}};function E(b){return S=>{const v=S(b);for(const A in C)delete v[A];const x={...b,...v};return Object.assign(x,{extend:E(x)})}}return Object.assign(C,{extend:E(C)})}function NG(e){var n,r,s,i,o,a;if(!(e instanceof Ce))return!1;const t=e.walk(c=>c instanceof G_);return t instanceof G_?((n=t.data)==null?void 0:n.errorName)==="HttpError"||((r=t.data)==null?void 0:r.errorName)==="ResolverError"||((s=t.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=t.data)==null?void 0:i.errorName)==="ResolverNotFound"||((o=t.data)==null?void 0:o.errorName)==="ReverseAddressMismatch"||((a=t.data)==null?void 0:a.errorName)==="UnsupportedResolverProfile":!1}function q4e(e){const{abi:t,data:n}=e,r=n1(n,0,4),s=t.find(i=>i.type==="function"&&r===ky(Gd(i)));if(!s)throw new d8e(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:s.name,args:"inputs"in s&&s.inputs&&s.inputs.length>0?o3(s.inputs,n1(n,4)):void 0}}const eU="/docs/contract/encodeErrorResult";function jz(e){const{abi:t,errorName:n,args:r}=e;let s=t[0];if(n){const c=b1({abi:t,args:r,name:n});if(!c)throw new Nz(n,{docsPath:eU});s=c}if(s.type!=="error")throw new Nz(void 0,{docsPath:eU});const i=Gd(s),o=ky(i);let a="0x";if(r&&r.length>0){if(!s.inputs)throw new c8e(s.name,{docsPath:eU});a=V0(s.inputs,r)}return Ob([o,a])}const tU="/docs/contract/encodeFunctionResult";function W4e(e){const{abi:t,functionName:n,result:r}=e;let s=t[0];if(n){const o=b1({abi:t,name:n});if(!o)throw new Oy(n,{docsPath:tU});s=o}if(s.type!=="function")throw new Oy(void 0,{docsPath:tU});if(!s.outputs)throw new GK(s.name,{docsPath:tU});const i=(()=>
4491{if(s.outputs.length===0)return[];if(s.outputs.length===1)return[r];if(Array.isArray(r))return r;throw new ZK(r)})();return V0(s.outputs,i)}const tx="x-batch-gateway:true";async function H4e(e){const{data:t,ccipRequest:n}=e,{args:[r]}=q4e({abi:Dz,data:t}),s=[],i=[];return await Promise.all(r.map(async(o,a)=>{try{i[a]=o.urls.includes(tx)?await H4e({data:o.data,ccipRequest:n}):await n(o),s[a]=!1}catch(c){s[a]=!0,i[a]=QOt(c)}})),W4e({abi:Dz,functionName:"query",result:[s,i]})}function QOt(e){return e.name==="HttpRequestError"&&e.status?jz({abi:Dz,errorName:"HttpError",args:[e.status,e.shortMessage]}):jz({abi:[O8e],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}function V4e(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return Nu(t)?t:null}function lN(e){let t=new Uint8Array(32).fill(0);if(!e)return Ds(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const s=V4e(n[r]),i=s?Pb(s):Ti(Um(n[r]),"bytes");t=Ti(Tu([t,i]),"bytes")}return Ds(t)}function ekt(e){return`[${e.slice(2)}]`}function K4e(e){const t=new Uint8Array(32).fill(0);return e?V4e(e)||Ti(Um(e)):Ds(t)}function TG(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(Um(t).byteLength+2);let r=0;const s=t.split(".");for(let i=0;i<s.length;i++){let o=Um(s[i]);o.byteLength>255&&(o=Um(ekt(K4e(s[i])))),n[r]=o.length,n.set(o,r+1),r+=o.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function tkt(e,t){const{blockNumber:n,blockTag:r,coinType:s,name:i,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Rb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c==null?void 0:c.ensTlds;if(u&&!u.some(h=>i.endsWith(h)))return null;const d=s!=null?[lN(i),BigInt(s)]:[lN(i)];try{const h=Nl({abi:$ce,functionName:"addr",args:d}),f={address:l,abi:k4e,functionName:"resolveWithGateways",args:[_0(TG(i)),h,o??[tx]],blockNumber:n,blockTag:r},p=await _t(e,eh,"readContract")(f);if(p[0]==="0x")return null;const m=K0({abi:$ce,args:d,functionName:"addr",data:p[0]});return m==="0x"||Dm(m)==="0x00"?null:m}catch(h){if(a)throw h;if(NG(h))return null;throw h}}class nkt extends Ce{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}}class lv extends Ce{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}}class NP extends Ce{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class G4e extends Ce{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const rkt=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,skt=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,ikt=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,okt=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function akt(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function Ice(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Z4e({uri:e,gatewayUrls:t}){const n=ikt.test(e);
4491if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=Ice(t==null?void 0:t.ipfs,"https://ipfs.io"),s=Ice(t==null?void 0:t.arweave,"https://arweave.net"),i=e.match(rkt),{protocol:o,subpath:a,target:c,subtarget:l=""}=(i==null?void 0:i.groups)||{},u=o==="ipns:/"||a==="ipns/",d=o==="ipfs:/"||a==="ipfs/"||skt.test(e);if(e.startsWith("http")&&!u&&!d){let f=e;return t!=null&&t.arweave&&(f=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((u||d)&&c)return{uri:`${r}/${u?"ipns":"ipfs"}/${c}${l}`,isOnChain:!1,isEncoded:!1};if(o==="ar:/"&&c)return{uri:`${s}/${c}${l||""}`,isOnChain:!1,isEncoded:!1};let h=e.replace(okt,"");if(h.startsWith("<svg")&&(h=`data:image/svg+xml;base64,${btoa(h)}`),h.startsWith("data:")||h.startsWith("{"))return{uri:h,isOnChain:!0,isEncoded:!1};throw new NP({uri:e})}function Y4e(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new nkt({data:e});return e.image||e.image_url||e.image_data}async function ckt({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(s=>s.json());return await PG({gatewayUrls:e,uri:Y4e(n)})}catch{throw new NP({uri:t})}}async function PG({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Z4e({uri:t,gatewayUrls:e});if(r||await akt(n))return n;throw new NP({uri:t})}function lkt(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=t.split("/"),[i,o]=n.split(":"),[a,c]=r.split(":");if(!i||i.toLowerCase()!=="eip155")throw new lv({reason:"Only EIP-155 supported"});if(!o)throw new lv({reason:"Chain ID not found"});if(!c)throw new lv({reason:"Contract address not found"});if(!s)throw new lv({reason:"Token ID not found"});if(!a)throw new lv({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:s}}async function ukt(e,{nft:t}){if(t.namespace==="erc721")return eh(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return eh(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new G4e({namespace:t.namespace})}async function dkt(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?hkt(e,{gatewayUrls:t,record:n}):PG({uri:n,gatewayUrls:t})}async function hkt(e,{gatewayUrls:t,record:n}){const r=lkt(n),s=await ukt(e,{nft:r}),{uri:i,isOnChain:o,isEncoded:a}=Z4e({uri:s,gatewayUrls:t});if(o&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=a?atob(i.replace("data:application/json;base64,","")):i,u=JSON.parse(l);return PG({uri:Y4e(u),gatewayUrls:t})}let c=r.tokenID;return r.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),ckt({gatewayUrls:t,uri:i.replace(/(?:0x)?{id}/,c)})}async function J4e(e,t){const{blockNumber:n,blockTag:r,key:s,name:i,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Rb({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c==null?void 0:c.ensTlds;if(u&&!u.some(d=>i.endsWith(d)))return null;try{const d={address:l,abi:k4e,args:[_0(TG(i)),Nl({abi:Cce,functionName:"text",args:[lN(i),s]}),o??[tx]],functionName:"resolveWithGateways",blockNumber:n,blockTag:r},f=await _t(e,eh,"readContract")(d);if(f[0]==="0x")return null;const g=K0({abi:Cce,functionName:"text",data:f[0]});return g===""?null:g}catch(d){if(a)throw d;if(NG(d))return null;throw d}}async function fkt(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:s,gatewayUrls:i,strict:o,universalResolverAddress:a}){const c=await _t(e,J4e,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:s,universalResolverAddress:a,gatewayUrls:i,strict:o});if(!c)return null;try{return await dkt(e,{record:c,gatewayUrls:r})}catch{return null}}async function pkt(e,t){const{address:n,blockNumber:r,blockTag:s,coinType:i=60n,gatewayUrls:o,strict:a}=t,{chain:c}=e,l=(()=>
4491{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Rb({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const u={address:l,abi:LOt,args:[n,i,o??[tx]],functionName:"reverseWithGateways",blockNumber:r,blockTag:s},d=_t(e,eh,"readContract"),[h]=await d(u);return h||null}catch(u){if(a)throw u;if(NG(u))return null;throw u}}async function gkt(e,t){const{blockNumber:n,blockTag:r,name:s}=t,{chain:i}=e,o=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!i)throw new Error("client chain not configured. universalResolverAddress is required.");return Rb({blockNumber:n,chain:i,contract:"ensUniversalResolver"})})(),a=i==null?void 0:i.ensTlds;if(a&&!a.some(l=>s.endsWith(l)))throw new Error(`${s} is not a valid ENS TLD (${a==null?void 0:a.join(", ")}) for chain "${i.name}" (id: ${i.id}).`);const[c]=await _t(e,eh,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[_0(TG(s))],blockNumber:n,blockTag:r});return c}async function X4e(e,t){var m,w,C;const{account:n=e.account,blockNumber:r,blockTag:s="latest",blobs:i,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:d,to:h,value:f,...g}=t,p=n?vl(n):void 0;try{kb(t);const b=(typeof r=="bigint"?Bt(r):void 0)||s,S=(C=(w=(m=e.chain)==null?void 0:m.formatters)==null?void 0:w.transactionRequest)==null?void 0:C.format,x=(S||c3)({...bP(g,{format:S}),account:p,blobs:i,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:d,to:h,value:f},"createAccessList"),A=await e.request({method:"eth_createAccessList",params:[x,b]});return{accessList:A.accessList,gasUsed:BigInt(A.gasUsed)}}catch(E){throw D4e(E,{...t,account:p,chain:e.chain})}}async function mkt(e){const t=gP(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Q4e(e,{address:t,args:n,event:r,events:s,fromBlock:i,strict:o,toBlock:a}={}){const c=s??(r?[r]:void 0),l=gP(e,{method:"eth_newFilter"});let u=[];c&&(u=[c.flatMap(f=>i3({abi:[f],eventName:f.name,args:n}))],r&&(u=u[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof i=="bigint"?Bt(i):i,toBlock:typeof a=="bigint"?Bt(a):a,...u.length?{topics:u}:{}}]});return{abi:c,args:n,eventName:r?r.name:void 0,fromBlock:i,id:d,request:l(d),strict:!!o,toBlock:a,type:"event"}}async function eCe(e){const t=gP(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function wkt(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){var o,a,c;if((o=e.batch)!=null&&o.multicall&&((c=(a=e.chain)==null?void 0:a.contracts)!=null&&c.multicall3)){const l=e.chain.contracts.multicall3.address,u=Nl({abi:My,functionName:"getEthBalance",args:[t]}),{data:d}=await _t(e,l3,"call")({to:l,data:u,blockNumber:n,blockTag:r});return K0({abi:My,functionName:"getEthBalance",args:[t],data:d||"0x"})}const s=typeof n=="bigint"?Bt(n):void 0,i=await e.request({method:"eth_getBalance",params:[t,s||r]});return BigInt(i)}async function ykt(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function bkt(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?Bt(n):void 0;let i;return t?i=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):i=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]},{dedupe:!!s}),df(i)}async function uN(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?Bt(n):void 0,i=await e.request({method:"eth_getCode",params:[t,s||r]},{dedupe:!!s});if(i!=="0x")return i}async function vkt(e,{address:t,blockNumber:n,blockTag:r="latest"}){const s=await uN(e,{address:t,...n!==void 0?{blockNumber:n}:{blockTag:r}});if(s&&ts(s)===23&&s.startsWith("0xef0100"))return H4(n1(s,3,23))}class Ekt extends Ce{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function Ckt(e,t){const{address:n,factory:r,factoryData:s}=t;try{const[i,o,a,c,l,u,d]=await _t(e,eh,"readContract")({abi:$kt,address:n,functionName:"eip712Domain",factory:r,factoryData:s});return{domain:{name:o,version:a,chainId:Number(c),verifyingContract:l,salt:u},extensions:d,fields:i}}catch(i){const o=i;throw o.name==="ContractFunctionExecutionError"&&o.cause.name==="ContractFunctionZeroDataError"?new Ekt({address:n}):o}}const $kt=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];function xkt(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.olde
4491stBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function Ikt(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const i=typeof n=="bigint"?Bt(n):void 0,o=await e.request({method:"eth_feeHistory",params:[Bt(t),i||r,s]},{dedupe:!!i});return xkt(o)}async function Skt(e,{filter:t}){const n=t.strict??!1,s=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(i=>Jd(i));return t.abi?CP({abi:t.abi,logs:s,strict:n}):s}async function Akt({address:e,authorization:t,signature:n}){return Dy(H4(e),await X8e({authorization:t,signature:n}))}const sS=new pP(8192);function _kt(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(sS.get(n))return sS.get(n);const r=e().finally(()=>sS.delete(n));return sS.set(n,r),r}function Nkt(e,t={}){return async(n,r={})=>{var d;const{dedupe:s=!1,methods:i,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...r},{method:l}=n;if((d=i==null?void 0:i.exclude)!=null&&d.includes(l))throw new pm(new Error("method not supported"),{method:l});if(i!=null&&i.include&&!i.include.includes(l))throw new pm(new Error("method not supported"),{method:l});const u=s?F5(`${c}.${ks(n)}`):void 0;return _kt(()=>cN(async()=>{try{return await e(n)}catch(h){const f=h;switch(f.code){case q5.code:throw new q5(f);case W5.code:throw new W5(f);case H5.code:throw new H5(f,{method:n.method});case V5.code:throw new V5(f);case r1.code:throw new r1(f);case T0.code:throw new T0(f);case K5.code:throw new K5(f);case G5.code:throw new G5(f);case Z5.code:throw new Z5(f);case pm.code:throw new pm(f,{method:n.method});case Ry.code:throw new Ry(f);case Y5.code:throw new Y5(f);case Fw.code:throw new Fw(f);case J5.code:throw new J5(f);case X5.code:throw new X5(f);case Q5.code:throw new Q5(f);case e6.code:throw new e6(f);case t6.code:throw new t6(f);case n6.code:throw new n6(f);case r6.code:throw new r6(f);case s6.code:throw new s6(f);case i6.code:throw new i6(f);case o6.code:throw new o6(f);case a6.code:throw new a6(f);case c6.code:throw new c6(f);case 5e3:throw new Fw(f);case K4.code:throw new K4(f);default:throw h instanceof Ce?h:new K8e(f)}}},{delay:({count:h,error:f})=>{var g;if(f&&f instanceof Lm){const p=(g=f==null?void 0:f.headers)==null?void 0:g.get("Retry-After");if(p!=null&&p.match(/\d/))return Number.parseInt(p,10)*1e3}return~~(1<<h)*o},retryCount:a,shouldRetry:({error:h})=>Tkt(h)}),{enabled:s,id:u})}}function Tkt(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Ry.code||e.code===r1.code:e instanceof Lm&&e.status?e.status===403||e.status===408||e.status===4
449113||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}class Pkt extends Ce{constructor({callbackSelector:t,cause:n,data:r,extraData:s,sender:i,urls:o}){var a;super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],(a=n.metaMessages)!=null&&a.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map(c=>` ${G$(c)}`)],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${s}`].flat(),name:"OffchainLookupError"})}}class Okt extends Ce{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${G$(n)}`,`Response: ${ks(t)}`],name:"OffchainLookupResponseMalformedError"})}}class kkt extends Ce{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}const tCe="0x556f1830",OG={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function nCe(e,{blockNumber:t,blockTag:n,data:r,to:s}){const{args:i}=sG({data:r,abi:[OG]}),[o,a,c,l,u]=i,{ccipRead:d}=e,h=d&&typeof(d==null?void 0:d.request)=="function"?d.request:dN;try{if(!Dy(s,o))throw new kkt({sender:o,to:s});const f=a.includes(tx)?await H4e({data:c,ccipRequest:h}):await h({data:c,sender:o,urls:a}),{data:g}=await l3(e,{blockNumber:t,blockTag:n,data:Tu([l,V0([{type:"bytes"},{type:"bytes"}],[f,u])]),to:s});return g}catch(f){throw new Pkt({callbackSelector:l,cause:f,data:r,extraData:u,sender:o,urls:a})}}async function dN({data:e,sender:t,urls:n}){var s;let r=new Error("An unknown error occurred.");for(let i=0;i<n.length;i++){const o=n[i],a=o.includes("{data}")?"GET":"POST",c=a==="POST"?{data:e,sender:t}:void 0,l=a==="POST"?{"Content-Type":"application/json"}:{};try{const u=await fetch(o.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:l,method:a});let d;if((s=u.headers.get("Content-Type"))!=null&&s.startsWith("application/json")?d=(await u.json()).data:d=await u.text(),!u.ok){r=new Lm({body:c,details:d!=null&&d.error?ks(d.error):u.statusText,headers:u.headers,status:u.status,url:o});continue}if(!Nu(d)){r=new Okt({result:d,url:o});continue}return d}catch(u){r=new Lm({body:c,details:u.message,url:o})}}throw r}const Rkt=Object.freeze(Object.defineProperty({__proto__:null,ccipRequest:dN,offchainLookup:nCe,offchainLookupAbiItem:OG,offchainLookupSignature:tCe},Symbol.toStringTag,{value:"Module"}));function Bkt(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return s=>{const i=typeof s=="function"?s(r):s,o={...r,...i};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}function rCe(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,i)=>{(async()=>{let o;try{const a=new AbortController;n>0&&(o=setTimeout(()=>{r&&a.abort()},n)),s(await e({signal:(a==null?void 0:a.signal)||null}))}catch(a){(a==null?void 0:a.name)==="AbortError"&&i(t),i(a)}finally{clearTimeout(o)}})()})}function Dkt(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const Sce=Dkt();function Ukt(e,t={}){const{url:n,headers:r}=Lkt(e);return{async request(s){var g,p,m;const{body:i,fetchFn:o=t.fetchFn??fetch,onRequest:a=t.onRequest,onResponse:c=t.onResponse,timeout:l=t.timeout??1e4}=s,u={...t.fetchOptions??{},...s.fetchOptions??{}},{headers:d,method:h,signal:f}=u;try{const w=await rCe(async({signal:E})=>{const b={...u,body:Array.isArray(i)?ks(i.map(A=>({jsonrpc:"2.0",id:A.id??Sce.take(),...A}))):ks({jsonrpc:"2.0",id:i.id??Sce.take(),...i}),headers:{...r,"Content-Type":"application/json",...d},method:h||"POST",signal:f||(l>0?E:null)},S=new Request(n,b),v=await(a==null?void 0:a(S,b))??{...b,url:n};return await o(v.url??n,v)},{errorInstance:new kz({body:i,url:n}),timeout:l,signal:!0});c&&await c(w);let C;if((g=w.headers.get("Content-Type"))!=null&&g.startsWith("application/json"))C=await w.json();else{C=await w.text();try{C=JSON.parse(C||"{}")}
4491catch(E){if(w.ok)throw E;C={error:C}}}if(!w.ok){if(typeof((p=C.error)==null?void 0:p.code)=="number"&&typeof((m=C.error)==null?void 0:m.message)=="string")return C;throw new Lm({body:i,details:ks(C.error)||w.statusText,headers:w.headers,status:w.status,url:n})}return C}catch(w){throw w instanceof Lm||w instanceof kz?w:new Lm({body:i,cause:w,url:n})}}}}function Lkt(e){try{const t=new URL(e),n=(()=>{if(t.username){const r=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(r)}`}}}})();return{url:t.toString(),...n}}catch{return{url:e}}}const sCe=`�Ethereum Signed Message: 4492`;function iCe(e){const t=typeof e=="string"?F5(e):typeof e.raw=="string"?e.raw:Ds(e.raw),n=F5(`${sCe}${ts(t)}`);return Tu([n,t])}function kG(e,t){return Ti(iCe(e),t)}class oCe extends Ce{constructor({domain:t}){super(`Invalid domain "${ks(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class aCe extends Ce{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class cCe extends Ce{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function lCe(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(o,a)=>{for(const c of o){const{name:l,type:u}=c,d=a[l],h=u.match(_8e);if(h&&(typeof d=="number"||typeof d=="bigint")){const[p,m,w]=h;Bt(d,{signed:m==="int",size:Number.parseInt(w,10)/8})}if(u==="address"&&typeof d=="string"&&!bl(d))throw new N0({address:d});const f=u.match(yPt);if(f){const[p,m]=f;if(m&&ts(d)!==Number.parseInt(m,10))throw new h8e({expectedSize:Number.parseInt(m,10),givenSize:ts(d)})}const g=s[u];g&&(Mkt(u),i(g,d))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new oCe({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new aCe({primaryType:r,types:s})}function uCe({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Mkt(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new cCe({type:e})}function dCe(e){const{domain:t={},message:n,primaryType:r}=e,s={EIP712Domain:uCe({domain:t}),...e.types};lCe({domain:t,message:n,primaryType:r,types:s});const i=["0x1901"];return t&&i.push(hCe({domain:t,types:s})),r!=="EIP712Domain"&&i.push(RG({data:n,primaryType:r,types:s})),Ti(Tu(i))}function hCe({domain:e,types:t}){return RG({data:e,primaryType:"EIP712Domain",types:t})}function RG({data:e,primaryType:t,types:n}){const r=fCe({data:e,primaryType:t,types:n});return Ti(r)}function fCe({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],s=[jkt({primaryType:t,types:n})];for(const i of n[t]){const[o,a]=gCe({types:n,name:i.name,type:i.type,value:e[i.name]});r.push(o),s.push(a)}return V0(r,s)}function jkt({primaryType:e,types:t}){const n=_0(Fkt({primaryType:e,types:t}));return Ti(n)}function Fkt({primaryType:e,types:t}){let n="";const r=pCe({primaryType:e,types:t});r.delete(e);const s=[e,...Array.from(r).sort()];for(const i of s)n+=`${i}(${t[i].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function pCe({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),s=r==null?void 0:r[0];if(n.has(s)||t[s]===void 0)return n;n.add(s);for(const i of t[s])pCe({primaryType:i.type,types:t},n);return n}function gCe({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Ti(fCe({data:r,primaryType:n,types:e}))];if(n==="bytes")return[{type:"bytes32"},Ti(r)];if(n==="string")return[{type:"bytes32"},Ti(_0(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(o=>gCe({name:t,type:s,types:e,value:o}));return[{type:"bytes32"},Ti(V0(i.map(([o])=>o),i.map(([,o])=>o)))]}return[{type:n},r]}class zkt extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const qkt={checksum:new zkt(8192)},nU=qkt.checksum;function mCe(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=U0(yOt(e));return n==="Bytes"?r:Qd(r)}const Wkt=/^0x[a-fA-F0-9]{40}$/;function TP(e,t={}){const{strict:n=!0}=t;if(!Wkt.test(e))throw new Ace({address:e,cause:new Hkt});if(n){if(e.toLowerCase()===e)return;if(wCe(e)!==e)throw new Ace({address:e,cause:new Vkt})}}function wCe(e){if(nU.has(e))return nU.get(e);TP(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=mCe(vOt(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return nU.set(e,s),s}function Fz(e,t={}){const{strict:n=!0}=t??{};try{return TP(e,{strict:n}),!0}catch{return!1}}class Ace extends jt{constructor({address:t,cause:n}){super(`Address "${t}
4492" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Hkt extends jt{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Vkt extends jt{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const Kkt=/^(.*)\[([0-9]*)\]$/,Gkt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,yCe=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,_ce=2n**256n-1n;function o5(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=UG(t.type);if(i){const[o,a]=i;return Ykt(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:s})}if(t.type==="tuple")return eRt(e,t,{checksumAddress:r,staticPosition:s});if(t.type==="address")return Zkt(e,{checksum:r});if(t.type==="bool")return Jkt(e);if(t.type.startsWith("bytes"))return Xkt(e,t,{staticPosition:s});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Qkt(e,t);if(t.type==="string")return tRt(e,{staticPosition:s});throw new MG(t.type)}const Nce=32,zz=32;function Zkt(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(i=>n?wCe(i):i)(Qd(COt(r,-20))),32]}function Ykt(e,t,n){const{checksumAddress:r,length:s,staticPosition:i}=n;if(!s){const c=p0(e.readBytes(zz)),l=i+c,u=l+Nce;e.setPosition(l);const d=p0(e.readBytes(Nce)),h=Q4(t);let f=0;const g=[];for(let p=0;p<d;++p){e.setPosition(u+(h?p*32:f));const[m,w]=o5(e,t,{checksumAddress:r,staticPosition:u});f+=w,g.push(m)}return e.setPosition(i+32),[g,32]}if(Q4(t)){const c=p0(e.readBytes(zz)),l=i+c,u=[];for(let d=0;d<s;++d){e.setPosition(l+d*32);const[h]=o5(e,t,{checksumAddress:r,staticPosition:l});u.push(h)}return e.setPosition(i+32),[u,32]}let o=0;const a=[];for(let c=0;c<s;++c){const[l,u]=o5(e,t,{checksumAddress:r,staticPosition:i+o});o+=u,a.push(l)}return[a,o]}function Jkt(e){return[xOt(e.readBytes(32),{size:32}),32]}function Xkt(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=p0(e.readBytes(32));e.setPosition(n+o);const a=p0(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Qd(c),32]}return[Qd(e.readBytes(Number.parseInt(s,10),32)),32]}function Qkt(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?$Ot(s,{signed:n}):p0(s,{signed:n}),32]}function eRt(e,t,n){const{checksumAddress:r,staticPosition:s}=n,i=t.components.length===0||t.components.some(({name:c})=>!c),o=i?[]:{};let a=0;if(Q4(t)){const c=p0(e.readBytes(zz)),l=s+c;for(let u=0;u<t.components.length;++u){const d=t.components[u];e.setPosition(l+a);const[h,f]=o5(e,d,{checksumAddress:r,staticPosition:l});a+=f,o[i?u:d==null?void 0:d.name]=h}return e.setPosition(s+32),[o,32]}for(let c=0;c<t.components.length;++c){const l=t.components[c],[u,d]=o5(e,l,{checksumAddress:r,staticPosition:s});o[i?c:l==null?void 0:l.name]=u,a+=d}return[o,a]}function tRt(e,{staticPosition:t}){const n=p0(e.readBytes(32)),r=t+n;e.setPosition(r);const s=p0(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=IOt(I4e(i));return e.setPosition(t+32),[o,32]}function nRt({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(BG({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function BG({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=UG(r.type);if(s){const[i,o]=s;return sRt(n,{checksumAddress:e,length:i,parameter:{...r,type:o}})}if(r.type==="tuple")return lRt(n,{checksumAddress:e,parameter:r});if(r.type==="address")return rRt(n,{checksum:e});if(r.type==="bool")return oRt(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,o="256"]=yCe.exec(r.type)??[];return aRt(n,{signed:i,size:Number(o)})}if(r.type.startsWith("bytes"))return iRt(n,{type:r.type});if(r.type==="string")return cRt(n);throw new MG(r.type)}function DG(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];
vendor: 6,062 bytes, line 4492
4492o?t+=32:t+=El(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(Go(t+s,{size:32})),r.push(a),s+=El(a)):n.push(a)}return Xd(...n,...r)}function rRt(e,t){const{checksum:n=!1}=t;return TP(e,{strict:n}),{dynamic:!1,encoded:Uy(e.toLowerCase())}}function sRt(e,t){const{checksumAddress:n,length:r,parameter:s}=t,i=r===null;if(!Array.isArray(e))throw new yRt(e);if(!i&&e.length!==r)throw new wRt({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const l=BG({checksumAddress:n,parameter:s,value:e[c]});l.dynamic&&(o=!0),a.push(l)}if(i||o){const c=DG(a);if(i){const l=Go(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Xd(l,c):l}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Xd(...a.map(({encoded:c})=>c))}}function iRt(e,{type:t}){const[,n]=t.split("bytes"),r=El(e);if(!n){let s=e;return r%32!==0&&(s=Ly(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Xd(Uy(Go(r,{size:32})),s)}}if(r!==Number.parseInt(n,10))throw new vCe({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Ly(e)}}function oRt(e){if(typeof e!="boolean")throw new jt(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Uy(S4e(e))}}function aRt(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new N4e({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:Go(e,{size:32,signed:t})}}function cRt(e){const t=xG(e),n=Math.ceil(El(t)/32),r=[];for(let s=0;s<n;s++)r.push(Ly(tf(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:Xd(Ly(Go(El(t),{size:32})),...r)}}function lRt(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,l=BG({checksumAddress:n,parameter:a,value:e[c]});i.push(l),l.dynamic&&(s=!0)}return{dynamic:s,encoded:s?DG(i):Xd(...i.map(({encoded:o})=>o))}}function UG(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Q4(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Q4);const n=UG(e.type);return!!(n&&Q4({...e,type:n[1]}))}const uRt={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new fRt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new hRt({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Tce({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Tce({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function dRt(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(uRt);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class Tce extends jt{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class hRt extends jt{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class fRt extends jt{constructor({count:t,limit:n}
4492){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function pRt(e,t,n={}){const{as:r="Array",checksumAddress:s=!1}=n,i=typeof t=="string"?x4e(t):t,o=dRt(i);if(Pv(i)===0&&e.length>0)throw new mRt;if(Pv(i)&&Pv(i)<32)throw new gRt({data:typeof t=="string"?t:Qd(t),parameters:e,size:Pv(i)});let a=0;const c=r==="Array"?[]:{};for(let l=0;l<e.length;++l){const u=e[l];o.setPosition(a);const[d,h]=o5(o,u,{checksumAddress:s,staticPosition:0});a+=h,r==="Array"?c.push(d):c[u.name??l]=d}return c}function LG(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new ECe({expectedLength:e.length,givenLength:t.length});const s=nRt({checksumAddress:r,parameters:e,values:t}),i=DG(s);return i.length===0?"0x":i}function qz(e,t){if(e.length!==t.length)throw new ECe({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(qz.encode(s,i))}return Xd(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return TP(c),Uy(c.toLowerCase(),s?32:0)}if(n==="string")return xG(r);if(n==="bytes")return r;if(n==="bool")return Uy(S4e(r),s?32:1);const i=n.match(yCe);if(i){const[c,l,u="256"]=i,d=Number.parseInt(u,10)/8;return Go(r,{size:s?32:d,signed:l==="int"})}const o=n.match(Gkt);if(o){const[c,l]=o;if(Number.parseInt(l,10)!==(r.length-2)/2)throw new vCe({expectedSize:Number.parseInt(l,10),value:r});return Ly(r,s?32:0)}const a=n.match(Kkt);if(a&&Array.isArray(r)){const[c,l]=a,u=[];for(let d=0;d<r.length;d++)u.push(t(l,r[d],!0));return u.length===0?"0x":Xd(...u)}throw new MG(n)}e.encode=t})(qz||(qz={}));function bCe(e){return Array.isArray(e)&&typeof e[0]=="string"||typeof e=="string"?y0(e):e}class gRt extends jt{constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Xg(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class mRt extends jt{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class wRt extends jt{constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class vCe extends jt{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${El(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class ECe extends jt{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(` 4493`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class yRt extends jt{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class MG extends jt{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}const mc=BigInt(0),da=BigInt(1),Sw=BigInt(2),bRt=BigInt(3),CCe=BigInt(4),$Ce=BigInt(5),xCe=BigInt(8);function ic(e,t){const n=e%t;return n>=mc?n:t+n}function Kl(e,t,n){let r=e;for(;t-- >mc;)r*=r,r%=n;return r}function Wz(e,t){if(e===mc)throw new Error("invert: expected non-zero number");if(t<=mc)throw new Error("invert: expected positive modulus, got "+t);let n=ic(e,t),r=t,s=mc,i=da;for(;n!==mc;){const a=r/n,c=r%n,l=s-i*a;r=n,n=c,s=i,i=l}if(r!==da)throw new Error("invert: does not exist");return ic(s,t)}function ICe(e,t){const n=(e.ORDER+da)/CCe,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function vRt(e,t){const n=(e.ORDER-$Ce)/xCe,r=e.mul(t,Sw),s=e.pow(r,n),i=e.mul(t,s),o=e.mul(e.mul(i,Sw),s),a=e.mul(i,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function ERt(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-da,n=0;for(;t%Sw===mc;)t/=Sw,n++;let r=Sw;const s=jG(e);for(;Pce(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return ICe;let i=s.pow(r,t);const o=(t+da)/Sw;return function(c,l){if(c.is0(l))return l;if(Pce(c,l)!==1)throw new Error("Cannot find square root");let u=n,d=c.mul(c.ONE,i),h=c.pow(l,t),f=c.pow(l,o);for(;!c.eql(h,c.ONE);){if(c.is0(h))return c.ZERO;let g=1,p=c.sqr(h);for(;!c.eql(p,c.ONE);)if(g++,p=c.sqr(p),g===u)throw new Error("Cannot find square root");const m=da<<BigInt(u-g-1),w=c.pow(d,m);u=g,d=c.sqr(w),h=c.mul(h,d),f=c.mul(f,w)}return f}}
vendor: 22,396 bytes, line 4493
4493function CRt(e){return e%CCe===bRt?ICe:e%xCe===$Ce?vRt:ERt(e)}const $Rt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function xRt(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=$Rt.reduce((r,s)=>(r[s]="function",r),t);return xP(e,n)}function IRt(e,t,n){if(n<mc)throw new Error("invalid exponent, negatives unsupported");if(n===mc)return e.ONE;if(n===da)return t;let r=e.ONE,s=t;for(;n>mc;)n&da&&(r=e.mul(r,s)),s=e.sqr(s),n>>=da;return r}function SCe(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((o,a,c)=>e.is0(a)?o:(r[c]=o,e.mul(o,a)),e.ONE),i=e.inv(s);return t.reduceRight((o,a,c)=>e.is0(a)?o:(r[c]=e.mul(o,r[c]),e.mul(o,a)),i),r}function Pce(e,t){const n=(e.ORDER-da)/Sw,r=e.pow(t,n),s=e.eql(r,e.ONE),i=e.eql(r,e.ZERO),o=e.eql(r,e.neg(e.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function ACe(e,t){t!==void 0&&Mm(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function jG(e,t,n=!1,r={}){if(e<=mc)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:s,nByteLength:i}=ACe(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:s,BYTES:i,MASK:$P(s),ZERO:mc,ONE:da,create:c=>ic(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return mc<=c&&c<e},is0:c=>c===mc,isOdd:c=>(c&da)===da,neg:c=>ic(-c,e),eql:(c,l)=>c===l,sqr:c=>ic(c*c,e),add:(c,l)=>ic(c+l,e),sub:(c,l)=>ic(c-l,e),mul:(c,l)=>ic(c*l,e),pow:(c,l)=>IRt(a,c,l),div:(c,l)=>ic(c*Wz(l,e),e),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>Wz(c,e),sqrt:r.sqrt||(c=>(o||(o=CRt(e)),o(a,c))),toBytes:c=>n?b4e(c,i):J$(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?y4e(c):zw(c)},invertBatch:c=>SCe(a,c),cmov:(c,l,u)=>u?l:c});return Object.freeze(a)}function _Ce(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function NCe(e){const t=_Ce(e);return t+Math.ceil(t/2)}function SRt(e,t,n=!1){const r=e.length,s=_Ce(t),i=NCe(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=n?y4e(e):zw(e),a=ic(o,t-da)+da;return n?b4e(a,s):J$(a,s)}const Oce=BigInt(0),Hz=BigInt(1);function rU(e,t){const n=t.negate();return e?n:t}function TCe(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function sU(e,t){TCe(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,i=$P(e),o=BigInt(e);return{windows:n,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function kce(e,t,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(e&s),c=e>>o;a>r&&(a-=i,c+=Hz);const l=t*r,u=l+Math.abs(a)-1,d=a===0,h=a<0,f=t%2!==0;return{nextN:c,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:l}}function ARt(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function _Rt(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const iU=new WeakMap,PCe=new WeakMap;function oU(e){return PCe.get(e)||1}function NRt(e,t){return{constTimeNegate:rU,hasPrecomputes(n){return oU(n)!==1},unsafeLadder(n,r,s=e.ZERO){let i=n;for(;r>Oce;)r&Hz&&(s=s.add(i)),i=i.double(),r>>=Hz;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=sU(r,t),o=[];let a=n,c=a;for(let l=0;l<s;l++){c=a,o.push(c);for(let u=1;u<i;u++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=e.ZERO,o=e.BASE;const a=sU(n,t);for(let c=0;c<a.windows;c++){const{nextN:l,offset:u,isZero:d,isNeg:h,isNegF:f,offsetF:g}=kce(s,c,a);s=l,d?o=o.add(rU(f,r[g])):i=i.add(rU(h,r[u]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=e.ZERO){const o=sU(n,t);for(let a=0;a<o.windows&&s!==Oce;a++){const{nextN:c,offset:l,isZero:u,isNeg:d}=kce(s,a,o);if(s=c,!u){const h=r[l];i=i.add(d?h.negate():h)}}return i},getPrecomputes(n,r,s){let i=iU.get(r);return i||(i=this.precomputeWindow(r,n),n!==1&&iU.set(r,s(i))),i},wNAFCached(n,r,s){const i=oU(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=oU(n);return o===1?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){TCe(r,t),PCe.set(n,r),iU.delete(n)}}}function TRt(e,t,n,r){ARt(n,e),_Rt(r,t);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,a=aOt(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=$P(c),u=new Array(Number(l)+1).fill(o),d=Math.floor((t.BITS-1)/c)*c;let h=o;for(let f=d;f>=0;f-=c){u.fill(o);for(let p=0;p<i;p++){const m=r[p],w=Number(m>>BigInt(f)&l);u[w]=u[w].add(n[p])}let g=o;for(let p=u.length-1,m=o;p>0;p--)m=m.add(u[p]),g=g.add(m);if(h=h.add(g),f!==0)for(let p=0;p<c;p++)h=h.double()}return h}function OCe(e){return xRt(e.Fp),xP(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ACe(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function Rce(e){e.lowS!==void 0&&J4("lowS",e.lowS),e.prehash!==void 0&&J4("prehash",e.prehash)}function PRt(e){const t=OCe(e);xP(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=t;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}class ORt extends Error{constructor(t=""){super(t)}}const Rp={Err:ORt,_tlv:{encode:(e,t)=>{const{Err:n}=Rp;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=tS(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?tS(s.length/2|128):"";return tS(e)+i+s+t},decode(e,t){const{Err:n}=Rp;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const c=s&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const l=t.subarray(r,r+c);if(l.length!==c)throw new n("tlv.decode: length bytes not complete");if(l[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const u of l)o=o<<8|u;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Rp;if(e<Vp)throw new t("integer: negative integers are not allowed");let n=tS(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Rp;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return zw(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Rp,s=au("signature",e),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Rp,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),i=r+s;return t.encode(48,i)}};function aU(e,t){return X4(J$(e,t))}const Vp=BigInt(0),wi=BigInt(1);BigInt(2);const cU=BigInt(3),kRt=BigInt(4);function RRt(e){const t=PRt(e),{Fp:n}=t,r=jG(t.n,t.nBitLength),s=t.toBytes||((E,b,S)=>{const v=b.toAffine();return iN(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const b=E.subarray(1),S=n.fromBytes(b.subarray(0,n.BYTES)),v=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:S,y:v}});function o(E){const{a:b,b:S}=t,v=n.sqr(E),x=n.mul(v,E);return n.add(n.add(x,n.mul(E,b)),S)}function a(E,b){const S=n.sqr(b),v=o(E);return n.eql(S,v)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,cU),kRt),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(E){return $G(E,wi,t.n)}function d(E){const{allowedPrivateKeyLengths:b,nByteLength:S,wrapPrivateKey:v,n:x}=t;if(b&&typeof E!="bigint"){if(Y$(E)&&(E=X4(E)),typeof E!="string"||!b.includes(E.length))throw new Error("invalid private key");E=E.padStart(S*2,"0")}let A;try{A=typeof E=="bigint"?E:zw(au("private key",E,S))}catch{throw new Error("invalid private key, expected hex or "+S+" bytes, got "+typeof E)}return v&&(A=ic(A,x)),i5("private key",A,wi,x),A}function h(E){if(!(E instanceof p))throw new Error("ProjectivePoint expected")}const f=yce((E,b)=>{const{px:S,py:v,pz:x}=E;if(n.eql(x,n.ONE))return{x:S,y:v};const A=E.is0();b==null&&(b=A?n.ONE:n.inv(x));const I=n.mul(S,b),O=n.mul(v,b),N=n.mul(x,b);if(A)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:I,y:O}}),g=yce(E=>{if(E.is0()){if(t.allowInfinityPoint&&!n.is0(E.py))return;throw new Error("bad point: ZERO")}const{x:b,y:S}=E.toAffine();if(!n.isValid(b)||!n.isValid(S))throw new Error("bad point: x or y not FE");if(!a(b,S))throw new Error("bad point: equation left != right");if(!E.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(b,S,v){if(b==null||!n.isValid(b))throw new Error("x required");if(S==null||!n.isValid(S)||n.is0(S))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=b,this.py=S,this.pz=v,Object.freeze(this)}static fromAffine(b){const{x:S,y:v}=b||{};if(!b||!n.isValid(S)||!n.isValid(v))throw new Error("invalid affine point");if(b instanceof p)throw new Error("projective point not allowed");const x=A=>n.eql(A,n.ZERO);return x(S)&&x(v)?p.ZERO:new p(S,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const S=SCe(n,b.map(v=>v.pz));return b.map((v,x)=>v.toAffine(S[x])).map(p.fromAffine)}static fromHex(b){const S=p.fromAffine(i(au("pointHex",b)));return S.assertValidity(),S}static fromPrivateKey(b){return p.BASE.multiply(d(b))}static msm(b,S){return TRt(p,r,b,S)}_setWindowSize(b){C.setWindowSize(this,b)}assertValidity(){g(this)}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b,N=n.eql(n.mul(S,O),n.mul(A,x)),T=n.eql(n.mul(v,O),n.mul(I,x));return N&&T}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:S}=t,v=n.mul(S,cU),{px:x,py:A,pz:I}=this;let O=n.ZERO,N=n.ZERO,T=n.ZERO,P=n.mul(x,x),_=n.mul(A,A),y=n.mul(I,I),$=n.mul(x,A);return $=n.add($,$),T=n.mul(x,I),T=n.add(T,T),O=n.mul(b,T),N=n.mul(v,y),N=n.add(O,N),O=n.sub(_,N),N=n.add(_,N),N=n.mul(O,N),O=n.mul($,O),T=n.mul(v,T),y=n.mul(b,y),$=n.sub(P,y),$=n.mul(b,$),$=n.add($,T),T=n.add(P,P),P=n.add(T,P),P=n.add(P,y),P=n.mul(P,$),N=n.add(N,P),y=n.mul(A,I),y=n.add(y,y),P=n.mul(y,$),O=n.sub(O,P),T=n.mul(y,_),T=n.add(T,T),T=n.add(T,T),new p(O,N,T)}add(b){h(b);const{px:S,py:v,pz:x}=this,{px:A,py:I,pz:O}=b;let N=n.ZERO,T=n.ZERO,P=n.ZERO;const _=t.a,y=n.mul(t.b,cU);let $=n.mul(S,A),R=n.mul(v,I),B=n.mul(x,O),k=n.add(S,v),D=n.add(A,I);k=n.mul(k,D),D=n.add($,R),k=n.sub(k,D),D=n.add(S,x);let U=n.add(A,O);return D=n.mul(D,U),U=n.add($,B),D=n.sub(D,U),U=n.add(v,x),N=n.add(I,O),U=n.mul(U,N),N=n.add(R,B),U=n.sub(U,N),P=n.mul(_,D),N=n.mul(y,B),P=n.add(N,P),N=n.sub(R,P),P=n.add(R,P),T=n.mul(N,P),R=n.add($,$),R=n.add(R,$),B=n.mul(_,B),D=n.mul(y,D),R=n.add(R,B),B=n.sub($,B),B=n.mul(_,B),D=n.add(D,B),$=n.mul(R,D),T=n.add(T,$),$=n.mul(U,D),N=n.mul(k,N),N=n.sub(N,$),$=n.mul(k,R),P=n.mul(U,P),P=n.add(P,$),new p(N,T,P)}subtract(b){return this.add(b.negate())}is0(){return this.equals(p.ZERO)}wNAF(b){return C.wNAFCached(this,b,p.normalizeZ)}multiplyUnsafe(b){const{endo:S,n:v}=t;i5("scalar",b,Vp,v);const x=p.ZERO;if(b===Vp)return x;if(this.is0()||b===wi)return this;if(!S||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,b,p.normalizeZ);let{k1neg:A,k1:I,k2neg:O,k2:N}=S.splitScalar(b),T=x,P=x,_=this;for(;I>Vp||N>Vp;)I&wi&&(T=T.add(_)),N&wi&&(P=P.add(_)),_=_.double(),I>>=wi,N>>=wi;return A&&(T=T.negate()),O&&(P=P.negate()),P=new p(n.mul(P.px,S.beta),P.py,P.pz),T.add(P)}multiply(b){const{endo:S,n:v}=t;i5("scalar",b,wi,v);let x,A;if(S){const{k1neg:I,k1:O,k2neg:N,k2:T}=S.splitScalar(b);let{p:P,f:_}=this.wNAF(O),{p:y,f:$}=this.wNAF(T);P=C.constTimeNegate(I,P),y=C.constTimeNegate(N,y),y=new p(n.mul(y.px,S.beta),y.py,y.pz),x=P.add(y),A=_.add($)}else{const{p:I,f:O}=this.wNAF(b);x=I,A=O}return p.normalizeZ([x,A])[0]}multiplyAndAddUnsafe(b,S,v){const x=p.BASE,A=(O,N)=>N===Vp||N===wi||!O.equals(x)?O.multiplyUnsafe(N):O.multiply(N),I=A(this,S).add(A(b,v));return I.is0()?void 0:I}toAffine(b){return f(this,b)}isTorsionFree(){const{h:b,isTorsionFree:S}=t;if(b===wi)return!0;if(S)return S(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:S}=t;return b===wi?this:S?S(p,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return J4("isCompressed",b),this.assertValidity(),s(p,this,b)}toHex(b=!0){return J4("isCompressed",b),X4(this.toRawBytes(b))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:w}=t,C=NRt(p,m?Math.ceil(w/2):w);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:d,weierstrassEquation:o,isWithinCurveOrder:u}}function BRt(e){const t=OCe(e);return xP(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function DRt(e){const t=BRt(e),{Fp:n,n:r,nByteLength:s,nBitLength:i}=t,o=n.BYTES+1,a=2*n.BYTES+1;function c(y){return ic(y,r)}function l(y){return Wz(y,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:h,isWithinCurveOrder:f}=RRt({...t,toBytes(y,$,R){const B=$.toAffine(),k=n.toBytes(B.x),D=iN;return J4("isCompressed",R),R?D(Uint8Array.from([$.hasEvenY()?2:3]),k):D(Uint8Array.from([4]),k,n.toBytes(B.y))},fromBytes(y){const $=y.length,R=y[0],B=y.subarray(1);if($===o&&(R===2||R===3)){const k=zw(B);if(!$G(k,wi,n.ORDER))throw new Error("Point is not on curve");const D=h(k);let U;try{U=n.sqrt(D)}catch(q){const H=q instanceof Error?": "+q.message:"";throw new Error("Point is not on curve"+H)}const F=(U&wi)===wi;return(R&1)===1!==F&&(U=n.neg(U)),{x:k,y:U}}else if($===a&&R===4){const k=n.fromBytes(B.subarray(0,n.BYTES)),D=n.fromBytes(B.subarray(n.BYTES,2*n.BYTES));return{x:k,y:D}}else{const k=o,D=a;throw new Error("invalid Point, expected length of "+k+", or uncompressed "+D+", got "+$)}}});function g(y){const $=r>>wi;return y>$}function p(y){return g(y)?c(-y):y}const m=(y,$,R)=>zw(y.slice($,R));class w{constructor($,R,B){i5("r",$,wi,r),i5("s",R,wi,r),this.r=$,this.s=R,B!=null&&(this.recovery=B),Object.freeze(this)}static fromCompact($){const R=s;return $=au("compactSignature",$,R*2),new w(m($,0,R),m($,R,2*R))}static fromDER($){const{r:R,s:B}=Rp.toSig(au("DER",$));return new w(R,B)}assertValidity(){}addRecoveryBit($){return new w(this.r,this.s,$)}recoverPublicKey($){const{r:R,s:B,recovery:k}=this,D=x(au("msgHash",$));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const U=k===2||k===3?R+t.n:R;if(U>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=(k&1)===0?"02":"03",K=u.fromHex(F+aU(U,n.BYTES)),q=l(U),H=c(-D*q),Z=c(B*q),ee=u.BASE.multiplyAndAddUnsafe(K,H,Z);if(!ee)throw new Error("point at infinify");return ee.assertValidity(),ee}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return sN(this.toDERHex())}toDERHex(){return Rp.hexFromSig(this)}toCompactRawBytes(){return sN(this.toCompactHex())}toCompactHex(){const $=s;return aU(this.r,$)+aU(this.s,$)}}const C={isValidPrivateKey(y){try{return d(y),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const y=NCe(t.n);return SRt(t.randomBytes(y),t.n)},precompute(y=8,$=u.BASE){return $._setWindowSize(y),$.multiply(BigInt(3)),$}};function E(y,$=!0){return u.fromPrivateKey(y).toRawBytes($)}function b(y){if(typeof y=="bigint")return!1;if(y instanceof u)return!0;const R=au("key",y).length,B=n.BYTES,k=B+1,D=2*B+1;if(!(t.allowedPrivateKeyLengths||s===k))return R===k||R===D}function S(y,$,R=!0){if(b(y)===!0)throw new Error("first arg must be private key");if(b($)===!1)throw new Error("second arg must be public key");return u.fromHex($).multiply(d(y)).toRawBytes(R)}const v=t.bits2int||function(y){if(y.length>8192)throw new Error("input is too large");const $=zw(y),R=y.length*8-i;return R>0?$>>BigInt(R):$},x=t.bits2int_modN||function(y){return c(v(y))},A=$P(i);function I(y){return i5("num < 2^"+i,y,Vp,A),J$(y,s)}function O(y,$,R=N){if(["recovered","canonical"].some(X=>X in R))throw new Error("sign() legacy options not supported");const{hash:B,randomBytes:k}=t;let{lowS:D,prehash:U,extraEntropy:F}=R;D==null&&(D=!0),y=au("msgHash",y),Rce(R),U&&(y=au("prehashed msgHash",B(y)));const K=x(y),q=d($),H=[I(q),I(K)];if(F!=null&&F!==!1){const X=F===!0?k(n.BYTES):F;H.push(au("extraEntropy",X))}const Z=iN(...H),ee=K;function ie(X){const le=v(X);if(!f(le))return;const _e=l(le),Ne=u.BASE.multiply(le).toAffine(),be=c(Ne.x);if(be===Vp)return;const Me=c(_e*c(ee+be*q));if(Me===Vp)return;let Ct=(Ne.x===be?0:2)|Number(Ne.y&wi),Wt=Me;return D&&g(Me)&&(Wt=p(Me),Ct^=1),new w(be,Wt,Ct)}return{seed:Z,k2sig:ie}}const N={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(y,$,R=N){const{seed:B,k2sig:k}=O(y,$,R),D=t;return cOt(D.hash.outputLen,D.nByteLength,D.hmac)(B,k)}u.BASE._setWindowSize(8);function _(y,$,R,B=T){var Ct;const k=y;$=au("msgHash",$),R=au("publicKey",R);const{lowS:D,prehash:U,format:F}=B;if(Rce(B),"strict"in B)throw new Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw new Error("format must be compact or der");const K=typeof k=="string"||Y$(k),q=!K&&!F&&typeof k=="object"&&k!==null&&typeof k.r=="bigint"&&typeof k.s=="bigint";if(!K&&!q)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let H,Z;try{if(q&&(H=new w(k.r,k.s)),K){try{F!=="compact"&&(H=w.fromDER(k))}catch(Wt){if(!(Wt instanceof Rp.Err))throw Wt}!H&&F!=="der"&&(H=w.fromCompact(k))}Z=u.fromHex(R)}catch{return!1}if(!H||D&&H.hasHighS())return!1;U&&($=t.hash($));const{r:ee,s:ie}=H,X=x($),le=l(ie),_e=c(X*le),Ne=c(ee*le),be=(Ct=u.BASE.multiplyAndAddUnsafe(Z,_e,Ne))==null?void 0:Ct.toAffine();return be?c(be.x)===ee:!1}return{CURVE:t,getPublicKey:E,getSharedSecret:S,sign:P,verify:_,ProjectivePoint:u,Signature:w,utils:C}}function URt(e){return{hash:e,hmac:(t,...n)=>m6(e,t,w6(...n)),randomBytes:g6}}function LRt(e,t){const n=r=>DRt({...e,...URt(r)});return{...n(t),create:n}}const kCe=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Bce=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),MRt=BigInt(0),jRt=BigInt(1),Vz=BigInt(2),Dce=(e,t)=>(e+t/Vz)/t;function FRt(e){const t=kCe,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Kl(u,n,t)*u%t,h=Kl(d,n,t)*u%t,f=Kl(h,Vz,t)*l%t,g=Kl(f,s,t)*f%t,p=Kl(g,i,t)*g%t,m=Kl(p,a,t)*p%t,w=Kl(m,c,t)*m%t,C=Kl(w,a,t)*p%t,E=Kl(C,n,t)*u%t,b=Kl(E,o,t)*g%t,S=Kl(b,r,t)*l%t,v=Kl(S,Vz,t);if(!Kz.eql(Kz.sqr(v),e))throw new Error("Cannot find square root");return v}const Kz=jG(kCe,void 0,void 0,{sqrt:FRt}),RCe=LRt({a:MRt,b:BigInt(7),Fp:Kz,n:Bce,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Bce,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-jRt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=Dce(i*e,t),c=Dce(-r*e,t);let l=ic(e-a*n-c*s,t),u=ic(-a*r-c*i,t);const d=l>o,h=u>o;if(d&&(l=t-l),h&&(u=t-u),l>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:h,k2:u}}}},y6),zRt=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:RCe},Symbol.toStringTag,{value:"Module"}));function BCe(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new lU({signature:e});if(typeof e.s>"u")throw new lU({signature:e});if(n&&typeof e.yParity>"u")throw new lU({signature:e});if(e.r<0n||e.r>_ce)throw new ZRt({value:e.r});if(e.s<0n||e.s>_ce)throw new YRt({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new zG({value:e.yParity})}function qRt(e){return DCe(Qd(e))}function DCe(e){if(e.length!==130&&e.length!==132)throw new GRt({signature:e});const t=BigInt(tf(e,0,32)),n=BigInt(tf(e,32,64)),r=(()=>{const s=+`0x${e.slice(130)}`;if(!Number.isNaN(s))try{return FG(s)}catch{throw new zG({value:s})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function WRt(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return HRt(e)}function HRt(e){const t=typeof e=="string"?DCe(e):e instanceof Uint8Array?qRt(e):typeof e.r=="string"?KRt(e):e.v?VRt(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return BCe(t),t}function VRt(e){return{r:e.r,s:e.s,yParity:FG(e.v)}}function KRt(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=FG(n)),typeof r!="number")throw new zG({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function FG(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new JRt({value:e})}class GRt extends jt{constructor({signature:t}){super(`Value \`${t}
4493\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${El(kOt(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class lU extends jt{constructor({signature:t}){super(`Signature \`${$4e(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class ZRt extends jt{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class YRt extends jt{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class zG extends jt{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class JRt extends jt{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function XRt(e,t={}){return typeof e.chainId=="string"?QRt(e):{...e,...t.signature}}function QRt(e){const{address:t,chainId:n,nonce:r}=e,s=WRt(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...s}}const eBt="0x8010801080108010801080108010801080108010801080108010801080108010",tBt=bCe("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function UCe(e){if(typeof e=="string"){if(tf(e,-32)!==eBt)throw new sBt(e)}else BCe(e.authorization)}function nBt(e){UCe(e);const t=_4e(tf(e,-64,-32)),n=tf(e,-t-64,-64),r=tf(e,0,-t-64),[s,i,o]=pRt(tBt,n);return{authorization:XRt({address:s.delegation,chainId:Number(s.chainId),nonce:s.nonce,yParity:s.yParity,r:s.r,s:s.s}),signature:r,...o&&o!=="0x"?{data:o,to:i}:{}}}function rBt(e){try{return UCe(e),!0}catch{return!1}}let sBt=class extends jt{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};function iBt(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function oBt(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?df(e.nonce):void 0,storageProof:e.storageProof?iBt(e.storageProof):void 0}}async function aBt(e,{address:t,blockNumber:n,blockTag:r,storageKeys:s}){const i=r??"latest",o=n!==void 0?Bt(n):void 0,a=await e.request({method:"eth_getProof",params:[t,s,o||i]});return oBt(a)}async function cBt(e,{address:t,blockNumber:n,blockTag:r="latest",slot:s}){const i=n!==void 0?Bt(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,s,i||r]})}async function qG(e,{blockHash:t,blockNumber:n,blockTag:r,hash:s,index:i,sender:o,nonce:a}){var h,f,g;const c=r||"latest",l=n!==void 0?Bt(n):void 0;let u=null;if(s?u=await e.request({method:"eth_getTransactionByHash",params:[s]},{dedupe:!0}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Bt(i)]},{dedupe:!0}):typeof i=="number"?u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[l||c,Bt(i)]},{dedupe:!!l}):o&&typeof a=="number"&&(u=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[o,Bt(a)]},{dedupe:!0})),!u)throw new iG({blockHash:t,blockNumber:n,blockTag:c,hash:s,index:i});return(((g=(f=(h=e.chain)==null?void 0:h.formatters)==null?void 0:f.transaction)==null?void 0:g.format)||EP)(u,"getTransaction")}async function lBt(e,{hash:t,transactionReceipt:n}){const[r,s]=await Promise.all([_t(e,ex,"getBlockNumber")({}),t?_t(e,qG,"getTransaction")({hash:t}):void 0]),i=(n==null?void 0:n.blockNumber)||(s==null?void 0:s.blockNumber);return i?r-i+1n:0n}async function WS(e,{hash:t}){var s,i,o;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new oG({hash:t});return(((o=(i=(s=e.chain)==null?void 0:s.formatters)==null?void 0:i.transactionReceipt)==null?void 0:o.format)||_G)(n,"getTransactionReceipt")}
4493async function uBt(e,t){var C;const{account:n,authorizationList:r,allowFailure:s=!0,blockNumber:i,blockOverrides:o,blockTag:a,stateOverride:c}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:d=t.deployless??!1}=typeof((C=e.batch)==null?void 0:C.multicall)=="object"?e.batch.multicall:{},h=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return Rb({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),f=[[]];let g=0,p=0;for(let E=0;E<l.length;E++){const{abi:b,address:S,args:v,functionName:x}=l[E];try{const A=Nl({abi:b,args:v,functionName:x});p+=(A.length-2)/2,u>0&&p>u&&f[g].length>0&&(g++,p=(A.length-2)/2,f[g]=[]),f[g]=[...f[g],{allowFailure:!0,callData:A,target:S}]}catch(A){const I=By(A,{abi:b,address:S,args:v,docsPath:"/docs/contract/multicall",functionName:x,sender:n});if(!s)throw I;f[g]=[...f[g],{allowFailure:!0,callData:"0x",target:S}]}}const m=await Promise.allSettled(f.map(E=>_t(e,eh,"readContract")({...h===null?{code:SG}:{address:h},abi:My,account:n,args:[E],authorizationList:r,blockNumber:i,blockOverrides:o,blockTag:a,functionName:"aggregate3",stateOverride:c}))),w=[];for(let E=0;E<m.length;E++){const b=m[E];if(b.status==="rejected"){if(!s)throw b.reason;for(let v=0;v<f[E].length;v++)w.push({status:"failure",error:b.reason,result:void 0});continue}const S=b.value;for(let v=0;v<S.length;v++){const{returnData:x,success:A}=S[v],{callData:I}=f[E][v],{abi:O,address:N,functionName:T,args:P}=l[w.length];try{if(I==="0x")throw new s3;if(!A)throw new Z$({data:x});const _=K0({abi:O,args:P,data:x,functionName:T});w.push(s?{result:_,status:"success"}:_)}catch(_){const y=By(_,{abi:O,address:N,args:P,docsPath:"/docs/contract/multicall",functionName:T});if(!s)throw y;w.push({error:y,result:void 0,status:"failure"})}}}if(w.length!==l.length)throw new Ce("multicall results mismatch");return w}async function Gz(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:s,returnFullTransactions:i,traceTransfers:o,validation:a}=t;try{const c=[];for(const h of s){const f=h.blockOverrides?P4e(h.blockOverrides):void 0,g=h.calls.map(m=>{const w=m,C=w.account?vl(w.account):void 0,E=w.abi?Nl(w):w.data,b={...w,account:C,data:w.dataSuffix?Tu([E||"0x",w.dataSuffix]):E,from:w.from??(C==null?void 0:C.address)};return kb(b),c3(b)}),p=h.stateOverrides?lG(h.stateOverrides):void 0;c.push({blockOverrides:f,calls:g,stateOverrides:p})}const u=(typeof n=="bigint"?Bt(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:i,traceTransfers:o,validation:a},u]})).map((h,f)=>({...fG(h),calls:h.calls.map((g,p)=>{var O,N;const{abi:m,args:w,functionName:C,to:E}=s[f].calls[p],b=((O=g.error)==null?void 0:O.data)??g.returnData,S=BigInt(g.gasUsed),v=(N=g.logs)==null?void 0:N.map(T=>Jd(T)),x=g.status==="0x1"?"success":"failure",A=m&&x==="success"&&b!=="0x"?K0({abi:m,data:b,functionName:C}):null,I=(()=>{if(x==="success")return;let T;if(b==="0x"?T=new s3:b&&(T=new Z$({data:b})),!!T)return By(T,{abi:m??[],address:E??"0x",args:w,functionName:C??"<unknown>"})})();return{data:b,gasUsed:S,logs:v,status:x,...x==="success"?{result:A}:{error:I}}})}))}catch(c){const l=c,u=yP(l,{});throw u instanceof a3?l:u}}function Zz(e){let t=!0,n="",r=0,s="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new jt("Unable to normalize signature.");return s}function Yz(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Fz(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((s,i)=>Yz(Object.values(e)[i],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="str
4493ing"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(s=>Yz(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function LCe(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return LCe(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Fz(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?Fz(n[r],{strict:!1}):!1)return o}}function MCe(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?w0(e):e;return{...r,...n?{hash:Ov(r)}:{}}}function PP(e,t,n){const{args:r=[],prepare:s=!0}=n??{},i=ROt(t,{strict:!1}),o=e.filter(l=>i?l.type==="function"||l.type==="error"?jCe(l)===tf(t,0,4):l.type==="event"?Ov(l)===t:!1:"name"in l&&l.name===t);if(o.length===0)throw new hN({name:t});if(o.length===1)return{...o[0],...s?{hash:Ov(o[0])}:{}};let a;for(const l of o){if(!("inputs"in l))continue;if(!r||r.length===0){if(!l.inputs||l.inputs.length===0)return{...l,...s?{hash:Ov(l)}:{}};continue}if(!l.inputs||l.inputs.length===0||l.inputs.length!==r.length)continue;if(r.every((d,h)=>{const f="inputs"in l&&l.inputs[h];return f?Yz(d,f):!1})){if(a&&"inputs"in a&&a.inputs){const d=LCe(l.inputs,a.inputs,r);if(d)throw new hBt({abiItem:l,type:d[0]},{abiItem:a,type:d[1]})}a=l}}const c=(()=>{if(a)return a;const[l,...u]=o;return{...l,overloads:u}})();if(!c)throw new hN({name:t});return{...c,...s?{hash:Ov(c)}:{}}}function jCe(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return PP(n,r)}return e[0]})();return tf(Ov(t),0,4)}function dBt(...e){const t=(()=>{if(Array.isArray(e[0])){const[r,s]=e;return PP(r,s)}return e[0]})(),n=typeof t=="string"?t:vu(t);return Zz(n)}function Ov(...e){const t=(()=>{if(Array.isArray(e[0])){const[n,r]=e;return PP(n,r)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:mCe(xG(dBt(t)))}class hBt extends jt{constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Zz(vu(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Zz(vu(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class hN extends jt{constructor({name:t,data:n,type:r="item"}){const s=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${s} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function fBt(...e){var i;const[t,n]=(()=>{if(Array.isArray(e[0])){const[o,a]=e;return[gBt(o),a]}return e})(),{bytecode:r,args:s}=n;return Xd(r,(i=t.inputs)!=null&&i.length&&(s!=null&&s.length)?LG(t.inputs,s):"0x")}function pBt(e){return MCe(e)}function gBt(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new hN({name:"constructor"});return t}function mBt(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[l,u,d]=e;return[Uce(l,u,{args:d}),d]}const[a,c]=e;return[a,c]})(),{overloads:r}=t,s=r?Uce([t,...r],t.name,{args:n}):t,i=wBt(s),o=n.length>0?LG(s.inputs,n):void 0;return o?Xd(i,o):i}function K2(e,t={}){return MCe(e,t)}function Uce(e,t,n){const r=PP(e,t,n);if(r.type!=="function")throw new hN({name:t,type:"function"});return r}function wBt(e){return jCe(e)}const FCe="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",Jl="0x0000000000000000000000000000000000000000",yBt="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";async function bBt(e,t){const{blockNumber:n,blockTag:r,calls:s,stateOverrides:i,traceAssetChanges:o,traceTransfers:a,validation:c}=t,l=t.account?vl(t.account):void 0;if(o&&!l)throw new Ce("`account` is required when `traceAssetChanges` is true");const u=l?fBt(pBt("constructor(bytes, bytes)"),{bytecode:IG,args:[yBt,mBt(K2("function getBalance(address)"),[l.address])]}):void 0,d=o?await Promise.all(t.calls.map(async B=>{if(!B.data&&!B.abi)return;const{accessList:k}=await X4e(e,{account:l.address,...B,data:B.abi?Nl(B):B.data});return k.map(({address:D,storageKeys:U})=>U.length>0?D:null)})).then(B=>
4493B.flat().filter(Boolean)):[],h=await Gz(e,{blockNumber:n,blockTag:r,blocks:[...o?[{calls:[{data:u}],stateOverrides:i},{calls:d.map((B,k)=>({abi:[K2("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:B,from:Jl,nonce:k})),stateOverrides:[{address:Jl,nonce:0}]}]:[],{calls:[...s,{to:Jl}].map(B=>({...B,from:l==null?void 0:l.address})),stateOverrides:i},...o?[{calls:[{data:u}]},{calls:d.map((B,k)=>({abi:[K2("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:B,from:Jl,nonce:k})),stateOverrides:[{address:Jl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[K2("function decimals() returns (uint256)")],functionName:"decimals",from:Jl,nonce:k})),stateOverrides:[{address:Jl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[K2("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:Jl,nonce:k})),stateOverrides:[{address:Jl,nonce:0}]},{calls:d.map((B,k)=>({to:B,abi:[K2("function symbol() returns (string)")],functionName:"symbol",from:Jl,nonce:k})),stateOverrides:[{address:Jl,nonce:0}]}]:[]],traceTransfers:a,validation:c}),f=o?h[2]:h[0],[g,p,,m,w,C,E,b]=o?h:[],{calls:S,...v}=f,x=S.slice(0,-1)??[],A=(g==null?void 0:g.calls)??[],I=(p==null?void 0:p.calls)??[],O=[...A,...I].map(B=>B.status==="success"?Zd(B.data):null),N=(m==null?void 0:m.calls)??[],T=(w==null?void 0:w.calls)??[],P=[...N,...T].map(B=>B.status==="success"?Zd(B.data):null),_=((C==null?void 0:C.calls)??[]).map(B=>B.status==="success"?B.result:null),y=((b==null?void 0:b.calls)??[]).map(B=>B.status==="success"?B.result:null),$=((E==null?void 0:E.calls)??[]).map(B=>B.status==="success"?B.result:null),R=[];for(const[B,k]of P.entries()){const D=O[B];if(typeof k!="bigint"||typeof D!="bigint")continue;const U=_[B-1],F=y[B-1],K=$[B-1],q=B===0?{address:FCe,decimals:18,symbol:"ETH"}:{address:d[B-1],decimals:K||U?Number(U??1):void 0,symbol:F??void 0};R.some(H=>H.token.address===q.address)||R.push({token:q,value:{pre:D,post:k,diff:k-D}})}return{assetChanges:R,block:v,results:x}}const zCe="0x6492649264926492649264926492649264926492649264926492649264926492";function vBt(e){if(tf(e,-32)!==zCe)throw new $Bt(e)}function EBt(e){const{data:t,signature:n,to:r}=e;return Xd(LG(bCe("address, bytes, bytes"),[r,t,n]),zCe)}function CBt(e){try{return vBt(e),!0}catch{return!1}}class $Bt extends jt{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function Jz({r:e,s:t,to:n="hex",v:r,yParity:s}){const i=(()=>{if(s===0||s===1)return s;if(r&&(r===27n||r===28n||r>=35n))return r%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),o=`0x${new RCe.Signature(Zd(e),Zd(t)).toCompactHex()}${i===0?"1b":"1c"}`;return n==="hex"?o:Yd(o)}async function OP(e,t){var l,u,d,h;const{address:n,chain:r=e.chain,hash:s,erc6492VerifierAddress:i=t.universalSignatureVerifierAddress??((u=(l=r==null?void 0:r.contracts)==null?void 0:l.erc6492Verifier)==null?void 0:u.address),multicallAddress:o=t.multicallAddress??((h=(d=r==null?void 0:r.contracts)==null?void 0:d.multicall3)==null?void 0:h.address),mode:a="auto"}=t;if(r!=null&&r.verifyHash)return await r.verifyHash(e,t);const c=(()=>{const f=t.signature;return Nu(f)?f:typeof f=="object"&&"r"in f&&"s"in f?Jz(f):Ds(f)})();try{if(a==="eoa")try{if(Dy(H4(n),await Z_({hash:s,signature:c})))return!0}catch{}return rBt(c)?await xBt(e,{...t,multicallAddress:o,signature:c}):await IBt(e,{...t,verifierAddress:i,signature:c})}catch(f){if(a!=="eoa")try{if(Dy(H4(n),await Z_({hash:s,signature:c})))return!0}catch{}if(f instanceof jy)return!1;throw f}}async function xBt(e,t){var m;const{address:n,blockNumber:r,blockTag:s,hash:i,multicallAddress:o}=t,{authorization:a,data:c,signature:l,to:u}=nBt(t.signature);if(await uN(e,{address:n,blockNumber:r,blockTag:s})===Ob(["0xef0100",a.address]))return await SBt(e,{address:n,blockNumber:r,blockTag:s,hash:i,signature:l});const h={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:Bt(a.r,{size:32}),s:Bt(a.s,{size:32}),yParity:a.yParity};if(!await Akt({address:n,authorization:h}
4493))throw new jy;const g=await _t(e,eh,"readContract")({...o?{address:o}:{code:SG},authorizationList:[h],abi:My,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:u??n,callData:c}]:[],{allowFailure:!0,target:n,callData:Nl({abi:R4e,functionName:"isValidSignature",args:[i,l]})}]]}),p=(m=g[g.length-1])==null?void 0:m.returnData;if(p!=null&&p.startsWith("0x1626ba7e"))return!0;throw new jy}async function IBt(e,t){const{address:n,factory:r,factoryData:s,hash:i,signature:o,verifierAddress:a,...c}=t,l=await(async()=>!r&&!s||CBt(o)?o:EBt({data:s,signature:o,to:r}))(),u=a?{to:a,data:Nl({abi:oN,functionName:"isValidSig",args:[n,i,l]}),...c}:{data:SP({abi:oN,args:[n,i,l],bytecode:Uz}),...c},{data:d}=await _t(e,l3,"call")(u).catch(h=>{throw h instanceof aG?new jy:h});if(E8e(d??"0x0"))return!0;throw new jy}async function SBt(e,t){const{address:n,blockNumber:r,blockTag:s,hash:i,signature:o}=t;if((await _t(e,eh,"readContract")({address:n,abi:R4e,args:[i,o],blockNumber:r,blockTag:s,functionName:"isValidSignature"}).catch(c=>{throw c instanceof cG?new jy:c})).startsWith("0x1626ba7e"))return!0;throw new jy}class jy extends Error{}async function ABt(e,{address:t,message:n,factory:r,factoryData:s,signature:i,...o}){const a=kG(n);return _t(e,OP,"verifyHash")({address:t,factory:r,factoryData:s,hash:a,signature:i,...o})}async function _Bt(e,t){const{address:n,factory:r,factoryData:s,signature:i,message:o,primaryType:a,types:c,domain:l,...u}=t,d=dCe({message:o,primaryType:a,types:c,domain:l});return _t(e,OP,"verifyHash")({address:n,factory:r,factoryData:s,hash:d,signature:i,...u})}function qCe(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:s,poll:i,pollingInterval:o=e.pollingInterval}){const a=typeof i<"u"?i:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
4493onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc"));let c;return a?(()=>{const d=ks(["watchBlockNumber",e.uid,t,n,o]);return s1(d,{onBlockNumber:r,onError:s},h=>Q$(async()=>{var f;try{const g=await _t(e,ex,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(g===c)return;if(g-c>1&&n)for(let p=c+1n;p<g;p++)h.onBlockNumber(p,c),c=p}(c===void 0||g>c)&&(h.onBlockNumber(g,c),c=g)}catch(g){(f=h.onError)==null||f.call(h,g)}},{emitOnBegin:t,interval:o}))})():(()=>{const d=ks(["watchBlockNumber",e.uid,t,n]);return s1(d,{onBlockNumber:r,onError:s},h=>{let f=!0,g=()=>f=!1;return(async()=>{try{const p=(()=>{if(e.transport.type==="fallback"){const w=e.transport.transports.find(C=>C.config.type==="webSocket"||C.config.type==="ipc");return w?w.value:e.transport}return e.transport})(),{unsubscribe:m}=await p.subscribe({params:["newHeads"],onData(w){var E;if(!f)return;const C=Zd((E=w.result)==null?void 0:E.number);h.onBlockNumber(C,c),c=C},onError(w){var C;(C=h.onError)==null||C.call(h,w)}});g=m,f||g()}catch(p){s==null||s(p)}})(),()=>g()})})()}async function NBt(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:s,onReplaced:i,retryCount:o=6,retryDelay:a=({count:S})=>~~(1<<S)*200,timeout:c=18e4}=t,l=ks(["waitForTransactionReceipt",e.uid,s]),u=(()=>{var S;return t.pollingInterval?t.pollingInterval:(S=e.chain)!=null&&S.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval})();let d,h,f,g=!1,p,m;const{promise:w,resolve:C,reject:E}=U4e(),b=c?setTimeout(()=>{m==null||m(),p==null||p(),E(new W8e({hash:s}))},c):void 0;return p=s1(l,{onReplaced:i,resolve:C,reject:E},async S=>{if(f=await _t(e,WS,"getTransactionReceipt")({hash:s}).catch(()=>{}),f&&r<=1){clearTimeout(b),S.resolve(f),p==null||p();return}m=_t(e,qCe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(v){const x=I=>{clearTimeout(b),m==null||m(),I(),p==null||p()};let A=v;if(!g)try{if(f){if(r>1&&(!f.blockNumber||A-f.blockNumber+1n<r))return;x(()=>S.resolve(f));return}if(n&&!d&&(g=!0,await cN(async()=>{d=await _t(e,qG,"getTransaction")({hash:s}),d.blockNumber&&(A=d.blockNumber)},{delay:a,retryCount:o}),g=!1),f=await _t(e,WS,"getTransactionReceipt")({hash:s}),r>1&&(!f.blockNumber||A-f.blockNumber+1n<r))return;x(()=>S.resolve(f))}catch(I){if(I instanceof iG||I instanceof oG){if(!d){g=!1;return}try{h=d,g=!0;const O=await cN(()=>_t(e,Ad,"getBlock")({blockNumber:A,includeTransactions:!0}),{delay:a,retryCount:o,shouldRetry:({error:P})=>P instanceof dG});g=!1;const N=O.transactions.find(({from:P,nonce:_})=>P===h.from&&_===h.nonce);if(!N||(f=await _t(e,WS,"getTransactionReceipt")({hash:N.hash}),r>1&&(!f.blockNumber||A-f.blockNumber+1n<r)))return;let T="replaced";N.to===h.to&&N.value===h.value&&N.input===h.input?T="repriced":N.from===N.to&&N.value===0n&&(T="cancelled"),x(()=>{var P;(P=S.onReplaced)==null||P.call(S,{reason:T,replacedTransaction:h,transaction:N,transactionReceipt:f}),S.resolve(f)})}catch(O){x(()=>S.reject(O))}}else x(()=>S.reject(I))}}})}),w}function TBt(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:i,includeTransactions:o,poll:a,pollingInterval:c=e.pollingInterval}){const l=typeof a<"u"?a:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
4493onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),u=o??!1;let d;return l?(()=>{const g=ks(["watchBlocks",e.uid,t,n,r,u,c]);return s1(g,{onBlock:s,onError:i},p=>Q$(async()=>{var m;try{const w=await _t(e,Ad,"getBlock")({blockTag:t,includeTransactions:u});if(w.number!==null&&(d==null?void 0:d.number)!=null){if(w.number===d.number)return;if(w.number-d.number>1&&n)for(let C=(d==null?void 0:d.number)+1n;C<w.number;C++){const E=await _t(e,Ad,"getBlock")({blockNumber:C,includeTransactions:u});p.onBlock(E,d),d=E}}((d==null?void 0:d.number)==null||t==="pending"&&(w==null?void 0:w.number)==null||w.number!==null&&w.number>d.number)&&(p.onBlock(w,d),d=w)}catch(w){(m=p.onError)==null||m.call(p,w)}},{emitOnBegin:r,interval:c}))})():(()=>{let g=!0,p=!0,m=()=>g=!1;return(async()=>{try{r&&_t(e,Ad,"getBlock")({blockTag:t,includeTransactions:u}).then(E=>{g&&p&&(s(E,void 0),p=!1)}).catch(i);const w=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return E?E.value:e.transport}return e.transport})(),{unsubscribe:C}=await w.subscribe({params:["newHeads"],async onData(E){var S;if(!g)return;const b=await _t(e,Ad,"getBlock")({blockNumber:(S=E.result)==null?void 0:S.number,includeTransactions:u}).catch(()=>{});g&&(s(b,d),p=!1,d=b)},onError(E){i==null||i(E)}});m=C,g||m()}catch(w){i==null||i(w)}})(),()=>m()})()}function PBt(e,{address:t,args:n,batch:r=!0,event:s,events:i,fromBlock:o,onError:a,onLogs:c,poll:l,pollingInterval:u=e.pollingInterval,strict:d}){const h=typeof l<"u"?l:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].c
4493onfig.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=d??!1;return h?(()=>{const m=ks(["watchEvent",t,n,r,e.uid,s,u,o]);return s1(m,{onLogs:c,onError:a},w=>{let C;o!==void 0&&(C=o-1n);let E,b=!1;const S=Q$(async()=>{var v;if(!b){try{E=await _t(e,Q4e,"createEventFilter")({address:t,args:n,event:s,events:i,strict:f,fromBlock:o})}catch{}b=!0;return}try{let x;if(E)x=await _t(e,AP,"getFilterChanges")({filter:E});else{const A=await _t(e,ex,"getBlockNumber")({});C&&C!==A?x=await _t(e,vG,"getLogs")({address:t,args:n,event:s,events:i,fromBlock:C+1n,toBlock:A}):x=[],C=A}if(x.length===0)return;if(r)w.onLogs(x);else for(const A of x)w.onLogs([A])}catch(x){E&&x instanceof T0&&(b=!1),(v=w.onError)==null||v.call(w,x)}},{emitOnBegin:!0,interval:u});return async()=>{E&&await _t(e,_P,"uninstallFilter")({filter:E}),S()}})})():(()=>{let m=!0,w=()=>m=!1;return(async()=>{try{const C=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(x=>x.config.type==="webSocket"||x.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),E=i??(s?[s]:void 0);let b=[];E&&(b=[E.flatMap(x=>i3({abi:[x],eventName:x.name,args:n}))],s&&(b=b[0]));const{unsubscribe:S}=await C.subscribe({params:["logs",{address:t,topics:b}],onData(v){var A;if(!m)return;const x=v.result;try{const{eventName:I,args:O}=Y4({abi:E??[],data:x.data,topics:x.topics,strict:f}),N=Jd(x,{args:O,eventName:I});c([N])}catch(I){let O,N;if(I instanceof W4||I instanceof hP){if(d)return;O=I.abiItem.name,N=(A=I.abiItem.inputs)==null?void 0:A.some(P=>!("name"in P&&P.name))}const T=Jd(x,{args:N?[]:{},eventName:O});c([T])}},onError(v){a==null||a(v)}});w=S,m||w()}catch(C){a==null||a(C)}})(),()=>w()})()}function OBt(e,{batch:t=!0,onError:n,onTransactions:r,poll:s,pollingInterval:i=e.pollingInterval}){return(typeof s<"u"?s:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{const l=ks(["watchPendingTransactions",e.uid,t,i]);return s1(l,{onTransactions:r,onError:n},u=>{let d;const h=Q$(async()=>{var f;try{if(!d)try{d=await _t(e,eCe,"createPendingTransactionFilter")({});return}catch(p){throw h(),p}const g=await _t(e,AP,"getFilterChanges")({filter:d});if(g.length===0)return;if(t)u.onTransactions(g);else for(const p of g)u.onTransactions([p])}catch(g){(f=u.onError)==null||f.call(u,g)}},{emitOnBegin:!0,interval:i});return async()=>{d&&await _t(e,_P,"uninstallFilter")({filter:d}),h()}})})():(()=>{let l=!0,u=()=>l=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(h){if(!l)return;const f=h.result;r([f])},onError(h){n==null||n(h)}});u=d,l||u()}catch(d){n==null||n(d)}})(),()=>u()})()}function kBt(e){var d,h,f;const{scheme:t,statement:n,...r}=((d=e.match(RBt))==null?void 0:d.groups)??{},{chainId:s,expirationTime:i,issuedAt:o,notBefore:a,requestId:c,...l}=((h=e.match(BBt))==null?void 0:h.groups)??{},u=(f=e.split("Resources:")[1])==null?void 0:f.split(` 4494- `).slice(1);return{...r,...l,...s?{chainId:Number(s)}:{},...i?{expirationTime:new Date(i)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const RBt=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,BBt=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function DBt(e){const{address:t,domain:n,message:r,nonce:s,scheme:i,time:o=new Date}=e;if(n&&r.domain!==n||s&&r.nonce!==s||i&&r.scheme!==i||r.expirationTime&&o>=r.expirationTime||r.notBefore&&o<r.notBefore)return!1;try{if(!r.address||!bl(r.address,{strict:!1})||t&&!Dy(r.address,t))return!1}catch{return!1}return!0}async function UBt(e,t){const{address:n,domain:r,message:s,nonce:i,scheme:o,signature:a,time:c=new Date,...l}=t,u=kBt(s);
4494if(!u.address||!DBt({address:n,domain:r,message:u,nonce:i,scheme:o,time:c}))return!1;const h=kG(s);return OP(e,{address:u.address,hash:h,signature:a,...l})}async function LBt(e,{serializedTransaction:t,throwOnReceiptRevert:n,timeout:r}){var a,c,l;const s=await e.request({method:"eth_sendRawTransactionSync",params:r?[t,r]:[t]},{retryCount:0}),o=(((l=(c=(a=e.chain)==null?void 0:a.formatters)==null?void 0:c.transactionReceipt)==null?void 0:l.format)||_G)(s);if(o.status==="reverted"&&n)throw new MPt({receipt:o});return o}function WCe(e){return{call:t=>l3(e,t),createAccessList:t=>X4e(e,t),createBlockFilter:()=>mkt(e),createContractEventFilter:t=>T8e(e,t),createEventFilter:t=>Q4e(e,t),createPendingTransactionFilter:()=>eCe(e),estimateContractGas:t=>rOt(e,t),estimateGas:t=>bG(e,t),getBalance:t=>wkt(e,t),getBlobBaseFee:()=>ykt(e),getBlock:t=>Ad(e,t),getBlockNumber:t=>ex(e,t),getBlockTransactionCount:t=>bkt(e,t),getBytecode:t=>uN(e,t),getChainId:()=>yG(e),getCode:t=>uN(e,t),getContractEvents:t=>g4e(e,t),getDelegation:t=>vkt(e,t),getEip712Domain:t=>Ckt(e,t),getEnsAddress:t=>tkt(e,t),getEnsAvatar:t=>fkt(e,t),getEnsName:t=>pkt(e,t),getEnsResolver:t=>gkt(e,t),getEnsText:t=>J4e(e,t),getFeeHistory:t=>Ikt(e,t),estimateFeesPerGas:t=>XPt(e,t),getFilterChanges:t=>AP(e,t),getFilterLogs:t=>Skt(e,t),getGasPrice:()=>pG(e),getLogs:t=>vG(e,t),getProof:t=>aBt(e,t),estimateMaxPriorityFeePerGas:t=>JPt(e,t),fillTransaction:t=>f4e(e,t),getStorageAt:t=>cBt(e,t),getTransaction:t=>qG(e,t),getTransactionConfirmations:t=>lBt(e,t),getTransactionCount:t=>s4e(e,t),getTransactionReceipt:t=>WS(e,t),multicall:t=>uBt(e,t),prepareTransactionRequest:t=>p4e(e,t),readContract:t=>eh(e,t),sendRawTransaction:t=>JOt(e,t),sendRawTransactionSync:t=>LBt(e,t),simulate:t=>Gz(e,t),simulateBlocks:t=>Gz(e,t),simulateCalls:t=>bBt(e,t),simulateContract:t=>WOt(e,t),verifyHash:t=>OP(e,t),verifyMessage:t=>ABt(e,t),verifySiweMessage:t=>UBt(e,t),verifyTypedData:t=>_Bt(e,t),uninstallFilter:t=>_P(e,t),waitForTransactionReceipt:t=>NBt(e,t),watchBlocks:t=>TBt(e,t),watchBlockNumber:t=>qCe(e,t),watchContractEvent:t=>YOt(e,t),watchEvent:t=>PBt(e,t),watchPendingTransactions:t=>OBt(e,t)}}function MBt(e){const{key:t="public",name:n="Public Client"}=e;return z4e({...e,key:t,name:n,type:"publicClient"}).extend(WCe)}function HCe({key:e,methods:t,name:n,request:r,retryCount:s=3,retryDelay:i=150,timeout:o,type:a},c){const l=F4e();return{config:{key:e,methods:t,name:n,request:r,retryCount:s,retryDelay:i,timeout:o,type:a},request:Nkt(r,{methods:t,retryCount:s,retryDelay:i,uid:l}),value:c}}class VCe extends Ce{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function jBt(e,t={}){const{batch:n,fetchFn:r,fetchOptions:s,key:i="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:u,raw:d}=t;return({chain:h,retryCount:f,timeout:g})=>{const{batchSize:p=1e3,wait:m=0}=typeof n=="object"?n:{},w=t.retryCount??f,C=g??t.timeout??1e4,E=e||(h==null?void 0:h.rpcUrls.default.http[0]);if(!E)throw new VCe;const b=Ukt(E,{fetchFn:r,fetchOptions:s,onRequest:c,onResponse:l,timeout:C});return HCe({key:i,methods:o,name:a,async request({method:S,params:v}){const x={method:S,params:v},{schedule:A}=L4e({id:E,wait:m,shouldSplitBatch(T){return T.length>p},fn:T=>b.request({body:T}),sort:(T,P)=>T.id-P.id}),I=async T=>n?A(T):[await b.request({body:T})],[{error:O,result:N}]=await I(x);if(d)return{error:O,result:N};if(O)throw new wP({body:x,error:O,url:E});return N},retryCount:w,retryDelay:u,timeout:C,type:"http"},{fetchOptions:s,url:E})}}const FBt=Object.freeze(Object.defineProperty({__proto__:null,AbiConstructorNotFoundError:s8e,AbiConstructorParamsNotFoundError:_z,AbiDecodingDataSizeTooSmallError:VK,AbiDecodingZeroDataError:s3,AbiEncodingArrayLengthMismatchError:i8e,AbiEncodingBytesSizeMismatchError:o8e,AbiEncodingLengthMismatchError:a8e,AbiErrorInputsNotFoundError:c8e,AbiErrorNotFoundError:Nz,AbiErrorSignatureNotFoundError:KK,AbiEventNotFoundError:Tz,AbiEventSignatureEmptyTopicsError:l8e,AbiEventSignatureNotFoundError:u8e,AbiFunctionNotFoundError:Oy,AbiFunctionOutputsNotFoundError:GK,AbiFunctionSignatureNotFoundError:d8e,AccountStateConflictError:j8e,AtomicReadyWalletRejectedUpgradeError:a6,AtomicityNotSupportedError:c6,BaseError:Ce,BaseFeeScalarError:uG,BlockNotFoundError:dG,BundleTooLargeError:o6,BytesSizeMismatchError:h8e,CallExecutionError:aG,ChainDisconnectedError:e6,ChainDoesNotSupportContract:aN,CircularReferenceError:v7,ClientChainNotConfiguredError:AG,ContractFunctionExecutionError:cG,ContractFunctionRevertedError:G_,ContractFunctionZeroDataError:H8e,CounterfactualDeploymentFailedError:V8e,DecodeLogDataMismatch:W4,DecodeLogTopicsMismatch:hP,DuplicateIdError:s6,Eip1559FeesNotSupportedError:vP,EnsAvatarInvalidNftUriError:lv,EnsAvatarUnsupportedNamespaceError:G4e,EnsAvatarUriResolutionError:NP,EstimateGasExecutionError:Q8e,ExecutionRevertedError:Iw,FeeCapTooHighError:G4,FeeCapTooLowError:Y_,FilterTypeNotSupportedError:m8e,HttpRequestError:Lm,InsufficientFundsError:eN,IntegerOutOfRangeError:fP,InternalRpcError:r1,IntrinsicGasTooHighError:tN,IntrinsicGasTooLowError:nN,InvalidAbiDecodingTypeError:p8e,InvalidAbiEncodingTypeError:f8e,InvalidAbiItemError:u7,InvalidAbiParametersError:h7,InvalidAbiTypeParameterError:w7,InvalidAddressError:N0,InvalidArrayError:ZK,InvalidBytesBooleanError:y8e,InvalidDefinitionTypeError:g8e,InvalidDomainError:oCe,InvalidFunctionModifierError:m7,InvalidHexBooleanError:b8e,InvalidInputRpcError:T0,InvalidModifierError:g7,InvalidParameterError:f7,InvalidParamsRpcError:V5,InvalidParenthesisError:E7,InvalidPrimaryTypeError:aCe,InvalidRequestRpcError:W5,InvalidSerializableTransactionError:z8e,InvalidSignatureError:M0,InvalidStructSignatureError:b7,InvalidStructTypeError:cCe,JsonRpcVersionUnsupportedError:Y5,LimitExceededRpcError:Ry,MaxFeePerGasTooLowError:n4e,MethodNotFoundRpcError:H5,MethodNotSupportedRpcError:pm,NonceMaxValueError:Q_,NonceTooHighError:J_,NonceTooLowError:X_,ParseRpcError:q5,ProviderDisconnectedError:Q5,ProviderRpcError:Ea,RawContractError:Z$,ResourceNotFoundRpcError:K5,ResourceUnavailableRpcError:G5,RpcError:va,RpcRequestError:wP,SizeExceedsPaddingSizeError:JK,SizeOverflowError:v8e,SliceOffsetOutOfBoundsError:YK,SolidityProtectedKeywordError:p7,StateAssignmentC
vendor: 4,296 bytes, line 4494
4494onflictError:F8e,SwitchChainError:t6,TimeoutError:kz,TipAboveFeeCapError:Z4,TransactionExecutionError:q8e,TransactionNotFoundError:iG,TransactionReceiptNotFoundError:oG,TransactionRejectedRpcError:Z5,TransactionTypeNotSupportedError:rN,UnauthorizedProviderError:J5,UnknownBundleIdError:i6,UnknownNodeError:a3,UnknownRpcError:K8e,UnknownSignatureError:y7,UnknownTypeError:d7,UnsupportedChainIdError:r6,UnsupportedNonOptionalCapabilityError:n6,UnsupportedProviderMethodError:X5,UrlRequiredError:VCe,UserRejectedRequestError:Fw,WaitForTransactionReceiptTimeoutError:W8e,assertRequest:kb,blobsToCommitments:gG,blobsToProofs:mG,boolToBytes:C8e,boolToHex:XK,bytesToBigInt:R8e,bytesToBool:B8e,bytesToHex:Ds,bytesToNumber:ef,bytesToString:D8e,ccipFetch:dN,ccipRequest:dN,checksumAddress:H$,commitmentToVersionedHash:o4e,commitmentsToVersionedHashes:a4e,concat:Tu,concatBytes:x8e,concatHex:Ob,createClient:z4e,createPublicClient:MBt,createTransport:HCe,decodeAbiParameters:o3,decodeErrorResult:sG,decodeEventLog:Y4,decodeFunctionData:q4e,decodeFunctionResult:K0,defineChain:Bkt,deploylessCallViaBytecodeBytecode:IG,deploylessCallViaFactoryBytecode:B4e,encodeAbiParameters:V0,encodeDeployData:SP,encodeErrorResult:jz,encodeEventTopics:i3,encodeFunctionData:Nl,encodeFunctionResult:W4e,erc20Abi:YE,erc6492SignatureValidatorAbi:oN,erc6492SignatureValidatorByteCode:Uz,ethAddress:FCe,etherUnits:L8e,formatBlock:fG,formatEther:mP,formatGwei:ua,formatLog:Jd,formatTransaction:EP,formatTransactionReceipt:_G,formatTransactionRequest:c3,formatUnits:V$,getAbiItem:b1,getAddress:H4,getChainContractAddress:Rb,getContractError:By,getEventSelector:z5,getEventSignature:ZE,getFunctionSelector:ky,getFunctionSignature:ZE,getTransactionType:h4e,getTypesForEIP712Domain:uCe,gweiUnits:M8e,hashDomain:hCe,hashMessage:kG,hashStruct:RG,hashTypedData:dCe,hexToBigInt:Zd,hexToBool:E8e,hexToBytes:Yd,hexToNumber:df,http:jBt,isAddress:bl,isAddressEqual:Dy,isHex:Nu,keccak256:Ti,labelhash:K4e,maxUint256:t4e,multicall3Abi:My,namehash:lN,numberToBytes:$8e,numberToHex:Bt,offchainLookup:nCe,offchainLookupAbiItem:OG,offchainLookupSignature:tCe,pad:Tb,padBytes:w8e,padHex:f0,parseAbi:j0,parseAbiItem:w0,parseAbiParameters:y0,parseEventLogs:CP,prepareEncodeFunctionData:P8e,presignMessagePrefix:sCe,publicActions:WCe,recoverAddress:Z_,recoverPublicKey:G8e,rpcTransactionType:e4e,serializeSignature:Jz,sha256:i4e,signatureToHex:Jz,size:ts,slice:n1,sliceBytes:QK,sliceHex:A8e,stringToBytes:Um,stringToHex:F5,stringify:ks,toBlobSidecars:d4e,toBlobs:u4e,toBytes:Pb,toEventHash:K_,toEventSelector:z5,toEventSignature:ZE,toFunctionHash:K_,toFunctionSelector:ky,toFunctionSignature:ZE,toHex:_0,toPrefixedMessage:iCe,toRlp:Z8e,transactionType:hG,trim:Dm,universalSignatureValidatorAbi:oN,universalSignatureValidatorByteCode:Uz,validateTypedData:lCe,withCache:j4e,withRetry:cN,withTimeout:rCe,zeroAddress:Jl},Symbol.toStringTag,{value:"Module"}));async function vE(...e){const t=await fetch(...e);if(!t.ok)throw new Error(`HTTP status code: ${t.status}`,{cause:t});return t}class u3{constructor({baseUrl:t,clientId:n}){this.baseUrl=t,this.clientId=n}async get({headers:t,signal:n,cache:r,...s}){const i=this.createUrl(s);return(await vE(i,{method:"GET",headers:t,signal:n,cache:r})).json()}async getBlob({headers:t,signal:n,...r}){const s=this.createUrl(r);return(await vE(s,{method:"GET",headers:t,signal:n})).blob()}async post({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await vE(i,{method:"POST",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async put({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await vE(i,{method:"PUT",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}async delete({body:t,headers:n,signal:r,...s}){const i=this.createUrl(s);return(await vE(i,{method:"DELETE",headers:n,body:t?JSON.stringify(t):void 0,signal:r})).json()}createUrl({path:t,params:n}){const r=new URL(t,this.baseUrl);return n&&Object.entries(n).forEach(([s,i])=>{i&&r.searchParams.append(s,i)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}sendBeacon({body:t,...n}){const r=this.createUrl(n);return navigator.sendBeacon(r.toString(),t?JSON.stringify(t):void 0)}}const Xz={getFeatureValue(e,t){const n=t==null?void 0:t[e];return n===void 0?ei.DEFAULT_FEATURES[e]:n}
4494,filterSocialsByPlatform(e){if(!e||!e.length)return e;let t=e;return ht.isTelegram()&&(ht.isIos()&&(t=t.filter(n=>n!=="google")),ht.isMac()&&(t=t.filter(n=>n!=="x")),ht.isAndroid()&&(t=t.filter(n=>!["facebook","x"].includes(n)))),ht.isMobile()&&(t=t.filter(n=>n!=="facebook")),t},isSocialsEnabled(){var e,t,n,r;return Array.isArray((e=Ot.state.features)==null?void 0:e.socials)&&((t=Ot.state.features)==null?void 0:t.socials.length)>0||Array.isArray((n=Ot.state.remoteFeatures)==null?void 0:n.socials)&&((r=Ot.state.remoteFeatures)==null?void 0:r.socials.length)>0},isEmailEnabled(){var e,t;return!!((e=Ot.state.features)!=null&&e.email||(t=Ot.state.remoteFeatures)!=null&&t.email)}},vt=os({features:ei.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:ei.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{},enableMobileFullScreen:!1,coinbasePreference:"all"}),Ot={state:vt,subscribeKey(e,t){return ha(vt,e,t)},setOptions(e){Object.assign(vt,e)},setRemoteFeatures(e){var n,r;if(!e)return;const t={...vt.remoteFeatures,...e};vt.remoteFeatures=t,(n=vt.remoteFeatures)!=null&&n.socials&&(vt.remoteFeatures.socials=Xz.filterSocialsByPlatform(vt.remoteFeatures.socials)),(r=vt.features)!=null&&r.pay&&(vt.remoteFeatures.email=!1,vt.remoteFeatures.socials=!1)},setFeatures(e){var n;if(!e)return;vt.features||(vt.features=ei.DEFAULT_FEATURES);const t={...vt.features,...e};vt.features=t,(n=vt.features)!=null&&n.pay&&vt.remoteFeatures&&(vt.remoteFeatures.email=!1,vt.remoteFeatures.socials=!1)},setProjectId(e){vt.projectId=e},setCustomRpcUrls(e){vt.customRpcUrls=e},setAllWallets(e){vt.allWallets=e},setIncludeWalletIds(e){vt.includeWalletIds=e},setExcludeWalletIds(e){vt.excludeWalletIds=e},setFeaturedWalletIds(e){vt.featuredWalletIds=e},setTokens(e){vt.tokens=e},setTermsConditionsUrl(e){vt.termsConditionsUrl=e},setPrivacyPolicyUrl(e){vt.privacyPolicyUrl=e},setCustomWallets(e){vt.customWallets=e},setIsSiweEnabled(e){vt.isSiweEnabled=e},setIsUniversalProvider(e){vt.isUniversalProvider=e},setSdkVersion(e){vt.sdkVersion=e},setMetadata(e){vt.metadata=e},setDisableAppend(e){vt.disableAppend=e},setEIP6963Enabled(e){vt.enableEIP6963=e},setEnableCoinbase(e){vt.enableCoinbase=e},setDebug(e){vt.debug=e},setEnableWalletGuide(e){vt.enableWalletGuide=e},setEnableAuthLogger(e){vt.enableAuthLogger=e},setEnableWallets(e){vt.enableWallets=e},setPreferUniversalLinks(e){vt.experimental_preferUniversalLinks=e},setSIWX(e){if(e)for(const[t,n]of Object.entries(ei.SIWX_DEFAULTS))e[t]??(e[t]=n);vt.siwx=e},setConnectMethodsOrder(e){vt.features={...vt.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){vt.features={...vt.features,walletFeaturesOrder:e}},setSocialsOrder(e){vt.remoteFeatures={...vt.remoteFeatures,socials:e}},setCollapseWallets(e){vt.features={...vt.features,collapseWallets:e}},setEnableEmbedded(e){vt.enableEmbedded=e},setAllowUnsupportedChain(e){vt.allowUnsupportedChain=e},setManualWCControl(e){vt.manualWCControl=e},setEnableNetworkSwitch(e){vt.enableNetworkSwitch=e},setEnableMobileFullScreen(e){vt.enableMobileFullScreen=ht.isMobile()&&e},setEnableReconnect(e){vt.enableReconnect=e},setCoinbasePreference(e){vt.coinbasePreference=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([t,n])=>{n&&(vt.defaultAccountTypes[t]=n)})},setUniversalProviderConfigOverride(e){vt.universalProviderConfigOverride=e},getUniversalProviderConfigOverride(){return vt.universalProviderConfigOverride},getSnapshot(){return z4(vt)}},G1=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),Vs=os({...G1}),zBt={state:Vs,subscribeKey(e,t){return ha(Vs,e,t)},showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){const t=ht.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){Vs.message=G1.message,Vs.variant=G1.variant,Vs.svg=G1.svg,Vs.open=G1.open,Vs.autoClose=G1.autoClose},_showMessage({message:e,svg:t,variant:n="success",autoClose:r=G1.autoClose}){Vs.open?(Vs.open=!1,setTimeout(()=>{Vs.message=e,Vs.variant=n,Vs.svg=t,Vs.open=!0,Vs.autoClose=r},150)):(Vs.message=e,Vs.variant=n,Vs.svg=t,Vs.open=!0,Vs.autoClose=r)}}
vendor: 5,175 bytes, line 4494
4494,nl=zBt,qBt={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},KCe=ht.getBlockchainApiUrl(),Fo=os({clientId:null,api:new u3({baseUrl:KCe,clientId:null}),supportedChains:{http:[],ws:[]}}),tn={state:Fo,async get(e){const{st:t,sv:n}=tn.getSdkProperties(),r=Ot.state.projectId,s={...e.params||{},st:t,sv:n,projectId:r};return Fo.api.get({...e,params:s})},getSdkProperties(){const{sdkType:e,sdkVersion:t}=Ot.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{Fo.supportedChains.http.length||await tn.getSupportedNetworks()}catch{return!1}return Fo.supportedChains.http.includes(e)},async getSupportedNetworks(){try{const e=await tn.get({path:"v1/supported-chains"});return Fo.supportedChains=e,e}catch{return Fo.supportedChains}},async fetchIdentity({address:e}){const t=Qe.getIdentityFromCacheForAddress(e);if(t)return t;const n=await tn.get({path:`/v1/identity/${e}`,params:{sender:re.state.activeCaipAddress?ht.getPlainAddress(re.state.activeCaipAddress):void 0}});return Qe.updateIdentityCache({address:e,identity:n,timestamp:Date.now()}),n},async fetchTransactions({account:e,cursor:t,signal:n,cache:r,chainId:s}){var c;if(!await tn.isNetworkSupported((c=re.state.activeCaipNetwork)==null?void 0:c.caipNetworkId))return{data:[],next:void 0};const o=Qe.getTransactionsCacheForAddress({address:e,chainId:s});if(o)return o;const a=await tn.get({path:`/v1/account/${e}/history`,params:{cursor:t,chainId:s},signal:n,cache:r});return Qe.updateTransactionsCache({address:e,chainId:s,timestamp:Date.now(),transactions:a}),a},async fetchSwapQuote({amount:e,userAddress:t,from:n,to:r,gasPrice:s}){var o;return await tn.isNetworkSupported((o=re.state.activeCaipNetwork)==null?void 0:o.caipNetworkId)?tn.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:n,to:r,gasPrice:s}}):{quotes:[]}},async fetchSwapTokens({chainId:e}){var n;return await tn.isNetworkSupported((n=re.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?tn.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]}},async getAddressBalance({caipNetworkId:e,address:t,method:n="getAddressBalance",params:r}){return Fo.api.post({path:`/v1?chainId=${e}&projectId=${Ot.state.projectId}`,body:{id:"1",jsonrpc:"2.0",method:n,params:r??{address:t}}}).then(s=>s.result)},async fetchTokenPrice({addresses:e,caipNetworkId:t=(n=>(n=re.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)()}){if(!await tn.isNetworkSupported(t))return{fungibles:[]};const s=Qe.getTokenPriceCacheForAddresses(e);if(s)return s;const i=await Fo.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:Ot.state.projectId},headers:{"Content-Type":"application/json"}});return Qe.updateTokenPriceCache({addresses:e,timestamp:Date.now(),tokenPrice:i}),i},async fetchSwapAllowance({tokenAddress:e,userAddress:t}){var r;return await tn.isNetworkSupported((r=re.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)?tn.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"}},async fetchGasPrice({chainId:e}){var s;const{st:t,sv:n}=tn.getSdkProperties();if(!await tn.isNetworkSupported((s=re.state.activeCaipNetwork)==null?void 0:s.caipNetworkId))throw new Error("Network not supported for Gas Price");return tn.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:n}})},async generateSwapCalldata({amount:e,from:t,to:n,userAddress:r,disableEstimate:s}){var o;if(!await tn.isNetworkSupported((o=re.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return Fo.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:ei.CONVERT_SLIPPAGE_TOLERANCE},projectId:Ot.state.projectId,from:t,to:n,userAddress:r,disableEstimate:s}})},async generateApproveCalldata({from:e,to:t,userAddress:n}){var o;const{st:r,sv:s}=tn.getSdkProperties();if(!await tn.isNetworkSupported((o=re.state.activeCaipNetwork)==null?void 0:o.caipNetworkId))throw new Error("Network not supported for Swaps");return tn.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"}
4494,params:{userAddress:n,from:e,to:t,st:r,sv:s}})},async getBalance(e,t,n){var l;const{st:r,sv:s}=tn.getSdkProperties();if(!await tn.isNetworkSupported((l=re.state.activeCaipNetwork)==null?void 0:l.caipNetworkId))return nl.showError("Token Balance Unavailable"),{balances:[]};const o=`${t}:${e}`,a=Qe.getBalanceCacheForCaipAddress(o);if(a)return a;const c=await tn.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:n,st:r,sv:s}});return Qe.updateBalanceCache({caipAddress:o,balance:c,timestamp:Date.now()}),c},async lookupEnsName(e){var n;return await tn.isNetworkSupported((n=re.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?tn.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}},async reverseLookupEnsName({address:e}){var r,s;if(!await tn.isNetworkSupported((r=re.state.activeCaipNetwork)==null?void 0:r.caipNetworkId))return[];const n=(s=re.getAccountData())==null?void 0:s.address;return tn.get({path:`/v1/profile/reverse/${e}`,params:{sender:n,apiVersion:"2"}})},async getEnsNameSuggestions(e){var n;return await tn.isNetworkSupported((n=re.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?tn.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]}},async registerEnsName({coinType:e,address:t,message:n,signature:r}){var i;return await tn.isNetworkSupported((i=re.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)?Fo.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:n,signature:r},headers:{"Content-Type":"application/json"}}):{success:!1}},async generateOnRampURL({destinationWallets:e,partnerUserId:t,defaultNetwork:n,purchaseAmount:r,paymentAmount:s}){var a;return await tn.isNetworkSupported((a=re.state.activeCaipNetwork)==null?void 0:a.caipNetworkId)?(await Fo.api.post({path:"/v1/generators/onrampurl",params:{projectId:Ot.state.projectId},body:{destinationWallets:e,defaultNetwork:n,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:r,presetFiatAmount:s}})).url:""},async getOnrampOptions(){var t;if(!await tn.isNetworkSupported((t=re.state.activeCaipNetwork)==null?void 0:t.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await tn.get({path:"/v1/onramp/options"})}catch{return qBt}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}){var s;try{return await tn.isNetworkSupported((s=re.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?await Fo.api.post({path:"/v1/onramp/quote",params:{projectId:Ot.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:n,network:r}}):null}catch{return{networkFee:{amount:n,currency:t.id},paymentSubtotal:{amount:n,currency:t.id},paymentTotal:{amount:n,currency:t.id},purchaseAmount:{amount:n,currency:t.id},quoteId:"mocked-quote-id"}}},async getSmartSessions(e){var n;return await tn.isNetworkSupported((n=re.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)?tn.get({path:`/v1/sessions/${e}`}):[]},async revokeSmartSession(e,t,n){var s;return await tn.isNetworkSupported((s=re.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)?Fo.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:Ot.state.projectId},body:{pci:t,signature:n}}):{success:!1}},setClientId(e){Fo.clientId=e,Fo.api=new u3({baseUrl:KCe,clientId:e})}},WBt=Object.freeze({enabled:!0,events:[]}),HBt=new u3({baseUrl:ht.getAnalyticsUrl(),clientId:null}),VBt=5,KBt=60*1e3,kg=os({...WBt}),GBt={state:kg,subscribeKey(e,t){return ha(kg,e,t)},async sendError(e,t){if(!kg.enabled)return;const n=Date.now();if(kg.events.filter(i=>{const o=new Date(i.properties.timestamp||"").getTime();return n-o<KBt}).length>=VBt)return;const s={type:"error",event:t,properties:{errorType:e.name,errorMessage:e.message,stackTrace:e.stack,timestamp:new Date().toISOString()}};kg.events.push(s);try{if(typeof window>"u")return;const{projectId:i,sdkType:o,sdkVersion:a}=Ot.state;await HBt.post({path:"/e",params:{projectId:i,st:o,sv:a||"html-wagmi-4.2.2"},body:{eventId:ht.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:new Date().toISOString(),props:{type:"error",event:t,errorType:e.name,errorMessage:e.message,stackTrace:e.stack}}})}catch{}},enable(){kg.enabled=!0},disable(){kg.enabled=!1},clearEvents(){kg.events=[]}};
vendor: 5,109 bytes, lines 4494-4496
4494class Fy extends Error{constructor(t,n,r){super(t),this.originalName="AppKitError",this.name="AppKitError",this.category=n,this.originalError=r,r&&r instanceof Error&&(this.originalName=r.name),Object.setPrototypeOf(this,Fy.prototype);let s=!1;if(r instanceof Error&&typeof r.stack=="string"&&r.stack){const i=r.stack,o=i.indexOf(` 4495`);if(o>-1){const a=i.substring(o+1);this.stack=`${this.name}: ${this.message} 4496${a}`,s=!0}}s||(Error.captureStackTrace?Error.captureStackTrace(this,Fy):this.stack||(this.stack=`${this.name}: ${this.message}`))}}function Lce(e,t){let n="";try{e instanceof Error?n=e.message:typeof e=="string"?n=e:typeof e=="object"&&e!==null?Object.keys(e).length===0?n="Unknown error":n=(e==null?void 0:e.message)||JSON.stringify(e):n=String(e)}catch(s){n="Unknown error",console.error("Error parsing error message",s)}const r=e instanceof Fy?e:new Fy(n,t,e);throw GBt.sendError(r,r.category),r}function G0(e,t="INTERNAL_SDK_ERROR"){const n={};return Object.keys(e).forEach(r=>{const s=e[r];if(typeof s=="function"){let i=s;s.constructor.name==="AsyncFunction"?i=async(...o)=>{try{return await s(...o)}catch(a){return Lce(a,t)}}:i=(...o)=>{try{return s(...o)}catch(a){return Lce(a,t)}},n[r]=i}else n[r]=s}),n}const zc=os({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),ZBt={state:zc,subscribeNetworkImages(e){return Po(zc.networkImages,()=>e(zc.networkImages))},subscribeKey(e,t){return ha(zc,e,t)},subscribe(e){return Po(zc,()=>e(zc))},setWalletImage(e,t){zc.walletImages[e]=t},setNetworkImage(e,t){zc.networkImages[e]=t},setChainImage(e,t){zc.chainImages[e]=t},setConnectorImage(e,t){zc.connectorImages={...zc.connectorImages,[e]:t}},setTokenImage(e,t){zc.tokenImages[e]=t},setCurrencyImage(e,t){zc.currencyImages[e]=t}},fu=G0(ZBt),Mce={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:"",sui:"",stacks:"",ton:"20f673c0-095e-49b2-07cf-eb5049dcf600",tron:"3502bb86-cc4e-420f-a387-59ea63a28b00"},G2=os({networkImagePromises:{},tokenImagePromises:{}}),ll={async fetchWalletImage(e){if(e)return await gt._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(!e)return;const t=this.getNetworkImageById(e);return t||(G2.networkImagePromises[e]||(G2.networkImagePromises[e]=gt._fetchNetworkImage(e)),await G2.networkImagePromises[e],this.getNetworkImageById(e))},async fetchTokenImage(e){if(e)return G2.tokenImagePromises[e]||(G2.tokenImagePromises[e]=gt._fetchTokenImage(e)),await G2.tokenImagePromises[e],this.getTokenImage(e)},getWalletImageById(e){if(e)return fu.state.walletImages[e]},getWalletImage(e){if(e!=null&&e.image_url)return e==null?void 0:e.image_url;if(e!=null&&e.image_id)return fu.state.walletImages[e.image_id]},getNetworkImage(e){var t,n,r;if((t=e==null?void 0:e.assets)!=null&&t.imageUrl)return(n=e==null?void 0:e.assets)==null?void 0:n.imageUrl;if((r=e==null?void 0:e.assets)!=null&&r.imageId)return fu.state.networkImages[e.assets.imageId]},getNetworkImageById(e){if(e)return fu.state.networkImages[e]},getConnectorImage(e){var t;if(e!=null&&e.imageUrl)return e.imageUrl;if((t=e==null?void 0:e.info)!=null&&t.icon)return e.info.icon;if(e!=null&&e.imageId)return fu.state.connectorImages[e.imageId]},getChainImage(e){return fu.state.networkImages[Mce[e]]},getTokenImage(e){if(e)return fu.state.tokenImages[e]},getWalletImageUrl(e){if(!e)return"";const{projectId:t,sdkType:n,sdkVersion:r}=Ot.state,s=new URL(`${Oe.W3M_API_URL}/getWalletImage/${e}`);return s.searchParams.set("projectId",t),s.searchParams.set("st",n),s.searchParams.set("sv",r),s.toString()},getAssetImageUrl(e){if(!e)return"";const{projectId:t,sdkType:n,sdkVersion:r}=Ot.state,s=new URL(`${Oe.W3M_API_URL}/public/getAssetImage/${e}`);return s.searchParams.set("projectId",t),s.searchParams.set("st",n),s.searchParams.set("sv",r),s.toString()},getChainNamespaceImageUrl(e){return this.getAssetImageUrl(Mce[e])},async getImageByToken(e,t){if(e==="native"){const r=Oe.NATIVE_IMAGE_IDS_BY_NAMESPACE[t]??null;return r?ll.fetchNetworkImage(r):void 0}const[,n]=Object.entries(Oe.TOKEN_SYMBOLS_BY_ADDRESS).find(([r])=>r.toLowerCase()===e.toLowerCase())??[];if(n)return ll.fetchTokenImage(n)}},Zs={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app",androidPackage:"app.phantom"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",url:"https://go.cb-w.com",evmDeeplink:"cbwallet://miniapp"},BINANCE:{id:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25",appId:"yFK5FCqYprrXDiVFbhyRx7",deeplink:"bnc://app.binance.com/mp/app",url:"https://app.binance.com/en/download"}},YBt={isCustomDeeplinkWallet(e,t){return e===Zs.PHANTOM.id?t===Oe.CHAIN.SOLANA||t===Oe.CHAIN.EVM||t===Oe.CHAIN.BITCOIN:e===Zs.SOLFLARE.id?t===Oe.CHAIN.SOLANA:e===Zs.COINBASE.id?t===Oe.CHAIN.SOLANA||t===Oe.CHAIN.EVM:e===Zs.BINANCE.id?t===Oe.CHAIN.BITCOIN:!1}
4496,handleMobileDeeplinkRedirect(e,t,n){const r=window.location.href,s=encodeURIComponent(r),i=(n==null?void 0:n.isCoinbaseDisabled)??!1;if(e===Zs.PHANTOM.id&&!("phantom"in window)){const o=r.startsWith("https")?"https":"http",a=r.split("/")[2],c=encodeURIComponent(`${o}://${a}`),l=`${Zs.PHANTOM.url}/ul/browse/${s}?ref=${c}`;if(ht.isAndroid()){const u=`intent://browse/${s}?ref=${c}#Intent;scheme=phantom;package=${Zs.PHANTOM.androidPackage};end`;window.location.href=u}else window.location.href=l}if(e===Zs.SOLFLARE.id&&t===Oe.CHAIN.SOLANA&&!("solflare"in window)&&(window.location.href=`${Zs.SOLFLARE.url}/ul/v1/browse/${s}?ref=${s}`),t===Oe.CHAIN.SOLANA&&e===Zs.COINBASE.id&&(i||!("coinbaseSolana"in window))&&(window.location.href=`${Zs.COINBASE.url}/dapp?cb_url=${s}`),t===Oe.CHAIN.EVM&&e===Zs.COINBASE.id&&(i||!("coinbaseWalletExtension"in window))&&(window.location.href=`${Zs.COINBASE.evmDeeplink}?url=${s}`),t===Oe.CHAIN.BITCOIN&&e===Zs.BINANCE.id&&!("binancew3w"in window)){const o=re.state.activeCaipNetwork,a=window.btoa("/pages/browser/index"),c=window.btoa(`url=${s}&defaultChainId=${(o==null?void 0:o.id)??1}`),l=new URL(Zs.BINANCE.deeplink);l.searchParams.set("appId",Zs.BINANCE.appId),l.searchParams.set("startPagePath",a),l.searchParams.set("startPageQuery",c);const u=new URL(Zs.BINANCE.url);u.searchParams.set("_dp",window.btoa(l.toString())),window.location.href=u.toString()}}},JBt=ht.getAnalyticsUrl(),XBt=new u3({baseUrl:JBt,clientId:null}),QBt=["MODAL_CREATED"],eDt=45,jce=1e3*10,ds=os({timestamp:Date.now(),lastFlush:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"},pendingEvents:[],subscribedToVisibilityChange:!1,walletImpressions:[]}),Mn={state:ds,subscribe(e){return Po(ds,()=>e(ds))},getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=Ot.state;return{projectId:e,st:t,sv:n||"html-wagmi-4.2.2"}},shouldFlushEvents(){const e=JSON.stringify(ds.pendingEvents).length/1024>eDt,t=ds.lastFlush+jce<Date.now();return e||t},_setPendingEvent(e){var t,n;try{let r=(t=re.getAccountData())==null?void 0:t.address;if("address"in e.data&&e.data.address&&(r=e.data.address),QBt.includes(e.data.event)||typeof window>"u")return;const s=(n=re.getActiveCaipNetwork())==null?void 0:n.caipNetworkId;this.state.pendingEvents.push({eventId:ht.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:r,properties:{..."properties"in e.data?e.data.properties:{},caipNetworkId:s}}}),ds.reportedErrors.FORBIDDEN=!1,Mn.shouldFlushEvents()&&Mn._submitPendingEvents()}catch(r){console.warn("_setPendingEvent",r)}},sendEvent(e){var n;ds.timestamp=Date.now(),ds.data=e;const t=["INITIALIZE","CONNECT_SUCCESS","SOCIAL_LOGIN_SUCCESS"];((n=Ot.state.features)!=null&&n.analytics||t.includes(e.event))&&Mn._setPendingEvent(ds),this.subscribeToFlushTriggers()},sendWalletImpressionEvent(e){ds.walletImpressions.push(e)},_transformPendingEventsForBatch(e){try{return e.filter(t=>t.props.event!=="WALLET_IMPRESSION_V2")}catch{return e}},_submitPendingEvents(){if(ds.lastFlush=Date.now(),!(ds.pendingEvents.length===0&&ds.walletImpressions.length===0))try{const e=Mn._transformPendingEventsForBatch(ds.pendingEvents);ds.walletImpressions.length&&e.push({eventId:ht.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:Date.now(),props:{type:"track",event:"WALLET_IMPRESSION_V2",items:[...ds.walletImpressions]}}),XBt.sendBeacon({path:"/batch",params:Mn.getSdkProperties(),body:e}),ds.reportedErrors.FORBIDDEN=!1,ds.pendingEvents=[],ds.walletImpressions=[]}catch{ds.reportedErrors.FORBIDDEN=!0}},subscribeToFlushTriggers(){var e,t,n;ds.subscribedToVisibilityChange||typeof document>"u"||(ds.subscribedToVisibilityChange=!0,(e=document==null?void 0:document.addEventListener)==null||e.call(document,"visibilitychange",()=>{document.visibilityState==="hidden"&&Mn._submitPendingEvents()}),(t=document==null?void 0:document.addEventListener)==null||t.call(document,"freeze",()=>{Mn._submitPendingEvents()}),(n=window==null?void 0:window.addEventListener)==null||n.call(window,"pagehide",()=>{Mn._submitPendingEvents()}),setInterval(()=>{Mn._submitPendingEvents()},jce))}},tDt=ht.getApiUrl(),zo=new u3({baseUrl:tDt,clientId:null}),nDt=40,Fce=4,rDt=20,qt=os({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1,explorerWallets:[],explorerFilteredWallets:[],plan:{tier:"none",hasExceededUsageLimit:!1,limits:{isAboveRpcLim
4496it:!1,isAboveMauLimit:!1}}}),gt={state:qt,subscribeKey(e,t){return ha(qt,e,t)},_getSdkProperties(){const{projectId:e,sdkType:t,sdkVersion:n}=Ot.state;return{projectId:e,st:t||"appkit",sv:n||"html-wagmi-4.2.2"}},_filterOutExtensions(e){return Ot.state.isUniversalProvider?e.filter(t=>!!(t.mobile_link||t.desktop_link||t.webapp_link)):e},async _fetchWalletImage(e){const t=`${zo.baseUrl}/getWalletImage/${e}`,n=await zo.getBlob({path:t,params:gt._getSdkProperties()});fu.setWalletImage(e,URL.createObjectURL(n))},async _fetchNetworkImage(e){const t=`${zo.baseUrl}/public/getAssetImage/${e}`,n=await zo.getBlob({path:t,params:gt._getSdkProperties()});fu.setNetworkImage(e,URL.createObjectURL(n))},async _fetchConnectorImage(e){const t=`${zo.baseUrl}/public/getAssetImage/${e}`,n=await zo.getBlob({path:t,params:gt._getSdkProperties()});fu.setConnectorImage(e,URL.createObjectURL(n))},async _fetchCurrencyImage(e){const t=`${zo.baseUrl}/public/getCurrencyImage/${e}`,n=await zo.getBlob({path:t,params:gt._getSdkProperties()});fu.setCurrencyImage(e,URL.createObjectURL(n))},async _fetchTokenImage(e){const t=`${zo.baseUrl}/public/getTokenImage/${e}`,n=await zo.getBlob({path:t,params:gt._getSdkProperties()});fu.setTokenImage(e,URL.createObjectURL(n))},_filterWalletsByPlatform(e){const t=e.length,n=ht.isMobile()?e==null?void 0:e.filter(s=>s.mobile_link||s.webapp_link?!0:Object.values(Zs).map(o=>o.id).includes(s.id)):e,r=t-n.length;return{filteredWallets:n,mobileFilteredOutWalletsLength:r}},async fetchProjectConfig(){return(await zo.get({path:"/appkit/v1/config",params:gt._getSdkProperties()})).features},async fetchUsage(){try{const e=await zo.get({path:"/appkit/v1/project-limits",params:gt._getSdkProperties()}),{tier:t,isAboveMauLimit:n,isAboveRpcLimit:r}=e.planLimits,s=t==="starter",i=n||r;gt.state.plan={tier:t,hasExceededUsageLimit:s&&i,limits:{isAboveRpcLimit:r,isAboveMauLimit:n}}}catch(e){console.warn("Failed to fetch usage",e)}},async fetchAllowedOrigins(){try{const{allowedOrigins:e}=await zo.get({path:"/projects/v1/origins",params:gt._getSdkProperties()});return e}catch(e){if(e instanceof Error&&e.cause instanceof Response){const t=e.cause.status;if(t===Oe.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)throw new Error("RATE_LIMITED",{cause:e});if(t>=Oe.HTTP_STATUS_CODES.SERVER_ERROR&&t<600)throw new Error("SERVER_ERROR",{cause:e});return[]}return[]}},async fetchNetworkImages(){const e=re.getAllRequestedCaipNetworks(),t=e==null?void 0:e.map(({assets:n})=>n==null?void 0:n.imageId).filter(Boolean).filter(n=>!ll.getNetworkImageById(n));t&&await Promise.allSettled(t.map(n=>gt._fetchNetworkImage(n)))},async fetchConnectorImages(){const{connectors:e}=Ve.state,t=e.map(({imageId:n})=>n).filter(Boolean);await Promise.allSettled(t.map(n=>gt._fetchConnectorImage(n)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(t=>gt._fetchCurrencyImage(t)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(t=>gt._fetchTokenImage(t)))},async fetchWallets(e){var o;const t=e.exclude??[];gt._getSdkProperties().sv.startsWith("html-core-")&&t.push(...Object.values(Zs).map(a=>a.id));const r=await zo.get({path:"/getWallets",params:{...gt._getSdkProperties(),...e,page:String(e.page),entries:String(e.entries),include:(o=e.include)==null?void 0:o.join(","),exclude:t.join(",")}}),{filteredWallets:s,mobileFilteredOutWalletsLength:i}=gt._filterWalletsByPlatform(r==null?void 0:r.data);return{data:s||[],count:r==null?void 0:r.count,mobileFilteredOutWalletsLength:i}},async prefetchWalletRanks(){const e=Ve.state.connectors;if(!(e!=null&&e.length))return;const t={page:1,entries:20,badge:"certified"};if(t.names=e.map(s=>s.name).join(","),re.state.activeChain===Oe.CHAIN.EVM){const s=[...e.flatMap(i=>{var o;return((o=i.connectors)==null?void 0:o.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}))||[]}),...e.map(i=>{var o;return(o=i.info)==null?void 0:o.rdns})].filter(i=>typeof i=="string"&&i.length>0);s.length&&(t.rdns=s.join(","))}const{data:n}=await gt.fetchWallets(t);qt.explorerWallets=n,Ve.extendConnectorsWithExplorerWallets(n);const r=re.getRequestedCaipNetworkIds().join(",");qt.explorerFilteredWallets=n.filter(s=>{var i;return(i=s.chains)==null?void 0:i.some(o=>r.includes(o))})},async fetchFeaturedWallets(){const{featuredWalletIds:e}=Ot.state;if(e!=null&&e.length){const t={...gt._getSdkProperties(),page:1,entries:(e==null?void 0:e.length)??Fce,include:e},{data:n}=await gt.fetchWallets(t),r=[...n].sort((i,o)=>e.indexOf(i.id)-e.indexOf(o.id)),s=r.map(i=>
vendor: 8,751 bytes, line 4496
4496i.image_id).filter(Boolean);await Promise.allSettled(s.map(i=>gt._fetchWalletImage(i))),qt.featured=r,qt.allFeatured=r}},async fetchRecommendedWallets(){try{qt.isFetchingRecommendedWallets=!0;const{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:n}=Ot.state,r=[...t??[],...n??[]].filter(Boolean),s=re.getRequestedCaipNetworkIds().join(","),i={page:1,entries:Fce,include:e,exclude:r,chains:s},{data:o,count:a}=await gt.fetchWallets(i),c=Qe.getRecentWallets(),l=o.map(d=>d.image_id).filter(Boolean),u=c.map(d=>d.image_id).filter(Boolean);await Promise.allSettled([...l,...u].map(d=>gt._fetchWalletImage(d))),qt.recommended=o,qt.allRecommended=o,qt.count=a??0}catch{}finally{qt.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:e,entries:t,badge:n,include:r,exclude:s}){const{includeWalletIds:i,excludeWalletIds:o,featuredWalletIds:a}=Ot.state,c=re.getRequestedCaipNetworkIds().join(","),l=[...qt.recommended.map(({id:p})=>p),...o??[],...a??[]].filter(Boolean),u={page:e,entries:t??nDt,include:r??i,exclude:s??l,badge_type:n,chains:c},{data:d,count:h,mobileFilteredOutWalletsLength:f}=await gt.fetchWallets(u);qt.mobileFilteredOutWalletsLength=f+(qt.mobileFilteredOutWalletsLength??0);const g=d.slice(0,rDt).map(p=>p.image_id).filter(Boolean);await Promise.allSettled(g.map(p=>gt._fetchWalletImage(p))),qt.wallets=ht.uniqueBy([...qt.wallets,...gt._filterOutExtensions(d)],"id").filter(p=>{var m;return(m=p.chains)==null?void 0:m.some(w=>c.includes(w))}),qt.count=h>qt.count?h:qt.count,qt.page=e},async initializeExcludedWallets({ids:e}){const t={page:1,entries:e.length,include:e},{data:n}=await gt.fetchWallets(t);n&&n.forEach(r=>{qt.excludedWallets.push({rdns:r.rdns,name:r.name})})},async searchWallet({search:e,badge:t,entries:n,page:r,include:s,exclude:i}){const{includeWalletIds:o,excludeWalletIds:a}=Ot.state,c=re.getRequestedCaipNetworkIds().join(",");qt.search=[];const l={page:r??1,entries:n??100,search:e==null?void 0:e.trim(),badge_type:t,include:s??o,exclude:i??a,chains:c},{data:u}=await gt.fetchWallets(l);Mn.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});const d=u.map(h=>h.image_id).filter(Boolean);await Promise.allSettled([...d.map(h=>gt._fetchWalletImage(h)),ht.wait(300)]),qt.search=gt._filterOutExtensions(u)},initPromise(e,t){const n=qt.promises[e];return n||(qt.promises[e]=t())},prefetch({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:n=!0,fetchNetworkImages:r=!0,fetchWalletRanks:s=!0}={}){const i=[e&>.initPromise("connectorImages",gt.fetchConnectorImages),t&>.initPromise("featuredWallets",gt.fetchFeaturedWallets),n&>.initPromise("recommendedWallets",gt.fetchRecommendedWallets),r&>.initPromise("networkImages",gt.fetchNetworkImages),s&>.initPromise("walletRanks",gt.prefetchWalletRanks)].filter(Boolean);return Promise.allSettled(i)},prefetchAnalyticsConfig(){var e;(e=Ot.state.features)!=null&&e.analytics&>.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{const{isAnalyticsEnabled:e}=await zo.get({path:"/getAnalyticsConfig",params:gt._getSdkProperties()});Ot.setFeatures({analytics:e})}catch{Ot.setFeatures({analytics:!1})}},filterByNamespaces(e){if(!(e!=null&&e.length)){qt.featured=qt.allFeatured,qt.recommended=qt.allRecommended;return}const t=re.getRequestedCaipNetworkIds().join(",");qt.featured=qt.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),qt.recommended=qt.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),qt.filteredWallets=qt.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})},clearFilterByNamespaces(){qt.filteredWallets=[]},setFilterByNamespace(e){if(!e){qt.featured=qt.allFeatured,qt.recommended=qt.allRecommended;return}const t=re.getRequestedCaipNetworkIds().join(",");qt.featured=qt.allFeatured.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),qt.recommended=qt.allRecommended.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))}),qt.filteredWallets=qt.wallets.filter(n=>{var r;return(r=n.chains)==null?void 0:r.some(s=>t.includes(s))})}},Aw={filterOutDuplicatesByRDNS(e){const t=Ot.state.enableEIP6963?Ve.state.connectors:[],n=Qe.getRecentWallets(),r=t.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),s=n.map(a=>a.rdns).filter(Boolean),i=r.concat(s);if(i.includes("io.metamask.mobile")&&ht.isMobile()){const a=i.indexOf("io.metamask.mobile");i[a]="io.metamask"}return e.filter(a=>!(a!=null&&a.rdns&&i.includes(String(a.rdns))||!(a!=null&&a.rdns)&&t.some(l=>l.name===a.name)))},filterOutDuplicatesByIds(e){const t=Ve.state.connectors.filter(a=>a.type==="ANNOUNCED"||a.type==="INJECTED"||a.type==="MULTI_CHAIN"),n=Qe.getRecentWallets(),r=t.map(a=>{var c;return a.explorerId||((c=a.explorerWallet)==null?void 0:c.id)||a.id}),s=n.map(a=>a.id),i=r.concat(s);return e.filter(a=>!i.includes(a==null?void 0:a.id))},filterOutDuplicateWallets(e){const t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){const{connectors:t}=Ve.state,{featuredWalletIds:n}=Ot.state,r=t.filter(o=>o.type==="ANNOUNCED").reduce((o,a)=>{var c;return(c=a.info)!=null&&c.rdns&&(o[a.info.rdns]=!0),o},{});return e.map(o=>({...o,installed:!!o.rdns&&!!r[o.rdns??""]})).sort((o,a)=>{const c=Number(a.installed)-Number(o.installed);if(c!==0)return c;if(n!=null&&n.length){const l=n.indexOf(o.id),u=n.indexOf(a.id);if(l!==-1&&u!==-1)return l-u;if(l!==-1)return-1;if(u!==-1)return 1}return 0})},getConnectOrderMethod(e,t){var c;const n=(e==null?void 0:e.connectMethodsOrder)||((c=Ot.state.features)==null?void 0:c.connectMethodsOrder),r=t||Ve.state.connectors;if(n)return n;const{injected:s,announced:i}=Wa.getConnectorsByType(r,gt.state.recommended,gt.state.featured),o=s.filter(Wa.showConnector),a=i.filter(Wa.showConnector);return o.length||a.length?["wallet","email","social"]:ei.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(e){const t=!!e.rdns&>.state.excludedWallets.some(r=>r.rdns===e.rdns),n=!!e.name&>.state.excludedWallets.some(r=>XEe.isLowerCaseMatch(r.name,e.name));return t||n},markWalletsWithDisplayIndex(e){return e.map((t,n)=>({...t,display_index:n}))},filterWalletsByWcSupport(e){return st.state.wcBasic?e.filter(t=>t.supports_wc):ht.isMobile()?e.filter(t=>t.supports_wc||ei.MANDATORY_WALLET_IDS_ON_MOBILE.includes(t.id)):e},getWalletConnectWallets(e){var i;const t=[...gt.state.featured,...gt.state.recommended];((i=gt.state.filteredWallets)==null?void 0:i.length)>0?t.push(...gt.state.filteredWallets):t.push(...e);const n=ht.uniqueBy(t,"id"),r=Aw.markWalletsAsInstalled(n),s=Aw.filterWalletsByWcSupport(r);return Aw.markWalletsWithDisplayIndex(s)}},Wa={getConnectorsByType(e,t,n){const{customWallets:r}=Ot.state,s=Qe.getRecentWallets(),i=Aw.filterOutDuplicateWallets(t),o=Aw.filterOutDuplicateWallets(n),a=e.filter(d=>d.type==="MULTI_CHAIN"),c=e.filter(d=>d.type==="ANNOUNCED"),l=e.filter(d=>d.type==="INJECTED"),u=e.filter(d=>d.type==="EXTERNAL");return{custom:r,recent:s,external:u,multiChain:a,announced:c,injected:l,recommended:i,featured:o}},showConnector(e){var s;const t=(s=e.info)==null?void 0:s.rdns,n=!!t&>.state.excludedWallets.some(i=>!!i.rdns&&i.rdns===t),r=!!e.name&>.state.excludedWallets.some(i=>XEe.isLowerCaseMatch(i.name,e.name));return!(e.type==="INJECTED"&&(e.name==="Browser Wallet"&&(!ht.isMobile()||ht.isMobile()&&!t&&!st.checkInstalled())||n||r)||(e.type==="ANNOUNCED"||e.type==="EXTERNAL")&&(n||r))},getIsConnectedWithWC(){return Array.from(re.state.chains.values()).some(n=>Ve.getConnectorId(n.namespace)===Oe.CONNECTOR_ID.WALLET_CONNECT)},getConnectorTypeOrder({recommended:e,featured:t,custom:n,recent:r,announced:s,injected:i,multiChain:o,external:a,overriddenConnectors:c=(l=>(l=Ot.state.features)==null?void 0:l.connectorTypeOrder)()??[]}){const d=[{type:"walletConnect",isEnabled:!0},{type:"recent",isEnabled:r.length>0},{type:"injected",isEnabled:[...i,...s,...o].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:n&&n.length>0},{type:"external",isEnabled:a.length>0},{type:"recommended",isEnabled:e.length>0}].filter(p=>p.isEnabled),h=new Set(d.map(p=>p.type)),f=c.filter(p=>h.has(p)).map(p=>({type:p,isEnabled:!0})),g=d.filter(({type:p})=>!f.some(({type:w})=>w===p));return Array.from(new Set([...f,...g].map(({type:p})=>p)))},sortConnectorsByExplorerWallet(e){return[...e].sort((t,n)=>t.explorerWallet&&n.explorerWallet?(t.explorerWallet.order??0)-(n.explorerWallet.order??0):t.explorerWallet?-1:n.explorerWallet?1:0)},getPriority(e){return e.id===Oe.CONNECTOR_ID.BASE_ACCOUNT?0:e.id===Oe.CONNECTOR_ID.COINBASE||e.id===Oe.CONNECTOR_ID.COINBASE_SDK?1:2},sortConnectorsByPriority(e){return[...e].sort((t,n)=>
4496Wa.getPriority(t)-Wa.getPriority(n))},getAuthName({email:e,socialUsername:t,socialProvider:n}){return t?n&&n==="discord"&&t.endsWith("0")?t.slice(0,-1):t:e.length>30?`${e.slice(0,-3)}...`:e},async fetchProviderData(e){var t,n;try{if(e.name==="Browser Wallet"&&!ht.isMobile())return{accounts:[],chainId:void 0};if(e.id===Oe.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};const[r,s]=await Promise.all([(t=e.provider)==null?void 0:t.request({method:"eth_accounts"}),(n=e.provider)==null?void 0:n.request({method:"eth_chainId"}).then(i=>Number(i))]);return{accounts:r,chainId:s}}catch(r){return console.warn(`Failed to fetch provider data for ${e.name}`,r),{accounts:[],chainId:void 0}}},getFilteredCustomWallets(e){const t=Qe.getRecentWallets(),n=Ve.state.connectors.map(o=>{var a;return(a=o.info)==null?void 0:a.rdns}).filter(Boolean),r=t.map(o=>o.rdns).filter(Boolean),s=n.concat(r);if(s.includes("io.metamask.mobile")&&ht.isMobile()){const o=s.indexOf("io.metamask.mobile");s[o]="io.metamask"}return e.filter(o=>!s.includes(String(o==null?void 0:o.rdns)))},hasWalletConnector(e){return Ve.state.connectors.some(t=>t.id===e.id||t.name===e.name)},isWalletCompatibleWithCurrentChain(e){const t=re.state.activeChain;return t&&e.chains?e.chains.some(n=>{const r=n.split(":")[0];return t===r}):!0},getFilteredRecentWallets(){return Qe.getRecentWallets().filter(n=>!Aw.isExcluded(n)).filter(n=>!this.hasWalletConnector(n)).filter(n=>this.isWalletCompatibleWithCurrentChain(n))},getCappedRecommendedWallets(e){const{connectors:t}=Ve.state,{customWallets:n,featuredWalletIds:r}=Ot.state,s=t.find(C=>C.id==="walletConnect"),i=t.filter(C=>C.type==="INJECTED"||C.type==="ANNOUNCED"||C.type==="MULTI_CHAIN");if(!s&&!i.length&&!(n!=null&&n.length))return[];const o=Xz.isEmailEnabled(),a=Xz.isSocialsEnabled(),c=i.filter(C=>C.name!=="Browser Wallet"&&C.name!=="WalletConnect"),l=(r==null?void 0:r.length)||0,u=(n==null?void 0:n.length)||0,d=c.length||0,h=o?1:0,f=a?1:0,g=l+u+d+h+f,m=Math.max(0,4-g);return m<=0?[]:Aw.filterOutDuplicateWallets(e).slice(0,m)},processConnectorsByType(e,t=!0){const n=Wa.sortConnectorsByExplorerWallet([...e]);return t?n.filter(Wa.showConnector):n},connectorList(){const e=Wa.getConnectorsByType(Ve.state.connectors,gt.state.recommended,gt.state.featured),t=this.processConnectorsByType(e.announced.filter(f=>f.id!=="walletConnect")),n=this.processConnectorsByType(e.injected),r=this.processConnectorsByType(e.multiChain.filter(f=>f.name!=="WalletConnect"),!1),s=e.custom,i=e.recent,o=this.processConnectorsByType(e.external.filter(f=>f.id!==Oe.CONNECTOR_ID.COINBASE_SDK&&f.id!==Oe.CONNECTOR_ID.BASE_ACCOUNT)),a=e.recommended,c=e.featured,l=Wa.getConnectorTypeOrder({custom:s,recent:i,announced:t,injected:n,multiChain:r,recommended:a,featured:c,external:o}),u=Ve.state.connectors.find(f=>f.id==="walletConnect"),d=ht.isMobile(),h=[];for(const f of l)switch(f){case"walletConnect":{!d&&u&&h.push({kind:"connector",subtype:"walletConnect",connector:u});break}case"recent":{Wa.getFilteredRecentWallets().forEach(p=>h.push({kind:"wallet",subtype:"recent",wallet:p}));break}case"injected":{r.forEach(g=>h.push({kind:"connector",subtype:"multiChain",connector:g})),t.forEach(g=>h.push({kind:"connector",subtype:"announced",connector:g})),n.forEach(g=>h.push({kind:"connector",subtype:"injected",connector:g}));break}
4496case"featured":{c.forEach(g=>h.push({kind:"wallet",subtype:"featured",wallet:g}));break}case"custom":{Wa.getFilteredCustomWallets(s??[]).forEach(p=>h.push({kind:"wallet",subtype:"custom",wallet:p}));break}case"external":{o.forEach(g=>h.push({kind:"connector",subtype:"external",connector:g}));break}case"recommended":{Wa.getCappedRecommendedWallets(a).forEach(p=>h.push({kind:"wallet",subtype:"recommended",wallet:p}));break}default:console.warn(`Unknown connector type: ${f}`)}return h},hasInjectedConnectors(){return Ve.state.connectors.filter(e=>(e.type==="INJECTED"||e.type==="ANNOUNCED"||e.type==="MULTI_CHAIN")&&e.name!=="Browser Wallet"&&e.name!=="WalletConnect").length}},sDt=["ConnectingExternal","ConnectingMultiChain","ConnectingSocial","ConnectingFarcaster"],nr=os({view:"Connect",history:["Connect"],transactionStack:[]}),iDt={state:nr,subscribeKey(e,t){return ha(nr,e,t)},pushTransactionStack(e){nr.transactionStack.push(e)},popTransactionStack(e){const t=nr.transactionStack.pop();if(!t)return;const{onSuccess:n,onError:r,onCancel:s}=t;switch(e){case"success":n==null||n();break;case"error":r==null||r(),Kt.goBack();break;case"cancel":s==null||s(),Kt.goBack();break}},push(e,t){let n=e,r=t;gt.state.plan.hasExceededUsageLimit&&sDt.includes(e)&&(n="UsageExceeded",r=void 0),n!==nr.view&&(nr.view=n,nr.history.push(n),nr.data=r)},reset(e,t){nr.view=e,nr.history=[e],nr.data=t},replace(e,t){nr.history.at(-1)===e||(nr.view=e,nr.history[nr.history.length-1]=e,nr.data=t)},goBack(){var r,s;const e=re.state.activeCaipAddress,t=Kt.state.view==="ConnectingFarcaster",n=!e&&t;if(nr.history.length>1){nr.history.pop();const[i]=nr.history.slice(-1);i&&(e&&i==="Connect"?nr.view="Account":nr.view=i)}else pr.close();(r=nr.data)!=null&&r.wallet&&(nr.data.wallet=void 0),(s=nr.data)!=null&&s.redirectView&&(nr.data.redirectView=void 0),setTimeout(()=>{var i,o,a;if(n){re.setAccountProp("farcasterUrl",void 0,re.state.activeChain);const c=Ve.getAuthConnector();(i=c==null?void 0:c.provider)==null||i.reload();const l=z4(Ot.state);(a=(o=c==null?void 0:c.provider)==null?void 0:o.syncDappData)==null||a.call(o,{metadata:l.metadata,sdkVersion:l.sdkVersion,projectId:l.projectId,sdkType:l.sdkType})}},100)},goBackToIndex(e){if(nr.history.length>1){nr.history=nr.history.slice(0,e+1);const[t]=nr.history.slice(-1);t&&(nr.view=t)}},goBackOrCloseModal(){Kt.state.history.length>1?Kt.goBack():pr.close()}},Kt=G0(iDt),op=os({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),Qz={state:op,subscribe(e){return Po(op,()=>e(op))},setThemeMode(e){op.themeMode=e;try{const t=Ve.getAuthConnector();if(t){const n=Qz.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:n,w3mThemeVariables:H_(n,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){op.themeVariables={...op.themeVariables,...e};try{const t=Ve.getAuthConnector();if(t){const n=Qz.getSnapshot().themeVariables;t.provider.syncTheme({themeVariables:n,w3mThemeVariables:H_(op.themeVariables,op.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot(){return z4(op)}},iS=G0(Qz),GCe=Object.fromEntries(QEe.map(e=>[e,void 0])),oDt=Object.fromEntries(QEe.map(e=>[e,!0])),kn=os({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:GCe,filterByNamespaceMap:oDt}),aDt={state:kn,subscribe(e){return Po(kn,()=>{e(kn)})},subscribeKey(e,t){return ha(kn,e,t)},initialize(e){e.forEach(t=>{const n=Qe.getConnectedConnectorId(t);n&&Ve.setConnectorId(n,t)})},setActiveConnector(e){e&&(kn.activeConnector=q4(e))},setConnectors(e){e.filter(s=>!kn.allConnectors.some(i=>i.id===s.id&&Ve.getConnectorName(i.name)===Ve.getConnectorName(s.name)&&i.chain===s.chain)).forEach(s=>{s.type!=="MULTI_CHAIN"&&kn.allConnectors.push(q4(s))});const n=Ve.getEnabledNamespaces(),r=Ve.getEnabledConnectors(n);kn.connectors=Ve.mergeMultiChainConnectors(r)},filterByNamespaces(e){Object.keys(kn.filterByNamespaceMap).forEach(t=>{kn.filterByNamespaceMap[t]=!1}),e.forEach(t=>{kn.filterByNamespaceMap[t]=!0}),Ve.updateConnectorsForEnabledNamespaces()},filterByNamespace(e,t){kn.filterByNamespaceMap[e]=t,Ve.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const e=Ve.getEnabledNamespaces(),t=Ve.getEnabledConnectors(e),n=Ve.areAllNamespacesEnabled();kn.connectors=Ve.mergeMultiChainConnectors(t),n?gt.clearFilterByNamespaces():gt.filterByNamespaces(e)},getEnabledNamespaces(){return Object.entries(kn.filterByNamespaceMap).filter(([e,t])=>t).map(([e])=>e)},getEnabledConnectors(e){return kn.allConnectors.filter(t=>e.includes(t.chain))},areAllNamespacesEnabled(){return Object.values(kn.filterByNamespaceMap).every(e=>e)},mergeMultiChainConnectors(e){const t=Ve.generateConnectorMapByName(e),n=[];return t.forEach(r=>{const s=r[0],i=(s==null?void 0:s.id)===Oe.CONNECTOR_ID.AUTH;r.length>1&&s?n.push({name:s.name,imageUrl:s.imageUrl,imageId:s.imageId,connectors:[...r],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:(s==null?void 0:s.id)||""}):s&&n.push(s)}),n},generateConnectorMapByName(e){const t=new Map;return e.forEach(n=>{const{name:r}=n,s=Ve.getConnectorName(r);if(!s)return;const i=t.get(s)||[];
4496i.find(a=>a.chain===n.chain)||i.push(n),t.set(s,i)}),t},getConnectorName(e){return e&&({"Trust Wallet":"Trust"}[e]||e)},getUniqueConnectorsByName(e){const t=[];return e.forEach(n=>{t.find(r=>r.chain===n.chain)||t.push(n)}),t},addConnector(e){var t,n,r;if(e.id===Oe.CONNECTOR_ID.AUTH){const s=e,i=z4(Ot.state),o=iS.getSnapshot().themeMode,a=iS.getSnapshot().themeVariables;(n=(t=s==null?void 0:s.provider)==null?void 0:t.syncDappData)==null||n.call(t,{metadata:i.metadata,sdkVersion:i.sdkVersion,projectId:i.projectId,sdkType:i.sdkType}),(r=s==null?void 0:s.provider)==null||r.syncTheme({themeMode:o,themeVariables:a,w3mThemeVariables:H_(a,o)}),Ve.setConnectors([e])}else Ve.setConnectors([e])},getAuthConnector(e){var r;const t=e||re.state.activeChain,n=kn.connectors.find(s=>s.id===Oe.CONNECTOR_ID.AUTH);if(n)return(r=n==null?void 0:n.connectors)!=null&&r.length?n.connectors.find(i=>i.chain===t):n},getAnnouncedConnectorRdns(){return kn.connectors.filter(e=>e.type==="ANNOUNCED").map(e=>{var t;return(t=e.info)==null?void 0:t.rdns})},getConnectorById(e){return Wa.sortConnectorsByPriority(kn.allConnectors).find(n=>n.id===e)},getConnector({id:e,namespace:t}){const n=t||re.state.activeChain,r=kn.allConnectors.filter(o=>o.chain===n);return Wa.sortConnectorsByPriority(r).find(o=>o.id===e||o.explorerId===e)},syncIfAuthConnector(e){var i,o;if(e.id!=="AUTH")return;const t=e,n=z4(Ot.state),r=iS.getSnapshot().themeMode,s=iS.getSnapshot().themeVariables;(o=(i=t==null?void 0:t.provider)==null?void 0:i.syncDappData)==null||o.call(i,{metadata:n.metadata,sdkVersion:n.sdkVersion,sdkType:n.sdkType,projectId:n.projectId}),t.provider.syncTheme({themeMode:r,themeVariables:s,w3mThemeVariables:H_(s,r)})},getConnectorsByNamespace(e){const t=kn.allConnectors.filter(n=>n.chain===e);return Ve.mergeMultiChainConnectors(t)},canSwitchToSmartAccount(e){return re.checkIfSmartAccountEnabled()&&gm(e)===im.ACCOUNT_TYPES.EOA},selectWalletConnector(e){var s;const t=(s=Kt.state.data)==null?void 0:s.redirectView,n=re.state.activeChain,r=n?Ve.getConnector({id:e.id,namespace:n}):void 0;YBt.handleMobileDeeplinkRedirect((r==null?void 0:r.explorerId)||e.id,re.state.activeChain,{isCoinbaseDisabled:Ot.state.enableCoinbase===!1}),r?Kt.push("ConnectingExternal",{connector:r,wallet:e,redirectView:t}):Kt.push("ConnectingWalletConnect",{wallet:e,redirectView:t})},getConnectors(e){return e?Ve.getConnectorsByNamespace(e):Ve.mergeMultiChainConnectors(kn.allConnectors)},setFilterByNamespace(e){kn.filterByNamespace=e,kn.connectors=Ve.getConnectors(e),gt.setFilterByNamespace(e)},setConnectorId(e,t){e&&(kn.activeConnectorIds={...kn.activeConnectorIds,[t]:e},Qe.setConnectedConnectorId(t,e))},removeConnectorId(e){kn.activeConnectorIds={...kn.activeConnectorIds,[e]:void 0},Qe.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return kn.activeConnectorIds[e]},isConnected(e){return e?!!kn.activeConnectorIds[e]:Object.values(kn.activeConnectorIds).some(t=>!!t)},resetConnectorIds(){kn.activeConnectorIds={...GCe}},extendConnectorsWithExplorerWallets(e){kn.allConnectors.forEach(r=>{const s=e.find(i=>{var o;return i.id===r.id||i.rdns&&i.rdns===((o=r.info)==null?void 0:o.rdns)});s&&(r.explorerWallet=s)});const t=Ve.getEnabledNamespaces(),n=Ve.getEnabledConnectors(t);kn.connectors=Ve.mergeMultiChainConnectors(n)},async connect(e={}){const{namespace:t}=e;return Ve.setFilterByNamespace(t),Kt.push("Connect",{addWalletForNamespace:t}),new Promise((n,r)=>{if(t){const s=re.subscribeChainProp("accountState",o=>{o!=null&&o.caipAddress&&(n({caipAddress:o==null?void 0:o.caipAddress}),s())},t),i=pr.subscribeKey("open",o=>{o||(r(new Error("Modal closed")),i())})}else{const s=re.subscribeKey("activeCaipAddress",o=>{o&&(n({caipAddress:o}),s())}),i=pr.subscribeKey("open",o=>{o||(r(new Error("Modal closed")),i())})}})}},Ve=G0(aDt),cDt=1e3,EE={checkNamespaceConnectorId(e,t){return Ve.getConnectorId(e)===t},isSocialProvider(e){return ei.DEFAULT_REMOTE_FEATURES.socials.includes(e)},connectWalletConnect({walletConnect:e,connector:t,closeModalOnConnect:n=!0,redirectViewOnModalClose:r="Connect",onOpen:s,onConnect:i}){return new Promise((o,a)=>
vendor: 5,086 bytes, line 4496
4496{if(e&&Ve.setActiveConnector(t),s==null||s(ht.isMobile()&&e),r){const l=pr.subscribeKey("open",u=>{u||(Kt.state.view!==r&&Kt.replace(r),l(),a(new Error("Modal closed")))})}const c=re.subscribeKey("activeCaipAddress",l=>{l&&(i==null||i(),n&&pr.close(),c(),o(mr.parseCaipAddress(l)))})})},connectExternal(e){return new Promise((t,n)=>{const r=re.subscribeKey("activeCaipAddress",s=>{s&&(pr.close(),r(),t(mr.parseCaipAddress(s)))});st.connectExternal(e,e.chain).catch(()=>{r(),n(new Error("Connection rejected"))})})},connectSocial({social:e,namespace:t,closeModalOnConnect:n=!0,onOpenFarcaster:r,onConnect:s}){let i,o=!1,a=null;const c=t||re.state.activeChain,l=re.subscribeKey("activeCaipAddress",u=>{u&&(n&&pr.close(),l())});return new Promise((u,d)=>{async function h(g){var p;if((p=g.data)!=null&&p.resultUri)if(g.origin===Oe.SECURE_SITE_SDK_ORIGIN){window.removeEventListener("message",h,!1);try{const m=Ve.getAuthConnector(c);if(m&&!o){i&&i.close(),o=!0;const w=g.data.resultUri;Mn.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:e}}),Qe.setConnectedSocialProvider(e),await st.connectExternal({id:m.id,type:m.type,socialUri:w},m.chain);const C=re.state.activeCaipAddress;if(!C){d(new Error("Failed to connect"));return}u(mr.parseCaipAddress(C)),Mn.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:e}})}}catch(m){Mn.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:e,message:ht.parseError(m)}}),d(new Error("Failed to connect"))}}else Mn.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:e,message:"Untrusted Origin"}})}async function f(){if(Mn.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:e}}),e==="farcaster"){r==null||r();const g=pr.subscribeKey("open",m=>{!m&&e==="farcaster"&&(d(new Error("Popup closed")),s==null||s(),g())}),p=Ve.getAuthConnector();if(p){const m=re.getAccountData(c);if(!(m!=null&&m.farcasterUrl))try{const{url:w}=await p.provider.getFarcasterUri();re.setAccountProp("farcasterUrl",w,c)}catch{d(new Error("Failed to connect to farcaster"))}}}else{const g=Ve.getAuthConnector();a=ht.returnOpenHref(`${Oe.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes");try{if(g){const{uri:p}=await g.provider.getSocialRedirectUri({provider:e});if(a&&p){a.location.href=p,i=a;const m=setInterval(()=>{i!=null&&i.closed&&!o&&(d(new Error("Popup closed")),clearInterval(m))},1e3);window.addEventListener("message",h,!1)}else a==null||a.close(),d(new Error("Failed to initiate social connection"))}}catch{d(new Error("Failed to initiate social connection")),a==null||a.close()}}}f()})},connectEmail({closeModalOnConnect:e=!0,redirectViewOnModalClose:t="Connect",onOpen:n,onConnect:r}){return new Promise((s,i)=>{if(n==null||n(),t){const a=pr.subscribeKey("open",c=>{c||(Kt.state.view!==t&&Kt.replace(t),a(),i(new Error("Modal closed")))})}const o=re.subscribeKey("activeCaipAddress",a=>{a&&(r==null||r(),e&&pr.close(),o(),s(mr.parseCaipAddress(a)))})})},async updateEmail(){const e=Qe.getConnectedConnectorId(re.state.activeChain),t=Ve.getAuthConnector();if(!t)throw new Error("No auth connector found");if(e!==Oe.CONNECTOR_ID.AUTH)throw new Error("Not connected to email or social");const n=t.provider.getEmail()??"";return await pr.open({view:"UpdateEmailWallet",data:{email:n,redirectView:void 0}}),new Promise((r,s)=>{const i=setInterval(()=>{const a=t.provider.getEmail()??"";a!==n&&(pr.close(),clearInterval(i),o(),r({email:a}))},cDt),o=pr.subscribeKey("open",a=>{a||(Kt.state.view!=="Connect"&&Kt.push("Connect"),clearInterval(i),o(),s(new Error("Modal closed")))})})},canSwitchToSmartAccount(e){return re.checkIfSmartAccountEnabled()&&gm(e)===im.ACCOUNT_TYPES.EOA}};function ZCe(){var r,s;const e=((r=re.state.activeCaipNetwork)==null?void 0:r.chainNamespace)||"eip155",t=((s=re.state.activeCaipNetwork)==null?void 0:s.id)||1,n=ei.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${n}`}function zce(e){return ei.NATIVE_TOKEN_ADDRESS[e]}function gm(e){var n;return(n=re.getAccountData(e))==null?void 0:n.preferredAccountType}const YCe={getConnectionStatus(e,t){const n=Ve.state.activeConnectorIds[t],r=st.getConnections(t);return!!n&&e.connectorId===n?"connected":r.some(o=>o.connectorId.toLowerCase()===e.connectorId.toLowerCase())?"active":"disconnected"},excludeConnectorAddressFromConnections({connections:e,connectorId:t,addresses:n}){return e.map(r=>{if((t?r.connectorId.toLowerCase()===t.toLowerCase():!1)&&n){const i=r.accounts.filter(o=>!n.some(c=>c.toLowerCase()===o.address.toLowerCase()));return{...r,accounts:i}}return r})},excludeExistingConnections(e,t){const n=new Set(e);return t.filter(r=>!n.has(r.connectorId))},getConnectionsByConnectorId(e,t){return e.filter(n=>n.connectorId.toLowerCase()===t.toLowerCase())},getConnectionsData(e){var a;const t=!!((a=Ot.state.remoteFeatures)!=null&&a.multiWallet),n=Ve.state.activeConnectorIds[e],r=st.getConnections(e),i=(st.state.recentConnections.get(e)??[]).filter(c=>Ve.getConnectorById(c.connectorId)),o=YCe.excludeExistingConnections([...r.map(c=>
4496c.connectorId),...n?[n]:[]],i);return t?{connections:r,recentConnections:o}:{connections:r.filter(c=>c.connectorId.toLowerCase()===(n==null?void 0:n.toLowerCase())),recentConnections:[]}},onConnectMobile(e,t){const n=st.state.wcUri;if(e!=null&&e.mobile_link&&n)try{st.setWcError(!1);const{mobile_link:r,link_mode:s,name:i}=e,o=ht.appendPayToUri(n,t),{redirect:a,redirectUniversalLink:c,href:l}=ht.formatNativeUrl(r,o,s),u=a,d=c,h=ht.isIframe()?"_top":"_self";st.setWcLinking({name:i,href:l}),st.setRecentWallet(e),Ot.state.experimental_preferUniversalLinks&&d?ht.openHref(d,h):ht.openHref(u,h)}catch(r){Mn.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:r instanceof Error?r.message:"Error parsing the deep link",uri:n,mobile_link:e.mobile_link,name:e.name}}),st.setWcError(!0)}}},Z2=os({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1,connectingWallet:void 0}),Jp={state:Z2,subscribe(e){return Po(Z2,()=>e(Z2))},subscribeOpen(e){return ha(Z2,"open",e)},set(e){Object.assign(Z2,{...Z2,...e})}},Zr=os({transactions:[],transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),lDt={state:Zr,subscribe(e){return Po(Zr,()=>e(Zr))},setLastNetworkInView(e){Zr.lastNetworkInView=e},async fetchTransactions(e){var t;if(!e)throw new Error("Transactions can't be fetched without an accountAddress");Zr.loading=!0;try{const n=await tn.fetchTransactions({account:e,cursor:Zr.next,chainId:(t=re.state.activeCaipNetwork)==null?void 0:t.caipNetworkId}),r=HS.filterSpamTransactions(n.data),s=HS.filterByConnectedChain(r),i=[...Zr.transactions,...s];Zr.loading=!1,Zr.transactions=i,Zr.transactionsByYear=HS.groupTransactionsByYearAndMonth(Zr.transactionsByYear,s),Zr.empty=i.length===0,Zr.next=n.next?n.next:void 0}catch{const r=re.state.activeChain;Mn.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:Ot.state.projectId,cursor:Zr.next,isSmartAccount:gm(r)===im.ACCOUNT_TYPES.SMART_ACCOUNT}}),nl.showError("Failed to fetch transactions"),Zr.loading=!1,Zr.empty=!0,Zr.next=void 0}},groupTransactionsByYearAndMonth(e={},t=[]){const n=e;return t.forEach(r=>{const s=new Date(r.metadata.minedAt).getFullYear(),i=new Date(r.metadata.minedAt).getMonth(),o=n[s]??{},c=(o[i]??[]).filter(l=>l.id!==r.id);n[s]={...o,[i]:[...c,r].sort((l,u)=>new Date(u.metadata.minedAt).getTime()-new Date(l.metadata.minedAt).getTime())}}),n},filterSpamTransactions(e){return e.filter(t=>{var r;return!((r=t.transfers)==null?void 0:r.every(s=>{var i;return((i=s.nft_info)==null?void 0:i.flags.is_spam)===!0}))})},filterByConnectedChain(e){var r;const t=(r=re.state.activeCaipNetwork)==null?void 0:r.caipNetworkId;return e.filter(s=>s.metadata.chain===t)},clearCursor(){Zr.next=void 0},resetTransactions(){Zr.transactions=[],Zr.transactionsByYear={},Zr.lastNetworkInView=void 0,Zr.loading=!1,Zr.empty=!1,Zr.next=void 0}},HS=G0(lDt,"API_ERROR"),en=os({connections:new Map,recentConnections:new Map,isSwitchingConnection:!1,wcError:!1,wcFetchingUri:!1,buffering:!1,status:"disconnected"});let Rg;const uDt={state:en,subscribe(e){return Po(en,()=>e(en))},subscribeKey(e,t){return ha(en,e,t)},_getClient(){return en._client},setClient(e){en._client=q4(e)},initialize(e){const t=e.filter(n=>!!n.namespace).map(n=>n.namespace);st.syncStorageConnections(t)},syncStorageConnections(e){const t=Qe.getConnections(),n=e??Array.from(re.state.chains.keys());for(const r of n){const s=t[r]??[],i=new Map(en.recentConnections);i.set(r,s),en.recentConnections=i}},getConnections(e){return e?en.connections.get(e)??[]:[]},hasAnyConnection(e){const t=st.state.connections;return Array.from(t.values()).flatMap(n=>n).some(({connectorId:n})=>n===e)},async connectWalletConnect({cache:e="auto"}={}){var n,r,s,i;en.wcFetchingUri=!0;const t=ht.isTelegram()||ht.isSafari()&&ht.isIos();try{if(e==="always"||e==="auto"&&t){if(Rg){await Rg,Rg=void 0;return}if(!ht.isPairingExpired(en==null?void 0:en.wcPairingExpiry)){const o=en.wcUri;en.wcUri=o;return}Rg=(r=(n=st._getClient())==null?void 0:n.connectWalletConnect)==null?void 0:r.call(n),st.state.status="connecting",await Rg,Rg=void 0,en.wcPairingExpiry=void 0,st.state.status="connected"}else await((i=(s=st._getClient())==null?void 0:s.connectWalletConnect)==null?void 0:i.call(s))}catch(o){throw en.wcError=!0,en.wcFetchingUri=!1,en.status="disconnected",Rg=void 0,o}},async connectExternal(e,t,n=!0){var o,a,c;const r=await((a=(o=st._getClient())==null?void 0:o.connectExternal)==null?void 0:a.call(o,e));n&&re.setActiveNamespace(t);const s=Ve.state.allConnectors.find(l=>l.id===(e==null?void 0:e.id)),i=e.type==="AUTH"?"email":"browser";return Mn.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:i,name:(s==null?void 0:s.name)||"Unknown",view:Kt.state.view,walletRank:(c=s==null?void 0:s.explorerWallet)==null?void 0:c.order}}),r},async reconnectExternal(e){var n,r;await((r=(n=st._getClient())==null?void 0:n.reconnectExternal)==null?void 0:r.call(n,e));const t=e.chain||re.state.activeChain;t&&Ve.setConnectorId(e.id,t)},async setPreferredAccountType(e,t){var r;if(!t)return;pr.setLoading(!0,re.state.activeChain);const n=Ve.getAuthConnector();n&&(re.setAccountProp("preferredAccountType",e,t),await n.provider.setPreferredAccount(e),Qe.setPreferredAccountTypes(Object.entries(re.state.chains).reduce((s,[i,o])=>{const a=i,c=gm(a);return c!==void 0&&(s[a]=c),s},{}
4496)),await st.reconnectExternal(n),pr.setLoading(!1,re.state.activeChain),Mn.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:((r=re.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}}))},async signMessage(e){var t;return(t=st._getClient())==null?void 0:t.signMessage(e)},parseUnits(e,t){var n;return(n=st._getClient())==null?void 0:n.parseUnits(e,t)},formatUnits(e,t){var n;return(n=st._getClient())==null?void 0:n.formatUnits(e,t)},updateBalance(e){var t;return(t=st._getClient())==null?void 0:t.updateBalance(e)},async sendTransaction(e){var t;return(t=st._getClient())==null?void 0:t.sendTransaction(e)},async getCapabilities(e){var t;return(t=st._getClient())==null?void 0:t.getCapabilities(e)},async grantPermissions(e){var t;return(t=st._getClient())==null?void 0:t.grantPermissions(e)},async walletGetAssets(e){var t;return((t=st._getClient())==null?void 0:t.walletGetAssets(e))??{}},async estimateGas(e){var t;return(t=st._getClient())==null?void 0:t.estimateGas(e)},async writeContract(e){var t;return(t=st._getClient())==null?void 0:t.writeContract(e)},async writeSolanaTransaction(e){var t;return(t=st._getClient())==null?void 0:t.writeSolanaTransaction(e)},async getEnsAddress(e){var t;return(t=st._getClient())==null?void 0:t.getEnsAddress(e)},async getEnsAvatar(e){var t;return(t=st._getClient())==null?void 0:t.getEnsAvatar(e)},checkInstalled(e){var t,n;return((n=(t=st._getClient())==null?void 0:t.checkInstalled)==null?void 0:n.call(t,e))||!1},resetWcConnection(){en.wcUri=void 0,en.wcPairingExpiry=void 0,en.wcLinking=void 0,en.recentWallet=void 0,en.wcFetchingUri=!1,en.status="disconnected",HS.resetTransactions(),Qe.deleteWalletConnectDeepLink(),Qe.deleteRecentWallet(),Jp.set({connectingWallet:void 0})},resetUri(){en.wcUri=void 0,en.wcPairingExpiry=void 0,Rg=void 0,en.wcFetchingUri=!1,Jp.set({connectingWallet:void 0})},finalizeWcConnection(e){var r,s;const{wcLinking:t,recentWallet:n}=st.state;t&&Qe.setWalletConnectDeepLink(t),n&&Qe.setAppKitRecent(n),e&&Mn.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:e,properties:{method:t?"mobile":"qrcode",name:((s=(r=Kt.state.data)==null?void 0:r.wallet)==null?void 0:s.name)||"Unknown",view:Kt.state.view,walletRank:n==null?void 0:n.order}})},setWcBasic(e){en.wcBasic=e},setUri(e){en.wcUri=e,en.wcFetchingUri=!1,en.wcPairingExpiry=ht.getPairingExpiry()},setWcLinking(e){en.wcLinking=e},setWcError(e){en.wcError=e,en.wcFetchingUri=!1,en.buffering=!1},setRecentWallet(e){en.recentWallet=e},setBuffering(e){en.buffering=e},setStatus(e){en.status=e},setIsSwitchingConnection(e){en.isSwitchingConnection=e},async disconnect({id:e,namespace:t,initialDisconnect:n}={}){var r;try{await((r=st._getClient())==null?void 0:r.disconnect({id:e,chainNamespace:t,initialDisconnect:n}))}catch(s){throw new Fy("Failed to disconnect","INTERNAL_SDK_ERROR",s)}},async disconnectConnector({id:e,namespace:t}){var n;try{await((n=st._getClient())==null?void 0:n.disconnectConnector({id:e,namespace:t}))}catch(r){throw new Fy("Failed to disconnect connector","INTERNAL_SDK_ERROR",r)}},setConnections(e,t){const n=new Map(en.connections);n.set(t,e),en.connections=n},async handleAuthAccountSwitch({address:e,namespace:t}){var i,o;const n=re.getAccountData(t),r=(o=(i=n==null?void 0:n.user)==null?void 0:i.accounts)==null?void 0:o.find(a=>a.type==="smartAccount"),s=r&&r.address.toLowerCase()===e.toLowerCase()&&EE.canSwitchToSmartAccount(t)?"smartAccount":"eoa";await st.setPreferredAccountType(s,t)},async handleActiveConnection({connection:e,namespace:t,address:n}){const r=Ve.getConnectorById(e.connectorId),s=e.connectorId===Oe.CONNECTOR_ID.AUTH;if(!r)throw new Error(`No connector found for connection: ${e.connectorId}`);if(s)n&&await st.handleAuthAccountSwitch({address:n,namespace:t});else{const i=await st.connectExternal({id:r.id,type:r.type,provider:r.provider,address:n,chain:t},t);return i==null?void 0:i.address}return n},async handleDisconnectedConnection({connection:e,namespace:t,address:n,closeModalOnConnect:r}){var l,u;const s=Ve.getConnectorById(e.connectorId),i=(u=(l=e.auth)==null?void 0:l.name)==null?void 0:u.toLowerCase(),o=e.connectorId===Oe.CONNECTOR_ID.AUTH,a=e.connectorId===Oe.CONNECTOR_ID.WALLET_CONNECT;if(!s)throw new Error(`No connector found for connection: ${e.connectorId}`);let c;if(o)if(i&&EE.isSocialProvider(i)){const{address:d}=await EE.connectSocial({social:i,closeModalOnConnect:r,onOpenFarcaster(){pr.open({view:"ConnectingFarcaster"})},onConnect(){Kt.replace("ProfileWallets")}});c=d}else{const{address:d}=await EE.connectEmail({closeModalOnConnect:r,onOpen(){pr.open({view:"EmailLogin"})},onConnect(){Kt.replace("ProfileWallets")}});c=d}else if(a){const{address:d}=await EE.connectWalletConnect({walletConnect:!0,connector:s,closeModalOnConnect:r,onOpen(h){const f=h?"AllWallets":"ConnectingWalletConnect";pr.state.open?Kt.push(f):pr.open({view:f})},onConnect(){Kt.replace("ProfileWallets")}});c=d}else{const d=await st.connectExternal({id:s.id,type:s.type,provider:s.provider,chain:t},t);d&&(c=d.address)}return o&&n&&await st.handleAuthAccountSwitch({address:n,namespace:t}),c},async switchConnection({connection:e,address:t,namespace:n,closeModalOnConnect:r,onChange:s}){var c;let i;const o=(c=re.getAccountData(n))==null?void 0:c.caipAddress;if(o){const{address:l}=mr.parseCaipAddress(o);i=l}
4496const a=YCe.getConnectionStatus(e,n);switch(a){case"connected":case"active":{const l=await st.handleActiveConnection({connection:e,namespace:n,address:t});if(i&&l){const u=l.toLowerCase()!==i.toLowerCase();s==null||s({address:l,namespace:n,hasSwitchedAccount:u,hasSwitchedWallet:a==="active"})}break}case"disconnected":{const l=await st.handleDisconnectedConnection({connection:e,namespace:n,address:t,closeModalOnConnect:r});l&&(s==null||s({address:l,namespace:n,hasSwitchedAccount:!0,hasSwitchedWallet:!0}));break}default:throw new Error(`Invalid connection status: ${a}`)}}},st=G0(uDt),uU={createBalance(e,t){const n={name:e.metadata.name||"",symbol:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:n.name,symbol:n.symbol,chainId:t,address:e.address==="native"?void 0:this.convertAddressToCAIP10Address(e.address,t),value:n.value,price:n.price,quantity:{decimals:n.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:n.decimals})},iconUrl:n.iconUrl}},convertHexToBalance({hex:e,decimals:t}){return V$(BigInt(e),t)},convertAddressToCAIP10Address(e,t){return`${t}:${e}`},createCAIP2ChainId(e,t){return`${t}:${parseInt(e,16)}`},getChainIdHexFromCAIP2ChainId(e){const t=e.split(":");if(t.length<2||!t[1])return"0x0";const n=t[1],r=parseInt(n,10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return typeof e!="object"||e===null?!1:Object.values(e).every(t=>Array.isArray(t)&&t.every(n=>this.isValidAsset(n)))},isValidAsset(e){return typeof e=="object"&&e!==null&&typeof e.address=="string"&&typeof e.balance=="string"&&(e.type==="ERC20"||e.type==="NATIVE")&&typeof e.metadata=="object"&&e.metadata!==null&&typeof e.metadata.name=="string"&&typeof e.metadata.symbol=="string"&&typeof e.metadata.decimals=="number"&&typeof e.metadata.price=="number"&&typeof e.metadata.iconUrl=="string"}};let dU;async function qce(){if(!dU){const{createPublicClient:e,http:t,defineChain:n}=await te(async()=>{const{createPublicClient:r,http:s,defineChain:i}=await Promise.resolve().then(()=>FBt);return{createPublicClient:r,http:s,defineChain:i}},void 0);dU={createPublicClient:e,http:t,defineChain:n}}return dU}const eq={getBlockchainApiRpcUrl(e,t){const n=new URL("https://rpc.walletconnect.org/v1/");return n.searchParams.set("chainId",e),n.searchParams.set("projectId",t),n.toString()},async getViemChain(e){const{defineChain:t}=await qce(),{chainId:n}=mr.parseCaipNetworkId(e.caipNetworkId);return t({...e,id:Number(n)})},async createViemPublicClient(e){const{createPublicClient:t,http:n}=await qce(),r=Ot.state.projectId,s=await eq.getViemChain(e);if(!s)throw new Error(`Chain ${e.caipNetworkId} not found in viem/chains`);return t({chain:s,transport:n(eq.getBlockchainApiRpcUrl(e.caipNetworkId,r))})}},kP={async getMyTokensWithBalance(e={forceUpdate:void 0,caipNetwork:re.state.activeCaipNetwork,address:(t=>(t=re.getAccountData())==null?void 0:t.address)()}){const{forceUpdate:n,caipNetwork:r,address:s}=e,i=Ve.getConnectorId("eip155")===Oe.CONNECTOR_ID.AUTH;if(!s)return[];const o=r?`${r.caipNetworkId}:${s}`:s,a=Qe.getBalanceCacheForCaipAddress(o);if(a)return a.balances;if(r&&r.chainNamespace===Oe.CHAIN.EVM&&i){const l=await this.getEIP155Balances(s,r);if(l)return this.filterLowQualityTokens(l)}const c=await tn.getBalance(s,r==null?void 0:r.caipNetworkId,n);return this.filterLowQualityTokens(c.balances)},async getEIP155Balances(e,t){var n,r;try{const s=uU.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await st.getCapabilities(e);if(!((r=(n=i==null?void 0:i[s])==null?void 0:n.assetDiscovery)!=null&&r.supported))return null;const o=await st.walletGetAssets({account:e,chainFilter:[s]});if(!uU.isWalletGetAssetsResponse(o))return null;const c=(o[s]||[]).map(l=>uU.createBalance(l,t.caipNetworkId));return Qe.updateBalanceCache({caipAddress:`${t.caipNetworkId}:${e}`,balance:{balances:c},timestamp:Date.now()}),c}catch{return null}},filterLowQualityTokens(e){return e.filter(t=>t.quantity.decimals!=="0")},async fetchERC20Balance({caipAddress:e,assetAddress:t,caipNetwork:n}){const r=await eq.createViemPublicClient(n),{address:s}=mr.parseCaipAddress(e),[{result:i},{result:o},{result:a},{result:c}]=await r.multicall({contracts:[{address:t,functionName:"name",args:[],abi:YE},{address:t,functionName:"symbol",args:[],abi:YE},{address:t,functionName:"balanceOf",args:[s],abi:YE},{address:t,functionName:"decimals",args:[],abi:YE}]});return{name:i,symbol:o,decimals:c,balance:a&&c?V$(a,c):"0"}}},hU={adapters:{}},dDt={state:hU,initialize(e){hU.adapters={...e}},get(e){return hU.adapters[e]}},fN={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:void 0,tron:void 0},Ua=os({providers:{...fN},providerIds:{...fN}}),JCe={state:Ua,subscribeKey(e,t){return ha(Ua,e,t)},subscribe(e){return Po(Ua,()=>{e(Ua)})},subscribeProviders(e){return Po(Ua.providers,()=>e(Ua.providers))},setProvider(e,t){e&&t&&(Ua.providers[e]=q4(t))},getProvider(e){if(e)return Ua.providers[e]},setProviderId(e,t){t&&(Ua.providerIds[e]=t)},getProviderId(e){if(e)return Ua.providerIds[e]},reset(){Ua.providers={...fN},Ua.providerIds={...fN}},resetChain(e){Ua.providers[e]=void 0,Ua.providerIds[e]=void 0}},hDt={async getTokenList(e){var r;const t=await tn.fetchSwapTokens({chainId:e});return((r=t==null?void 0:t.tokens)==null?void 0:r.map(s=>({...s,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0})))||[]},async fetchGasPrice(){var t;const e=re.state.activeCaipNetwork;if(!e)return null;try{switch(e.chainNamespace){case"solana":const n=(t=await(st==null?void 0:st.estimateGas({chainNamespace:"solana"})))==null?void 0:t.toString();return{standard:n,fast:n,instant:n};case"eip155":default:return await tn.fetchGasPrice({chainId:e.caipNetworkId})}}catch{return null}},async fetchSwapAllowance({tokenAddress:e,userAddress:t,sourceTokenAmount:n,sourceTokenDecimals:r}){const s=await tn.fetchSwapAllowance({tokenAddress:e,userAddress:t});if(s!=null&&s.allowance&&n&&r){const i=st.parseUnits(n,r)||0;return BigInt(s.allowance)>=i}return!1},async getMyTokensWithBalance(e){var n;const t=await kP.getMyTokensWithBalance({forceUpdate:e,caipNetwork:re.state.activeCaipNetwork,address:(n=re.getAccountData())==null?void 0:n.address});return re.setAccountProp("tokenBalance",t,re.state.activeChain),this.mapBalancesToSwapTokens(t)},mapBalancesToSwapTokens(e){return(e==null?void 0:e.map(t=>({...t,address:t!=null&&t.address?t.address:ZCe(),decimals:parseInt(t.quantity.decimals,10),logoUri:t.iconUrl,eip2612:!1})))||[]},async handleSwapError(e){var t,n;try{const r=e==null?void 0:e.cause;if(!(r!=null&&r.json))return;const s=await r.json(),i=(n=(t=s==null?void 0:s.reasons)==null?void 0:t[0])==null?void 0:n.description;return i!=null&&i.includes("insufficient liquidity")?"Insufficient liquidity":void 0}catch{return}}},Rn=os({tokenBalances:[],loading:!1}),fDt={state:Rn,subscribe(e){return Po(Rn,()=>e(Rn))},subscribeKey(e,t){return ha(Rn,e,t)},setToken(e){e&&(Rn.token=q4(e))},setTokenAmount(e){Rn.sendTokenAmount=e},setReceiverAddress(e){Rn.receiverAddress=e},setReceiverProfileImageUrl(e){Rn.receiverProfileImageUrl=e},setReceiverProfileName(e){Rn.receiverProfileName=e},setNetworkBalanceInUsd(e){Rn.networkBalanceInUSD=e},setLoading(e){Rn.loading=e},getSdkEventProperties(e){var t,n;return{message:ht.parseError(e),isSmartAccount:gm(re.state.activeChain)===im.ACCOUNT_TYPES.SMART_ACCOUNT,token:((t=Rn.token)==null?void 0:t.symbol)||"",amount:Rn.sendTokenAmount??0,network:((n=re.state.activeCaipNetwork)==null?void 0:n.caipNetworkId)||""}},async sendToken(){var e;
4496try{switch(un.setLoading(!0),(e=re.state.activeCaipNetwork)==null?void 0:e.chainNamespace){case"eip155":await un.sendEvmToken();return;case"solana":await un.sendSolanaToken();return;default:throw new Error("Unsupported chain")}}catch(t){throw Hp.isUserRejectedRequestError(t)?new GTt(t):t}finally{un.setLoading(!1)}},async sendEvmToken(){var n,r,s;const e=re.state.activeChain;if(!e)throw new Error("SendController:sendEvmToken - activeChainNamespace is required");const t=gm(e);if(!un.state.sendTokenAmount||!un.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!un.state.token)throw new Error("A token is required");if((n=un.state.token)!=null&&n.address){Mn.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===im.ACCOUNT_TYPES.SMART_ACCOUNT,token:un.state.token.address,amount:un.state.sendTokenAmount,network:((r=re.state.activeCaipNetwork)==null?void 0:r.caipNetworkId)||""}});const{hash:i}=await un.sendERC20Token({receiverAddress:un.state.receiverAddress,tokenAddress:un.state.token.address,sendTokenAmount:un.state.sendTokenAmount,decimals:un.state.token.quantity.decimals});i&&(Rn.hash=i)}else{Mn.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===im.ACCOUNT_TYPES.SMART_ACCOUNT,token:un.state.token.symbol||"",amount:un.state.sendTokenAmount,network:((s=re.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||""}});const{hash:i}=await un.sendNativeToken({receiverAddress:un.state.receiverAddress,sendTokenAmount:un.state.sendTokenAmount,decimals:un.state.token.quantity.decimals});i&&(Rn.hash=i)}},async fetchTokenBalance(e){var o,a,c;Rn.loading=!0;const t=re.state.activeChain,n=(o=re.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,r=(a=re.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=((c=re.getAccountData(t))==null?void 0:c.caipAddress)??re.state.activeCaipAddress,i=s?ht.getPlainAddress(s):void 0;if(Rn.lastRetry&&!ht.isAllowedRetry(Rn.lastRetry,30*ei.ONE_SEC_MS))return Rn.loading=!1,[];try{if(i&&n&&r){const l=await kP.getMyTokensWithBalance();return Rn.tokenBalances=l,Rn.lastRetry=void 0,l}}catch(l){Rn.lastRetry=Date.now(),e==null||e(l),nl.showError("Token Balance Unavailable")}finally{Rn.loading=!1}return[]},fetchNetworkBalance(){if(Rn.tokenBalances.length===0)return;const e=hDt.mapBalancesToSwapTokens(Rn.tokenBalances);if(!e)return;const t=e.find(n=>n.address===ZCe());t&&(Rn.networkBalanceInUSD=t?Io.multiply(t.quantity.numeric,t.price).toString():"0")},async sendNativeToken(e){var o,a,c,l;Kt.pushTransactionStack({});const t=e.receiverAddress,n=(o=re.getAccountData())==null?void 0:o.address,r=st.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals)),i=await st.sendTransaction({chainNamespace:Oe.CHAIN.EVM,to:t,address:n,data:"0x",value:r??BigInt(0)});return Mn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:gm("eip155")===im.ACCOUNT_TYPES.SMART_ACCOUNT,token:((a=un.state.token)==null?void 0:a.symbol)||"",amount:e.sendTokenAmount,network:((c=re.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",hash:i||""}}),(l=st._getClient())==null||l.updateBalance("eip155"),un.resetSend(),{hash:i}},async sendERC20Token(e){var r,s,i;Kt.pushTransactionStack({onSuccess(){Kt.replace("Account")}});const t=st.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals)),n=(r=re.getAccountData())==null?void 0:r.address;if(n&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){const o=ht.getPlainAddress(e.tokenAddress);if(!o)throw new Error("SendController:sendERC20Token - tokenAddress is required");const a=await st.writeContract({fromAddress:n,tokenAddress:o,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:e8e.getERC20Abi(o),chainNamespace:Oe.CHAIN.EVM});return Mn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:gm("eip155")===im.ACCOUNT_TYPES.SMART_ACCOUNT,token:((s=un.state.token)==null?void 0:s.symbol)||"",amount:e.sendTokenAmount,network:((i=re.state.activeCaipNetwork)==null?void 0:i.caipNetworkId)||"",hash:a||""}}),un.resetSend(),{hash:a}}return{hash:void 0}},async sendSolanaToken(){var n,r,s;if(!un.state.sendTokenAmount||!un.state.receiverAddress)throw new Error("An amount and receiver address are required");Kt.pushTransactionStack({onSuccess(){Kt.replace("Account")}});let e;un.state.token&&un.state.token.address!==ei.SOLANA_NATIVE_TOKEN_ADDRESS&&(ht.isCaipAddress(un.state.token.address)?e=ht.getPlainAddress(un.state.token.address):e=un.state.token.address);const t=await st.sendTransaction({chainNamespace:"solana",tokenMint:e,to:un.state.receiverAddress,value:un.state.sendTokenAmount});t&&(Rn.hash=t),(n=st._getClient())==null||n.updateBalance("solana"),Mn.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:!1,token:((r=un.state.token)==null?void 0:r.symbol)||"",amount:un.state.sendTokenAmount,network:((s=re.state.activeCaipNetwork)==null?void 0:s.caipNetworkId)||"",hash:t||""}}),un.resetSend()},resetSend(){Rn.token=void 0,Rn.sendTokenAmount=void 0,Rn.receiverAddress=void 0,Rn.receiverProfileImageUrl=void 0,Rn.receiverProfileName=void 0,Rn.loading=!1,Rn.tokenBalances=[]}},un=G0(fDt),fU={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,user:void 0,preferredAccountType:void 0},oS={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},Ze=os({chains:aPt(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter
4496:{connectionControllerClient:void 0},isSwitchingNamespace:!1}),XCe={state:Ze,subscribe(e){return Po(Ze,()=>{e(Ze)})},subscribeKey(e,t){return ha(Ze,e,t)},subscribeAccountStateProp(e,t,n){var s;const r=n||Ze.activeChain;return r?ha(((s=Ze.chains.get(r))==null?void 0:s.accountState)||{},e,t):()=>{}},subscribeChainProp(e,t,n){let r;return Po(Ze.chains,()=>{var i;const s=n||Ze.activeChain;if(s){const o=(i=Ze.chains.get(s))==null?void 0:i[e];r!==o&&(r=o,t(o))}})},initialize(e,t,n){const{chainId:r,namespace:s}=Qe.getActiveNetworkProps(),i=t==null?void 0:t.find(u=>u.id.toString()===(r==null?void 0:r.toString())),a=e.find(u=>(u==null?void 0:u.namespace)===s)||(e==null?void 0:e[0]),c=e.map(u=>u.namespace).filter(u=>u!==void 0),l=Ot.state.enableEmbedded?new Set([...c]):new Set([...(t==null?void 0:t.map(u=>u.chainNamespace))??[]]);((e==null?void 0:e.length)===0||!a)&&(Ze.noAdapters=!0),Ze.noAdapters||(Ze.activeChain=a==null?void 0:a.namespace,Ze.activeCaipNetwork=i,re.setChainNetworkData(a==null?void 0:a.namespace,{caipNetwork:i}),Ze.activeChain&&Jp.set({activeChain:a==null?void 0:a.namespace})),l.forEach(u=>{const d=t==null?void 0:t.filter(g=>g.chainNamespace===u),h=Qe.getPreferredAccountTypes()||{},f={...Ot.state.defaultAccountTypes,...h};re.state.chains.set(u,{namespace:u,networkState:os({...oS,caipNetwork:d==null?void 0:d[0]}),accountState:os({...fU,preferredAccountType:f[u]}),caipNetworks:d??[],...n}),re.setRequestedCaipNetworks(d??[],u)})},removeAdapter(e){var t,n;if(Ze.activeChain===e){const r=Array.from(Ze.chains.entries()).find(([s])=>s!==e);if(r){const s=(n=(t=r[1])==null?void 0:t.caipNetworks)==null?void 0:n[0];s&&re.setActiveCaipNetwork(s)}}Ze.chains.delete(e)},addAdapter(e,{connectionControllerClient:t},n){if(!e.namespace)throw new Error("ChainController:addAdapter - adapter must have a namespace");Ze.chains.set(e.namespace,{namespace:e.namespace,networkState:{...oS,caipNetwork:n[0]},accountState:{...fU},caipNetworks:n,connectionControllerClient:t}),re.setRequestedCaipNetworks((n==null?void 0:n.filter(r=>r.chainNamespace===e.namespace))??[],e.namespace)},addNetwork(e){var n;const t=Ze.chains.get(e.chainNamespace);if(t){const r=[...t.caipNetworks||[]];(n=t.caipNetworks)!=null&&n.find(s=>s.id===e.id)||r.push(e),Ze.chains.set(e.chainNamespace,{...t,caipNetworks:r}),re.setRequestedCaipNetworks(r,e.chainNamespace),Ve.filterByNamespace(e.chainNamespace,!0)}},removeNetwork(e,t){var r,s,i;const n=Ze.chains.get(e);if(n){const o=((r=Ze.activeCaipNetwork)==null?void 0:r.id)===t,a=[...((s=n.caipNetworks)==null?void 0:s.filter(c=>c.id!==t))||[]];o&&((i=n==null?void 0:n.caipNetworks)!=null&&i[0])&&re.setActiveCaipNetwork(n.caipNetworks[0]),Ze.chains.set(e,{...n,caipNetworks:a}),re.setRequestedCaipNetworks(a||[],e),a.length===0&&Ve.filterByNamespace(e,!1)}},setAdapterNetworkState(e,t){const n=Ze.chains.get(e);n&&(n.networkState={...n.networkState||oS,...t},Ze.chains.set(e,n))},setChainAccountData(e,t,n=!0){if(!e)throw new Error("Chain is required to update chain account data");const r=Ze.chains.get(e);if(r){const s={...r.accountState||fU,...t};Ze.chains.set(e,{...r,accountState:s}),(Ze.chains.size===1||Ze.activeChain===e)&&t.caipAddress&&(Ze.activeCaipAddress=t.caipAddress)}},setChainNetworkData(e,t){if(!e)return;const n=Ze.chains.get(e);if(n){const r={...n.networkState||oS,...t};Ze.chains.set(e,{...n,networkState:r})}},setAccountProp(e,t,n,r=!0){re.setChainAccountData(n,{[e]:t},r)},setActiveNamespace(e){var r,s;Ze.activeChain=e;const t=e?Ze.chains.get(e):void 0,n=(r=t==null?void 0:t.networkState)==null?void 0:r.caipNetwork;n!=null&&n.id&&e&&(Ze.activeCaipAddress=(s=t==null?void 0:t.accountState)==null?void 0:s.caipAddress,Ze.activeCaipNetwork=n,re.setChainNetworkData(e,{caipNetwork:n}),Qe.setActiveCaipNetworkId(n==null?void 0:n.caipNetworkId),Jp.set({activeChain:e,selectedNetworkId:n==null?void 0:n.caipNetworkId}))},setActiveCaipNetwork(e){var i,o;if(!e)return;const t=Ze.activeChain===e.chainNamespace;t||re.setIsSwitchingNamespace(!0);const n=Ze.chains.get(e.chainNamespace);Ze.activeChain=e.chainNamespace,Ze.activeCaipNetwork=e,re.setChainNetworkData(e.chainNamespace,{caipNetwork:e});let r=(i=n==null?void 0:n.accountState)==null?void 0:i.address;if(r)Ze.activeCaipAddress=`${e.chainNamespace}:${e.id}:${r}`;else if(t&&Ze.activeCaipAddress){const{address:a}=mr.parseCaipAddress(Ze.activeCaipAddress);r=a,Ze.activeCaipAddress=`${e.caipNetworkId}:${r}`}else Ze.activeCaipAddress=void 0;re.setChainAccountData(e.chainNamespace,{address:r,caipAddress:Ze.activeCaipAddress}),un.resetSend(),Jp.set({activeChain:Ze.activeChain,selectedNetworkId:(o=Ze.activeCaipNetwork)==null?void 0:o.caipNetworkId}),Qe.setActiveCaipNetworkId(e.caipNetworkId),!re.checkIfSupportedNetwork(e.chainNamespace)&&Ot.state.enableNetworkSwitch&&!Ot.state.allowUnsupportedChain&&!st.state.wcBasic&&re.showUnsupportedChainUI()},addCaipNetwork(e){var n;if(!e)return;const t=Ze.chains.get(e.chainNamespace);t&&((n=t==null?void 0:t.caipNetworks)==null||n.push(e))},async switchActiveNamespace(e){var s;if(!e)return;const t=e!==re.state.activeChain,n=(s=re.getNetworkData(e))==null?void 0:s.caipNetwork,r=re.getCaipNetworkByNamespace(e,n==null?void 0:n.id);t&&r&&await re.switchActiveNetwork(r)},async switchActiveNetwork(e,{throwOnFailure:t=!1}={}){var o;const n=re.state.activeChain;if(!n)throw new Error("ChainController:switchActiveNetwork - namespace is required");const r=JCe.getProviderId(Ze.activeChain)==="AUTH",s=(o=re.getAccountData(n))==null?void 0:o.address,i=Oe.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e.chainNamespace);try{if(s&&e.chainNamespace===n||r&&i){const a=dDt.get(e.chainNamespace);if(!a)throw new Error("Adapter not found");await a.switchNetwork({caipNetwork:e})}re.setActiveCaipNetwork(e)}catch(a){if(t)throw a}Mn.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}})},getConnectionControllerClient(e){const t=e||Ze.activeChain;if(!t)throw new Error("Chain is required to get connection controller client");const n=Ze.chains.get(t);if(!(n!=null&&n.connectionControllerClient))throw new Error("ConnectionController client not set");return n.connectionControllerClient},getNetworkProp(e,t){var r;const n=(r=Ze.chains.get(t))==null?void 0:r.networkState;if(n)return n[e]},getRequestedCaipNetworks(e){const t=Ze.chains.get(e),{approvedCaipNetworkIds:n=[],requestedCaipNetworks:r=[]}=(t==null?void 0:t.networkState)||{};return ht.sortRequestedNetworks(n,r).filter(o=>o==null?void 0:o.id)},getAllRequestedCaipNetworks(){const e=[];return Ze.chains.forEach(t=>{if(!t.namespace)throw new Error("ChainController:getAllRequestedCaipNetworks - chainAdapter must have a namespace");const n=re.getRequestedCaipNetworks(t.namespace);e.push(...n)}),e},setRequestedCaipNetworks(e,t){re.setAdapterNetworkState(t,{requestedCaipNetworks:e});const r=re.getAllRequestedCaipNetworks().map(i=>i.chainNamespace),s=Array.from(new Set(r));Ve.filterByNamespaces(s)},getAllApprovedCaipNetworkIds(){const e=[];return Ze.chains.forEach(t=>{if(!t.namespace)throw new Error("ChainController:getAllApprovedCaipNetworkIds - chainAdapter must have a namespace");const n=re.getApprovedCaipNetworkIds(t.namespace);e.push(...n)}),e},getActiveCaipNetwork(e){var t,n;return e?(n=(t=Ze.chains.get(e))==null?void 0:t.networkState)==null?void 0:n.caipNetwork:Ze.activeCaipNetwork},getActiveCaipAddress(){return Ze.activeCaipAddress},getApprovedCaipNetworkIds(e){var r;const t=Ze.chains.get(e);return((r=t==null?void 0:t.networkState)==null?void 0:r.approvedCaipNetworkIds)||[]},setApprovedCaipNetworksData(e,t){re.setAdapterNetworkState(e,t)},checkIfSupportedNetwork(e,t){var s;const n=t||((s=Ze.activeCaipNetwork)==null?void 0:s.caipNetworkId),r=re.getRequestedCaipNetworks(e);return r.length?r==null?void 0:r.some(i=>i.caipNetworkId===n):!0},checkIfSupportedChainId(e){if(!Ze.activeChain)return!0;const t=re.getRequestedCaipNetworks(Ze.activeChain);return t==null?void 0:t.some(n=>n.id===e)},checkIfSmartAccountEnabled(){var r,s;const e=qTt.caipNetworkIdToNumber((r=Ze.activeCaipNetwork)==null?void 0:r.caipNetworkId);if(!Ze.activeChain||!e)return!1;const n=((s=cPt.get(qS.SMART_ACCOUNT_ENABLED_NETWORKS))==null?void 0:s.split(","))||[];return!!(n!=null&&n.includes(e.toString()))},showUnsupportedChainUI(){pr.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const e=Ze.activeCaipNetwork;return!!(e!=null&&e.chainNamespace&&ei.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){re.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})},resetAccount(e){var s,i;const t=e;if(!t)throw new Error("Chain is required to set account prop");const n=(i=(s=re.state.chains.get(t))==null?void 0:s.accountState)==null?void 0:i.preferredAccountType,r=Ot.state.defaultAccountTypes[t];Ze.activeCaipAddress=void 0,re.setChainAccountData(t,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol
4496:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:r||n,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,user:void 0,status:"disconnected"}),Ve.removeConnectorId(t)},setIsSwitchingNamespace(e){Ze.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){var n,r;const e=[];let t;if(Ze.chains.forEach(s=>{Oe.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(i=>i===s.namespace)&&s.namespace&&e.push(s.namespace)}),e.length>0){const s=e[0];return t=s?(r=(n=Ze.chains.get(s))==null?void 0:n.caipNetworks)==null?void 0:r[0]:void 0,t}},getAccountData(e){var n;const t=e||Ze.activeChain;if(t)return(n=re.state.chains.get(t))==null?void 0:n.accountState},getNetworkData(e){var n;const t=e||Ze.activeChain;if(t)return(n=re.state.chains.get(t))==null?void 0:n.networkState},getCaipNetworkByNamespace(e,t){var s,i,o;if(!e)return;const n=re.state.chains.get(e),r=(s=n==null?void 0:n.caipNetworks)==null?void 0:s.find(a=>a.id.toString()===(t==null?void 0:t.toString()));return r||((i=n==null?void 0:n.networkState)==null?void 0:i.caipNetwork)||((o=n==null?void 0:n.caipNetworks)==null?void 0:o[0])},getRequestedCaipNetworkIds(){const e=Ve.state.filterByNamespace;return(e?[Ze.chains.get(e)]:Array.from(Ze.chains.values())).flatMap(n=>(n==null?void 0:n.caipNetworks)||[]).map(n=>n.caipNetworkId)},getCaipNetworks(e){return e?re.getRequestedCaipNetworks(e):re.getAllRequestedCaipNetworks()},getCaipNetworkById(e,t){return XCe.getCaipNetworks(t).find(n=>n.id.toString()===e.toString()||n.caipNetworkId.toString()===e.toString())},setLastConnectedSIWECaipNetwork(e){Ze.lastConnectedSIWECaipNetwork=e},getLastConnectedSIWECaipNetwork(){return Ze.lastConnectedSIWECaipNetwork},async fetchTokenBalance(e){var o,a;const t=re.getAccountData();if(!t)return[];const n=(o=re.state.activeCaipNetwork)==null?void 0:o.caipNetworkId,r=(a=re.state.activeCaipNetwork)==null?void 0:a.chainNamespace,s=re.state.activeCaipAddress,i=s?ht.getPlainAddress(s):void 0;if(re.setAccountProp("balanceLoading",!0,r),t.lastRetry&&!ht.isAllowedRetry(t.lastRetry,30*ei.ONE_SEC_MS))return re.setAccountProp("balanceLoading",!1,r),[];try{if(i&&n&&r){const c=await kP.getMyTokensWithBalance();return re.setAccountProp("tokenBalance",c,r),re.setAccountProp("lastRetry",void 0,r),re.setAccountProp("balanceLoading",!1,r),c}}catch(c){re.setAccountProp("lastRetry",Date.now(),r),e==null||e(c),nl.showError("Token Balance Unavailable")}finally{re.setAccountProp("balanceLoading",!1,r)}return[]},isCaipNetworkDisabled(e){var c;const t=e.chainNamespace,n=!!((c=re.getAccountData(t))!=null&&c.caipAddress),r=re.getAllApprovedCaipNetworkIds(),s=re.getNetworkProp("supportsAllNetworks",t)!==!1,i=Ve.getConnectorId(t),o=Ve.getAuthConnector(),a=i===Oe.CONNECTOR_ID.AUTH&&o;return!n||s||a?!1:!(r!=null&&r.includes(e.caipNetworkId))}},re=G0(XCe),pDt={onSwitchNetwork({network:e,ignoreSwitchConfirmation:t=!1}){var h,f;const n=re.state.activeCaipNetwork,r=re.state.activeChain,s=Kt.state.data;if(e.id===(n==null?void 0:n.id))return;const o=!!((h=re.getAccountData(r))!=null&&h.address),a=!!((f=re.getAccountData(e.chainNamespace))!=null&&f.address),c=e.chainNamespace!==r,u=Ve.getConnectorId(r)===Oe.CONNECTOR_ID.AUTH,d=Oe.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(g=>g===e.chainNamespace);t||u&&d?Kt.push("SwitchNetwork",{...s,network:e}):o&&c&&!a?Kt.push("SwitchActiveChain",{switchToChain:e.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:e}):Kt.push("SwitchNetwork",{...s,network:e})}},La=os({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),gDt={state:La,subscribe(e){return Po(La,()=>e(La))},subscribeKey(e,t){return ha(La,e,t)},async open(e){var o,a;const t=e==null?void 0:e.namespace,n=re.state.activeChain,r=t&&t!==n,s=(o=re.getAccountData(e==null?void 0:e.namespace))==null?void 0:o.caipAddress,i=re.state.noAdapters;if(st.state.wcBasic?gt.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1}):await gt.prefetch(),Ve.setFilterByNamespace(e==null?void 0:e.namespace),pr.setLoading(!0,t),t&&r){const c=((a=re.getNetworkData(t))==null?void 0:a.caipNetwork)||re.getRequestedCaipNetworks(t)[0];c&&(i?(await re.switchActiveNetwork(c),Kt.push("ConnectingWalletConnectBasic")):pDt.onSwitchNetwork({network:c,ignoreSwitchConfirmation:!0}))}else Ot.state.manualWCControl||i&&!s?ht.isMobile()?Kt.reset("AllWallets"):Kt.reset("ConnectingWalletConnectBasic"):e!=null&&e.view?Kt.reset(e.view,e.data):s?Kt.reset("Account"):Kt.reset("Connect");La.open=!0,Jp.set({open:!0}),Mn.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!s}})},close(){const e=Ot.state.enableEmbedded,t=!!re.state.activeCaipAddress;La.open&&Mn.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),La.open=!1,Kt.reset("Connect"),pr.clearLoading(),e?t?Kt.replace("Account"):Kt.push("Connect"):Jp.set({open:!1}),st.resetUri()}
vendor: 15,450 bytes, lines 4496-4530
4496,setLoading(e,t){t&&La.loadingNamespaceMap.set(t,e),La.loading=e,Jp.set({loading:e})},clearLoading(){La.loadingNamespaceMap.clear(),La.loading=!1,Jp.set({loading:!1})},shake(){La.shake||(La.shake=!0,setTimeout(()=>{La.shake=!1},500))}},pr=G0(gDt),Wce={interpolate(e,t,n){if(e.length!==2||t.length!==2)throw new Error("inputRange and outputRange must be an array of length 2");const r=e[0]||0,s=e[1]||0,i=t[0]||0,o=t[1]||0;return n<r?i:n>s?o:(o-i)/(s-r)*(n-r)+i}},mDt={black:"#202020",white:"#FFFFFF",white010:"rgba(255, 255, 255, 0.1)",accent010:"rgba(9, 136, 240, 0.1)",accent020:"rgba(9, 136, 240, 0.2)",accent030:"rgba(9, 136, 240, 0.3)",accent040:"rgba(9, 136, 240, 0.4)",accent050:"rgba(9, 136, 240, 0.5)",accent060:"rgba(9, 136, 240, 0.6)",accent070:"rgba(9, 136, 240, 0.7)",accent080:"rgba(9, 136, 240, 0.8)",accent090:"rgba(9, 136, 240, 0.9)",accent100:"rgba(9, 136, 240, 1.0)",accentSecondary010:"rgba(199, 185, 148, 0.1)",accentSecondary020:"rgba(199, 185, 148, 0.2)",accentSecondary030:"rgba(199, 185, 148, 0.3)",accentSecondary040:"rgba(199, 185, 148, 0.4)",accentSecondary050:"rgba(199, 185, 148, 0.5)",accentSecondary060:"rgba(199, 185, 148, 0.6)",accentSecondary070:"rgba(199, 185, 148, 0.7)",accentSecondary080:"rgba(199, 185, 148, 0.8)",accentSecondary090:"rgba(199, 185, 148, 0.9)",accentSecondary100:"rgba(199, 185, 148, 1.0)",productWalletKit:"#FFB800",productAppKit:"#FF573B",productCloud:"#0988F0",productDocumentation:"#008847",neutrals050:"#F6F6F6",neutrals100:"#F3F3F3",neutrals200:"#E9E9E9",neutrals300:"#D0D0D0",neutrals400:"#BBB",neutrals500:"#9A9A9A",neutrals600:"#6C6C6C",neutrals700:"#4F4F4F",neutrals800:"#363636",neutrals900:"#2A2A2A",neutrals1000:"#252525",semanticSuccess010:"rgba(48, 164, 107, 0.1)",semanticSuccess020:"rgba(48, 164, 107, 0.2)",semanticSuccess030:"rgba(48, 164, 107, 0.3)",semanticSuccess040:"rgba(48, 164, 107, 0.4)",semanticSuccess050:"rgba(48, 164, 107, 0.5)",semanticSuccess060:"rgba(48, 164, 107, 0.6)",semanticSuccess070:"rgba(48, 164, 107, 0.7)",semanticSuccess080:"rgba(48, 164, 107, 0.8)",semanticSuccess090:"rgba(48, 164, 107, 0.9)",semanticSuccess100:"rgba(48, 164, 107, 1.0)",semanticError010:"rgba(223, 74, 52, 0.1)",semanticError020:"rgba(223, 74, 52, 0.2)",semanticError030:"rgba(223, 74, 52, 0.3)",semanticError040:"rgba(223, 74, 52, 0.4)",semanticError050:"rgba(223, 74, 52, 0.5)",semanticError060:"rgba(223, 74, 52, 0.6)",semanticError070:"rgba(223, 74, 52, 0.7)",semanticError080:"rgba(223, 74, 52, 0.8)",semanticError090:"rgba(223, 74, 52, 0.9)",semanticError100:"rgba(223, 74, 52, 1.0)",semanticWarning010:"rgba(243, 161, 63, 0.1)",semanticWarning020:"rgba(243, 161, 63, 0.2)",semanticWarning030:"rgba(243, 161, 63, 0.3)",semanticWarning040:"rgba(243, 161, 63, 0.4)",semanticWarning050:"rgba(243, 161, 63, 0.5)",semanticWarning060:"rgba(243, 161, 63, 0.6)",semanticWarning070:"rgba(243, 161, 63, 0.7)",semanticWarning080:"rgba(243, 161, 63, 0.8)",semanticWarning090:"rgba(243, 161, 63, 0.9)",semanticWarning100:"rgba(243, 161, 63, 1.0)"},pN={core:{backgroundAccentPrimary:"#0988F0",backgroundAccentCertified:"#C7B994",backgroundWalletKit:"#FFB800",backgroundAppKit:"#FF573B",backgroundCloud:"#0988F0",backgroundDocumentation:"#008847",backgroundSuccess:"rgba(48, 164, 107, 0.20)",backgroundError:"rgba(223, 74, 52, 0.20)",backgroundWarning:"rgba(243, 161, 63, 0.20)",textAccentPrimary:"#0988F0",textAccentCertified:"#C7B994",textWalletKit:"#FFB800",textAppKit:"#FF573B",textCloud:"#0988F0",textDocumentation:"#008847",textSuccess:"#30A46B",textError:"#DF4A34",textWarning:"#F3A13F",borderAccentPrimary:"#0988F0",borderSecondary:"#C7B994",borderSuccess:"#30A46B",borderError:"#DF4A34",borderWarning:"#F3A13F",foregroundAccent010:"rgba(9, 136, 240, 0.1)",foregroundAccent020:"rgba(9, 136, 240, 0.2)",foregroundAccent040:"rgba(9, 136, 240, 0.4)",foregroundAccent060:"rgba(9, 136, 240, 0.6)",foregroundSecondary020:"rgba(199, 185, 148, 0.2)",foregroundSecondary040:"rgba(199, 185, 148, 0.4)",foregroundSecondary060:"rgba(199, 185, 148, 0.6)",iconAccentPrimary:"#0988F0",iconAccentCertified:"#C7B994",iconSuccess:"#30A46B",iconError:"#DF4A34",iconWarning:"#F3A13F",glass010:"rgba(255, 255, 255, 0.1)",zIndex:"9999"},dark:{overlay:"rgba(0, 0, 0, 0.50)",backgroundPrimary:"#202020",backgroundInvert:"#FFFFFF",textPrimary:"#FFFFFF",textSecondary:"#9A9A9A",textTertiary:"#BBBBBB",textInvert:"#202020",borderPrimary:"#2A2A2A",borderPrimaryDark:"#363636",borderSecondary:"#4F4F4F",foregroundPrimary:"#252525",foregroundSecondary:"#2A2A2A",foregroundTertiary:"#363636",iconDefault:"#9A9A9A",iconInverse:"#FFFFFF"},light:{overlay:"rgba(230 , 230, 230, 0.5)",backgroundPrimary:"#FFFFFF",borderPrimaryDark:"#E9E9E9",backgroundInvert:"#202020",textPrimary:"#202020",textSecondary:"#9A9A9A",textTertiary:"#6C6C6C",textInvert:"#FFFFFF",borderPrimary:"#E9E9E9",borderSecondary:"#D0D0D0",foregroundPrimary:"#F3F3F3",foregroundSecondary:"#E9E9E9",foregroundTertiary:"#D0D0D0",iconDefault:"#9A9A9A",iconInverse:"#202020"}},wDt={1:"4px",2:"8px",10:"10px",3:"12px",4:"16px",6:"24px",5:"20px",8:"32px",16:"64px",20:"80px",32:"128px",64:"256px",128:"512px",round:"9999px"},yDt={0:"0px","01":"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",12:"48px",14:"56px",16:"64px",20:"80px",32:"128px",64:"256px"},bDt={regular:"KHTeka",mono:"KHTekaMono"},vDt={regular:"400",medium:"500"},EDt={h1:"50px",h2:"44px",h3:"38px",h4:"32px",h5:"26px",h6:"20px",large:"16px",medium:"14px",small:"12px"},CDt={"h1-regular-mono":{lineHeight:"50px",letterSpacing:"-3px"},"h1-regular":{lineHeight:"50px",letterSpacing:"-1px"},"h1-medium":{lineHeight:"50px",letterSpacing:"-0.84px"},"h2-regular-mono":{lineHeight:"44px",letterSpacing:"-2.64px"},"h2-regular":{lineHeight:"44px",letterSpacing:"-0.88px"},"h2-medium":{lineHeight:"44px",letterSpacing:"-0.88px"},"h3-regular-mono":{lineHeight:"38px",letterSpacing:"-2.28px"},"h3-regular":{lineHeight:"38px",letterSpacing:"-0.76px"},"h3-medium":{lineHeight:"38px",letterSpacing:"-0.76px"},"h4-regular-mono":{lineHeight:"32px",letterSpacing:"-1.92px"},"h4-regular":{lineHeight:"32px",letterSpacing:"-0.32px"},"h4-medium":{lineHeight:"32px",letterSpacing:"-0.32px"},"h5-regular-mono":{lineHeight:"26px",letterSpacing:"-1.56px"},"h5-regular":{lineHeight:"26px",letterSpacing:"-0.26px"},"h5-medium":{lineHeight:"26px",letterSpacing:"-0.26px"},"h6-regular-mono":{lineHeight:"20px",letterSpacing:"-1.2px"},"h6-regular":{lineHeight:"20px",letterSpacing:"-0.6px"},"h6-medium":{lineHeight:"20px",letterSpacing:"-0.6px"},"lg-regular-mono":{lineHeight:"16px",letterSpacing:"-0.96px"},"lg-regular":{lineHeight:"18px",letterSpacing:"-0.16px"},"lg-medium":{lineHeight:"18px",letterSpacing:"-0.16px"},"md-regular-mono":{lineHeight:"14px",letterSpacing:"-0.84px"},"md-regular":{lineHeight:"16px",letterSpacing:"-0.14px"},"md-medium":{lineHeight:"16px",letterSpacing:"-0.14px"},"sm-regular-mono":{lineHeight:"12px",letterSpacing:"-0.72px"},"sm-regular":{lineHeight:"14px",letterSpacing:"-0.12px"},"sm-medium":{lineHeight:"14px",letterSpacing:"-0.12px"}},$Dt={"ease-out-power-2":"cubic-bezier(0.23, 0.09, 0.08, 1.13)","ease-out-power-1":"cubic-bezier(0.12, 0.04, 0.2, 1.06)","ease-in-power-2":"cubic-bezier(0.92, -0.13, 0.77, 0.91)","ease-in-power-1":"cubic-bezier(0.88, -0.06, 0.8, 0.96)","ease-inout-power-2":"cubic-bezier(0.77, 0.09, 0.23, 1.13)","ease-inout-power-1":"cubic-bezier(0.88, 0.04, 0.12, 1.06)"},xDt={xl:"400ms",lg:"200ms",md:"125ms",sm:"75ms"},tq={colors:mDt,fontFamily:bDt,fontWeight:vDt,textSize:EDt,typography:CDt,tokens:{core:pN.core,theme:pN.dark},borderRadius:wDt,spacing:yDt,durations:xDt,easings:$Dt},Hce="--apkt";function aS(e){if(!e)return{};const t={};return t["font-family"]=e["--apkt-font-family"]??e["--w3m-font-family"]??"KHTeka",t.accent=e["--apkt-accent"]??e["--w3m-accent"]??"#0988F0",t["color-mix"]=e["--apkt-color-mix"]??e["--w3m-color-mix"]??"#000",t["color-mix-strength"]=e["--apkt-color-mix-strength"]??e["--w3m-color-mix-strength"]??0,t["font-size-master"]=e["--apkt-font-size-master"]??e["--w3m-font-size-master"]??"10px",t["border-radius-master"]=e["--apkt-border-radius-master"]??e["--w3m-border-radius-master"]??"4px",e["--apkt-z-index"]!==void 0?t["z-index"]=e["--apkt-z-index"]:e["--w3m-z-index"]!==void 0&&(t["z-index"]=e["--w3m-z-index"]),t}const Lg={createCSSVariables(e){const t={},n={};function r(i,o,a=""){for(const[c,l]of Object.entries(i)){const u=a?`${a}-${c}`:c;l&&typeof l=="object"&&Object.keys(l).length?(o[c]={},r(l,o[c],u)):typeof l=="string"&&(o[c]=`${Hce}-${u}`)}}function s(i,o){for(const[a,c]of Object.entries(i))c&&typeof c=="object"?(o[a]={},s(c,o[a])):typeof c=="string"&&(o[a]=`var(${c})`)}return r(e,t),s(t,n),{cssVariables:t,cssVariablesVarPrefix:n}},assignCSSVariables(e,t){const n={};function r(s,i,o){for(const[a,c]of Object.entries(s)){const l=o?`${o}-${a}`:a,u=i[a];c&&typeof c=="object"?r(c,u,l):typeof u=="string"&&(n[`${Hce}-${l}`]=u)}}return r(e,t),n},createRootStyles(e,t){const n={...tq,tokens:{...tq.tokens,theme:e==="light"?pN.light:pN.dark}},{cssVariables:r}=Lg.createCSSVariables(n),s=Lg.assignCSSVariables(r,n),i=Lg.generateW3MVariables(t),o=Lg.generateW3MOverrides(t),a=Lg.generateScaledVariables(t),c=Lg.generateBaseVariables(s),l={...s,...c,...i,...o,...a},u=Lg.applyColorMixToVariables(t,l),d={...l,...u};return`:root {${Object.entries(d).map(([f,g])=>`${f}:${g.replace("/[:;{}</>]/g","")};`).join("")}}`},generateW3MVariables(e){if(!e)return{};const t=aS(e),n={};return n["--w3m-font-family"]=t["font-family"],n["--w3m-accent"]=t.accent,n["--w3m-color-mix"]=t["color-mix"],n["--w3m-color-mix-strength"]=`${t["color-mix-strength"]}%`,n["--w3m-font-size-master"]=t["font-size-master"],n["--w3m-border-radius-master"]=t["border-radius-master"],n},generateW3MOverrides(e){if(!e)return{};const t=aS(e),n={};if(e["--apkt-accent"]||e["--w3m-accent"]){const r=t.accent;n["--apkt-tokens-core-iconAccentPrimary"]=r,n["--apkt-tokens-core-borderAccentPrimary"]=r,n["--apkt-tokens-core-textAccentPrimary"]=r,n["--apkt-tokens-core-backgroundAccentPrimary"]=r}return(e["--apkt-font-family"]||e["--w3m-font-family"])&&(n["--apkt-fontFamily-regular"]=t["font-family"]),t["z-index"]!==void 0&&(n["--apkt-tokens-core-zIndex"]=`${t["z-index"]}`),n},generateScaledVariables(e){if(!e)return{};const t=aS(e),n={};if(e["--apkt-font-size-master"]||e["--w3m-font-size-master"]){const r=parseFloat(t["font-size-master"].replace("px",""));n["--apkt-textSize-h1"]=`${Number(r)*5}px`,n["--apkt-textSize-h2"]=`${Number(r)*4.4}px`,n["--apkt-textSize-h3"]=`${Number(r)*3.8}px`,n["--apkt-textSize-h4"]=`${Number(r)*3.2}px`,n["--apkt-textSize-h5"]=`${Number(r)*2.6}px`,n["--apkt-textSize-h6"]=`${Number(r)*2}px`,n["--apkt-textSize-large"]=`${Number(r)*1.6}px`,n["--apkt-textSize-medium"]=`${Number(r)*1.4}px`,n["--apkt-textSize-small"]=`${Number(r)*1.2}px`}if(e["--apkt-border-radius-master"]||e["--w3m-border-radius-master"]){const r=parseFloat(t["border-radius-master"].replace("px",""));n["--apkt-borderRadius-1"]=`${Number(r)}px`,n["--apkt-borderRadius-2"]=`${Number(r)*2}px`,n["--apkt-borderRadius-3"]=`${Number(r)*3}px`,n["--apkt-borderRadius-4"]=`${Number(r)*4}px`,n["--apkt-borderRadius-5"]=`${Number(r)*5}px`,n["--apkt-borderRadius-6"]=`${Number(r)*6}px`,n["--apkt-borderRadius-8"]=`${Number(r)*8}px`,n["--apkt-borderRadius-16"]=`${Number(r)*16}px`,n["--apkt-borderRadius-20"]=`${Number(r)*20}px`,n["--apkt-borderRadius-32"]=`${Number(r)*32}px`,n["--apkt-borderRadius-64"]=`${Number(r)*64}px`,n["--apkt-borderRadius-128"]=`${Number(r)*128}px`}return n},generateColorMixCSS(e,t){if(!(e!=null&&e["--w3m-color-mix"])||!e["--w3m-color-mix-strength"])return"";const n=e["--w3m-color-mix"],r=e["--w3m-color-mix-strength"];if(!r||r===0)return"";const s=Object.keys(t||{}).filter(o=>{const a=o.includes("-tokens-core-background")||o.includes("-tokens-core-text")||o.includes("-tokens-core-border")||o.includes("-tokens-core-foreground")||o.includes("-tokens-core-icon")||o.includes("-tokens-theme-background")||o.includes("-tokens-theme-text")||o.includes("-tokens-theme-border")||o.includes("-tokens-theme-foreground")||o.includes("-tokens-theme-icon"),c=o.includes("-borderRadius-")||o.includes("-spacing-")||o.includes("-textSize-")||o.includes("-fontFamily-")||o.includes("-fontWeight-")||o.includes("-typography-")||o.includes("-duration-")||o.includes("-ease-")||o.includes("-path-")||o.includes("-width-")||o.includes("-height-")||o.includes("-visual-size-")||o.includes("-modal-width")||o.includes("-cover");return a&&!c});return s.length===0?"":` @supports (background: color-mix(in srgb, white 50%, black)) { 4497 :root { 4498 ${s.map(o=>{const a=(t==null?void 0:t[o])||"";return a.includes("color-mix")||a.startsWith("#")||a.startsWith("rgb")?`${o}: color-mix(in srgb, ${n} ${r}%, ${a});`:`${o}: color-mix(in srgb, ${n} ${r}%, var(${o}-base, ${a}));`}).join("")} 4499 } 4500 }`},generateBaseVariables(e){const t={},n=e["--apkt-tokens-theme-backgroundPrimary"];n&&(t["--apkt-tokens-theme-backgroundPrimary-base"]=n);const r=e["--apkt-tokens-core-backgroundAccentPrimary"];return r&&(t["--apkt-tokens-core-backgroundAccentPrimary-base"]=r),t},applyColorMixToVariables(e,t){const n={};t!=null&&t["--apkt-tokens-theme-backgroundPrimary"]&&(n["--apkt-tokens-theme-backgroundPrimary"]="var(--apkt-tokens-theme-backgroundPrimary-base)"),t!=null&&t["--apkt-tokens-core-backgroundAccentPrimary"]&&(n["--apkt-tokens-core-backgroundAccentPrimary"]="var(--apkt-tokens-core-backgroundAccentPrimary-base)");const r=aS(e),s=r["color-mix"],i=r["color-mix-strength"];if(!i||i===0)return n;const o=Object.keys(t||{}).filter(a=>{const c=a.includes("-tokens-core-background")||a.includes("-tokens-core-text")||a.includes("-tokens-core-border")||a.includes("-tokens-core-foreground")||a.includes("-tokens-core-icon")||a.includes("-tokens-theme-background")||a.includes("-tokens-theme-text")||a.includes("-tokens-theme-border")||a.includes("-tokens-theme-foreground")||a.includes("-tokens-theme-icon")||a.includes("-tokens-theme-overlay"),l=a.includes("-borderRadius-")||a.includes("-spacing-")||a.includes("-textSize-")||a.includes("-fontFamily-")||a.includes("-fontWeight-")||a.includes("-typography-")||a.includes("-duration-")||a.includes("-ease-")||a.includes("-path-")||a.includes("-width-")||a.includes("-height-")||a.includes("-visual-size-")||a.includes("-modal-width")||a.includes("-cover");return c&&!l});return o.length===0||o.forEach(a=>{const c=(t==null?void 0:t[a])||"";a.endsWith("-base")||(a==="--apkt-tokens-theme-backgroundPrimary"||a==="--apkt-tokens-core-backgroundAccentPrimary"?n[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base))`:c.includes("color-mix")||c.startsWith("#")||c.startsWith("rgb")?n[a]=`color-mix(in srgb, ${s} ${i}%, ${c})`:n[a]=`color-mix(in srgb, ${s} ${i}%, var(${a}-base, ${c}))`)}),n}},{cssVariablesVarPrefix:Fr}=Lg.createCSSVariables(tq);function Ms(e,...t){return Xe(e,...t.map(n=>Xr(typeof n=="function"?n(Fr):n)))}const Ca=Xe` 4501 div, 4502 span, 4503 iframe, 4504 a, 4505 img, 4506 form, 4507 button, 4508 label, 4509 *::after, 4510 *::before { 4511 margin: 0; 4512 padding: 0; 4513 box-sizing: border-box; 4514 font-style: normal; 4515 text-rendering: optimizeSpeed; 4516 -webkit-font-smoothing: antialiased; 4517 -moz-osx-font-smoothing: grayscale; 4518 -webkit-tap-highlight-color: transparent; 4519 backface-visibility: hidden; 4520 } 4521 4522 :host { 4523 font-family: var(--apkt-fontFamily-regular); 4524 } 4525`,d3=Xe` 4526 button, 4527 a { 4528 cursor: pointer; 4529 display: flex; 4530 justify-content: center;
4531 align-items: center; 4532 position: relative; 4533 4534 will-change: background-color, color, border, box-shadow, width, height, transform, opacity; 4535 outline: none; 4536 border: none; 4537 text-decoration: none; 4538 transition: 4539 background-color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4540 color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4541 border var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4542 box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4543 width var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4544 height var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4545 transform var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4546 opacity var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4547 scale var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2), 4548 border-radius var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2); 4549 will-change: 4550 background-color, color, border, box-shadow, width, height, transform, opacity, scale, 4551 border-radius; 4552 } 4553 4554 a:active:not([disabled]), 4555 button:active:not([disabled]) { 4556 scale: 0.975; 4557 transform-origin: center; 4558 } 4559 4560 button:disabled { 4561 cursor: default; 4562 } 4563 4564 input { 4565 border: none; 4566 outline: none; 4567 appearance: none; 4568 } 4569`,cS=".",Ph={getSpacingStyles(e,t){if(Array.isArray(e))return e[t]?`var(--apkt-spacing-${e[t]})`:void 0;if(typeof e=="string")return`var(--apkt-spacing-${e})`},getFormattedDate(e){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e)},formatCurrency(e=0,t={}){const n=Number(e);return isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2,...t}).format(n)},getHostName(e){try{return new URL(e).hostname}catch{return""}},getTruncateString({string:e,charsStart:t,charsEnd:n,truncate:r}){return e.length<=t+n?e:r==="end"?`${e.substring(0,t)}...`:r==="start"?`...${e.substring(e.length-n)}`:`${e.substring(0,Math.floor(t))}...${e.substring(e.length-Math.floor(n))}`},generateAvatarColors(e){const n=e.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),r=this.hexToRgb(n),s=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),o=100-3*Number(s==null?void 0:s.replace("px","")),a=`${o}% ${o}% at 65% 40%`,c=[];for(let l=0;l<5;l+=1){const u=this.tintColor(r,.15*l);c.push(`rgb(${u[0]}, ${u[1]}, ${u[2]})`)}return` 4570 --local-color-1: ${c[0]}; 4571 --local-color-2: ${c[1]}; 4572 --local-color-3: ${c[2]}; 4573 --local-color-4: ${c[3]}; 4574 --local-color-5: ${c[4]}; 4575 --local-radial-circle: ${a} 4576 `},hexToRgb(e){const t=parseInt(e,16),n=t>>16&255,r=t>>8&255,s=t&255;return[n,r,s]},tintColor(e,t){const[n,r,s]=e,i=Math.round(n+(255-n)*t),o=Math.round(r+(255-r)*t),a=Math.round(s+(255-s)*t);return[i,o,a]},isNumber(e){return{number:/^[0-9]+$/u}.number.test(e)},getColorTheme(e){var t;return e||(typeof window<"u"&&window.matchMedia&&typeof window.matchMedia=="function"?(t=window.matchMedia("(prefers-color-scheme: dark)"))!=null&&t.matches?"dark":"light":"dark")},splitBalance(e){const t=e.split(".");return t.length===2?[t[0],t[1]]:["0","00"]},roundNumber(e,t,n){return e.toString().length>=t?Number(e).toFixed(n):e},cssDurationToNumber(e){return e.endsWith("s")?Number(e.replace("s",""))*1e3:e.endsWith("ms")?Number(e.replace("ms","")):0},maskInput({value:e,decimals:t,integers:n}){if(e=e.replace(",","."),e===cS)return`0${cS}`;const[r="",s]=e.split(cS).map(u=>u.replace(/[^0-9]/gu,"")),i=n?r.substring(0,n):r,o=i.length===2?String(Number(i)):i,a=typeof t=="number"?s==null?void 0:s.substring(0,t):s,c=typeof t!="number"||t>0;return(typeof a=="string"&&c?[o,a].join(cS):o)??""},capitalize(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}};function IDt(e,t){const{kind:n,elements:r}=t;return{kind:n,elements:r,finisher(s){customElements.get(e)||customElements.define(e,s)}}}function SDt(e,t){return customElements.get(e)||customElements.define(e,t),t}function ns(e){return function(n){return typeof n=="function"?SDt(e,n):IDt(e,n)}}const ADt=ae`<svg width="30" height="30" viewBox="0 0 30 30" fill="none"> 4577 <g clip-path="url(#clip0_87_33)"> 4578 <path d="M23.9367 2.29447e-07H6.05917C5.26333 -0.000218805 4.47526 0.156384 3.73997 0.46086C3.00469 0.765337 2.33661 1.21172 1.77391 1.7745C1.21121 2.33727 0.7649
457817 3.00542 0.460542 3.74074C0.156167 4.47607 -0.000327963 5.26417 5.16031e-07 6.06V23.9433C4.48257e-07 24.7389 0.156744 25.5267 0.461276 26.2617C0.765808 26.9967 1.21216 27.6645 1.77484 28.2269C2.33752 28.7894 3.0055 29.2355 3.74061 29.5397C4.47573 29.8439 5.26358 30.0003 6.05917 30H23.9417C25.5486 29.9996 27.0895 29.3609 28.2257 28.2245C29.3618 27.0881 30 25.5469 30 23.94V6.06C29.9993 4.45241 29.3602 2.91091 28.2232 1.77449C27.0861 0.638064 25.5443 -0.000220881 23.9367 2.29447e-07Z" fill="url(#paint0_linear_87_33)"/> 4579 <path d="M14.8708 6.89259L15.4783 5.84259C15.5679 5.68703 15.6873 5.55064 15.8296 5.44122C15.9719 5.3318 16.1344 5.25148 16.3078 5.20486C16.4812 5.15824 16.662 5.14622 16.8401 5.1695C17.0181 5.19277 17.1898 5.25088 17.3453 5.34051C17.5009 5.43013 17.6373 5.54952 17.7467 5.69186C17.8561 5.83419 17.9364 5.99669 17.9831 6.17006C18.0297 6.34344 18.0417 6.5243 18.0184 6.70232C17.9952 6.88034 17.9371 7.05203 17.8474 7.20759L11.9949 17.3401H16.2283C17.5999 17.3401 18.3691 18.9526 17.7724 20.0701H5.36159C5.18215 20.0707 5.00436 20.0359 4.83845 19.9675C4.67254 19.8992 4.5218 19.7986 4.39492 19.6718C4.26803 19.5449 4.16751 19.3941 4.09915 19.2282C4.03079 19.0623 3.99593 18.8845 3.99659 18.7051C3.99659 17.9476 4.60492 17.3401 5.36159 17.3401H8.84159L13.2958 9.61926L11.9041 7.20426C11.738 6.89096 11.7 6.52543 11.7982 6.18469C11.8963 5.84395 12.1229 5.5546 12.4301 5.37763C12.7374 5.20065 13.1014 5.14987 13.4454 5.23599C13.7893 5.3221 14.0864 5.53838 14.2741 5.83926L14.8708 6.89259ZM9.60659 21.4759L8.29409 23.7526C8.20446 23.9082 8.08506 24.0446 7.94271 24.1541C7.80035 24.2636 7.63783 24.344 7.46441 24.3906C7.291 24.4373 7.11009 24.4493 6.93202 24.4261C6.75395 24.4028 6.58221 24.3447 6.42659 24.2551C6.27097 24.1655 6.13454 24.0461 6.02506 23.9037C5.91559 23.7613 5.83523 23.5988 5.78857 23.4254C5.74191 23.252 5.72986 23.0711 5.75311 22.893C5.77637 22.715 5.83446 22.5432 5.92409 22.3876L6.89909 20.7001C8.00159 20.3584 8.89742 20.6209 9.60659 21.4759ZM20.9066 17.3476H24.4583C25.2158 17.3476 25.8233 17.9551 25.8233 18.7126C25.8233 19.4701 25.2149 20.0776 24.4583 20.0776H22.4858L23.8166 22.3876C24.1916 23.0443 23.9708 23.8726 23.3149 24.2551C23.0006 24.4359 22.6274 24.4845 22.2772 24.3903C21.927 24.2961 21.6286 24.0667 21.4474 23.7526C19.2058 19.8643 17.5216 16.9534 16.4041 15.0151C15.2608 13.0426 16.0783 11.0626 16.8841 10.3909C17.7799 11.9293 19.1191 14.2501 20.9074 17.3476H20.9066Z" fill="white"/> 4580 </g> 4581 <defs> 4582 <linearGradient id="paint0_linear_87_33" x1="15" y1="2.29447e-07" x2="15" y2="30" gradientUnits="userSpaceOnUse"> 4583 <stop stop-color="#18BFFB"/> 4584 <stop offset="1" stop-color="#2072F3"/> 4585 </linearGradient> 4586 <clipPath id="clip0_87_33"> 4587 <rect width="30" height="30" fill="white"/> 4588 </clipPath> 4589 </defs> 4590</svg>`,_Dt=ae`<svg fill="none" viewBox="0 0 40 40"> 4591 <g clip-path="url(#a)"> 4592 <g clip-path="url(#b)"> 4593 <circle cx="20" cy="19.89" r="20" fill="#000" /> 4594 <g clip-path="url(#c)"> 4595 <path 4596 fill="#fff" 4597 d="M28.77 23.3c-.69 1.99-2.75 5.52-4.87 5.56-1.4.03-1.86-.84-3.46-.84-1.61 0-2.12.81-3.45.86-2.25.1-5.72-5.1-5.72-9.62 0-4.15 2.9-6.2 5.42-6.25 1.36-.02 2.64.92 3.47.92.83 0 2.38-1.13 4.02-.97.68.03 2.6.28 3.84 2.08-3.27 2.14-2.76 6.61.75 8.25ZM24.2 7.88c-2.47.1-4.49 2.69-4.2 4.84 2.28.17 4.47-2.39 4.2-4.84Z" 4598 /> 4599 </g> 4600 </g> 4601 </g> 4602 <defs> 4603 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 4604 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 4605 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 4606 </defs> 4607</svg>`,NDt=ae` 4608 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 8 11"> 4609 <path 4610 fill="var(--apkt-tokens-theme-textPrimary)" 4611 d="M7.862 4.86c.159-1.064-.652-1.637-1.76-2.018l.36-1.443-.879-.218-.35 1.404c-.23-.058-.468-.112-.703-.166l.352-1.413-.877-.219-.36 1.442a29.02 29.02 0 0 1-.56-.132v-.005l-1.21-.302-.234.938s.652.15.638.158c.356.089.42.324.41.51l-.41 1.644a.715.715 0 0 1 .09.03l-.092-.024-.574 2.302c-.044.108-.154.27-.402.208.008.013-.639-.16-.639-.16L.227 8.403l1.142.285c.213.053.42.109.626.161l-.363 1.459.877.218.36-1.443c.239.065.472.125.7.
4611182l-.36 1.436.879.219.363-1.456c1.497.283 2.623.17 3.097-1.185.381-1.09-.02-1.719-.807-2.129.574-.132 1.006-.51 1.12-1.289ZM5.856 7.673c-.272 1.09-2.107.5-2.702.353l.482-1.933c.595.149 2.503.443 2.22 1.58Zm.271-2.829c-.247.992-1.775.488-2.27.365l.436-1.753c.496.124 2.092.354 1.834 1.388Z" 4612 /> 4613 </svg> 4614`,TDt=ae`<svg viewBox="0 0 32 32" fill="none"> 4615<path d="M29.0612 10.0613L13.0612 26.0613C12.9218 26.2011 12.7563 26.3121 12.5739 26.3878C12.3916 26.4635 12.1961 26.5024 11.9987 26.5024C11.8013 26.5024 11.6058 26.4635 11.4235 26.3878C11.2411 26.3121 11.0756 26.2011 10.9362 26.0613L3.9362 19.0613C3.79667 18.9217 3.68599 18.7561 3.61047 18.5738C3.53496 18.3915 3.49609 18.1961 3.49609 17.9988C3.49609 17.8014 3.53496 17.606 3.61047 17.4237C3.68599 17.2414 3.79667 17.0758 3.9362 16.9363C4.07573 16.7967 4.24137 16.686 4.42367 16.6105C4.60598 16.535 4.80137 16.4962 4.9987 16.4962C5.19602 16.4962 5.39141 16.535 5.57372 16.6105C5.75602 16.686 5.92167 16.7967 6.0612 16.9363L11.9999 22.875L26.9387 7.93876C27.2205 7.65697 27.6027 7.49866 28.0012 7.49866C28.3997 7.49866 28.7819 7.65697 29.0637 7.93876C29.3455 8.22055 29.5038 8.60274 29.5038 9.00126C29.5038 9.39977 29.3455 9.78197 29.0637 10.0638L29.0612 10.0613Z" fill="currentColor"/> 4616</svg> 4617`,PDt=ae`<svg width="30" height="30" viewBox="0 0 30 30" fill="none"> 4618<path d="M14.9978 7.80003H27.4668C26.2032 5.61107 24.3857 3.79333 22.1968 2.52955C20.008 1.26577 17.525 0.600485 14.9975 0.600586C12.47 0.600687 9.98712 1.26617 7.79838 2.53012C5.60964 3.79408 3.79221 5.61197 2.52881 7.80103L8.76281 18.599L8.76881 18.598C8.13412 17.5044 7.79906 16.2628 7.79743 14.9983C7.79579 13.7339 8.12764 12.4914 8.7595 11.3961C9.39136 10.3008 10.3009 9.39159 11.3963 8.76005C12.4918 8.12851 13.7344 7.79702 14.9988 7.79903L14.9978 7.80003Z" fill="url(#paint0_linear_87_32)"/> 4619<path d="M21.237 18.5981L15.003 29.3961C17.5305 29.3961 20.0134 28.7308 22.2022 27.467C24.391 26.2032 26.2086 24.3854 27.4721 22.1965C28.7356 20.0075 29.4006 17.5245 29.4003 14.997C29.3999 12.4695 28.7342 9.9867 27.47 7.7981H15.002L15 7.8041C16.2642 7.80168 17.5067 8.13257 18.6022 8.76342C19.6977 9.39428 20.6076 10.3028 21.2401 11.3974C21.8726 12.492 22.2053 13.734 22.2048 14.9982C22.2042 16.2623 21.8704 17.504 21.237 18.5981Z" fill="url(#paint1_linear_87_32)"/> 4620<path d="M8.76502 18.601L2.53102 7.80298C1.26664 9.99172 0.600848 12.4748 0.600586 15.0025C0.600324 17.5302 1.2656 20.0134 2.52953 22.2024C3.79345 24.3914 5.61145 26.209 7.80071 27.4725C9.98998 28.736 12.4733 29.4008 15.001 29.4L21.236 18.602L21.232 18.598C20.6022 19.6941 19.6944 20.6049 18.6003 21.2383C17.5062 21.8717 16.2644 22.2055 15.0002 22.2059C13.7359 22.2063 12.4939 21.8733 11.3994 21.2406C10.3049 20.6079 9.39657 19.6977 8.76602 18.602L8.76502 18.601Z" fill="url(#paint2_linear_87_32)"/> 4621<path d="M14.9998 22.2C16.9094 22.2 18.7407 21.4415 20.091 20.0912C21.4412 18.741 22.1998 16.9096 22.1998 15C22.1998 13.0905 21.4412 11.2591 20.091 9.90888C18.7407 8.55862 16.9094 7.80005 14.9998 7.80005C13.0902 7.80005 11.2589 8.55862 9.90864 9.90888C8.55837 11.2591 7.7998 13.0905 7.7998 15C7.7998 16.9096 8.55837 18.741 9.90864 20.0912C11.2589 21.4415 13.0902 22.2 14.9998 22.2Z" fill="white"/> 4622<path d="M14.9998 20.7C16.5115 20.7 17.9614 20.0995 19.0303 19.0306C20.0993 17.9616 20.6998 16.5118 20.6998 15C20.6998 13.4883 20.0993 12.0385 19.0303 10.9695C17.9614 9.90058 16.5115 9.30005 14.9998 9.30005C13.4881 9.30005 12.0383 9.90058 10.9693 10.9695C9.90034 12.0385 9.2998 13.4883 9.2998 15C9.2998 16.5118 9.90034 17.9616 10.9693 19.0306C12.0383 20.0995 13.4881 20.7 14.9998 20.7Z" fill="#1A73E8"/> 4623<defs> 4624 <linearGradient id="paint0_linear_87_32" x1="3.29381" y1="2.99503" x2="38.0998" y2="2.99503" gradientUnits="userSpaceOnUse"> 4625 <stop stop-color="#D93025"/> 4626 <stop offset="1" stop-color="#EA4335"/> 4627 </linearGradient> 4628 <linearGradient id="paint1_linear_87_32" x1="17.953" y1="29.1431" x2="34.194" y2="-0.298904" gradientUnits="userSpaceOnUse"> 4629 <stop stop-color="#FCC934"/> 4630 <stop offset="1" stop-color="#FBBC04"/> 4631 </linearGradient> 4632 <linearGradient id="paint2_linear_87_32" x1="22.873" y1="28.2" x2="6.63202" y2="-1.24102" gradientUnits="userSpaceOnUse"> 4633 <stop stop-color="#1E8E3E"/> 4634 <stop offset="1" stop-color="#34A853"/> 4635 </linearGradient> 4636</defs> 4637</svg>`,ODt=ae`<svg width="32" height="32" viewBox="0 0 32 32" fill="none"> 4638<path d="M23 11.1962V10.5C23 7.365 18.2712 5 12 5C5.72875 5 1 7.365 1 10.5V15.5C1 18.1112 4.28125 20.1863 9 20.8075V21.5C9 24.635 13.7288 27 20 27C26.2712 27 31 24.635 31 21.5V16.5C31 13.9125 27.8225 11.835 23 11.1962ZM7 18.3587C4.55125 17.675 3 16.5487 3 15.5V13.7413C4.02 14.4637 5.38625 15.0463 7 15.4375V18.3587ZM17 15.4375C18.6138 15.0463 19.98 14.4637 21 13.7413V15.5C21 16.5487 19.4487 17.675 17 18.3587V15.4375ZM15 24.3587C12.5513 23.675 11 22.5487 11 21.5V20.9788C11.3287 20.9913 11.6613 21 12 21C12.485 21 12.9587 20.9837 13.4237 20.9562C13.9403 21.1412 14.4665 21.2981 15 21.4263V24.3587ZM15 18.7812C14.0068 18.928 13.004 19.0011 12 19C10.996 19.0011 9.99324 18.928 9 18.7812V15.8075C9.99472 15.9371 10.9969 16.0014 12 16C13.0031 16.0014 14.0053 15.9371 15 15.8075V18.7812ZM23 24.7812C21.0106 25.0729 18.9894 25.0729 17 24.7812V21.8C17.9944 21.9337 18.9967 22.0005 20 22C21.0031 22.0014 22.0053 21.9371 23 21.8075V24.7812ZM29 21.5C29 22.5487 27.4487 23.675 25 24.3587V21.4375C26.6138 21.0462 27.98 20.4637 29 19.7412V21.5Z" fill="currentColor"/> 4639</svg> 4640`,kDt=ae` <svg fill="none" viewBox="0 0 13 4">
4641 <path fill="currentColor" d="M.5 0h12L8.9 3.13a3.76 3.76 0 0 1-4.8 0L.5 0Z" /> 4642</svg>`,RDt=ae`<svg fill="none" viewBox="0 0 40 40"> 4643 <g clip-path="url(#a)"> 4644 <g clip-path="url(#b)"> 4645 <circle cx="20" cy="19.89" r="20" fill="#5865F2" /> 4646 <path 4647 fill="#fff" 4648 fill-rule="evenodd" 4649 d="M25.71 28.15C30.25 28 32 25.02 32 25.02c0-6.61-2.96-11.98-2.96-11.98-2.96-2.22-5.77-2.15-5.77-2.15l-.29.32c3.5 1.07 5.12 2.61 5.12 2.61a16.75 16.75 0 0 0-10.34-1.93l-.35.04a15.43 15.43 0 0 0-5.88 1.9s1.71-1.63 5.4-2.7l-.2-.24s-2.81-.07-5.77 2.15c0 0-2.96 5.37-2.96 11.98 0 0 1.73 2.98 6.27 3.13l1.37-1.7c-2.6-.79-3.6-2.43-3.6-2.43l.58.35.09.06.08.04.02.01.08.05a17.25 17.25 0 0 0 4.52 1.58 14.4 14.4 0 0 0 8.3-.86c.72-.27 1.52-.66 2.37-1.21 0 0-1.03 1.68-3.72 2.44.61.78 1.35 1.67 1.35 1.67Zm-9.55-9.6c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28.01-1.25-.93-2.28-2.1-2.28Zm7.5 0c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28 0-1.25-.93-2.28-2.1-2.28Z" 4650 clip-rule="evenodd" 4651 /> 4652 </g> 4653 </g> 4654 <defs> 4655 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 4656 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 4657 </defs> 4658</svg>`,BDt=ae`<svg 4659 xmlns="http://www.w3.org/2000/svg" 4660 fill="none" 4661 viewBox="0 0 9 12" 4662> 4663 <path 4664 fill="var(--apkt-tokens-theme-textPrimary)" 4665 d="M4.666.001v4.435l3.748 1.675L4.666.001Zm0 0L.917 6.111l3.749-1.675V.001Zm0 8.984V12l3.75-5.19-3.75 2.176Zm0 3.014V8.985L.917 6.81 4.666 12Zm0-3.712 3.748-2.176-3.748-1.675v3.851Z" 4666 /> 4667 <path fill="var(--apkt-tokens-theme-textPrimary)" d="m.917 6.111 3.749 2.176v-3.85L.917 6.11Z" /> 4668</svg>`,DDt=ae`<svg fill="none" viewBox="0 0 16 16"> 4669 <path 4670 fill="currentColor" 4671 d="M4.25 7a.63.63 0 0 0-.63.63v3.97c0 .28-.2.51-.47.54l-.75.07a.93.93 0 0 1-.9-.47A7.51 7.51 0 0 1 5.54.92a7.5 7.5 0 0 1 9.54 4.62c.12.35.06.72-.16 1-.74.97-1.68 1.78-2.6 2.44V4.44a.64.64 0 0 0-.63-.64h-1.06c-.35 0-.63.3-.63.64v5.5c0 .23-.12.42-.32.5l-.52.23V6.05c0-.36-.3-.64-.64-.64H7.45c-.35 0-.64.3-.64.64v4.97c0 .25-.17.46-.4.52a5.8 5.8 0 0 0-.45.11v-4c0-.36-.3-.65-.64-.65H4.25ZM14.07 12.4A7.49 7.49 0 0 1 3.6 14.08c4.09-.58 9.14-2.5 11.87-6.6v.03a7.56 7.56 0 0 1-1.41 4.91Z" 4672 /> 4673</svg>`,UDt=ae`<svg fill="none" viewBox="0 0 40 40"> 4674 <g clip-path="url(#a)"> 4675 <g clip-path="url(#b)"> 4676 <circle cx="20" cy="19.89" r="20" fill="#1877F2" /> 4677 <g clip-path="url(#c)"> 4678 <path 4679 fill="#fff" 4680 d="M26 12.38h-2.89c-.92 0-1.61.38-1.61 1.34v1.66H26l-.36 4.5H2
46801.5v12H17v-12h-3v-4.5h3V12.5c0-3.03 1.6-4.62 5.2-4.62H26v4.5Z" 4681 /> 4682 </g> 4683 </g> 4684 <path 4685 fill="#1877F2" 4686 d="M40 20a20 20 0 1 0-23.13 19.76V25.78H11.8V20h5.07v-4.4c0-5.02 3-7.79 7.56-7.79 2.19 0 4.48.4 4.48.4v4.91h-2.53c-2.48 0-3.25 1.55-3.25 3.13V20h5.54l-.88 5.78h-4.66v13.98A20 20 0 0 0 40 20Z" 4687 /> 4688 <path 4689 fill="#fff" 4690 d="m27.79 25.78.88-5.78h-5.55v-3.75c0-1.58.78-3.13 3.26-3.13h2.53V8.2s-2.3-.39-4.48-.39c-4.57 0-7.55 2.77-7.55 7.78V20H11.8v5.78h5.07v13.98a20.15 20.15 0 0 0 6.25 0V25.78h4.67Z" 4691 /> 4692 </g> 4693 <defs> 4694 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 4695 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 4696 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 4697 </defs> 4698</svg>`,LDt=ae`<svg style="border-radius: 9999px; overflow: hidden;" fill="none" viewBox="0 0 1000 1000"> 4699 <rect width="1000" height="1000" rx="9999" ry="9999" fill="#855DCD"/> 4700 <path fill="#855DCD" d="M0 0h1000v1000H0V0Z" /> 4701 <path 4702 fill="#fff" 4703 d="M320 248h354v504h-51.96V521.13h-.5c-5.76-63.8-59.31-113.81-124.54-113.81s-118.78 50-124.53 113.81h-.5V752H320V248Z" 4704 /> 4705 <path 4706 fill="#fff" 4707 d="m225 320 21.16 71.46h17.9v289.09a16.29 16.29 0 0 0-16.28 16.24v19.49h-3.25a16.3 16.3 0 0 0-16.28 16.24V752h182.26v-19.48a16.22 16.22 0 0 0-16.28-16.24h-3.25v-19.5a16.22 16.22 0 0 0-16.28-16.23h-19.52V320H225Zm400.3 360.55a16.3 16.3 0 0 0-15.04 10.02 16.2 16.2 0 0 0-1.24 6.22v19.49h-3.25a16.29 16.29 0 0 0-16.27 16.24V752h182.24v-19.48a16.23 16.23 0 0 0-16.27-16.24h-3.25v-19.5a16.2 16.2 0 0 0-10.04-15 16.3 16.3 0 0 0-6.23-1.23v-289.1h17.9L775 320H644.82v360.55H625.3Z" 4708 /> 4709</svg>`,MDt=ae`<svg fill="none" viewBox="0 0 40 40"> 4710 <g clip-path="url(#a)"> 4711 <g clip-path="url(#b)"> 4712 <circle cx="20" cy="19.89" r="20" fill="#1B1F23" /> 4713 <g clip-path="url(#c)"> 4714 <path 4715 fill="#fff" 4716 d="M8 19.89a12 12 0 1 1 15.8 11.38c-.6.12-.8-.26-.8-.57v-3.3c0-1.12-.4-1.85-.82-2.22 2.67-.3 5.48-1.31 5.48-5.92 0-1.31-.47-2.38-1.24-3.22.13-.3.54-1.52-.12-3.18 0 0-1-.32-3.3 1.23a11.54 11.54 0 0 0-6 0c-2.3-1.55-3.3-1.23-3.3-1.23a4.32 4.32 0 0 0-.12 3.18 4.64 4.64 0 0 0-1.24 3.22c0 4.6 2.8 5.63 5.47 5.93-.34.3-.65.83-.76 1.6-.69.31-2.42.84-3.5-1 0 0-.63-1.15-1.83-1.23 0 0-1.18-.02-.09.73 0 0 .8.37 1.34 1.76 0 0 .7 2.14 4.03 1.41v2.24c0 .31-.2.68-.8.57A12 12 0 0 1 8 19.9Z" 4717 /> 4718 </g> 4719 </g> 4720 </g> 4721 <defs> 4722 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 4723 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 4724 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 4725 </defs> 4726</svg>`,jDt=ae`<svg fill="none" viewBox="0 0 40 40"> 4727 <path 4728 fill="#4285F4" 4729 d="M32.74 20.3c0-.93-.08-1.81-.24-2.66H20.26v5.03h7a6 6 0 0 1-2.62 3.91v3.28h4.22c2.46-2.27 3.88-5.6 3.88-9.56Z" 4730 /> 4731 <path 4732 fill="#34A853" 4733 d="M20.26 33a12.4 12.4 0 0 0 8.6-3.14l-4.22-3.28a7.74 7.74 0 0 1-4.38 1.26 7.76 7.76 0 0 1-7.28-5.36H8.65v3.36A12.99 12.99 0 0 0 20.26 33Z" 4734 /> 4735 <path 4736 fill="#FBBC05" 4737 d="M12.98 22.47a7.79 7.79 0 0 1 0-4.94v-3.36H8.65a12.84 12.84 0 0 0 0 11.66l3.37-2.63.96-.73Z" 4738 /> 4739 <path 4740 fill="#EA4335" 4741 d="M20.26 12.18a7.1 7.1 0 0 1 4.98 1.93l3.72-3.72A12.47 12.47 0 0 0 20.26 7c-5.08 0-9.47 2.92-11.6 7.17l4.32 3.36a7.76 7.76 0 0 1 7.28-5.35Z" 4742 /> 4743</svg>`,FDt=ae`<svg width="10" height="10" viewBox="0 0 10 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> 4744<path d="M4.875 0C3.91082 0 2.96829 0.285914 2.1666 0.821586C1.36491 1.35726 0.740067 2.11863 0.371089 3.00942C0.00211226 3.90021 -0.094429 4.88041 0.093674 5.82607C0.281777 6.77172 0.746076 7.64036 1.42786 8.32215C2.10964 9.00393 2.97828 9.46823 3.92394 9.65633C4.86959 9.84443 5.84979 9.74789 6.74058 9.37891C7.63137 9.00994 8.39274 8.38509 8.92842 7.5834C9.46409 6.78171 9.75 5.83918 9.75 4.875C9.74864 3.58249 9.23458 2.34331 8.32064 1.42936C7.4067 0.515418 6.16751 0.00136492 4.875 0ZM4.6875 2.25C4.79875 2.25 4.90751 2.28299 5.00001 2.3448C5.09251 2.40661 5.16461 2.49446 5.20718 2.59724C5.24976 2.70002 5.2609 2.81312 5.23919 2.92224C5.21749 3.03135 5.16392 3.13158 5.08525 3.21025C5.00658 3.28891 4.90635 3.34249 4.79724 3.36419C4.68813 3.3859 4.57503 3.37476 4.47224 3.33218C4.36946 3.28961 4.28161 3.21751 4.2198 3.12501C4.15799 3.03251 4.125 2.92375 4.125 2.8125C4.125 2.66332 4.18427 2.52024 4.28975 2.41475C4.39524 2.30926 4.53832 2.25 4.6875 2.25ZM5.25 7.5C5.05109 7.5 4.86032 7.42098 4.71967 7.28033C4.57902 7.13968 4.5 6.94891 4.5 6.75V4.875C4.40055 4.875 4.30516 4.83549 4.23484 4.76516C4.16451 4.69484 4.125 4.59946 4.125 4.5C4.125 4.40054 4.16451 4.30516 4.23484 4.23484C4.30516 4.16451 4.40055 4.125 4.5 4.125C4.69891 4.125 4.88968 4.20402 5.03033 4.34467C5.17098 4.48532 5.25 4.67609 5.25 4.875V6.75C5.34946 6.75 5.44484 6.78951 5.51517 6.85983C5.58549 6.93016 5.625 7.02554 5.625 7.125C5.625 7.22446 5.58549 7.31984 5.51517 7.39017C5.44484 7.46049 5.34946 7.5 5.25 7.5Z" fill="#9A9A9A"/> 4745</svg> 4746`,zDt=ae`<svg width="32" height="32" viewBox="0 0 32 32" fill="none"> 4747<path d="M28.925 5.5425C28.925 5.5425 28.925 5.555 28.925 5.56125L21.65 29.5537C21.5399 29.9434 21.3132 30.2901 21.0004 30.5473C20.6876 30.8045 20.3036 3
47470.9598 19.9 30.9925C19.8425 30.9975 19.785 31 19.7275 31C19.3493 31.0012 18.9786 30.8941 18.6592 30.6915C18.3398 30.4888 18.085 30.199 17.925 29.8563L13.375 20.5187C13.3295 20.4252 13.3143 20.3197 13.3315 20.2171C13.3488 20.1145 13.3976 20.0198 13.4713 19.9463L20.7113 12.7063C20.8909 12.5172 20.9895 12.2654 20.9862 12.0047C20.9829 11.7439 20.8778 11.4948 20.6934 11.3104C20.509 11.126 20.2599 11.0209 19.9991 11.0176C19.7383 11.0142 19.4866 11.1129 19.2975 11.2925L12.0538 18.5325C11.9802 18.6061 11.8855 18.655 11.7829 18.6722C11.6803 18.6895 11.5748 18.6743 11.4813 18.6287L2.13502 14.08C1.76954 13.9047 1.46598 13.6224 1.26454 13.2706C1.06311 12.9189 0.973316 12.5142 1.00707 12.1102C1.04082 11.7063 1.19652 11.3221 1.45354 11.0087C1.71056 10.6952 2.05676 10.4673 2.44627 10.355L26.4388 3.08H26.4575C26.7991 2.98403 27.1601 2.98066 27.5034 3.07025C27.8468 3.15984 28.1601 3.33916 28.4113 3.58981C28.6624 3.84045 28.8424 4.15341 28.9326 4.49656C29.0229 4.83971 29.0203 5.2007 28.925 5.5425Z" fill="currentColor"/> 4748</svg> 4749`,qDt=ae` <svg width="27" height="30" viewBox="0 0 27 30" fill="none"> 4750 <path d="M12.5395 14.3237L0.116699 27.5049V27.5188C0.251527 28.0177 0.49972 28.4788 0.841941 28.866C1.18416 29.2533 1.61117 29.5563 2.0897 29.7515C2.56823 29.9467 3.08536 30.0287 3.60081 29.9913C4.11625 29.9538 4.61609 29.7979 5.06139 29.5356L5.0975 29.512L19.0718 21.4519L12.5395 14.3237Z" fill="#EA4335"/> 4751 <path d="M25.103 12.0833L25.0919 12.0722L19.0611 8.57202L12.2607 14.6279L19.0847 21.4504L25.0919 17.9864C25.6229 17.6983 26.0665 17.2725 26.376 16.7537C26.6854 16.2349 26.8493 15.6422 26.8505 15.0381C26.8516 14.434 26.6899 13.8408 26.3824 13.3208C26.0749 12.8008 25.633 12.3734 25.103 12.0833Z" fill="#FBBC04"/> 4752 <path d="M0.116672 2.49553C0.047224 2.7761 0 3.05528 0 3.35946V26.6537C0 26.9565 0.0347234 27.237 0.116672 27.5162L12.959 14.6725L0.116672 2.49553Z" fill="#4285F4"/> 4753 <path d="M12.634 15.0001L19.0607 8.57198L5.0975 0.477133C4.65115 0.210463 4.14916 0.0506574 3.63079 0.0102139C3.11242 -0.0302296 2.59172 0.0497852 2.10941 0.244001C1.6271 0.438216 1.19625 0.741368 0.850556 1.12975C0.504864 1.51813 0.253698 1.98121 0.116699 2.48279L12.634 15.0001Z" fill="#34A853"/> 4754</svg>`,WDt=ae`<svg width="75" height="20" viewBox="0 0 75 20" fill="none" xmlns="http://www.w3.org/2000/svg"> 4755<path d="M11.6666 5.83334C11.6666 2.61168 14.2783 0 17.5 0H25.8334C29.055 0 31.6666 2.61168 31.6666 5.83334V14.1666C31.6666 17.3883 29.055 20 25.8334 20H17.5C14.2783 20 11.6666 17.3883 11.6666 14.1666V5.83334Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 4756<path d="M19.5068 13.7499L22.4309 5.83331H23.2895L20.3654 13.7499H19.5068Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4757<path d="M0 5.41666C0 2.42513 2.42513 0 5.41666 0C8.40821 0 10.8334 2.42513 10.8334 5.41666V14.5833C10.8334 17.5748 8.40821 20 5.41666 20C2.42513 20 0 17.5748 0 14.5833V5.41666Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 4758<path d="M4.89581 12.4997V11.458H5.93747V12.4997H4.89581Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4759<path d="M32.5 10C32.5 4.47715 36.6896 0 41.8578 0H65.6422C70.8104 0 75 4.47715 75 10C75 15.5229 70.8104 20 65.6422 20H41.8578C36.6896 20 32.5 15.5229 32.5 10Z" fill="var(--apkt-tokens-theme-foregroundTertiary)"/> 4760<path d="M61.7108 12.4475V7.82751H62.5266V8.52418C62.8199 8.01084 63.4157 7.70834 64.0757 7.70834C65.0749 7.70834 65.7715 8.34084 65.7715 9.56918V12.4475H64.9649V9.61503C64.9649 8.80831 64.5066 8.38668 63.8374 8.38668C63.1132 8.38668 62.5266 8.9642 62.5266 9.78001V12.4475H61.7108Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4761<path d="M56.5671 12.4475L55.7147 7.82748H56.4846L57.0896 11.6409L57.8871 9.12916H58.6479L59.4363 11.6134L60.0505 7.82748H60.8204L59.9679 12.4475H59.0513L58.2721 10.0458L57.4838 12.4475H56.5671Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4762<path d="M52.9636 12.5666C51.5611 12.5666 50.7361 11.5217 50.7361 10.1375C50.7361 8.76254 51.5611 7.70834 52.9636 7.70834C54.3661 7.70834 55.1911 8.76254 55.1911 10.1375C55.1911 11.5217 54.3661 12.5666 52.9636 12.5666ZM52.9636 11.8883C53.9719 11.8883 54.357 11.0266 54.357 10.1283C54.357 9.23914 53.9719 8.38668 52.9636 8.38668C51.9552 8.38668 51.5702 9.23914 51.5702 10.1283C51.5702 11.0266 51.9552 11.8883 52.9636 11.8883Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4763<path d="M47.8507 12.5666C46.494 12.5666 45.6415 11.5308 45.6415 10.1375C45.6415 8.75337 46.494 7.70834 47.8507 7.70834C48.9965 7.70834 50.0048 8.35917 49.8948 10.3483H46.4756C46.5398 11.2009 46.934 11.8975 47.8507 11.8975C48.4648 11.8975 48.8681 11.5217 49.0057 11.0908H49.8123C49.684 11.8609 48.9598 12.5666 47.8507 12.5666ZM46.494 9.73416H49.1065C49.0423 8.80831 48.6114 8.37751 47.8507 8.37751C47.0165 8.37751 46.604 8.98254 46.494 9.73416Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4764<path d="M41.7284 12.4475V7.82748H42.5625V8.60665C42.8559 8.09332 43.3601 7.82748 43.8825 7.82748H44.9917V8.60665H43.8184C43.0851 8.60665 42.5625 9.08331 42.5625 10.0092V12.4475H41.7284Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4765</svg> 4766 4767`,HDt=ae` 4768 <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 8"> 4769 <path 4770 fill="var(--apkt-tokens-theme-textPrimary)" 4771 d="m9.524 6.307-1.51 1.584A.35.35 0 0 1 7.76 8H.604a.178.178 0 0 1-.161-.103.168.168 0 0 1 .033-.186l1.51-1.583a.35.35 0 0 1 .256-.11h7.154c.034 0 .068.01.096.029a.168.168 0 0 1 .032.26Zm-1.51-3.189a.35.35 0 0 0-.255-.109H.604a.178.178 0 0 0-.161.103.168.168 0 0 0 .033.186l1.51 1.583a.35.35 0 0 0 .256.11h7.154a.178.178 0 0 0 .16-.104.168.168 0 0 0-.032-.185l-1.51-1.584ZM.605 1.981H7.76a.357.357 0 0 0 .256-.11L9.525.289a.17.17 0 0 0 .032-.185.173.173 0 0 0-.16-.103H2.241a.357.357 0 0 0-.256.109L.476 1.692a.17.17 0 0 0-.033.185.178.178 0 0 0 .16.103Z" 4772 /> 4773 </svg> 4774`,VDt=ae`<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"> 4775 <g clip-path="url(#a)"> 4776 <path fill="url(#b)" d="M0 0h32v32H0z"/> 4777 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.034 15.252c4.975-2.167 8.293-3.596 9.953-4.287 4.74-1.971 5.725-2.314 6.366-2.325.142-.002.457.033.662.198.172.14.22.33.243.463.022.132.05.435.028.671-.257 2.7-1.368 9.248-1.933 12.27-.24 1.28-.71 1.708-1.167 1.75-.99.091-1.743-.655-2.703-1.284-1.502-.985-2.351-1.598-3.81-2.558-1.684-1.11-.592-1.721.368-2.718.252-.261 4.619-4.233 4.703-4.594.01-.045.02-.213-.08-.301-.1-.09-.246-.059-.353-.035-.15.034-2.55 1.62-7.198 4.758-.682.468-1.298.696-1.851.684-.61-.013-1.782-.344-2.653-.628-1.069-.347-1.918-.53-1.845-1.12.039-.308.462-.623 1.27-.944Z" fill="#fff"/> 4778 </g> 4779 <path d="M.5 16C.5 7.44 7.44.5 16 .5 24.56.5 31.5 7.44 31.5 16c0 8.56-6.94 15.5-15.5 15.5C7.44 31.5.5 24.56.5 16Z" stroke="#141414" stroke-opacity=".05"/> 4780 <defs> 4781 <linearGradient id="b" x1="1600" y1="0" x2="1600" y2="3176.27" gradientUnits="userSpaceOnUse"> 4782 <stop stop-color="#2AABEE"/> 4783 <stop offset="1" stop-color="#229ED9"/> 4784 </linearGradient> 4785 <clipPath id="a"> 4786 <path d="M0 16C0 7.163 7.163 0 16 0s16 7.163 16 16-7.163 16-16 16S0 24.837 0 16Z" fill="#fff"/> 4787 </clipPath> 4788 </defs> 4789</svg>`,KDt=ae` 4790 <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewB
4790ox="0 0 10 10"> 4791 <path d="M8.37651 0H1.62309C0.381381 0 -0.405611 1.33944 0.219059 2.42225L4.38701 9.64649C4.659 10.1182 5.3406 10.1182 5.61259 9.64649L9.78139 2.42225C10.4052 1.34117 9.61822 0 8.37736 0H8.37651ZM4.38362 7.48005L3.47591 5.72329L1.2857 1.80606C1.14121 1.55534 1.31968 1.23405 1.62225 1.23405H4.38278V7.4809L4.38362 7.48005ZM8.71221 1.80521L6.52284 5.72414L5.61513 7.48005V1.2332H8.37566C8.67823 1.2332 8.85669 1.55449 8.71221 1.80521Z" fill="var(--apkt-tokens-theme-textPrimary)" /> 4792</svg> 4793`,GDt=ae` 4794 <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 64 64"> 4795 <path fill="var(--apkt-tokens-theme-textPrimary)" d="M61.55 19.28c-3-2.77-7.15-7-10.53-10l-.2-.14a3.82 3.82 0 0 0-1.11-.62l0 0C41.56 7 3.63-.09 2.89 0a1.4 1.4 0 0 0-.58.22L2.12.37a2.23 2.23 0 0 0-.52.84l-.05.13v.71l0 .11C5.82 14.05 22.68 53 26 62.14c.2.62.58 1.8 1.29 1.86h.16c.38 0 2-2.14 2-2.14S58.41 26.74 61.34 23a9.46 9.46 0 0 0 1-1.48A2.41 2.41 0 0 0 61.55 19.28ZM36.88 23.37 49.24 13.12l7.25 6.68Zm-4.8-.67L10.8 5.26l34.43 6.35ZM34 27.27l21.78-3.51-24.9 30ZM7.91 7 30.3 26 27.06 53.78Z"/> 4796 </svg> 4797`,ZDt=ae`<svg fill="none" viewBox="0 0 40 40"> 4798 <g clip-path="url(#a)"> 4799 <g clip-path="url(#b)"> 4800 <circle cx="20" cy="19.89" r="20" fill="#5A3E85" /> 4801 <g clip-path="url(#c)"> 4802 <path 4803 fill="#fff" 4804 d="M18.22 25.7 20 23.91h3.34l2.1-2.1v-6.68H15.4v8.78h2.82v1.77Zm3.87-8.16h1.25v3.66H22.1v-3.66Zm-3.34 0H20v3.66h-1.25v-3.66ZM20 7.9a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.69 14.56-3.66 3.66h-2.72l-1.77 1.78h-1.88V26.1H13.3v-9.82l.94-2.4H26.7v8.56Z" 4805 /> 4806 </g> 4807 </g> 4808 </g> 4809 <defs> 4810 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 4811 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 4812 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 4813 </defs> 4814</svg>`,YDt=ae`<svg fill="none" viewBox="0 0 16 16"> 4815 <path 4816 fill="currentColor" 4817 d="m14.36 4.74.01.42c0 4.34-3.3 9.34-9.34 9.34A9.3 9.3 0 0 1 0 13.03a6.6 6.6 0 0 0 4.86-1.36 3.29 3.29 0 0 1-3.07-2.28c.5.1 1 .07 1.48-.06A3.28 3.28 0 0 1 .64 6.11v-.04c.46.26.97.4 1.49.41A3.29 3.29 0 0 1 1.11 2.1a9.32 9.32 0 0 0 6.77 3.43 3.28 3.28 0 0 1 5.6-3 6.59 6.59 0 0 0 2.08-.8 3.3 3.3 0 0 1-1.45 1.82A6.53 6.53 0 0 0 16 3.04c-.44.66-1 1.23-1.64 1.7Z" 4818 /> 4819</svg>`,JDt=ae` 4820<svg xmlns="http://www.w3.org/2000/svg" width="89" height="89" viewBox="0 0 89 89" fill="none"> 4821<path d="M60.0468 39.2502L65.9116 33.3854C52.6562 20.13 36.1858 20.13 22.9304 33.3854L28.7952 39.2502C38.8764 29.169 49.9725 29.169 60.0536 39.2502H60.0468Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4822<path d="M58.0927 52.9146L44.415 39.2369L30.7373 52.9146L17.0596 39.2369L11.2017 45.0949L30.7373 64.6374L44.415 50.9597L58.0927 64.6374L77.6284 45.0949L71.7704 39.2369L58.0927 52.9146Z" fill="var(--apkt-tokens-theme-textPrimary)"/> 4823</svg>`,XDt=ae` 4824<svg xmlns="http://www.w3.org/2000/svg" width="89" height="89" viewBox="0 0 89 89" fill="none"> 4825<path d="M60.0468 39.2502L65.9116 33.3854C52.6562 20.13 36.1858 20.13 22.9304 33.3854L28.7952 39.2502C38.8764 29.169 49.9725 29.169 60.0536 39.2502H60.0468Z" fill="var(--apkt-tokens-theme-textInvert)"/> 4826<path d="M58.0927 52.9146L44.415 39.2369L30.7373 52.9146L17.0596 39.2369L11.2017 45.0949L30.7373 64.6374L44.415 50.9597L58.0927 64.6374L77.6284 45.0949L71.7704 39.2369L58.0927 52.9146Z" fill="var(--apkt-tokens-theme-textInvert)"/> 4827</svg>`,QDt=ae` 4828<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 4829<g clip-path="url(#clip0_22274_4692)"> 4830<path d="M0 6.64C0 4.17295 0 2.93942 0.525474 2.01817C0.880399 1.39592 1.39592 0.880399 2.01817 0.525474C2.93942 0 4.17295 0 6.64 0H9.36C11.8271 0 13.0606 0 13.9818 0.525474C14.6041 0.880399 15.1196 1.39592 15.4745 2.01817C16 2.93942 16 4.17295 16 6.64V9.36C16 11.8271 16 13.0606 15.4745 13.9818C15.1196 14.6041 14.6041 15.1196 13.9818 15.4745C13.0606 16 11.8271 16 9.36 16H6.64C4.17295 16 2.93942 16 2.01817 15.4745C1.39592 15.1196 0.880399 14.6041 0.525474 13.9818C0 13.0606 0 11.8271 0 9.36V6.64Z" fill="#C7B994"/> 4831<path d="M4.49038 5.76609C6.42869 3.86833 9.5713 3.86833 11.5096 5.76609L11.7429 5.99449C11.8398 6.08938 11.8398 6.24323 11.7429 6.33811L10.9449 7.11942C10.8964 7.16686 10.8179 7.16686 10.7694 7.11942L10.4484 6.80512C9.09617 5.48119 6.90381 5.48119 5.5516 6.80512L5.20782 7.14171C5.15936 7.18915 5.08079 7.18915 5.03234 7.14171L4.23434 6.3604C4.13742 6.26552 4.13742 6.11167 4.23434 6.01678L4.49038 5.76609ZM13.1599 7.38192L13.8702 8.07729C13.9671 8.17217 13.9671 8.32602 13.8702 8.4209L10.6677 11.5564C10.5708 11.6513 10.4137 11.6513 10.3168 11.5564L8.04388 9.33105C8.01965 9.30733 7.98037 9.30733 7.95614 9.33105L5.6833 11.5564C5.58638 11.6513 5.42925 11.6513 5.33234 11.5564L2.12982 8.42087C2.0329 8.32598 2.0329 8.17213 2.12982 8.07724L2.84004 7.38188C2.93695 7.28699 3.09408 7.28699 3.191 7.38188L5.46392 9.60726C5.48815 9.63098 5.52743 9.63098 5.55166 9.60726L7.82447 7.38188C7.92138 7.28699 8.07851 7.28699 8.17543 7.38187L10.4484 9.60726C10.4726 9.63098 10.5119 9.63098 10.5361 9.60726L12.809 7.38192C12.9059 7.28703 13.063 7.28703 13.1599 7.38192Z" fill="currentColor"/> 4832</g> 4833<defs> 4834<clipPath id="clip0_22274_4692"> 4835<path d="M0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8Z" fill="white"/> 4836</clipPath> 4837</defs> 4838</svg> 4839`,eUt=ae` 4840<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 4841<circle cx="11" cy="11" r="11" transform="matrix(-1 0 0 1 23 1)" fill="#202020"/> 4842<circle cx="11" cy="11" r="11.5" transform="matrix(-1 0 0 1 23 1)" stroke="#C7B994" stroke-opacity="0.7"/> 4843<path d="M15.4523 11.0686L16.7472 9.78167C13.8205 6.87297 10.1838 6.87297 7.25708 9.78167L8.55201 11.0686C10.7779 8.85645 13.2279 8.85645 15.4538 11.0686H15.4523Z" fill="#C7B994"/> 4844<path d="M15.0199 14.067L12 11.0656L8.98 14.067L5.96004 11.0656L4.66663 12.3511L8.98 16.6393L12 13.638L15.0199 16.6393L19.3333 12.3511L18.0399 11.0656L15.0199 14.067Z" fill="#C7B994"/> 4845</svg> 4846`,Vce=ae`<svg fill="none" viewBox="0 0 41 40"> 4847 <g clip-path="url(#a)"> 4848 <path fill="#000" d="M.8 0h40v40H.8z" /> 4849 <path 4850 fill="#fff" 4851 d="m22.63 18.46 7.14-8.3h-1.69l-6.2 7.2-4.96-7.2H11.2l7.5 10.9-7.5 8.71h1.7l6.55-7.61 5.23 7.61h5.72l-7.77-11.31Zm-9.13-7.03h2.6l11.98 17.13h-2.6L13.5 11.43Z" 4852 /> 4853 </g>
4854 <defs> 4855 <clipPath id="a"><path fill="#fff" d="M.8 20a20 20 0 1 1 40 0 20 20 0 0 1-40 0Z" /></clipPath> 4856 </defs> 4857</svg>`,tUt=Xe` 4858 :host { 4859 display: flex; 4860 justify-content: center; 4861 align-items: center; 4862 aspect-ratio: 1 / 1; 4863 color: var(--local-color); 4864 width: var(--local-width); 4865 } 4866 4867 svg { 4868 height: inherit; 4869 width: inherit; 4870 object-fit: contain; 4871 object-position: center; 4872 } 4873`;var nx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const nUt={add:"ph-plus",allWallets:"ph-dots-three",arrowBottom:"ph-arrow-down",arrowBottomCircle:"ph-arrow-circle-down",arrowClockWise:"ph-arrow-clockwise",arrowLeft:"ph-arrow-left",arrowRight:"ph-arrow-right",arrowTop:"ph-arrow-up",arrowTopRight:"ph-arrow-up-right",bank:"ph-bank",bin:"ph-trash",browser:"ph-browser",card:"ph-credit-card",checkmarkBold:"ph-check",chevronBottom:"ph-caret-down",chevronLeft:"ph-caret-left",chevronRight:"ph-caret-right",chevronTop:"ph-caret-up",clock:"ph-clock",close:"ph-x",coinPlaceholder:"ph-circle-half",compass:"ph-compass",copy:"ph-copy",desktop:"ph-desktop",dollar:"ph-currency-dollar",download:"ph-vault",exclamationCircle:"ph-warning-circle",extension:"ph-puzzle-piece",externalLink:"ph-arrow-square-out",filters:"ph-funnel-simple",helpCircle:"ph-question",id:"ph-identification-card",image:"ph-image",info:"ph-info",lightbulb:"ph-lightbulb",mail:"ph-envelope",mobile:"ph-device-mobile",more:"ph-dots-three",networkPlaceholder:"ph-globe",nftPlaceholder:"ph-image",plus:"ph-plus",power:"ph-power",qrCode:"ph-qr-code",questionMark:"ph-question",refresh:"ph-arrow-clockwise",recycleHorizontal:"ph-arrows-clockwise",search:"ph-magnifying-glass",sealCheck:"ph-seal-check",send:"ph-paper-plane-right",signOut:"ph-sign-out",spinner:"ph-spinner",swapHorizontal:"ph-arrows-left-right",swapVertical:"ph-arrows-down-up",threeDots:"ph-dots-three",user:"ph-user",verify:"ph-seal-check",verifyFilled:"ph-seal-check",wallet:"ph-wallet",warning:"ph-warning",warningCircle:"ph-warning-circle",appStore:"",apple:"",bitcoin:"",coins:"",chromeStore:"",cursor:"",discord:"",ethereum:"",etherscan:"",facebook:"",farcaster:"",github:"",google:"",playStore:"",paperPlaneTitle:"",reown:"",solana:"",ton:"",tron:"",telegram:"",twitch:"",twitterIcon:"",twitter:"",walletConnect:"",walletConnectBrown:"",walletConnectLightBrown:"",x:"",infoSeal:"",checkmark:""},rUt={"ph-arrow-circle-down":()=>te(()=>import("./PhArrowCircleDown-C8sfqb_q.js"),__vite__mapDeps([0,1])),"ph-arrow-clockwise":()=>te(()=>import("./PhArrowClockwise-DtPSkNiy.js"),__vite__mapDeps([2,1])),"ph-arrow-down":()=>te(()=>import("./PhArrowDown-BA6bqI-h.js"),__vite__mapDeps([3,1])),"ph-arrow-left":()=>te(()=>import("./PhArrowLeft-BagVykqk.js"),__vite__mapDeps([4,1])),"ph-arrow-right":()=>te(()=>import("./PhArrowRight-meiNum-s.js"),__vite__mapDeps([5,1])),"ph-arrow-square-out":()=>te(()=>import("./PhArrowSquareOut-DuB9-oNy.js"),__vite__mapDeps([6,1])),"ph-arrows-down-up":()=>te(()=>import("./PhArrowsDownUp-Bwprpk5p.js"),__vite__mapDeps([7,1])),"ph-arrows-left-right":()=>te(()=>import("./PhArrowsLeftRight-CBa1AHPv.js"),__vite__mapDeps([8,1])),"ph-arrow-up":()=>te(()=>import("./PhArrowUp-BNML-ssX.js"),__vite__mapDeps([9,1])),"ph-arrow-up-right":()=>te(()=>import("./PhArrowUpRight-E9p7twEV.js"),__vite__mapDeps([10,1])),"ph-arrows-clockwise":()=>te(()=>import("./PhArrowsClockwise-DPavEfmI.js"),__vite__mapDeps([11,1])),"ph-bank":()=>te(()=>import("./PhBank-ChEGvcrG.js"),__vite__mapDeps([12,1])),"ph-browser":()=>te(()=>import("./PhBrowser-DAHUmQYP.js"),__vite__mapDeps([13,1])),"ph-caret-down":()=>te(()=>import("./PhCaretDown-CVPAhONG.js"),__vite__mapDeps([14,1])),"ph-caret-left":()=>te(()=>import("./PhCaretLeft-Cjnn7efI.js"),__vite__mapDeps([15,1])),"ph-caret-right":()=>te(()=>import("./PhCaretRight-BOw6b8E-.js"),__vite__mapDeps([16,1])),"ph-caret-up":()=>te(()=>import("./PhCaretUp-CRyMReh0.js"),__vite__mapDeps([17,1])),"ph-check":()=>te(()=>import("./PhCheck-BjfM-ObM.js"),__vite__mapDeps([18,1])),"ph-circle-half":()=>te(()=>import("./PhCircleHalf-Dw6KHNdh.js"),__vite__mapDeps([19,1])),"ph-clock":()=>te(()=>import("./PhClock-DgL7-xE_.js"),__vite__mapDeps([20,1])),"ph-compass":()=>te(()=>import("./PhCompass-Dfw_iYBq.js"),__vite__mapDeps([21,1])),"ph-copy":()=>te(()=>import("./PhCopy-CBFzCcT0.js"),__vite__mapDeps([22,1])),"ph-credit-card":()=>te(()=>import("./PhCreditCard-DxzeozHs.js"),__vite__mapDeps([23,1])),"ph-currency-dollar":()=>te(()=>import("./PhCurrencyDollar-DBM7izx7.js"),__vite__mapDeps([24,1])
4873),"ph-desktop":()=>te(()=>import("./PhDesktop-BQJ0jJEw.js"),__vite__mapDeps([25,1])),"ph-device-mobile":()=>te(()=>import("./PhDeviceMobile-B5SC4g2S.js"),__vite__mapDeps([26,1])),"ph-dots-three":()=>te(()=>import("./PhDotsThree-89amEoiE.js"),__vite__mapDeps([27,1])),"ph-vault":()=>te(()=>import("./PhVault-tuRA-lQz.js"),__vite__mapDeps([28,1])),"ph-envelope":()=>te(()=>import("./PhEnvelope-DheiVAl2.js"),__vite__mapDeps([29,1])),"ph-funnel-simple":()=>te(()=>import("./PhFunnelSimple-D2VcnCQ3.js"),__vite__mapDeps([30,1])),"ph-globe":()=>te(()=>import("./PhGlobe-BOWfnrZq.js"),__vite__mapDeps([31,1])),"ph-identification-card":()=>te(()=>import("./PhIdentificationCard-CoKk3ytY.js"),__vite__mapDeps([32,1])),"ph-image":()=>te(()=>import("./PhImage-DYKjtKeZ.js"),__vite__mapDeps([33,1])),"ph-info":()=>te(()=>import("./PhInfo-Wr7tBEGO.js"),__vite__mapDeps([34,1])),"ph-lightbulb":()=>te(()=>import("./PhLightbulb-DfclYvXe.js"),__vite__mapDeps([35,1])),"ph-magnifying-glass":()=>te(()=>import("./PhMagnifyingGlass-ptT4GDlT.js"),__vite__mapDeps([36,1])),"ph-paper-plane-right":()=>te(()=>import("./PhPaperPlaneRight-DlGPga9t.js"),__vite__mapDeps([37,1])),"ph-plus":()=>te(()=>import("./PhPlus-Bv1d-A17.js"),__vite__mapDeps([38,1])),"ph-power":()=>te(()=>import("./PhPower-i0OFmFkP.js"),__vite__mapDeps([39,1])),"ph-puzzle-piece":()=>te(()=>import("./PhPuzzlePiece-BIQHBxgR.js"),__vite__mapDeps([40,1])),"ph-qr-code":()=>te(()=>import("./PhQrCode-DYymT0U6.js"),__vite__mapDeps([41,1])),"ph-question":()=>te(()=>import("./PhQuestion-V-t4d9L8.js"),__vite__mapDeps([42,1])),"ph-question-circle":()=>te(()=>import("./PhQuestionMark-BlrV0OLv.js"),__vite__mapDeps([43,1])),"ph-seal-check":()=>te(()=>import("./PhSealCheck-DJg6zkcd.js"),__vite__mapDeps([44,1])),"ph-sign-out":()=>te(()=>import("./PhSignOut-3LIUMyak.js"),__vite__mapDeps([45,1])),"ph-spinner":()=>te(()=>import("./PhSpinner-CgS0DtZv.js"),__vite__mapDeps([46,1])),"ph-trash":()=>te(()=>import("./PhTrash-Bjt7wbP4.js"),__vite__mapDeps([47,1])),"ph-user":()=>te(()=>import("./PhUser-DHlhekvv.js"),__vite__mapDeps([48,1])),"ph-wallet":()=>te(()=>import("./PhWallet-CzKiZSmU.js"),__vite__mapDeps([49,1])),"ph-warning":()=>te(()=>import("./PhWarning-VwPb-1BV.js"),__vite__mapDeps([50,1])),"ph-warning-circle":()=>te(()=>import("./PhWarningCircle-B82beykt.js"),__vite__mapDeps([51,1])),"ph-x":()=>te(()=>import("./PhX-iUNICe98.js"),__vite__mapDeps([52,1]))},sUt={appStore:ADt,apple:_Dt,bitcoin:NDt,coins:ODt,chromeStore:PDt,cursor:kDt,discord:RDt,ethereum:BDt,etherscan:DDt,facebook:UDt,farcaster:LDt,github:MDt,google:jDt,playStore:qDt,paperPlaneTitle:zDt,reown:WDt,solana:HDt,ton:KDt,tron:GDt,telegram:VDt,twitch:ZDt,twitter:Vce,twitterIcon:YDt,walletConnect:JDt,walletConnectInvert:XDt,walletConnectBrown:eUt,walletConnectLightBrown:QDt,x:Vce,infoSeal:FDt,checkmark:TDt},iUt={"accent-primary":Fr.tokens.core.iconAccentPrimary,"accent-certified":Fr.tokens.core.iconAccentCertified,"foreground-secondary":Fr.tokens.theme.foregroundSecondary,default:Fr.tokens.theme.iconDefault,success:Fr.tokens.core.iconSuccess,error:Fr.tokens.core.iconError,warning:Fr.tokens.core.iconWarning,inverse:Fr.tokens.theme.iconInverse};let zy=class extends ce{constructor(){super(...arguments),this.size="md",this.name="copy",this.weight="bold",this.color="inherit"}render(){const t={xxs:"2",xs:"3",sm:"3",md:"4",mdl:"5",lg:"5",xl:"6",xxl:"7",inherit:"inherit"};this.style.cssText=` 4874 --local-width: ${this.size==="inherit"?"inherit":`var(--apkt-spacing-${t[this.size]})`}; 4875 --local-color: ${this.color==="inherit"?"inherit":iUt[this.color]} 4876 `;const n=nUt[this.name];if(n&&n!==""){const r=rUt[n];r&&r();const s=PEe(n);return R_`<${s} size=${{xxs:"0.5em",xs:"0.75em",sm:"0.75em",md:"1em",mdl:"1.25em",lg:"1.25em",xl:"1.5em",xxl:"1.75em"}[this.size]} weight="${this.weight}"></${s}>`}return sUt[this.name]||R_``}};zy.styles=[Ca,tUt];nx([z()],zy.prototype,"size",void 0);nx([z()],zy.prototype,"name",void 0);nx([z()],zy.prototype,"weight",void 0);nx([z()],zy.prototype,"color",void 0);zy=nx([ns("wui-icon")],zy);const oUt=Xe` 4877 :host { 4878 display: flex; 4879 } 4880 4881 :host([data-size='sm']) > svg { 4882 width: 12px; 4883 height: 12px; 4884 } 4885 4886 :host([data-size='md']) > svg { 4887 width: 16px; 4888 height: 16px; 4889 } 4890 4891 :host([data-size='lg']) > svg { 4892 width: 24px; 4893 height: 24px; 4894 } 4895 4896 :host([data-size='xl']) > svg { 4897 width: 32px; 4898 height: 32px; 4899 } 4900 4901 svg { 4902 animation: rotate 1.4s linear infinite; 4903 color: var(--local-color); 4904 } 4905 4906 :host([data-size='md']) > svg > circle { 4907 stroke-width: 6px; 4908 } 4909 4910 :host([data-size='sm']) > svg > circle { 4911 stroke-width: 8px; 4912 } 4913 4914 @keyframes rotate { 4915 100% { 4916 transform: rotate(360deg); 4917 } 4918 } 4919`;var WG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let eC=class extends ce{constructor(){super(...arguments),this.color="primary",this.size="lg"}render(){const t={primary:Fr.tokens.theme.textPrimary,secondary:Fr.tokens.theme.textSecondary,tertiary:Fr.tokens.theme.textTertiary,invert:Fr.tokens.theme.textInvert,error:Fr.tokens.core.textError,warning:Fr.tokens.core.textWarning,"accent-primary":Fr.tokens.core.textAccentPrimary};return this.style.cssText=` 4920 --local-color: ${this.color==="inherit"?"inherit":t[this.color]}; 4921 `,this.dataset.size=this.size,j`<svg viewBox="0 0 16 17" fill="none"> 4922 <path 4923 d="M8.75 2.65625V4.65625C8.75 4.85516 8.67098 5.04593 8.53033 5.18658C8.38968 5.32723 8.19891 5.40625 8 5.40625C7.80109 5.40625 7.61032 5.32723 7.46967 5.18658C7.32902 5.04593 7.25 4.85516 7.25 4.65625V2.65625C7.25 2.45734 7.32902 2.26657 7.46967 2.12592C7.61032 1.98527 7.80109 1.90625 8 1.90625C8.19891 1.90625 8.38968 1.98527 8.53033 2.12592C8.67098 2.26657 8.75 2.45734 8.75 2.65625ZM14 7.90625H12C11.8011 7.90625 11.6103 7.98527 11.4697 8.12592C11.329 8.26657 11.25 8.45734 11.25 8.65625C11.25 8.85516 11.329 9.04593 11.4697 9.18658C11.6103 9.32723 11.8011 9.40625 12 9.40625H14C14.1989 9.40625 14.3897 9.32723 14.5303 9.18658C14.671 9.04593 14.75 8.85516 14.75 8.65625C14.75 8.45734 14.671 8.26657 14.5303 8.12592C14.3897 7.98527 14.1989 7.90625 14 7.90625ZM11.3588 10.9544C11.289 10.8846 11.2062 10.8293 11.115 10.7915C11.0239 10.7538 10.9262 10.7343 10.8275 10.7343C10.7288 10.7343 10.6311 10.7538 10.54 10.7915C10.4488 10.8293 10.366 10.8846 10.2963 10.9544C10.2265 11.0241 10.1711 11.107 10.1334 11.1981C10.0956 11.2893 10.0762 11.387 10.0762 11.4856C10.0762 11.5843 10.0956 11.682 10.1334 11.7731C10.1711 11.8643 10.2265 11.9471 10.2963 12.0169L11.7106 13.4312C11.8515 13.5721 12.0426 13.6513 12.2419 13.6513C12.4411 13.6513 12.6322 13.5721 12.7731 13.4312C12.914 13.2904 12.9932 13.0993 12.9932 12.9C12.9932 12.7007 12.914 12.5096 12.7731 12.3687L11.3588 10.9544ZM8 11.9062C7.80109 11.9062 7.61032 11.9853 7.46967 12.1259C7.32902 12.2666 7.25 12.4573 7.25 12.6562V14.6562C7.25 14.8552 7.32902 15.0459 7.46967 15.1866C7.61032 15.3272 7.80109 15.4062 8 15.4062C8.19891 15.4062 8.38968 15.3272 8.53033 15.1866C8.67098 15.0459 8.75 14.8552 8.75 14.6562V12.6562C8.75 12.4573 8.67098 12.2666 8.53033 12.1259C8.38968 11.9853 8.19891 11.9062 8 11.9062ZM4.64125 10.9544L3.22688 12.3687C3.08598 12.5096 3.00682 12.7007 3.00682 12.9C3.00682 13.0993 3.08598 13.2904 3.22688 13.4312C3.36777 13.5721 3.55887 13.6513 3.75813 13.6513C3.95738 13.6513 4.14848 13.5721 4.28937 13.4312L5.70375 12.0169C5.84465 11.876 5.9238 11.6849 5.9238 11.4856C5.9238 11.2864 5.84465 11.0953 5.70375 10.9544C5.56285 10.8135 5.37176 10.7343 5.1725 10.7343C4.97324 10.7343 4.78215 10.8135 4.64125 10.9544ZM4.75 8.65625C4.75 8.45734 4.67098 8.26657 4.53033 8.12592C4.38968 7.98527 4.19891 7.90625 4 7.90625H2C1.80109 7.90625 1.61032 7.98527 1.46967 8.12592C1.32902 8.26657 1.25 8.45734 1.25 8.65625C1.25 8.85516 1.32902 9.04593 1.46967 9.18658C1.61032 9.32723 1.80109 9.40625 2 9.40625H4C4.19891 9.40625 4.38968 9.32723 4.53033 9.18658C4.67098 9.04593 4.75 8.85516 4.75 8.65625ZM4.2875 3.88313C4.1466 3.74223 3.95551 3.66307 3.75625 3.66307C3.55699 3.66307 3.3659 3.74223 3.225 3.88313C3.0841 4.02402 3.00495 4.21512 3.00495 4.41438C3.00495 4.61363 3.0841 4.80473 3.225 4.94562L4.64125 6.35813C4.78215 6.49902 4.97324 6.57818 5.1725 6.57818C5.37176 6.57818 5.56285 6.49902 5.70375 6.35813C5.84465 6.21723 5.9238 6.02613 5.9238 5.82688C5.9238 5.62762 5.84465 5.43652 5.70375 5.29563L4.2875 3.88313Z" 4924 fill="currentColor" 4925 /> 4926 </svg>`}};eC.styles=[Ca,oUt];WG([z()],eC.prototype,"color",void 0);WG([z()],eC.prototype,"size",void 0);eC=WG([ns("wui-loading-spinner")],eC);
4926const aUt=Ms` 4927 slot { 4928 width: 100%; 4929 display: inline-block; 4930 font-style: normal; 4931 overflow: inherit; 4932 text-overflow: inherit; 4933 text-align: var(--local-align); 4934 color: var(--local-color); 4935 } 4936 4937 .wui-line-clamp-1 { 4938 overflow: hidden; 4939 display: -webkit-box; 4940 -webkit-box-orient: vertical; 4941 -webkit-line-clamp: 1; 4942 } 4943 4944 .wui-line-clamp-2 { 4945 overflow: hidden; 4946 display: -webkit-box; 4947 -webkit-box-orient: vertical; 4948 -webkit-line-clamp: 2; 4949 } 4950 4951 /* -- Headings --------------------------------------------------- */ 4952 .wui-font-h1-regular-mono { 4953 font-size: ${({textSize:e})=>e.h1}; 4954 line-height: ${({typography:e})=>e["h1-regular-mono"].lineHeight}; 4955 letter-spacing: ${({typography:e})=>e["h1-regular-mono"].letterSpacing}; 4956 font-weight: ${({fontWeight:e})=>e.regular}; 4957 font-family: ${({fontFamily:e})=>e.mono}; 4958 } 4959 4960 .wui-font-h1-regular { 4961 font-size: ${({textSize:e})=>e.h1}; 4962 line-height: ${({typography:e})=>e["h1-regular"].lineHeight}; 4963 letter-spacing: ${({typography:e})=>e["h1-regular"].letterSpacing}; 4964 font-weight: ${({fontWeight:e})=>e.regular}; 4965 font-family: ${({fontFamily:e})=>e.regular}; 4966 font-feature-settings: 4967 'liga' off, 4968 'clig' off; 4969 } 4970 4971 .wui-font-h1-medium { 4972 font-size: ${({textSize:e})=>e.h1}; 4973 line-height: ${({typography:e})=>e["h1-medium"].lineHeight}; 4974 letter-spacing: ${({typography:e})=>e["h1-medium"].letterSpacing}; 4975 font-weight: ${({fontWeight:e})=>e.medium}; 4976 font-family: ${({fontFamily:e})=>e.regular}; 4977 font-feature-settings: 4978 'liga' off, 4979 'clig' off; 4980 } 4981 4982 .wui-font-h2-regular-mono { 4983 font-size: ${({textSize:e})=>e.h2}; 4984 line-height: ${({typography:e})=>e["h2-regular-mono"].lineHeight}; 4985 letter-spacing: ${({typography:e})=>e["h2-regular-mono"].letterSpacing}; 4986 font-weight: ${({fontWeight:e})=>e.regular}; 4987 font-family: ${({fontFamily:e})=>e.mono}; 4988 } 4989 4990 .wui-font-h2-regular { 4991 font-size: ${({textSize:e})=>e.h2}; 4992 line-height: ${({typography:e})=>e["h2-regular"].lineHeight}; 4993 letter-spacing: ${({typography:e})=>e["h2-regular"].letterSpacing}; 4994 font-weight: ${({fontWeight:e})=>e.regular}; 4995 font-family: ${({fontFamily:e})=>e.regular}; 4996 font-feature-settings: 4997 'liga' off, 4998 'clig' off; 4999 } 5000 5001 .wui-font-h2-medium { 5002 font-size: ${({textSize:e})=>e.h2}; 5003 line-height: ${({typography:e})=>e["h2-medium"].lineHeight}; 5004 letter-spacing: ${({typography:e})=>e["h2-medium"].letterSpacing}; 5005 font-weight: ${({fontWeight:e})=>e.medium}; 5006 font-family: ${({fontFamily:e})=>e.regular}; 5007 font-feature-settings: 5008 'liga' off, 5009 'clig' off; 5010 } 5011 5012 .wui-font-h3-regular-mono { 5013 font-size: ${({textSize:e})=>e.h3}; 5014 line-height: ${({typography:e})=>e["h3-regular-mono"].lineHeight}; 5015 letter-spacing: ${({typography:e})=>e["h3-regular-mono"].letterSpacing}; 5016 font-weight: ${({fontWeight:e})=>e.regular}; 5017 font-family: ${({fontFamily:e})=>e.mono}; 5018 } 5019 5020 .wui-font-h3-regular { 5021 font-size: ${({textSize:e})=>e.h3}; 5022 line-height: ${({typography:e})=>e["h3-regular"].lineHeight}; 5023 letter-spacing: ${({typography:e})=>e["h3-regular"].letterSpacing}; 5024 font-weight: ${({fontWeight:e})=>e.regular}; 5025 font-family: ${({fontFamily:e})=>e.regular}; 5026 font-feature-settings: 5027 'liga' off, 5028 'clig' off; 5029 } 5030 5031 .wui-font-h3-medium { 5032 font-size: ${({textSize:e})=>e.h3}; 5033 line-height: ${({typography:e})=>e["h3-medium"].lineHeight}; 5034 letter-spacing: ${({typography:e})=>e["h3-medium"].letterSpacing}; 5035 font-weight: ${({fontWeight:e})=>e.medium}; 5036 font-family: ${({fontFamily:e})=>e.regular}; 5037 font-feature-settings: 5038 'liga' off, 5039 'clig' off; 5040 } 5041 5042 .wui-font-h4-regular-mono { 5043 font-size: ${({textSize:e})=>e.h4}; 5044 line-height: ${({typography:e})=>e["h4-regular-mono"].lineHeight}; 5045 letter-spacing: ${({typography:e})=>e["h4-regular-mono"].letterSpacing}; 5046 font-weight: ${({fontWeight:e})=>e.regular}; 5047 font-family: ${({fontFamily:e})=>e.mono}; 5048 } 5049 5050 .wui-font-h4-regular { 5051 font-size: ${({textSize:e})=>e.h4}; 5052 line-height: ${({typography:e})=>e["h4-regular"].lineHeight}; 5053 letter-spacing: ${({typography:e})=>e["h4-regular"].letterSpacing}; 5054 font-weight: ${({fontWeight:e})=>e.regular}; 5055 font-family: ${({fontFamily:e})=>e.regular}; 5056 font-feature-settings: 5057 'liga' off, 5058 'clig' off; 5059 } 5060 5061 .wui-font-h4-medium { 5062 font-size: ${({textSize:e})=>e.h4}; 5063 line-height: ${({typography:e})=>e["h4-medium"].lineHeight}; 5064 letter-spacing: ${({typography:e})=>e["h4-medium"].letterSpacing}; 5065 font-weight: ${({fontWeight:e})=>e.medium}; 5066 font-family: ${({fontFamily:e})=>e.regular}; 5067 font-feature-settings: 5068 'liga' off, 5069 'clig' off; 5070 } 5071 5072 .wui-font-h5-regular-mono { 5073 font-size: ${({textSize:e})=>e.h5}; 5074 line-height: ${({typography:e})=>e["h5-regular-mono"].lineHeight}; 5075 letter-spacing: ${({typography:e})=>e["h5-regular-mono"].letterSpacing}; 5076 font-weight: ${({fontWeight:e})=>e.regular}; 5077 font-family: ${({fontFamily:e})=>e.mono}; 5078 } 5079 5080 .wui-font-h5-regular { 5081 font-size: ${({textSize:e})=>e.h5}; 5082 line-height: ${({typography:e})=>e["h5-regular"].lineHeight}; 5083 letter-spacing: ${({typography:e})=>e["h5-regular"].letterSpacing}; 5084 font-weight: ${({fontWeight:e})=>e.regular}; 5085 font-family: ${({fontFamily:e})=>e.regular}; 5086 font-feature-settings: 5087 'liga' off, 5088 'clig' off; 5089 } 5090 5091 .wui-font-h5-medium { 5092 font-size: ${({textSize:e})=>e.h5}; 5093 line-height: ${({typography:e})=>e["h5-medium"].lineHeight}; 5094 letter-spacing: ${({typography:e})=>e["h5-medium"].letterSpacing}; 5095 font-weight: ${({fontWeight:e})=>e.medium}; 5096 font-family: ${({fontFamily:e})=>e.regular}; 5097 font-feature-settings: 5098 'liga' off, 5099 'clig' off; 5100 } 5101 5102 .wui-font-h6-regular-mono { 5103 font-size: ${({textSize:e})=>e.h6}; 5104 line-height: ${({typography:e})=>e["h6-regular-mono"].lineHeight}; 5105 letter-spacing: ${({typography:e})=>e["h6-regular-mono"].letterSpacing}; 5106 font-weight: ${({fontWeight:e})=>e.regular}; 5107 font-family: ${({fontFamily:e})=>e.mono}; 5108 } 5109 5110 .wui-font-h6-regular { 5111 font-size: ${({textSize:e})=>e.h6}; 5112 line-height: ${({typography:e})=>e["h6-regular"].lineHeight}; 5113 letter-spacing: ${({typography:e})=>e["h6-regular"].letterSpacing}; 5114 font-weight: ${({fontWeight:e})=>e.regular}; 5115 font-family: ${({fontFamily:e})=>e.regular}; 5116 font-feature-settings: 5117 'liga' off, 5118 'clig' off; 5119 } 5120 5121 .wui-font-h6-medium { 5122 font-size: ${({textSize:e})=>e.h6}; 5123 line-height: ${({typography:e})=>e["h6-medium"].lineHeight}; 5124 letter-spacing: ${({typography:e})=>e["h6-medium"].letterSpacing}; 5125 font-weight: ${({fontWeight:e})=>e.medium}; 5126 font-family: ${({fontFamily:e})=>e.regular}; 5127 font-feature-settings: 5128 'liga' off, 5129 'clig' off; 5130 } 5131 5132 .wui-font-lg-regular-mono { 5133 font-size: ${({textSize:e})=>e.large}; 5134 line-height: ${({typography:e})=>e["lg-regular-mono"].lineHeight}; 5135 letter-spacing: ${({typography:e})=>e["lg-regular-mono"].letterSpacing}; 5136 font-weight: ${({fontWeight:e})=>e.regular}; 5137 font-family: ${({fontFamily:e})=>e.mono}; 5138 } 5139 5140 .wui-font-lg-regular { 5141 font-size: ${({textSize:e})=>e.large}; 5142 line-height: ${({typography:e})=>e["lg-regular"].lineHeight}; 5143 letter-spacing: ${({typography:e})=>e["lg-regular"].letterSpacing}; 5144 font-weight: ${({fontWeight:e})=>e.regular}; 5145 font-family: ${({fontFamily:e})=>e.regular}; 5146 font-feature-settings: 5147 'liga' off, 5148 'clig' off; 5149 } 5150 5151 .wui-font-lg-medium { 5152 font-size: ${({textSize:e})=>e.large}; 5153 line-height: ${({typography:e})=>e["lg-medium"].lineHeight}; 5154 letter-spacing: ${({typography:e})=>e["lg-medium"].letterSpacing}; 5155 font-weight: ${({fontWeight:e})=>e.medium}; 5156 font-family: ${({fontFamily:e})=>e.regular}; 5157 font-feature-settings: 5158 'liga' off, 5159 'clig' off; 5160 } 5161 5162 .wui-font-md-regular-mono { 5163 font-size: ${({textSize:e})=>e.medium}; 5164 line-height: ${({typography:e})=>e["md-regular-mono"].lineHeight}; 5165 letter-spacing: ${({typography:e})=>e["md-regular-mono"].letterSpacing}; 5166 font-weight: ${({fontWeight:e})=>e.regular}; 5167 font-family: ${({fontFamily:e})=>e.mono}; 5168 } 5169 5170 .wui-font-md-regular { 5171 font-size: ${({textSize:e})=>e.medium}; 5172 line-height: ${({typography:e})=>e["md-regular"].lineHeight}; 5173 letter-spacing: ${({typography:e})=>e["md-regular"].letterSpacing}; 5174 font-weight: ${({fontWeight:e})=>e.regular}; 5175 font-family: ${({fontFamily:e})=>e.regular}; 5176 font-feature-settings: 5177 'liga' off, 5178 'clig' off; 5179 } 5180 5181 .wui-font-md-medium { 5182 font-size: ${({textSize:e})=>e.medium}; 5183 line-height: ${({typography:e})=>e["md-medium"].lineHeight}; 5184 letter-spacing: ${({typography:e})=>e["md-medium"].letterSpacing}; 5185 font-weight: ${({fontWeight:e})=>e.medium}; 5186 font-family: ${({fontFamily:e})=>e.regular}; 5187 font-feature-settings: 5188 'liga' off, 5189 'clig' off; 5190 } 5191 5192 .wui-font-sm-regular-mono { 5193 font-size: ${({textSize:e})=>e.small}; 5194 line-height: ${({typography:e})=>e["sm-regular-mono"].lineHeight}; 5195 letter-spacing: ${({typography:e})=>e["sm-regular-mono"].letterSpacing}; 5196 font-weight: ${({fontWeight:e})=>e.regular}; 5197 font-family: ${({fontFamily:e})=>e.mono}; 5198 } 5199 5200 .wui-font-sm-regular { 5201 font-size: ${({textSize:e})=>e.small}; 5202 line-height: ${({typography:e})=>e["sm-regular"].lineHeight}; 5203 letter-spacing: ${({typography:e})=>e["sm-regular"].letterSpacing}; 5204 font-weight: ${({fontWeight:e})=>e.regular}; 5205 font-family: ${({fontFamily:e})=>e.regular}; 5206 font-feature-settings: 5207 'liga' off, 5208 'clig' off; 5209 } 5210 5211 .wui-font-sm-medium { 5212 font-size: ${({textSize:e})=>e.small}; 5213 line-height: ${({typography:e})=>e["sm-medium"].lineHeight}; 5214 letter-spacing: ${({typography:e})=>e["sm-medium"].letterSpacing}; 5215 font-weight: ${({fontWeight:e})=>e.medium}; 5216 font-family: ${({fontFamily:e})=>e.regular}; 5217 font-feature-settings: 5218 'liga' off, 5219 'clig' off; 5220 } 5221`;var h3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const cUt={primary:Fr.tokens.theme.textPrimary,secondary:Fr.tokens.theme.textSecondary,tertiary:Fr.tokens.theme.textTertiary,invert:Fr.tokens.theme.textInvert,error:Fr.tokens.core.textError,success:Fr.tokens.core.textSuccess,warning:Fr.tokens.core.textWarning,"accent-primary":Fr.tokens.core.textAccentPrimary};let i1=class extends ce{constructor(){super(...arguments),this.variant="md-regular",this.color="inherit",this.align="left",this.lineClamp=void 0,this.display="inline-flex"}render(){const t={[`wui-font-${this.variant}
5221`]:!0,[`wui-line-clamp-${this.lineClamp}`]:!!this.lineClamp};return this.style.cssText=` 5222 display: ${this.display}; 5223 --local-align: ${this.align}; 5224 --local-color: ${this.color==="inherit"?"inherit":cUt[this.color??"primary"]}; 5225 `,j`<slot class=${Y6(t)}></slot>`}};i1.styles=[Ca,aUt];h3([z()],i1.prototype,"variant",void 0);h3([z()],i1.prototype,"color",void 0);h3([z()],i1.prototype,"align",void 0);h3([z()],i1.prototype,"lineClamp",void 0);h3([z()],i1.prototype,"display",void 0);i1=h3([ns("wui-text")],i1);const lUt=Ms` 5226 :host { 5227 width: var(--local-width); 5228 } 5229 5230 button { 5231 width: var(--local-width); 5232 white-space: nowrap; 5233 column-gap: ${({spacing:e})=>e[2]}; 5234 transition: 5235 scale ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-1"]}, 5236 background-color ${({durations:e})=>e.lg} 5237 ${({easings:e})=>e["ease-out-power-2"]}, 5238 border-radius ${({durations:e})=>e.lg} 5239 ${({easings:e})=>e["ease-out-power-1"]}; 5240 will-change: scale, background-color, border-radius; 5241 cursor: pointer; 5242 } 5243 5244 /* -- Sizes --------------------------------------------------- */ 5245 button[data-size='sm'] { 5246 border-radius: ${({borderRadius:e})=>e[2]}; 5247 padding: 0 ${({spacing:e})=>e[2]}; 5248 height: 28px; 5249 } 5250 5251 button[data-size='md'] { 5252 border-radius: ${({borderRadius:e})=>e[3]}; 5253 padding: 0 ${({spacing:e})=>e[4]}; 5254 height: 38px; 5255 } 5256 5257 button[data-size='lg'] { 5258 border-radius: ${({borderRadius:e})=>e[4]}; 5259 padding: 0 ${({spacing:e})=>e[5]}; 5260 height: 48px; 5261 } 5262 5263 /* -- Variants --------------------------------------------------------- */ 5264 button[data-variant='accent-primary'] { 5265 background-color: ${({tokens:e})=>e.core.backgroundAccentPrimary}; 5266 color: ${({tokens:e})=>e.theme.textInvert}; 5267 } 5268 5269 button[data-variant='accent-secondary'] { 5270 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 5271 color: ${({tokens:e})=>e.core.textAccentPrimary}; 5272 } 5273 5274 button[data-variant='neutral-primary'] { 5275 background-color: ${({tokens:e})=>e.theme.backgroundInvert}; 5276 color: ${({tokens:e})=>e.theme.textInvert}; 5277 } 5278 5279 button[data-variant='neutral-secondary'] { 5280 background-color: transparent; 5281 border: 1px solid ${({tokens:e})=>e.theme.borderSecondary}; 5282 color: ${({tokens:e})=>e.theme.textPrimary}; 5283 } 5284 5285 button[data-variant='neutral-tertiary'] { 5286 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 5287 color: ${({tokens:e})=>e.theme.textPrimary}; 5288 } 5289 5290 button[data-variant='error-primary'] { 5291 background-color: ${({tokens:e})=>e.core.textError}; 5292 color: ${({tokens:e})=>e.theme.textInvert}; 5293 } 5294 5295 button[data-variant='error-secondary'] { 5296 background-color: ${({tokens:e})=>e.core.backgroundError}; 5297 color: ${({tokens:e})=>e.core.textError}; 5298 } 5299 5300 button[data-variant='shade'] { 5301 background: var(--wui-color-gray-glass-002); 5302 color: var(--wui-color-fg-200); 5303 border: none; 5304 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 5305 } 5306 5307 /* -- Focus states --------------------------------------------------- */ 5308 button[data-size='sm']:focus-visible:enabled { 5309 border-radius: 28px; 5310 } 5311 5312 button[data-size='md']:focus-visible:enabled { 5313 border-radius: 38px; 5314 } 5315 5316 button[data-size='lg']:focus-visible:enabled { 5317 border-radius: 48px; 5318 } 5319 button[data-variant='shade']:focus-visible:enabled { 5320 background: var(--wui-color-gray-glass-005); 5321 box-shadow: 5322 inset 0 0 0 1px var(--wui-color-gray-glass-010), 5323 0 0 0 4px var(--wui-color-gray-glass-002); 5324 } 5325 5326 /* -- Hover & Active states ----------------------------------------------------------- */ 5327 @media (hover: hover) { 5328 button[data-size='sm']:hover:enabled { 5329 border-radius: 28px; 5330 } 5331 5332 button[data-size='md']:hover:enabled { 5333 border-radius: 38px; 5334 } 5335 5336 button[data-size='lg']:hover:enabled { 5337 border-radius: 48px; 5338 } 5339 5340 button[data-variant='shade']:hover:enabled { 5341 background: var(--wui-color-gray-glass-002); 5342 } 5343 5344 button[data-variant='shade']:active:enabled { 5345 background: var(--wui-color-gray-glass-005); 5346 } 5347 } 5348 5349 button[data-size='sm']:active:enabled { 5350 border-radius: 28px; 5351 } 5352 5353 button[data-size='md']:active:enabled { 5354 border-radius: 38px; 5355 } 5356 5357 button[data-size='lg']:active:enabled { 5358 border-radius: 48px; 5359 } 5360 5361 /* -- Disabled states --------------------------------------------------- */ 5362 button:disabled { 5363 opacity: 0.3; 5364 } 5365`;var Bb=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const uUt={lg:"lg-regular-mono",md:"md-regular-mono",sm:"sm-regular-mono"},dUt={lg:"md",md:"md",sm:"sm"};let P0=class extends ce{constructor(){super(...arguments),this.size="lg",this.disabled=!1,this.fullWidth=!1,this.loading=!1,this.variant="accent-primary"}render(){this.style.cssText=` 5366 --local-width: ${this.fullWidth?"100%":"auto"}; 5367 `;const t=this.textVariant??uUt[this.size];return j` 5368 <button data-variant=${this.variant} data-size=${this.size} ?disabled=${this.disabled}> 5369 ${this.loadingTemplate()} 5370 <slot name="iconLeft"></slot> 5371 <wui-text variant=${t} color="inherit"> 5372 <slot></slot> 5373 </wui-text> 5374 <slot name="iconRight"></slot> 5375 </button> 5376 `}loadingTemplate(){if(this.loading){const t=dUt[this.size],n=this.variant==="neutral-primary"||this.variant==="accent-primary"?"invert":"primary";return j`<wui-loading-spinner color=${n} size=${t}></wui-loading-spinner>`}return null}};P0.styles=[Ca,d3,lUt];Bb([z()],P0.prototype,"size",void 0);Bb([z({type:Boolean})],P0.prototype,"disabled",void 0);Bb([z({type:Boolean})],P0.prototype,"fullWidth",void 0);Bb([z({type:Boolean})],P0.prototype,"loading",void 0);Bb([z()],P0.prototype,"variant",void 0);Bb([z()],P0.prototype,"textVariant",void 0);P0=Bb([ns("wui-button")],P0);const hUt=Xe` 5377 :host { 5378 display: flex; 5379 width: inherit; 5380 height: inherit; 5381 box-sizing: border-box; 5382 } 5383`;var Tc=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Oo=class extends ce{render(){return this.style.cssText=` 5384 flex-direction: ${this.flexDirection}; 5385 flex-wrap: ${this.flexWrap}; 5386 flex-basis: ${this.flexBasis}; 5387 flex-grow: ${this.flexGrow}; 5388 flex-shrink: ${this.flexShrink}; 5389 align-items: ${this.alignItems}; 5390 justify-content: ${this.justifyContent}; 5391 column-gap: ${this.columnGap&&`var(--apkt-spacing-${this.columnGap})`}; 5392 row-gap: ${this.rowGap&&`var(--apkt-spacing-${this.rowGap})`}; 5393 gap: ${this.gap&&`var(--apkt-spacing-${this.gap})`}; 5394 padding-top: ${this.padding&&Ph.getSpacingStyles(this.padding,0)}; 5395 padding-right: ${this.padding&&Ph.getSpacingStyles(this.padding,1)}; 5396 padding-bottom: ${this.padding&&Ph.getSpacingStyles(this.padding,2)}; 5397 padding-left: ${this.padding&&Ph.getSpacingStyles(this.padding,3)}; 5398 margin-top: ${this.margin&&Ph.getSpacingStyles(this.margin,
53980)}; 5399 margin-right: ${this.margin&&Ph.getSpacingStyles(this.margin,1)}; 5400 margin-bottom: ${this.margin&&Ph.getSpacingStyles(this.margin,2)}; 5401 margin-left: ${this.margin&&Ph.getSpacingStyles(this.margin,3)}; 5402 width: ${this.width}; 5403 `,j`<slot></slot>`}};Oo.styles=[Ca,hUt];Tc([z()],Oo.prototype,"flexDirection",void 0);Tc([z()],Oo.prototype,"flexWrap",void 0);Tc([z()],Oo.prototype,"flexBasis",void 0);Tc([z()],Oo.prototype,"flexGrow",void 0);Tc([z()],Oo.prototype,"flexShrink",void 0);Tc([z()],Oo.prototype,"alignItems",void 0);Tc([z()],Oo.prototype,"justifyContent",void 0);Tc([z()],Oo.prototype,"columnGap",void 0);Tc([z()],Oo.prototype,"rowGap",void 0);Tc([z()],Oo.prototype,"gap",void 0);Tc([z()],Oo.prototype,"padding",void 0);Tc([z()],Oo.prototype,"margin",void 0);Tc([z()],Oo.prototype,"width",void 0);Oo=Tc([ns("wui-flex")],Oo);const fUt=Ms` 5404 :host { 5405 position: relative; 5406 } 5407 5408 button { 5409 display: flex; 5410 justify-content: center; 5411 align-items: center; 5412 background-color: transparent; 5413 padding: ${({spacing:e})=>e[1]}; 5414 } 5415 5416 /* -- Colors --------------------------------------------------- */ 5417 button[data-type='accent'] wui-icon { 5418 color: ${({tokens:e})=>e.core.iconAccentPrimary}; 5419 } 5420 5421 button[data-type='neutral'][data-variant='primary'] wui-icon { 5422 color: ${({tokens:e})=>e.theme.iconInverse}; 5423 } 5424 5425 button[data-type='neutral'][data-variant='secondary'] wui-icon { 5426 color: ${({tokens:e})=>e.theme.iconDefault}; 5427 } 5428 5429 button[data-type='success'] wui-icon { 5430 color: ${({tokens:e})=>e.core.iconSuccess}; 5431 } 5432 5433 button[data-type='error'] wui-icon { 5434 color: ${({tokens:e})=>e.core.iconError}; 5435 } 5436 5437 /* -- Sizes --------------------------------------------------- */ 5438 button[data-size='xs'] { 5439 width: 16px; 5440 height: 16px; 5441 5442 border-radius: ${({borderRadius:e})=>e[1]}; 5443 } 5444 5445 button[data-size='sm'] { 5446 width: 20px; 5447 height: 20px; 5448 border-radius: ${({borderRadius:e})=>e[1]}; 5449 } 5450 5451 button[data-size='md'] { 5452 width: 24px; 5453 height: 24px; 5454 border-radius: ${({borderRadius:e})=>e[2]}; 5455 } 5456 5457 button[data-size='lg'] { 5458 width: 28px; 5459 height: 28px; 5460 border-radius: ${({borderRadius:e})=>e[2]}; 5461 } 5462 5463 button[data-size='xs'] wui-icon { 5464 width: 8px; 5465 height: 8px; 5466 } 5467 5468 button[data-size='sm'] wui-icon { 5469 width: 12px; 5470 height: 12px; 5471 } 5472 5473 button[data-size='md'] wui-icon { 5474 width: 16px; 5475 height: 16px; 5476 } 5477 5478 button[data-size='lg'] wui-icon { 5479 width: 20px; 5480 height: 20px; 5481 } 5482 5483 /* -- Hover --------------------------------------------------- */ 5484 @media (hover: hover) { 5485 button[data-type='accent']:hover:enabled { 5486 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 5487 } 5488 5489 button[data-variant='primary'][data-type='neutral']:hover:enabled { 5490 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 5491 } 5492 5493 button[data-variant='secondary'][data-type='neutral']:hover:enabled { 5494 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 5495 } 5496 5497 button[data-type='success']:hover:enabled { 5498 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 5499 } 5500 5501 button[data-type='error']:hover:enabled { 5502 background-color: ${({tokens:e})=>e.core.backgroundError}; 5503 } 5504 } 5505 5506 /* -- Focus --------------------------------------------------- */ 5507 button:focus-visible { 5508 box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020}; 5509 } 5510 5511 /* -- Properties --------------------------------------------------- */ 5512 button[data-full-width='true'] { 5513 width: 100%; 5514 } 5515 5516 :host([fullWidth]) { 5517 width: 100%; 5518 } 5519 5520 button[disabled] { 5521 opacity: 0.5; 5522 cursor: not-allowed; 5523 } 5524`;var v1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let hf=class extends ce{constructor(){super(...arguments),this.icon="card",this.variant="primary",this.type="accent",this.size="md",this.iconSize=void 0,this.fullWidth=!1,this.disabled=!1}render(){return j`<button 5525 data-variant=${this.variant} 5526 data-type=${this.type} 5527 data-size=${this.size} 5528 data-full-width=${this.fullWidth} 5529 ?disabled=${this.disabled} 5530 > 5531 <wui-icon color="inherit" name=${this.icon} size=${ge(this.iconSize)}></wui-icon> 5532 </button>`}}
5532;hf.styles=[Ca,d3,fUt];v1([z()],hf.prototype,"icon",void 0);v1([z()],hf.prototype,"variant",void 0);v1([z()],hf.prototype,"type",void 0);v1([z()],hf.prototype,"size",void 0);v1([z()],hf.prototype,"iconSize",void 0);v1([z({type:Boolean})],hf.prototype,"fullWidth",void 0);v1([z({type:Boolean})],hf.prototype,"disabled",void 0);hf=v1([ns("wui-icon-button")],hf);const pUt=Ms` 5533 button { 5534 background-color: transparent; 5535 padding: ${({spacing:e})=>e[1]}; 5536 } 5537 5538 button:focus-visible { 5539 box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent020}; 5540 } 5541 5542 button[data-variant='accent']:hover:enabled, 5543 button[data-variant='accent']:focus-visible { 5544 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 5545 } 5546 5547 button[data-variant='primary']:hover:enabled, 5548 button[data-variant='primary']:focus-visible, 5549 button[data-variant='secondary']:hover:enabled, 5550 button[data-variant='secondary']:focus-visible { 5551 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 5552 } 5553 5554 button[data-size='xs'] > wui-icon { 5555 width: 8px; 5556 height: 8px; 5557 } 5558 5559 button[data-size='sm'] > wui-icon { 5560 width: 12px; 5561 height: 12px; 5562 } 5563 5564 button[data-size='xs'], 5565 button[data-size='sm'] { 5566 border-radius: ${({borderRadius:e})=>e[1]}; 5567 } 5568 5569 button[data-size='md'], 5570 button[data-size='lg'] { 5571 border-radius: ${({borderRadius:e})=>e[2]}; 5572 } 5573 5574 button[data-size='md'] > wui-icon { 5575 width: 16px; 5576 height: 16px; 5577 } 5578 5579 button[data-size='lg'] > wui-icon { 5580 width: 20px; 5581 height: 20px; 5582 } 5583 5584 button:disabled { 5585 background-color: transparent; 5586 cursor: not-allowed; 5587 opacity: 0.5; 5588 } 5589 5590 button:hover:not(:disabled) { 5591 background-color: var(--wui-color-accent-glass-015); 5592 } 5593 5594 button:focus-visible:not(:disabled) { 5595 background-color: var(--wui-color-accent-glass-015); 5596 box-shadow: 5597 inset 0 0 0 1px var(--wui-color-accent-100), 5598 0 0 0 4px var(--wui-color-accent-glass-020); 5599 } 5600`;var f3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let o1=class extends ce{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="default",this.variant="accent"}render(){const t={accent:"accent-primary",primary:"inverse",secondary:"default"};return j` 5601 <button data-variant=${this.variant} ?disabled=${this.disabled} data-size=${this.size}> 5602 <wui-icon 5603 color=${t[this.variant]||this.iconColor} 5604 size=${this.size} 5605 name=${this.icon} 5606 ></wui-icon> 5607 </button> 5608 `}};o1.styles=[Ca,d3,pUt];f3([z()],o1.prototype,"size",void 0);f3([z({type:Boolean})],o1.prototype,"disabled",void 0);f3([z()],o1.prototype,"icon",void 0);f3([z()],o1.prototype,"iconColor",void 0);f3([z()],o1.prototype,"variant",void 0);o1=f3([ns("wui-icon-link")],o1);const gUt=Ms` 5609 :host { 5610 display: block; 5611 width: var(--local-width); 5612 height: var(--local-height); 5613 } 5614 5615 img { 5616 display: block; 5617 width: 100%; 5618 height: 100%; 5619 object-fit: cover; 5620 object-position: center center; 5621 border-radius: inherit; 5622 user-select: none; 5623 user-drag: none; 5624 -webkit-user-drag: none; 5625 -khtml-user-drag: none; 5626 -moz-user-drag: none; 5627 -o-user-drag: none; 5628 } 5629 5630 :host([data-boxed='true']) { 5631 width: 40px; 5632 height: 40px; 5633 display: flex; 5634 align-items: center; 5635 justify-content: center; 5636 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 5637 border-radius: ${({borderRadius:e})=>e[2]}; 5638 } 5639 5640 :host([data-boxed='true']) img { 5641 width: 20px; 5642 height: 20px; 5643 border-radius: ${({borderRadius:e})=>e[16]}; 5644 } 5645 5646 :host([data-full='true']) img { 5647 width: 100%; 5648 height: 100%; 5649 } 5650 5651 :host([data-boxed='true']) wui-icon { 5652 width: 20px; 5653 height: 20px; 5654 } 5655 5656 :host([data-icon='error']) { 5657 background-color: ${({tokens:e})=>e.core.backgroundError}; 5658 } 5659 5660 :host([data-rounded='true']) { 5661 border-radius: ${({borderRadius:e})=>e[16]}; 5662 } 5663`;var Ef=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Pu=class extends ce{constructor(){super(...arguments),this.src="./path/to/image.jpg",this.alt="Image",this.size=void 0,this.boxed=!1,this.rounded=!1,this.fullSize=!1}render(){const t={inherit:"inherit",xxs:"2",xs:"3",sm:"4",md:"4",mdl:"5",lg:"5",xl:"6",xxl:"7","3xl":"8","4xl":"9","5xl":"10"};return this.style.cssText=` 5664 --local-width: ${this.size?`var(--apkt-spacing-${t[this.size]});`:"100%"}; 5665 --local-height: ${this.size?`var(--apkt-spacing-${t[this.size]});`:"100%"}; 5666 `,this.dataset.boxed=this.boxed?"true":"false",this.dataset.rounded=this.rounded?"true":"false",this.dataset.full=this.fullSize?"true":"false",this.dataset.icon=this.iconColor||"inherit",this.icon?j`<wui-icon 5667 color=${this.iconColor||"inherit"} 5668 name=${this.icon} 5669 size="lg" 5670 ></wui-icon> `:this.logo?j`<wui-icon size="lg" color="inherit" name=${this.logo}></wui-icon> `:j`<img src=${ge(this.src)} alt=${this.alt} @error=${this.handleImageError} />`}handleImageError(){this.dispatchEvent(new CustomEvent("onLoadError",{bubbles:!0,composed:!0}))}};Pu.styles=[Ca,gUt];Ef([z()],Pu.prototype,"src",void 0);Ef([z()],Pu.prototype,"logo",void 0);Ef([z()],Pu.prototype,"icon",void 0);Ef([z()],Pu.prototype,"iconColor",void 0);Ef([z()],Pu.prototype,"alt",void 0);Ef([z()],Pu.prototype,"size",void 0);Ef([z({type:Boolean})],Pu.prototype,"boxed",void 0);Ef([z({type:Boolean})],Pu.prototype,"rounded",void 0);Ef([z({type:Boolean})],Pu.prototype,"fullSize",void 0);Pu=Ef([ns("wui-image")],Pu);const mUt=Ms` 5671 :host { 5672 width: 100%; 5673 } 5674 5675 :host([data-type='primary']) > button { 5676 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 5677 } 5678 5679 :host([data-type='secondary']) > button { 5680 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 5681 } 5682 5683 button { 5684 display: flex; 5685 align-items: center; 5686 justify-content: space-between; 5687 padding: ${({spacing:e})=>e[3]}; 5688 width: 100%; 5689 border-radius: ${({borderRadius:e})=>e[4]}; 5690 transition: 5691 background-color ${({durations:e})=>e.lg} 5692 ${({easings:e})=>e["ease-out-power-2"]}, 5693 scale ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; 5694 will-change: background-color, scale; 5695 } 5696 5697 wui-text { 5698 text-transform: capitalize; 5699 } 5700 5701 wui-image { 5702 color: ${({tokens:e})=>e.theme.textPrimary}; 5703 } 5704 5705 @media (hover: hover) { 5706 :host([data-type='primary']) > button:hover:enabled { 5707 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 5708 } 5709 5710 :host([data-type='secondary']) > button:hover:enabled { 5711 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 5712 } 5713 } 5714 5715 button:disabled { 5716 opacity: 0.5;
5717 cursor: not-allowed; 5718 } 5719`;var Pc=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let ko=class extends ce{constructor(){super(...arguments),this.type="primary",this.imageSrc="google",this.imageSize=void 0,this.loading=!1,this.boxColor="foregroundPrimary",this.disabled=!1,this.rightIcon=!0,this.boxed=!0,this.rounded=!1,this.fullSize=!1}render(){return this.dataset.rounded=this.rounded?"true":"false",this.dataset.type=this.type,j` 5720 <button 5721 ?disabled=${this.loading?!0:!!this.disabled} 5722 data-loading=${this.loading} 5723 tabindex=${ge(this.tabIdx)} 5724 > 5725 <wui-flex gap="2" alignItems="center"> 5726 ${this.templateLeftIcon()} 5727 <wui-flex gap="1"> 5728 <slot></slot> 5729 </wui-flex> 5730 </wui-flex> 5731 ${this.templateRightIcon()} 5732 </button> 5733 `}templateLeftIcon(){return this.icon?j`<wui-image 5734 icon=${this.icon} 5735 iconColor=${ge(this.iconColor)} 5736 ?boxed=${this.boxed} 5737 ?rounded=${this.rounded} 5738 boxColor=${this.boxColor} 5739 ></wui-image>`:j`<wui-image 5740 ?boxed=${this.boxed} 5741 ?rounded=${this.rounded} 5742 ?fullSize=${this.fullSize} 5743 size=${ge(this.imageSize)} 5744 src=${this.imageSrc} 5745 boxColor=${this.boxColor} 5746 ></wui-image>`}templateRightIcon(){return this.rightIcon?this.loading?j`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:j`<wui-icon name="chevronRight" size="lg" color="default"></wui-icon>`:null}};ko.styles=[Ca,d3,mUt];Pc([z()],ko.prototype,"type",void 0);Pc([z()],ko.prototype,"imageSrc",void 0);Pc([z()],ko.prototype,"imageSize",void 0);Pc([z()],ko.prototype,"icon",void 0);Pc([z()],ko.prototype,"iconColor",void 0);Pc([z({type:Boolean})],ko.prototype,"loading",void 0);Pc([z()],ko.prototype,"tabIdx",void 0);Pc([z()],ko.prototype,"boxColor",void 0);Pc([z({type:Boolean})],ko.prototype,"disabled",void 0);Pc([z({type:Boolean})],ko.prototype,"rightIcon",void 0);Pc([z({type:Boolean})],ko.prototype,"boxed",void 0);Pc([z({type:Boolean})],ko.prototype,"rounded",void 0);Pc([z({type:Boolean})],ko.prototype,"fullSize",void 0);ko=Pc([ns("wui-list-item")],ko);const wUt=ae`<svg width="86" height="96" fill="none"> 5747 <path 5748 d="M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z" 5749 /> 5750</svg>`,yUt=ae`<svg viewBox="0 0 48 54" fill="none"> 5751 <path 5752 d="M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z" 5753 /> 5754</svg>`,bUt=ae` 5755 <svg fill="none" viewBox="0 0 36 40"> 5756 <path 5757 d="M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z" 5758 /> 5759 </svg> 5760`,vUt=Ms` 5761 :host { 5762 position: relative; 5763 border-radius: inherit; 5764 display: flex; 5765 justify-content: center; 5766 align-items: center; 5767 width: var(--local-width); 5768 height: var(--local-height); 5769 } 5770 5771 :host([data-round='true']) { 5772 background: ${({tokens:e})=>e.theme.foregroundPrimary}; 5773 border-radius: 100%; 5774 outline: 1px solid ${({tokens:e})=>e.core.glass010}; 5775 } 5776 5777 svg { 5778 position: absolute; 5779 top: 0; 5780 left: 0; 5781 width: 100%; 5782 height: 100%; 5783 z-index: 1; 5784 } 5785 5786 svg > path { 5787 stroke: var(--local-stroke); 5788 } 5789 5790 wui-image { 5791 width: 100%; 5792 height: 100%; 5793 -webkit-clip-path: var(--local-path); 5794 clip-path: var(--local-path); 5795 background: ${({tokens:e})=>e.theme.foregroundPrimary}; 5796 } 5797 5798 wui-icon { 5799 transform: translateY(-5%); 5800 width: var(--local-icon-size); 5801 height: var(--local-icon-size); 5802 } 5803`;var Db=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let O0=class extends ce{constructor(){super(...arguments),this.size="md",this.name="uknown",this.networkImagesBySize={sm:bUt,md:yUt,lg:wUt},this.selected=!1,this.round=!1}render(){const t={sm:"4",md:"6",lg:"10"};return this.round?(this.dataset.round="true",this.style.cssText=` 5804 --local-width: var(--apkt-spacing-10); 5805 --local-height: var(--apkt-spacing-10); 5806 --local-icon-size: var(--apkt-spacing-4); 5807 `):this.style.cssText=` 5808 5809 --local-path: var(--apkt-path-network-${this.size}); 5810 --local-width: var(--apkt-width-network-${this.size}); 5811 --local-height: var(--apkt-height-network-${this.size}); 5812 --local-icon-size: var(--apkt-spacing-${t[this.size]}); 5813 `,j`${this.templateVisual()} ${this.svgTemplate()} `}svgTemplate(){return this.round?null:this.networkImagesBySize[this.size]}templateVisual(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:j`<wui-icon size="inherit" color="default" name="networkPlaceholder"></wui-icon>`}};O0.styles=[Ca,vUt];Db([z()],O0.prototype,"size",void 0);Db([z()],O0.prototype,"name",void 0);Db([z({type:Object})],O0.prototype,"networkImagesBySize",void 0);Db([z()],O0.prototype,"imageSrc",void 0);Db([z({type:Boolean})],O0.prototype,"selected",void 0);Db([z({type:Boolean})],O0.prototype,"round",void 0);O0=Db([ns("wui-network-image")],O0);const EUt=Ms` 5814 :host { 5815 position: relative; 5816 display: flex; 5817 width: 100%; 5818 height: 1px; 5819 background-color: ${({tokens:e})=>e.theme.borderPrimary}; 5820 justify-content: center;
5821 align-items: center; 5822 } 5823 5824 :host > wui-text { 5825 position: absolute; 5826 padding: 0px 8px; 5827 transition: background-color ${({durations:e})=>e.lg} 5828 ${({easings:e})=>e["ease-out-power-2"]}; 5829 will-change: background-color; 5830 } 5831 5832 :host([data-bg-color='primary']) > wui-text { 5833 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 5834 } 5835 5836 :host([data-bg-color='secondary']) > wui-text { 5837 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 5838 } 5839`;var HG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let tC=class extends ce{constructor(){super(...arguments),this.text="",this.bgColor="primary"}render(){return this.dataset.bgColor=this.bgColor,j`${this.template()}`}template(){return this.text?j`<wui-text variant="md-regular" color="secondary">${this.text}</wui-text>`:null}};tC.styles=[Ca,EUt];HG([z()],tC.prototype,"text",void 0);HG([z()],tC.prototype,"bgColor",void 0);tC=HG([ns("wui-separator")],tC);const CUt=Ms` 5840 :host { 5841 display: inline-flex; 5842 justify-content: center; 5843 align-items: center; 5844 border-radius: ${({borderRadius:e})=>e[2]}; 5845 padding: ${({spacing:e})=>e[1]} !important; 5846 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 5847 position: relative; 5848 } 5849 5850 :host([data-padding='2']) { 5851 padding: ${({spacing:e})=>e[2]} !important; 5852 } 5853 5854 :host:after { 5855 content: ''; 5856 position: absolute; 5857 top: 0; 5858 left: 0; 5859 width: 100%; 5860 height: 100%; 5861 border-radius: ${({borderRadius:e})=>e[2]}; 5862 } 5863 5864 :host > wui-icon { 5865 z-index: 10; 5866 } 5867 5868 /* -- Colors --------------------------------------------------- */ 5869 :host([data-color='accent-primary']) { 5870 color: ${({tokens:e})=>e.core.iconAccentPrimary}; 5871 } 5872 5873 :host([data-color='accent-primary']):after { 5874 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 5875 } 5876 5877 :host([data-color='default']), 5878 :host([data-color='secondary']) { 5879 color: ${({tokens:e})=>e.theme.iconDefault}; 5880 } 5881 5882 :host([data-color='default']):after { 5883 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 5884 } 5885 5886 :host([data-color='secondary']):after { 5887 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 5888 } 5889 5890 :host([data-color='success']) { 5891 color: ${({tokens:e})=>e.core.iconSuccess}; 5892 } 5893 5894 :host([data-color='success']):after { 5895 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 5896 } 5897 5898 :host([data-color='error']) { 5899 color: ${({tokens:e})=>e.core.iconError}; 5900 } 5901 5902 :host([data-color='error']):after { 5903 background-color: ${({tokens:e})=>e.core.backgroundError}; 5904 } 5905 5906 :host([data-color='warning']) { 5907 color: ${({tokens:e})=>e.core.iconWarning}; 5908 } 5909 5910 :host([data-color='warning']):after { 5911 background-color: ${({tokens:e})=>e.core.backgroundWarning}; 5912 } 5913 5914 :host([data-color='inverse']) { 5915 color: ${({tokens:e})=>e.theme.iconInverse}; 5916 } 5917 5918 :host([data-color='inverse']):after { 5919 background-color: transparent; 5920 } 5921`;var rx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let qy=class extends ce{constructor(){super(...arguments),this.icon="copy",this.size="md",this.padding="1",this.color="default"}render(){return this.dataset.padding=this.padding,this.dataset.color=this.color,j` 5922 <wui-icon size=${ge(this.size)} name=${this.icon} color="inherit"></wui-icon> 5923 `}};qy.styles=[Ca,d3,CUt];rx([z()],qy.prototype,"icon",void 0);rx([z()],qy.prototype,"size",void 0);rx([z()],qy.prototype,"padding",void 0);rx([z()],qy.prototype,"color",void 0);qy=rx([ns("wui-icon-box")],qy);const $Ut=Ms` 5924 :host { 5925 position: relative; 5926 background-color: ${({tokens:e})=>e.theme.foregroundTertiary}; 5927 display: flex; 5928 justify-content: center;
5929 align-items: center; 5930 border-radius: inherit; 5931 border-radius: var(--local-border-radius); 5932 } 5933 5934 :host([data-image='true']) { 5935 background-color: transparent; 5936 } 5937 5938 :host > wui-flex { 5939 overflow: hidden; 5940 border-radius: inherit; 5941 border-radius: var(--local-border-radius); 5942 } 5943 5944 :host([data-size='sm']) { 5945 width: 32px; 5946 height: 32px; 5947 } 5948 5949 :host([data-size='md']) { 5950 width: 40px; 5951 height: 40px; 5952 } 5953 5954 :host([data-size='lg']) { 5955 width: 56px; 5956 height: 56px; 5957 } 5958 5959 :host([name='Extension'])::after { 5960 border: 1px solid ${({colors:e})=>e.accent010}; 5961 } 5962 5963 :host([data-wallet-icon='allWallets'])::after { 5964 border: 1px solid ${({colors:e})=>e.accent010}; 5965 } 5966 5967 wui-icon[data-parent-size='inherit'] { 5968 width: 75%; 5969 height: 75%; 5970 align-items: center; 5971 } 5972 5973 wui-icon { 5974 color: ${({tokens:e})=>e.theme.iconDefault}; 5975 } 5976 5977 wui-icon[data-parent-size='sm'] { 5978 width: 24px; 5979 height: 24px; 5980 } 5981 5982 wui-icon[data-parent-size='md'] { 5983 width: 32px; 5984 height: 32px; 5985 } 5986 5987 :host > wui-icon-box { 5988 position: absolute; 5989 overflow: hidden; 5990 right: -1px; 5991 bottom: -2px; 5992 z-index: 1; 5993 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 5994 padding: 1px; 5995 } 5996`;var Ub=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let k0=class extends ce{constructor(){super(...arguments),this.size="md",this.name="",this.installed=!1,this.badgeSize="xs"}render(){let t="1";return this.size==="lg"?t="4":this.size==="md"?t="2":this.size==="sm"&&(t="1"),this.style.cssText=` 5997 --local-border-radius: var(--apkt-borderRadius-${t}); 5998 `,this.dataset.size=this.size,this.imageSrc&&(this.dataset.image="true"),this.walletIcon&&(this.dataset.walletIcon=this.walletIcon),j` 5999 <wui-flex justifyContent="center" alignItems="center"> ${this.templateVisual()} </wui-flex> 6000 `}templateVisual(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:this.walletIcon?j`<wui-icon size="md" color="default" name=${this.walletIcon}></wui-icon>`:j`<wui-icon 6001 data-parent-size=${this.size} 6002 size="inherit" 6003 color="inherit" 6004 name="wallet" 6005 ></wui-icon>`}};k0.styles=[Ca,$Ut];Ub([z()],k0.prototype,"size",void 0);Ub([z()],k0.prototype,"name",void 0);Ub([z()],k0.prototype,"imageSrc",void 0);Ub([z()],k0.prototype,"walletIcon",void 0);Ub([z({type:Boolean})],k0.prototype,"installed",void 0);Ub([z()],k0.prototype,"badgeSize",void 0);k0=Ub([ns("wui-wallet-image")],k0);const xUt={EIP155:Oe.CHAIN.EVM},gu={getCaipTokens(e){if(!e)return;const t={};return Object.entries(e).forEach(([n,r])=>{t[`${xUt.EIP155}:${n}`]=r}),t},isLowerCaseMatch(e,t){return(e==null?void 0:e.toLowerCase())===(t==null?void 0:t.toLowerCase())},getActiveNamespaceConnectedToAuth(){const e=re.state.activeChain;return Oe.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(t=>Ve.getConnectorId(t)===Oe.CONNECTOR_ID.AUTH&&t===e)},withRetry({conditionFn:e,intervalMs:t,maxRetries:n}){let r=0;return new Promise(s=>{async function i(){return r+=1,await e()?s(!0):r>=n?s(!1):(setTimeout(i,t),null)}i()})},userChainIdToChainNamespace(e){if(typeof e=="number")return Oe.CHAIN.EVM;const[t]=e.split(":");return t},getOtherAuthNamespaces(e){return e?Oe.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(r=>r!==e):[]},getConnectorStorageInfo(e,t){const r=Qe.getConnections()[t]??[];return{hasDisconnected:Qe.isConnectorDisconnected(e,t),hasConnected:r.some(s=>gu.isLowerCaseMatch(s.connectorId,e))}}},Vt={INVALID_PAYMENT_CONFIG:"INVALID_PAYMENT_CONFIG",INVALID_RECIPIENT:"INVALID_RECIPIENT",INVALID_ASSET:"INVALID_ASSET",INVALID_AMOUNT:"INVALID_AMOUNT",UNKNOWN_ERROR:"UNKNOWN_ERROR",UNABLE_TO_INITIATE_PAYMENT:"UNABLE_TO_INITIATE_PAYMENT",INVALID_CHAIN_NAMESPACE:"INVALID_CHAIN_NAMESPACE",GENERIC_PAYMENT_ERROR:"GENERIC_PAYMENT_ERROR",UNABLE_TO_GET_EXCHANGES:"UNABLE_TO_GET_EXCHANGES",ASSET_NOT_SUPPORTED:"ASSET_NOT_SUPPORTED",UNABLE_TO_GET_PAY_URL:"UNABLE_TO_GET_PAY_URL",UNABLE_TO_GET_BUY_STATUS:"UNABLE_TO_GET_BUY_STATUS",UNABLE_TO_GET_TOKEN_BALANCES:"UNABLE_TO_GET_TOKEN_BALANCES",UNABLE_TO_GET_QUOTE:"UNABLE_TO_GET_QUOTE",UNABLE_TO_GET_QUOTE_
6005STATUS:"UNABLE_TO_GET_QUOTE_STATUS",INVALID_RECIPIENT_ADDRESS_FOR_ASSET:"INVALID_RECIPIENT_ADDRESS_FOR_ASSET"},Yg={[Vt.INVALID_PAYMENT_CONFIG]:"Invalid payment configuration",[Vt.INVALID_RECIPIENT]:"Invalid recipient address",[Vt.INVALID_ASSET]:"Invalid asset specified",[Vt.INVALID_AMOUNT]:"Invalid payment amount",[Vt.INVALID_RECIPIENT_ADDRESS_FOR_ASSET]:"Invalid recipient address for the asset selected",[Vt.UNKNOWN_ERROR]:"Unknown payment error occurred",[Vt.UNABLE_TO_INITIATE_PAYMENT]:"Unable to initiate payment",[Vt.INVALID_CHAIN_NAMESPACE]:"Invalid chain namespace",[Vt.GENERIC_PAYMENT_ERROR]:"Unable to process payment",[Vt.UNABLE_TO_GET_EXCHANGES]:"Unable to get exchanges",[Vt.ASSET_NOT_SUPPORTED]:"Asset not supported by the selected exchange",[Vt.UNABLE_TO_GET_PAY_URL]:"Unable to get payment URL",[Vt.UNABLE_TO_GET_BUY_STATUS]:"Unable to get buy status",[Vt.UNABLE_TO_GET_TOKEN_BALANCES]:"Unable to get token balances",[Vt.UNABLE_TO_GET_QUOTE]:"Unable to get quote. Please choose a different token",[Vt.UNABLE_TO_GET_QUOTE_STATUS]:"Unable to get quote status"};
vendor: 6,134 bytes, line 6005
6005class yn extends Error{get message(){return Yg[this.code]}constructor(t,n){super(Yg[t]),this.name="AppKitPayError",this.code=t,this.details=n,Error.captureStackTrace&&Error.captureStackTrace(this,yn)}}const IUt="https://rpc.walletconnect.org/v1/json-rpc",Kce="reown_test";function SUt(){const{chainNamespace:e}=mr.parseCaipNetworkId(ot.state.paymentAsset.network);if(!ht.isAddress(ot.state.recipient,e))throw new yn(Vt.INVALID_RECIPIENT_ADDRESS_FOR_ASSET,`Provide valid recipient address for namespace "${e}"`)}async function AUt(e,t,n){var a;if(t!==Oe.CHAIN.EVM)throw new yn(Vt.INVALID_CHAIN_NAMESPACE);if(!n.fromAddress)throw new yn(Vt.INVALID_PAYMENT_CONFIG,"fromAddress is required for native EVM payments.");const r=typeof n.amount=="string"?parseFloat(n.amount):n.amount;if(isNaN(r))throw new yn(Vt.INVALID_PAYMENT_CONFIG);const s=((a=e.metadata)==null?void 0:a.decimals)??18,i=st.parseUnits(r.toString(),s);if(typeof i!="bigint")throw new yn(Vt.GENERIC_PAYMENT_ERROR);return await st.sendTransaction({chainNamespace:t,to:n.recipient,address:n.fromAddress,value:i,data:"0x"})??void 0}async function _Ut(e,t){if(!t.fromAddress)throw new yn(Vt.INVALID_PAYMENT_CONFIG,"fromAddress is required for ERC20 EVM payments.");const n=e.asset,r=t.recipient,s=Number(e.metadata.decimals),i=st.parseUnits(t.amount.toString(),s);if(i===void 0)throw new yn(Vt.GENERIC_PAYMENT_ERROR);return await st.writeContract({fromAddress:t.fromAddress,tokenAddress:n,args:[r,i],method:"transfer",abi:e8e.getERC20Abi(n),chainNamespace:Oe.CHAIN.EVM})??void 0}async function NUt(e,t){if(e!==Oe.CHAIN.SOLANA)throw new yn(Vt.INVALID_CHAIN_NAMESPACE);if(!t.fromAddress)throw new yn(Vt.INVALID_PAYMENT_CONFIG,"fromAddress is required for Solana payments.");const n=typeof t.amount=="string"?parseFloat(t.amount):t.amount;if(isNaN(n)||n<=0)throw new yn(Vt.INVALID_PAYMENT_CONFIG,"Invalid payment amount.");try{if(!JCe.getProvider(e))throw new yn(Vt.GENERIC_PAYMENT_ERROR,"No Solana provider available.");const s=await st.sendTransaction({chainNamespace:Oe.CHAIN.SOLANA,to:t.recipient,value:n,tokenMint:t.tokenMint});if(!s)throw new yn(Vt.GENERIC_PAYMENT_ERROR,"Transaction failed.");return s}catch(r){throw r instanceof yn?r:new yn(Vt.GENERIC_PAYMENT_ERROR,`Solana payment failed: ${r}`)}}async function TUt({sourceToken:e,toToken:t,amount:n,recipient:r}){const s=st.parseUnits(n,e.metadata.decimals),i=st.parseUnits(n,t.metadata.decimals);return Promise.resolve({type:rq,origin:{amount:(s==null?void 0:s.toString())??"0",currency:e},destination:{amount:(i==null?void 0:i.toString())??"0",currency:t},fees:[{id:"service",label:"Service Fee",amount:"0",currency:t}],steps:[{requestId:rq,type:"deposit",deposit:{amount:(s==null?void 0:s.toString())??"0",currency:e.asset,receiver:r}}],timeInSeconds:6})}function nq(e){if(!e)return null;const t=e.steps[0];return!t||t.type!==WUt?null:t}function pU(e,t=0){if(!e)return[];const n=e.steps.filter(s=>s.type===HUt),r=n.filter((s,i)=>i+1>t);return n.length>0&&n.length<3?r:[]}const VG=new u3({baseUrl:ht.getApiUrl(),clientId:null});class PUt extends Error{}function OUt(){const e=Ot.getSnapshot().projectId;return`${IUt}?projectId=${e}`}function KG(){const{projectId:e,sdkType:t,sdkVersion:n}=Ot.state;return{projectId:e,st:t||"appkit",sv:n||"html-wagmi-4.2.2"}}async function GG(e,t){const n=OUt(),{sdkType:r,sdkVersion:s,projectId:i}=Ot.getSnapshot(),o={jsonrpc:"2.0",id:1,method:e,params:{...t||{},st:r,sv:s,projectId:i}},c=await(await fetch(n,{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json"}})).json();if(c.error)throw new PUt(c.error.message);return c}async function Gce(e){return(await GG("reown_getExchanges",e)).result}async function Zce(e){return(await GG("reown_getExchangePayUrl",e)).result}async function kUt(e){return(await GG("reown_getExchangeBuyStatus",e)).result}async function RUt(e){const t=Io.bigNumber(e.amount).times(10**e.toToken.metadata.decimals).toString(),{chainId:n,chainNamespace:r}=mr.parseCaipNetworkId(e.sourceToken.network),{chainId:s,chainNamespace:i}=mr.parseCaipNetworkId(e.toToken.network),o=e.sourceToken.asset==="native"?zce(r):e.sourceToken.asset,a=e.toToken.asset==="native"?zce(i):e.toToken.asset;return await VG.post({path:"/appkit/v1/transfers/quote",body:{user:e.address,originChainId:n.toString(),originCurrency:o,destinationChainId:s.toString(),destinationCurrency:a,recipient:e.recipient,amount:t},params:KG()})}async function BUt(e){const t=gu.isLowerCaseMatch(e.sourceToken.network,e.toToken.network),n=gu.isLowerCaseMatch(e.sourceToken.asset,e.toToken.asset);return t&&n?TUt(e):RUt(e)}async function DUt(e){return await VG.get({path:"/appkit/v1/transfers/status",params:{requestId:e.requestId,...KG()}})}async function UUt(e){return await VG.get({path:`/appkit/v1/transfers/assets/exchanges/${e}`,params:KG()})}const LUt=["eip155","solana"],MUt={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},Yce={56:"714",204:"714"};function gU(e,t){const{chainNamespace:n,chainId:r}=mr.parseCaipNetworkId(e),s=MUt[n];if(!s)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${n}`);let i=s.native.assetNamespace,o=s.native.assetReference;return t!=="native"?(i=s.defaultTokenNamespace,o=t):n==="eip155"&&Yce[r]&&(o=Yce[r]),`${`${n}:${r}`}/${i}:${o}`}function jUt(e){const{chainNamespace:t}=mr.parseCaipNetworkId(e);return LUt.includes(t)}function FUt(e){const n=re.getAllRequestedCaipNetworks().find(s=>s.caipNetworkId===e.chainId);let r=e.address;if(!n)throw new Error(`Target network not found for balance chainId "${e.chainId}"`);if(gu.isLowerCaseMatch(e.symbol,n.nativeCurrency.symbol))r="native";else if(ht.isCaipAddress(r)){const{address:s}=mr.parseCaipAddress(r);r=s}else if(!r)throw new Error(`Balance address not found for balance symbol "${e.symbol}"`);return{network:n.caipNetworkId,asset:r,metadata:{name:e.name,symbol:e.symbol,decimals:Number(e.quantity.decimals),logoURI:e.iconUrl},amount:e.quantity.numeric}}function zUt(e){return{chainId:e.network,address:`${e.network}:${e.asset}
6005`,symbol:e.metadata.symbol,name:e.metadata.name,iconUrl:e.metadata.logoURI||"",price:0,quantity:{numeric:"0",decimals:e.metadata.decimals.toString()}}}function gN(e){const t=Io.bigNumber(e,{safe:!0});return t.lt(.001)?"<0.001":t.round(4).toString()}function qUt(e){const n=re.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===e.network);return n?!!n.testnet:!1}const Jce=0,mU="unknown",rq="direct-transfer",WUt="deposit",HUt="transaction",de=os({paymentAsset:{network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},recipient:"0x0",amount:0,isConfigured:!1,error:null,isPaymentInProgress:!1,exchanges:[],isLoading:!1,openInNewTab:!0,redirectUrl:void 0,payWithExchange:void 0,currentPayment:void 0,analyticsSet:!1,paymentId:void 0,choice:"pay",tokenBalances:{[Oe.CHAIN.EVM]:[],[Oe.CHAIN.SOLANA]:[]},isFetchingTokenBalances:!1,selectedPaymentAsset:null,quote:void 0,quoteStatus:"waiting",quoteError:null,isFetchingQuote:!1,selectedExchange:void 0,exchangeUrlForQuote:void 0,requestId:void 0}),ot={state:de,subscribe(e){return Po(de,()=>e(de))},subscribeKey(e,t){return ha(de,e,t)},async handleOpenPay(e){this.resetState(),this.setPaymentConfig(e),this.initializeAnalytics(),SUt(),await this.prepareTokenLogo(),de.isConfigured=!0,Mn.sendEvent({type:"track",event:"PAY_MODAL_OPEN",properties:{exchanges:de.exchanges,configuration:{network:de.paymentAsset.network,asset:de.paymentAsset.asset,recipient:de.recipient,amount:de.amount}}}),await pr.open({view:"Pay"})},resetState(){de.paymentAsset={network:"eip155:1",asset:"0x0",metadata:{name:"0x0",symbol:"0x0",decimals:0}},de.recipient="0x0",de.amount=0,de.isConfigured=!1,de.error=null,de.isPaymentInProgress=!1,de.isLoading=!1,de.currentPayment=void 0,de.selectedExchange=void 0,de.exchangeUrlForQuote=void 0,de.requestId=void 0},resetQuoteState(){de.quote=void 0,de.quoteStatus="waiting",de.quoteError=null,de.isFetchingQuote=!1,de.requestId=void 0},setPaymentConfig(e){if(!e.paymentAsset)throw new yn(Vt.INVALID_PAYMENT_CONFIG);try{de.choice=e.choice??"pay",de.paymentAsset=e.paymentAsset,de.recipient=e.recipient,de.amount=e.amount,de.openInNewTab=e.openInNewTab??!0,de.redirectUrl=e.redirectUrl,de.payWithExchange=e.payWithExchange,de.error=null}catch(t){throw new yn(Vt.INVALID_PAYMENT_CONFIG,t.message)}},setSelectedPaymentAsset(e){de.selectedPaymentAsset=e},setSelectedExchange(e){de.selectedExchange=e},setRequestId(e){de.requestId=e},setPaymentInProgress(e){de.isPaymentInProgress=e},getPaymentAsset(){return de.paymentAsset},getExchanges(){return de.exchanges},async fetchExchanges(){try{de.isLoading=!0;const e=await Gce({page:Jce});de.exchanges=e.exchanges.slice(0,2)}catch{throw nl.showError(Yg.UNABLE_TO_GET_EXCHANGES),new yn(Vt.UNABLE_TO_GET_EXCHANGES)}finally{de.isLoading=!1}},async getAvailableExchanges(e){var t;try{const n=e!=null&&e.asset&&(e!=null&&e.network)?gU(e.network,e.asset):void 0;return await Gce({page:(e==null?void 0:e.page)??Jce,asset:n,amount:(t=e==null?void 0:e.amount)==null?void 0:t.toString()})}catch{throw new yn(Vt.UNABLE_TO_GET_EXCHANGES)}},async getPayUrl(e,t,n=!1){try{const r=Number(t.amount),s=await Zce({exchangeId:e,asset:gU(t.network,t.asset),amount:r.toString(),recipient:`${t.network}:${t.recipient}`});return Mn.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{source:"pay",exchange:{id:e},configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:r},currentPayment:{type:"exchange",exchangeId:e},headless:n}}),n&&(this.initiatePayment(),Mn.sendEvent({type:"track",event:"PAY_INITIATED",properties:{source:"pay",paymentId:de.paymentId||mU,configuration:{network:t.network,asset:t.asset,recipient:t.recipient,amount:r},currentPayment:{type:"exchange",exchangeId:e}}})),s}catch(r){throw r instanceof Error&&r.message.includes("is not supported")?new yn(Vt.ASSET_NOT_SUPPORTED):new Error(r.message)}},async generateExchangeUrlForQuote({exchangeId:e,paymentAsset:t,amount:n,recipient:r}){const s=await Zce({exchangeId:e,asset:gU(t.network,t.asset),amount:n.toString(),recipient:r});de.exchangeSessionId=s.sessionId,de.exchangeUrlForQuote=s.url},async openPayUrl(e,t,n=!1){try{const r=await this.getPayUrl(e.exchangeId,t,n);if(!r)throw new yn(Vt.UNABLE_TO_GET_PAY_URL);const i=e.openInNewTab??!0?"_blank":"_self";return ht.openHref(r.url,i),r}catch(r){throw r instanceof yn?de.error=r.message:de.error=Yg.GENERIC_PAYMENT_ERROR,new yn(Vt.UNABLE_TO_GET_PAY_URL)}},async onTransfer({chainNamespace:e,fromAddress:t,toAddress:n,amount:r,paymentAsset:s}){if(de.currentPayment={type:"wallet",status:"IN_PROGRESS"},!de.isPaymentInProgress)try{this.initiatePayment();const o=re.getAllRequestedCaipNetworks().find(c=>c.caipNetworkId===s.network);if(!o)throw new Error("Target network not found");const a=re.state.activeCaipNetwork;switch(gu.isLowerCaseMatch(a==null?void 0:a.caipNetworkId,o.caipNetworkId)||await re.switchActiveNetwork(o),e){case Oe.CHAIN.EVM:s.asset==="native"&&(de.currentPayment.result=await AUt(s,e,{recipient:n,amount:r,fromAddress:t})),s.asset.startsWith("0x")&&(de.currentPayment.result=await _Ut(s,{recipient:n,amount:r,fromAddress:t})),de.currentPayment.status="SUCCESS";break;case Oe.CHAIN.SOLANA:de.currentPayment.result=await NUt(e,{recipient:n,amount:r,fromAddress:t,tokenMint:s.asset==="native"?void 0:s.asset}),de.currentPayment.status="SUCCESS";break;default:throw new yn(Vt.INVALID_CHAIN_NAMESPACE)}}catch(i){throw i instanceof yn?de.error=i.message:de.error=Yg.GENERIC_PAYMENT_ERROR,de.currentPayment.status="FAILED",nl.showError(de.error),i}finally{de.isPaymentInProgress=!1}},async onSendTransaction(e){try{const{namespace:t,transactionStep:n}=e;ot.initiatePayment();const s=re.getAllRequestedCaipNetworks().find(o=>{var a;return o.caipNetworkId===((a=de.paymentAsset)==null?void 0:a.network)});if(!s)throw new Error("Target network not found");const i=re.state.activeCaipNetwork;if(gu.isLowerCaseMatch(i==null?void 0:i.caipNetworkId,s.caipNetworkId)||await re.switchActiveNetwork(s),t===Oe.CHAIN.EVM){const{from:o,to:a,data:c,value:l}=n.transaction;await st.sendTransaction({address:o,to:a,data:c,value:BigInt(l),chainNamespace:t})}else if(t===Oe.CHAIN.SOLANA){const{instructions:o}=n.transaction;await st.writeSolanaTransaction({instructions:o})}}catch(t){throw t instanceof yn?de.error=t.message:de.error=Yg.GENERIC_PAYMENT_ERROR,nl.showError(de.error),t}finally{de.isPaymentInProgress=!1}},getExchangeById(e){return de.exchanges.find(t=>
vendor: 5,714 bytes, lines 6005-6030
6005t.id===e)},validatePayConfig(e){const{paymentAsset:t,recipient:n,amount:r}=e;if(!t)throw new yn(Vt.INVALID_PAYMENT_CONFIG);if(!n)throw new yn(Vt.INVALID_RECIPIENT);if(!t.asset)throw new yn(Vt.INVALID_ASSET);if(r==null||r<=0)throw new yn(Vt.INVALID_AMOUNT)},async handlePayWithExchange(e){try{de.currentPayment={type:"exchange",exchangeId:e};const{network:t,asset:n}=de.paymentAsset,r={network:t,asset:n,amount:de.amount,recipient:de.recipient},s=await this.getPayUrl(e,r);if(!s)throw new yn(Vt.UNABLE_TO_INITIATE_PAYMENT);return de.currentPayment.sessionId=s.sessionId,de.currentPayment.status="IN_PROGRESS",de.currentPayment.exchangeId=e,this.initiatePayment(),{url:s.url,openInNewTab:de.openInNewTab}}catch(t){return t instanceof yn?de.error=t.message:de.error=Yg.GENERIC_PAYMENT_ERROR,de.isPaymentInProgress=!1,nl.showError(de.error),null}},async getBuyStatus(e,t){var n,r;try{const s=await kUt({sessionId:t,exchangeId:e});return(s.status==="SUCCESS"||s.status==="FAILED")&&Mn.sendEvent({type:"track",event:s.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:s.status==="FAILED"?ht.parseError(de.error):void 0,source:"pay",paymentId:de.paymentId||mU,configuration:{network:de.paymentAsset.network,asset:de.paymentAsset.asset,recipient:de.recipient,amount:de.amount},currentPayment:{type:"exchange",exchangeId:(n=de.currentPayment)==null?void 0:n.exchangeId,sessionId:(r=de.currentPayment)==null?void 0:r.sessionId,result:s.txHash}}}),s}catch{throw new yn(Vt.UNABLE_TO_GET_BUY_STATUS)}},async fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:n}){if(!e)return[];const{address:r}=mr.parseCaipAddress(e);let s=t;return n===Oe.CHAIN.EVM&&(s=void 0),await kP.getMyTokensWithBalance({address:r,caipNetwork:s})},async fetchTokensFromExchange(){if(!de.selectedExchange)return[];const e=await UUt(de.selectedExchange.id),t=Object.values(e.assets).flat();return await Promise.all(t.map(async r=>{const s=zUt(r),{chainNamespace:i}=mr.parseCaipNetworkId(s.chainId);let o=s.address;if(ht.isCaipAddress(o)){const{address:c}=mr.parseCaipAddress(o);o=c}const a=await ll.getImageByToken(o??"",i).catch(()=>{});return s.iconUrl=a??"",s}))},async fetchTokens({caipAddress:e,caipNetwork:t,namespace:n}){try{de.isFetchingTokenBalances=!0;const i=await(!!de.selectedExchange?this.fetchTokensFromExchange():this.fetchTokensFromEOA({caipAddress:e,caipNetwork:t,namespace:n}));de.tokenBalances={...de.tokenBalances,[n]:i}}catch(r){const s=r instanceof Error?r.message:"Unable to get token balances";nl.showError(s)}finally{de.isFetchingTokenBalances=!1}},async fetchQuote({amount:e,address:t,sourceToken:n,toToken:r,recipient:s}){try{ot.resetQuoteState(),de.isFetchingQuote=!0;const i=await BUt({amount:e,address:de.selectedExchange?void 0:t,sourceToken:n,toToken:r,recipient:s});if(de.selectedExchange){const o=nq(i);if(o){const a=`${n.network}:${o.deposit.receiver}`,c=Io.formatNumber(o.deposit.amount,{decimals:n.metadata.decimals??0,round:8});await ot.generateExchangeUrlForQuote({exchangeId:de.selectedExchange.id,paymentAsset:n,amount:c.toString(),recipient:a})}}de.quote=i}catch(i){let o=Yg.UNABLE_TO_GET_QUOTE;if(i instanceof Error&&i.cause&&i.cause instanceof Response)try{const a=await i.cause.json();a.error&&typeof a.error=="string"&&(o=a.error)}catch{}throw de.quoteError=o,nl.showError(o),new yn(Vt.UNABLE_TO_GET_QUOTE)}finally{de.isFetchingQuote=!1}},async fetchQuoteStatus({requestId:e}){try{if(e===rq){const n=de.selectedExchange,r=de.exchangeSessionId;if(n&&r){switch((await this.getBuyStatus(n.id,r)).status){case"IN_PROGRESS":de.quoteStatus="waiting";break;case"SUCCESS":de.quoteStatus="success",de.isPaymentInProgress=!1;break;case"FAILED":de.quoteStatus="failure",de.isPaymentInProgress=!1;break;case"UNKNOWN":de.quoteStatus="waiting";break;default:de.quoteStatus="waiting";break}return}de.quoteStatus="success";return}const{status:t}=await DUt({requestId:e});de.quoteStatus=t}catch{throw de.quoteStatus="failure",new yn(Vt.UNABLE_TO_GET_QUOTE_STATUS)}},initiatePayment(){de.isPaymentInProgress=!0,de.paymentId=crypto.randomUUID()},initializeAnalytics(){de.analyticsSet||(de.analyticsSet=!0,this.subscribeKey("isPaymentInProgress",e=>{var t;if((t=de.currentPayment)!=null&&t.status&&de.currentPayment.status!=="UNKNOWN"){const n={IN_PROGRESS:"PAY_INITIATED",SUCCESS:"PAY_SUCCESS",FAILED:"PAY_ERROR"}[de.currentPayment.status];Mn.sendEvent({type:"track",event:n,properties:{message:de.currentPayment.status==="FAILED"?ht.parseError(de.error):void 0,source:"pay",paymentId:de.paymentId||mU,configuration:{network:de.paymentAsset.network,asset:de.paymentAsset.asset,recipient:de.recipient,amount:de.amount},currentPayment:{type:de.currentPayment.type,exchangeId:de.currentPayment.exchangeId,sessionId:de.currentPayment.sessionId,result:de.currentPayment.result}}})}}))},async prepareTokenLogo(){if(!de.paymentAsset.metadata.logoURI)try{const{chainNamespace:e}=mr.parseCaipNetworkId(de.paymentAsset.network),t=await ll.getImageByToken(de.paymentAsset.asset,e);de.paymentAsset.metadata.logoURI=t}catch{}}},VUt=Ms` 6006 wui-separator { 6007 margin: var(--apkt-spacing-3) calc(var(--apkt-spacing-3) * -1) var(--apkt-spacing-2) 6008 calc(var(--apkt-spacing-3) * -1); 6009 width: calc(100% + var(--apkt-spacing-3) * 2); 6010 } 6011 6012 .token-display { 6013 padding: var(--apkt-spacing-3) var(--apkt-spacing-3); 6014 border-radius: var(--apkt-borderRadius-5); 6015 background-color: var(--apkt-tokens-theme-backgroundPrimary); 6016 margin-top: var(--apkt-spacing-3); 6017 margin-bottom: var(--apkt-spacing-3); 6018 } 6019 6020 .token-display wui-text { 6021 text-transform: none; 6022 } 6023 6024 wui-loading-spinner { 6025 padding: var(--apkt-spacing-2); 6026 } 6027 6028 .left-image-container { 6029 position: relative; 6030 justify-content: center;
6031 align-items: center; 6032 } 6033 6034 .token-image { 6035 border-radius: ${({borderRadius:e})=>e.round}; 6036 width: 40px; 6037 height: 40px; 6038 } 6039 6040 .chain-image { 6041 position: absolute; 6042 width: 20px; 6043 height: 20px; 6044 bottom: -3px; 6045 right: -5px; 6046 border-radius: ${({borderRadius:e})=>e.round}; 6047 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 6048 } 6049 6050 .payment-methods-container { 6051 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6052 border-top-right-radius: ${({borderRadius:e})=>e[8]}; 6053 border-top-left-radius: ${({borderRadius:e})=>e[8]}; 6054 } 6055`;var E1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let ff=class extends ce{constructor(){super(),this.unsubscribe=[],this.amount=ot.state.amount,this.namespace=void 0,this.paymentAsset=ot.state.paymentAsset,this.activeConnectorIds=Ve.state.activeConnectorIds,this.caipAddress=void 0,this.exchanges=ot.state.exchanges,this.isLoading=ot.state.isLoading,this.initializeNamespace(),this.unsubscribe.push(ot.subscribeKey("amount",t=>this.amount=t)),this.unsubscribe.push(Ve.subscribeKey("activeConnectorIds",t=>this.activeConnectorIds=t)),this.unsubscribe.push(ot.subscribeKey("exchanges",t=>this.exchanges=t)),this.unsubscribe.push(ot.subscribeKey("isLoading",t=>this.isLoading=t)),ot.fetchExchanges(),ot.setSelectedExchange(void 0)}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return j` 6056 <wui-flex flexDirection="column"> 6057 ${this.paymentDetailsTemplate()} ${this.paymentMethodsTemplate()} 6058 </wui-flex> 6059 `}paymentMethodsTemplate(){return j` 6060 <wui-flex flexDirection="column" padding="3" gap="2" class="payment-methods-container"> 6061 ${this.payWithWalletTemplate()} ${this.templateSeparator()} 6062 ${this.templateExchangeOptions()} 6063 </wui-flex> 6064 `}initializeNamespace(){var n;const t=re.state.activeChain;this.namespace=t,this.caipAddress=(n=re.getAccountData(t))==null?void 0:n.caipAddress,this.unsubscribe.push(re.subscribeChainProp("accountState",r=>{this.caipAddress=r==null?void 0:r.caipAddress},t))}paymentDetailsTemplate(){const n=re.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===this.paymentAsset.network);return j` 6065 <wui-flex 6066 alignItems="center" 6067 justifyContent="space-between" 6068 .padding=${["6","8","6","8"]} 6069 gap="2" 6070 > 6071 <wui-flex alignItems="center" gap="1"> 6072 <wui-text variant="h1-regular" color="primary"> 6073 ${gN(this.amount||"0")} 6074 </wui-text> 6075 6076 <wui-flex flexDirection="column"> 6077 <wui-text variant="h6-regular" color="secondary"> 6078 ${this.paymentAsset.metadata.symbol||"Unknown"} 6079 </wui-text> 6080 <wui-text variant="md-medium" color="secondary" 6081 >on ${(n==null?void 0:n.name)||"Unknown"}</wui-text 6082 > 6083 </wui-flex> 6084 </wui-flex> 6085 6086 <wui-flex class="left-image-container"> 6087 <wui-image 6088 src=${ge(this.paymentAsset.metadata.logoURI)} 6089 class="token-image" 6090 ></wui-image> 6091 <wui-image 6092 src=${ge(ll.getNetworkImage(n))} 6093 class="chain-image" 6094 ></wui-image> 6095 </wui-flex> 6096 </wui-flex> 6097 `}payWithWalletTemplate(){return jUt(this.paymentAsset.network)?this.caipAddress?this.connectedWalletTemplate():this.disconnectedWalletTemplate():j``}connectedWalletTemplate(){const{name:t,image:n}=this.getWalletProperties({namespace:this.namespace});return j` 6098 <wui-flex flexDirection="column" gap="3"> 6099 <wui-list-item 6100 type="secondary" 6101 boxColor="foregroundSecondary" 6102 @click=${this.onWalletPayment} 6103 .boxed=${!1} 6104 ?chevron=${!0} 6105 ?fullSize=${!1} 6106 ?rounded=${!0} 6107 data-testid="wallet-payment-option" 6108 imageSrc=${ge(n)} 6109 imageSize="3xl" 6110 > 6111 <wui-text variant="lg-regular" color="primary">Pay with ${t}</wui-text> 6112 </wui-list-item> 6113 6114 <wui-list-item 6115 type="secondary" 6116 icon="power" 6117 iconColor="error" 6118 @click=${this.onDisconnect} 6119 data-testid="disconnect-button" 6120 ?chevron=${!1} 6121 boxColor="foregroundSecondary" 6122 > 6123 <wui-text variant="lg-regular" color="secondary">Disconnect</wui-text> 6124 </wui-list-item> 6125 </wui-flex> 6126 `}disconnectedWalletTemplate(){return j`<wui-list-item 6127 type="secondary" 6128 boxColor="foregroundSecondary" 6129 variant="icon" 6130 iconColor="default" 6131 iconVariant="overlay" 6132 icon="wallet" 6133 @click=${this.onWalletPayment} 6134 ?chevron=${!0} 6135 data-testid="wallet-payment-option" 6136 > 6137 <wui-text variant="lg-regular" color="primary">Pay with wallet</wui-text> 6138 </wui-list-item>`}templateExchangeOptions(){if(this.isLoading)return j`<wui-flex justifyContent="center" alignItems="center"> 6139 <wui-loading-spinner size="md"></wui-loading-spinner> 6140 </wui-flex>`;const t=this.exchanges.filter(n=>qUt(this.paymentAsset)?n.id===Kce:n.id!==Kce);return t.length===0?j`<wui-flex justifyContent="center" alignItems="center"> 6141 <wui-text variant="md-medium" color="primary">No exchanges available</wui-text> 6142 </wui-flex>`:t.map(n=>j` 6143 <wui-list-item 6144 type="secondary" 6145 boxColor="foregroundSecondary" 6146 @click=${()=>this.onExchangePayment(n)}
6147 data-testid="exchange-option-${n.id}" 6148 ?chevron=${!0} 6149 imageSrc=${ge(n.imageUrl)} 6150 > 6151 <wui-text flexGrow="1" variant="lg-regular" color="primary"> 6152 Pay with ${n.name} 6153 </wui-text> 6154 </wui-list-item> 6155 `)}templateSeparator(){return j`<wui-separator text="or" bgColor="secondary"></wui-separator>`}async onWalletPayment(){if(!this.namespace)throw new Error("Namespace not found");this.caipAddress?Kt.push("PayQuote"):(await Ve.connect(),await pr.open({view:"PayQuote"}))}onExchangePayment(t){ot.setSelectedExchange(t),Kt.push("PayQuote")}async onDisconnect(){try{await st.disconnect(),await pr.open({view:"Pay"})}catch{console.error("Failed to disconnect"),nl.showError("Failed to disconnect")}}getWalletProperties({namespace:t}){if(!t)return{name:void 0,image:void 0};const n=this.activeConnectorIds[t];if(!n)return{name:void 0,image:void 0};const r=Ve.getConnector({id:n,namespace:t});if(!r)return{name:void 0,image:void 0};const s=ll.getConnectorImage(r);return{name:r.name,image:s}}};ff.styles=VUt;E1([se()],ff.prototype,"amount",void 0);E1([se()],ff.prototype,"namespace",void 0);E1([se()],ff.prototype,"paymentAsset",void 0);E1([se()],ff.prototype,"activeConnectorIds",void 0);E1([se()],ff.prototype,"caipAddress",void 0);E1([se()],ff.prototype,"exchanges",void 0);E1([se()],ff.prototype,"isLoading",void 0);ff=E1([ns("w3m-pay-view")],ff);const KUt=Ms` 6156 :host { 6157 display: inline-flex; 6158 align-items: center; 6159 justify-content: center; 6160 } 6161 6162 .pulse-container { 6163 position: relative; 6164 width: var(--pulse-size); 6165 height: var(--pulse-size); 6166 display: flex; 6167 align-items: center; 6168 justify-content: center; 6169 } 6170 6171 .pulse-rings { 6172 position: absolute; 6173 inset: 0; 6174 pointer-events: none; 6175 } 6176 6177 .pulse-ring { 6178 position: absolute; 6179 inset: 0; 6180 border-radius: 50%; 6181 border: 2px solid var(--pulse-color); 6182 opacity: 0; 6183 animation: pulse var(--pulse-duration, 2s) ease-out infinite; 6184 } 6185 6186 .pulse-content { 6187 position: relative; 6188 z-index: 1; 6189 display: flex; 6190 align-items: center; 6191 justify-content: center; 6192 } 6193 6194 @keyframes pulse { 6195 0% { 6196 transform: scale(0.5); 6197 opacity: var(--pulse-opacity, 0.3); 6198 } 6199 50% { 6200 opacity: calc(var(--pulse-opacity, 0.3) * 0.5); 6201 } 6202 100% { 6203 transform: scale(1.2); 6204 opacity: 0; 6205 } 6206 } 6207`;var p3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const GUt=3,ZUt=2,YUt=.3,JUt="200px",XUt={"accent-primary":Fr.tokens.core.backgroundAccentPrimary};let a1=class extends ce{constructor(){super(...arguments),this.rings=GUt,this.duration=ZUt,this.opacity=YUt,this.size=JUt,this.variant="accent-primary"}render(){const t=XUt[this.variant];this.style.cssText=` 6208 --pulse-size: ${this.size}; 6209 --pulse-duration: ${this.duration}s; 6210 --pulse-color: ${t}; 6211 --pulse-opacity: ${this.opacity}; 6212 `;const n=Array.from({length:this.rings},(r,s)=>this.renderRing(s,this.rings));return j` 6213 <div class="pulse-container"> 6214 <div class="pulse-rings">${n}</div> 6215 <div class="pulse-content"> 6216 <slot></slot> 6217 </div> 6218 </div> 6219 `}renderRing(t,n){const s=`animation-delay: ${t/n*this.duration}s;`;return j`<div class="pulse-ring" style=${s}></div>`}};a1.styles=[Ca,KUt];p3([z({type:Number})],a1.prototype,"rings",void 0);p3([z({type:Number})],a1.prototype,"duration",void 0);p3([z({type:Number})],a1.prototype,"opacity",void 0);p3([z()],a1.prototype,"size",void 0);p3([z()],a1.prototype,"variant",void 0);a1=p3([ns("wui-pulse")],a1);const Xce=[{id:"received",title:"Receiving funds",icon:"dollar"},{id:"processing",title:"Swapping asset",icon:"recycleHorizontal"},{id:"sending",title:"Sending asset to the recipient address",icon:"send"}],Qce=["success","submitted","failure","timeout","refund"],QUt=Ms` 6220 :host { 6221 display: block; 6222 height: 100%; 6223 width: 100%; 6224 } 6225 6226 wui-image { 6227 border-radius: ${({borderRadius:e})=>e.round}; 6228 } 6229 6230 .token-badge-container { 6231 position: absolute; 6232 bottom: 6px; 6233 left: 50%; 6234 transform: translateX(-50%); 6235 border-radius: ${({borderRadius:e})=>e[4]}; 6236 z-index: 3; 6237 min-width: 105px; 6238 } 6239 6240 .token-badge-container.loading { 6241 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 6242 border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 6243 } 6244 6245 .token-badge-container.success { 6246 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 6247 border: 3px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 6248 } 6249 6250 .token-image-container { 6251 position: relative; 6252 } 6253 6254 .token-image { 6255 border-radius: ${({borderRadius:e})=>e.round}; 6256 width: 64px; 6257 height: 64px; 6258 } 6259 6260 .token-image.success { 6261 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6262 } 6263 6264 .token-image.error { 6265 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6266 } 6267 6268 .token-image.loading { 6269 background: ${({colors:e})=>e.accent010}; 6270 } 6271 6272 .token-image wui-icon { 6273 width: 32px; 6274 height: 32px; 6275 } 6276 6277 .token-badge { 6278 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6279 border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary}; 6280 border-radius: ${({borderRadius:e})=>e[4]}; 6281 } 6282 6283 .token-badge wui-text { 6284 white-space: nowrap; 6285 } 6286 6287 .payment-lifecycle-container { 6288 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6289 border-top-right-radius: ${({borderRadius:e})=>e[6]}; 6290 border-top-left-radius: ${({borderRadius:e})=>e[6]}; 6291 } 6292 6293 .payment-step-badge { 6294 padding: ${({spacing:e})=>e[1]} ${({spacing:e})=>e[2]}; 6295 border-radius: ${({borderRadius:e})=>e[1]}; 6296 } 6297 6298 .payment-step-badge.loading { 6299 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 6300 } 6301 6302 .payment-step-badge.error { 6303 background-color: ${({tokens:e})=>e.core.backgroundError}; 6304 } 6305 6306 .payment-step-badge.success { 6307 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 6308 } 6309 6310 .step-icon-container { 6311 position: relative; 6312 height: 40px; 6313 width: 40px; 6314 border-radius: ${({borderRadius:e})=>e.round}; 6315 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 6316 } 6317 6318 .step-icon-box { 6319 position: absolute; 6320 right: -4px; 6321 bottom: -1px; 6322 padding: 2px; 6323 border-radius: ${({borderRadius:e})=>e.round}; 6324 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 6325 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6326 } 6327 6328 .step-icon-box.success { 6329 background-color: ${({tokens:e})=>e.core.backgroundSuccess}; 6330 } 6331`;var Cf=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const eLt={received:["pending","success","submitted"],processing:["success","submitted"],sending:["success","submitted"]},tLt=3e3;let Ou=class extends ce{constructor(){super(),this.unsubscribe=[],this.pollingInterval=null,this.paymentAsset=ot.state.paymentAsset,this.quoteStatus=ot.state.quoteStatus,this.quote=ot.state.quote,this.amount=ot.state.amount,this.namespace=void 0,this.caipAddress=void 0,this.profileName=null,this.activeConnectorIds=Ve.state.activeConnectorIds,this.selectedExchange=ot.state.selectedExchange,this.initializeNamespace(),this.unsubscribe.push(ot.subscribeKey("quoteStatus",t=>this.quoteStatus=t),ot.subscribeKey("quote",t=>this.quote=t),Ve.subscribeKey("activeConnectorIds",t=>this.activeConnectorIds=t),ot.subscribeKey("selectedExchange",t=>this.selectedExchange=t))}connectedCallback(){super.connectedCallback(),this.startPolling()}disconnectedCallback(){super.disconnectedCallback(),this.stopPolling(),this.unsubscribe.forEach(t=>t())}render(){return j` 6332 <wui-flex flexDirection="column" .padding=${["3","0","0","0"]} gap="2"> 6333 ${this.tokenTemplate()} ${this.paymentTemplate()} ${this.paymentLifecycleTemplate()} 6334 </wui-flex> 6335 `}tokenTemplate(){const t=gN(this.amount||"0"),n=this.paymentAsset.metadata.symbol??"Unknown",s=re.getAllRequestedCaipNetworks().find(a=>a.caipNetworkId===this.paymentAsset.network),i=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund";return this.quoteStatus==="success"||this.quoteStatus==="submitted"?j`<wui-flex alignItems="center" justifyContent="center"> 6336 <wui-flex justifyContent="center" alignItems="center" class="token-image success"> 6337 <wui-icon name="checkmark" color="success" size="inherit"></wui-icon> 6338 </wui-flex> 6339 </wui-flex>`:i?j`<wui-flex alignItems="center" justifyContent="center"> 6340 <wui-flex justifyContent="center" alignItems="center" class="token-image error"> 6341 <wui-icon name="close" color="error" size="inherit"></wui-icon> 6342 </wui-flex> 6343 </wui-flex>`:j` 6344 <wui-flex alignItems="center" justifyContent="center"> 6345 <wui-flex class="token-image-container"> 6346 <wui-pulse size="125px" rings="3" duration="4" opacity="0.5" variant="accent-primary"> 6347 <wui-flex justifyContent="center" alignItems="center" class="token-image loading"> 6348 <wui-icon name="paperPlaneTitle" color="accent-primary" size="inherit"></wui-icon> 6349 </wui-flex> 6350 </wui-pulse> 6351 6352 <wui-flex 6353 justifyContent="center" 6354 alignItems="center" 6355 class="token-badge-container loading" 6356 > 6357 <wui-flex 6358 alignItems="center" 6359 justifyContent="center" 6360 gap="01" 6361 padding="1" 6362 class="token-badge" 6363 > 6364 <wui-image 6365 src=${ge(ll.getNetworkImage(s))} 6366 class="chain-image" 6367 size="mdl" 6368 ></wui-image> 6369 6370 <wui-text variant="lg-regular" color="primary">${t} ${n}</wui-text> 6371 </wui-flex> 6372 </wui-flex> 6373 </wui-flex> 6374 </wui-flex> 6375 `}paymentTemplate(){return j` 6376 <wui-flex flexDirection="column" gap="2" .padding=${["0","6","0","6"]}> 6377 ${this.renderPayment()} 6378 <wui-separator></wui-separator> 6379 ${this.renderWallet()} 6380 </wui-flex> 6381 `}paymentLifecycleTemplate(){const t=this.getStepsWithStatus();return j` 6382 <wui-flex flexDirection="column" padding="4" gap="2" class="payment-lifecycle-container"> 6383 <wui-flex alignItems="center" justifyContent="space-between"> 6384 <wui-text variant="md-regular" color="secondary">PAYMENT CYCLE</wui-text> 6385 6386 ${this.renderPaymentCycleBadge()} 6387 </wui-flex> 6388 6389 <wui-flex flexDirection="column" gap="5" .padding=${["2","0","2","0"]}> 6390 ${t.map(n=>this.renderStep(n))} 6391 </wui-flex> 6392 </wui-flex> 6393 `}renderPaymentCycleBadge(){var s;const t=this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund",n=this.quoteStatus==="success"||this.quoteStatus==="submitted";if(t)return j` 6394 <wui-flex 6395 justifyContent="center" 6396 alignItems="center" 6397 class="payment-step-badge error" 6398 gap="1" 6399 > 6400 <wui-icon name="close" color="error" size="xs"></wui-icon> 6401 <wui-text variant="sm-regular" color="error">Failed</wui-text> 6402 </wui-flex> 6403 `;if(n)return j` 6404 <wui-flex 6405 justifyContent="center" 6406 alignItems="center" 6407 class="payment-step-badge success" 6408 gap="1" 6409 > 6410 <wui-icon name="checkmark" color="success" size="xs"></wui-icon> 6411 <wui-text variant="sm-regular" color="success">Completed</wui-text> 6412 </wui-flex> 6413 `;const r=((s=this.quote)==null?void 0:s.timeInSeconds)??0;return j` 6414 <wui-flex alignItems="center" justifyContent="space-between" gap="3"> 6415 <wui-flex 6416 justifyContent="center" 6417 alignItems="center" 6418 class="payment-step-badge loading" 6419 gap="1" 6420 > 6421 <wui-icon name="clock" color="default" size="xs"></wui-icon> 6422 <wui-text variant="sm-regular" color="primary">Est. ${r} sec</wui-text> 6423 </wui-flex> 6424 6425 <wui-icon name="chevronBottom" color="default" size="xxs"></wui-icon> 6426 </wui-flex> 6427 `}renderPayment(){var o,a,c;const n=re.getAllRequestedCaipNetworks().find(l=>{var h;const u=(h=this.quote)==null?void 0:h.origin.currency.network;if(!u)return!1;const{chainId:d}=mr.parseCaipNetworkId(u);return gu.isLowerCaseMatch(l.id.toString(),d.toString())}),r=Io.formatNumber(((o=this.quote)==null?void 0:o.origin.amount)||"0",{decimals:((a=this.quote)==null?void 0:a.origin.currency.metadata.decimals)??0}).toString(),s=gN(r),i=((c=this.quote)==null?void 0:c.origin.currency.metadata.symbol)??"Unknown";return j` 6428 <wui-flex 6429 alignItems="flex-start" 6430 justifyContent="space-between" 6431 .padding=${["3","0","3","0"]} 6432 > 6433 <wui-text variant="lg-regular" color="secondary">Payment Method</wui-text> 6434 6435 <wui-flex flexDirection="column" alignItems="flex-end" gap="1"> 6436 <wui-flex alignItems="center" gap="01"> 6437 <wui-text variant="lg-regular" color="primary">${s}</wui-text> 6438 <wui-text variant="lg-regular" color="secondary">${i}</wui-text> 6439 </wui-flex> 6440 6441 <wui-flex alignItems="center" gap="1"> 6442 <wui-text variant="md-regular" color="secondary">on</wui-text> 6443 <wui-image 6444 src=${ge(ll.getNetworkImage(n))} 6445 size="xs" 6446 ></wui-image> 6447 <wui-text variant="md-regular" color="secondary">${n==null?void 0:n.name}</wui-text> 6448 </wui-flex> 6449 </wui-flex> 6450 </wui-flex> 6451 `}renderWallet(){return j` 6452 <wui-flex 6453 alignItems="flex-start" 6454 justifyContent="space-between" 6455 .padding=${["3","0","3","0"]} 6456 > 6457 <wui-text variant="lg-regular" color="secondary" 6458 >${this.selectedExchange?"Exchange":"Wallet"}</wui-text 6459 > 6460 6461 ${this.renderWalletText()} 6462 </wui-flex> 6463 `}renderWalletText(){var s;const{image:t}=this.getWalletProperties({namespace:this.namespace}),{address:n}=this.caipAddress?mr.parseCaipAddress(this.caipAddress):{},r=(s=this.selectedExchange)==null?void 0:s.name;return this.selectedExchange?j` 6464 <wui-flex alignItems="center" justifyContent="flex-end" gap="1"> 6465 <wui-text variant="lg-regular" color="primary">${r}</wui-text> 6466 <wui-image src=${ge(this.selectedExchange.imageUrl)} size="mdl"></wui-image> 6467 </wui-flex> 6468 `:j` 6469 <wui-flex alignItems="center" justifyContent="flex-end" gap="1"> 6470 <wui-text variant="lg-regular" color="primary"> 6471 ${Ph.getTruncateString({string:this.profileName||n||r||"",charsStart:this.profileName?16:4,charsEnd:this.profileName?0:6,truncate:this.profileName?"end":"middle"})} 6472 </wui-text> 6473 6474 <wui-image src=${ge(t)} size="mdl"></wui-image> 6475 </wui-flex> 6476 `}getStepsWithStatus(){return this.quoteStatus==="failure"||this.quoteStatus==="timeout"||this.quoteStatus==="refund"?Xce.map(n=>({...n,status:"failed"})):Xce.map(n=>{const s=(eLt[n.id]??[]).includes(this.quoteStatus)?"completed":"pending";return{...n,status:s}})}renderStep({title:t,icon:n,status:r}){return j` 6477 <wui-flex alignItems="center" gap="3"> 6478 <wui-flex justifyContent="center" alignItems="center" class="step-icon-container"> 6479 <wui-icon name=${n} color="default" size="mdl"></wui-icon> 6480 6481 <wui-flex alignItems="center" justifyContent="center" class=${Y6({"step-icon-box":!0,success:r==="completed"})}> 6482 ${this.renderStatusIndicator(r)} 6483 </wui-flex> 6484 </wui-flex> 6485 6486 <wui-text variant="md-regular" color="primary">${t}</wui-text> 6487 </wui-flex> 6488 `}renderStatusIndicator(t){return t==="completed"?j`<wui-icon size="sm" color="success" name="checkmark"></wui-icon>`:t==="failed"?j`<wui-icon size="sm" color="error" name="close"></wui-icon>`:t==="pending"?j`<wui-loading-spinner color="accent-primary" size="sm"></wui-loading-spinner>`:null}startPolling(){this.p
6488ollingInterval||(this.fetchQuoteStatus(),this.pollingInterval=setInterval(()=>{this.fetchQuoteStatus()},tLt))}stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null)}async fetchQuoteStatus(){const t=ot.state.requestId;if(!t||Qce.includes(this.quoteStatus))this.stopPolling();else try{await ot.fetchQuoteStatus({requestId:t}),Qce.includes(this.quoteStatus)&&this.stopPolling()}catch{this.stopPolling()}}initializeNamespace(){var n,r;const t=re.state.activeChain;this.namespace=t,this.caipAddress=(n=re.getAccountData(t))==null?void 0:n.caipAddress,this.profileName=((r=re.getAccountData(t))==null?void 0:r.profileName)??null,this.unsubscribe.push(re.subscribeChainProp("accountState",s=>{this.caipAddress=s==null?void 0:s.caipAddress,this.profileName=(s==null?void 0:s.profileName)??null},t))}getWalletProperties({namespace:t}){if(!t)return{name:void 0,image:void 0};const n=this.activeConnectorIds[t];if(!n)return{name:void 0,image:void 0};const r=Ve.getConnector({id:n,namespace:t});if(!r)return{name:void 0,image:void 0};const s=ll.getConnectorImage(r);return{name:r.name,image:s}}};Ou.styles=QUt;Cf([se()],Ou.prototype,"paymentAsset",void 0);Cf([se()],Ou.prototype,"quoteStatus",void 0);Cf([se()],Ou.prototype,"quote",void 0);Cf([se()],Ou.prototype,"amount",void 0);Cf([se()],Ou.prototype,"namespace",void 0);Cf([se()],Ou.prototype,"caipAddress",void 0);Cf([se()],Ou.prototype,"profileName",void 0);Cf([se()],Ou.prototype,"activeConnectorIds",void 0);Cf([se()],Ou.prototype,"selectedExchange",void 0);Ou=Cf([ns("w3m-pay-loading-view")],Ou);const nLt=Ms` 6489 button { 6490 display: flex; 6491 align-items: center; 6492 height: 40px; 6493 padding: ${({spacing:e})=>e[2]}; 6494 border-radius: ${({borderRadius:e})=>e[4]}; 6495 column-gap: ${({spacing:e})=>e[1]}; 6496 background-color: transparent; 6497 transition: background-color ${({durations:e})=>e.lg} 6498 ${({easings:e})=>e["ease-out-power-2"]}; 6499 will-change: background-color; 6500 } 6501 6502 wui-image, 6503 .icon-box { 6504 width: ${({spacing:e})=>e[6]}; 6505 height: ${({spacing:e})=>e[6]}; 6506 border-radius: ${({borderRadius:e})=>e[4]}; 6507 } 6508 6509 wui-text { 6510 flex: 1; 6511 } 6512 6513 .icon-box { 6514 position: relative; 6515 } 6516 6517 .icon-box[data-active='true'] { 6518 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 6519 } 6520 6521 .circle { 6522 position: absolute; 6523 left: 16px; 6524 top: 15px; 6525 width: 8px; 6526 height: 8px; 6527 background-color: ${({tokens:e})=>e.core.textSuccess}; 6528 box-shadow: 0 0 0 2px ${({tokens:e})=>e.theme.foregroundPrimary}; 6529 border-radius: 50%; 6530 } 6531 6532 /* -- Hover & Active states ----------------------------------------------------------- */ 6533 @media (hover: hover) { 6534 button:hover:enabled, 6535 button:active:enabled { 6536 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6537 } 6538 } 6539`;var lh=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Cl=class extends ce{constructor(){super(...arguments),this.address="",this.profileName="",this.alt="",this.imageSrc="",this.icon=void 0,this.iconSize="md",this.enableGreenCircle=!0,this.loading=!1,this.charsStart=4,this.charsEnd=6}render(){return j` 6540 <button> 6541 ${this.leftImageTemplate()} ${this.textTemplate()} ${this.rightImageTemplate()} 6542 </button> 6543 `}leftImageTemplate(){const t=this.icon?j`<wui-icon 6544 size=${ge(this.iconSize)} 6545 color="default" 6546 name=${this.icon} 6547 class="icon" 6548 ></wui-icon>`:j`<wui-image src=${this.imageSrc} alt=${this.alt}></wui-image>`;return j` 6549 <wui-flex 6550 alignItems="center" 6551 justifyContent="center" 6552 class="icon-box" 6553 data-active=${!!this.icon} 6554 > 6555 ${t} 6556 ${this.enableGreenCircle?j`<wui-flex class="circle"></wui-flex>`:null} 6557 </wui-flex> 6558 `}textTemplate(){return j` 6559 <wui-text variant="lg-regular" color="primary"> 6560 ${Ph.getTruncateString({string:this.profileName||this.address,charsStart:this.profileName?16:this.charsStart,charsEnd:this.profileName?0:this.charsEnd,truncate:this.profileName?"end":"middle"})} 6561 </wui-text> 6562 `}rightImageTemplate(){return j`<wui-icon name="chevronBottom" size="sm" color="default"></wui-icon>`}};Cl.styles=[Ca,d3,nLt];lh([z()],Cl.prototype,"address",void 0);lh([z()],Cl.prototype,"profileName",void 0);lh([z()],Cl.prototype,"alt",void 0);lh([z()],Cl.prototype,"imageSrc",void 0);lh([z()],Cl.prototype,"icon",void 0);lh([z()],Cl.prototype,"iconSize",void 0);lh([z({type:Boolean})],Cl.prototype,"enableGreenCircle",void 0);lh([z({type:Boolean})],Cl.prototype,"loading",void 0);lh([z({type:Number})],Cl.prototype,"charsStart",void 0);lh([z({type:Number})],Cl.prototype,"charsEnd",void 0);Cl=lh([ns("wui-wallet-switch")],Cl);const rLt=Ms` 6563 :host { 6564 display: block; 6565 background: linear-gradient( 6566 90deg, 6567 ${({tokens:e})=>e.theme.foregroundPrimary} 0%, 6568 ${({tokens:e})=>e.theme.foregroundSecondary} 50%, 6569 ${({tokens:e})=>e.theme.foregroundPrimary} 100% 6570 ); 6571 background-size: 200% 100%; 6572 animation: shimmer 2s linear infinite; 6573 border-radius: ${({borderRadius:e})=>e[1]}; 6574 } 6575 6576 :host([data-rounded='true']) { 6577 border-radius: ${({borderRadius:e})=>e[16]}; 6578 } 6579 6580 @keyframes shimmer { 6581 0% { 6582 background-position: 100% 0; 6583 } 6584 100% { 6585 background-position: -100% 0; 6586 } 6587 } 6588`;var sx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Wy=class extends ce{constructor(){super(...arguments),this.width="",this.height="",this.variant="default",this.rounded=!1}render(){return this.style.cssText=` 6589 width: ${this.width}; 6590 height: ${this.height}; 6591 `,this.dataset.rounded=this.rounded?"true":"false",j`<slot></slot>`}};Wy.styles=[rLt];sx([z()],Wy.prototype,"width",void 0);sx([z()],Wy.prototype,"height",void 0);sx([z()],Wy.prototype,"variant",void 0);sx([z({type:Boolean})],Wy.prototype,"rounded",void 0);Wy=sx([ns("wui-shimmer")],Wy);const sLt=Xe` 6592 :host { 6593 display: block; 6594 } 6595`;var iLt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let sq=class extends ce{render(){return j` 6596 <wui-flex flexDirection="column" gap="4"> 6597 <wui-flex alignItems="center" justifyContent="space-between"> 6598 <wui-text variant="md-regular" color="secondary">Pay</wui-text> 6599 <wui-shimmer width="60px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer> 6600 </wui-flex> 6601 6602 <wui-flex alignItems="center" justifyContent="space-between"> 6603 <wui-text variant="md-regular" color="secondary">Network Fee</wui-text> 6604 6605 <wui-flex flexDirection="column" alignItems="flex-end" gap="2"> 6606 <wui-shimmer 6607 width="75px" 6608 height="16px" 6609 borderRadius="4xs" 6610 variant="light" 6611 ></wui-shimmer> 6612 6613 <wui-flex alignItems="center" gap="01"> 6614 <wui-shimmer width="14px" height="14px" rounded variant="light"></wui-shimmer> 6615 <wui-shimmer 6616 width="49px" 6617 height="14px" 6618 borderRadius="4xs" 6619 variant="light" 6620 ></wui-shimmer> 6621 </wui-flex> 6622 </wui-flex> 6623 </wui-flex> 6624 6625 <wui-flex alignItems="center" justifyContent="space-between"> 6626 <wui-text variant="md-regular" color="secondary">Service Fee</wui-text> 6627 <wui-shimmer width="75px" height="16px" borderRadius="4xs" variant="light"></wui-shimmer> 6628 </wui-flex> 6629 </wui-flex> 6630 `}};sq.styles=[sLt];
6630sq=iLt([ns("w3m-pay-fees-skeleton")],sq);const oLt=Ms` 6631 :host { 6632 display: block; 6633 } 6634 6635 wui-image { 6636 border-radius: ${({borderRadius:e})=>e.round}; 6637 } 6638`;var QCe=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let mN=class extends ce{constructor(){super(),this.unsubscribe=[],this.quote=ot.state.quote,this.unsubscribe.push(ot.subscribeKey("quote",t=>this.quote=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){var n,r,s;const t=Io.formatNumber(((n=this.quote)==null?void 0:n.origin.amount)||"0",{decimals:((r=this.quote)==null?void 0:r.origin.currency.metadata.decimals)??0,round:6}).toString();return j` 6639 <wui-flex flexDirection="column" gap="4"> 6640 <wui-flex alignItems="center" justifyContent="space-between"> 6641 <wui-text variant="md-regular" color="secondary">Pay</wui-text> 6642 <wui-text variant="md-regular" color="primary"> 6643 ${t} ${((s=this.quote)==null?void 0:s.origin.currency.metadata.symbol)||"Unknown"} 6644 </wui-text> 6645 </wui-flex> 6646 6647 ${this.quote&&this.quote.fees.length>0?this.quote.fees.map(i=>this.renderFee(i)):null} 6648 </wui-flex> 6649 `}renderFee(t){const n=t.id==="network",r=Io.formatNumber(t.amount||"0",{decimals:t.currency.metadata.decimals??0,round:6}).toString();if(n){const i=re.getAllRequestedCaipNetworks().find(o=>gu.isLowerCaseMatch(o.caipNetworkId,t.currency.network));return j` 6650 <wui-flex alignItems="center" justifyContent="space-between"> 6651 <wui-text variant="md-regular" color="secondary">${t.label}</wui-text> 6652 6653 <wui-flex flexDirection="column" alignItems="flex-end" gap="2"> 6654 <wui-text variant="md-regular" color="primary"> 6655 ${r} ${t.currency.metadata.symbol||"Unknown"} 6656 </wui-text> 6657 6658 <wui-flex alignItems="center" gap="01"> 6659 <wui-image 6660 src=${ge(ll.getNetworkImage(i))} 6661 size="xs" 6662 ></wui-image> 6663 <wui-text variant="sm-regular" color="secondary"> 6664 ${(i==null?void 0:i.name)||"Unknown"} 6665 </wui-text> 6666 </wui-flex> 6667 </wui-flex> 6668 </wui-flex> 6669 `}return j` 6670 <wui-flex alignItems="center" justifyContent="space-between"> 6671 <wui-text variant="md-regular" color="secondary">${t.label}</wui-text> 6672 <wui-text variant="md-regular" color="primary"> 6673 ${r} ${t.currency.metadata.symbol||"Unknown"} 6674 </wui-text> 6675 </wui-flex> 6676 `}};mN.styles=[oLt];QCe([se()],mN.prototype,"quote",void 0);mN=QCe([ns("w3m-pay-fees")],mN);const aLt=Ms` 6677 :host { 6678 display: block; 6679 width: 100%; 6680 } 6681 6682 .disabled-container { 6683 padding: ${({spacing:e})=>e[2]}; 6684 min-height: 168px; 6685 } 6686 6687 wui-icon { 6688 width: ${({spacing:e})=>e[8]}; 6689 height: ${({spacing:e})=>e[8]}; 6690 } 6691 6692 wui-flex > wui-text { 6693 max-width: 273px; 6694 } 6695`;var e$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let wN=class extends ce{constructor(){super(),this.unsubscribe=[],this.selectedExchange=ot.state.selectedExchange,this.unsubscribe.push(ot.subscribeKey("selectedExchange",t=>this.selectedExchange=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=!!this.selectedExchange;return j` 6696 <wui-flex 6697 flexDirection="column" 6698 alignItems="center" 6699 justifyContent="center" 6700 gap="3" 6701 class="disabled-container" 6702 > 6703 <wui-icon name="coins" color="default" size="inherit"></wui-icon> 6704 6705 <wui-text variant="md-regular" color="primary" align="center"> 6706 You don't have enough funds to complete this transaction 6707 </wui-text> 6708 6709 ${t?null:j`<wui-button 6710 size="md" 6711 variant="neutral-secondary" 6712 @click=${this.dispatchConnectOtherWalletEvent.bind(this)} 6713 >Connect other wallet</wui-button 6714 >`} 6715 </wui-flex> 6716 `}dispatchConnectOtherWalletEvent(){this.dispatchEvent(new CustomEvent("connectOtherWallet",{detail:!0,bubbles:!0,composed:!0}))}};wN.styles=[aLt];e$e([z({type:Array})],wN.prototype,"selectedExchange",void 0);wN=e$e([ns("w3m-pay-options-empty")],wN);const cLt=Ms` 6717 :host { 6718 display: block; 6719 width: 100%; 6720 } 6721 6722 .pay-options-container { 6723 max-height: 196px; 6724 overflow-y: auto; 6725 overflow-x: hidden; 6726 scrollbar-width: none; 6727 } 6728 6729 .pay-options-container::-webkit-scrollbar {
6730 display: none; 6731 } 6732 6733 .pay-option-container { 6734 border-radius: ${({borderRadius:e})=>e[4]}; 6735 padding: ${({spacing:e})=>e[3]}; 6736 min-height: 60px; 6737 } 6738 6739 .token-images-container { 6740 position: relative; 6741 justify-content: center; 6742 align-items: center; 6743 } 6744 6745 .chain-image { 6746 position: absolute; 6747 bottom: -3px; 6748 right: -5px; 6749 border: 2px solid ${({tokens:e})=>e.theme.foregroundSecondary}; 6750 } 6751`;var lLt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let iq=class extends ce{render(){return j` 6752 <wui-flex flexDirection="column" gap="2" class="pay-options-container"> 6753 ${this.renderOptionEntry()} ${this.renderOptionEntry()} ${this.renderOptionEntry()} 6754 </wui-flex> 6755 `}renderOptionEntry(){return j` 6756 <wui-flex 6757 alignItems="center" 6758 justifyContent="space-between" 6759 gap="2" 6760 class="pay-option-container" 6761 > 6762 <wui-flex alignItems="center" gap="2"> 6763 <wui-flex class="token-images-container"> 6764 <wui-shimmer 6765 width="32px" 6766 height="32px" 6767 rounded 6768 variant="light" 6769 class="token-image" 6770 ></wui-shimmer> 6771 <wui-shimmer 6772 width="16px" 6773 height="16px" 6774 rounded 6775 variant="light" 6776 class="chain-image" 6777 ></wui-shimmer> 6778 </wui-flex> 6779 6780 <wui-flex flexDirection="column" gap="1"> 6781 <wui-shimmer 6782 width="74px" 6783 height="16px" 6784 borderRadius="4xs" 6785 variant="light" 6786 ></wui-shimmer> 6787 <wui-shimmer 6788 width="46px" 6789 height="14px" 6790 borderRadius="4xs" 6791 variant="light" 6792 ></wui-shimmer> 6793 </wui-flex> 6794 </wui-flex> 6795 </wui-flex> 6796 `}};iq.styles=[cLt];iq=lLt([ns("w3m-pay-options-skeleton")],iq);const uLt=Ms` 6797 :host { 6798 display: block; 6799 width: 100%; 6800 } 6801 6802 .pay-options-container { 6803 max-height: 196px; 6804 overflow-y: auto; 6805 overflow-x: hidden; 6806 scrollbar-width: none; 6807 mask-image: var(--options-mask-image); 6808 -webkit-mask-image: var(--options-mask-image); 6809 } 6810 6811 .pay-options-container::-webkit-scrollbar {
6812 display: none; 6813 } 6814 6815 .pay-option-container { 6816 cursor: pointer; 6817 border-radius: ${({borderRadius:e})=>e[4]}; 6818 padding: ${({spacing:e})=>e[3]}; 6819 transition: background-color ${({durations:e})=>e.lg} 6820 ${({easings:e})=>e["ease-out-power-1"]}; 6821 will-change: background-color; 6822 } 6823 6824 .token-images-container { 6825 position: relative; 6826 justify-content: center; 6827 align-items: center; 6828 } 6829 6830 .token-image { 6831 border-radius: ${({borderRadius:e})=>e.round}; 6832 width: 32px; 6833 height: 32px; 6834 } 6835 6836 .chain-image { 6837 position: absolute; 6838 width: 16px; 6839 height: 16px; 6840 bottom: -3px; 6841 right: -5px; 6842 border-radius: ${({borderRadius:e})=>e.round}; 6843 border: 2px solid ${({tokens:e})=>e.theme.backgroundPrimary}; 6844 } 6845 6846 @media (hover: hover) and (pointer: fine) { 6847 .pay-option-container:hover { 6848 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6849 } 6850 } 6851`;var RP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const dLt=300;let l6=class extends ce{constructor(){super(),this.unsubscribe=[],this.options=[],this.selectedPaymentAsset=null}disconnectedCallback(){var n,r;this.unsubscribe.forEach(s=>s()),(n=this.resizeObserver)==null||n.disconnect();const t=(r=this.shadowRoot)==null?void 0:r.querySelector(".pay-options-container");t==null||t.removeEventListener("scroll",this.handleOptionsListScroll.bind(this))}firstUpdated(){var n,r;const t=(n=this.shadowRoot)==null?void 0:n.querySelector(".pay-options-container");t&&(requestAnimationFrame(this.handleOptionsListScroll.bind(this)),t==null||t.addEventListener("scroll",this.handleOptionsListScroll.bind(this)),this.resizeObserver=new ResizeObserver(()=>{this.handleOptionsListScroll()}),(r=this.resizeObserver)==null||r.observe(t),this.handleOptionsListScroll())}render(){return j` 6852 <wui-flex flexDirection="column" gap="2" class="pay-options-container"> 6853 ${this.options.map(t=>this.payOptionTemplate(t))} 6854 </wui-flex> 6855 `}payOptionTemplate(t){var f,g;const{network:n,metadata:r,asset:s,amount:i="0"}=t,a=re.getAllRequestedCaipNetworks().find(p=>p.caipNetworkId===n),c=`${n}:${s}`,l=`${(f=this.selectedPaymentAsset)==null?void 0:f.network}:${(g=this.selectedPaymentAsset)==null?void 0:g.asset}`,u=c===l,d=Io.bigNumber(i,{safe:!0}),h=d.gt(0);return j` 6856 <wui-flex 6857 alignItems="center" 6858 justifyContent="space-between" 6859 gap="2" 6860 @click=${()=>{var p;return(p=this.onSelect)==null?void 0:p.call(this,t)}} 6861 class="pay-option-container" 6862 > 6863 <wui-flex alignItems="center" gap="2"> 6864 <wui-flex class="token-images-container"> 6865 <wui-image 6866 src=${ge(r.logoURI)} 6867 class="token-image" 6868 size="3xl" 6869 ></wui-image> 6870 <wui-image 6871 src=${ge(ll.getNetworkImage(a))} 6872 class="chain-image" 6873 size="md" 6874 ></wui-image> 6875 </wui-flex> 6876 6877 <wui-flex flexDirection="column" gap="1"> 6878 <wui-text variant="lg-regular" color="primary">${r.symbol}</wui-text> 6879 ${h?j`<wui-text variant="sm-regular" color="secondary"> 6880 ${d.round(6).toString()} ${r.symbol} 6881 </wui-text>`:null} 6882 </wui-flex> 6883 </wui-flex> 6884 6885 ${u?j`<wui-icon name="checkmark" size="md" color="success"></wui-icon>`:null} 6886 </wui-flex> 6887 `}handleOptionsListScroll(){var r;const t=(r=this.shadowRoot)==null?void 0:r.querySelector(".pay-options-container");if(!t)return;t.scrollHeight>dLt?(t.style.setProperty("--options-mask-image",`linear-gradient( 6888 to bottom, 6889 rgba(0, 0, 0, calc(1 - var(--options-scroll--top-opacity))) 0px, 6890 rgba(200, 200, 200, calc(1 - var(--options-scroll--top-opacity))) 1px, 6891 black 50px, 6892 black calc(100% - 50px), 6893 rgba(155, 155, 155, calc(1 - var(--options-scroll--bottom-opacity))) calc(100% - 1px), 6894 rgba(0, 0, 0, calc(1 - var(--options-scroll--bottom-opacity))) 100% 6895 )`),t.style.setProperty("--options-scroll--top-opacity",Wce.interpolate([0,50],[0,1],t.scrollTop).toString()),t.style.setProperty("--options-scroll--bottom-opacity",Wce.interpolate([0,50],[0,1],t.scrollHeight-t.scrollTop-t.offsetHeight).toString())):(t.style.setProperty("--options-mask-image","none"),t.style.setProperty("--options-scroll--top-opacity","0"),t.style.setProperty("--options-scroll--bottom-opacity","0"))}};l6.styles=[uLt];RP([z({type:Array})],l6.prototype,"options",void 0);RP([z()],l6.prototype,"selectedPaymentAsset",void 0);RP([z()],l6.prototype,"onSelect",void 0);l6=RP([ns("w3m-pay-options")],l6);const hLt=Ms` 6896 .payment-methods-container { 6897 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 6898 border-top-right-radius: ${({borderRadius:e})=>e[5]}; 6899 border-top-left-radius: ${({borderRadius:e})=>e[5]}; 6900 } 6901 6902 .pay-options-container { 6903 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 6904 border-radius: ${({borderRadius:e})=>e[5]}; 6905 padding: ${({spacing:e})=>e[1]}; 6906 } 6907 6908 w3m-tooltip-trigger { 6909 display: flex; 6910 align-items: center; 6911 justify-content: center; 6912 max-width: fit-content; 6913 } 6914 6915 wui-image { 6916 border-radius: ${({borderRadius:e})=>e.round}; 6917 } 6918 6919 w3m-pay-options.disabled { 6920 opacity: 0.5; 6921 pointer-events: none; 6922 } 6923`;var Oi=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const lS={eip155:"ethereum",solana:"solana",bip122:"bitcoin",ton:"ton"},fLt={eip155:{icon:lS.eip155,label:"EVM"},solana:{icon:lS.solana,label:"Solana"},bip122:{icon:lS.bip122,label:"Bitcoin"},ton:{icon:lS.ton,label:"Ton"}};let Us=class extends ce{constructor(){super(),this.unsubscribe=[],this.profileName=null,this.paymentAsset=ot.state.paymentAsset,this.namespace=void 0,this.caipAddress=void 0,this.amount=ot.state.amount,this.recipient=ot.state.recipient,this.activeConnectorIds=Ve.state.activeConnectorIds,this.selectedPaymentAsset=ot.state.selectedPaymentAsset,this.selectedExchange=ot.state.selectedExchange,this.isFetchingQuote=ot.state.isFetchingQuote,this.quoteError=ot.state.quoteError,this.quote=ot.state.quote,this.isFetchingTokenBalances=ot.
6923state.isFetchingTokenBalances,this.tokenBalances=ot.state.tokenBalances,this.isPaymentInProgress=ot.state.isPaymentInProgress,this.exchangeUrlForQuote=ot.state.exchangeUrlForQuote,this.completedTransactionsCount=0,this.unsubscribe.push(ot.subscribeKey("paymentAsset",t=>this.paymentAsset=t)),this.unsubscribe.push(ot.subscribeKey("tokenBalances",t=>this.onTokenBalancesChanged(t))),this.unsubscribe.push(ot.subscribeKey("isFetchingTokenBalances",t=>this.isFetchingTokenBalances=t)),this.unsubscribe.push(Ve.subscribeKey("activeConnectorIds",t=>this.activeConnectorIds=t)),this.unsubscribe.push(ot.subscribeKey("selectedPaymentAsset",t=>this.selectedPaymentAsset=t)),this.unsubscribe.push(ot.subscribeKey("isFetchingQuote",t=>this.isFetchingQuote=t)),this.unsubscribe.push(ot.subscribeKey("quoteError",t=>this.quoteError=t)),this.unsubscribe.push(ot.subscribeKey("quote",t=>this.quote=t)),this.unsubscribe.push(ot.subscribeKey("amount",t=>this.amount=t)),this.unsubscribe.push(ot.subscribeKey("recipient",t=>this.recipient=t)),this.unsubscribe.push(ot.subscribeKey("isPaymentInProgress",t=>this.isPaymentInProgress=t)),this.unsubscribe.push(ot.subscribeKey("selectedExchange",t=>this.selectedExchange=t)),this.unsubscribe.push(ot.subscribeKey("exchangeUrlForQuote",t=>this.exchangeUrlForQuote=t)),this.resetQuoteState(),this.initializeNamespace(),this.fetchTokens()}disconnectedCallback(){super.disconnectedCallback(),this.resetAssetsState(),this.unsubscribe.forEach(t=>t())}updated(t){super.updated(t),t.has("selectedPaymentAsset")&&this.fetchQuote()}render(){return j` 6924 <wui-flex flexDirection="column"> 6925 ${this.profileTemplate()} 6926 6927 <wui-flex 6928 flexDirection="column" 6929 gap="4" 6930 class="payment-methods-container" 6931 .padding=${["4","4","5","4"]} 6932 > 6933 ${this.paymentOptionsViewTemplate()} ${this.amountWithFeeTemplate()} 6934 6935 <wui-flex 6936 alignItems="center" 6937 justifyContent="space-between" 6938 .padding=${["1","0","1","0"]} 6939 > 6940 <wui-separator></wui-separator> 6941 </wui-flex> 6942 6943 ${this.paymentActionsTemplate()} 6944 </wui-flex> 6945 </wui-flex> 6946 `}profileTemplate(){var o,a;if(this.selectedExchange){const c=Io.formatNumber((o=this.quote)==null?void 0:o.origin.amount,{decimals:((a=this.quote)==null?void 0:a.origin.currency.metadata.decimals)??0}).toString();return j` 6947 <wui-flex 6948 .padding=${["4","3","4","3"]} 6949 alignItems="center" 6950 justifyContent="space-between" 6951 gap="2" 6952 > 6953 <wui-text variant="lg-regular" color="secondary">Paying with</wui-text> 6954 6955 ${this.quote?j`<wui-text variant="lg-regular" color="primary"> 6956 ${Io.bigNumber(c,{safe:!0}).round(6).toString()} 6957 ${this.quote.origin.currency.metadata.symbol} 6958 </wui-text>`:j`<wui-shimmer width="80px" height="18px" variant="light"></wui-shimmer>`} 6959 </wui-flex> 6960 `}const t=ht.getPlainAddress(this.caipAddress)??"",{name:n,image:r}=this.getWalletProperties({namespace:this.namespace}),{icon:s,label:i}=fLt[this.namespace]??{};return j` 6961 <wui-flex 6962 .padding=${["4","3","4","3"]} 6963 alignItems="center" 6964 justifyContent="space-between" 6965 gap="2" 6966 > 6967 <wui-wallet-switch 6968 profileName=${ge(this.profileName)} 6969 address=${ge(t)} 6970 imageSrc=${ge(r)} 6971 alt=${ge(n)} 6972 @click=${this.onConnectOtherWallet.bind(this)} 6973 data-testid="wui-wallet-switch" 6974 ></wui-wallet-switch> 6975 6976 <wui-wallet-switch 6977 profileName=${ge(i)} 6978 address=${ge(t)} 6979 icon=${ge(s)} 6980 iconSize="xs" 6981 .enableGreenCircle=${!1} 6982 alt=${ge(i)} 6983 @click=${this.onConnectOtherWallet.bind(this)} 6984 data-testid="wui-wallet-switch" 6985 ></wui-wallet-switch> 6986 </wui-flex> 6987 `}initializeNamespace(){var n,r;const t=re.state.activeChain;this.namespace=t,this.caipAddress=(n=re.getAccountData(t))==null?void 0:n.caipAddress,this.profileName=((r=re.getAccountData(t))==null?void 0:r.profileName)??null,this.unsubscribe.push(re.subscribeChainProp("accountState",s=>this.onAccountStateChanged(s),t))}async fetchTokens(){if(this.namespace){let t;if(this.caipAddress){const{chainId:n,chainNamespace:r}=mr.parseCaipAddress(this.caipAddress),s=`${r}:${n}`;t=re.getAllRequestedCaipNetworks().find(o=>o.caipNetworkId===s)}await ot.fetchTokens({caipAddress:this.caipAddress,caipNetwork:t,namespace:this.namespace})}}fetchQuote(){if(this.amount&&this.recipient&&this.selectedPaymentAsset&&this.paymentAsset){const{address:t}=this.caipAddress?mr.parseCaipAddress(this.caipAddress):{};ot.fetchQuote({amount:this.amount.toString(),address:t,sourceToken:this.selectedPaymentAsset,toToken:this.paymentAsset,recipient:this.recipient})}}getWalletProperties({namespace:t}){if(!t)return{name:void 0,image:void 0};const n=this.activeConnectorIds[t];if(!n)return{name:void 0,image:void 0};const r=Ve.getConnector({id:n,namespace:t});if(!r)return{name:void 0,image:void 0};const s=ll.getConnectorImage(r);return{name:r.name,image:s}}paymentOptionsViewTemplate(){return j` 6988 <wui-flex flexDirection="column" gap="2"> 6989 <wui-text variant="sm-regular" color="secondary">CHOOSE PAYMENT OPTION</wui-text> 6990 <wui-flex class="pay-options-container">${this.paymentOptionsTemplate()}</wui-flex> 6991 </wui-flex> 6992 `}paymentOptionsTemplate(){const t=this.getPaymentAssetFromTokenBalances();if(this.isFetchingTokenBalances)return j`<w3m-pay-options-skeleton></w3m-pay-options-skeleton>`;if(t.length===0)return j`<w3m-pay-options-empty 6993 @connectOtherWallet=${this.onConnectOtherWallet.bind(this)} 6994 ></w3m-pay-options-empty>`;const n={disabled:this.isFetchingQuote};return j`<w3m-pay-options 6995 class=${Y6(n)} 6996 .options=${t} 6997 .selectedPaymentAsset=${ge(this.selectedPaymentAsset)} 6998 .onSelect=${this.onSelectedPaymentAssetChanged.bind(this)} 6999 ></w3m-pay-options>`}amountWithFeeTemplate(){return this.isFetchingQuote||!this.selectedPaymentAsset||this.quoteError?j`<w3m-pay-fees-skeleton></w3m-pay-fees-skeleton>`:j`<w3m-pay-fees></w3m-pay-fees>`}paymentActionsTemplate(){var s,i,o;const t=this.isFetchingQuote||this.isFetchingTokenBalances,n=this.isFetchingQuote||this.isFetchingTokenBalances||!this.selectedPaymentAsset||!!this.quoteError,r=Io.formatNumber(((s=this.quote)==null?void 0:s.origin.amount)??0,{decimals:((i=this.quote)==null?void 0:i.origin.currency.metadata.decimals)??0}).toString();return this.selectedExchange?t||n?j` 7000 <wui-shimmer width="100%" height="48px" variant="light" ?rounded=${!0}></wui-shimmer> 7001 `:j`<wui-button 7002 size="lg" 7003 fullWidth 7004 variant="accent-secondary" 7005 @click=${this.onPayWithExchange.bind(this)} 7006 > 7007 ${`Continue in ${this.selectedExchange.name}`} 7008 7009 <wui-icon name="arrowRight" color="inherit" size="sm" slot="iconRight"></wui-icon> 7010 </wui-button>
7010`:j` 7011 <wui-flex alignItems="center" justifyContent="space-between"> 7012 <wui-flex flexDirection="column" gap="1"> 7013 <wui-text variant="md-regular" color="secondary">Order Total</wui-text> 7014 7015 ${t||n?j`<wui-shimmer width="58px" height="32px" variant="light"></wui-shimmer>`:j`<wui-flex alignItems="center" gap="01"> 7016 <wui-text variant="h4-regular" color="primary">${gN(r)}</wui-text> 7017 7018 <wui-text variant="lg-regular" color="secondary"> 7019 ${((o=this.quote)==null?void 0:o.origin.currency.metadata.symbol)||"Unknown"} 7020 </wui-text> 7021 </wui-flex>`} 7022 </wui-flex> 7023 7024 ${this.actionButtonTemplate({isLoading:t,isDisabled:n})} 7025 </wui-flex> 7026 `}actionButtonTemplate(t){const n=pU(this.quote),{isLoading:r,isDisabled:s}=t;let i="Pay";return n.length>1&&this.completedTransactionsCount===0&&(i="Approve"),j` 7027 <wui-button 7028 size="lg" 7029 variant="accent-primary" 7030 ?loading=${r||this.isPaymentInProgress} 7031 ?disabled=${s||this.isPaymentInProgress} 7032 @click=${()=>{n.length>0?this.onSendTransactions():this.onTransfer()}} 7033 > 7034 ${i} 7035 ${r?null:j`<wui-icon 7036 name="arrowRight" 7037 color="inherit" 7038 size="sm" 7039 slot="iconRight" 7040 ></wui-icon>`} 7041 </wui-button> 7042 `}getPaymentAssetFromTokenBalances(){return this.namespace?(this.tokenBalances[this.namespace]??[]).map(s=>{try{return FUt(s)}catch{return null}}).filter(s=>!!s).filter(s=>{const{chainId:i}=mr.parseCaipNetworkId(s.network),{chainId:o}=mr.parseCaipNetworkId(this.paymentAsset.network);return gu.isLowerCaseMatch(s.asset,this.paymentAsset.asset)?!0:this.selectedExchange?!gu.isLowerCaseMatch(i.toString(),o.toString()):!0}):[]}onTokenBalancesChanged(t){this.tokenBalances=t;const[n]=this.getPaymentAssetFromTokenBalances();n&&ot.setSelectedPaymentAsset(n)}async onConnectOtherWallet(){await Ve.connect(),await pr.open({view:"PayQuote"})}onAccountStateChanged(t){const{address:n}=this.caipAddress?mr.parseCaipAddress(this.caipAddress):{};if(this.caipAddress=t==null?void 0:t.caipAddress,this.profileName=(t==null?void 0:t.profileName)??null,n){const{address:r}=this.caipAddress?mr.parseCaipAddress(this.caipAddress):{};r?gu.isLowerCaseMatch(r,n)||(this.resetAssetsState(),this.resetQuoteState(),this.fetchTokens()):pr.close()}}onSelectedPaymentAssetChanged(t){this.isFetchingQuote||ot.setSelectedPaymentAsset(t)}async onTransfer(){var n,r,s;const t=nq(this.quote);if(t){if(!gu.isLowerCaseMatch((n=this.selectedPaymentAsset)==null?void 0:n.asset,t.deposit.currency))throw new Error("Quote asset is not the same as the selected payment asset");const o=((r=this.selectedPaymentAsset)==null?void 0:r.amount)??"0",a=Io.formatNumber(t.deposit.amount,{decimals:((s=this.selectedPaymentAsset)==null?void 0:s.metadata.decimals)??0}).toString();if(!Io.bigNumber(o).gte(a)){nl.showError("Insufficient funds");return}if(this.quote&&this.selectedPaymentAsset&&this.caipAddress&&this.namespace){const{address:l}=mr.parseCaipAddress(this.caipAddress);await ot.onTransfer({chainNamespace:this.namespace,fromAddress:l,toAddress:t.deposit.receiver,amount:a,paymentAsset:this.selectedPaymentAsset}),ot.setRequestId(t.requestId),Kt.push("PayLoading")}}}async onSendTransactions(){var o,a,c;const t=((o=this.selectedPaymentAsset)==null?void 0:o.amount)??"0",n=Io.formatNumber(((a=this.quote)==null?void 0:a.origin.amount)??0,{decimals:((c=this.selectedPaymentAsset)==null?void 0:c.metadata.decimals)??0}).toString();if(!Io.bigNumber(t).gte(n)){nl.showError("Insufficient funds");return}const s=pU(this.quote),[i]=pU(this.quote,this.completedTransactionsCount);i&&this.namespace&&(await ot.onSendTransaction({namespace:this.namespace,transactionStep:i}),this.completedTransactionsCount+=1,this.completedTransactionsCount===s.length&&(ot.setRequestId(i.requestId),Kt.push("PayLoading")))}onPayWithExchange(){if(this.exchangeUrlForQuote){const t=ht.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!t)throw new Error("Could not create popup window");t.location.href=this.exchangeUrlForQuote;const n=nq(this.quote);n&&ot.setRequestId(n.requestId),ot.initiatePayment(),Kt.push("PayLoading")}}resetAssetsState(){ot.setSelectedPaymentAsset(null)}resetQuoteState(){ot.resetQuoteState()}};Us.styles=hLt;Oi([se()],Us.prototype,"profileName",void 0);Oi([se()],Us.prototype,"paymentAsset",void 0);Oi([se()],Us.prototype,"namespace",void 0);Oi([se()],Us.prototype,"caipAddress",void 0);Oi([se()],Us.prototype,"amount",void 0);Oi([se()],Us.prototype,"recipient",void 0);Oi([se()],Us.prototype,"activeConnectorIds",void 0);Oi([se()],Us.prototype,"selectedPaymentAsset",void 0);Oi([se()],Us.prototype,"selectedExchange",void 0);Oi([se()],Us.prototype,"isFetchingQuote",void 0);Oi([se()],Us.prototype,"quoteError",void 0);Oi([se()],Us.prototype,"quote",void 0);Oi([se()],Us.prototype,"isFetchingTokenBalances",void 0);Oi([se()],Us.prototype,"tokenBalances",void 0);Oi([se()],Us.prototype,"isPaymentInProgress",void 0);Oi([se()],Us.prototype,"exchangeUrlForQuote",void 0);Oi([se()],Us.prototype,"completedTransactionsCount",void 0);Us=Oi([ns("w3m-pay-quote-view")],Us);const pLt=Gt` 7043 wui-image { 7044 border-radius: ${({borderRadius:e})=>e.round}; 7045 } 7046 7047 .transfers-badge { 7048 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 7049 border: 1px solid ${({tokens:e})=>e.theme.foregroundSecondary}; 7050 border-radius: ${({borderRadius:e})=>e[4]}; 7051 } 7052`;var ZG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let nC=class extends ce{constructor(){super(),this.unsubscribe=[],this.paymentAsset=ot.state.paymentAsset,this.amount=ot.state.amount,this.unsubscribe.push(ot.subscribeKey("paymentAsset",t=>{this.paymentAsset=t}),ot.subscribeKey("amount",t=>{this.amount=t}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const n=Q.getAllRequestedCaipNetworks().find(r=>r.caipNetworkId===this.paymentAsset.network);return j`<wui-flex 7053 alignItems="center" 7054 gap="1" 7055 .padding=${["1","2","1","1"]} 7056 class="transfers-badge" 7057 > 7058 <wui-image src=${ge(this.paymentAsset.metadata.logoURI)} size="xl"></wui-image> 7059 <wui-text variant="lg-regular" color="primary"> 7060 ${this.amount} ${this.paymentAsset.metadata.symbol} 7061 </wui-text> 7062 <wui-text variant="sm-regular" color="secondary"> 7063 on ${(n==null?void 0:n.name)??"Unknown"} 7064 </wui-text> 7065 </wui-flex>`}};nC.styles=[pLt];ZG([z()],nC.prototype,"paymentAsset",void 0);ZG([z()],nC.prototype,"amount",void 0);nC=ZG([pt("w3m-pay-header")],nC);const gLt=Gt` 7066 :host { 7067 height: 60px; 7068 } 7069 7070 :host > wui-flex { 7071 box-sizing: border-box; 7072 background-color: var(--local-header-background-color); 7073 } 7074 7075 wui-text { 7076 background-color: var(--local-header-background-color); 7077 } 7078 7079 wui-flex.w3m-header-title { 7080 transform: translateY(0); 7081 opacity: 1; 7082 } 7083 7084 wui-flex.w3m-header-title[view-direction='prev'] { 7085 animation: 7086 slide-down-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}, 7087 slide-down-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}; 7088 animation-delay: 0ms, 200ms; 7089 } 7090 7091 wui-flex.w3m-header-title[view-direction='next'] { 7092 animation: 7093 slide-up-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}, 7094 slide-up-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}; 7095 animation-delay: 0ms, 200ms; 7096 } 7097 7098 wui-icon-button[data-hidden='true'] { 7099 opacity: 0 !important; 7100 pointer-events: none; 7101 } 7102 7103 @keyframes slide-up-out { 7104 from { 7105 transform: translateY(0px); 7106 opacity: 1; 7107 } 7108 to { 7109 transform: translateY(3px); 7110 opacity: 0; 7111 } 7112 } 7113 7114 @keyframes slide-up-in { 7115 from { 7116 transform: translateY(-3px); 7117 opacity: 0; 7118 } 7119 to { 7120 transform: translateY(0); 7121 opacity: 1; 7122 } 7123 } 7124 7125 @keyframes slide-down-out { 7126 from { 7127 transform: translateY(0px); 7128 opacity: 1; 7129 } 7130 to { 7131 transform: translateY(-3px); 7132 opacity: 0; 7133 } 7134 } 7135 7136 @keyframes slide-down-in { 7137 from { 7138 transform: translateY(3px); 7139 opacity: 0; 7140 } 7141 to { 7142 transform: translateY(0); 7143 opacity: 1; 7144 } 7145 } 7146`;var C1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const mLt=["SmartSessionList"],wLt={PayWithExchange:gr.tokens.theme.foregroundPrimary};function ele(){var c,l,u,d,h,f,g,p;const e=(l=(c=fe.state.data)==null?void 0:c.connector)==null?void 0:l.name,t=(d=(u=fe.state.data)==null?void 0:u.wallet)==null?void 0:d.name,n=(f=(h=fe.state.data)==null?void 0:h.network)==null?void 0:f.name,r=t??e,s=qe.getConnectors(),i=s.length===1&&((g=s[0])==null?void 0:g.id)==="w3m-email",o=(p=Q.getAccountData())==null?void 0:p.socialProvider,a=o?o.charAt(0).toUpperCase()+o.slice(1):"Connect Social";return{Connect:`Connect ${i?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",UsageExceeded:"Usage Exceeded",ConnectingExter
7146nal:r??"Connect Wallet",ConnectingWalletConnect:r??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview Convert",Downloads:r?`Get ${r}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a Wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",ProfileWallets:"Wallets",SwitchNetwork:n??"Switch Network",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade Your Wallet",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",WalletSendConfirmed:"Confirmed",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a Wallet?",ConnectWallets:"Connect Wallet",ConnectSocials:"All Socials",ConnectingSocial:a,ConnectingMultiChain:"Select Chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch Chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Processing payment...",PayQuote:"Payment Quote",DataCapture:"Profile",DataCaptureOtpConfirm:"Confirm Email",FundWallet:"Fund Wallet",PayWithExchange:"Deposit from Exchange",PayWithExchangeSelectAsset:"Select Asset",SmartAccountSettings:"Smart Account Settings"}}let pf=class extends ce{constructor(){super(),this.unsubscribe=[],this.heading=ele()[fe.state.view],this.network=Q.state.activeCaipNetwork,this.networkImage=wc.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=fe.state.view,this.viewDirection="",this.unsubscribe.push(Ho.subscribeNetworkImages(()=>{this.networkImage=wc.getNetworkImage(this.network)}),fe.subscribeKey("view",t=>{setTimeout(()=>{this.view=t,this.heading=ele()[t]},xw.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),Q.subscribeKey("activeCaipNetwork",t=>{this.network=t,this.networkImage=wc.getNetworkImage(this.network)}))}disconnectCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=wLt[fe.state.view]??gr.tokens.theme.backgroundPrimary;return this.style.setProperty("--local-header-background-color",t),j` 7147 <wui-flex 7148 .padding=${["0","4","0","4"]} 7149 justifyContent="space-between" 7150 alignItems="center" 7151 > 7152 ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()} 7153 </wui-flex> 7154 `}onWalletHelp(){It.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),fe.push("WhatIsAWallet")}async onClose(){await NEe.safeClose()}rightHeaderTemplate(){var n,r;const t=(r=(n=ke==null?void 0:ke.state)==null?void 0:n.features)==null?void 0:r.smartSessions;return fe.state.view!=="Account"||!t?this.closeButtonTemplate():j`<wui-flex> 7155 <wui-icon-button 7156 icon="clock" 7157 size="lg" 7158 iconSize="lg" 7159 type="neutral" 7160 variant="primary" 7161 @click=${()=>fe.push("SmartSessionList")} 7162 data-testid="w3m-header-smart-sessions" 7163 ></wui-icon-button> 7164 ${this.closeButtonTemplate()} 7165 </wui-flex> `}closeButtonTemplate(){return j` 7166 <wui-icon-button 7167 icon="close" 7168 size="lg" 7169 type="neutral" 7170 variant="primary" 7171 iconSize="lg" 7172 @click=${this.onClose.bind(this)} 7173 data-testid="w3m-header-close" 7174 ></wui-icon-button> 7175 `}titleTemplate(){if(this.view==="PayQuote")return j`<w3m-pay-header></w3m-pay-header>`;const t=mLt.includes(this.view);return j` 7176 <wui-flex 7177 view-direction="${this.viewDirection}" 7178 class="w3m-header-title" 7179 alignItems="center" 7180 gap="2" 7181 > 7182 <wui-text 7183 display="inline" 7184 variant="lg-regular" 7185 color="primary" 7186 data-testid="w3m-header-text" 7187 > 7188 ${this.heading} 7189 </wui-text> 7190 ${t?j`<wui-tag variant="accent" size="md">Beta</wui-tag>`:null} 7191 </wui-flex> 7192 `}leftHeaderTemplate(){var l;const{view:t}=fe.state,n=t==="Connect",r=ke.state.enableEmbedded,s=t==="ApproveTransaction",i=t==="ConnectingSiwe",o=t==="Account",a=ke.state.enableNetworkSwitch,c=s||i||n&&r;return o&&a?j`<wui-select 7193 id="dynamic" 7194 data-testid="w3m-account-select-network" 7195 active-network=${ge((l=this.network)==null?void 0:l.name)} 7196 @click=${this.onNetworks.bind(this)} 7197 imageSrc=${ge(this.networkImage)} 7198 ></wui-select>`:this.showBack&&!c?j`<wui-icon-button 7199 data-testid="header-back" 7200 id="dynamic" 7201 icon="chevronLeft" 7202 size="lg" 7203 iconSize="lg" 7204 type="neutral" 7205 variant="primary" 7206 @click=${this.onGoBack.bind(this)} 7207 ></wui-icon-button>`:j`<wui-icon-button 7208 data-hidden=${!n} 7209 id="dynamic" 7210 icon="helpCircle" 7211 size="lg" 7212 iconSize="lg" 7213 type="neutral" 7214 variant="primary" 7215 @click=${this.onWalletHelp.bind(this)} 7216 ></wui-icon-button>`}onNetworks(){this.isAllowedNetworkSwitch()&&(It.sendEvent({type:"track",event:"CLICK_NETWORKS"}),fe.push("Networks"))}isAllowedNetworkSwitch(){const t=Q.getAllRequestedCaipNetworks(),n=t?t.length>1:!1,r=t==null?void 0:t.find(({id:s})=>{var i;return s===((i=this.network)==null?void 0:i.id)});return n||!r}onViewChange(){const{history:t}=fe.state;let n=xw.VIEW_DIRECTION.Next;t.length<this.prevHistoryLength&&(n=xw.VIEW_DIRECTION.Prev),this.prevHistoryLength=t.length,this.viewDirection=n}async onHistoryChange(){var r;const{history:t}=fe.state,n=(r=this.shadowRoot)==null?void 0:r.querySelector("#dynamic");t.length>1&&!this.showBack&&n?(await n.animate([{opacity:1},{opacity:0}
vendor: 7,677 bytes, lines 7216-7350
7216],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):t.length<=1&&this.showBack&&n&&(await n.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){fe.goBack()}};pf.styles=gLt;C1([se()],pf.prototype,"heading",void 0);C1([se()],pf.prototype,"network",void 0);C1([se()],pf.prototype,"networkImage",void 0);C1([se()],pf.prototype,"showBack",void 0);C1([se()],pf.prototype,"prevHistoryLength",void 0);C1([se()],pf.prototype,"view",void 0);C1([se()],pf.prototype,"viewDirection",void 0);pf=C1([pt("w3m-header")],pf);const yLt=Gt` 7217 :host { 7218 display: flex; 7219 align-items: center; 7220 gap: ${({spacing:e})=>e[1]}; 7221 padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]} 7222 ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]}; 7223 border-radius: ${({borderRadius:e})=>e[20]}; 7224 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 7225 box-shadow: 7226 0px 0px 8px 0px rgba(0, 0, 0, 0.1), 7227 inset 0 0 0 1px ${({tokens:e})=>e.theme.borderPrimary}; 7228 max-width: 320px; 7229 } 7230 7231 wui-icon-box { 7232 border-radius: ${({borderRadius:e})=>e.round} !important; 7233 overflow: hidden; 7234 } 7235 7236 wui-loading-spinner { 7237 padding: ${({spacing:e})=>e[1]}; 7238 background-color: ${({tokens:e})=>e.core.foregroundAccent010}; 7239 border-radius: ${({borderRadius:e})=>e.round} !important; 7240 } 7241`;var YG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let rC=class extends ce{constructor(){super(...arguments),this.message="",this.variant="success"}render(){return j` 7242 ${this.templateIcon()} 7243 <wui-text variant="lg-regular" color="primary" data-testid="wui-snackbar-message" 7244 >${this.message}</wui-text 7245 > 7246 `}templateIcon(){const t={success:"success",error:"error",warning:"warning",info:"default"},n={success:"checkmark",error:"warning",warning:"warningCircle",info:"info"};return this.variant==="loading"?j`<wui-loading-spinner size="md" color="accent-primary"></wui-loading-spinner>`:j`<wui-icon-box 7247 size="md" 7248 color=${t[this.variant]} 7249 icon=${n[this.variant]} 7250 ></wui-icon-box>`}};rC.styles=[ar,yLt];YG([z()],rC.prototype,"message",void 0);YG([z()],rC.prototype,"variant",void 0);rC=YG([pt("wui-snackbar")],rC);const bLt=Xe` 7251 :host { 7252 display: block; 7253 position: absolute; 7254 opacity: 0; 7255 pointer-events: none; 7256 top: 11px; 7257 left: 50%; 7258 width: max-content; 7259 } 7260`;var t$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let yN=class extends ce{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=Xn.state.open,this.unsubscribe.push(Xn.subscribeKey("open",t=>{this.open=t,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:n}=Xn.state;return j` <wui-snackbar message=${t} variant=${n}></wui-snackbar> `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),Xn.state.autoClose&&(this.timeout=setTimeout(()=>Xn.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"})}};yN.styles=bLt;t$e([se()],yN.prototype,"open",void 0);yN=t$e([pt("w3m-snackbar")],yN);const vLt=Xe` 7261 :host { 7262 width: 100%; 7263 display: block; 7264 } 7265`;var JG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let sC=class extends ce{constructor(){super(),this.unsubscribe=[],this.text="",this.open=hu.state.open,this.unsubscribe.push(fe.subscribeKey("view",()=>{hu.hide()}),Zt.subscribeKey("open",t=>{t||hu.hide()}),hu.subscribeKey("open",t=>{this.open=t}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),hu.hide()}render(){return j` 7266 <div 7267 @pointermove=${this.onMouseEnter.bind(this)} 7268 @pointerleave=${this.onMouseLeave.bind(this)} 7269 > 7270 ${this.renderChildren()} 7271 </div> 7272 `}renderChildren(){return j`<slot></slot> `}onMouseEnter(){const t=this.getBoundingClientRect();if(!this.open){const n=document.querySelector("w3m-modal"),r={width:t.width,height:t.height,left:t.left,top:t.top};if(n){const s=n.getBoundingClientRect();r.left=t.left-(window.innerWidth-s.width)/2,r.top=t.top-(window.innerHeight-s.height)/2}hu.showTooltip({message:this.text,triggerRect:r,variant:"shade"})}}onMouseLeave(t){this.contains(t.relatedTarget)||hu.hide()}};sC.styles=[vLt];JG([z()],sC.prototype,"text",void 0);JG([se()],sC.prototype,"open",void 0);sC=JG([pt("w3m-tooltip-trigger")],sC);const ELt=Gt` 7273 :host { 7274 pointer-events: none; 7275 } 7276 7277 :host > wui-flex { 7278 display: var(--w3m-tooltip-display); 7279 opacity: var(--w3m-tooltip-opacity); 7280 padding: 9px ${({spacing:e})=>e[3]} 10px ${({spacing:e})=>e[3]}; 7281 border-radius: ${({borderRadius:e})=>e[3]}; 7282 color: ${({tokens:e})=>e.theme.backgroundPrimary}; 7283 position: absolute; 7284 top: var(--w3m-tooltip-top); 7285 left: var(--w3m-tooltip-left); 7286 transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px)); 7287 max-width: calc(var(--apkt-modal-width) - ${({spacing:e})=>e[5]}); 7288 transition: opacity ${({durations:e})=>e.lg} 7289 ${({easings:e})=>e["ease-out-power-2"]}; 7290 will-change: opacity; 7291 opacity: 0; 7292 animation-duration: ${({durations:e})=>e.xl}; 7293 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 7294 animation-name: fade-in; 7295 animation-fill-mode: forwards; 7296 } 7297 7298 :host([data-variant='shade']) > wui-flex { 7299 background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; 7300 } 7301 7302 :host([data-variant='shade']) > wui-flex > wui-text { 7303 color: ${({tokens:e})=>e.theme.textSecondary}; 7304 } 7305 7306 :host([data-variant='fill']) > wui-flex { 7307 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 7308 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 7309 } 7310 7311 wui-icon { 7312 position: absolute; 7313 width: 12px !important; 7314 height: 4px !important; 7315 color: ${({tokens:e})=>e.theme.foregroundPrimary}; 7316 } 7317 7318 wui-icon[data-placement='top'] { 7319 bottom: 0px; 7320 left: 50%; 7321 transform: translate(-50%, 95%); 7322 } 7323 7324 wui-icon[data-placement='bottom'] { 7325 top: 0; 7326 left: 50%; 7327 transform: translate(-50%, -95%) rotate(180deg); 7328 } 7329 7330 wui-icon[data-placement='right'] { 7331 top: 50%; 7332 left: 0; 7333 transform: translate(-65%, -50%) rotate(90deg); 7334 } 7335 7336 wui-icon[data-placement='left'] { 7337 top: 50%; 7338 right: 0%; 7339 transform: translate(65%, -50%) rotate(270deg); 7340 } 7341 7342 @keyframes fade-in { 7343 from { 7344 opacity: 0; 7345 } 7346 to { 7347 opacity: 1; 7348 } 7349 } 7350`;
7350var ix=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Hy=class extends ce{constructor(){super(),this.unsubscribe=[],this.open=hu.state.open,this.message=hu.state.message,this.triggerRect=hu.state.triggerRect,this.variant=hu.state.variant,this.unsubscribe.push(hu.subscribe(t=>{this.open=t.open,this.message=t.message,this.triggerRect=t.triggerRect,this.variant=t.variant}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){this.dataset.variant=this.variant;const t=this.triggerRect.top,n=this.triggerRect.left;return this.style.cssText=` 7351 --w3m-tooltip-top: ${t}px; 7352 --w3m-tooltip-left: ${n}px; 7353 --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px; 7354 --w3m-tooltip-display: ${this.open?"flex":"none"}; 7355 --w3m-tooltip-opacity: ${this.open?1:0}; 7356 `,j`<wui-flex> 7357 <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon> 7358 <wui-text color="primary" variant="sm-regular">${this.message}</wui-text> 7359 </wui-flex>`}};Hy.styles=[ELt];ix([se()],Hy.prototype,"open",void 0);ix([se()],Hy.prototype,"message",void 0);ix([se()],Hy.prototype,"triggerRect",void 0);ix([se()],Hy.prototype,"variant",void 0);Hy=ix([pt("w3m-tooltip")],Hy);const N8={getTabsByNamespace(e){var n;return!!e&&e===ye.CHAIN.EVM?((n=ke.state.remoteFeatures)==null?void 0:n.activity)===!1?xw.ACCOUNT_TABS.filter(r=>r.label!=="Activity"):xw.ACCOUNT_TABS:[]},isValidReownName(e){return/^[a-zA-Z0-9]+$/gu.test(e)},isValidEmail(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/gu.test(e)},validateReownName(e){return e.replace(/\^/gu,"").toLowerCase().replace(/[^a-zA-Z0-9]/gu,"")},hasFooter(){var t;const e=fe.state.view;if(xw.VIEWS_WITH_LEGAL_FOOTER.includes(e)){const{termsConditionsUrl:n,privacyPolicyUrl:r}=ke.state,s=(t=ke.state.features)==null?void 0:t.legalCheckbox;return!(!n&&!r||s)}return xw.VIEWS_WITH_DEFAULT_FOOTER.includes(e)}},CLt=Gt` 7360 :host wui-ux-by-reown { 7361 padding-top: 0; 7362 } 7363 7364 :host wui-ux-by-reown.branding-only { 7365 padding-top: ${({spacing:e})=>e[3]}; 7366 } 7367 7368 a { 7369 text-decoration: none; 7370 color: ${({tokens:e})=>e.core.textAccentPrimary}; 7371 font-weight: 500; 7372 } 7373`;var n$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let bN=class extends ce{constructor(){super(),this.unsubscribe=[],this.remoteFeatures=ke.state.remoteFeatures,this.unsubscribe.push(ke.subscribeKey("remoteFeatures",t=>this.remoteFeatures=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){var i;const{termsConditionsUrl:t,privacyPolicyUrl:n}=ke.state,r=(i=ke.state.features)==null?void 0:i.legalCheckbox;return!t&&!n||r?j` 7374 <wui-flex flexDirection="column"> ${this.reownBrandingTemplate(!0)} </wui-flex> 7375 `:j` 7376 <wui-flex flexDirection="column"> 7377 <wui-flex .padding=${["4","3","3","3"]} justifyContent="center"> 7378 <wui-text color="secondary" variant="md-regular" align="center"> 7379 By connecting your wallet, you agree to our <br /> 7380 ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()} 7381 </wui-text> 7382 </wui-flex> 7383 ${this.reownBrandingTemplate()} 7384 </wui-flex> 7385 `}andTemplate(){const{termsConditionsUrl:t,privacyPolicyUrl:n}=ke.state;return t&&n?"and":""}termsTemplate(){const{termsConditionsUrl:t}=ke.state;return t?j`<a href=${t} target="_blank" rel="noopener noreferrer" 7386 >Terms of Service</a 7387 >`:null}privacyTemplate(){const{privacyPolicyUrl:t}=ke.state;return t?j`<a href=${t} target="_blank" rel="noopener noreferrer" 7388 >Privacy Policy</a 7389 >`:null}reownBrandingTemplate(t=!1){var n;return(n=this.remoteFeatures)!=null&&n.reownBranding?t?j`<wui-ux-by-reown class="branding-only"></wui-ux-by-reown>`:j`<wui-ux-by-reown></wui-ux-by-reown>`:null}};bN.styles=[CLt];n$e([se()],bN.prototype,"remoteFeatures",void 0);bN=n$e([pt("w3m-legal-footer")],bN);const $Lt=Xe``;var xLt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let oq=class extends ce{render(){const{termsConditionsUrl:t,privacyPolicyUrl:n}=ke.state;return!t&&!n?null:j` 7390 <wui-flex 7391 .padding=${["4","3","3","3"]} 7392 flexDirection="column" 7393 alignItems="center" 7394 justifyContent="center" 7395 gap="3" 7396 > 7397 <wui-text color="secondary" variant="md-regular" align="center"> 7398 We work with the best providers to give you the lowest fees and best support. More options 7399 coming soon! 7400 </wui-text> 7401 7402 ${this.howDoesItWorkTemplate()} 7403 </wui-flex> 7404 `}howDoesItWorkTemplate(){return j` <wui-link @click=${this.onWhatIsBuy.bind(this)}> 7405 <wui-icon size="xs" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon> 7406 How does it work? 7407 </wui-link>`}onWhatIsBuy(){It.sendEvent({type:"track",event:"SELECT_WHAT_IS_A_BUY",properties:{isSmartAccount:cl(Q.state.activeChain)===sl.ACCOUNT_TYPES.SMART_ACCOUNT}}),fe.push("WhatIsABuy")}};oq.styles=[$Lt];oq=xLt([pt("w3m-onramp-providers-footer")],oq);const ILt=Gt` 7408 :host { 7409 display: block; 7410 } 7411 7412 div.container { 7413 position: absolute; 7414 bottom: 0; 7415 left: 0; 7416 right: 0; 7417 overflow: hidden; 7418 height: auto; 7419 display: block; 7420 } 7421 7422 div.container[status='hide'] { 7423 animation: fade-out; 7424 animation-duration: var(--apkt-duration-dynamic); 7425 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 7426 animation-fill-mode: both; 7427 animation-delay: 0s; 7428 } 7429 7430 div.container[status='show'] { 7431 animation: fade-in; 7432 animation-duration: var(--apkt-duration-dynamic); 7433 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 7434 animation-fill-mode: both; 7435 animation-delay: var(--apkt-duration-dynamic); 7436 } 7437 7438 @keyframes fade-in { 7439 from { 7440 opacity: 0; 7441 filter: blur(6px); 7442 } 7443 to { 7444 opacity: 1; 7445 filter: blur(0px); 7446 } 7447 } 7448 7449 @keyframes fade-out { 7450 from { 7451 opacity: 1; 7452 filter: blur(0px); 7453 } 7454 to { 7455 opacity: 0; 7456 filter: blur(6px); 7457 } 7458 } 7459`;var XG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let iC=class extends ce{constructor(){super(...arguments),this.resizeObserver=void 0,this.unsubscribe=[],this.status="hide",this.view=fe.state.view}firstUpdated(){this.status=N8.hasFooter()?"show":"hide",this.unsubscribe.push(fe.subscribeKey("view",t=>{this.view=t,this.status=N8.hasFooter()?"show":"hide",this.status==="hide"&&document.documentElement.style.setProperty("--apkt-footer-height","0px")})),this.resizeObserver=new ResizeObserver(t=>{for(const n of t)if(n.target===this.getWrapper()){const r=`${n.contentRect.height}px`;document.documentElement.style.setProperty("--apkt-footer-height",r)}}),this.resizeObserver.observe(this.getWrapper())}render(){return j` 7460 <div class="container" status=${this.status}>${this.templatePageContainer()}</div> 7461 `}templatePageContainer(){return N8.hasFooter()?j` ${this.templateFooter()}`:null}templateFooter(){switch(this.view){case"Networks":return this.templateNetworksFooter();case"Connect":case"ConnectWallets":case"OnRampFiatSelect":case"OnRampTokenSelect":return j`<w3m-legal-footer></w3m-legal-footer>`;case"OnRampProviders":return j`<w3m-onramp-providers-footer></w3m-onramp-providers-footer>`;default:return null}}templateNetworksFooter(){return j` <wui-flex 7462 class="footer-in" 7463 padding="3" 7464 flexDirection="column" 7465 gap="3" 7466 alignItems="center" 7467 > 7468 <wui-text variant="md-regular" color="secondary" align="center"> 7469 Your connected wallet may not support some of the networks available for this dApp 7470 </wui-text> 7471 <wui-link @click=${this.onNetworkHelp.bind(this)}> 7472 <wui-icon size="sm" color="accent-primary" slot="iconLeft" name="helpCircle"></wui-icon> 7473 What is a network 7474 </wui-link> 7475 </wui-flex>`}onNetworkHelp(){It.sendEvent({type:"track",event:"CLICK_NETWORK_HELP"}),fe.push("WhatIsANetwork")}getWrapper(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("div.container")}};iC.styles=[ILt];XG([se()],iC.prototype,"status",void 0);XG([se()],iC.prototype,"view",void 0);iC=XG([pt("w3m-footer")],iC);const SLt=Gt` 7476 :host { 7477 display: block; 7478 width: inherit; 7479 } 7480`;var QG=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let oC=class extends ce{constructor(){super(),this.unsubscribe=[],this.viewState=fe.state.view,this.history=fe.state.history.join(","),this.unsubscribe.push(fe.subscribeKey("view",()=>{this.history=fe.state.history.join(","),document.documentElement.style.setProperty("--apkt-duration-dynamic","var(--apkt-durations-lg)")}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),document.documentElement.style.setProperty("--apkt-duration-dynamic","0s")}render(){return j`${this.templatePageContainer()}`}templatePageContainer(){return j`<w3m-router-container 7481 history=${this.history} 7482 .setView=${()=>{this.viewState=fe.state.view}} 7483 > 7484 ${this.viewTemplate(this.viewState)} 7485 </w3m-router-container>`}viewTemplate(t){switch(t){case"AccountSettings":return j`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return j`<w3m-account-view></w3m-account-view>`;case"AllWallets":return j`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return j`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return j`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return j`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":return j`<w3m-connect-view></w3m-connect-view>`;case"Create":return j`<w3m-connect-view walletGuide="explore"></w3m-connect-view>`;case"ConnectingWalletConnect":return j`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;case"ConnectingWalletConnectBasic":return j`<w3m-connecting-wc-basic-view></w3m-connecting-wc-basic-view>`;
7485case"ConnectingExternal":return j`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return j`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return j`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return j`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return j`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"DataCapture":return j`<w3m-data-capture-view></w3m-data-capture-view>`;case"DataCaptureOtpConfirm":return j`<w3m-data-capture-otp-confirm-view></w3m-data-capture-otp-confirm-view>`;case"Downloads":return j`<w3m-downloads-view></w3m-downloads-view>`;case"EmailLogin":return j`<w3m-email-login-view></w3m-email-login-view>`;case"EmailVerifyOtp":return j`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return j`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return j`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return j`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return j`<w3m-network-switch-view></w3m-network-switch-view>`;case"ProfileWallets":return j`<w3m-profile-wallets-view></w3m-profile-wallets-view>`;case"Transactions":return j`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return j`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampTokenSelect":return j`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return j`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return j`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpdateEmailWallet":return j`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return j`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return j`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return j`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return j`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return j`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return j`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return j`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return j`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return j`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WalletSendConfirmed":return j`<w3m-send-confirmed-view></w3m-send-confirmed-view>`;case"WhatIsABuy":return j`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return j`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return j`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return j`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return j`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return j`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return j`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return j`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return j`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return j`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`;case"SmartSessionCreated":return j`<w3m-smart-session-created-view></w3m-smart-session-created-view>`;case"SmartSessionList":return j`<w3m-smart-session-list-view></w3m-smart-session-list-view>`;case"SIWXSignMessage":return j`<w3m-siwx-sign-message-view></w3m-siwx-sign-message-view>`;case"Pay":return j`<w3m-pay-view></w3m-pay-view>`;case"PayLoading":return j`<w3m-pay-loading-view></w3m-pay-loading-view>`;case"PayQuote":return j`<w3m-pay-quote-view></w3m-pay-quote-view>`;case"FundWallet":return j`<w3m-fund-wallet-view></w3m-fund-wallet-view>`;case"PayWithExchange":return j`<w3m-deposit-from-exchange-view></w3m-deposit-from-exchange-view>`;case"PayWithExchangeSelectAsset":return j`<w3m-deposit-from-exchange-select-asset-view></w3m-deposit-from-exchange-select-asset-view>`;case"UsageExceeded":return j`<w3m-usage-exceeded-view></w3m-usage-exceeded-view>`;case"SmartAccountSettings":return j`<w3m-smart-account-settings-view></w3m-smart-account-settings-view>`;default:return j`<w3m-connect-view></w3m-connect-view>`}}};oC.styles=[SLt];QG([se()],oC.prototype,"viewState",void 0);QG([se()],oC.prototype,"history",void 0);oC=QG([pt("w3m-router")],oC);const ALt=Gt` 7486 :host { 7487 z-index: ${({tokens:e})=>e.core.zIndex}; 7488 display: block; 7489 backface-visibility: hidden; 7490 will-change: opacity; 7491 position: fixed; 7492 top: 0; 7493 left: 0; 7494 right: 0; 7495 bottom: 0; 7496 pointer-events: none; 7497 opacity: 0; 7498 background-color: ${({tokens:e})=>e.theme.overlay}; 7499 backdrop-filter: blur(0px); 7500 transition: 7501 opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 7502 backdrop-filter ${({durations:e})=>e.lg} 7503 ${({easings:e})=>e["ease-out-power-2"]}; 7504 will-change: opacity; 7505 } 7506 7507 :host(.open) { 7508 opacity: 1; 7509 backdrop-filter: blur(8px); 7510 } 7511 7512 :host(.appkit-modal) { 7513 position: relative; 7514 pointer-events: unset; 7515 background: none; 7516 width: 100%; 7517 opacity: 1; 7518 } 7519 7520 wui-card { 7521 max-width: var(--apkt-modal-width); 7522 width: 100%; 7523 position: relative; 7524 outline: none; 7525 transform: translateY(4px); 7526 box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05); 7527 transition: 7528 transform ${({durations:e})=>e.lg} 7529 ${({easings:e})=>e["ease-out-power-2"]}, 7530 border-radius ${({durations:e})=>e.lg} 7531 ${({easings:e})=>e["ease-out-power-1"]}, 7532 background-color ${({durations:e})=>e.lg} 7533 ${({easings:e})=>e["ease-out-power-1"]}, 7534 box-shadow ${({durations:e})=>e.lg} 7535 ${({easings:e})=>e["ease-out-power-1"]}; 7536 will-change: border-radius, background-color, transform, box-shadow; 7537 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 7538 padding: var(--local-modal-padding); 7539 box-sizing: border-box; 7540 } 7541 7542 :host(.open) wui-card { 7543 transform: translateY(0px); 7544 } 7545 7546 wui-card::before { 7547 z-index: 1; 7548 pointer-events: none; 7549 content: ''; 7550 position: absolute; 7551 inset: 0; 7552 border-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); 7553 transition: box-shadow ${({durations:e})=>e.lg} 7554 ${({easings:e})=>e["ease-out-power-2"]}; 7555 transition-delay: ${({durations:e})=>e.md}; 7556 will-change: box-shadow; 7557 } 7558 7559 :host([data-mobile-fullscreen='true']) wui-card::before { 7560 border-radius: 0px; 7561 } 7562 7563 :host([data-border='true']) wui-card::before { 7564 box-shadow: inset 0px 0px 0px 4px ${({tokens:e})=>e.theme.foregroundSecondary}; 7565 } 7566 7567 :host([data-border='false']) wui-card::before { 7568 box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.borderPrimaryDark}; 7569 } 7570 7571 :host([data-border='true']) wui-card { 7572 animation: 7573 fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 7574 card-background-border var(--apkt-duration-dynamic) 7575 ${({easings:e})=>e["ease-out-power-2"]}; 7576 animation-fill-mode: backwards, both; 7577 animation-delay: var(--apkt-duration-dynamic); 7578 } 7579 7580 :host([data-border='false']) wui-card { 7581 animation: 7582 fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 7583 card-background-default var(--apkt-duration-dynamic) 7584 ${({easings:e})=>e["ease-out-power-2"]}; 7585 animation-fill-mode: backwards, both; 7586 animation-delay: 0s; 7587 } 7588 7589 :host(.appkit-modal) wui-card { 7590 max-width: var(--apkt-modal-width); 7591 } 7592 7593 wui-card[shake='true'] { 7594 animation: 7595 fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 7596 w3m-shake ${({durations:e})=>e.xl} 7597 ${({easings:e})=>e["ease-out-power-2"]}; 7598 } 7599 7600 wui-flex { 7601 overflow-x: hidden; 7602 overflow-y: auto; 7603 display: flex; 7604 align-items: center; 7605 justify-content: center; 7606 width: 100%; 7607 height: 100%; 7608 } 7609 7610 @media (max-height: 700px) and (min-width: 431px) { 7611 wui-flex { 7612 align-items: flex-start; 7613 } 7614 7615 wui-card { 7616 margin: var(--apkt-spacing-6) 0px; 7617 } 7618 } 7619 7620 @media (max-width: 430px) { 7621 :host([data-mobile-fullscreen='true']) { 7622 height: 100dvh; 7623 } 7624 :host([data-mobile-fullscreen='true']) wui-flex { 7625 align-items: stretch; 7626 } 7627 :host([data-mobile-fullscreen='true']) wui-card { 7628 max-width: 100%; 7629 height: 100%; 7630 border-radius: 0; 7631 border: none; 7632 } 7633 :host(:not([data-mobile-fullscreen='true'])) wui-flex { 7634 align-items: flex-end; 7635 } 7636 7637 :host(:not([data-mobile-fullscreen='true'])) wui-card { 7638 max-width: 100%; 7639 border-bottom: none; 7640 } 7641 7642 :host(:not([data-mobile-fullscreen='true'])) wui-card[data-embedded='true'] { 7643 border-bottom-left-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); 7644 border-bottom-right-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); 7645 } 7646 7647 :host(:not([data-mobile-fullscreen='true'])) wui-card:not([data-embedded='true']) { 7648 border-bottom-left-radius: 0px; 7649 border-bottom-right-radius: 0px; 7650 } 7651 7652 wui-card[shake='true'] { 7653 animation: w3m-shake 0.5s ${({easings:e})=>e["ease-out-power-2"]}; 7654 } 7655 } 7656 7657 @keyframes fade-in { 7658 0% { 7659 transform: scale(0.99) translateY(4px); 7660 } 7661 100% { 7662 transform: scale(1) translateY(0); 7663 } 7664 } 7665 7666 @keyframes w3m-shake { 7667 0% { 7668 transform: scale(1) rotate(0deg); 7669 } 7670 20% { 7671 transform: scale(1) rotate(-1deg); 7672 } 7673 40% { 7674 transform: scale(1) rotate(1.5deg); 7675 } 7676 60% { 7677 transform: scale(1) rotate(-1.5deg); 7678 } 7679 80% { 7680 transform: scale(1) rotate(1deg); 7681 } 7682 100% { 7683 transform: scale(1) rotate(0deg); 7684 } 7685 } 7686 7687 @keyframes card-background-border { 7688 from { 7689 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 7690 } 7691 to { 7692 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 7693 } 7694 } 7695 7696 @keyframes card-background-default { 7697 from { 7698 background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; 7699 } 7700 to { 7701 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 7702 } 7703 } 7704`;var $f=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const tle="scroll-lock",_Lt={PayWithExchange:"0",PayWithExchangeSelectAsset:"0",Pay:"0",PayQuote:"0",PayLoading:"0"};let qu=class extends ce{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=ke.state.enableEmbedded,this.open=Zt.state.open,this.caipAddress=Q.state.activeCaipAddress,this.caipNetwork=Q.state.activeCaipNetwork,this.shake=Zt.state.shake,this.filterByNamespace=qe.state.filterByNamespace,this.padding=gr.spacing[1],this.mobileFullScreen=ke.state.enableMobileFullScreen,this.initializeTheming(),De.prefetchAnalyticsConfig(),this.unsubscribe.push(Zt.subscribeKey("open",t=>t?this.onOpen():this.onClose()),Zt.subscribeKey("shake",t=>this.shake=t),Q.subscribeKey("activeCaipNetwork",t=>this.onNewNetwork(t)),Q.subscribeKey("activeCaipAddress",t=>this.onNewAddress(t)),ke.subscribeKey("enableEmbedded",t=>this.enableEmbedded=t),qe.subscribeKey("filterByNamespace",t=>{var n;this.filterByNamespace!==t&&!((n=Q.getAccountData(t))!=null&&n.caipAddress)&&(De.fetchRecommendedWallets(),this.filterByNamespace=t)}),fe.subscribeKey("view",()=>{this.dataset.border=N8.hasFooter()?"true":"false",this.padding=_Lt[fe.state.view]??gr.spacing[1]}))}firstUpdated(){if(this.dataset.border=N8.hasFooter()?"true":"false",this.mobileFullScreen&&this.setAttribute("data-mobile-fullscreen","true"),this.caipAddress){if(this.enableEmbedded){Zt.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),this.onRemoveKeyboardListener()}render(){return this.style.setProperty("--local-modal-padding",this.padding),this.enableEmbedded?j`${this.contentTemplate()} 7705 <w3m-tooltip></w3m-tooltip> `:this.open?j` 7706 <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay"> 7707 ${this.contentTemplate()} 7708 </wui-flex> 7709 <w3m-tooltip></w3m-tooltip> 7710 `:null}contentTemplate(){return j` <wui-card 7711 shake="${this.shake}" 7712 data-embedded="${ge(this.enableEmbedded)}" 7713 role="alertdialog" 7714 aria-modal="true" 7715 tabindex="0" 7716 data-testid="w3m-modal-card" 7717 > 7718 <w3m-header></w3m-header> 7719 <w3m-router></w3m-router> 7720 <w3m-footer></w3m-footer> 7721 <w3m-snackbar></w3m-snackbar> 7722 <w3m-alertbar></w3m-alertbar> 7723 </wui-card>`}async onOverlayClick(t){if(t.target===t.currentTarget){if(this.mobileFullScreen)return;await this.handleClose()}}async handleClose(){await NEe.safeClose()}initializeTheming(){const{themeVariables:t,themeMode:n}=Zp.state,r=Xs.getColorTheme(n);ENt(t,r)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),Xn.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const t=document.createElement("style");t.dataset.w3m=tle,t.textContent=` 7724 body { 7725 touch-action: none; 7726 overflow: hidden; 7727 overscroll-behavior: contain; 7728 } 7729 w3m-modal { 7730 pointer-events: auto; 7731 } 7732 `,document.head.appendChild(t)}onScrollUnlock(){const t=document.head.querySelector(`style[data-w3m="${tle}"]`);t&&t.remove()}onAddKeyboardListener(){var n;this.abortController=new AbortController;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("wui-card");t==null||t.focus(),window.addEventListener("keydown",r=>{if(r.key==="Escape")this.handleClose();else if(r.key==="Tab"){const{tagName:s}=r.target;s&&!s.includes("W3M-")&&!s.includes("WUI-")&&(t==null||t.focus())}},this.abortController)}onRemoveKeyboardListener(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}async onNewAddress(t){const n=Q.state.isSwitchingNamespace,r=fe.state.view==="ProfileWallets";!t&&!n&&!r&&Zt.close(),await Ep.initializeIfEnabled(t),this.caipAddress=t,Q.setIsSwitchingNamespace(!1)}onNewNetwork(t){var l,u;const n=this.caipNetwork,r=(l=n==null?void 0:n.caipNetworkId)==null?void 0:l.toString(),s=(u=t==null?void 0:t.caipNetworkId)==null?void 0:u.toString(),i=r!==s,o=fe.state.view==="UnsupportedChain",a=Zt.state.open;let c=!1;this.enableEmbedded&&fe.state.view==="SwitchNetwork"&&(c=!0),i&&Dt.resetState(),a&&o&&(c=!0),c&&fe.state.view!=="SIWXSignMessage"&&fe.goBack(),this.caipNetwork=t}prefetch(){this.hasPrefetched||(De.prefetch(),De.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}};
vendor: 9,600 bytes, lines 7732-7904
7732qu.styles=ALt;$f([z({type:Boolean})],qu.prototype,"enableEmbedded",void 0);$f([se()],qu.prototype,"open",void 0);$f([se()],qu.prototype,"caipAddress",void 0);$f([se()],qu.prototype,"caipNetwork",void 0);$f([se()],qu.prototype,"shake",void 0);$f([se()],qu.prototype,"filterByNamespace",void 0);$f([se()],qu.prototype,"padding",void 0);$f([se()],qu.prototype,"mobileFullScreen",void 0);let aq=class extends qu{};aq=$f([pt("w3m-modal")],aq);let cq=class extends qu{};cq=$f([pt("appkit-modal")],cq);const NLt=Gt` 7733 .icon-box { 7734 width: 64px; 7735 height: 64px; 7736 border-radius: ${({borderRadius:e})=>e[5]}; 7737 background-color: ${({colors:e})=>e.semanticError010}; 7738 } 7739`;var TLt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let vN=class extends ce{constructor(){super()}render(){return j` 7740 <wui-flex 7741 flexDirection="column" 7742 alignItems="center" 7743 gap="4" 7744 .padding="${["1","3","4","3"]}" 7745 > 7746 <wui-flex justifyContent="center" alignItems="center" class="icon-box"> 7747 <wui-icon size="xxl" color="error" name="warningCircle"></wui-icon> 7748 </wui-flex> 7749 7750 <wui-text variant="lg-medium" color="primary" align="center"> 7751 The app isn't responding as expected 7752 </wui-text> 7753 <wui-text variant="md-regular" color="secondary" align="center"> 7754 Try again or reach out to the app team for help. 7755 </wui-text> 7756 7757 <wui-button 7758 variant="neutral-secondary" 7759 size="md" 7760 @click=${this.onTryAgainClick.bind(this)} 7761 data-testid="w3m-usage-exceeded-button" 7762 > 7763 <wui-icon color="inherit" slot="iconLeft" name="refresh"></wui-icon> 7764 Try Again 7765 </wui-button> 7766 </wui-flex> 7767 `}onTryAgainClick(){fe.goBack()}};vN.styles=NLt;vN=TLt([pt("w3m-usage-exceeded-view")],vN);const PLt=Gt` 7768 :host { 7769 width: 100%; 7770 } 7771`;var co=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Ls=class extends ce{constructor(){super(...arguments),this.hasImpressionSent=!1,this.walletImages=[],this.imageSrc="",this.name="",this.size="md",this.tabIdx=void 0,this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100",this.rdnsId="",this.displayIndex=void 0,this.walletRank=void 0,this.namespaces=[]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.cleanupIntersectionObserver()}updated(t){super.updated(t),(t.has("name")||t.has("imageSrc")||t.has("walletRank"))&&(this.hasImpressionSent=!1),t.has("walletRank")&&this.walletRank&&!this.intersectionObserver&&this.setupIntersectionObserver()}setupIntersectionObserver(){this.intersectionObserver=new IntersectionObserver(t=>{t.forEach(n=>{n.isIntersecting&&!this.loading&&!this.hasImpressionSent&&this.sendImpressionEvent()})},{threshold:.1}),this.intersectionObserver.observe(this)}cleanupIntersectionObserver(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=void 0)}sendImpressionEvent(){!this.name||this.hasImpressionSent||!this.walletRank||(this.hasImpressionSent=!0,(this.rdnsId||this.name)&&It.sendWalletImpressionEvent({name:this.name,walletRank:this.walletRank,rdnsId:this.rdnsId,view:fe.state.view,displayIndex:this.displayIndex}))}handleGetWalletNamespaces(){return Object.keys(AEe.state.adapters).length>1?this.namespaces:[]}render(){return j` 7772 <wui-list-wallet 7773 .walletImages=${this.walletImages} 7774 imageSrc=${ge(this.imageSrc)} 7775 name=${this.name} 7776 size=${ge(this.size)} 7777 tagLabel=${ge(this.tagLabel)} 7778 .tagVariant=${this.tagVariant} 7779 .walletIcon=${this.walletIcon} 7780 .tabIdx=${this.tabIdx} 7781 .disabled=${this.disabled} 7782 .showAllWallets=${this.showAllWallets} 7783 .loading=${this.loading} 7784 loadingSpinnerColor=${this.loadingSpinnerColor} 7785 .namespaces=${this.handleGetWalletNamespaces()} 7786 ></wui-list-wallet> 7787 `}};Ls.styles=PLt;co([z({type:Array})],Ls.prototype,"walletImages",void 0);co([z()],Ls.prototype,"imageSrc",void 0);co([z()],Ls.prototype,"name",void 0);co([z()],Ls.prototype,"size",void 0);co([z()],Ls.prototype,"tagLabel",void 0);co([z()],Ls.prototype,"tagVariant",void 0);co([z()],Ls.prototype,"walletIcon",void 0);co([z()],Ls.prototype,"tabIdx",void 0);co([z({type:Boolean})],Ls.prototype,"disabled",void 0);co([z({type:Boolean})],Ls.prototype,"showAllWallets",void 0);co([z({type:Boolean})],Ls.prototype,"loading",void 0);co([z({type:String})],Ls.prototype,"loadingSpinnerColor",void 0);co([z()],Ls.prototype,"rdnsId",void 0);co([z()],Ls.prototype,"displayIndex",void 0);co([z()],Ls.prototype,"walletRank",void 0);co([z({type:Array})],Ls.prototype,"namespaces",void 0);Ls=co([pt("w3m-list-wallet")],Ls);const OLt=Gt` 7788 :host { 7789 --local-duration-height: 0s; 7790 --local-duration: ${({durations:e})=>e.lg}; 7791 --local-transition: ${({easings:e})=>e["ease-out-power-2"]}; 7792 } 7793 7794 .container { 7795 display: block; 7796 overflow: hidden; 7797 overflow: hidden; 7798 position: relative; 7799 height: var(--local-container-height); 7800 transition: height var(--local-duration-height) var(--local-transition); 7801 will-change: height, padding-bottom; 7802 } 7803 7804 .container[data-mobile-fullscreen='true'] { 7805 overflow: scroll; 7806 } 7807 7808 .page { 7809 position: absolute; 7810 top: 0; 7811 left: 0; 7812 right: 0; 7813 width: 100%; 7814 height: auto; 7815 width: inherit; 7816 box-sizing: border-box; 7817 display: flex; 7818 flex-direction: column; 7819 background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; 7820 border-bottom-left-radius: var(--local-border-bottom-radius); 7821 border-bottom-right-radius: var(--local-border-bottom-radius); 7822 transition: border-bottom-left-radius var(--local-duration) var(--local-transition); 7823 } 7824 7825 .page[data-mobile-fullscreen='true'] { 7826 height: 100%; 7827 } 7828 7829 .page-content { 7830 display: flex; 7831 flex-direction: column; 7832 min-height: 100%; 7833 } 7834 7835 .footer { 7836 height: var(--apkt-footer-height); 7837 } 7838 7839 div.page[view-direction^='prev-'] .page-content { 7840 animation: 7841 slide-left-out var(--local-duration) forwards var(--local-transition), 7842 slide-left-in var(--local-duration) forwards var(--local-transition); 7843 animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg}); 7844 } 7845 7846 div.page[view-direction^='next-'] .page-content { 7847 animation: 7848 slide-right-out var(--local-duration) forwards var(--local-transition), 7849 slide-right-in var(--local-duration) forwards var(--local-transition); 7850 animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg}); 7851 } 7852 7853 @keyframes slide-left-out { 7854 from { 7855 transform: translateX(0px) scale(1); 7856 opacity: 1; 7857 filter: blur(0px); 7858 } 7859 to { 7860 transform: translateX(8px) scale(0.99); 7861 opacity: 0; 7862 filter: blur(4px); 7863 } 7864 } 7865 7866 @keyframes slide-left-in { 7867 from { 7868 transform: translateX(-8px) scale(0.99); 7869 opacity: 0; 7870 filter: blur(4px); 7871 } 7872 to { 7873 transform: translateX(0) translateY(0) scale(1); 7874 opacity: 1; 7875 filter: blur(0px); 7876 } 7877 } 7878 7879 @keyframes slide-right-out { 7880 from { 7881 transform: translateX(0px) scale(1); 7882 opacity: 1; 7883 filter: blur(0px); 7884 } 7885 to { 7886 transform: translateX(-8px) scale(0.99); 7887 opacity: 0; 7888 filter: blur(4px); 7889 } 7890 } 7891 7892 @keyframes slide-right-in { 7893 from { 7894 transform: translateX(8px) scale(0.99); 7895 opacity: 0; 7896 filter: blur(4px); 7897 } 7898 to { 7899 transform: translateX(0) translateY(0) scale(1); 7900 opacity: 1; 7901 filter: blur(0px); 7902 } 7903 } 7904`;var xf=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const kLt=60;let $l=class extends ce{constructor(){super(...arguments),this.resizeObserver=void 0,this.transitionDuration="0.15s",this.transitionFunction="",this.history="",this.view="",this.setView=void 0,this.viewDirection="",this.historyState="",this.previousHeight="0px",this.mobileFullScreen=ke.state.enableMobileFullScreen,this.onViewportResize=()=>{this.updateContainerHeight()}}updated(t){if(t.has("history")){const n=this.history;this.historyState!==""&&this.historyState!==n&&this.onViewChange(n)}t.has("transitionDuration")&&this.style.setProperty("--local-duration",this.transitionDuration),t.has("transitionFunction")&&this.style.setProperty("--local-transition",this.transitionFunction)}firstUpdated(){var t;this.transitionFunction&&this.style.setProperty("--local-transition",this.transitionFunction),this.style.setProperty("--local-duration",this.transitionDuration),this.historyState=this.history,this.resizeObserver=new ResizeObserver(n=>{var r;for(const s of n)if(s.target===this.getWrapper()){let i=s.contentRect.height;const o=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");
7904if(this.mobileFullScreen){const a=((r=window.visualViewport)==null?void 0:r.height)||window.innerHeight,c=this.getHeaderHeight();i=a-c-o,this.style.setProperty("--local-border-bottom-radius","0px")}else i=i+o,this.style.setProperty("--local-border-bottom-radius",o?"var(--apkt-borderRadius-5)":"0px");this.style.setProperty("--local-container-height",`${i}px`),this.previousHeight!=="0px"&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${i}px`}}),this.resizeObserver.observe(this.getWrapper()),this.updateContainerHeight(),window.addEventListener("resize",this.onViewportResize),(t=window.visualViewport)==null||t.addEventListener("resize",this.onViewportResize)}disconnectedCallback(){var n;const t=this.getWrapper();t&&this.resizeObserver&&this.resizeObserver.unobserve(t),window.removeEventListener("resize",this.onViewportResize),(n=window.visualViewport)==null||n.removeEventListener("resize",this.onViewportResize)}render(){return j` 7905 <div class="container" data-mobile-fullscreen="${ge(this.mobileFullScreen)}"> 7906 <div 7907 class="page" 7908 data-mobile-fullscreen="${ge(this.mobileFullScreen)}" 7909 view-direction="${this.viewDirection}" 7910 > 7911 <div class="page-content"> 7912 <slot></slot> 7913 </div> 7914 </div> 7915 </div> 7916 `}onViewChange(t){const n=t.split(",").filter(Boolean),r=this.historyState.split(",").filter(Boolean),s=r.length,i=n.length,o=n[n.length-1]||"",a=Xs.cssDurationToNumber(this.transitionDuration);let c="";i>s?c="next":i<s?c="prev":i===s&&n[i-1]!==r[s-1]&&(c="next"),this.viewDirection=`${c}-${o}`,setTimeout(()=>{var l;this.historyState=t,(l=this.setView)==null||l.call(this,o)},a),setTimeout(()=>{this.viewDirection=""},a*2)}getWrapper(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("div.page")}updateContainerHeight(){var s;const t=this.getWrapper();if(!t)return;const n=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");let r=0;if(this.mobileFullScreen){const i=((s=window.visualViewport)==null?void 0:s.height)||window.innerHeight,o=this.getHeaderHeight();r=i-o-n,this.style.setProperty("--local-border-bottom-radius","0px")}else r=t.getBoundingClientRect().height+n,this.style.setProperty("--local-border-bottom-radius",n?"var(--apkt-borderRadius-5)":"0px");this.style.setProperty("--local-container-height",`${r}px`),this.previousHeight!=="0px"&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${r}px`}getHeaderHeight(){return kLt}};$l.styles=[OLt];xf([z({type:String})],$l.prototype,"transitionDuration",void 0);xf([z({type:String})],$l.prototype,"transitionFunction",void 0);xf([z({type:String})],$l.prototype,"history",void 0);xf([z({type:String})],$l.prototype,"view",void 0);xf([z({attribute:!1})],$l.prototype,"setView",void 0);xf([se()],$l.prototype,"viewDirection",void 0);xf([se()],$l.prototype,"historyState",void 0);xf([se()],$l.prototype,"previousHeight",void 0);xf([se()],$l.prototype,"mobileFullScreen",void 0);$l=xf([pt("w3m-router-container")],$l);const RLt=Object.freeze(Object.defineProperty({__proto__:null,get AppKitModal(){return cq},get W3mListWallet(){return Ls},get W3mModal(){return aq},W3mModalBase:qu,get W3mRouterContainer(){return $l},get W3mUsageExceededView(){return vN}},Symbol.toStringTag,{value:"Module"})),BLt=Xe` 7917 :host { 7918 display: flex; 7919 width: inherit; 7920 height: inherit; 7921 } 7922`;var Tl=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let fa=class extends ce{render(){return this.style.cssText=` 7923 flex-direction: ${this.flexDirection}; 7924 flex-wrap: ${this.flexWrap}; 7925 flex-basis: ${this.flexBasis}; 7926 flex-grow: ${this.flexGrow}; 7927 flex-shrink: ${this.flexShrink}; 7928 align-items: ${this.alignItems}; 7929 justify-content: ${this.justifyContent}; 7930 column-gap: ${this.columnGap&&`var(--wui-spacing-${this.columnGap})`}; 7931 row-gap: ${this.rowGap&&`var(--wui-spacing-${this.rowGap})`}; 7932 gap: ${this.gap&&`var(--wui-spacing-${this.gap})`}; 7933 padding-top: ${this.padding&&yi.getSpacingStyles(this.padding,0)}; 7934 padding-right: ${this.padding&&yi.getSpacingStyles(this.padding,1)}; 7935 padding-bottom: ${this.padding&&yi.getSpacingStyles(this.padding,2)}; 7936 padding-left: ${this.padding&&yi.getSpacingStyles(this.padding,3)}; 7937 margin-top: ${this.margin&&yi.getSpacingStyles(this.margin,
79370)}; 7938 margin-right: ${this.margin&&yi.getSpacingStyles(this.margin,1)}; 7939 margin-bottom: ${this.margin&&yi.getSpacingStyles(this.margin,2)}; 7940 margin-left: ${this.margin&&yi.getSpacingStyles(this.margin,3)}; 7941 `,j`<slot></slot>`}};fa.styles=[Qn,BLt];Tl([z()],fa.prototype,"flexDirection",void 0);Tl([z()],fa.prototype,"flexWrap",void 0);Tl([z()],fa.prototype,"flexBasis",void 0);Tl([z()],fa.prototype,"flexGrow",void 0);Tl([z()],fa.prototype,"flexShrink",void 0);Tl([z()],fa.prototype,"alignItems",void 0);Tl([z()],fa.prototype,"justifyContent",void 0);Tl([z()],fa.prototype,"columnGap",void 0);Tl([z()],fa.prototype,"rowGap",void 0);Tl([z()],fa.prototype,"gap",void 0);Tl([z()],fa.prototype,"padding",void 0);Tl([z()],fa.prototype,"margin",void 0);fa=Tl([ct("wui-flex")],fa);class DLt{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class ULt{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??(this.Y=new Promise(t=>this.Z=t))}resume(){var t;(t=this.Z)==null||t.call(this),this.Y=this.Z=void 0}}const nle=e=>!pTt(e)&&typeof e.then=="function",rle=1073741823;class LLt extends KEe{constructor(){super(...arguments),this._$Cwt=rle,this._$Cbt=[],this._$CK=new DLt(this),this._$CX=new ULt}render(...t){return t.find(n=>!nle(n))??C0}update(t,n){const r=this._$Cbt;let s=r.length;this._$Cbt=n;const i=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<n.length&&!(a>this._$Cwt);a++){const c=n[a];if(!nle(c))return this._$Cwt=a,c;a<s&&c===r[a]||(this._$Cwt=rle,s=0,Promise.resolve(c).then(async l=>{for(;o.get();)await o.get();const u=i.deref();if(u!==void 0){const d=u._$Cbt.indexOf(c);d>-1&&d<u._$Cwt&&(u._$Cwt=d,u.setValue(l))}}))}return C0}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}const MLt=LK(LLt);class jLt{constructor(){this.cache=new Map}set(t,n){this.cache.set(t,n)}get(t){return this.cache.get(t)}has(t){return this.cache.has(t)}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}}const wU=new jLt,FLt=Xe` 7942 :host { 7943 display: flex; 7944 aspect-ratio: var(--local-aspect-ratio); 7945 color: var(--local-color); 7946 width: var(--local-width); 7947 } 7948 7949 svg { 7950 width: inherit; 7951 height: inherit; 7952 object-fit: contain; 7953 object-position: center; 7954 } 7955 7956 .fallback { 7957 width: var(--local-width); 7958 height: var(--local-height); 7959 } 7960`;var ox=function(e,t,n,r){var s=arguments.length,i=s<3?t:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const sle={add:async()=>(await te(async()=>{const{addSvg:e}=await Promise.resolve().then(()=>ejt);return{addSvg:e}},void 0)).addSvg,allWallets:async()=>(await te(async()=>{const{allWalletsSvg:e}=await Promise.resolve().then(()=>njt);return{allWalletsSvg:e}},void 0)).allWalletsSvg,arrowBottomCircle:async()=>(await te(async()=>{const{arrowBottomCircleSvg:e}=await Promise.resolve().then(()=>sjt);return{arrowBottomCircleSvg:e}},void 0)).arrowBottomCircleSvg,appStore:async()=>(await te(async()=>{const{appStoreSvg:e}=await Promise.resolve().then(()=>ojt);return{appStoreSvg:e}},void 0)).appStoreSvg,apple:async()=>(await te(async()=>{const{appleSvg:e}=await Promise.resolve().then(()=>cjt);return{appleSvg:e}},void 0)).appleSvg,arrowBottom:async()=>(await te(async()=>{const{arrowBottomSvg:e}=await Promise.resolve().then(()=>ujt);return{arrowBottomSvg:e}},void 0)).arrowBottomSvg,arrowLeft:async()=>(await te(async()=>{const{arrowLeftSvg:e}=await Promise.resolve().then(()=>hjt);return{arrowLeftSvg:e}},void 0)).arrowLeftSvg,arrowRight:async()=>(await te(async()=>{const{arrowRightSvg:e}=await Promise.resolve().then(()=>pjt);return{arrowRightSvg:e}},void 0)).arrowRightSvg,arrowTop:async()=>(await te(async()=>{const{arrowTopSvg:e}=await Promise.resolve().then(()=>mjt);return{arrowTopSvg:e}},void 0)).arrowTopSvg,bank:async()=>(await te(async()=>{const{bankSvg:e}=await Promise.resolve().then(()=>yjt);
7960return{bankSvg:e}},void 0)).bankSvg,browser:async()=>(await te(async()=>{const{browserSvg:e}=await Promise.resolve().then(()=>vjt);return{browserSvg:e}},void 0)).browserSvg,card:async()=>(await te(async()=>{const{cardSvg:e}=await Promise.resolve().then(()=>Cjt);return{cardSvg:e}},void 0)).cardSvg,checkmark:async()=>(await te(async()=>{const{checkmarkSvg:e}=await Promise.resolve().then(()=>xjt);return{checkmarkSvg:e}},void 0)).checkmarkSvg,checkmarkBold:async()=>(await te(async()=>{const{checkmarkBoldSvg:e}=await Promise.resolve().then(()=>Sjt);return{checkmarkBoldSvg:e}},void 0)).checkmarkBoldSvg,chevronBottom:async()=>(await te(async()=>{const{chevronBottomSvg:e}=await Promise.resolve().then(()=>_jt);return{chevronBottomSvg:e}},void 0)).chevronBottomSvg,chevronLeft:async()=>(await te(async()=>{const{chevronLeftSvg:e}=await Promise.resolve().then(()=>Tjt);return{chevronLeftSvg:e}},void 0)).chevronLeftSvg,chevronRight:async()=>(await te(async()=>{const{chevronRightSvg:e}=await Promise.resolve().then(()=>Ojt);return{chevronRightSvg:e}},void 0)).chevronRightSvg,chevronTop:async()=>(await te(async()=>{const{chevronTopSvg:e}=await Promise.resolve().then(()=>Rjt);return{chevronTopSvg:e}},void 0)).chevronTopSvg,chromeStore:async()=>(await te(async()=>{const{chromeStoreSvg:e}=await Promise.resolve().then(()=>Djt);return{chromeStoreSvg:e}},void 0)).chromeStoreSvg,clock:async()=>(await te(async()=>{const{clockSvg:e}=await Promise.resolve().then(()=>Ljt);return{clockSvg:e}},void 0)).clockSvg,close:async()=>(await te(async()=>{const{closeSvg:e}=await Promise.resolve().then(()=>jjt);return{closeSvg:e}},void 0)).closeSvg,compass:async()=>(await te(async()=>{const{compassSvg:e}=await Promise.resolve().then(()=>zjt);return{compassSvg:e}},void 0)).compassSvg,coinPlaceholder:async()=>(await te(async()=>{const{coinPlaceholderSvg:e}=await Promise.resolve().then(()=>Wjt);return{coinPlaceholderSvg:e}},void 0)).coinPlaceholderSvg,copy:async()=>(await te(async()=>{const{copySvg:e}=await Promise.resolve().then(()=>Vjt);return{copySvg:e}},void 0)).copySvg,cursor:async()=>(await te(async()=>{const{cursorSvg:e}=await Promise.resolve().then(()=>Gjt);return{cursorSvg:e}},void 0)).cursorSvg,cursorTransparent:async()=>(await te(async()=>{const{cursorTransparentSvg:e}=await Promise.resolve().then(()=>Yjt);return{cursorTransparentSvg:e}},void 0)).cursorTransparentSvg,desktop:async()=>(await te(async()=>{const{desktopSvg:e}=await Promise.resolve().then(()=>Xjt);return{desktopSvg:e}},void 0)).desktopSvg,disconnect:async()=>(await te(async()=>{const{disconnectSvg:e}=await Promise.resolve().then(()=>eFt);return{disconnectSvg:e}},void 0)).disconnectSvg,discord:async()=>(await te(async()=>{const{discordSvg:e}=await Promise.resolve().then(()=>nFt);return{discordSvg:e}},void 0)).discordSvg,etherscan:async()=>(await te(async()=>{const{etherscanSvg:e}=await Promise.resolve().then(()=>sFt);return{etherscanSvg:e}},void 0)).etherscanSvg,extension:async()=>(await te(async()=>{const{extensionSvg:e}=await Promise.resolve().then(()=>oFt);return{extensionSvg:e}},void 0)).extensionSvg,externalLink:async()=>(await te(async()=>{const{externalLinkSvg:e}=await Promise.resolve().then(()=>cFt);return{externalLinkSvg:e}},void 0)).externalLinkSvg,facebook:async()=>(await te(async()=>{const{facebookSvg:e}=await Promise.resolve().then(()=>uFt);return{facebookSvg:e}},void 0)).facebookSvg,farcaster:async()=>(await te(async()=>{const{farcasterSvg:e}=await Promise.resolve().then(()=>hFt);return{farcasterSvg:e}},void 0)).farcasterSvg,filters:async()=>(await te(async()=>{const{filtersSvg:e}=await Promise.resolve().then(()=>pFt);return{filtersSvg:e}},void 0)).filtersSvg,github:async()=>(await te(async()=>{const{githubSvg:e}=await Promise.resolve().then(()=>mFt);return{githubSvg:e}},void 0)).githubSvg,google:async()=>(await te(async()=>{const{googleSvg:e}=await Promise.resolve().then(()=>yFt);return{googleSvg:e}},void 0)).googleSvg,helpCircle:async()=>(await te(async()=>{const{helpCircleSvg:e}=await Promise.resolve().then(()=>vFt);return{helpCircleSvg:e}},void 0)).helpCircleSvg,image:async()=>(await te(async()=>{const{imageSvg:e}=await Promise.resolve().then(()=>CFt);return{imageSvg:e}},void 0)).imageSvg,id:async()=>(await te(async()=>{const{idSvg:e}=await Promise.resolve().then(()=>xFt);return{idSvg:e}},void 0)).idSvg,infoCircle:async()=>(await te(async()=>{const{infoCircleSvg:e}=await Promise.resolve().then(()=>SFt);return{infoCircleSvg:e}},void 0)).infoCircleSvg,lightbulb:async()=>(await te(async()=>{const{lightbulbSvg:e}=await Promise.resolve().then(()=>_Ft);return{lightbulbSvg:e}},void 0)).lightbulbSvg,mail:async()=>(await te(async()=>{const{mailSvg:e}=await Promise.resolve().then(()=>TFt);return{mailSvg:e}},void 0)).mailSvg,mobile:async()=>(await te(async()=>{const{mobileSvg:e}=await Promise.resolve().then(()=>OFt);return{mobileSvg:e}},void 0)).mobileSvg,more:async()=>(await te(async()=>{const{moreSvg:e}=await Promise.resolve().then(()=>RFt);return{moreSvg:e}},void 0)).moreSvg,networkPlaceholder:async()=>(await te(async()=>{const{networkPlaceholderSvg:e}=await Promise.resolve().then(()=>DFt);return{networkPlaceholderSvg:e}},void 0)).networkPlaceholderSvg,nftPlaceholder:async()=>(await te(async()=>{const{nftPlaceholderSvg:e}=await Promise.resolve().then(()=>LFt);return{nftPlaceholderSvg:e}},void 0)).nftPlaceholderSvg,off:async()=>(await te(async()=>{const{offSvg:e}=await Promise.resolve().then(()=>jFt);return{offSvg:e}},void 0)).offSvg,playStore:async()=>(await te(async()=>{const{playStoreSvg:e}=await Promise.resolve().then(()=>zFt);return{playStoreSvg:e}},void 0)).playStoreSvg,plus:async()=>(await te(async()=>{const{plusSvg:e}=await Promise.resolve().then(()=>WFt);return{plusSvg:e}},void 0)).plusSvg,qrCode:async()=>(await te(async()=>{const{qrCodeIcon:e}=await Promise.resolve().then(()=>VFt);return{qrCodeIcon:e}},void 0)).qrCodeIcon,recycleHorizontal:async()=>(await te(async()=>{const{recycleHorizontalSvg:e}=await Promise.resolve().then(()=>GFt);return{recycleHorizontalSvg:e}},void 0)).recycleHorizontalSvg,refresh:async()=>(await te(async()=>{const{refreshSvg:e}=await Promise.resolve().then(()=>YFt);return{refreshSvg:e}},void 0)).refreshSvg,search:async()=>(await te(async()=>{const{searchSvg:e}=await Promise.resolve().then(()=>XFt);return{searchSvg:e}},void 0)).searchSvg,send:async()=>(await te(async()=>{const{sendSvg:e}=await Promise.resolve().then(()=>ezt);return{sendSvg:e}},void 0)).sendSvg,swapHorizontal:async()=>(await te(async()=>{const{swapHorizontalSvg:e}=await Promise.resolve().then(()=>nzt);return{swapHorizontalSvg:e}},void 0)).swapHorizontalSvg,swapHorizontalMedium:async()=>(await te(async()=>{const{swapHorizontalMediumSvg:e}=await Promise.resolve().then(()=>szt);return{swapHorizontalMediumSvg:e}},void 0)).swapHorizontalMediumSvg,swapHorizontalBold:async()=>(await te(async()=>{const{swapHorizontalBoldSvg:e}=await Promise.resolve().then(()=>ozt);return{swapHorizontalBoldSvg:e}},void 0)).swapHorizontalBoldSvg,swapHorizontalRoundedBold:async()=>(await te(async()=>{const{swapHorizontalRoundedBoldSvg:e}=await Promise.resolve().then(()=>czt);return{swapHorizontalRoundedBoldSvg:e}},void 0)).swapHorizontalRoundedBoldSvg,swapVertical:async()=>(await te(async()=>{const{swapVerticalSvg:e}=await Promise.resolve().then(()=>uzt);return{swapVerticalSvg:e}},void 0)).swapVerticalSvg,telegram:async()=>(await te(async()=>{const{telegramSvg:e}=await Promise.resolve().then(()=>hzt);return{telegramSvg:e}},void 0)).telegramSvg,threeDots:async()=>(await te(async()=>{const{threeDotsSvg:e}=await Promise.resolve().then(()=>pzt);return{threeDotsSvg:e}},void 0)).threeDotsSvg,twitch:async()=>(await te(async()=>{const{twitchSvg:e}=await Promise.resolve().then(()=>mzt);return{twitchSvg:e}},void 0)).twitchSvg,twitter:async()=>(await te(async()=>{const{xSvg:e}=await Promise.resolve().then(()=>hle);return{xSvg:e}},void 0)).xSvg,twitterIcon:async()=>(await te(async()=>{const{twitterIconSvg:e}=await Promise.resolve().then(()=>bzt);return{twitterIconSvg:e}},void 0)).twitterIconSvg,verify:async()=>(await te(async()=>{const{verifySvg:e}=await Promise.resolve().then(()=>Ezt);return{verifySvg:e}},void 0)).verifySvg,verifyFilled:async()=>(await te(async()=>{const{verifyFilledSvg:e}=await Promise.resolve().then(()=>$zt);return{verifyFilledSvg:e}},void 0)).verifyFilledSvg,wallet:async()=>(await te(async()=>{const{walletSvg:e}=await Promise.resolve().then(()=>Izt);return{walletSvg:e}},void 0)).walletSvg,walletConnect:async()=>(await te(async()=>{const{walletConnectSvg:e}=await Promise.resolve().then(()=>EU);return{walletConnectSvg:e}},void 0)).walletConnectSvg,walletConnectLightBrown:async()=>(await te(async()=>{const{walletConnectLightBrownSvg:e}=await Promise.resolve().then(()=>EU);return{walletConnectLightBrownSvg:e}},void 0)).walletConnectLightBrownSvg,walletConnectBrown:async()=>(await te(async()=>{const{walletConnectBrownSvg:e}=await Promise.resolve().then(()=>EU);return{walletConnectBrownSvg:e}},void 0)).walletConnectBrownSvg,walletPlaceholder:async()=>(await te(async()=>{const{walletPlaceholderSvg:e}=await Promise.resolve().then(()=>Tzt);return{walletPlaceholderSvg:e}},void 0)).walletPlaceholderSvg,warningCircle:async()=>(await te(async()=>{const{warningCircleSvg:e}=await Promise.resolve().then(()=>Ozt);return{warningCircleSvg:e}},void 0)).warningCircleSvg,x:async()=>(await te(async()=>{const{xSvg:e}=await Promise.resolve().then(()=>hle);return{xSvg:e}},void 0)).xSvg,info:async()=>(await te(async()=>{const{infoSvg:e}=await Promise.resolve().then(()=>Rzt);return{infoSvg:e}},void 0)).infoSvg,exclamationTriangle:async()=>(await te(async()=>{const{exclamationTriangleSvg:e}=await Promise.resolve().then(()=>Dzt);return{exclamationTriangleSvg:e}},void 0)).exclamationTriangleSvg,reown:async()=>(await te(async()=>{const{reownSvg:e}=await Promise.resolve().then(()=>Lzt);return{reownSvg:e}},void 0)).reownSvg};async function zLt(e){if(wU.has(e))return wU.get(e);const n=(sle[e]??sle.copy)();return wU.set(e,n),n}let Vy=class extends ce{constructor(){super(...arguments),this.size="md",this.name="copy",this.color="fg-300",this.aspectRatio="1 / 1"}render(){return this.style.cssText=` 7961 --local-color: ${`var(--wui-color-${this.color});`} 7962 --local-width: ${`var(--wui-icon-size-${this.size});`} 7963 --local-aspect-ratio: ${this.aspectRatio} 7964 `,j`${MLt(zLt(this.name),j`<div class="fallback"></div>`)}`}};Vy.styles=[Qn,E$,FLt];ox([z()],Vy.prototype,"size",void 0);ox([z()],Vy.prototype,"name",void 0);ox([z()],Vy.prototype,"color",void 0);
7964ox([z()],Vy.prototype,"aspectRatio",void 0);Vy=ox([ct("wui-icon")],Vy);const qLt=Xe` 7965 :host { 7966 display: inline-flex !important; 7967 } 7968 7969 slot { 7970 width: 100%; 7971 display: inline-block; 7972 font-style: normal; 7973 font-family: var(--wui-font-family); 7974 font-feature-settings: 7975 'tnum' on, 7976 'lnum' on, 7977 'case' on; 7978 line-height: 130%; 7979 font-weight: var(--wui-font-weight-regular); 7980 overflow: inherit; 7981 text-overflow: inherit; 7982 text-align: var(--local-align); 7983 color: var(--local-color); 7984 } 7985 7986 .wui-line-clamp-1 { 7987 overflow: hidden; 7988 display: -webkit-box; 7989 -webkit-box-orient: vertical; 7990 -webkit-line-clamp: 1; 7991 } 7992 7993 .wui-line-clamp-2 { 7994 overflow: hidden; 7995 display: -webkit-box; 7996 -webkit-box-orient: vertical; 7997 -webkit-line-clamp: 2; 7998 } 7999 8000 .wui-font-medium-400 { 8001 font-size: var(--wui-font-size-medium); 8002 font-weight: var(--wui-font-weight-light); 8003 letter-spacing: var(--wui-letter-spacing-medium); 8004 } 8005 8006 .wui-font-medium-600 { 8007 font-size: var(--wui-font-size-medium); 8008 letter-spacing: var(--wui-letter-spacing-medium); 8009 } 8010 8011 .wui-font-title-600 { 8012 font-size: var(--wui-font-size-title); 8013 letter-spacing: var(--wui-letter-spacing-title); 8014 } 8015 8016 .wui-font-title-6-600 { 8017 font-size: var(--wui-font-size-title-6); 8018 letter-spacing: var(--wui-letter-spacing-title-6); 8019 } 8020 8021 .wui-font-mini-700 { 8022 font-size: var(--wui-font-size-mini); 8023 letter-spacing: var(--wui-letter-spacing-mini); 8024 text-transform: uppercase; 8025 } 8026 8027 .wui-font-large-500, 8028 .wui-font-large-600, 8029 .wui-font-large-700 { 8030 font-size: var(--wui-font-size-large); 8031 letter-spacing: var(--wui-letter-spacing-large); 8032 } 8033 8034 .wui-font-2xl-500, 8035 .wui-font-2xl-600, 8036 .wui-font-2xl-700 { 8037 font-size: var(--wui-font-size-2xl); 8038 letter-spacing: var(--wui-letter-spacing-2xl); 8039 } 8040 8041 .wui-font-paragraph-400, 8042 .wui-font-paragraph-500, 8043 .wui-font-paragraph-600, 8044 .wui-font-paragraph-700 { 8045 font-size: var(--wui-font-size-paragraph); 8046 letter-spacing: var(--wui-letter-spacing-paragraph); 8047 } 8048 8049 .wui-font-small-400, 8050 .wui-font-small-500, 8051 .wui-font-small-600 { 8052 font-size: var(--wui-font-size-small); 8053 letter-spacing: var(--wui-letter-spacing-small); 8054 } 8055 8056 .wui-font-tiny-400, 8057 .wui-font-tiny-500, 8058 .wui-font-tiny-600 { 8059 font-size: var(--wui-font-size-tiny); 8060 letter-spacing: var(--wui-letter-spacing-tiny); 8061 } 8062 8063 .wui-font-micro-700, 8064 .wui-font-micro-600 { 8065 font-size: var(--wui-font-size-micro); 8066 letter-spacing: var(--wui-letter-spacing-micro); 8067 text-transform: uppercase; 8068 } 8069 8070 .wui-font-tiny-400, 8071 .wui-font-small-400, 8072 .wui-font-medium-400, 8073 .wui-font-paragraph-400 { 8074 font-weight: var(--wui-font-weight-light); 8075 } 8076 8077 .wui-font-large-700, 8078 .wui-font-paragraph-700, 8079 .wui-font-micro-700, 8080 .wui-font-mini-700 { 8081 font-weight: var(--wui-font-weight-bold); 8082 } 8083 8084 .wui-font-medium-600, 8085 .wui-font-medium-title-600, 8086 .wui-font-title-6-600, 8087 .wui-font-large-600, 8088 .wui-font-paragraph-600, 8089 .wui-font-small-600, 8090 .wui-font-tiny-600, 8091 .wui-font-micro-600 { 8092 font-weight: var(--wui-font-weight-medium); 8093 } 8094 8095 :host([disabled]) { 8096 opacity: 0.4; 8097 } 8098`;var ax=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Ky=class extends ce{constructor(){super(...arguments),this.variant="paragraph-500",this.color="fg-300",this.align="left",this.lineClamp=void 0}render(){const t={[`wui-font-${this.variant}`]:!0,[`wui-color-${this.color}`]:!0,[`wui-line-clamp-${this.lineClamp}`]:!!this.lineClamp};return this.style.cssText=` 8099 --local-align: ${this.align}; 8100 --local-color: var(--wui-color-${this.color}); 8101 `,j`<slot class=${Y6(t)}></slot>`}};Ky.styles=[Qn,qLt];ax([z()],Ky.prototype,"variant",void 0);ax([z()],Ky.prototype,"color",void 0);ax([z()],Ky.prototype,"align",void 0);ax([z()],Ky.prototype,"lineClamp",void 0);Ky=ax([ct("wui-text")],Ky);const WLt=Xe` 8102 :host { 8103 display: inline-flex; 8104 justify-content: center;
8105 align-items: center; 8106 position: relative; 8107 overflow: hidden; 8108 background-color: var(--wui-color-gray-glass-020); 8109 border-radius: var(--local-border-radius); 8110 border: var(--local-border); 8111 box-sizing: content-box; 8112 width: var(--local-size); 8113 height: var(--local-size); 8114 min-height: var(--local-size); 8115 min-width: var(--local-size); 8116 } 8117 8118 @supports (background: color-mix(in srgb, white 50%, black)) { 8119 :host { 8120 background-color: color-mix(in srgb, var(--local-bg-value) var(--local-bg-mix), transparent); 8121 } 8122 } 8123`;var Z0=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let th=class extends ce{constructor(){super(...arguments),this.size="md",this.backgroundColor="accent-100",this.iconColor="accent-100",this.background="transparent",this.border=!1,this.borderColor="wui-color-bg-125",this.icon="copy"}render(){const t=this.iconSize||this.size,n=this.size==="lg",r=this.size==="xl",s=n?"12%":"16%",i=n?"xxs":r?"s":"3xl",o=this.background==="gray",a=this.background==="opaque",c=this.backgroundColor==="accent-100"&&a||this.backgroundColor==="success-100"&&a||this.backgroundColor==="error-100"&&a||this.backgroundColor==="inverse-100"&&a;let l=`var(--wui-color-${this.backgroundColor})`;return c?l=`var(--wui-icon-box-bg-${this.backgroundColor})`:o&&(l=`var(--wui-color-gray-${this.backgroundColor})`),this.style.cssText=` 8124 --local-bg-value: ${l}; 8125 --local-bg-mix: ${c||o?"100%":s}; 8126 --local-border-radius: var(--wui-border-radius-${i}); 8127 --local-size: var(--wui-icon-box-size-${this.size}); 8128 --local-border: ${this.borderColor==="wui-color-bg-125"?"2px":"1px"} solid ${this.border?`var(--${this.borderColor})`:"transparent"} 8129 `,j` <wui-icon color=${this.iconColor} size=${t} name=${this.icon}></wui-icon> `}};th.styles=[Qn,oo,WLt];Z0([z()],th.prototype,"size",void 0);Z0([z()],th.prototype,"backgroundColor",void 0);Z0([z()],th.prototype,"iconColor",void 0);Z0([z()],th.prototype,"iconSize",void 0);Z0([z()],th.prototype,"background",void 0);Z0([z({type:Boolean})],th.prototype,"border",void 0);Z0([z()],th.prototype,"borderColor",void 0);Z0([z()],th.prototype,"icon",void 0);th=Z0([ct("wui-icon-box")],th);const HLt=Xe` 8130 :host { 8131 display: block; 8132 width: var(--local-width); 8133 height: var(--local-height); 8134 } 8135 8136 img { 8137 display: block; 8138 width: 100%; 8139 height: 100%; 8140 object-fit: cover; 8141 object-position: center center; 8142 border-radius: inherit; 8143 } 8144`;var BP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let u6=class extends ce{constructor(){super(...arguments),this.src="./path/to/image.jpg",this.alt="Image",this.size=void 0}render(){return this.style.cssText=` 8145 --local-width: ${this.size?`var(--wui-icon-size-${this.size});`:"100%"}; 8146 --local-height: ${this.size?`var(--wui-icon-size-${this.size});`:"100%"}; 8147 `,j`<img src=${this.src} alt=${this.alt} @error=${this.handleImageError} />`}handleImageError(){this.dispatchEvent(new CustomEvent("onLoadError",{bubbles:!0,composed:!0}))}};u6.styles=[Qn,E$,HLt];BP([z()],u6.prototype,"src",void 0);BP([z()],u6.prototype,"alt",void 0);BP([z()],u6.prototype,"size",void 0);u6=BP([ct("wui-image")],u6);const VLt=Xe` 8148 :host { 8149 position: relative; 8150 background-color: var(--wui-color-gray-glass-002); 8151 display: flex; 8152 justify-content: center; 8153 align-items: center; 8154 width: var(--local-size); 8155 height: var(--local-size); 8156 border-radius: inherit; 8157 border-radius: var(--local-border-radius); 8158 } 8159 8160 :host > wui-flex { 8161 overflow: hidden; 8162 border-radius: inherit; 8163 border-radius: var(--local-border-radius); 8164 } 8165 8166 :host::after { 8167 content: ''; 8168 position: absolute; 8169 top: 0; 8170 bottom: 0; 8171 left: 0; 8172 right: 0; 8173 border-radius: inherit; 8174 border: 1px solid var(--wui-color-gray-glass-010); 8175 pointer-events: none; 8176 } 8177 8178 :host([name='Extension'])::after { 8179 border: 1px solid var(--wui-color-accent-glass-010); 8180 } 8181 8182 :host([data-wallet-icon='allWallets']) { 8183 background-color: var(--wui-all-wallets-bg-100); 8184 } 8185 8186 :host([data-wallet-icon='allWallets'])::after { 8187 border: 1px solid var(--wui-color-accent-glass-010); 8188 } 8189 8190 wui-icon[data-parent-size='inherit'] { 8191 width: 75%; 8192 height: 75%; 8193 align-items: center; 8194 } 8195 8196 wui-icon[data-parent-size='sm'] { 8197 width: 18px; 8198 height: 18px; 8199 } 8200 8201 wui-icon[data-parent-size='md'] { 8202 width: 24px; 8203 height: 24px; 8204 } 8205 8206 wui-icon[data-parent-size='lg'] { 8207 width: 42px; 8208 height: 42px; 8209 } 8210 8211 wui-icon[data-parent-size='full'] { 8212 width: 100%; 8213 height: 100%; 8214 } 8215 8216 :host > wui-icon-box { 8217 position: absolute; 8218 overflow: hidden; 8219 right: -1px; 8220 bottom: -2px; 8221 z-index: 1; 8222 border: 2px solid var(--wui-color-bg-150, #1e1f1f); 8223 padding: 1px; 8224 } 8225`;var Lb=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let R0=class extends ce{constructor(){super(...arguments),this.size="md",this.name="",this.installed=!1,this.badgeSize="xs"}render(){let t="xxs";return this.size==="lg"?t="m":this.size==="md"?t="xs":t="xxs",this.style.cssText=` 8226 --local-border-radius: var(--wui-border-radius-${t}); 8227 --local-size: var(--wui-wallet-image-size-${this.size}); 8228 `,this.walletIcon&&(this.dataset.walletIcon=this.walletIcon),j` 8229 <wui-flex justifyContent="center" alignItems="center"> ${this.templateVisual()} </wui-flex> 8230 `}templateVisual(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt=${this.name}></wui-image>`:this.walletIcon?j`<wui-icon 8231 data-parent-size="md" 8232 size="md" 8233 color="inherit" 8234 name=${this.walletIcon} 8235 ></wui-icon>`:j`<wui-icon 8236 data-parent-size=${this.size} 8237 size="inherit" 8238 color="inherit" 8239 name="walletPlaceholder" 8240 ></wui-icon>`}};R0.styles=[oo,Qn,VLt];Lb([z()],R0.prototype,"size",void 0);Lb([z()],R0.prototype,"name",void 0);Lb([z()],R0.prototype,"imageSrc",void 0);Lb([z()],R0.prototype,"walletIcon",void 0);Lb([z({type:Boolean})],R0.prototype,"installed",void 0);Lb([z()],R0.prototype,"badgeSize",void 0);
8240R0=Lb([ct("wui-wallet-image")],R0);const KLt=Xe` 8241 :host { 8242 position: relative; 8243 border-radius: var(--wui-border-radius-xxs); 8244 width: 40px; 8245 height: 40px; 8246 overflow: hidden; 8247 background: var(--wui-color-gray-glass-002); 8248 display: flex; 8249 justify-content: center; 8250 align-items: center; 8251 flex-wrap: wrap; 8252 gap: var(--wui-spacing-4xs); 8253 padding: 3.75px !important; 8254 } 8255 8256 :host::after { 8257 content: ''; 8258 position: absolute; 8259 top: 0; 8260 bottom: 0; 8261 left: 0; 8262 right: 0; 8263 border-radius: inherit; 8264 border: 1px solid var(--wui-color-gray-glass-010); 8265 pointer-events: none; 8266 } 8267 8268 :host > wui-wallet-image { 8269 width: 14px; 8270 height: 14px; 8271 border-radius: var(--wui-border-radius-5xs); 8272 } 8273 8274 :host > wui-flex { 8275 padding: 2px; 8276 position: fixed; 8277 overflow: hidden; 8278 left: 34px; 8279 bottom: 8px; 8280 background: var(--dark-background-150, #1e1f1f); 8281 border-radius: 50%; 8282 z-index: 2; 8283 display: flex; 8284 } 8285`;var r$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const yU=4;let EN=class extends ce{constructor(){super(...arguments),this.walletImages=[]}render(){const t=this.walletImages.length<yU;return j`${this.walletImages.slice(0,yU).map(({src:n,walletName:r})=>j` 8286 <wui-wallet-image 8287 size="inherit" 8288 imageSrc=${n} 8289 name=${ge(r)} 8290 ></wui-wallet-image> 8291 `)} 8292 ${t?[...Array(yU-this.walletImages.length)].map(()=>j` <wui-wallet-image size="inherit" name=""></wui-wallet-image>`):null} 8293 <wui-flex> 8294 <wui-icon-box 8295 size="xxs" 8296 iconSize="xxs" 8297 iconcolor="success-100" 8298 backgroundcolor="success-100" 8299 icon="checkmark" 8300 background="opaque" 8301 ></wui-icon-box> 8302 </wui-flex>`}};EN.styles=[Qn,KLt];r$e([z({type:Array})],EN.prototype,"walletImages",void 0);EN=r$e([ct("wui-all-wallets-image")],EN);const GLt=Xe` 8303 :host { 8304 display: flex; 8305 justify-content: center; 8306 align-items: center; 8307 height: var(--wui-spacing-m); 8308 padding: 0 var(--wui-spacing-3xs) !important; 8309 border-radius: var(--wui-border-radius-5xs); 8310 transition: 8311 border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), 8312 background-color var(--wui-duration-lg) var(--wui-ease-out-power-1); 8313 will-change: border-radius, background-color; 8314 } 8315 8316 :host > wui-text { 8317 transform: translateY(5%); 8318 } 8319 8320 :host([data-variant='main']) { 8321 background-color: var(--wui-color-accent-glass-015); 8322 color: var(--wui-color-accent-100); 8323 } 8324 8325 :host([data-variant='shade']) { 8326 background-color: var(--wui-color-gray-glass-010); 8327 color: var(--wui-color-fg-200); 8328 } 8329 8330 :host([data-variant='success']) { 8331 background-color: var(--wui-icon-box-bg-success-100); 8332 color: var(--wui-color-success-100); 8333 } 8334 8335 :host([data-variant='error']) { 8336 background-color: var(--wui-icon-box-bg-error-100); 8337 color: var(--wui-color-error-100); 8338 } 8339 8340 :host([data-size='lg']) { 8341 padding: 11px 5px !important; 8342 } 8343 8344 :host([data-size='lg']) > wui-text { 8345 transform: translateY(2%); 8346 } 8347`;var eZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let aC=class extends ce{constructor(){super(...arguments),this.variant="main",this.size="lg"}render(){this.dataset.variant=this.variant,this.dataset.size=this.size;const t=this.size==="md"?"mini-700":"micro-700";return j` 8348 <wui-text data-variant=${this.variant} variant=${t} color="inherit"> 8349 <slot></slot> 8350 </wui-text> 8351 `}};aC.styles=[Qn,GLt];eZ([z()],aC.prototype,"variant",void 0);eZ([z()],aC.prototype,"size",void 0);aC=eZ([ct("wui-tag")],aC);const ZLt=Xe` 8352 button { 8353 column-gap: var(--wui-spacing-s); 8354 padding: 7px var(--wui-spacing-l) 7px var(--wui-spacing-xs); 8355 width: 100%; 8356 background-color: var(--wui-color-gray-glass-002); 8357 border-radius: var(--wui-border-radius-xs); 8358 color: var(--wui-color-fg-100); 8359 } 8360 8361 button > wui-text:nth-child(2) { 8362 display: flex; 8363 flex: 1; 8364 } 8365 8366 button:disabled { 8367 background-color: var(--wui-color-gray-glass-015); 8368 color: var(--wui-color-gray-glass-015); 8369 } 8370 8371 button:disabled > wui-tag { 8372 background-color: var(--wui-color-gray-glass-010); 8373 color: var(--wui-color-fg-300); 8374 } 8375 8376 wui-icon { 8377 color: var(--wui-color-fg-200) !important; 8378 } 8379`;var Oc=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Ro=class extends ce{constructor(){super(...arguments),this.walletImages=[],this.imageSrc="",this.name="",this.tabIdx=void 0,this.installed=!1,this.disabled=!1,this.showAllWallets=!1,this.loading=!1,this.loadingSpinnerColor="accent-100"}render(){return j` 8380 <button ?disabled=${this.disabled} tabindex=${ge(this.tabIdx)}> 8381 ${this.templateAllWallets()} ${this.templateWalletImage()} 8382 <wui-text variant="paragraph-500" color="inherit">${this.name}</wui-text> 8383 ${this.templateStatus()} 8384 </button> 8385 `}templateAllWallets(){return this.showAllWallets&&this.imageSrc?j` <wui-all-wallets-image .imageeSrc=${this.imageSrc}> </wui-all-wallets-image> `:this.showAllWallets&&this.walletIcon?j` <wui-wallet-image .walletIcon=${this.walletIcon} size="sm"> </wui-wallet-image> `:null}templateWalletImage(){return!this.showAllWallets&&this.imageSrc?j`<wui-wallet-image 8386 size="sm" 8387 imageSrc=${this.imageSrc} 8388 name=${this.name} 8389 .installed=${this.installed} 8390 ></wui-wallet-image>`:!this.showAllWallets&&!this.imageSrc?j`<wui-wallet-image size="sm" name=${this.name}></wui-wallet-image>`:null}templateStatus(){return this.loading?j`<wui-loading-spinner 8391 size="lg" 8392 color=${this.loadingSpinnerColor} 8393 ></wui-loading-spinner>`:this.tagLabel&&this.tagVariant?j`<wui-tag variant=${this.tagVariant}>${this.tagLabel}</wui-tag>`:this.icon?j`<wui-icon color="inherit" size="sm" name=${this.icon}></wui-icon>`:null}};Ro.styles=[Qn,oo,ZLt];Oc([z({type:Array})],Ro.prototype,"walletImages",void 0);Oc([z()],Ro.prototype,"imageSrc",void 0);Oc([z()],Ro.prototype,"name",void 0);Oc([z()],Ro.prototype,"tagLabel",void 0);Oc([z()],Ro.prototype,"tagVariant",void 0);Oc([z()],Ro.prototype,"icon",void 0);Oc([z()],Ro.prototype,"walletIcon",void 0);Oc([z()],Ro.prototype,"tabIdx",void 0);Oc([z({type:Boolean})],Ro.prototype,"installed",void 0);Oc([z({type:Boolean})],Ro.prototype,"disabled",void 0);Oc([z({type:Boolean})],Ro.prototype,"showAllWallets",void 0);Oc([z({type:Boolean})],Ro.prototype,"loading",void 0);Oc([z({type:String})],Ro.prototype,"loadingSpinnerColor",void 0);Ro=Oc([ct("wui-list-wallet")],Ro);var g3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Gy=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.count=ze.state.count,this.filteredCount=ze.state.filteredWallets.length,this.isFetchingRecommendedWallets=ze.state.isFetchingRecommendedWallets,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t),ze.subscribeKey("count",t=>this.count=t),ze.subscribeKey("filteredWallets",t=>this.filteredCount=t.length),ze.subscribeKey("isFetchingRecommendedWallets",t=>this.isFetchingRecommendedWallets=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=this.connectors.find(c=>c.id==="walletConnect"),{allWallets:n}=we.state;if(!t||n==="HIDE"||n==="ONLY_MOBILE"&&!Re.isMobile())return null;const r=ze.state.featured.length,s=this.count+r,i=s<10?s:Math.floor(s/10)*10,o=this.filteredCount>0?this.filteredCount:i;let a=`${o}`;return this.filteredCount>0?a=`${this.filteredCount}`:o<s&&(a=`${o}+`),j` 8394 <wui-list-wallet 8395 name="All Wallets" 8396 walletIcon="allWallets" 8397 showAllWallets 8398 @click=${this.onAllWallets.bind(this)} 8399 tagLabel=${a} 8400 tagVariant="shade" 8401 data-testid="all-wallets" 8402 tabIdx=${ge(this.tabIdx)} 8403 .loading=${this.isFetchingRecommendedWallets} 8404 loadingSpinnerColor=${this.isFetchingRecommendedWallets?"fg-300":"accent-100"} 8405 ></wui-list-wallet> 8406 `}onAllWallets(){bn.sendEvent({type:"track",event:"CLICK_ALL_WALLETS"}),Le.push("AllWallets")}};g3([z()],Gy.prototype,"tabIdx",void 0);g3([se()],Gy.prototype,"connectors",void 0);g3([se()],Gy.prototype,"count",void 0);g3([se()],Gy.prototype,"filteredCount",void 0);g3([se()],Gy.prototype,"isFetchingRecommendedWallets",void 0);Gy=g3([ct("w3m-all-wallets-widget")],Gy);var tZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let CN=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=this.connectors.filter(n=>n.type==="ANNOUNCED");return t!=null&&t.length?j` 8407 <wui-flex flexDirection="column" gap="xs"> 8408 ${t.filter(u0.showConnector).map(n=>j` 8409 <wui-list-wallet 8410 imageSrc=${ge(ti.getConnectorImage(n))} 8411 name=${n.name??"Unknown"} 8412 @click=${()=>this.onConnector(n)} 8413 tagVariant="success" 8414 tagLabel="installed" 8415 data-testid=${`wallet-selector-${n.id}`} 8416 .installed=${!0} 8417 tabIdx=${ge(this.tabIdx)} 8418 > 8419 </wui-list-wallet> 8420 `)} 8421 </wui-flex> 8422 `:(this.style.cssText="display: none",null)}onConnector(t){t.id==="walletConnect"?Re.isMobile()?Le.push("AllWallets"):Le.push("ConnectingWalletConnect"):Le.push("ConnectingExter
8422nal",{connector:t})}};tZ([z()],CN.prototype,"tabIdx",void 0);tZ([se()],CN.prototype,"connectors",void 0);CN=tZ([ct("w3m-connect-announced-widget")],CN);var DP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let cC=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.loading=!1,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t)),Re.isTelegram()&&Re.isIos()&&(this.loading=!He.state.wcUri,this.unsubscribe.push(He.subscribeKey("wcUri",t=>this.loading=!t)))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const{customWallets:t}=we.state;if(!(t!=null&&t.length))return this.style.cssText="display: none",null;const n=this.filterOutDuplicateWallets(t);return j`<wui-flex flexDirection="column" gap="xs"> 8423 ${n.map(r=>j` 8424 <wui-list-wallet 8425 imageSrc=${ge(ti.getWalletImage(r))} 8426 name=${r.name??"Unknown"} 8427 @click=${()=>this.onConnectWallet(r)} 8428 data-testid=${`wallet-selector-${r.id}`} 8429 tabIdx=${ge(this.tabIdx)} 8430 ?loading=${this.loading} 8431 > 8432 </wui-list-wallet> 8433 `)} 8434 </wui-flex>`}filterOutDuplicateWallets(t){const n=lt.getRecentWallets(),r=this.connectors.map(a=>{var c;return(c=a.info)==null?void 0:c.rdns}).filter(Boolean),s=n.map(a=>a.rdns).filter(Boolean),i=r.concat(s);if(i.includes("io.metamask.mobile")&&Re.isMobile()){const a=i.indexOf("io.metamask.mobile");i[a]="io.metamask"}return t.filter(a=>!i.includes(String(a==null?void 0:a.rdns)))}onConnectWallet(t){this.loading||Le.push("ConnectingWalletConnect",{wallet:t})}};DP([z()],cC.prototype,"tabIdx",void 0);DP([se()],cC.prototype,"connectors",void 0);DP([se()],cC.prototype,"loading",void 0);cC=DP([ct("w3m-connect-custom-widget")],cC);var nZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let $N=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const r=this.connectors.filter(s=>s.type==="EXTERNAL").filter(u0.showConnector).filter(s=>s.id!==$t.CONNECTOR_ID.COINBASE_SDK);return r!=null&&r.length?j` 8435 <wui-flex flexDirection="column" gap="xs"> 8436 ${r.map(s=>j` 8437 <wui-list-wallet 8438 imageSrc=${ge(ti.getConnectorImage(s))} 8439 .installed=${!0} 8440 name=${s.name??"Unknown"} 8441 data-testid=${`wallet-selector-external-${s.id}`} 8442 @click=${()=>this.onConnector(s)} 8443 tabIdx=${ge(this.tabIdx)} 8444 > 8445 </wui-list-wallet> 8446 `)} 8447 </wui-flex> 8448 `:(this.style.cssText="display: none",null)}onConnector(t){Le.push("ConnectingExternal",{connector:t})}};nZ([z()],$N.prototype,"tabIdx",void 0);nZ([se()],$N.prototype,"connectors",void 0);$N=nZ([ct("w3m-connect-external-widget")],$N);var rZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let xN=class extends ce{constructor(){super(...arguments),this.tabIdx=void 0,this.wallets=[]}render(){return this.wallets.length?j` 8449 <wui-flex flexDirection="column" gap="xs"> 8450 ${this.wallets.map(t=>j` 8451 <wui-list-wallet 8452 data-testid=${`wallet-selector-featured-${t.id}`} 8453 imageSrc=${ge(ti.getWalletImage(t))} 8454 name=${t.name??"Unknown"} 8455 @click=${()=>this.onConnectWallet(t)} 8456 tabIdx=${ge(this.tabIdx)} 8457 > 8458 </wui-list-wallet> 8459 `)} 8460 </wui-flex> 8461 `:(this.style.cssText="display: none",null)}onConnectWallet(t){Pe.selectWalletConnector(t)}};rZ([z()],xN.prototype,"tabIdx",void 0);rZ([z()],xN.prototype,"wallets",void 0);xN=rZ([ct("w3m-connect-featured-widget")],xN);var sZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let IN=class extends ce{constructor(){super(...arguments),this.tabIdx=void 0,this.connectors=[]}render(){const t=this.connectors.filter(u0.showConnector);return t.length===0?(this.style.cssText="display: none",null):j` 8462 <wui-flex flexDirection="column" gap="xs"> 8463 ${t.map(n=>j` 8464 <wui-list-wallet 8465 imageSrc=${ge(ti.getConnectorImage(n))} 8466 .installed=${!0} 8467 name=${n.name??"Unknown"} 8468 tagVariant="success" 8469 tagLabel="installed" 8470 data-testid=${`wallet-selector-${n.id}`} 8471 @click=${()=>this.onConnector(n)} 8472 tabIdx=${ge(this.tabIdx)} 8473 > 8474 </wui-list-wallet> 8475 `)} 8476 </wui-flex> 8477 `}onConnector(t){Pe.setActiveConnector(t),Le.push("ConnectingExter
8477nal",{connector:t})}};sZ([z()],IN.prototype,"tabIdx",void 0);sZ([z()],IN.prototype,"connectors",void 0);IN=sZ([ct("w3m-connect-injected-widget")],IN);var iZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let SN=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=this.connectors.filter(n=>n.type==="MULTI_CHAIN"&&n.name!=="WalletConnect");return t!=null&&t.length?j` 8478 <wui-flex flexDirection="column" gap="xs"> 8479 ${t.map(n=>j` 8480 <wui-list-wallet 8481 imageSrc=${ge(ti.getConnectorImage(n))} 8482 .installed=${!0} 8483 name=${n.name??"Unknown"} 8484 tagVariant="shade" 8485 tagLabel="multichain" 8486 data-testid=${`wallet-selector-${n.id}`} 8487 @click=${()=>this.onConnector(n)} 8488 tabIdx=${ge(this.tabIdx)} 8489 > 8490 </wui-list-wallet> 8491 `)} 8492 </wui-flex> 8493 `:(this.style.cssText="display: none",null)}onConnector(t){Pe.setActiveConnector(t),Le.push("ConnectingMultiChain")}};iZ([z()],SN.prototype,"tabIdx",void 0);iZ([se()],SN.prototype,"connectors",void 0);SN=iZ([ct("w3m-connect-multi-chain-widget")],SN);var UP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let lC=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.loading=!1,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t)),Re.isTelegram()&&Re.isIos()&&(this.loading=!He.state.wcUri,this.unsubscribe.push(He.subscribeKey("wcUri",t=>this.loading=!t)))}render(){const n=lt.getRecentWallets().filter(r=>!hy.isExcluded(r)).filter(r=>!this.hasWalletConnector(r)).filter(r=>this.isWalletCompatibleWithCurrentChain(r));return n.length?j` 8494 <wui-flex flexDirection="column" gap="xs"> 8495 ${n.map(r=>j` 8496 <wui-list-wallet 8497 imageSrc=${ge(ti.getWalletImage(r))} 8498 name=${r.name??"Unknown"} 8499 @click=${()=>this.onConnectWallet(r)} 8500 tagLabel="recent" 8501 tagVariant="shade" 8502 tabIdx=${ge(this.tabIdx)} 8503 ?loading=${this.loading} 8504 > 8505 </wui-list-wallet> 8506 `)} 8507 </wui-flex> 8508 `:(this.style.cssText="display: none",null)}onConnectWallet(t){this.loading||Pe.selectWalletConnector(t)}hasWalletConnector(t){return this.connectors.some(n=>n.id===t.id||n.name===t.name)}isWalletCompatibleWithCurrentChain(t){const n=J.state.activeChain;return n&&t.chains?t.chains.some(r=>{const s=r.split(":")[0];return n===s}):!0}};UP([z()],lC.prototype,"tabIdx",void 0);UP([se()],lC.prototype,"connectors",void 0);UP([se()],lC.prototype,"loading",void 0);lC=UP([ct("w3m-connect-recent-widget")],lC);var LP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let uC=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.wallets=[],this.loading=!1,Re.isTelegram()&&Re.isIos()&&(this.loading=!He.state.wcUri,this.unsubscribe.push(He.subscribeKey("wcUri",t=>this.loading=!t)))}render(){const{connectors:t}=Pe.state,{customWallets:n,featuredWalletIds:r}=we.state,s=lt.getRecentWallets(),i=t.find(d=>d.id==="walletConnect"),a=t.filter(d=>d.type==="INJECTED"||d.type==="ANNOUNCED"||d.type==="MULTI_CHAIN").filter(d=>d.name!=="Browser Wallet");if(!i)return null;if(r||n||!this.wallets.length)return this.style.cssText="display: none",null;const c=a.length+s.length,l=Math.max(0,2-c),u=hy.filterOutDuplicateWallets(this.wallets).slice(0,l);return u.length?j` 8509 <wui-flex flexDirection="column" gap="xs"> 8510 ${u.map(d=>j` 8511 <wui-list-wallet 8512 imageSrc=${ge(ti.getWalletImage(d))}
8513 name=${(d==null?void 0:d.name)??"Unknown"} 8514 @click=${()=>this.onConnectWallet(d)} 8515 tabIdx=${ge(this.tabIdx)} 8516 ?loading=${this.loading} 8517 > 8518 </wui-list-wallet> 8519 `)} 8520 </wui-flex> 8521 `:(this.style.cssText="display: none",null)}onConnectWallet(t){if(this.loading)return;const n=Pe.getConnector(t.id,t.rdns);n?Le.push("ConnectingExternal",{connector:n}):Le.push("ConnectingWalletConnect",{wallet:t})}};LP([z()],uC.prototype,"tabIdx",void 0);LP([z()],uC.prototype,"wallets",void 0);LP([se()],uC.prototype,"loading",void 0);uC=LP([ct("w3m-connect-recommended-widget")],uC);var MP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let dC=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.connectorImages=oc.state.connectorImages,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t),oc.subscribeKey("connectorImages",t=>this.connectorImages=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){if(Re.isMobile())return this.style.cssText="display: none",null;const t=this.connectors.find(r=>r.id==="walletConnect");if(!t)return this.style.cssText="display: none",null;const n=t.imageUrl||this.connectorImages[(t==null?void 0:t.imageId)??""];return j` 8522 <wui-list-wallet 8523 imageSrc=${ge(n)} 8524 name=${t.name??"Unknown"} 8525 @click=${()=>this.onConnector(t)} 8526 tagLabel="qr code" 8527 tagVariant="main" 8528 tabIdx=${ge(this.tabIdx)} 8529 data-testid="wallet-selector-walletconnect" 8530 > 8531 </wui-list-wallet> 8532 `}onConnector(t){Pe.setActiveConnector(t),Le.push("ConnectingWalletConnect")}};MP([z()],dC.prototype,"tabIdx",void 0);MP([se()],dC.prototype,"connectors",void 0);MP([se()],dC.prototype,"connectorImages",void 0);dC=MP([ct("w3m-connect-walletconnect-widget")],dC);const YLt=Xe` 8533 :host { 8534 margin-top: var(--wui-spacing-3xs); 8535 } 8536 wui-separator { 8537 margin: var(--wui-spacing-m) calc(var(--wui-spacing-m) * -1) var(--wui-spacing-xs) 8538 calc(var(--wui-spacing-m) * -1); 8539 width: calc(100% + var(--wui-spacing-s) * 2); 8540 } 8541`;var cx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Zy=class extends ce{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=Pe.state.connectors,this.recommended=ze.state.recommended,this.featured=ze.state.featured,this.unsubscribe.push(Pe.subscribeKey("connectors",t=>this.connectors=t),ze.subscribeKey("recommended",t=>this.recommended=t),ze.subscribeKey("featured",t=>this.featured=t))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return j` 8542 <wui-flex flexDirection="column" gap="xs"> ${this.connectorListTemplate()} </wui-flex> 8543 `}connectorListTemplate(){const{custom:t,recent:n,announced:r,injected:s,multiChain:i,recommended:o,featured:a,external:c}=u0.getConnectorsByType(this.connectors,this.recommended,this.featured);return u0.getConnectorTypeOrder({custom:t,recent:n,announced:r,injected:s,multiChain:i,recommended:o,featured:a,external:c}).map(u=>{switch(u){case"injected":return j` 8544 ${i.length?j`<w3m-connect-multi-chain-widget 8545 tabIdx=${ge(this.tabIdx)} 8546 ></w3m-connect-multi-chain-widget>`:null} 8547 ${r.length?j`<w3m-connect-announced-widget 8548 tabIdx=${ge(this.tabIdx)} 8549 ></w3m-connect-announced-widget>`:null} 8550 ${s.length?j`<w3m-connect-injected-widget 8551 .connectors=${s} 8552 tabIdx=${ge(this.tabIdx)} 8553 ></w3m-connect-injected-widget>`:null} 8554 `;case"walletConnect":return j`<w3m-connect-walletconnect-widget 8555 tabIdx=${ge(this.tabIdx)} 8556 ></w3m-connect-walletconnect-widget>`;case"recent":return j`<w3m-connect-recent-widget 8557 tabIdx=${ge(this.tabIdx)} 8558 ></w3m-connect-recent-widget>`;case"featured":return j`<w3m-connect-featured-widget 8559 .wallets=${a} 8560 tabIdx=${ge(this.tabIdx)} 8561 ></w3m-connect-featured-widget>`;
8561case"custom":return j`<w3m-connect-custom-widget 8562 tabIdx=${ge(this.tabIdx)} 8563 ></w3m-connect-custom-widget>`;case"external":return j`<w3m-connect-external-widget 8564 tabIdx=${ge(this.tabIdx)} 8565 ></w3m-connect-external-widget>`;case"recommended":return j`<w3m-connect-recommended-widget 8566 .wallets=${o} 8567 tabIdx=${ge(this.tabIdx)} 8568 ></w3m-connect-recommended-widget>`;default:return console.warn(`Unknown connector type: ${u}`),null}})}};Zy.styles=YLt;cx([z()],Zy.prototype,"tabIdx",void 0);cx([se()],Zy.prototype,"connectors",void 0);cx([se()],Zy.prototype,"recommended",void 0);cx([se()],Zy.prototype,"featured",void 0);Zy=cx([ct("w3m-connector-list")],Zy);const JLt=Xe` 8569 :host { 8570 display: inline-flex; 8571 background-color: var(--wui-color-gray-glass-002); 8572 border-radius: var(--wui-border-radius-3xl); 8573 padding: var(--wui-spacing-3xs); 8574 position: relative; 8575 height: 36px; 8576 min-height: 36px; 8577 overflow: hidden; 8578 } 8579 8580 :host::before { 8581 content: ''; 8582 position: absolute; 8583 pointer-events: none; 8584 top: 4px; 8585 left: 4px; 8586 display: block; 8587 width: var(--local-tab-width); 8588 height: 28px; 8589 border-radius: var(--wui-border-radius-3xl); 8590 background-color: var(--wui-color-gray-glass-002); 8591 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); 8592 transform: translateX(calc(var(--local-tab) * var(--local-tab-width))); 8593 transition: transform var(--wui-ease-out-power-1) var(--wui-duration-md); 8594 will-change: background-color, opacity; 8595 } 8596 8597 :host([data-type='flex'])::before { 8598 left: 3px; 8599 transform: translateX(calc((var(--local-tab) * 34px) + (var(--local-tab) * 4px))); 8600 } 8601 8602 :host([data-type='flex']) { 8603 display: flex; 8604 padding: 0px 0px 0px 12px; 8605 gap: 4px; 8606 } 8607 8608 :host([data-type='flex']) > button > wui-text { 8609 position: absolute; 8610 left: 18px; 8611 opacity: 0; 8612 } 8613 8614 button[data-active='true'] > wui-icon, 8615 button[data-active='true'] > wui-text { 8616 color: var(--wui-color-fg-100); 8617 } 8618 8619 button[data-active='false'] > wui-icon, 8620 button[data-active='false'] > wui-text { 8621 color: var(--wui-color-fg-200); 8622 } 8623 8624 button[data-active='true']:disabled, 8625 button[data-active='false']:disabled { 8626 background-color: transparent; 8627 opacity: 0.5; 8628 cursor: not-allowed; 8629 } 8630 8631 button[data-active='true']:disabled > wui-text { 8632 color: var(--wui-color-fg-200); 8633 } 8634 8635 button[data-active='false']:disabled > wui-text { 8636 color: var(--wui-color-fg-300); 8637 } 8638 8639 button > wui-icon, 8640 button > wui-text { 8641 pointer-events: none; 8642 transition: color var(--wui-e ase-out-power-1) var(--wui-duration-md); 8643 will-change: color; 8644 } 8645 8646 button { 8647 width: var(--local-tab-width); 8648 transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); 8649 will-change: background-color; 8650 } 8651 8652 :host([data-type='flex']) > button { 8653 width: 34px; 8654 position: relative; 8655 display: flex; 8656 justify-content: flex-start; 8657 } 8658 8659 button:hover:enabled, 8660 button:active:enabled { 8661 background-color: transparent !important; 8662 } 8663 8664 button:hover:enabled > wui-icon, 8665 button:active:enabled > wui-icon { 8666 transition: all var(--wui-ease-out-power-1) var(--wui-duration-lg); 8667 color: var(--wui-color-fg-125); 8668 } 8669 8670 button:hover:enabled > wui-text, 8671 button:active:enabled > wui-text { 8672 transition: all var(--wui-ease-out-power-1) var(--wui-duration-lg); 8673 color: var(--wui-color-fg-125); 8674 } 8675 8676 button { 8677 border-radius: var(--wui-border-radius-3xl); 8678 } 8679`;var $1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let gf=class extends ce{constructor(){super(...arguments),this.tabs=[],this.onTabChange=()=>null,this.buttons=[],this.disabled=!1,this.localTabWidth="100px",this.activeTab=0,this.isDense=!1}render(){return this.isDense=this.tabs.length>3,this.style.cssText=` 8680 --local-tab: ${this.activeTab}; 8681 --local-tab-width: ${this.localTabWidth}; 8682 `,this.dataset.type=this.isDense?"flex":"block",this.tabs.map((t,n)=>{var s;const r=n===this.activeTab;return j` 8683 <button 8684 ?disabled=${this.disabled} 8685 @click=${()=>this.onTabClick(n)} 8686 data-active=${r} 8687 data-testid="tab-${(s=t.label)==null?void 0:s.toLowerCase()}" 8688 > 8689 ${this.iconTemplate(t)}
8689 8690 <wui-text variant="small-600" color="inherit"> ${t.label} </wui-text> 8691 </button> 8692 `})}firstUpdated(){this.shadowRoot&&this.isDense&&(this.buttons=[...this.shadowRoot.querySelectorAll("button")],setTimeout(()=>{this.animateTabs(0,!0)},0))}iconTemplate(t){return t.icon?j`<wui-icon size="xs" color="inherit" name=${t.icon}></wui-icon>`:null}onTabClick(t){this.buttons&&this.animateTabs(t,!1),this.activeTab=t,this.onTabChange(t)}animateTabs(t,n){const r=this.buttons[this.activeTab],s=this.buttons[t],i=r==null?void 0:r.querySelector("wui-text"),o=s==null?void 0:s.querySelector("wui-text"),a=s==null?void 0:s.getBoundingClientRect(),c=o==null?void 0:o.getBoundingClientRect();r&&i&&!n&&t!==this.activeTab&&(i.animate([{opacity:0}],{duration:50,easing:"ease",fill:"forwards"}),r.animate([{width:"34px"}],{duration:500,easing:"ease",fill:"forwards"})),s&&a&&c&&o&&(t!==this.activeTab||n)&&(this.localTabWidth=`${Math.round(a.width+c.width)+6}px`,s.animate([{width:`${a.width+c.width}px`}],{duration:n?0:500,fill:"forwards",easing:"ease"}),o.animate([{opacity:1}],{duration:n?0:125,delay:n?0:200,fill:"forwards",easing:"ease"}))}};gf.styles=[Qn,oo,JLt];$1([z({type:Array})],gf.prototype,"tabs",void 0);$1([z()],gf.prototype,"onTabChange",void 0);$1([z({type:Array})],gf.prototype,"buttons",void 0);$1([z({type:Boolean})],gf.prototype,"disabled",void 0);$1([z()],gf.prototype,"localTabWidth",void 0);$1([se()],gf.prototype,"activeTab",void 0);$1([se()],gf.prototype,"isDense",void 0);gf=$1([ct("wui-tabs")],gf);var oZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let AN=class extends ce{constructor(){super(...arguments),this.platformTabs=[],this.unsubscribe=[],this.platforms=[],this.onSelectPlatfrom=void 0}disconnectCallback(){this.unsubscribe.forEach(t=>t())}render(){const t=this.generateTabs();return j` 8693 <wui-flex justifyContent="center" .padding=${["0","0","l","0"]}> 8694 <wui-tabs .tabs=${t} .onTabChange=${this.onTabChange.bind(this)}></wui-tabs> 8695 </wui-flex> 8696 `}generateTabs(){const t=this.platforms.map(n=>n==="browser"?{label:"Browser",icon:"extension",platform:"browser"}:n==="mobile"?{label:"Mobile",icon:"mobile",platform:"mobile"}:n==="qrcode"?{label:"Mobile",icon:"mobile",platform:"qrcode"}:n==="web"?{label:"Webapp",icon:"browser",platform:"web"}:n==="desktop"?{label:"Desktop",icon:"desktop",platform:"desktop"}:{label:"Browser",icon:"extension",platform:"unsupported"});return this.platformTabs=t.map(({platform:n})=>n),t}onTabChange(t){var r;const n=this.platformTabs[t];n&&((r=this.onSelectPlatfrom)==null||r.call(this,n))}};oZ([z({type:Array})],AN.prototype,"platforms",void 0);oZ([z()],AN.prototype,"onSelectPlatfrom",void 0);AN=oZ([ct("w3m-connecting-header")],AN);const XLt=Xe` 8697 :host { 8698 display: flex; 8699 } 8700 8701 :host([data-size='sm']) > svg { 8702 width: 12px; 8703 height: 12px; 8704 } 8705 8706 :host([data-size='md']) > svg { 8707 width: 16px; 8708 height: 16px; 8709 } 8710 8711 :host([data-size='lg']) > svg { 8712 width: 24px; 8713 height: 24px; 8714 } 8715 8716 :host([data-size='xl']) > svg { 8717 width: 32px; 8718 height: 32px; 8719 } 8720 8721 svg { 8722 animation: rotate 2s linear infinite; 8723 } 8724 8725 circle { 8726 fill: none; 8727 stroke: var(--local-color); 8728 stroke-width: 4px; 8729 stroke-dasharray: 1, 124; 8730 stroke-dashoffset: 0; 8731 stroke-linecap: round; 8732 animation: dash 1.5s ease-in-out infinite; 8733 } 8734 8735 :host([data-size='md']) > svg > circle { 8736 stroke-width: 6px; 8737 } 8738 8739 :host([data-size='sm']) > svg > circle { 8740 stroke-width: 8px; 8741 } 8742 8743 @keyframes rotate { 8744 100% { 8745 transform: rotate(360deg); 8746 } 8747 } 8748 8749 @keyframes dash { 8750 0% { 8751 stroke-dasharray: 1, 124; 8752 stroke-dashoffset: 0; 8753 } 8754 8755 50% { 8756 stroke-dasharray: 90, 124; 8757 stroke-dashoffset: -35; 8758 } 8759 8760 100% { 8761 stroke-dashoffset: -125; 8762 } 8763 } 8764`;var aZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let hC=class extends ce{constructor(){super(...arguments),this.color="accent-100",this.size="lg"}render(){return this.style.cssText=`--local-color: ${this.color==="inherit"?"inherit":`var(--wui-color-${this.color})`}`,this.dataset.size=this.size,j`<svg viewBox="25 25 50 50"> 8765 <circle r="20" cy="50" cx="50"></circle> 8766 </svg>`}};hC.styles=[Qn,XLt];aZ([z()],hC.prototype,"color",void 0);aZ([z()],hC.prototype,"size",void 0);hC=aZ([ct("wui-loading-spinner")],hC);const QLt=Xe` 8767 :host { 8768 width: var(--local-width); 8769 position: relative; 8770 } 8771 8772 button { 8773 border: none; 8774 border-radius: var(--local-border-radius); 8775 width: var(--local-width); 8776 white-space: nowrap; 8777 } 8778 8779 /* -- Sizes --------------------------------------------------- */ 8780 button[data-size='md'] { 8781 padding: 8.2px var(--wui-spacing-l) 9px var(--wui-spacing-l); 8782 height: 36px; 8783 } 8784 8785 button[data-size='md'][data-icon-left='true'][data-icon-right='false'] { 8786 padding: 8.2px var(--wui-spacing-l) 9px var(--wui-spacing-s); 8787 } 8788 8789 button[data-size='md'][data-icon-right='true'][data-icon-left='false'] { 8790 padding: 8.2px var(--wui-spacing-s) 9px var(--wui-spacing-l); 8791 } 8792 8793 button[data-size='lg'] { 8794 padding: var(--wui-spacing-m) var(--wui-spacing-2l); 8795 height: 48px; 8796 } 8797 8798 /* -- Variants --------------------------------------------------------- */ 8799 button[data-variant='main'] { 8800 background-color: var(--wui-color-accent-100); 8801 color: var(--wui-color-inverse-100); 8802 border: none; 8803 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); 8804 } 8805 8806 button[data-variant='inverse'] { 8807 background-color: var(--wui-color-inverse-100); 8808 color: var(--wui-color-inverse-000); 8809 border: none; 8810 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); 8811 } 8812 8813 button[data-variant='accent'] { 8814 background-color: var(--wui-color-accent-glass-010); 8815 color: var(--wui-color-accent-100); 8816 border: none; 8817 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 8818 } 8819 8820 button[data-variant='accent-error'] { 8821 background: var(--wui-color-error-glass-015); 8822 color: var(--wui-color-error-100); 8823 border: none; 8824 box-shadow: inset 0 0 0 1px var(--wui-color-error-glass-010); 8825 } 8826 8827 button[data-variant='accent-success'] { 8828 background: var(--wui-color-success-glass-015); 8829 color: var(--wui-color-success-100); 8830 border: none; 8831 box-shadow: inset 0 0 0 1px var(--wui-color-success-glass-010); 8832 } 8833 8834 button[data-variant='neutral'] { 8835 background: transparent; 8836 color: var(--wui-color-fg-100); 8837 border: none; 8838 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 8839 } 8840 8841 /* -- Focus states --------------------------------------------------- */ 8842 button[data-variant='main']:focus-visible:enabled { 8843 background-color: var(--wui-color-accent-090); 8844 box-shadow: 8845 inset 0 0 0 1px var(--wui-color-accent-100), 8846 0 0 0 4px var(--wui-color-accent-glass-020); 8847 } 8848 button[data-variant='inverse']:focus-visible:enabled { 8849 background-color: var(--wui-color-inverse-100); 8850 box-shadow: 8851 inset 0 0 0 1px var(--wui-color-gray-glass-010), 8852 0 0 0 4px var(--wui-color-accent-glass-020); 8853 } 8854 button[data-variant='accent']:focus-visible:enabled { 8855 background-color: var(--wui-color-accent-glass-010); 8856 box-shadow: 8857 inset 0 0 0 1px var(--wui-color-accent-100), 8858 0 0 0 4px var(--wui-color-accent-glass-020); 8859 } 8860 button[data-variant='accent-error']:focus-visible:enabled { 8861 background: var(--wui-color-error-glass-015); 8862 box-shadow: 8863 inset 0 0 0 1px var(--wui-color-error-100), 8864 0 0 0 4px var(--wui-color-error-glass-020); 8865 } 8866 button[data-variant='accent-success']:focus-visible:enabled { 8867 background: var(--wui-color-success-glass-015); 8868 box-shadow: 8869 inset 0 0 0 1px var(--wui-color-success-100), 8870 0 0 0 4px var(--wui-color-success-glass-020); 8871 } 8872 button[data-variant='neutral']:focus-visible:enabled { 8873 background: var(--wui-color-gray-glass-005); 8874 box-shadow: 8875 inset 0 0 0 1px var(--wui-color-gray-glass-010), 8876 0 0 0 4px var(--wui-color-gray-glass-002); 8877 } 8878 8879 /* -- Hover & Active states ----------------------------------------------------------- */ 8880 @media (hover: hover) and (pointer: fine) { 8881 button[data-variant='main']:hover:enabled { 8882 background-color: var(--wui-color-accent-090); 8883 } 8884 8885 button[data-variant='main']:active:enabled { 8886 background-color: var(--wui-color-accent-080); 8887 } 8888 8889 button[data-variant='accent']:hover:enabled { 8890 background-color: var(--wui-color-accent-glass-015); 8891 } 8892 8893 button[data-variant='accent']:active:enabled { 8894 background-color: var(--wui-color-accent-glass-020); 8895 } 8896 8897 button[data-variant='accent-error']:hover:enabled { 8898 background: var(--wui-color-error-glass-020); 8899 color: var(--wui-color-error-100); 8900 } 8901 8902 button[data-variant='accent-error']:active:enabled { 8903 background: var(--wui-color-error-glass-030); 8904 color: var(--wui-color-error-100); 8905 } 8906 8907 button[data-variant='accent-success']:hover:enabled { 8908 background: var(--wui-color-success-glass-020); 8909 color: var(--wui-color-success-100); 8910 } 8911 8912 button[data-variant='accent-success']:active:enabled { 8913 background: var(--wui-color-success-glass-030); 8914 color: var(--wui-color-success-100); 8915 } 8916 8917 button[data-variant='neutral']:hover:enabled { 8918 background: var(--wui-color-gray-glass-002); 8919 } 8920 8921 button[data-variant='neutral']:active:enabled { 8922 background: var(--wui-color-gray-glass-005); 8923 } 8924 8925 button[data-size='lg'][data-icon-left='true'][data-icon-right='false'] { 8926 padding-left: var(--wui-spacing-m); 8927 } 8928 8929 button[data-size='lg'][data-icon-right='true'][data-icon-left='false'] { 8930 padding-right: var(--wui-spacing-m); 8931 } 8932 } 8933 8934 /* -- Disabled state --------------------------------------------------- */ 8935 button:disabled { 8936 background-color: var(--wui-color-gray-glass-002); 8937 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); 8938 color: var(--wui-color-gray-glass-020);
8939 cursor: not-allowed; 8940 } 8941 8942 button > wui-text { 8943 transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); 8944 will-change: opacity; 8945 opacity: var(--local-opacity-100); 8946 } 8947 8948 ::slotted(*) { 8949 transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); 8950 will-change: opacity; 8951 opacity: var(--local-opacity-100); 8952 } 8953 8954 wui-loading-spinner { 8955 position: absolute; 8956 left: 50%; 8957 top: 50%; 8958 transform: translate(-50%, -50%); 8959 opacity: var(--local-opacity-000); 8960 } 8961`;var If=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const ile={main:"inverse-100",inverse:"inverse-000",accent:"accent-100","accent-error":"error-100","accent-success":"success-100",neutral:"fg-100",disabled:"gray-glass-020"},eMt={lg:"paragraph-600",md:"small-600"},tMt={lg:"md",md:"md"};let ku=class extends ce{constructor(){super(...arguments),this.size="lg",this.disabled=!1,this.fullWidth=!1,this.loading=!1,this.variant="main",this.hasIconLeft=!1,this.hasIconRight=!1,this.borderRadius="m"}render(){this.style.cssText=` 8962 --local-width: ${this.fullWidth?"100%":"auto"}; 8963 --local-opacity-100: ${this.loading?0:1}; 8964 --local-opacity-000: ${this.loading?1:0}; 8965 --local-border-radius: var(--wui-border-radius-${this.borderRadius}); 8966 `;const t=this.textVariant??eMt[this.size];return j` 8967 <button 8968 data-variant=${this.variant} 8969 data-icon-left=${this.hasIconLeft} 8970 data-icon-right=${this.hasIconRight} 8971 data-size=${this.size} 8972 ?disabled=${this.disabled} 8973 > 8974 ${this.loadingTemplate()} 8975 <slot name="iconLeft" @slotchange=${()=>this.handleSlotLeftChange()}></slot> 8976 <wui-text variant=${t} color="inherit"> 8977 <slot></slot> 8978 </wui-text> 8979 <slot name="iconRight" @slotchange=${()=>this.handleSlotRightChange()}></slot> 8980 </button> 8981 `}handleSlotLeftChange(){this.hasIconLeft=!0}handleSlotRightChange(){this.hasIconRight=!0}loadingTemplate(){if(this.loading){const t=tMt[this.size],n=this.disabled?ile.disabled:ile[this.variant];return j`<wui-loading-spinner color=${n} size=${t}></wui-loading-spinner>`}return j``}};ku.styles=[Qn,oo,QLt];If([z()],ku.prototype,"size",void 0);If([z({type:Boolean})],ku.prototype,"disabled",void 0);If([z({type:Boolean})],ku.prototype,"fullWidth",void 0);If([z({type:Boolean})],ku.prototype,"loading",void 0);If([z()],ku.prototype,"variant",void 0);If([z({type:Boolean})],ku.prototype,"hasIconLeft",void 0);If([z({type:Boolean})],ku.prototype,"hasIconRight",void 0);If([z()],ku.prototype,"borderRadius",void 0);If([z()],ku.prototype,"textVariant",void 0);ku=If([ct("wui-button")],ku);const nMt=Xe` 8982 button { 8983 padding: var(--wui-spacing-4xs) var(--wui-spacing-xxs); 8984 border-radius: var(--wui-border-radius-3xs); 8985 background-color: transparent; 8986 color: var(--wui-color-accent-100); 8987 } 8988 8989 button:disabled { 8990 background-color: transparent; 8991 color: var(--wui-color-gray-glass-015); 8992 } 8993 8994 button:hover { 8995 background-color: var(--wui-color-gray-glass-005); 8996 } 8997`;var jP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let d6=class extends ce{constructor(){super(...arguments),this.tabIdx=void 0,this.disabled=!1,this.color="inherit"}render(){return j` 8998 <button ?disabled=${this.disabled} tabindex=${ge(this.tabIdx)}> 8999 <slot name="iconLeft"></slot> 9000 <wui-text variant="small-600" color=${this.color}> 9001 <slot></slot> 9002 </wui-text> 9003 <slot name="iconRight"></slot> 9004 </button> 9005 `}};d6.styles=[Qn,oo,nMt];jP([z()],d6.prototype,"tabIdx",void 0);jP([z({type:Boolean})],d6.prototype,"disabled",void 0);jP([z()],d6.prototype,"color",void 0);d6=jP([ct("wui-link")],d6);const rMt=Xe` 9006 :host { 9007 display: block; 9008 width: var(--wui-box-size-md); 9009 height: var(--wui-box-size-md); 9010 } 9011 9012 svg { 9013 width: var(--wui-box-size-md); 9014 height: var(--wui-box-size-md); 9015 } 9016 9017 rect { 9018 fill: none; 9019 stroke: var(--wui-color-accent-100); 9020 stroke-width: 4px; 9021 stroke-linecap: round; 9022 animation: dash 1s linear infinite; 9023 } 9024 9025 @keyframes dash { 9026 to { 9027 stroke-dashoffset: 0px; 9028 } 9029 } 9030`;var s$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let _N=class extends ce{constructor(){super(...arguments),this.radius=36}render(){return this.svgLoaderTemplate()}svgLoaderTemplate(){const t=this.radius>50?50:this.radius,r=36-t,s=116+r,i=245+r,o=360+r*1.75;return j` 9031 <svg viewBox="0 0 110 110" width="110" height="110"> 9032 <rect 9033 x="2" 9034 y="2" 9035 width="106" 9036 height="106" 9037 rx=${t} 9038 stroke-dasharray="${s} ${i}" 9039 stroke-dashoffset=${o} 9040 /> 9041 </svg> 9042 `}};_N.styles=[Qn,rMt];s$e([z({type:Number})],_N.prototype,"radius",void 0);_N=s$e([ct("wui-loading-thumbnail")],_N);const sMt=Xe` 9043 button { 9044 border: none; 9045 border-radius: var(--wui-border-radius-3xl); 9046 } 9047 9048 button[data-variant='main'] { 9049 background-color: var(--wui-color-accent-100); 9050 color: var(--wui-color-inverse-100); 9051 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); 9052 } 9053 9054 button[data-variant='accent'] { 9055 background-color: var(--wui-color-accent-glass-010); 9056 color: var(--wui-color-accent-100); 9057 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 9058 } 9059 9060 button[data-variant='gray'] { 9061 background-color: transparent; 9062 color: var(--wui-color-fg-200); 9063 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); 9064 } 9065 9066 button[data-variant='shade'] { 9067 background-color: transparent; 9068 color: var(--wui-color-accent-100); 9069 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); 9070 } 9071 9072 button[data-size='sm'] { 9073 height: 32px; 9074 padding: 0 var(--wui-spacing-s); 9075 } 9076 9077 button[data-size='md'] { 9078 height: 40px; 9079 padding: 0 var(--wui-spacing-l); 9080 } 9081 9082 button[data-size='sm'] > wui-image { 9083 width: 16px; 9084 height: 16px; 9085 } 9086 9087 button[data-size='md'] > wui-image { 9088 width: 24px; 9089 height: 24px; 9090 } 9091 9092 button[data-size='sm'] > wui-icon { 9093 width: 12px; 9094 height: 12px; 9095 } 9096 9097 button[data-size='md'] > wui-icon { 9098 width: 14px; 9099 height: 14px; 9100 } 9101 9102 wui-image { 9103 border-radius: var(--wui-border-radius-3xl); 9104 overflow: hidden; 9105 } 9106 9107 button.disabled > wui-icon, 9108 button.disabled > wui-image { 9109 filter: grayscale(1); 9110 } 9111 9112 button[data-variant='main'] > wui-image { 9113 box-shadow: inset 0 0 0 1px var(--wui-color-accent-090); 9114 } 9115 9116 button[data-variant='shade'] > wui-image, 9117 button[data-variant='gray'] > wui-image { 9118 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-010); 9119 } 9120 9121 @media (hover: hover) and (pointer: fine) { 9122 button[data-variant='main']:focus-visible { 9123 background-color: var(--wui-color-accent-090); 9124 } 9125 9126 button[data-variant='main']:hover:enabled { 9127 background-color: var(--wui-color-accent-090); 9128 } 9129 9130 button[data-variant='main']:active:enabled { 9131 background-color: var(--wui-color-accent-080); 9132 } 9133 9134 button[data-variant='accent']:hover:enabled { 9135 background-color: var(--wui-color-accent-glass-015); 9136 } 9137 9138 button[data-variant='accent']:active:enabled { 9139 background-color: var(--wui-color-accent-glass-020); 9140 } 9141 9142 button[data-variant='shade']:focus-visible, 9143 button[data-variant='gray']:focus-visible, 9144 button[data-variant='shade']:hover, 9145 button[data-variant='gray']:hover { 9146 background-color: var(--wui-color-gray-glass-002); 9147 } 9148 9149 button[data-variant='gray']:active, 9150 button[data-variant='shade']:active { 9151 background-color: var(--wui-color-gray-glass-005); 9152 } 9153 } 9154 9155 button.disabled { 9156 color: var(--wui-color-gray-glass-020); 9157 background-color: var(--wui-color-gray-glass-002); 9158 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); 9159 pointer-events: none; 9160 } 9161`;var Mb=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let B0=class extends ce{constructor(){super(...arguments),this.variant="accent",this.imageSrc="",this.disabled=!1,this.icon="externalLink",this.size="md",this.text=""}render(){const t=this.size==="sm"?"small-600":"paragraph-600";return j` 9162 <button 9163 class=${this.disabled?"disabled":""} 9164 data-variant=${this.variant} 9165 data-size=${this.size} 9166 > 9167 ${this.imageSrc?j`<wui-image src=${this.imageSrc}></wui-image>`:null} 9168 <wui-text variant=${t} color="inherit"> ${this.text} </wui-text> 9169 <wui-icon name=${this.icon} color="inherit" size="inherit"></wui-icon> 9170 </button> 9171 `}};B0.styles=[Qn,oo,sMt];Mb([z()],B0.prototype,"variant",void 0);Mb([z()],B0.prototype,"imageSrc",void 0);Mb([z({type:Boolean})],B0.prototype,"disabled",void 0);Mb([z()],B0.prototype,"icon",void 0);Mb([z()],B0.prototype,"size",void 0);Mb([z()],B0.prototype,"text",void 0);B0=Mb([ct("wui-chip-button")],B0);const iMt=Xe` 9172 wui-flex { 9173 width: 100%; 9174 background-color: var(--wui-color-gray-glass-002); 9175 border-radius: var(--wui-border-radius-xs); 9176 } 9177`;var FP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let h6=class extends ce{constructor(){super(...arguments),this.disabled=!1,this.label="",this.buttonLabel=""}render(){return j` 9178 <wui-flex 9179 justifyContent="space-between" 9180 alignItems="center" 9181 .padding=${["1xs","2l","1xs","2l"]} 9182 > 9183 <wui-text variant="paragraph-500" color="fg-200">${this.label}</wui-text> 9184 <wui-chip-button size="sm" variant="shade" text=${this.buttonLabel} icon="chevronRight"> 9185 </wui-chip-button>
9185 9186 </wui-flex> 9187 `}};h6.styles=[Qn,oo,iMt];FP([z({type:Boolean})],h6.prototype,"disabled",void 0);FP([z()],h6.prototype,"label",void 0);FP([z()],h6.prototype,"buttonLabel",void 0);h6=FP([ct("wui-cta-button")],h6);const oMt=Xe` 9188 :host { 9189 display: block; 9190 padding: 0 var(--wui-spacing-xl) var(--wui-spacing-xl); 9191 } 9192`;var i$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let NN=class extends ce{constructor(){super(...arguments),this.wallet=void 0}render(){if(!this.wallet)return this.style.display="none",null;const{name:t,app_store:n,play_store:r,chrome_store:s,homepage:i}=this.wallet,o=Re.isMobile(),a=Re.isIos(),c=Re.isAndroid(),l=[n,r,i,s].filter(Boolean).length>1,u=yi.getTruncateString({string:t,charsStart:12,charsEnd:0,truncate:"end"});return l&&!o?j` 9193 <wui-cta-button 9194 label=${`Don't have ${u}?`} 9195 buttonLabel="Get" 9196 @click=${()=>Le.push("Downloads",{wallet:this.wallet})} 9197 ></wui-cta-button> 9198 `:!l&&i?j` 9199 <wui-cta-button 9200 label=${`Don't have ${u}?`} 9201 buttonLabel="Get" 9202 @click=${this.onHomePage.bind(this)} 9203 ></wui-cta-button> 9204 `:n&&a?j` 9205 <wui-cta-button 9206 label=${`Don't have ${u}?`} 9207 buttonLabel="Get" 9208 @click=${this.onAppStore.bind(this)} 9209 ></wui-cta-button> 9210 `:r&&c?j` 9211 <wui-cta-button 9212 label=${`Don't have ${u}?`} 9213 buttonLabel="Get" 9214 @click=${this.onPlayStore.bind(this)} 9215 ></wui-cta-button> 9216 `:(this.style.display="none",null)}onAppStore(){var t;(t=this.wallet)!=null&&t.app_store&&Re.openHref(this.wallet.app_store,"_blank")}onPlayStore(){var t;(t=this.wallet)!=null&&t.play_store&&Re.openHref(this.wallet.play_store,"_blank")}onHomePage(){var t;(t=this.wallet)!=null&&t.homepage&&Re.openHref(this.wallet.homepage,"_blank")}};NN.styles=[oMt];i$e([z({type:Object})],NN.prototype,"wallet",void 0);NN=i$e([ct("w3m-mobile-download-links")],NN);const aMt=Xe` 9217 @keyframes shake { 9218 0% { 9219 transform: translateX(0); 9220 } 9221 25% { 9222 transform: translateX(3px); 9223 } 9224 50% { 9225 transform: translateX(-3px); 9226 } 9227 75% { 9228 transform: translateX(3px); 9229 } 9230 100% { 9231 transform: translateX(0); 9232 } 9233 } 9234 9235 wui-flex:first-child:not(:only-child) { 9236 position: relative; 9237 } 9238 9239 wui-loading-thumbnail { 9240 position: absolute; 9241 } 9242 9243 wui-icon-box { 9244 position: absolute; 9245 right: calc(var(--wui-spacing-3xs) * -1); 9246 bottom: calc(var(--wui-spacing-3xs) * -1); 9247 opacity: 0; 9248 transform: scale(0.5); 9249 transition-property: opacity, transform; 9250 transition-duration: var(--wui-duration-lg); 9251 transition-timing-function: var(--wui-ease-out-power-2); 9252 will-change: opacity, transform; 9253 } 9254 9255 wui-text[align='center'] { 9256 width: 100%; 9257 padding: 0px var(--wui-spacing-l); 9258 } 9259 9260 [data-error='true'] wui-icon-box { 9261 opacity: 1; 9262 transform: scale(1); 9263 } 9264 9265 [data-error='true'] > wui-flex:first-child { 9266 animation: shake 250ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; 9267 } 9268 9269 [data-retry='false'] wui-link { 9270 display: none; 9271 } 9272 9273 [data-retry='true'] wui-link { 9274 display: block; 9275 opacity: 1; 9276 } 9277`;var Sf=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};class Bo extends ce{constructor(){var t,n,r,s,i;super(),this.wallet=(t=Le.state.data)==null?void 0:t.wallet,this.connector=(n=Le.state.data)==null?void 0:n.connector,this.timeout=void 0,this.secondaryBtnIcon="refresh",this.onConnect=void 0,this.onRender=void 0,this.onAutoConnect=void 0,this.isWalletConnect=!0,this.unsubscribe=[],this.imageSrc=ti.getWalletImage(this.wallet)??ti.getConnectorImage(this.connector),this.name=((r=this.wallet)==null?void 0:r.name)??((s=this.connector)==null?void 0:s.name)??"Wallet",this.isRetrying=!1,this.uri=He.state.wcUri,this.error=He.state.wcError,this.ready=!1,this.showRetry=!1,this.secondaryBtnLabel="Try again",this.secondaryLabel="Accept connection request in the wallet",this.isLoading=!1,this.isMobile=!1,this.onRetry=void 0,this.unsubscribe.push(He.subscribeKey("wcUri",o=>{var a;this.uri=o,this.isRetrying&&this.onRetry&&(this.isRetrying=!1,(a=this.onConnect)==null||a.call(this))}),He.subscribeKey("wcError",o=>this.error=o)),(Re.isTelegram()||Re.isSafari())&&Re.isIos()&&He.state.wcUri&&((i=this.onConnect)==null||i.call(this))}firstUpdated(){var t;(t=this.onAutoConnect)==null||t.call(this),this.showRetry=!this.onAutoConnect}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),He.setWcError(!1),clearTimeout(this.timeout)}render(){var r;(r=this.onRender)==null||r.call(this),this.onShowRetry();const t=this.error?"Connection can be declined if a previous request is still active":this.secondaryLabel;let n=`Continue in ${this.name}`;return this.error&&(n="Connection declined"),j` 9278 <wui-flex 9279 data-error=${ge(this.error)} 9280 data-retry=${this.showRetry} 9281 flexDirection="column" 9282 alignItems="center" 9283 .padding=${["3xl","xl","xl","xl"]} 9284 gap="xl" 9285 > 9286 <wui-flex justifyContent="center" alignItems="center"> 9287 <wui-wallet-image size="lg" imageSrc=${ge(this.imageSrc)}></wui-wallet-image> 9288 9289 ${this.error?null:this.loaderTemplate()} 9290 9291 <wui-icon-box 9292 backgroundColor="error-100" 9293 background="opaque" 9294 iconColor="error-100" 9295 icon="close" 9296 size="sm" 9297 border 9298 borderColor="wui-color-bg-125" 9299 ></wui-icon-box> 9300 </wui-flex> 9301 9302 <wui-flex flexDirection="column" alignItems="center" gap="xs"> 9303 <wui-text variant="paragraph-500" color=${this.error?"error-100":"fg-100"}> 9304 ${n} 9305 </wui-text> 9306 <wui-text align="center" variant="small-500" color="fg-200">${t}</wui-text> 9307 </wui-flex> 9308 9309 ${this.secondaryBtnLabel?j` 9310 <wui-button 9311 variant="accent" 9312 size="md" 9313 ?disabled=${this.isRetrying||this.isLoading} 9314 @click=${this.onTryAgain.bind(this)} 9315 data-testid="w3m-connecting-widget-secondary-button" 9316 > 9317 <wui-icon color="inherit" slot="iconLeft" name=${this.secondaryBtnIcon}></wui-icon> 9318 ${this.secondaryBtnLabel} 9319 </wui-button>
9319 9320 `:null} 9321 </wui-flex> 9322 9323 ${this.isWalletConnect?j` 9324 <wui-flex .padding=${["0","xl","xl","xl"]} justifyContent="center"> 9325 <wui-link @click=${this.onCopyUri} color="fg-200" data-testid="wui-link-copy"> 9326 <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon> 9327 Copy link 9328 </wui-link> 9329 </wui-flex> 9330 `:null} 9331 9332 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 9333 `}onShowRetry(){var t;if(this.error&&!this.showRetry){this.showRetry=!0;const n=(t=this.shadowRoot)==null?void 0:t.querySelector("wui-button");n==null||n.animate([{opacity:0},{opacity:1}],{fill:"forwards",easing:"ease"})}}onTryAgain(){var t,n;He.setWcError(!1),this.onRetry?(this.isRetrying=!0,(t=this.onRetry)==null||t.call(this)):(n=this.onConnect)==null||n.call(this)}loaderTemplate(){const t=Vi.state.themeVariables["--w3m-border-radius-master"],n=t?parseInt(t.replace("px",""),10):4;return j`<wui-loading-thumbnail radius=${n*9}></wui-loading-thumbnail>`}onCopyUri(){try{this.uri&&(Re.copyToClopboard(this.uri),vs.showSuccess("Link copied"))}catch{vs.showError("Failed to copy")}}}Bo.styles=aMt;Sf([se()],Bo.prototype,"isRetrying",void 0);Sf([se()],Bo.prototype,"uri",void 0);Sf([se()],Bo.prototype,"error",void 0);Sf([se()],Bo.prototype,"ready",void 0);Sf([se()],Bo.prototype,"showRetry",void 0);Sf([se()],Bo.prototype,"secondaryBtnLabel",void 0);Sf([se()],Bo.prototype,"secondaryLabel",void 0);Sf([se()],Bo.prototype,"isLoading",void 0);Sf([z({type:Boolean})],Bo.prototype,"isMobile",void 0);Sf([z()],Bo.prototype,"onRetry",void 0);var cMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let ole=class extends Bo{constructor(){if(super(),!this.wallet)throw new Error("w3m-connecting-wc-browser: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onAutoConnect=this.onConnectProxy.bind(this),bn.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser"}})}async onConnectProxy(){var t;try{this.error=!1;const{connectors:n}=Pe.state,r=n.find(s=>{var i,o,a;return s.type==="ANNOUNCED"&&((i=s.info)==null?void 0:i.rdns)===((o=this.wallet)==null?void 0:o.rdns)||s.type==="INJECTED"||s.name===((a=this.wallet)==null?void 0:a.name)});if(r)await He.connectExternal(r,r.chain);else throw new Error("w3m-connecting-wc-browser: No connector found");ir.close(),bn.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"browser",name:((t=this.wallet)==null?void 0:t.name)||"Unknown"}})}catch(n){bn.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(n==null?void 0:n.message)??"Unknown"}}),this.error=!0}}};ole=cMt([ct("w3m-connecting-wc-browser")],ole);var lMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let ale=class extends Bo{constructor(){if(super(),!this.wallet)throw new Error("w3m-connecting-wc-desktop: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.onRender=this.onRenderProxy.bind(this),bn.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"desktop"}})}onRenderProxy(){var t;!this.ready&&this.uri&&(this.ready=!0,(t=this.onConnect)==null||t.call(this))}onConnectProxy(){var t;if((t=this.wallet)!=null&&t.desktop_link&&this.uri)try{this.error=!1;const{desktop_link:n,name:r}=this.wallet,{redirect:s,href:i}=Re.formatNativeUrl(n,this.uri);He.setWcLinking({name:r,href:i}),He.setRecentWallet(this.wallet),Re.openHref(s,"_blank")}catch{this.error=!0}}};ale=lMt([ct("w3m-connecting-wc-desktop")],ale);var m3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Yy=class extends Bo{constructor(){if(super(),this.btnLabelTimeout=void 0,this.redirectDeeplink=void 0,this.redirectUniversalLink=void 0,this.target=void 0,this.preferUniversalLinks=we.state.experimental_preferUniversalLinks,this.isLoading=!0,this.onConnect=()=>{var t;if((t=this.wallet)!=null&&t.mobile_link&&this.uri)try{this.error=!1;const{mobile_link:n,link_mode:r,name:s}=this.wallet,{redirect:i,redirectUniversalLink:o,href:a}=Re.formatNativeUrl(n,this.uri,r);this.redirectDeeplink=i,this.redirectUniversalLink=o,this.target=Re.isIframe()?"_top":"_self",He.setWcLinking({name:s,href:a}),He.setRecentWallet(this.wallet),this.preferUniversalLinks&&this.redirectUniversalLink?Re.openHref(this.redirectUniversalLink,this.target):Re.openHref(this.redirectDeeplink,this.target)}catch(n){bn.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:n instanceof Error?n.message:"Error parsing the deeplink",uri:this.uri,mobile_link:this.wallet.mobile_link,name:this.wallet.name}}),this.error=!0}},!this.wallet)throw new Error("w3m-connecting-wc-mobile: No wallet provided");this.secondaryBtnLabel="Open",this.secondaryLabel=dr.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.onHandleURI(),this.unsubscribe.push(He.subscribeKey("wcUri",()=>{this.onHandleURI()})),bn.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"mobile"}})}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.btnLabelTimeout)}onHandleURI(){var t;this.isLoading=!this.uri,!this.ready&&this.uri&&(this.ready=!0,(t=this.onConnect)==null||t.call(this))}onTryAgain(){var t;He.setWcError(!1),(t=this.onConnect)==null||t.call(this)}};m3([se()],Yy.prototype,"redirectDeeplink",void 0);m3([se()],Yy.prototype,"redirectUniversalLink",void 0);m3([se()],Yy.prototype,"target",void 0);m3([se()],Yy.prototype,"preferUniversalLinks",void 0);m3([se()],Yy.prototype,"isLoading",void 0);Yy=m3([ct("w3m-connecting-wc-mobile")],Yy);const uMt=.1,cle=2.5,ap=7;function bU(e,t,n){return e===t?!1:(e-t<0?t-e:e-t)<=n+uMt}function dMt(e,t){const n=Array.prototype.slice.call(qEe.create(e,{errorCorrectionLevel:t}).modules.data,0),r=Math.sqrt(n.length);return n.reduce((s,i,o)=>(o%r===0?s.push([i]):s[s.length-1].push(i))&&s,[])}const hMt={generate({uri:e,size:t,logoSize:n,dotColor:r="#141414"}){const s="transparent",o=[],a=dMt(e,"Q"),c=t/a.length,l=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];l.forEach(({x:p,y:m})=>{const w=(a.length-ap)*c*p,C=(a.length-ap)*c*m,E=.45;for(let b=0;b<l.length;b+=1){const S=c*(ap-b*2);o.push(ae` 9334 <rect 9335 fill=${b===2?r:s} 9336 width=${b===0?S-5:S} 9337 rx= ${b===0?(S-5)*E:S*E} 9338 ry= ${b===0?(S-5)*E:S*E} 9339 stroke=${r} 9340 stroke-width=${b===0?5:0} 9341 height=${b===0?S-5:S} 9342 x= ${b===0?C+c*b+5/2:C+c*b} 9343 y= ${b===0?w+c*b+5/2:w+c*b} 9344 /> 9345 `)}});const u=Math.floor((n+25)/c),d=a.length/2-u/2,h=a.length/2+u/2-1,f=[];a.forEach((p,m)=>{p.forEach((w,C)=>{if(a[m][C]&&!(m<ap&&C<ap||m>a.length-(ap+1)&&C<ap||m<ap&&C>a.length-(ap+1))&&!(m>d&&m<h&&C>d&&C<h)){const E=m*c+c/2,b=C*c+c/2;f.push([E,b])}})});const g={};return f.forEach(([p,m])=>{var w;
9345g[p]?(w=g[p])==null||w.push(m):g[p]=[m]}),Object.entries(g).map(([p,m])=>{const w=m.filter(C=>m.every(E=>!bU(C,E,c)));return[Number(p),w]}).forEach(([p,m])=>{m.forEach(w=>{o.push(ae`<circle cx=${p} cy=${w} fill=${r} r=${c/cle} />`)})}),Object.entries(g).filter(([p,m])=>m.length>1).map(([p,m])=>{const w=m.filter(C=>m.some(E=>bU(C,E,c)));return[Number(p),w]}).map(([p,m])=>{m.sort((C,E)=>C<E?-1:1);const w=[];for(const C of m){const E=w.find(b=>b.some(S=>bU(C,S,c)));E?E.push(C):w.push([C])}return[p,w.map(C=>[C[0],C[C.length-1]])]}).forEach(([p,m])=>{m.forEach(([w,C])=>{o.push(ae` 9346 <line 9347 x1=${p} 9348 x2=${p} 9349 y1=${w} 9350 y2=${C} 9351 stroke=${r} 9352 stroke-width=${c/(cle/2)} 9353 stroke-linecap="round" 9354 /> 9355 `)})}),o}},fMt=Xe` 9356 :host { 9357 position: relative; 9358 user-select: none; 9359 display: block; 9360 overflow: hidden; 9361 aspect-ratio: 1 / 1; 9362 width: var(--local-size); 9363 } 9364 9365 :host([data-theme='dark']) { 9366 border-radius: clamp(0px, var(--wui-border-radius-l), 40px); 9367 background-color: var(--wui-color-inverse-100); 9368 padding: var(--wui-spacing-l); 9369 } 9370 9371 :host([data-theme='light']) { 9372 box-shadow: 0 0 0 1px var(--wui-color-bg-125); 9373 background-color: var(--wui-color-bg-125); 9374 } 9375 9376 :host([data-clear='true']) > wui-icon { 9377 display: none; 9378 } 9379 9380 svg:first-child, 9381 wui-image, 9382 wui-icon { 9383 position: absolute; 9384 top: 50%; 9385 left: 50%; 9386 transform: translateY(-50%) translateX(-50%); 9387 } 9388 9389 wui-image { 9390 width: 25%; 9391 height: 25%; 9392 border-radius: var(--wui-border-radius-xs); 9393 } 9394 9395 wui-icon { 9396 width: 100%; 9397 height: 100%; 9398 color: var(--local-icon-color) !important; 9399 transform: translateY(-50%) translateX(-50%) scale(0.25); 9400 } 9401`;var Y0=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const pMt="#3396ff";let nh=class extends ce{constructor(){super(...arguments),this.uri="",this.size=0,this.theme="dark",this.imageSrc=void 0,this.alt=void 0,this.arenaClear=void 0,this.farcaster=void 0}render(){return this.dataset.theme=this.theme,this.dataset.clear=String(this.arenaClear),this.style.cssText=` 9402 --local-size: ${this.size}px; 9403 --local-icon-color: ${this.color??pMt} 9404 `,j`${this.templateVisual()} ${this.templateSvg()}`}templateSvg(){const t=this.theme==="light"?this.size:this.size-32;return ae` 9405 <svg height=${t} width=${t}> 9406 ${hMt.generate({uri:this.uri,size:t,logoSize:this.arenaClear?0:t/4,dotColor:this.color})} 9407 </svg> 9408 `}templateVisual(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt=${this.alt??"logo"}></wui-image>`:this.farcaster?j`<wui-icon 9409 class="farcaster" 9410 size="inherit" 9411 color="inherit" 9412 name="farcaster" 9413 ></wui-icon>`:j`<wui-icon size="inherit" color="inherit" name="walletConnect"></wui-icon>`}};nh.styles=[Qn,fMt];Y0([z()],nh.prototype,"uri",void 0);Y0([z({type:Number})],nh.prototype,"size",void 0);Y0([z()],nh.prototype,"theme",void 0);Y0([z()],nh.prototype,"imageSrc",void 0);Y0([z()],nh.prototype,"alt",void 0);Y0([z()],nh.prototype,"color",void 0);Y0([z({type:Boolean})],nh.prototype,"arenaClear",void 0);Y0([z({type:Boolean})],nh.prototype,"farcaster",void 0);nh=Y0([ct("wui-qr-code")],nh);const gMt=Xe` 9414 :host { 9415 display: block; 9416 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-005); 9417 background: linear-gradient( 9418 120deg, 9419 var(--wui-color-bg-200) 5%, 9420 var(--wui-color-bg-200) 48%, 9421 var(--wui-color-bg-300) 55%, 9422 var(--wui-color-bg-300) 60%, 9423 var(--wui-color-bg-300) calc(60% + 10px), 9424 var(--wui-color-bg-200) calc(60% + 12px), 9425 var(--wui-color-bg-200) 100% 9426 ); 9427 background-size: 250%; 9428 animation: shimmer 3s linear infinite reverse; 9429 } 9430 9431 :host([variant='light']) { 9432 background: linear-gradient( 9433 120deg, 9434 var(--wui-color-bg-150) 5%, 9435 var(--wui-color-bg-150) 48%, 9436 var(--wui-color-bg-200) 55%, 9437 var(--wui-color-bg-200) 60%, 9438 var(--wui-color-bg-200) calc(60% + 10px), 9439 var(--wui-color-bg-150) calc(60% + 12px), 9440 var(--wui-color-bg-150) 100% 9441 ); 9442 background-size: 250%; 9443 } 9444 9445 @keyframes shimmer { 9446 from { 9447 background-position: -250% 0; 9448 } 9449 to { 9450 background-position: 250% 0; 9451 } 9452 } 9453`;var lx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Jy=class extends ce{constructor(){super(...arguments),this.width="",this.height="",this.borderRadius="m",this.variant="default"}render(){return this.style.cssText=` 9454 width: ${this.width}; 9455 height: ${this.height}; 9456 border-radius: ${`clamp(0px,var(--wui-border-radius-${this.borderRadius}), 40px)`}; 9457 `,j`<slot></slot>`}};Jy.styles=[gMt];lx([z()],Jy.prototype,"width",void 0);lx([z()],Jy.prototype,"height",void 0);lx([z()],Jy.prototype,"borderRadius",void 0);lx([z()],Jy.prototype,"variant",void 0);Jy=lx([ct("wui-shimmer")],Jy);const mMt="https://reown.com",wMt=Xe` 9458 .reown-logo { 9459 height: var(--wui-spacing-xxl); 9460 } 9461 9462 a { 9463 text-decoration: none; 9464 cursor: pointer; 9465 } 9466 9467 a:hover { 9468 opacity: 0.9; 9469 } 9470`;var yMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let lq=class extends ce{render(){return j` 9471 <a 9472 data-testid="ux-branding-reown" 9473 href=${mMt} 9474 rel="noreferrer" 9475 target="_blank" 9476 style="text-decoration: none;" 9477 > 9478 <wui-flex 9479 justifyContent="center" 9480 alignItems="center" 9481 gap="xs" 9482 .padding=${["0","0","l","0"]} 9483 > 9484 <wui-text variant="small-500" color="fg-100"> UX by </wui-text> 9485 <wui-icon name="reown" size="xxxl" class="reown-logo"></wui-icon> 9486 </wui-flex> 9487 </a> 9488 `}};lq.styles=[Qn,oo,wMt];lq=yMt([ct("wui-ux-by-reown")],lq);const bMt=Xe` 9489 @keyframes fadein { 9490 from { 9491 opacity: 0; 9492 } 9493 to { 9494 opacity: 1; 9495 } 9496 } 9497 9498 wui-shimmer { 9499 width: 100%; 9500 aspect-ratio: 1 / 1; 9501 border-radius: clamp(0px, var(--wui-border-radius-l), 40px) !important; 9502 } 9503 9504 wui-qr-code { 9505 opacity: 0; 9506 animation-duration: 200ms; 9507 animation-timing-function: ease; 9508 animation-name: fadein; 9509 animation-fill-mode: forwards; 9510 } 9511`;var vMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let uq=class extends Bo{constructor(){var t;super(),this.forceUpdate=()=>{this.requestUpdate()},window.addEventListener("resize",this.forceUpdate),bn.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:((t=this.wallet)==null?void 0:t.name)??"WalletConnect",platform:"qrcode"}})}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.unsubscribe)==null||t.forEach(n=>n()),window.removeEventListener("resize",this.forceUpdate)}render(){return this.onRenderProxy(),j` 9512 <wui-flex 9513 flexDirection="column" 9514 alignItems="center" 9515 .padding=${["0","xl","xl","xl"]} 9516 gap="xl" 9517 > 9518 <wui-shimmer borderRadius="l" width="100%"> ${this.qrCodeTemplate()} </wui-shimmer> 9519 9520 <wui-text variant="paragraph-500" color="fg-100"> 9521 Scan this QR Code with your phone 9522 </wui-text> 9523 ${this.copyTemplate()} 9524 </wui-flex>
9525 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 9526 `}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},200))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const t=this.getBoundingClientRect().width-40,n=this.wallet?this.wallet.name:void 0;return He.setWcLinking(void 0),He.setRecentWallet(this.wallet),j` <wui-qr-code 9527 size=${t} 9528 theme=${Vi.state.themeMode} 9529 uri=${this.uri} 9530 imageSrc=${ge(ti.getWalletImage(this.wallet))} 9531 color=${ge(Vi.state.themeVariables["--w3m-qr-color"])} 9532 alt=${ge(n)} 9533 data-testid="wui-qr-code" 9534 ></wui-qr-code>`}copyTemplate(){const t=!this.uri||!this.ready;return j`<wui-link 9535 .disabled=${t} 9536 @click=${this.onCopyUri} 9537 color="fg-200" 9538 data-testid="copy-wc2-uri" 9539 > 9540 <wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon> 9541 Copy link 9542 </wui-link>`}};uq.styles=bMt;uq=vMt([ct("w3m-connecting-wc-qrcode")],uq);var EMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let lle=class extends ce{constructor(){var t;if(super(),this.wallet=(t=Le.state.data)==null?void 0:t.wallet,!this.wallet)throw new Error("w3m-connecting-wc-unsupported: No wallet provided");bn.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"browser"}})}render(){return j` 9543 <wui-flex 9544 flexDirection="column" 9545 alignItems="center" 9546 .padding=${["3xl","xl","xl","xl"]} 9547 gap="xl" 9548 > 9549 <wui-wallet-image 9550 size="lg" 9551 imageSrc=${ge(ti.getWalletImage(this.wallet))} 9552 ></wui-wallet-image> 9553 9554 <wui-text variant="paragraph-500" color="fg-100">Not Detected</wui-text> 9555 </wui-flex> 9556 9557 <w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links> 9558 `}};lle=EMt([ct("w3m-connecting-wc-unsupported")],lle);var o$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let dq=class extends Bo{constructor(){if(super(),this.isLoading=!0,!this.wallet)throw new Error("w3m-connecting-wc-web: No wallet provided");this.onConnect=this.onConnectProxy.bind(this),this.secondaryBtnLabel="Open",this.secondaryLabel=dr.CONNECT_LABELS.MOBILE,this.secondaryBtnIcon="externalLink",this.updateLoadingState(),this.unsubscribe.push(He.subscribeKey("wcUri",()=>{this.updateLoadingState()})),bn.sendEvent({type:"track",event:"SELECT_WALLET",properties:{name:this.wallet.name,platform:"web"}})}updateLoadingState(){this.isLoading=!this.uri}onConnectProxy(){var t;
9558if((t=this.wallet)!=null&&t.webapp_link&&this.uri)try{this.error=!1;const{webapp_link:n,name:r}=this.wallet,{redirect:s,href:i}=Re.formatUniversalUrl(n,this.uri);He.setWcLinking({name:r,href:i}),He.setRecentWallet(this.wallet),Re.openHref(s,"_blank")}catch{this.error=!0}}};o$e([se()],dq.prototype,"isLoading",void 0);dq=o$e([ct("w3m-connecting-wc-web")],dq);var ux=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let f6=class extends ce{constructor(){var t;super(),this.wallet=(t=Le.state.data)==null?void 0:t.wallet,this.unsubscribe=[],this.platform=void 0,this.platforms=[],this.isSiwxEnabled=!!we.state.siwx,this.remoteFeatures=we.state.remoteFeatures,this.determinePlatforms(),this.initializeConnection(),this.unsubscribe.push(we.subscribeKey("remoteFeatures",n=>this.remoteFeatures=n))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){return j` 9559 ${this.headerTemplate()} 9560 <div>${this.platformTemplate()}</div> 9561 ${this.reownBrandingTemplate()} 9562 `}reownBrandingTemplate(){var t;return(t=this.remoteFeatures)!=null&&t.reownBranding?j`<wui-ux-by-reown></wui-ux-by-reown>`:null}async initializeConnection(t=!1){if(!(this.platform==="browser"||we.state.manualWCControl&&!t))try{const{wcPairingExpiry:n,status:r}=He.state;(t||we.state.enableEmbedded||Re.isPairingExpired(n)||r==="connecting")&&(await He.connectWalletConnect(),this.isSiwxEnabled||ir.close())}catch(n){bn.sendEvent({type:"track",event:"CONNECT_ERROR",properties:{message:(n==null?void 0:n.message)??"Unknown"}}),He.setWcError(!0),vs.showError(n.message??"Connection error"),He.resetWcConnection(),Le.goBack()}}determinePlatforms(){if(!this.wallet){this.platforms.push("qrcode"),this.platform="qrcode";return}if(this.platform)return;const{mobile_link:t,desktop_link:n,webapp_link:r,injected:s,rdns:i}=this.wallet,o=s==null?void 0:s.map(({injected_id:g})=>g).filter(Boolean),a=[...i?[i]:o??[]],c=we.state.isUniversalProvider?!1:a.length,l=t,u=r,d=He.checkInstalled(a),h=c&&d,f=n&&!Re.isMobile();h&&!J.state.noAdapters&&this.platforms.push("browser"),l&&this.platforms.push(Re.isMobile()?"mobile":"qrcode"),u&&this.platforms.push("web"),f&&this.platforms.push("desktop"),!h&&c&&!J.state.noAdapters&&this.platforms.push("unsupported"),this.platform=this.platforms[0]}platformTemplate(){switch(this.platform){case"browser":return j`<w3m-connecting-wc-browser></w3m-connecting-wc-browser>`;case"web":return j`<w3m-connecting-wc-web></w3m-connecting-wc-web>`;case"desktop":return j` 9563 <w3m-connecting-wc-desktop .onRetry=${()=>this.initializeConnection(!0)}> 9564 </w3m-connecting-wc-desktop> 9565 `;case"mobile":return j` 9566 <w3m-connecting-wc-mobile isMobile .onRetry=${()=>this.initializeConnection(!0)}> 9567 </w3m-connecting-wc-mobile> 9568 `;case"qrcode":return j`<w3m-connecting-wc-qrcode></w3m-connecting-wc-qrcode>`;default:return j`<w3m-connecting-wc-unsupported></w3m-connecting-wc-unsupported>`}}headerTemplate(){return this.platforms.length>1?j` 9569 <w3m-connecting-header 9570 .platforms=${this.platforms} 9571 .onSelectPlatfrom=${this.onSelectPlatform.bind(this)} 9572 > 9573 </w3m-connecting-header> 9574 `:null}async onSelectPlatform(t){var r;const n=(r=this.shadowRoot)==null?void 0:r.querySelector("div");n&&(await n.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.platform=t,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}};ux([se()],f6.prototype,"platform",void 0);ux([se()],f6.prototype,"platforms",void 0);ux([se()],f6.prototype,"isSiwxEnabled",void 0);ux([se()],f6.prototype,"remoteFeatures",void 0);f6=ux([ct("w3m-connecting-wc-view")],f6);var a$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let TN=class extends ce{constructor(){super(...arguments),this.isMobile=Re.isMobile()}
9574render(){if(this.isMobile){const{featured:t,recommended:n}=ze.state,{customWallets:r}=we.state,s=lt.getRecentWallets(),i=t.length||n.length||(r==null?void 0:r.length)||s.length;return j`<wui-flex 9575 flexDirection="column" 9576 gap="xs" 9577 .margin=${["3xs","s","s","s"]} 9578 > 9579 ${i?j`<w3m-connector-list></w3m-connector-list>`:null} 9580 <w3m-all-wallets-widget></w3m-all-wallets-widget> 9581 </wui-flex>`}return j`<wui-flex flexDirection="column" .padding=${["0","0","l","0"]}> 9582 <w3m-connecting-wc-view></w3m-connecting-wc-view> 9583 <wui-flex flexDirection="column" .padding=${["0","m","0","m"]}> 9584 <w3m-all-wallets-widget></w3m-all-wallets-widget> </wui-flex 9585 ></wui-flex>`}};a$e([se()],TN.prototype,"isMobile",void 0);TN=a$e([ct("w3m-connecting-wc-basic-view")],TN);const CMt=Xe` 9586 :host { 9587 display: flex; 9588 align-items: center; 9589 justify-content: center; 9590 } 9591 9592 label { 9593 position: relative; 9594 display: inline-block; 9595 width: 32px; 9596 height: 22px; 9597 } 9598 9599 input { 9600 width: 0; 9601 height: 0; 9602 opacity: 0; 9603 } 9604 9605 span { 9606 position: absolute; 9607 cursor: pointer; 9608 top: 0; 9609 left: 0; 9610 right: 0; 9611 bottom: 0; 9612 background-color: var(--wui-color-blue-100); 9613 border-width: 1px; 9614 border-style: solid; 9615 border-color: var(--wui-color-gray-glass-002); 9616 border-radius: 999px; 9617 transition: 9618 background-color var(--wui-ease-inout-power-1) var(--wui-duration-md), 9619 border-color var(--wui-ease-inout-power-1) var(--wui-duration-md); 9620 will-change: background-color, border-color; 9621 } 9622 9623 span:before { 9624 position: absolute; 9625 content: ''; 9626 height: 16px; 9627 width: 16px; 9628 left: 3px; 9629 top: 2px; 9630 background-color: var(--wui-color-inverse-100); 9631 transition: transform var(--wui-ease-inout-power-1) var(--wui-duration-lg); 9632 will-change: transform; 9633 border-radius: 50%; 9634 } 9635 9636 input:checked + span { 9637 border-color: var(--wui-color-gray-glass-005); 9638 background-color: var(--wui-color-blue-100); 9639 } 9640 9641 input:not(:checked) + span { 9642 background-color: var(--wui-color-gray-glass-010); 9643 } 9644 9645 input:checked + span:before { 9646 transform: translateX(calc(100% - 7px)); 9647 } 9648`;var c$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let PN=class extends ce{constructor(){super(...arguments),this.inputElementRef=t3(),this.checked=void 0}render(){return j` 9649 <label> 9650 <input 9651 ${n3(this.inputElementRef)} 9652 type="checkbox" 9653 ?checked=${ge(this.checked)} 9654 @change=${this.dispatchChangeEvent.bind(this)} 9655 /> 9656 <span></span> 9657 </label> 9658 `}dispatchChangeEvent(){var t;this.dispatchEvent(new CustomEvent("switchChange",{detail:(t=this.inputElementRef.value)==null?void 0:t.checked,bubbles:!0,composed:!0}))}};PN.styles=[Qn,oo,E$,CMt];c$e([z({type:Boolean})],PN.prototype,"checked",void 0);PN=c$e([ct("wui-switch")],PN);const $Mt=Xe` 9659 :host { 9660 height: 100%; 9661 } 9662 9663 button { 9664 display: flex; 9665 align-items: center; 9666 justify-content: center; 9667 column-gap: var(--wui-spacing-1xs); 9668 padding: var(--wui-spacing-xs) var(--wui-spacing-s); 9669 background-color: var(--wui-color-gray-glass-002); 9670 border-radius: var(--wui-border-radius-xs); 9671 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); 9672 transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-md); 9673 will-change: background-color; 9674 cursor: pointer; 9675 } 9676 9677 wui-switch { 9678 pointer-events: none; 9679 } 9680`;var l$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let ON=class extends ce{constructor(){super(...arguments),this.checked=void 0}render(){return j` 9681 <button> 9682 <wui-icon size="xl" name="walletConnectBrown"></wui-icon> 9683 <wui-switch ?checked=${ge(this.checked)}></wui-switch> 9684 </button> 9685 `}};ON.styles=[Qn,oo,$Mt];l$e([z({type:Boolean})],ON.prototype,"checked",void 0);ON=l$e([ct("wui-certified-switch")],ON);const xMt=Xe` 9686 button { 9687 background-color: var(--wui-color-fg-300); 9688 border-radius: var(--wui-border-radius-4xs); 9689 width: 16px; 9690 height: 16px; 9691 } 9692 9693 button:disabled { 9694 background-color: var(--wui-color-bg-300); 9695 } 9696 9697 wui-icon { 9698 color: var(--wui-color-bg-200) !important; 9699 } 9700 9701 button:focus-visible { 9702 background-color: var(--wui-color-fg-250); 9703 border: 1px solid var(--wui-color-accent-100); 9704 } 9705 9706 @media (hover: hover) and (pointer: fine) { 9707 button:hover:enabled { 9708 background-color: var(--wui-color-fg-250); 9709 } 9710 9711 button:active:enabled { 9712 background-color: var(--wui-color-fg-225); 9713 } 9714 } 9715`;var u$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let kN=class extends ce{constructor(){super(...arguments),this.icon="copy"}render(){return j` 9716 <button> 9717 <wui-icon color="inherit" size="xxs" name=${this.icon}></wui-icon> 9718 </button> 9719 `}};kN.styles=[Qn,oo,xMt];u$e([z()],kN.prototype,"icon",void 0);kN=u$e([ct("wui-input-element")],kN);const IMt=Xe` 9720 :host { 9721 position: relative; 9722 width: 100%; 9723 display: inline-block; 9724 color: var(--wui-color-fg-275); 9725 } 9726 9727 input { 9728 width: 100%; 9729 border-radius: var(--wui-border-radius-xs); 9730 box-shadow: inset 0 0 0 1px var(--wui-color-gray-glass-002); 9731 background: var(--wui-color-gray-glass-002); 9732 font-size: var(--wui-font-size-paragraph); 9733 letter-spacing: var(--wui-letter-spacing-paragraph); 9734 color: var(--wui-color-fg-100); 9735 transition: 9736 background-color var(--wui-ease-inout-power-1) var(--wui-duration-md), 9737 border-color var(--wui-ease-inout-power-1) var(--wui-duration-md), 9738 box-shadow var(--wui-ease-inout-power-1) var(--wui-duration-md); 9739 will-change: background-color, border-color, box-shadow; 9740 caret-color: var(--wui-color-accent-100); 9741 } 9742 9743 input:disabled {
9744 cursor: not-allowed; 9745 border: 1px solid var(--wui-color-gray-glass-010); 9746 } 9747 9748 input:disabled::placeholder, 9749 input:disabled + wui-icon { 9750 color: var(--wui-color-fg-300); 9751 } 9752 9753 input::placeholder { 9754 color: var(--wui-color-fg-275); 9755 } 9756 9757 input:focus:enabled { 9758 background-color: var(--wui-color-gray-glass-005); 9759 -webkit-box-shadow: 9760 inset 0 0 0 1px var(--wui-color-accent-100), 9761 0px 0px 0px 4px var(--wui-box-shadow-blue); 9762 -moz-box-shadow: 9763 inset 0 0 0 1px var(--wui-color-accent-100), 9764 0px 0px 0px 4px var(--wui-box-shadow-blue); 9765 box-shadow: 9766 inset 0 0 0 1px var(--wui-color-accent-100), 9767 0px 0px 0px 4px var(--wui-box-shadow-blue); 9768 } 9769 9770 input:hover:enabled { 9771 background-color: var(--wui-color-gray-glass-005); 9772 } 9773 9774 wui-icon { 9775 position: absolute; 9776 top: 50%; 9777 transform: translateY(-50%); 9778 pointer-events: none; 9779 } 9780 9781 .wui-size-sm { 9782 padding: 9px var(--wui-spacing-m) 10px var(--wui-spacing-s); 9783 } 9784 9785 wui-icon + .wui-size-sm { 9786 padding: 9px var(--wui-spacing-m) 10px 36px; 9787 } 9788 9789 wui-icon[data-input='sm'] { 9790 left: var(--wui-spacing-s); 9791 } 9792 9793 .wui-size-md { 9794 padding: 15px var(--wui-spacing-m) var(--wui-spacing-l) var(--wui-spacing-m); 9795 } 9796 9797 wui-icon + .wui-size-md, 9798 wui-loading-spinner + .wui-size-md { 9799 padding: 10.5px var(--wui-spacing-3xl) 10.5px var(--wui-spacing-3xl); 9800 } 9801 9802 wui-icon[data-input='md'] { 9803 left: var(--wui-spacing-l); 9804 } 9805 9806 .wui-size-lg { 9807 padding: var(--wui-spacing-s) var(--wui-spacing-s) var(--wui-spacing-s) var(--wui-spacing-l); 9808 letter-spacing: var(--wui-letter-spacing-medium-title); 9809 font-size: var(--wui-font-size-medium-title); 9810 font-weight: var(--wui-font-weight-light); 9811 line-height: 130%; 9812 color: var(--wui-color-fg-100); 9813 height: 64px; 9814 } 9815 9816 .wui-padding-right-xs { 9817 padding-right: var(--wui-spacing-xs); 9818 } 9819 9820 .wui-padding-right-s { 9821 padding-right: var(--wui-spacing-s); 9822 } 9823 9824 .wui-padding-right-m { 9825 padding-right: var(--wui-spacing-m); 9826 } 9827 9828 .wui-padding-right-l { 9829 padding-right: var(--wui-spacing-l); 9830 } 9831 9832 .wui-padding-right-xl { 9833 padding-right: var(--wui-spacing-xl); 9834 } 9835 9836 .wui-padding-right-2xl { 9837 padding-right: var(--wui-spacing-2xl); 9838 } 9839 9840 .wui-padding-right-3xl { 9841 padding-right: var(--wui-spacing-3xl); 9842 } 9843 9844 .wui-padding-right-4xl { 9845 padding-right: var(--wui-spacing-4xl); 9846 } 9847 9848 .wui-padding-right-5xl { 9849 padding-right: var(--wui-spacing-5xl); 9850 } 9851 9852 wui-icon + .wui-size-lg, 9853 wui-loading-spinner + .wui-size-lg { 9854 padding-left: 50px; 9855 } 9856 9857 wui-icon[data-input='lg'] { 9858 left: var(--wui-spacing-l); 9859 } 9860 9861 .wui-size-mdl { 9862 padding: 17.25px var(--wui-spacing-m) 17.25px var(--wui-spacing-m); 9863 } 9864 wui-icon + .wui-size-mdl, 9865 wui-loading-spinner + .wui-size-mdl { 9866 padding: 17.25px var(--wui-spacing-3xl) 17.25px 40px; 9867 } 9868 wui-icon[data-input='mdl'] { 9869 left: var(--wui-spacing-m); 9870 } 9871 9872 input:placeholder-shown ~ ::slotted(wui-input-element), 9873 input:placeholder-shown ~ ::slotted(wui-icon) { 9874 opacity: 0; 9875 pointer-events: none; 9876 } 9877 9878 input::-webkit-outer-spin-button, 9879 input::-webkit-inner-spin-button { 9880 -webkit-appearance: none; 9881 margin: 0; 9882 } 9883 9884 input[type='number'] { 9885 -moz-appearance: textfield; 9886 } 9887 9888 ::slotted(wui-input-element), 9889 ::slotted(wui-icon) { 9890 position: absolute; 9891 top: 50%; 9892 transform: translateY(-50%); 9893 } 9894 9895 ::slotted(wui-input-element) { 9896 right: var(--wui-spacing-m); 9897 } 9898 9899 ::slotted(wui-icon) { 9900 right: 0px; 9901 } 9902`;var Af=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Ru=class extends ce{constructor(){super(...arguments),this.inputElementRef=t3(),this.size="md",this.disabled=!1,this.placeholder="",this.type="text",this.value=""}render(){const t=`wui-padding-right-${this.inputRightPadding}`,r={[`wui-size-${this.size}`]:!0,[t]:!!this.inputRightPadding};return j`${this.templateIcon()} 9903 <input 9904 data-testid="wui-input-text" 9905 ${n3(this.inputElementRef)} 9906 class=${Y6(r)} 9907 type=${this.type} 9908 enterkeyhint=${ge(this.enterKeyHint)} 9909 ?disabled=${this.disabled} 9910 placeholder=${this.placeholder}
9911 @input=${this.dispatchInputChangeEvent.bind(this)} 9912 .value=${this.value||""} 9913 tabindex=${ge(this.tabIdx)} 9914 /> 9915 <slot></slot>`}templateIcon(){return this.icon?j`<wui-icon 9916 data-input=${this.size} 9917 size=${this.size} 9918 color="inherit" 9919 name=${this.icon} 9920 ></wui-icon>`:null}dispatchInputChangeEvent(){var t;this.dispatchEvent(new CustomEvent("inputChange",{detail:(t=this.inputElementRef.value)==null?void 0:t.value,bubbles:!0,composed:!0}))}};Ru.styles=[Qn,oo,IMt];Af([z()],Ru.prototype,"size",void 0);Af([z()],Ru.prototype,"icon",void 0);Af([z({type:Boolean})],Ru.prototype,"disabled",void 0);Af([z()],Ru.prototype,"placeholder",void 0);Af([z()],Ru.prototype,"type",void 0);Af([z()],Ru.prototype,"keyHint",void 0);Af([z()],Ru.prototype,"value",void 0);Af([z()],Ru.prototype,"inputRightPadding",void 0);Af([z()],Ru.prototype,"tabIdx",void 0);Ru=Af([ct("wui-input-text")],Ru);const SMt=Xe` 9921 :host { 9922 position: relative; 9923 display: inline-block; 9924 width: 100%; 9925 } 9926`;var AMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let hq=class extends ce{constructor(){super(...arguments),this.inputComponentRef=t3()}render(){return j` 9927 <wui-input-text 9928 ${n3(this.inputComponentRef)} 9929 placeholder="Search wallet" 9930 icon="search" 9931 type="search" 9932 enterKeyHint="search" 9933 size="sm" 9934 > 9935 <wui-input-element @click=${this.clearValue} icon="close"></wui-input-element> 9936 </wui-input-text> 9937 `}clearValue(){const t=this.inputComponentRef.value,n=t==null?void 0:t.inputElementRef.value;n&&(n.value="",n.focus(),n.dispatchEvent(new Event("input")))}};hq.styles=[Qn,SMt];hq=AMt([ct("wui-search-bar")],hq);const _Mt=ae`<svg viewBox="0 0 48 54" fill="none"> 9938 <path 9939 d="M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z" 9940 /> 9941</svg>`,NMt=Xe` 9942 :host { 9943 display: flex; 9944 flex-direction: column; 9945 align-items: center; 9946 width: 104px; 9947 row-gap: var(--wui-spacing-xs); 9948 padding: var(--wui-spacing-xs) 10px; 9949 background-color: var(--wui-color-gray-glass-002); 9950 border-radius: clamp(0px, var(--wui-border-radius-xs), 20px); 9951 position: relative; 9952 } 9953 9954 wui-shimmer[data-type='network'] { 9955 border: none; 9956 -webkit-clip-path: var(--wui-path-network); 9957 clip-path: var(--wui-path-network); 9958 } 9959 9960 svg { 9961 position: absolute; 9962 width: 48px; 9963 height: 54px; 9964 z-index: 1; 9965 } 9966 9967 svg > path { 9968 stroke: var(--wui-color-gray-glass-010); 9969 stroke-width: 1px; 9970 } 9971 9972 @media (max-width: 350px) { 9973 :host { 9974 width: 100%; 9975 } 9976 } 9977`;var d$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let RN=class extends ce{constructor(){super(...arguments),this.type="wallet"}render(){return j` 9978 ${this.shimmerTemplate()} 9979 <wui-shimmer width="56px" height="20px" borderRadius="xs"></wui-shimmer> 9980 `}shimmerTemplate(){return this.type==="network"?j` <wui-shimmer 9981 data-type=${this.type} 9982 width="48px" 9983 height="54px" 9984 borderRadius="xs" 9985 ></wui-shimmer> 9986 ${_Mt}`:j`<wui-shimmer width="56px" height="56px" borderRadius="xs"></wui-shimmer>`}};RN.styles=[Qn,oo,NMt];d$e([z()],RN.prototype,"type",void 0);RN=d$e([ct("wui-card-select-loader")],RN);const TMt=Xe` 9987 :host { 9988 display: grid; 9989 width: inherit; 9990 height: inherit; 9991 } 9992`;var Wu=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let vc=class extends ce{render(){return this.style.cssText=` 9993 grid-template-rows: ${this.gridTemplateRows}; 9994 grid-template-columns: ${this.gridTemplateColumns}; 9995 justify-items: ${this.justifyItems}; 9996 align-items: ${this.alignItems}; 9997 justify-content: ${this.justifyContent}; 9998 align-content: ${this.alignContent}; 9999 column-gap: ${this.columnGap&&`var(--wui-spacing-${this.columnGap})`}; 10000 row-gap: ${this.rowGap&&`var(--wui-spacing-${this.rowGap})`}; 10001 gap: ${this.gap&&`var(--wui-spacing-${this.gap})`}; 10002 padding-top: ${this.padding&&yi.getSpacingStyles(this.padding,0)}; 10003 padding-right: ${this.padding&&yi.getSpacingStyles(this.padding,1)}; 10004 padding-bottom: ${this.padding&&yi.getSpacingStyles(this.padding,2)}; 10005 padding-left: ${this.padding&&yi.getSpacingStyles(this.padding,3)}; 10006 margin-top: ${this.margin&&yi.getSpacingStyles(this.margin,
100060)}; 10007 margin-right: ${this.margin&&yi.getSpacingStyles(this.margin,1)}; 10008 margin-bottom: ${this.margin&&yi.getSpacingStyles(this.margin,2)}; 10009 margin-left: ${this.margin&&yi.getSpacingStyles(this.margin,3)}; 10010 `,j`<slot></slot>`}};vc.styles=[Qn,TMt];Wu([z()],vc.prototype,"gridTemplateRows",void 0);Wu([z()],vc.prototype,"gridTemplateColumns",void 0);Wu([z()],vc.prototype,"justifyItems",void 0);Wu([z()],vc.prototype,"alignItems",void 0);Wu([z()],vc.prototype,"justifyContent",void 0);Wu([z()],vc.prototype,"alignContent",void 0);Wu([z()],vc.prototype,"columnGap",void 0);Wu([z()],vc.prototype,"rowGap",void 0);Wu([z()],vc.prototype,"gap",void 0);Wu([z()],vc.prototype,"padding",void 0);Wu([z()],vc.prototype,"margin",void 0);vc=Wu([ct("wui-grid")],vc);const PMt=Xe` 10011 button { 10012 display: flex; 10013 flex-direction: column; 10014 justify-content: center; 10015 align-items: center; 10016 cursor: pointer; 10017 width: 104px; 10018 row-gap: var(--wui-spacing-xs); 10019 padding: var(--wui-spacing-s) var(--wui-spacing-0); 10020 background-color: var(--wui-color-gray-glass-002); 10021 border-radius: clamp(0px, var(--wui-border-radius-xs), 20px); 10022 transition: 10023 color var(--wui-duration-lg) var(--wui-ease-out-power-1), 10024 background-color var(--wui-duration-lg) var(--wui-ease-out-power-1), 10025 border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1); 10026 will-change: background-color, color, border-radius; 10027 outline: none; 10028 border: none; 10029 } 10030 10031 button > wui-flex > wui-text { 10032 color: var(--wui-color-fg-100); 10033 max-width: 86px; 10034 white-space: nowrap; 10035 overflow: hidden; 10036 text-overflow: ellipsis; 10037 justify-content: center; 10038 } 10039 10040 button > wui-flex > wui-text.certified { 10041 max-width: 66px; 10042 } 10043 10044 button:hover:enabled { 10045 background-color: var(--wui-color-gray-glass-005); 10046 } 10047 10048 button:disabled > wui-flex > wui-text { 10049 color: var(--wui-color-gray-glass-015); 10050 } 10051 10052 [data-selected='true'] { 10053 background-color: var(--wui-color-accent-glass-020); 10054 } 10055 10056 @media (hover: hover) and (pointer: fine) { 10057 [data-selected='true']:hover:enabled { 10058 background-color: var(--wui-color-accent-glass-015); 10059 } 10060 } 10061 10062 [data-selected='true']:active:enabled { 10063 background-color: var(--wui-color-accent-glass-010); 10064 } 10065 10066 @media (max-width: 350px) { 10067 button { 10068 width: 100%; 10069 } 10070 } 10071`;var dx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Xy=class extends ce{constructor(){super(),this.observer=new IntersectionObserver(()=>{}),this.visible=!1,this.imageSrc=void 0,this.imageLoading=!1,this.wallet=void 0,this.observer=new IntersectionObserver(t=>{t.forEach(n=>{n.isIntersecting?(this.visible=!0,this.fetchImageSrc()):this.visible=!1})},{threshold:.01})}firstUpdated(){this.observer.observe(this)}disconnectedCallback(){this.observer.disconnect()}render(){var n,r;const t=((n=this.wallet)==null?void 0:n.badge_type)==="certified";return j` 10072 <button> 10073 ${this.imageTemplate()} 10074 <wui-flex flexDirection="row" alignItems="center" justifyContent="center" gap="3xs"> 10075 <wui-text 10076 variant="tiny-500" 10077 color="inherit" 10078 class=${ge(t?"certified":void 0)} 10079 >${(r=this.wallet)==null?void 0:r.name}</wui-text 10080 > 10081 ${t?j`<wui-icon size="sm" name="walletConnectBrown"></wui-icon>`:null} 10082 </wui-flex> 10083 </button> 10084 `}imageTemplate(){var t,n;return!this.visible&&!this.imageSrc||this.imageLoading?this.shimmerTemplate():j` 10085 <wui-wallet-image 10086 size="md" 10087 imageSrc=${ge(this.imageSrc)} 10088 name=${(t=this.wallet)==null?void 0:t.name} 10089 .installed=${(n=this.wallet)==null?void 0:n.installed} 10090 badgeSize="sm" 10091 > 10092 </wui-wallet-image> 10093 `}shimmerTemplate(){return j`<wui-shimmer width="56px" height="56px" borderRadius="xs"></wui-shimmer>`}async fetchImageSrc(){this.wallet&&(this.imageSrc=ti.getWalletImage(this.wallet),!this.imageSrc&&(this.imageLoading=!0,this.imageSrc=await ti.fetchWalletImage(this.wallet.image_id),this.imageLoading=!1))}};Xy.styles=PMt;dx([se()],Xy.prototype,"visible",void 0);dx([se()],Xy.prototype,"imageSrc",void 0);dx([se()],Xy.prototype,"imageLoading",void 0);dx([z()],Xy.prototype,"wallet",void 0);Xy=dx([ct("w3m-all-wallets-list-item")],Xy);const OMt=Xe` 10094 wui-grid { 10095 max-height: clamp(360px, 400px, 80vh); 10096 overflow: scroll; 10097 scrollbar-width: none; 10098 grid-auto-rows: min-content; 10099 grid-template-columns: repeat(auto-fill, 104px); 10100 } 10101 10102 @media (max-width: 350px) { 10103 wui-grid { 10104 grid-template-columns: repeat(2, 1fr); 10105 } 10106 } 10107 10108 wui-grid[data-scroll='false'] { 10109 overflow: hidden; 10110 } 10111 10112 wui-grid::-webkit-scrollbar {
10113 display: none; 10114 } 10115 10116 wui-loading-spinner { 10117 padding-top: var(--wui-spacing-l); 10118 padding-bottom: var(--wui-spacing-l); 10119 justify-content: center; 10120 grid-column: 1 / span 4; 10121 } 10122`;var w3=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const ule="local-paginator";let c1=class extends ce{constructor(){super(),this.unsubscribe=[],this.paginationObserver=void 0,this.loading=!ze.state.wallets.length,this.wallets=ze.state.wallets,this.recommended=ze.state.recommended,this.featured=ze.state.featured,this.filteredWallets=ze.state.filteredWallets,this.unsubscribe.push(ze.subscribeKey("wallets",t=>this.wallets=t),ze.subscribeKey("recommended",t=>this.recommended=t),ze.subscribeKey("featured",t=>this.featured=t),ze.subscribeKey("filteredWallets",t=>this.filteredWallets=t))}firstUpdated(){this.initialFetch(),this.createPaginationObserver()}disconnectedCallback(){var t;this.unsubscribe.forEach(n=>n()),(t=this.paginationObserver)==null||t.disconnect()}render(){return j` 10123 <wui-grid 10124 data-scroll=${!this.loading} 10125 .padding=${["0","s","s","s"]} 10126 columnGap="xxs" 10127 rowGap="l" 10128 justifyContent="space-between" 10129 > 10130 ${this.loading?this.shimmerTemplate(16):this.walletsTemplate()} 10131 ${this.paginationLoaderTemplate()} 10132 </wui-grid> 10133 `}async initialFetch(){var n;this.loading=!0;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("wui-grid");t&&(await ze.fetchWalletsByPage({page:1}),await t.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.loading=!1,t.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}shimmerTemplate(t,n){return[...Array(t)].map(()=>j` 10134 <wui-card-select-loader type="wallet" id=${ge(n)}></wui-card-select-loader> 10135 `)}walletsTemplate(){var r;const t=((r=this.filteredWallets)==null?void 0:r.length)>0?Re.uniqueBy([...this.featured,...this.recommended,...this.filteredWallets],"id"):Re.uniqueBy([...this.featured,...this.recommended,...this.wallets],"id");return hy.markWalletsAsInstalled(t).map(s=>j` 10136 <w3m-all-wallets-list-item 10137 @click=${()=>this.onConnectWallet(s)} 10138 .wallet=${s} 10139 ></w3m-all-wallets-list-item> 10140 `)}paginationLoaderTemplate(){const{wallets:t,recommended:n,featured:r,count:s}=ze.state,i=window.innerWidth<352?3:4,o=t.length+n.length;let c=Math.ceil(o/i)*i-o+i;return c-=t.length?r.length%i:0,s===0&&r.length>0?null:s===0||[...r,...t,...n].length<s?this.shimmerTemplate(c,ule):null}createPaginationObserver(){var n;const t=(n=this.shadowRoot)==null?void 0:n.querySelector(`#${ule}`);t&&(this.paginationObserver=new IntersectionObserver(([r])=>{if(r!=null&&r.isIntersecting&&!this.loading){const{page:s,count:i,wallets:o}=ze.state;o.length<i&&ze.fetchWalletsByPage({page:s+1})}}),this.paginationObserver.observe(t))}onConnectWallet(t){Pe.selectWalletConnector(t)}};c1.styles=OMt;w3([se()],c1.prototype,"loading",void 0);w3([se()],c1.prototype,"wallets",void 0);w3([se()],c1.prototype,"recommended",void 0);w3([se()],c1.prototype,"featured",void 0);w3([se()],c1.prototype,"filteredWallets",void 0);c1=w3([ct("w3m-all-wallets-list")],c1);const kMt=Xe` 10141 wui-grid, 10142 wui-loading-spinner, 10143 wui-flex { 10144 height: 360px; 10145 } 10146 10147 wui-grid { 10148 overflow: scroll; 10149 scrollbar-width: none; 10150 grid-auto-rows: min-content; 10151 grid-template-columns: repeat(auto-fill, 104px); 10152 } 10153 10154 wui-grid[data-scroll='false'] { 10155 overflow: hidden; 10156 } 10157 10158 wui-grid::-webkit-scrollbar {
10159 display: none; 10160 } 10161 10162 wui-loading-spinner { 10163 justify-content: center; 10164 align-items: center; 10165 } 10166 10167 @media (max-width: 350px) { 10168 wui-grid { 10169 grid-template-columns: repeat(2, 1fr); 10170 } 10171 } 10172`;var zP=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let p6=class extends ce{constructor(){super(...arguments),this.prevQuery="",this.prevBadge=void 0,this.loading=!0,this.query=""}render(){return this.onSearch(),this.loading?j`<wui-loading-spinner color="accent-100"></wui-loading-spinner>`:this.walletsTemplate()}async onSearch(){(this.query.trim()!==this.prevQuery.trim()||this.badge!==this.prevBadge)&&(this.prevQuery=this.query,this.prevBadge=this.badge,this.loading=!0,await ze.searchWallet({search:this.query,badge:this.badge}),this.loading=!1)}walletsTemplate(){const{search:t}=ze.state,n=hy.markWalletsAsInstalled(t);return t.length?j` 10173 <wui-grid 10174 data-testid="wallet-list" 10175 .padding=${["0","s","s","s"]} 10176 rowGap="l" 10177 columnGap="xs" 10178 justifyContent="space-between" 10179 > 10180 ${n.map(r=>j` 10181 <w3m-all-wallets-list-item 10182 @click=${()=>this.onConnectWallet(r)} 10183 .wallet=${r} 10184 data-testid="wallet-search-item-${r.id}" 10185 ></w3m-all-wallets-list-item> 10186 `)} 10187 </wui-grid> 10188 `:j` 10189 <wui-flex 10190 data-testid="no-wallet-found" 10191 justifyContent="center" 10192 alignItems="center" 10193 gap="s" 10194 flexDirection="column" 10195 > 10196 <wui-icon-box 10197 size="lg" 10198 iconColor="fg-200" 10199 backgroundColor="fg-300" 10200 icon="wallet" 10201 background="transparent" 10202 ></wui-icon-box> 10203 <wui-text data-testid="no-wallet-found-text" color="fg-200" variant="paragraph-500"> 10204 No Wallet found 10205 </wui-text> 10206 </wui-flex> 10207 `}onConnectWallet(t){Pe.selectWalletConnector(t)}};p6.styles=kMt;zP([se()],p6.prototype,"loading",void 0);zP([z()],p6.prototype,"query",void 0);zP([z()],p6.prototype,"badge",void 0);p6=zP([ct("w3m-all-wallets-search")],p6);var cZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let fC=class extends ce{constructor(){super(...arguments),this.search="",this.onDebouncedSearch=Re.debounce(t=>{this.search=t})}render(){const t=this.search.length>=2;return j` 10208 <wui-flex .padding=${["0","s","s","s"]} gap="xs"> 10209 <wui-search-bar @inputChange=${this.onInputChange.bind(this)}></wui-search-bar> 10210 <wui-certified-switch 10211 ?checked=${this.badge} 10212 @click=${this.onClick.bind(this)} 10213 data-testid="wui-certified-switch" 10214 ></wui-certified-switch> 10215 ${this.qrButtonTemplate()} 10216 </wui-flex> 10217 ${t||this.badge?j`<w3m-all-wallets-search 10218 query=${this.search} 10219 badge=${ge(this.badge)} 10220 ></w3m-all-wallets-search>`:j`<w3m-all-wallets-list badge=${ge(this.badge)}></w3m-all-wallets-list>`} 10221 `}onInputChange(t){this.onDebouncedSearch(t.detail)}onClick(){if(this.badge==="certified"){this.badge=void 0;return}this.badge="certified",vs.showSvg("Only WalletConnect certified",{icon:"walletConnectBrown",iconColor:"accent-100"})}qrButtonTemplate(){return Re.isMobile()?j` 10222 <wui-icon-box 10223 size="lg" 10224 iconSize="xl" 10225 iconColor="accent-100" 10226 backgroundColor="accent-100" 10227 icon="qrCode" 10228 background="transparent" 10229 border 10230 borderColor="wui-accent-glass-010" 10231 @click=${this.onWalletConnectQr.bind(this)} 10232 ></wui-icon-box> 10233 `:null}onWalletConnectQr(){Le.push("ConnectingWalletConnect")}};cZ([se()],fC.prototype,"search",void 0);cZ([se()],fC.prototype,"badge",void 0);fC=cZ([ct("w3m-all-wallets-view")],fC);const RMt=Xe` 10234 button { 10235 column-gap: var(--wui-spacing-s); 10236 padding: 11px 18px 11px var(--wui-spacing-s); 10237 width: 100%; 10238 background-color: var(--wui-color-gray-glass-002); 10239 border-radius: var(--wui-border-radius-xs); 10240 color: var(--wui-color-fg-250); 10241 transition: 10242 color var(--wui-ease-out-power-1) var(--wui-duration-md), 10243 background-color var(--wui-ease-out-power-1) var(--wui-duration-md); 10244 will-change: color, background-color; 10245 } 10246 10247 button[data-iconvariant='square'], 10248 button[data-iconvariant='square-blue'] { 10249 padding: 6px 18px 6px 9px; 10250 } 10251 10252 button > wui-flex { 10253 flex: 1; 10254 } 10255 10256 button > wui-image { 10257 width: 32px; 10258 height: 32px; 10259 box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); 10260 border-radius: var(--wui-border-radius-3xl); 10261 } 10262 10263 button > wui-icon { 10264 width: 36px; 10265 height: 36px; 10266 transition: opacity var(--wui-ease-out-power-1) var(--wui-duration-md); 10267 will-change: opacity; 10268 } 10269 10270 button > wui-icon-box[data-variant='blue'] { 10271 box-shadow: 0 0 0 2px var(--wui-color-accent-glass-005); 10272 } 10273 10274 button > wui-icon-box[data-variant='overlay'] { 10275 box-shadow: 0 0 0 2px var(--wui-color-gray-glass-005); 10276 } 10277 10278 button > wui-icon-box[data-variant='square-blue'] { 10279 border-radius: var(--wui-border-radius-3xs); 10280 position: relative; 10281 border: none; 10282 width: 36px; 10283 height: 36px; 10284 } 10285 10286 button > wui-icon-box[data-variant='square-blue']::after { 10287 content: ''; 10288 position: absolute; 10289 top: 0; 10290 bottom: 0; 10291 left: 0; 10292 right: 0; 10293 border-radius: inherit; 10294 border: 1px solid var(--wui-color-accent-glass-010); 10295 pointer-events: none; 10296 } 10297 10298 button > wui-icon:last-child { 10299 width: 14px; 10300 height: 14px; 10301 } 10302 10303 button:disabled { 10304 color: var(--wui-color-gray-glass-020); 10305 } 10306 10307 button[data-loading='true'] > wui-icon { 10308 opacity: 0; 10309 } 10310 10311 wui-loading-spinner { 10312 position: absolute; 10313 right: 18px; 10314 top: 50%; 10315 transform: translateY(-50%); 10316 } 10317`;var uh=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let xl=class extends ce{constructor(){super(...arguments),this.tabIdx=void 0,this.variant="icon",this.disabled=!1,this.imageSrc=void 0,this.alt=void 0,this.chevron=!1,this.loading=!1}render(){return j` 10318 <button 10319 ?disabled=${this.loading?!0:!!this.disabled} 10320 data-loading=${this.loading} 10321 data-iconvariant=${ge(this.iconVariant)} 10322 tabindex=${ge(this.tabIdx)} 10323 > 10324 ${this.loadingTemplate()} ${this.visualTemplate()} 10325 <wui-flex gap="3xs"> 10326 <slot></slot> 10327 </wui-flex> 10328 ${this.chevronTemplate()} 10329 </button> 10330 `}visualTemplate(){if(this.variant==="image"&&this.imageSrc)return j`<wui-image src=${this.imageSrc} alt=${this.alt??"list item"}></wui-image>`;if(this.iconVariant==="square"&&this.icon&&this.variant==="icon")return j`<wui-icon name=${this.icon}></wui-icon>`;if(this.variant==="icon"&&this.icon&&this.iconVariant){const t=["blue","square-blue"].includes(this.iconVariant)?"accent-100":"fg-200",n=this.iconVariant==="square-blue"?"mdl":"md",r=this.iconSize?this.iconSize:n;return j` 10331 <wui-icon-box 10332 data-variant=${this.iconVariant} 10333 icon=${this.icon} 10334 iconSize=${r} 10335 background="transparent" 10336 iconColor=${t} 10337 backgroundColor=${t} 10338 size=${n} 10339 ></wui-icon-box> 10340 `}return null}loadingTemplate(){return this.loading?j`<wui-loading-spinner 10341 data-testid="wui-list-item-loading-spinner" 10342 color="fg-300" 10343 ></wui-loading-spinner>`:j``}chevronTemplate(){return this.chevron?j`<wui-icon size="inherit" color="fg-200" name="chevronRight"></wui-icon>`:null}};xl.styles=[Qn,oo,RMt];uh([z()],xl.prototype,"icon",void 0);uh([z()],xl.prototype,"iconSize",void 0);uh([z()],xl.prototype,"tabIdx",void 0);uh([z()],xl.prototype,"variant",void 0);uh([z()],xl.prototype,"iconVariant",void 0);uh([z({type:Boolean})],xl.prototype,"disabled",void 0);uh([z()],xl.prototype,"imageSrc",void 0);uh([z()],xl.prototype,"alt",void 0);uh([z({type:Boolean})],xl.prototype,"chevron",void 0);uh([z({type:Boolean})],xl.prototype,"loading",void 0);xl=uh([ct("wui-list-item")],xl);var BMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let fq=class extends ce{constructor(){var t;super(...arguments),this.wallet=(t=Le.state.data)==null?void 0:t.wallet}
10343render(){if(!this.wallet)throw new Error("w3m-downloads-view");return j` 10344 <wui-flex gap="xs" flexDirection="column" .padding=${["s","s","l","s"]}> 10345 ${this.chromeTemplate()} ${this.iosTemplate()} ${this.androidTemplate()} 10346 ${this.homepageTemplate()} 10347 </wui-flex> 10348 `}chromeTemplate(){var t;return(t=this.wallet)!=null&&t.chrome_store?j`<wui-list-item 10349 variant="icon" 10350 icon="chromeStore" 10351 iconVariant="square" 10352 @click=${this.onChromeStore.bind(this)} 10353 chevron 10354 > 10355 <wui-text variant="paragraph-500" color="fg-100">Chrome Extension</wui-text> 10356 </wui-list-item>`:null}iosTemplate(){var t;return(t=this.wallet)!=null&&t.app_store?j`<wui-list-item 10357 variant="icon" 10358 icon="appStore" 10359 iconVariant="square" 10360 @click=${this.onAppStore.bind(this)} 10361 chevron 10362 > 10363 <wui-text variant="paragraph-500" color="fg-100">iOS App</wui-text> 10364 </wui-list-item>`:null}androidTemplate(){var t;return(t=this.wallet)!=null&&t.play_store?j`<wui-list-item 10365 variant="icon" 10366 icon="playStore" 10367 iconVariant="square" 10368 @click=${this.onPlayStore.bind(this)} 10369 chevron 10370 > 10371 <wui-text variant="paragraph-500" color="fg-100">Android App</wui-text> 10372 </wui-list-item>`:null}homepageTemplate(){var t;return(t=this.wallet)!=null&&t.homepage?j` 10373 <wui-list-item 10374 variant="icon" 10375 icon="browser" 10376 iconVariant="square-blue" 10377 @click=${this.onHomePage.bind(this)} 10378 chevron 10379 > 10380 <wui-text variant="paragraph-500" color="fg-100">Website</wui-text> 10381 </wui-list-item> 10382 `:null}onChromeStore(){var t;(t=this.wallet)!=null&&t.chrome_store&&Re.openHref(this.wallet.chrome_store,"_blank")}onAppStore(){var t;(t=this.wallet)!=null&&t.app_store&&Re.openHref(this.wallet.app_store,"_blank")}onPlayStore(){var t;(t=this.wallet)!=null&&t.play_store&&Re.openHref(this.wallet.play_store,"_blank")}onHomePage(){var t;(t=this.wallet)!=null&&t.homepage&&Re.openHref(this.wallet.homepage,"_blank")}};fq=BMt([ct("w3m-downloads-view")],fq);const DMt=Object.freeze(Object.defineProperty({__proto__:null,get W3mAllWalletsView(){return fC},get W3mConnectingWcBasicView(){return TN},get W3mDownloadsView(){return fq}},Symbol.toStringTag,{value:"Module"})),UMt=Xe` 10383 :host { 10384 display: block; 10385 border-radius: clamp(0px, var(--wui-border-radius-l), 44px); 10386 box-shadow: 0 0 0 1px var(--wui-color-gray-glass-005); 10387 background-color: var(--wui-color-modal-bg); 10388 overflow: hidden; 10389 } 10390 10391 :host([data-embedded='true']) { 10392 box-shadow: 10393 0 0 0 1px var(--wui-color-gray-glass-005), 10394 0px 4px 12px 4px var(--w3m-card-embedded-shadow-color); 10395 } 10396`;var LMt=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let pq=class extends ce{render(){return j`<slot></slot>`}};pq.styles=[Qn,UMt];pq=LMt([ct("wui-card")],pq);const MMt=Xe` 10397 :host { 10398 display: flex; 10399 align-items: center; 10400 justify-content: center; 10401 padding: var(--wui-spacing-s); 10402 border-radius: var(--wui-border-radius-s); 10403 border: 1px solid var(--wui-color-dark-glass-100); 10404 box-sizing: border-box; 10405 background-color: var(--wui-color-bg-325); 10406 box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25); 10407 } 10408 10409 wui-flex { 10410 width: 100%; 10411 } 10412 10413 wui-text { 10414 word-break: break-word; 10415 flex: 1; 10416 } 10417 10418 .close { 10419 cursor: pointer; 10420 } 10421 10422 .icon-box { 10423 height: 40px; 10424 width: 40px; 10425 border-radius: var(--wui-border-radius-3xs); 10426 background-color: var(--local-icon-bg-value); 10427 } 10428`;var hx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let Qy=class extends ce{constructor(){super(...arguments),this.message="",this.backgroundColor="accent-100",this.iconColor="accent-100",this.icon="info"}render(){return this.style.cssText=` 10429 --local-icon-bg-value: var(--wui-color-${this.backgroundColor}); 10430 `,j` 10431 <wui-flex flexDirection="row" justifyContent="space-between" alignItems="center"> 10432 <wui-flex columnGap="xs" flexDirection="row" alignItems="center"> 10433 <wui-flex 10434 flexDirection="row" 10435 alignItems="center" 10436 justifyContent="center" 10437 class="icon-box" 10438 > 10439 <wui-icon color=${this.iconColor} size="md" name=${this.icon}></wui-icon> 10440 </wui-flex> 10441 <wui-text variant="small-500" color="bg-350" data-testid="wui-alertbar-text" 10442 >${this.message}</wui-text 10443 > 10444 </wui-flex> 10445 <wui-icon 10446 class="close" 10447 color="bg-350" 10448 size="sm" 10449 name="close" 10450 @click=${this.onClose} 10451 ></wui-icon> 10452 </wui-flex> 10453 `}onClose(){vd.close()}};Qy.styles=[Qn,MMt];hx([z()],Qy.prototype,"message",void 0);hx([z()],Qy.prototype,"backgroundColor",void 0);hx([z()],Qy.prototype,"iconColor",void 0);hx([z()],Qy.prototype,"icon",void 0);Qy=hx([ct("wui-alertbar")],Qy);const jMt=Xe` 10454 :host { 10455 display: block; 10456 position: absolute; 10457 top: var(--wui-spacing-s); 10458 left: var(--wui-spacing-l); 10459 right: var(--wui-spacing-l); 10460 opacity: 0; 10461 pointer-events: none; 10462 } 10463`;var h$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const FMt={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"exclamationTriangle"}};let BN=class extends ce{constructor(){super(),this.unsubscribe=[],this.open=vd.state.open,this.onOpen(!0),this.unsubscribe.push(vd.subscribeKey("open",t=>{this.open=t,this.onOpen(!1)}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:n}=vd.state,r=FMt[n];return j` 10464 <wui-alertbar 10465 message=${t} 10466 backgroundColor=${r==null?void 0:r.backgroundColor} 10467 iconColor=${r==null?void 0:r.iconColor} 10468 icon=${r==null?void 0:r.icon} 10469 ></wui-alertbar> 10470 `}onOpen(t){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):t||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};BN.styles=jMt;h$e([se()],BN.prototype,"open",void 0);BN=h$e([ct("w3m-alertbar")],BN);const zMt=Xe` 10471 button { 10472 border-radius: var(--local-border-radius); 10473 color: var(--wui-color-fg-100); 10474 padding: var(--local-padding); 10475 } 10476 10477 @media (max-width: 700px) { 10478 button { 10479 padding: var(--wui-spacing-s); 10480 } 10481 } 10482 10483 button > wui-icon { 10484 pointer-events: none; 10485 } 10486 10487 button:disabled > wui-icon { 10488 color: var(--wui-color-bg-300) !important; 10489 } 10490 10491 button:disabled { 10492 background-color: transparent; 10493 } 10494`;var fx=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let eb=class extends ce{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.icon="copy",this.iconColor="inherit"}render(){const t=this.size==="lg"?"--wui-border-radius-xs":"--wui-border-radius-xxs",n=this.size==="lg"?"--wui-spacing-1xs":"--wui-spacing-2xs";return this.style.cssText=` 10495 --local-border-radius: var(${t}); 10496 --local-padding: var(${n}); 10497`,j` 10498 <button ?disabled=${this.disabled}> 10499 <wui-icon color=${this.iconColor} size=${this.size} name=${this.icon}></wui-icon> 10500 </button> 10501 `}};eb.styles=[Qn,oo,E$,zMt];fx([z()],eb.prototype,"size",void 0);fx([z({type:Boolean})],eb.prototype,"disabled",void 0);fx([z()],eb.prototype,"icon",void 0);fx([z()],eb.prototype,"iconColor",void 0);eb=fx([ct("wui-icon-link")],eb);const qMt=Xe` 10502 button { 10503 display: block; 10504 display: flex; 10505 align-items: center; 10506 padding: var(--wui-spacing-xxs); 10507 gap: var(--wui-spacing-xxs); 10508 transition: all var(--wui-ease-out-power-1) var(--wui-duration-md); 10509 border-radius: var(--wui-border-radius-xxs); 10510 } 10511 10512 wui-image { 10513 border-radius: 100%; 10514 width: var(--wui-spacing-xl); 10515 height: var(--wui-spacing-xl); 10516 } 10517 10518 wui-icon-box { 10519 width: var(--wui-spacing-xl); 10520 height: var(--wui-spacing-xl); 10521 } 10522 10523 button:hover { 10524 background-color: var(--wui-color-gray-glass-002); 10525 } 10526 10527 button:active { 10528 background-color: var(--wui-color-gray-glass-005); 10529 } 10530`;var f$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let DN=class extends ce{constructor(){super(...arguments),this.imageSrc=""}render(){return j`<button> 10531 ${this.imageTemplate()} 10532 <wui-icon size="xs" color="fg-200" name="chevronBottom"></wui-icon> 10533 </button>`}imageTemplate(){return this.imageSrc?j`<wui-image src=${this.imageSrc} alt="select visual"></wui-image>`:j`<wui-icon-box 10534 size="xxs" 10535 iconColor="fg-200" 10536 backgroundColor="fg-100" 10537 background="opaque" 10538 icon="networkPlaceholder" 10539 ></wui-icon-box>`}};DN.styles=[Qn,oo,E$,qMt];f$e([z()],DN.prototype,"imageSrc",void 0);DN=f$e([ct("wui-select")],DN);const WMt=Xe` 10540 :host { 10541 height: 64px; 10542 } 10543 10544 wui-text { 10545 text-transform: capitalize; 10546 } 10547 10548 wui-flex.w3m-header-title { 10549 transform: translateY(0); 10550 opacity: 1; 10551 } 10552 10553 wui-flex.w3m-header-title[view-direction='prev'] { 10554 animation: 10555 slide-down-out 120ms forwards var(--wui-ease-out-power-2), 10556 slide-down-in 120ms forwards var(--wui-ease-out-power-2); 10557 animation-delay: 0ms, 200ms; 10558 } 10559 10560 wui-flex.w3m-header-title[view-direction='next'] { 10561 animation: 10562 slide-up-out 120ms forwards var(--wui-ease-out-power-2), 10563 slide-up-in 120ms forwards var(--wui-ease-out-power-2); 10564 animation-delay: 0ms, 200ms; 10565 } 10566 10567 wui-icon-link[data-hidden='true'] { 10568 opacity: 0 !important; 10569 pointer-events: none; 10570 } 10571 10572 @keyframes slide-up-out { 10573 from { 10574 transform: translateY(0px); 10575 opacity: 1; 10576 } 10577 to { 10578 transform: translateY(3px); 10579 opacity: 0; 10580 } 10581 } 10582 10583 @keyframes slide-up-in { 10584 from { 10585 transform: translateY(-3px); 10586 opacity: 0; 10587 } 10588 to { 10589 transform: translateY(0); 10590 opacity: 1; 10591 } 10592 } 10593 10594 @keyframes slide-down-out { 10595 from { 10596 transform: translateY(0px); 10597 opacity: 1; 10598 } 10599 to { 10600 transform: translateY(-3px); 10601 opacity: 0; 10602 } 10603 } 10604 10605 @keyframes slide-down-in { 10606 from { 10607 transform: translateY(3px); 10608 opacity: 0; 10609 } 10610 to { 10611 transform: translateY(0); 10612 opacity: 1; 10613 } 10614 } 10615`;var J0=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const HMt=["SmartSessionList"];function vU(){var o,a,c,l,u,d,h;const e=(a=(o=Le.state.data)==null?void 0:o.connector)==null?void 0:a.name,t=(l=(c=Le.state.data)==null?void 0:c.wallet)==null?void 0:l.name,n=(d=(u=Le.state.data)==null?void 0:u.network)==null?void 0:d.name,r=t??e,s=Pe.getConnectors();return{Connect:`Connect ${s.length===1&&((h=s[0])==null?void 0:h.id)==="w3m-email"?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",ConnectingExter
10615nal:r??"Connect Wallet",ConnectingWalletConnect:r??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview convert",Downloads:r?`Get ${r}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",Profile:void 0,SwitchNetwork:n??"Switch Network",SwitchAddress:"Switch Address",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade your Wallet",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:Et.state.socialProvider?Et.state.socialProvider:"Connect Social",ConnectingMultiChain:"Select chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Payment in progress"}}let rh=class extends ce{constructor(){super(),this.unsubscribe=[],this.heading=vU()[Le.state.view],this.network=J.state.activeCaipNetwork,this.networkImage=ti.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=Le.state.view,this.viewDirection="",this.headerText=vU()[Le.state.view],this.unsubscribe.push(oc.subscribeNetworkImages(()=>{this.networkImage=ti.getNetworkImage(this.network)}),Le.subscribeKey("view",t=>{setTimeout(()=>{this.view=t,this.headerText=vU()[t]},hm.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),J.subscribeKey("activeCaipNetwork",t=>{this.network=t,this.networkImage=ti.getNetworkImage(this.network)}))}disconnectCallback(){this.unsubscribe.forEach(t=>t())}render(){return j` 10616 <wui-flex .padding=${this.getPadding()} justifyContent="space-between" alignItems="center"> 10617 ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()} 10618 </wui-flex> 10619 `}onWalletHelp(){bn.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),Le.push("WhatIsAWallet")}async onClose(){await Jye.safeClose()}rightHeaderTemplate(){var n,r;const t=(r=(n=we==null?void 0:we.state)==null?void 0:n.features)==null?void 0:r.smartSessions;return Le.state.view!=="Account"||!t?this.closeButtonTemplate():j`<wui-flex> 10620 <wui-icon-link 10621 icon="clock" 10622 @click=${()=>Le.push("SmartSessionList")} 10623 data-testid="w3m-header-smart-sessions" 10624 ></wui-icon-link> 10625 ${this.closeButtonTemplate()} 10626 </wui-flex> `}closeButtonTemplate(){return j` 10627 <wui-icon-link 10628 icon="close" 10629 @click=${this.onClose.bind(this)} 10630 data-testid="w3m-header-close" 10631 ></wui-icon-link> 10632 `}titleTemplate(){const t=HMt.includes(this.view);return j` 10633 <wui-flex 10634 view-direction="${this.viewDirection}" 10635 class="w3m-header-title" 10636 alignItems="center" 10637 gap="xs" 10638 > 10639 <wui-text variant="paragraph-700" color="fg-100" data-testid="w3m-header-text" 10640 >${this.headerText}</wui-text 10641 > 10642 ${t?j`<wui-tag variant="main">Beta</wui-tag>`:null} 10643 </wui-flex> 10644 `}leftHeaderTemplate(){var l;const{view:t}=Le.state,n=t==="Connect",r=we.state.enableEmbedded,s=t==="ApproveTransaction",i=t==="ConnectingSiwe",o=t==="Account",a=we.state.enableNetworkSwitch,c=s||i||n&&r;return o&&a?j`<wui-select 10645 id="dynamic" 10646 data-testid="w3m-account-select-network" 10647 active-network=${ge((l=this.network)==null?void 0:l.name)} 10648 @click=${this.onNetworks.bind(this)} 10649 imageSrc=${ge(this.networkImage)} 10650 ></wui-select>`:this.showBack&&!c?j`<wui-icon-link 10651 data-testid="header-back" 10652 id="dynamic" 10653 icon="chevronLeft" 10654 @click=${this.onGoBack.bind(this)} 10655 ></wui-icon-link>`:j`<wui-icon-link 10656 data-hidden=${!n} 10657 id="dynamic" 10658 icon="helpCircle" 10659 @click=${this.onWalletHelp.bind(this)} 10660 ></wui-icon-link>`}onNetworks(){this.isAllowedNetworkSwitch()&&(bn.sendEvent({type:"track",event:"CLICK_NETWORKS"}),Le.push("Networks"))}isAllowedNetworkSwitch(){const t=J.getAllRequestedCaipNetworks(),n=t?t.length>1:!1,r=t==null?void 0:t.find(({id:s})=>{var i;return s===((i=this.network)==null?void 0:i.id)});return n||!r}getPadding(){return this.heading?["l","2l","l","2l"]:["0","2l","0","2l"]}onViewChange(){const{history:t}=Le.state;let n=hm.VIEW_DIRECTION.Next;t.length<this.prevHistoryLength&&(n=hm.VIEW_DIRECTION.Prev),this.prevHistoryLength=t.length,this.viewDirection=n}async onHistoryChange(){var r;const{history:t}=Le.state,n=(r=this.shadowRoot)==null?void 0:r.querySelector("#dynamic");t.length>1&&!this.showBack&&n?(await n.animate([{opacity:1},{opacity:0}
10660],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):t.length<=1&&this.showBack&&n&&(await n.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,n.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){Le.goBack()}};rh.styles=WMt;J0([se()],rh.prototype,"heading",void 0);J0([se()],rh.prototype,"network",void 0);J0([se()],rh.prototype,"networkImage",void 0);J0([se()],rh.prototype,"showBack",void 0);J0([se()],rh.prototype,"prevHistoryLength",void 0);J0([se()],rh.prototype,"view",void 0);J0([se()],rh.prototype,"viewDirection",void 0);J0([se()],rh.prototype,"headerText",void 0);rh=J0([ct("w3m-header")],rh);const VMt=Xe` 10661 :host { 10662 display: flex; 10663 column-gap: var(--wui-spacing-s); 10664 align-items: center; 10665 padding: var(--wui-spacing-xs) var(--wui-spacing-m) var(--wui-spacing-xs) var(--wui-spacing-xs); 10666 border-radius: var(--wui-border-radius-s); 10667 border: 1px solid var(--wui-color-gray-glass-005); 10668 box-sizing: border-box; 10669 background-color: var(--wui-color-bg-175); 10670 box-shadow: 10671 0px 14px 64px -4px rgba(0, 0, 0, 0.15), 10672 0px 8px 22px -6px rgba(0, 0, 0, 0.15); 10673 10674 max-width: 300px; 10675 } 10676 10677 :host wui-loading-spinner { 10678 margin-left: var(--wui-spacing-3xs); 10679 } 10680`;var jb=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let D0=class extends ce{constructor(){super(...arguments),this.backgroundColor="accent-100",this.iconColor="accent-100",this.icon="checkmark",this.message="",this.loading=!1,this.iconType="default"}render(){return j` 10681 ${this.templateIcon()} 10682 <wui-text variant="paragraph-500" color="fg-100" data-testid="wui-snackbar-message" 10683 >${this.message}</wui-text 10684 > 10685 `}templateIcon(){return this.loading?j`<wui-loading-spinner size="md" color="accent-100"></wui-loading-spinner>`:this.iconType==="default"?j`<wui-icon size="xl" color=${this.iconColor} name=${this.icon}></wui-icon>`:j`<wui-icon-box 10686 size="sm" 10687 iconSize="xs" 10688 iconColor=${this.iconColor} 10689 backgroundColor=${this.backgroundColor} 10690 icon=${this.icon} 10691 background="opaque" 10692 ></wui-icon-box>`}};D0.styles=[Qn,VMt];jb([z()],D0.prototype,"backgroundColor",void 0);jb([z()],D0.prototype,"iconColor",void 0);jb([z()],D0.prototype,"icon",void 0);jb([z()],D0.prototype,"message",void 0);jb([z()],D0.prototype,"loading",void 0);jb([z()],D0.prototype,"iconType",void 0);D0=jb([ct("wui-snackbar")],D0);const KMt=Xe` 10693 :host { 10694 display: block; 10695 position: absolute; 10696 opacity: 0; 10697 pointer-events: none; 10698 top: 11px; 10699 left: 50%; 10700 width: max-content; 10701 } 10702`;var p$e=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const GMt={loading:void 0,success:{backgroundColor:"success-100",iconColor:"success-100",icon:"checkmark"},error:{backgroundColor:"error-100",iconColor:"error-100",icon:"close"}};let UN=class extends ce{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=vs.state.open,this.unsubscribe.push(vs.subscribeKey("open",t=>{this.open=t,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:n,svg:r}=vs.state,s=GMt[n],{icon:i,iconColor:o}=r??s??{};return j` 10703 <wui-snackbar 10704 message=${t} 10705 backgroundColor=${s==null?void 0:s.backgroundColor} 10706 iconColor=${o} 10707 icon=${i} 10708 .loading=${n==="loading"} 10709 ></wui-snackbar> 10710 `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),vs.state.autoClose&&(this.timeout=setTimeout(()=>vs.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"})}};UN.styles=KMt;p$e([se()],UN.prototype,"open",void 0);UN=p$e([ct("w3m-snackbar")],UN);const ZMt=Xe` 10711 :host { 10712 pointer-events: none; 10713 } 10714 10715 :host > wui-flex { 10716 display: var(--w3m-tooltip-display); 10717 opacity: var(--w3m-tooltip-opacity); 10718 padding: 9px var(--wui-spacing-s) 10px var(--wui-spacing-s); 10719 border-radius: var(--wui-border-radius-xxs); 10720 color: var(--wui-color-bg-100); 10721 position: fixed; 10722 top: var(--w3m-tooltip-top); 10723 left: var(--w3m-tooltip-left); 10724 transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px)); 10725 max-width: calc(var(--w3m-modal-width) - var(--wui-spacing-xl)); 10726 transition: opacity 0.2s var(--wui-ease-out-power-2); 10727 will-change: opacity; 10728 } 10729 10730 :host([data-variant='shade']) > wui-flex { 10731 background-color: var(--wui-color-bg-150); 10732 border: 1px solid var(--wui-color-gray-glass-005); 10733 } 10734 10735 :host([data-variant='shade']) > wui-flex > wui-text { 10736 color: var(--wui-color-fg-150); 10737 } 10738 10739 :host([data-variant='fill']) > wui-flex { 10740 background-color: var(--wui-color-fg-100); 10741 border: none; 10742 } 10743 10744 wui-icon { 10745 position: absolute; 10746 width: 12px !important; 10747 height: 4px !important; 10748 color: var(--wui-color-bg-150); 10749 } 10750 10751 wui-icon[data-placement='top'] { 10752 bottom: 0px; 10753 left: 50%; 10754 transform: translate(-50%, 95%); 10755 } 10756 10757 wui-icon[data-placement='bottom'] { 10758 top: 0; 10759 left: 50%; 10760 transform: translate(-50%, -95%) rotate(180deg); 10761 } 10762 10763 wui-icon[data-placement='right'] { 10764 top: 50%; 10765 left: 0; 10766 transform: translate(-65%, -50%) rotate(90deg); 10767 } 10768 10769 wui-icon[data-placement='left'] { 10770 top: 50%; 10771 right: 0%; 10772 transform: translate(65%, -50%) rotate(270deg); 10773 } 10774`;var px=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let tb=class extends ce{constructor(){super(),this.unsubscribe=[],this.open=nv.state.open,this.message=nv.state.message,this.triggerRect=nv.state.triggerRect,this.variant=nv.state.variant,this.unsubscribe.push(nv.subscribe(t=>{this.open=t.open,this.message=t.message,this.triggerRect=t.triggerRect,this.variant=t.variant}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){this.dataset.variant=this.variant;const t=this.triggerRect.top,n=this.triggerRect.left;return this.style.cssText=` 10775 --w3m-tooltip-top: ${t}px; 10776 --w3m-tooltip-left: ${n}px; 10777 --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px; 10778 --w3m-tooltip-display: ${this.open?"flex":"none"}; 10779 --w3m-tooltip-opacity: ${this.open?1:0}; 10780 `,j`<wui-flex> 10781 <wui-icon data-placement="top" color="fg-100" size="inherit" name="cursor"></wui-icon> 10782 <wui-text color="inherit" variant="small-500">${this.message}</wui-text> 10783 </wui-flex>`}};tb.styles=[ZMt];px([se()],tb.prototype,"open",void 0);px([se()],tb.prototype,"message",void 0);px([se()],tb.prototype,"triggerRect",void 0);px([se()],tb.prototype,"variant",void 0);tb=px([ct("w3m-tooltip"),ct("w3m-tooltip")],tb);const YMt=Xe` 10784 :host { 10785 --prev-height: 0px; 10786 --new-height: 0px; 10787 display: block; 10788 } 10789 10790 div.w3m-router-container { 10791 transform: translateY(0); 10792 opacity: 1; 10793 } 10794 10795 div.w3m-router-container[view-direction='prev'] { 10796 animation: 10797 slide-left-out 150ms forwards ease, 10798 slide-left-in 150ms forwards ease; 10799 animation-delay: 0ms, 200ms; 10800 } 10801 10802 div.w3m-router-container[view-direction='next'] { 10803 animation: 10804 slide-right-out 150ms forwards ease, 10805 slide-right-in 150ms forwards ease; 10806 animation-delay: 0ms, 200ms; 10807 } 10808 10809 @keyframes slide-left-out { 10810 from { 10811 transform: translateX(0px); 10812 opacity: 1; 10813 } 10814 to { 10815 transform: translateX(10px); 10816 opacity: 0; 10817 } 10818 } 10819 10820 @keyframes slide-left-in { 10821 from { 10822 transform: translateX(-10px); 10823 opacity: 0; 10824 } 10825 to { 10826 transform: translateX(0); 10827 opacity: 1; 10828 } 10829 } 10830 10831 @keyframes slide-right-out { 10832 from { 10833 transform: translateX(0px); 10834 opacity: 1; 10835 } 10836 to { 10837 transform: translateX(-10px); 10838 opacity: 0; 10839 } 10840 } 10841 10842 @keyframes slide-right-in { 10843 from { 10844 transform: translateX(10px); 10845 opacity: 0; 10846 } 10847 to { 10848 transform: translateX(0); 10849 opacity: 1; 10850 } 10851 } 10852`;var lZ=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};let pC=class extends ce{constructor(){super(),this.resizeObserver=void 0,this.prevHeight="0px",this.prevHistoryLength=1,this.unsubscribe=[],this.view=Le.state.view,this.viewDirection="",this.unsubscribe.push(Le.subscribeKey("view",t=>this.onViewChange(t)))}firstUpdated(){var t;this.resizeObserver=new ResizeObserver(([n])=>{const r=`${n==null?void 0:n.contentRect.height}px`;this.prevHeight!=="0px"&&(this.style.setProperty("--prev-height",this.prevHeight),this.style.setProperty("--new-height",r),this.style.animation="w3m-view-height 150ms forwards ease",this.style.height="auto"),setTimeout(()=>{this.prevHeight=r,this.style.animation="unset"}
10852,hm.ANIMATION_DURATIONS.ModalHeight)}),(t=this.resizeObserver)==null||t.observe(this.getWrapper())}disconnectedCallback(){var t;(t=this.resizeObserver)==null||t.unobserve(this.getWrapper()),this.unsubscribe.forEach(n=>n())}render(){return j`<div class="w3m-router-container" view-direction="${this.viewDirection}"> 10853 ${this.viewTemplate()} 10854 </div>`}viewTemplate(){switch(this.view){case"AccountSettings":return j`<w3m-account-settings-view></w3m-account-settings-view>`;case"Account":return j`<w3m-account-view></w3m-account-view>`;case"AllWallets":return j`<w3m-all-wallets-view></w3m-all-wallets-view>`;case"ApproveTransaction":return j`<w3m-approve-transaction-view></w3m-approve-transaction-view>`;case"BuyInProgress":return j`<w3m-buy-in-progress-view></w3m-buy-in-progress-view>`;case"ChooseAccountName":return j`<w3m-choose-account-name-view></w3m-choose-account-name-view>`;case"Connect":return j`<w3m-connect-view></w3m-connect-view>`;case"Create":return j`<w3m-connect-view walletGuide="explore"></w3m-connect-view>`;case"ConnectingWalletConnect":return j`<w3m-connecting-wc-view></w3m-connecting-wc-view>`;case"ConnectingWalletConnectBasic":return j`<w3m-connecting-wc-basic-view></w3m-connecting-wc-basic-view>`;case"ConnectingExternal":return j`<w3m-connecting-external-view></w3m-connecting-external-view>`;case"ConnectingSiwe":return j`<w3m-connecting-siwe-view></w3m-connecting-siwe-view>`;case"ConnectWallets":return j`<w3m-connect-wallets-view></w3m-connect-wallets-view>`;case"ConnectSocials":return j`<w3m-connect-socials-view></w3m-connect-socials-view>`;case"ConnectingSocial":return j`<w3m-connecting-social-view></w3m-connecting-social-view>`;case"Downloads":return j`<w3m-downloads-view></w3m-downloads-view>`;case"EmailLogin":return j`<w3m-email-login-view></w3m-email-login-view>`;case"EmailVerifyOtp":return j`<w3m-email-verify-otp-view></w3m-email-verify-otp-view>`;case"EmailVerifyDevice":return j`<w3m-email-verify-device-view></w3m-email-verify-device-view>`;case"GetWallet":return j`<w3m-get-wallet-view></w3m-get-wallet-view>`;case"Networks":return j`<w3m-networks-view></w3m-networks-view>`;case"SwitchNetwork":return j`<w3m-network-switch-view></w3m-network-switch-view>`;case"Profile":return j`<w3m-profile-view></w3m-profile-view>`;case"SwitchAddress":return j`<w3m-switch-address-view></w3m-switch-address-view>`;case"Transactions":return j`<w3m-transactions-view></w3m-transactions-view>`;case"OnRampProviders":return j`<w3m-onramp-providers-view></w3m-onramp-providers-view>`;case"OnRampActivity":return j`<w3m-onramp-activity-view></w3m-onramp-activity-view>`;case"OnRampTokenSelect":return j`<w3m-onramp-token-select-view></w3m-onramp-token-select-view>`;case"OnRampFiatSelect":return j`<w3m-onramp-fiat-select-view></w3m-onramp-fiat-select-view>`;case"UpgradeEmailWallet":return j`<w3m-upgrade-wallet-view></w3m-upgrade-wallet-view>`;case"UpdateEmailWallet":return j`<w3m-update-email-wallet-view></w3m-update-email-wallet-view>`;case"UpdateEmailPrimaryOtp":return j`<w3m-update-email-primary-otp-view></w3m-update-email-primary-otp-view>`;case"UpdateEmailSecondaryOtp":return j`<w3m-update-email-secondary-otp-view></w3m-update-email-secondary-otp-view>`;case"UnsupportedChain":return j`<w3m-unsupported-chain-view></w3m-unsupported-chain-view>`;case"Swap":return j`<w3m-swap-view></w3m-swap-view>`;case"SwapSelectToken":return j`<w3m-swap-select-token-view></w3m-swap-select-token-view>`;case"SwapPreview":return j`<w3m-swap-preview-view></w3m-swap-preview-view>`;case"WalletSend":return j`<w3m-wallet-send-view></w3m-wallet-send-view>`;case"WalletSendSelectToken":return j`<w3m-wallet-send-select-token-view></w3m-wallet-send-select-token-view>`;case"WalletSendPreview":return j`<w3m-wallet-send-preview-view></w3m-wallet-send-preview-view>`;case"WhatIsABuy":return j`<w3m-what-is-a-buy-view></w3m-what-is-a-buy-view>`;case"WalletReceive":return j`<w3m-wallet-receive-view></w3m-wallet-receive-view>`;case"WalletCompatibleNetworks":return j`<w3m-wallet-compatible-networks-view></w3m-wallet-compatible-networks-view>`;case"WhatIsAWallet":return j`<w3m-what-is-a-wallet-view></w3m-what-is-a-wallet-view>`;case"ConnectingMultiChain":return j`<w3m-connecting-multi-chain-view></w3m-connecting-multi-chain-view>`;case"WhatIsANetwork":return j`<w3m-what-is-a-network-view></w3m-what-is-a-network-view>`;case"ConnectingFarcaster":return j`<w3m-connecting-farcaster-view></w3m-connecting-farcaster-view>`;case"SwitchActiveChain":return j`<w3m-switch-active-chain-view></w3m-switch-active-chain-view>`;case"RegisterAccountName":return j`<w3m-register-account-name-view></w3m-register-account-name-view>`;case"RegisterAccountNameSuccess":return j`<w3m-register-account-name-success-view></w3m-register-account-name-success-view>`;case"SmartSessionCreated":return j`<w3m-smart-session-created-view></w3m-smart-session-created-view>`;case"SmartSessionList":return j`<w3m-smart-session-list-view></w3m-smart-session-list-view>`;case"SIWXSignMessage":return j`<w3m-siwx-sign-message-view></w3m-siwx-sign-message-view>`;case"Pay":return j`<w3m-pay-view></w3m-pay-view>`;case"PayLoading":return j`<w3m-pay-loading-view></w3m-pay-loading-view>`;default:return j`<w3m-connect-view></w3m-connect-view>`}}onViewChange(t){nv.hide();let n=hm.VIEW_DIRECTION.Next;const{history:r}=Le.state;r.length<this.prevHistoryLength&&(n=hm.VIEW_DIRECTION.Prev),this.prevHistoryLength=r.length,this.viewDirection=n,setTimeout(()=>{this.view=t},hm.ANIMATION_DURATIONS.ViewTransition)}getWrapper(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("div")}};pC.styles=YMt;lZ([se()],pC.prototype,"view",void 0);lZ([se()],pC.prototype,"viewDirection",void 0);pC=lZ([ct("w3m-router")],pC);const JMt=Xe` 10855 :host { 10856 z-index: var(--w3m-z-index); 10857 display: block; 10858 backface-visibility: hidden; 10859 will-change: opacity; 10860 position: fixed; 10861 top: 0; 10862 left: 0; 10863 right: 0; 10864 bottom: 0; 10865 pointer-events: none; 10866 opacity: 0; 10867 background-color: var(--wui-cover); 10868 transition: opacity 0.2s var(--wui-ease-out-power-2); 10869 will-change: opacity; 10870 } 10871 10872 :host(.open) { 10873 opacity: 1; 10874 } 10875 10876 :host(.appkit-modal) { 10877 position: relative; 10878 pointer-events: unset; 10879 background: none; 10880 width: 100%; 10881 opacity: 1; 10882 } 10883 10884 wui-card { 10885 max-width: var(--w3m-modal-width); 10886 width: 100%; 10887 position: relative; 10888 animation: zoom-in 0.2s var(--wui-ease-out-power-2); 10889 animation-fill-mode: backwards; 10890 outline: none; 10891 transition: 10892 border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), 10893 background-color var(--wui-duration-lg) var(--wui-ease-out-power-1); 10894 will-change: border-radius, background-color; 10895 } 10896 10897 :host(.appkit-modal) wui-card { 10898 max-width: 400px; 10899 } 10900 10901 wui-card[shake='true'] { 10902 animation: 10903 zoom-in 0.2s var(--wui-ease-out-power-2), 10904 w3m-shake 0.5s var(--wui-ease-out-power-2); 10905 } 10906 10907 wui-flex { 10908 overflow-x: hidden; 10909 overflow-y: auto; 10910 display: flex; 10911 align-items: center; 10912 justify-content: center; 10913 width: 100%; 10914 height: 100%; 10915 } 10916 10917 @media (max-height: 700px) and (min-width: 431px) { 10918 wui-flex { 10919 align-items: flex-start; 10920 } 10921 10922 wui-card { 10923 margin: var(--wui-spacing-xxl) 0px; 10924 } 10925 } 10926 10927 @media (max-width: 430px) { 10928 wui-flex { 10929 align-items: flex-end; 10930 } 10931 10932 wui-card { 10933 max-width: 100%; 10934 border-bottom-left-radius: var(--local-border-bottom-mobile-radius); 10935 border-bottom-right-radius: var(--local-border-bottom-mobile-radius); 10936 border-bottom: none; 10937 animation: slide-in 0.2s var(--wui-ease-out-power-2); 10938 } 10939 10940 wui-card[shake='true'] { 10941 animation: 10942 slide-in 0.2s var(--wui-ease-out-power-2), 10943 w3m-shake 0.5s var(--wui-ease-out-power-2); 10944 } 10945 } 10946 10947 @keyframes zoom-in { 10948 0% { 10949 transform: scale(0.95) translateY(0); 10950 } 10951 100% { 10952 transform: scale(1) translateY(0); 10953 } 10954 } 10955 10956 @keyframes slide-in { 10957 0% { 10958 transform: scale(1) translateY(50px); 10959 } 10960 100% { 10961 transform: scale(1) translateY(0); 10962 } 10963 } 10964 10965 @keyframes w3m-shake { 10966 0% { 10967 transform: scale(1) rotate(0deg); 10968 } 10969 20% { 10970 transform: scale(1) rotate(-1deg); 10971 } 10972 40% { 10973 transform: scale(1) rotate(1.5deg); 10974 } 10975 60% { 10976 transform: scale(1) rotate(-1.5deg); 10977 } 10978 80% { 10979 transform: scale(1) rotate(1deg); 10980 } 10981 100% { 10982 transform: scale(1) rotate(0deg); 10983 } 10984 } 10985 10986 @keyframes w3m-view-height { 10987 from { 10988 height: var(--prev-height); 10989 } 10990 to { 10991 height: var(--new-height); 10992 } 10993 } 10994`;var x1=function(e,t,n,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i};const dle="scroll-lock";class _f extends ce{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=we.state.enableEmbedded,this.open=ir.state.open,this.caipAddress=J.state.activeCaipAddress,this.caipNetwork=J.state.activeCaipNetwork,this.shake=ir.state.shake,this.filterByNamespace=Pe.state.filterByNamespace,this.initializeTheming(),ze.prefetchAnalyticsConfig(),this.unsubscribe.push(ir.subscribeKey("open",t=>t?this.onOpen():this.onClose()),ir.subscribeKey("shake",t=>this.shake=t),J.subscribeKey("activeCaipNetwork",t=>this.onNewNetwork(t)),J.subscribeKey("activeCaipAddress",t=>this.onNewAddress(t)),we.subscribeKey("enableEmbedded",t=>this.enableEmbedded=t),Pe.subscribeKey("filterByNamespace",t=>{var n;this.filterByNamespace!==t&&!((n=J.getAccountData(t))!=null&&n.caipAddress)&&(ze.fetchRecommendedWallets(),this.filterByNamespace=t)}))}firstUpdated(){if(this.caipAddress){if(this.enableEmbedded){ir.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),this.onRemoveKeyboardListener()}render(){return this.style.cssText=` 10995 --local-border-bottom-mobile-radius: ${this.enableEmbedded?"clamp(0px, var(--wui-border-radius-l), 44px)":"0px"}; 10996 `,this.enableEmbedded?j`${this.contentTemplate()} 10997 <w3m-tooltip></w3m-tooltip> `:this.open?j` 10998 <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay"> 10999 ${this.contentTemplate()} 11000 </wui-flex> 11001 <w3m-tooltip></w3m-tooltip> 11002 `:null}contentTemplate(){return j` <wui-card 11003 shake="${this.shake}" 11004 data-embedded="${ge(this.enableEmbedded)}" 11005 role="alertdialog" 11006 aria-modal="true" 11007 tabindex="0" 11008 data-testid="w3m-modal-card" 11009 > 11010 <w3m-header></w3m-header> 11011 <w3m-router></w3m-router> 11012 <w3m-snackbar></w3m-snackbar> 11013 <w3m-alertbar></w3m-alertbar> 11014 </wui-card>`}async onOverlayClick(t){t.target===t.currentTarget&&await this.handleClose()}async handleClose(){await Jye.safeClose()}initializeTheming(){const{themeVariables:t,themeMode:n}=Vi.state,r=yi.getColorTheme(n);cxt(t,r)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),vs.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const t=document.createElement("style");t.dataset.w3m=dle,t.textContent=` 11015 body { 11016 touch-action: none; 11017 overflow: hidden; 11018 overscroll-behavior: contain; 11019 } 11020 w3m-modal { 11021 pointer-events: auto; 11022 } 11023 `,document.head.appendChild(t)}onScrollUnlock(){const t=document.head.querySelector(`style[data-w3m="${dle}"]`);t&&t.remove()}onAddKeyboardListener(){var n;this.abortController=new AbortController;const t=(n=this.shadowRoot)==null?void 0:n.querySelector("wui-card");t==null||t.focus(),window.addEventListener("keydown",r=>{if(r.key==="Escape")this.handleClose();else if(r.key==="Tab"){const{tagName:s}=r.target;s&&!s.includes("W3M-")&&!s.includes("WUI-")&&(t==null||t.focus())}},this.abortController)}onRemoveKeyboardListener(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}async onNewAddress(t){const n=J.state.isSwitchingNamespace,r=Re.getPlainAddress(t);!r&&!n?ir.close():n&&r&&Le.goBack(),await kw.initializeIfEnabled(),this.caipAddress=t,J.setIsSwitchingNamespace(!1)}onNewNetwork(t){var m,w,C;const n=this.caipNetwork,r=(m=n==null?void 0:n.caipNetworkId)==null?void 0:m.toString(),s=n==null?void 0:n.chainNamespace,i=(w=t==null?void 0:t.caipNetworkId)==null?void 0:w.toString(),o=t==null?void 0:t.chainNamespace,a=r!==i,l=a&&!(s!==o),u=(n==null?void 0:n.name)===$t.UNSUPPORTED_NETWORK_NAME,d=Le.state.view==="ConnectingExter
11023nal",h=!((C=J.getAccountData(t==null?void 0:t.chainNamespace))!=null&&C.caipAddress),f=Le.state.view==="UnsupportedChain",g=ir.state.open;let p=!1;g&&!d&&(h?a&&(p=!0):(f||l&&!u)&&(p=!0)),p&&Le.state.view!=="SIWXSignMessage"&&Le.goBack(),this.caipNetwork=t}prefetch(){this.hasPrefetched||(ze.prefetch(),ze.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}_f.styles=JMt;x1([z({type:Boolean})],_f.prototype,"enableEmbedded",void 0);x1([se()],_f.prototype,"open",void 0);x1([se()],_f.prototype,"caipAddress",void 0);x1([se()],_f.prototype,"caipNetwork",void 0);x1([se()],_f.prototype,"shake",void 0);x1([se()],_f.prototype,"filterByNamespace",void 0);let gq=class extends _f{};gq=x1([ct("w3m-modal")],gq);let mq=class extends _f{};mq=x1([ct("appkit-modal")],mq);const XMt=Object.freeze(Object.defineProperty({__proto__:null,get AppKitModal(){return mq},get W3mModal(){return gq},W3mModalBase:_f},Symbol.toStringTag,{value:"Module"})),QMt=ae`<svg 11024 width="14" 11025 height="14" 11026 viewBox="0 0 14 14" 11027 fill="none" 11028 xmlns="http://www.w3.org/2000/svg" 11029> 11030 <path 11031 fill="currentColor" 11032 fill-rule="evenodd" 11033 clip-rule="evenodd" 11034 d="M7.0023 0.875C7.48571 0.875 7.8776 1.26675 7.8776 1.75V6.125H12.2541C12.7375 6.125 13.1294 6.51675 13.1294 7C13.1294 7.48325 12.7375 7.875 12.2541 7.875H7.8776V12.25C7.8776 12.7332 7.48571 13.125 7.0023 13.125C6.51889 13.125 6.12701 12.7332 6.12701 12.25V7.875H1.75054C1.26713 7.875 0.875244 7.48325 0.875244 7C0.875244 6.51675 1.26713 6.125 1.75054 6.125H6.12701V1.75C6.12701 1.26675 6.51889 0.875 7.0023 0.875Z" 11035 fill="#667dff" 11036 /></svg 11037>`,ejt=Object.freeze(Object.defineProperty({__proto__:null,addSvg:QMt},Symbol.toStringTag,{value:"Module"})),tjt=ae`<svg fill="none" viewBox="0 0 24 24"> 11038 <path 11039 style="fill: var(--wui-color-accent-100);" 11040 d="M10.2 6.6a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0ZM21 6.6a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0ZM10.2 17.4a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0ZM21 17.4a3.6 3.6 0 1 1-7.2 0 3.6 3.6 0 0 1 7.2 0Z" 11041 /> 11042</svg>`,njt=Object.freeze(Object.defineProperty({__proto__:null,allWalletsSvg:tjt},Symbol.toStringTag,{value:"Module"})),rjt=ae`<svg 11043 fill="none" 11044 viewBox="0 0 21 20" 11045> 11046 <path 11047 fill="currentColor" 11048 fill-rule="evenodd" 11049 d="M10.5 2.42908C6.31875 2.42908 2.92859 5.81989 2.92859 10.0034C2.92859 14.1869 6.31875 17.5777 10.5 17.5777C14.6813 17.5777 18.0714 14.1869 18.0714 10.0034C18.0714 5.81989 14.6813 2.42908 10.5 2.42908ZM0.928589 10.0034C0.928589 4.71596 5.21355 0.429077 10.5 0.429077C15.7865 0.429077 20.0714 4.71596 20.0714 10.0034C20.0714 15.2908 15.7865 19.5777 10.5 19.5777C5.21355 19.5777 0.928589 15.2908 0.928589 10.0034ZM10.5 5.75003C11.0523 5.75003 11.5 6.19774 11.5 6.75003L11.5 10.8343L12.7929 9.54137C13.1834 9.15085 13.8166 9.15085 14.2071 9.54137C14.5976 9.9319 14.5976 10.5651 14.2071 10.9556L11.2071 13.9556C10.8166 14.3461 10.1834 14.3461 9.79291 13.9556L6.79291 10.9556C6.40239 10.5651 6.40239 9.9319 6.79291 9.54137C7.18343 9.15085 7.8166 9.15085 8.20712 9.54137L9.50002 10.8343L9.50002 6.75003C9.50002 6.19774 9.94773 5.75003 10.5 5.75003Z" 11050 clip-rule="evenodd" 11051 /></svg 11052>`,sjt=Object.freeze(Object.defineProperty({__proto__:null,arrowBottomCircleSvg:rjt},Symbol.toStringTag,{value:"Module"})),ijt=ae` 11053<svg width="36" height="36"> 11054 <path 11055 d="M28.724 0H7.271A7.269 7.269 0 0 0 0 7.272v21.46A7.268 7.268 0 0 0 7.271 36H28.73A7.272 7.272 0 0 0 36 28.728V7.272A7.275 7.275 0 0 0 28.724 0Z" 11056 fill="url(#a)" 11057 /> 11058 <path 11059 d="m17.845 8.271.729-1.26a1.64 1.64 0 1 1 2.843 1.638l-7.023 12.159h5.08c1.646 0 2.569 1.935 1.853 3.276H6.434a1.632 1.632 0 0 1-1.638-1.638c0-.909.73-1.638 1.638-1.638h4.176l5.345-9.265-1.67-2.898a1.642 1.642 0 0 1 2.844-1.638l.716 1.264Zm-6.317 17.5-1.575 2.732a1.64 1.64 0 1 1-2.844-1.638l1.17-2.025c1.323-.41 2.398-.095 3.249.931Zm13.56-4.954h4.262c.909 0 1.638.729 1.638 1.638 0 .909-.73 1.638-1.638 1.638h-2.367l1.597 2.772c.45.788.185 1.782-.602 2.241a1.642 1.642 0 0 1-2.241-.603c-2.69-4.666-4.711-8.159-6.052-10.485-1.372-2.367-.391-4.743.576-5.549 1.075 1.846 2.682 4.631 4.828 8.348Z" 11060 fill="#fff" 11061 /> 11062 <defs> 11063 <linearGradient id="a" x1="18" y1="0" x2="18" y2="36" gradientUnits="userSpaceOnUse">
11064 <stop stop-color="#18BFFB" /> 11065 <stop offset="1" stop-color="#2072F3" /> 11066 </linearGradient> 11067 </defs> 11068</svg>`,ojt=Object.freeze(Object.defineProperty({__proto__:null,appStoreSvg:ijt},Symbol.toStringTag,{value:"Module"})),ajt=ae`<svg fill="none" viewBox="0 0 40 40"> 11069 <g clip-path="url(#a)"> 11070 <g clip-path="url(#b)"> 11071 <circle cx="20" cy="19.89" r="20" fill="#000" /> 11072 <g clip-path="url(#c)"> 11073 <path 11074 fill="#fff" 11075 d="M28.77 23.3c-.69 1.99-2.75 5.52-4.87 5.56-1.4.03-1.86-.84-3.46-.84-1.61 0-2.12.81-3.45.86-2.25.1-5.72-5.1-5.72-9.62 0-4.15 2.9-6.2 5.42-6.25 1.36-.02 2.64.92 3.47.92.83 0 2.38-1.13 4.02-.97.68.03 2.6.28 3.84 2.08-3.27 2.14-2.76 6.61.75 8.25ZM24.2 7.88c-2.47.1-4.49 2.69-4.2 4.84 2.28.17 4.47-2.39 4.2-4.84Z" 11076 /> 11077 </g> 11078 </g> 11079 </g> 11080 <defs> 11081 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 11082 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 11083 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 11084 </defs> 11085</svg>`,cjt=Object.freeze(Object.defineProperty({__proto__:null,appleSvg:ajt},Symbol.toStringTag,{value:"Module"})),ljt=ae`<svg fill="none" viewBox="0 0 14 15"> 11086 <path 11087 fill="currentColor" 11088 fill-rule="evenodd" 11089 d="M7 1.99a1 1 0 0 1 1 1v7.58l2.46-2.46a1 1 0 0 1 1.41 1.42L7.7 13.69a1 1 0 0 1-1.41 0L2.12 9.53A1 1 0 0 1 3.54 8.1L6 10.57V3a1 1 0 0 1 1-1Z" 11090 clip-rule="evenodd" 11091 /> 11092</svg>`,ujt=Object.freeze(Object.defineProperty({__proto__:null,arrowBottomSvg:ljt},Symbol.toStringTag,{value:"Module"})),djt=ae`<svg fill="none" viewBox="0 0 14 15"> 11093 <path 11094 fill="currentColor" 11095 fill-rule="evenodd" 11096 d="M13 7.99a1 1 0 0 1-1 1H4.4l2.46 2.46a1 1 0 1 1-1.41 1.41L1.29 8.7a1 1 0 0 1 0-1.41L5.46 3.1a1 1 0 0 1 1.41 1.42L4.41 6.99H12a1 1 0 0 1 1 1Z" 11097 clip-rule="evenodd" 11098 /> 11099</svg>`,hjt=Object.freeze(Object.defineProperty({__proto__:null,arrowLeftSvg:djt},Symbol.toStringTag,{value:"Module"})),fjt=ae`<svg fill="none" viewBox="0 0 14 15"> 11100 <path 11101 fill="currentColor" 11102 fill-rule="evenodd" 11103 d="M1 7.99a1 1 0 0 1 1-1h7.58L7.12 4.53A1 1 0 1 1 8.54 3.1l4.16 4.17a1 1 0 0 1 0 1.41l-4.16 4.17a1 1 0 1 1-1.42-1.41l2.46-2.46H2a1 1 0 0 1-1-1Z" 11104 clip-rule="evenodd" 11105 /> 11106</svg>`,pjt=Object.freeze(Object.defineProperty({__proto__:null,arrowRightSvg:fjt},Symbol.toStringTag,{value:"Module"})),gjt=ae`<svg fill="none" viewBox="0 0 14 15"> 11107 <path 11108 fill="currentColor" 11109 fill-rule="evenodd" 11110 d="M7 13.99a1 1 0 0 1-1-1V5.4L3.54 7.86a1 1 0 0 1-1.42-1.41L6.3 2.28a1 1 0 0 1 1.41 0l4.17 4.17a1 1 0 1 1-1.41 1.41L8 5.4v7.59a1 1 0 0 1-1 1Z" 11111 clip-rule="evenodd" 11112 /> 11113</svg>`,mjt=Object.freeze(Object.defineProperty({__proto__:null,arrowTopSvg:gjt},Symbol.toStringTag,{value:"Module"})),wjt=ae`<svg 11114 xmlns="http://www.w3.org/2000/svg" 11115 width="12" 11116 height="13" 11117 viewBox="0 0 12 13" 11118 fill="none" 11119> 11120 <path 11121 fill-rule="evenodd" 11122 clip-rule="evenodd" 11123 d="M5.61391 1.57124C5.85142 1.42873 6.14813 1.42873 6.38564 1.57124L11.0793 4.38749C11.9179 4.89067 11.5612 6.17864 10.5832 6.17864H9.96398V10.0358H10.2854C10.6996 10.0358 11.0354 10.3716 11.0354 10.7858C11.0354 11.2 10.6996 11.5358 10.2854 11.5358H1.71416C1.29995 11.5358 0.964172 11.2 0.964172 10.7858C0.964172 10.3716 1.29995 10.0358 1.71416 10.0358H2.03558L2.03558 6.17864H1.41637C0.438389 6.17864 0.0816547 4.89066 0.920263 4.38749L5.61391 1.57124ZM3.53554 6.17864V10.0358H5.24979V6.17864H3.53554ZM6.74976 6.17864V10.0358H8.46401V6.17864H6.74976ZM8.64913 4.67864H3.35043L5.99978 3.089L8.64913 4.67864Z" 11124 fill="currentColor" 11125 /></svg 11126>`,yjt=Object.freeze(Object.defineProperty({__proto__:null,bankSvg:wjt},Symbol.toStringTag,{value:"Module"})),bjt=ae`<svg fill="none" viewBox="0 0 20 20"> 11127 <path 11128 fill="currentColor" 11129 fill-rule="evenodd" 11130 d="M4 6.4a1 1 0 0 1-.46.89 6.98 6.98 0 0 0 .38 6.18A7 7 0 0 0 16.46 7.3a1 1 0 0 1-.47-.92 7 7 0 0 0-12 .03Zm-2.02-.5a9 9 0 1 1 16.03 8.2A9 9 0 0 1 1.98 5.9Z" 11131 clip-rule="evenodd" 11132 /> 11133 <path 11134 fill="currentColor" 11135 fill-rule="evenodd" 11136 d="M6.03 8.63c-1.46-.3-2.72-.75-3.6-1.35l-.02-.01-.14-.11a1 1 0 0 1 1.2-1.6l.1.08c.6.4 1.52.74 2.69 1 .16-.99.39-1.88.67-2.65.3-.79.68-1.5 1.15-2.02A2.58 2.58 0 0 1 9.99 1c.8 0 1.45.44 1.92.97.47.52.84 1.23 1.14 2.02.29.77.52 1.66.68 2.64a8 8 0 0 0 2.7-1l.26-.18h.48a1 1 0 0 1 .12 2c-.86.51-2.01.91-3.34 1.18a22.24 22.24 0 0 1-.03 3.19c1.45.29 2.7.73 3.58 1.31a1 1 0 0 1-1.1 1.68c-.6-.4-1.56-.76-2.75-1-.15.8-.36 1.55-.6 2.2-.3.79-.67 1.5-1.14 2.02-.47.53-1.12.97-1.92.97-.8 0-1.45-.44-1.91-.97a6.51 6.51 0 0 1-1.15-2.02c-.24-.65-.44-1.4-.6-2.2-1.18.24-2.13.6-2.73.99a1 1 0 1 1-1.1-1.67c.88-.58 2.12-1.03 3.57-1.31a22.03 22.03 0 0 1-.04-3.2Zm2.2-1.7c.15-.86.34-1.61.58-2.24.24-.65.51-1.12.76-1.4.25-.28.4-.29.42-.29.03 0 .17.01.42.3.25.27.52.74.77 1.4.23.62.43 1.37.57 2.22a19.96 19.96 0 0 1-3.52 0Zm-.18 4.6a20.1 20.1 0 0 1-.03-2.62 21.95 21.95 0 0 0 3.94 0 20.4 20.4 0 0 1-.03 2.63 21.97 21.97 0 0 0-3.88 0Zm.27 2c.13.66.3 1.26.49 1.78.24.65.51 1.12.76 1.4.25.28.4.29.42.29.03 0 .17-.01.42-.3.25-.27.52-.74.77-1.4.19-.5.36-1.1.49-1.78a20.03 20.03 0 0 0-3.35 0Z" 11137 clip-rule="evenodd" 11138 /> 11139</svg>`,vjt=Object.freeze(Object.defineProperty({__proto__:null,browserSvg:bjt},Symbol.toStringTag,{value:"Module"})),Ejt=ae`<svg 11140 xmlns="http://www.w3.org/2000/svg" 11141 width="12" 11142 height="13" 11143 viewBox="0 0 12 13" 11144 fill="none" 11145> 11146 <path 11147 fill-rule="evenodd" 11148 clip-rule="evenodd" 11149 d="M4.16072 2C4.17367 2 4.18665 2 4.19968 2L7.83857 2C8.36772 1.99998 8.82398 1.99996 9.19518 2.04018C9.5895 2.0829 9.97577 2.17811 10.3221 2.42971C10.5131 2.56849 10.6811 2.73647 10.8198 2.92749C11.0714 3.27379 11.1666 3.66007 11.2094 4.0544C11.2496 4.42561 11.2496 4.88188 11.2495 5.41105V7.58896C11.2496 8.11812 11.2496 8.57439 11.2094 8.94561C11.1666 9.33994 11.0714 9.72621 10.8198 10.0725C10.6811 10.2635 10.5131 10.4315 10.3221 10.5703C9.97577 10.8219 9.5895 10.9171 9.19518 10.9598C8.82398 11 8.36772 11 7.83856 11H4.16073C3.63157 11 3.17531 11 2.80411 10.9598C2.40979 10.9171 2.02352 10.8219 1.67722 10.5703C1.48621 10.4315 1.31824 10.2635 1.17946 10.0725C0.927858 9.72621 0.832652 9.33994 0.78993 8.94561C0.749713 8.5744 0.749733 8.11813 0.749757 7.58896L0.749758 5.45C0.749758 5.43697 0.749758 5.42399 0.749757 5.41104C0.749733 4.88188 0.749713 4.42561 0.78993 4.0544C0.832652 3.66007 0.927858 3.27379 1.17946 2.92749C1.31824 2.73647 1.48621 2.56849 1.67722 2.42971C2.02352 2.17811 2.40979 2.0829 2.80411 2.04018C3.17531 1.99996 3.63157 1.99998 4.16072 2ZM2.96567 3.53145C2.69897 3.56034 2.60687 3.60837 2.55888 3.64324C2.49521 3.6895 2.43922 3.74549 2.39296 3.8
111490916C2.35809 3.85715 2.31007 3.94926 2.28117 4.21597C2.26629 4.35335 2.25844 4.51311 2.25431 4.70832H9.74498C9.74085 4.51311 9.733 4.35335 9.71812 4.21597C9.68922 3.94926 9.6412 3.85715 9.60633 3.80916C9.56007 3.74549 9.50408 3.6895 9.44041 3.64324C9.39242 3.60837 9.30031 3.56034 9.03362 3.53145C8.75288 3.50103 8.37876 3.5 7.79961 3.5H4.19968C3.62053 3.5 3.24641 3.50103 2.96567 3.53145ZM9.74956 6.20832H2.24973V7.55C2.24973 8.12917 2.25076 8.5033 2.28117 8.78404C2.31007 9.05074 2.35809 9.14285 2.39296 9.19084C2.43922 9.25451 2.49521 9.31051 2.55888 9.35677C2.60687 9.39163 2.69897 9.43966 2.96567 9.46856C3.24641 9.49897 3.62053 9.5 4.19968 9.5H7.79961C8.37876 9.5 8.75288 9.49897 9.03362 9.46856C9.30032 9.43966 9.39242 9.39163 9.44041 9.35677C9.50408 9.31051 9.56007 9.25451 9.60633 9.19084C9.6412 9.14285 9.68922 9.05075 9.71812 8.78404C9.74854 8.5033 9.74956 8.12917 9.74956 7.55V6.20832ZM6.74963 8C6.74963 7.58579 7.08541 7.25 7.49961 7.25H8.2496C8.6638 7.25 8.99958 7.58579 8.99958 8C8.99958 8.41422 8.6638 8.75 8.2496 8.75H7.49961C7.08541 8.75 6.74963 8.41422 6.74963 8Z" 11150 fill="currentColor" 11151 /></svg 11152>`,Cjt=Object.freeze(Object.defineProperty({__proto__:null,cardSvg:Ejt},Symbol.toStringTag,{value:"Module"})),$jt=ae`<svg 11153 width="28" 11154 height="28" 11155 viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"> 11156 <path 11157 fill-rule="evenodd" 11158 clip-rule="evenodd" 11159 d="M25.5297 4.92733C26.1221 5.4242 26.1996 6.30724 25.7027 6.89966L12.2836 22.8997C12.0316 23.2001 11.6652 23.3811 11.2735 23.3986C10.8817 23.4161 10.5006 23.2686 10.2228 22.9919L2.38218 15.1815C1.83439 14.6358 1.83268 13.7494 2.37835 13.2016C2.92403 12.6538 3.81046 12.6521 4.35825 13.1978L11.1183 19.9317L23.5573 5.10036C24.0542 4.50794 24.9372 4.43047 25.5297 4.92733Z" 11160 fill="currentColor"/> 11161</svg> 11162`,xjt=Object.freeze(Object.defineProperty({__proto__:null,checkmarkSvg:$jt},Symbol.toStringTag,{value:"Module"})),Ijt=ae`<svg fill="none" viewBox="0 0 14 14"> 11163 <path 11164 fill="currentColor" 11165 fill-rule="evenodd" 11166 d="M12.9576 2.23383C13.3807 2.58873 13.4361 3.21947 13.0812 3.64263L6.37159 11.6426C6.19161 11.8572 5.92989 11.9865 5.65009 11.999C5.3703 12.0115 5.09808 11.9062 4.89965 11.7085L0.979321 7.80331C0.588042 7.41354 0.586817 6.78038 0.976585 6.3891C1.36635 5.99782 1.99952 5.99659 2.3908 6.38636L5.53928 9.52268L11.5488 2.35742C11.9037 1.93426 12.5344 1.87893 12.9576 2.23383Z" 11167 clip-rule="evenodd" 11168 /> 11169</svg>`,Sjt=Object.freeze(Object.defineProperty({__proto__:null,checkmarkBoldSvg:Ijt},Symbol.toStringTag,{value:"Module"})),Ajt=ae`<svg fill="none" viewBox="0 0 16 16"> 11170 <path 11171 fill="currentColor" 11172 fill-rule="evenodd" 11173 d="M1.46 4.96a1 1 0 0 1 1.41 0L8 10.09l5.13-5.13a1 1 0 1 1 1.41 1.41l-5.83 5.84a1 1 0 0 1-1.42 0L1.46 6.37a1 1 0 0 1 0-1.41Z" 11174 clip-rule="evenodd" 11175 /> 11176</svg>`,_jt=Object.freeze(Object.defineProperty({__proto__:null,chevronBottomSvg:Ajt},Symbol.toStringTag,{value:"Module"})),Njt=ae`<svg fill="none" viewBox="0 0 16 16"> 11177 <path 11178 fill="currentColor" 11179 fill-rule="evenodd" 11180 d="M11.04 1.46a1 1 0 0 1 0 1.41L5.91 8l5.13 5.13a1 1 0 1 1-1.41 1.41L3.79 8.71a1 1 0 0 1 0-1.42l5.84-5.83a1 1 0 0 1 1.41 0Z" 11181 clip-rule="evenodd" 11182 /> 11183</svg>`,Tjt=Object.freeze(Object.defineProperty({__proto__:null,chevronLeftSvg:Njt},Symbol.toStringTag,{value:"Module"})),Pjt=ae`<svg fill="none" viewBox="0 0 16 16"> 11184 <path 11185 fill="currentColor" 11186 fill-rule="evenodd" 11187 d="M4.96 14.54a1 1 0 0 1 0-1.41L10.09 8 4.96 2.87a1 1 0 0 1 1.41-1.41l5.84 5.83a1 1 0 0 1 0 1.42l-5.84 5.83a1 1 0 0 1-1.41 0Z" 11188 clip-rule="evenodd" 11189 /> 11190</svg>`,Ojt=Object.freeze(Object.defineProperty({__proto__:null,chevronRightSvg:Pjt},Symbol.toStringTag,{value:"Module"})),kjt=ae`<svg fill="none" viewBox="0 0 16 16"> 11191 <path 11192 fill="currentColor" 11193 fill-rule="evenodd" 11194 d="M14.54 11.04a1 1 0 0 1-1.41 0L8 5.92l-5.13 5.12a1 1 0 1 1-1.41-1.41l5.83-5.84a1 1 0 0 1 1.42 0l5.83 5.84a1 1 0 0 1 0 1.41Z" 11195 clip-rule="evenodd" 11196 /> 11197</svg>`,Rjt=Object.freeze(Object.defineProperty({__proto__:null,chevronTopSvg:kjt},Symbol.toStringTag,{value:"Module"})),Bjt=ae`<svg width="36" height="36" fill="none"> 11198 <path 11199 fill="#fff" 11200 fill-opacity=".05" 11201 d="M0 14.94c0-5.55 0-8.326 1.182-10.4a9 9 0 0 1 3.359-3.358C6.614 0 9.389 0 14.94 0h6.12c5.55 0 8.326 0 10.4 1.182a9 9 0 0 1 3.358 3.359C36 6.614 36 9.389 36 14.94v6.12c0 5.55 0 8.326-1.182 10.4a9 9 0 0 1-3.359 3.358C29.386 36 26.611 36 21.06 36h-6.12c-5.55 0-8.326 0-10.4-1.182a9 9 0 0 1-3.358-3.359C0 29.386 0 26.611 0 21.06v-6.12Z" 11202 /> 11203 <path 11204 stroke="#fff" 11205 stroke-opacity=".05" 11206 d="M14.94.5h6.12c2.785 0 4.84 0 6.46.146 1.612.144 2.743.43 3.691.97a8.5 8.5 0 0 1 3.172 3.173c.541.948.826 2.08.971 3.692.145 1.62.146 3.675.146 6.459v6.12c0 2.785 0 4.84-.146 6.46-.145 1.612-.43 2.743-.97 3.691a8.5 8.5 0 0 1-3.173 3.172c-.948.541-2.08.826-3.692.971-1.62.145-3.674.146-6.459.146h-6.12c-2.784 0-4.84 0-6.46-.146-1.612-.145-2.743-.43-3.691-.97a8.5 8.5 0 0 1-3.172-3.173c-.541-.948-.827-2.08-.971-3.692C.5 25.9.5 23.845.5 21.06v-6.12c0-2.784 0-4.84.146-6.46.144-1.612.43-2.743.97-3.691A8.5 8.5 0 0 1 4.79 1.617C5.737 1.076 6.869.79 8.48.646 10.1.5 12.156.5 14.94.5Z" 11207 /> 11208 <path 11209 fill="url(#a)" 11210 d="M17.998 10.8h12.469a14.397 14.397 0 0 0-24.938.001l6.234 10.798.006-.001a7.19 7.19 0 0 1 6.23-10.799Z" 11211 /> 11212 <path 11213 fill="url(#b)" 11214 d="m24.237 21.598-6.234 10.798A14.397 14.397 0 0 0 30.47 10.798H18.002l-.002.006a7.191 7.191 0 0 1 6.237 10.794Z" 11215 /> 11216 <path 11217 fill="url(#c)" 11218 d="M11.765 21.601 5.531 10.803A14.396 14.396 0 0 0 18.001 32.4l6.235-10.798-.004-.004a7.19 7.19 0 0 1-12.466.004Z" 11219 /> 11220 <path fill="#fff" d="M18 25.2a7.2 7.2 0 1 0 0-14.4 7.2 7.2 0 0 0 0 14.4Z" /> 11221 <path fill="#1A73E8" d="M18 23.7a5.7 5.7 0 1 0 0-11.4 5.7 5.7 0 0 0 0 11.4Z" /> 11222 <defs> 11223 <linearGradient 11224 id="a" 11225 x1="6.294" 11226 x2="41.1" 11227 y1="5.995" 11228 y2="5.995" 11229 gradientUnits="userSpaceOnUse" 11230 > 11231 <stop stop-color="#D93025" /> 11232 <stop offset="1" stop-color="#EA4335" /> 11233 </linearGradient> 11234 <linearGradient 11235 id="b" 11236 x1="20.953" 11237 x2="37.194" 11238 y1="32.143" 11239 y2="2.701" 11240 gradientUnits="userSpaceOnUse" 11241 > 11242 <stop stop-color="#FCC934" /> 11243 <stop offset="1" stop-color="#FBBC04" /> 11244 </linearGradient> 11245 <linearGradient 11246 id="c" 11247 x1="25.873" 11248 x2="9.632" 11249 y1="31.2"
11250 y2="1.759" 11251 gradientUnits="userSpaceOnUse" 11252 > 11253 <stop stop-color="#1E8E3E" /> 11254 <stop offset="1" stop-color="#34A853" /> 11255 </linearGradient> 11256 </defs> 11257</svg>`,Djt=Object.freeze(Object.defineProperty({__proto__:null,chromeStoreSvg:Bjt},Symbol.toStringTag,{value:"Module"})),Ujt=ae`<svg width="14" height="14" viewBox="0 0 14 14" fill="none"> 11258 <path 11259 fill-rule="evenodd" 11260 clip-rule="evenodd" 11261 d="M7.00235 2C4.24 2 2.00067 4.23858 2.00067 7C2.00067 9.76142 4.24 12 7.00235 12C9.7647 12 12.004 9.76142 12.004 7C12.004 4.23858 9.7647 2 7.00235 2ZM0 7C0 3.13401 3.13506 0 7.00235 0C10.8696 0 14.0047 3.13401 14.0047 7C14.0047 10.866 10.8696 14 7.00235 14C3.13506 14 0 10.866 0 7ZM7.00235 3C7.55482 3 8.00269 3.44771 8.00269 4V6.58579L9.85327 8.43575C10.2439 8.82627 10.2439 9.45944 9.85327 9.84996C9.46262 10.2405 8.82924 10.2405 8.43858 9.84996L6.29501 7.70711C6.10741 7.51957 6.00201 7.26522 6.00201 7V4C6.00201 3.44771 6.44988 3 7.00235 3Z" 11262 fill="currentColor" 11263 /> 11264</svg>`,Ljt=Object.freeze(Object.defineProperty({__proto__:null,clockSvg:Ujt},Symbol.toStringTag,{value:"Module"})),Mjt=ae`<svg fill="none" viewBox="0 0 16 16"> 11265 <path 11266 fill="currentColor" 11267 fill-rule="evenodd" 11268 d="M2.54 2.54a1 1 0 0 1 1.42 0L8 6.6l4.04-4.05a1 1 0 1 1 1.42 1.42L9.4 8l4.05 4.04a1 1 0 0 1-1.42 1.42L8 9.4l-4.04 4.05a1 1 0 0 1-1.42-1.42L6.6 8 2.54 3.96a1 1 0 0 1 0-1.42Z" 11269 clip-rule="evenodd" 11270 /> 11271</svg>`,jjt=Object.freeze(Object.defineProperty({__proto__:null,closeSvg:Mjt},Symbol.toStringTag,{value:"Module"})),Fjt=ae`<svg fill="none" viewBox="0 0 16 16"> 11272 <path 11273 fill="currentColor" 11274 fill-rule="evenodd" 11275 d="M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm10.66-2.65a1 1 0 0 1 .23 1.06L9.83 9.24a1 1 0 0 1-.59.58l-2.83 1.06A1 1 0 0 1 5.13 9.6l1.06-2.82a1 1 0 0 1 .58-.59L9.6 5.12a1 1 0 0 1 1.06.23ZM7.9 7.89l-.13.35.35-.13.12-.35-.34.13Z" 11276 clip-rule="evenodd" 11277 /> 11278</svg>`,zjt=Object.freeze(Object.defineProperty({__proto__:null,compassSvg:Fjt},Symbol.toStringTag,{value:"Module"})),qjt=ae`<svg fill="none" viewBox="0 0 20 20"> 11279 <path 11280 fill="currentColor" 11281 fill-rule="evenodd" 11282 d="M10 3a7 7 0 0 0-6.85 8.44l8.29-8.3C10.97 3.06 10.49 3 10 3Zm3.49.93-9.56 9.56c.32.55.71 1.06 1.16 1.5L15 5.1a7.03 7.03 0 0 0-1.5-1.16Zm2.7 2.8-9.46 9.46a7 7 0 0 0 9.46-9.46ZM1.99 5.9A9 9 0 1 1 18 14.09 9 9 0 0 1 1.98 5.91Z" 11283 clip-rule="evenodd" 11284 /> 11285</svg>`,Wjt=Object.freeze(Object.defineProperty({__proto__:null,coinPlaceholderSvg:qjt},Symbol.toStringTag,{value:"Module"})),Hjt=ae`<svg 11286 xmlns="http://www.w3.org/2000/svg" 11287 width="16" 11288 height="16" 11289 viewBox="0 0 16 16" 11290 fill="none" 11291> 11292 <path 11293 fill="currentColor" 11294 fill-rule="evenodd" 11295 clip-rule="evenodd" 11296 d="M9.21498 1.28565H10.5944C11.1458 1.28562 11.6246 1.2856 12.0182 1.32093C12.4353 1.35836 12.853 1.44155 13.2486 1.66724C13.7005 1.92498 14.0749 2.29935 14.3326 2.75122C14.5583 3.14689 14.6415 3.56456 14.6789 3.9817C14.7143 4.37531 14.7142 4.85403 14.7142 5.40545V6.78489C14.7142 7.33631 14.7143 7.81503 14.6789 8.20865C14.6415 8.62578 14.5583 9.04345 14.3326 9.43912C14.0749 9.89099 13.7005 10.2654 13.2486 10.5231C12.853 10.7488 12.4353 10.832 12.0182 10.8694C11.7003 10.8979 11.3269 10.9034 10.9045 10.9045C10.9034 11.3269 10.8979 11.7003 10.8694 12.0182C10.832 12.4353 10.7488 12.853 10.5231 13.2486C10.2654 13.7005 9.89099 14.0749 9.43912 14.3326C9.04345 14.5583 8.62578 14.6415 8.20865 14.6789C7.81503 14.7143 7.33631 14.7142 6.78489 14.7142H5.40545C4.85403 14.7142 4.37531 14.7143 3.9817 14.6789C3.56456 14.6415 3.14689 14.5583 2.75122 14.3326C2.29935 14.0749 1.92498 13.7005 1.66724 13.2486C1.44155 12.853 1.35836 12.4353 1.32093 12.0182C1.2856 11.6246 1.28562 11.1458 1.28565 10.5944V9.21498C1.28562 8.66356 1.2856 8.18484 1.32093 7.79122C1.35836 7.37409 1.44155 6.95642 1.66724 6.56074C1.92498 6.10887 2.29935 5.73451 2.75122 5.47677C3.14689 5.25108 3.56456 5.16789 3.9817 5.13045C4.2996 5.10192 4.67301 5.09645 5.09541 5.09541C5.09645 4.67302 5.10192 4.2996 5.13045 3.9817C5.16789 3.56456 5.25108 3.14689 5.47676 2.75122C5.73451 2.29935 6.10887 1.92498 6.56074 1.66724C6.95642 1.44155 7.37409 1.35836 7.79122 1.32093C8.18484 1.2856 8.66356 1.28562 9.21498 1.2856
112965ZM5.09541 7.09552C4.68397 7.09667 4.39263 7.10161 4.16046 7.12245C3.88053 7.14757 3.78516 7.18949 3.74214 7.21403C3.60139 7.29431 3.48478 7.41091 3.4045 7.55166C3.37997 7.59468 3.33804 7.69005 3.31292 7.96999C3.28659 8.26345 3.28565 8.65147 3.28565 9.25708V10.5523C3.28565 11.1579 3.28659 11.5459 3.31292 11.8394C3.33804 12.1193 3.37997 12.2147 3.4045 12.2577C3.48478 12.3985 3.60139 12.5151 3.74214 12.5954C3.78516 12.6199 3.88053 12.6618 4.16046 12.6869C4.45393 12.7133 4.84195 12.7142 5.44755 12.7142H6.74279C7.3484 12.7142 7.73641 12.7133 8.02988 12.6869C8.30981 12.6618 8.40518 12.6199 8.44821 12.5954C8.58895 12.5151 8.70556 12.3985 8.78584 12.2577C8.81038 12.2147 8.8523 12.1193 8.87742 11.8394C8.89825 11.6072 8.90319 11.3159 8.90435 10.9045C8.48219 10.9034 8.10898 10.8979 7.79122 10.8694C7.37409 10.832 6.95641 10.7488 6.56074 10.5231C6.10887 10.2654 5.73451 9.89099 5.47676 9.43912C5.25108 9.04345 5.16789 8.62578 5.13045 8.20865C5.10194 7.89089 5.09645 7.51767 5.09541 7.09552ZM7.96999 3.31292C7.69005 3.33804 7.59468 3.37997 7.55166 3.4045C7.41091 3.48478 7.29431 3.60139 7.21403 3.74214C7.18949 3.78516 7.14757 3.88053 7.12245 4.16046C7.09611 4.45393 7.09517 4.84195 7.09517 5.44755V6.74279C7.09517 7.3484 7.09611 7.73641 7.12245 8.02988C7.14757 8.30981 7.18949 8.40518 7.21403 8.4482C7.29431 8.58895 7.41091 8.70556 7.55166 8.78584C7.59468 8.81038 7.69005 8.8523 7.96999 8.87742C8.26345 8.90376 8.65147 8.9047 9.25708 8.9047H10.5523C11.1579 8.9047 11.5459 8.90376 11.8394 8.87742C12.1193 8.8523 12.2147 8.81038 12.2577 8.78584C12.3985 8.70556 12.5151 8.58895 12.5954 8.4482C12.6199 8.40518 12.6618 8.30981 12.6869 8.02988C12.7133 7.73641 12.7142 7.3484 12.7142 6.74279V5.44755C12.7142 4.84195 12.7133 4.45393 12.6869 4.16046C12.6618 3.88053 12.6199 3.78516 12.5954 3.74214C12.5151 3.60139 12.3985 3.48478 12.2577 3.4045C12.2147 3.37997 12.1193 3.33804 11.8394 3.31292C11.5459 3.28659 11.1579 3.28565 10.5523 3.28565H9.25708C8.65147 3.28565 8.26345 3.28659 7.96999 3.31292Z" 11297 fill="#788181" 11298 /></svg 11299>`,Vjt=Object.freeze(Object.defineProperty({__proto__:null,copySvg:Hjt},Symbol.toStringTag,{value:"Module"})),Kjt=ae` <svg fill="none" viewBox="0 0 13 4"> 11300 <path fill="currentColor" d="M.5 0h12L8.9 3.13a3.76 3.76 0 0 1-4.8 0L.5 0Z" /> 11301</svg>`,Gjt=Object.freeze(Object.defineProperty({__proto__:null,cursorSvg:Kjt},Symbol.toStringTag,{value:"Module"})),Zjt=ae`<svg fill="none" viewBox="0 0 14 6"> 11302 <path style="fill: var(--wui-color-bg-150);" d="M0 1h14L9.21 5.12a3.31 3.31 0 0 1-4.49 0L0 1Z" /> 11303 <path 11304 style="stroke: var(--wui-color-inverse-100);" 11305 stroke-opacity=".05" 11306 d="M1.33 1.5h11.32L8.88 4.75l-.01.01a2.81 2.81 0 0 1-3.8 0l-.02-.01L1.33 1.5Z" 11307 /> 11308 <path 11309 style="fill: var(--wui-color-bg-150);" 11310 d="M1.25.71h11.5L9.21 3.88a3.31 3.31 0 0 1-4.49 0L1.25.71Z" 11311 /> 11312</svg> `,Yjt=Object.freeze(Object.defineProperty({__proto__:null,cursorTransparentSvg:Zjt},Symbol.toStringTag,{value:"Module"})),Jjt=ae`<svg fill="none" viewBox="0 0 20 20"> 11313 <path 11314 fill="currentColor" 11315 fill-rule="evenodd" 11316 d="M13.66 2H6.34c-1.07 0-1.96 0-2.68.08-.74.08-1.42.25-2.01.68a4 4 0 0 0-.89.89c-.43.6-.6 1.27-.68 2.01C0 6.38 0 7.26 0 8.34v.89c0 1.07 0 1.96.08 2.68.08.74.25 1.42.68 2.01a4 4 0 0 0 .89.89c.6.43 1.27.6 2.01.68a27 27 0 0 0 2.68.08h7.32a27 27 0 0 0 2.68-.08 4.03 4.03 0 0 0 2.01-.68 4 4 0 0 0 .89-.89c.43-.6.6-1.27.68-2.01.08-.72.08-1.6.08-2.68v-.89c0-1.07 0-1.96-.08-2.68a4.04 4.04 0 0 0-.68-2.01 4 4 0 0 0-.89-.89c-.6-.43-1.27-.6-2.01-.68C15.62 2 14.74 2 13.66 2ZM2.82 4.38c.2-.14.48-.25 1.06-.31C4.48 4 5.25 4 6.4 4h7.2c1.15 0 1.93 0 2.52.07.58.06.86.17 1.06.31a2 2 0 0 1 .44.44c.14.2.25.48.31 1.06.07.6.07 1.37.07 2.52v.77c0 1.15 0 1.93-.07 2.52-.06.58-.17.86-.31 1.06a2 2 0 0 1-.44.44c-.2.14-.48.25-1.06.32-.6.06-1.37.06-2.52.06H6.4c-1.15 0-1.93 0-2.52-.06-.58-.07-.86-.18-1.06-.32a2 2 0 0 1-.44-.44c-.14-.2-.25-.48-.31-1.06C2 11.1 2 10.32 2 9.17V8.4c0-1.15 0-1.93.07-2.52.06-.58.17-.86.31-1.06a2 2 0 0 1 .44-.44Z" 11317 clip-rule="evenodd" 11318 /> 11319 <path fill="currentColor" d="M6.14 17.57a1 1 0 1 0 0 2h7.72a1 1 0 1 0 0-2H6.14Z" /> 11320</svg>`,Xjt=Object.freeze(Object.defineProperty({__proto__:null,desktopSvg:Jjt},Symbol.toStringTag,{value:"Module"})),Qjt=ae`<svg fill="none" viewBox="0 0 16 16"> 11321 <path 11322 fill="currentColor" 11323 fill-rule="evenodd" 11324 d="M6.07 1h.57a1 1 0 0 1 0 2h-.52c-.98 0-1.64 0-2.14.06-.48.05-.7.14-.84.24-.13.1-.25.22-.34.35-.1.14-.2.35-.25.83-.05.5-.05 1.16-.05 2.15v2.74c0 .99 0 1.65.05 2.15.05.48.14.7.25.83.1.14.2.25.34.35.14.1.36.2.84.25.5.05 1.16.05 2.14.05h.52a1 1 0 0 1 0 2h-.5
113247c-.92 0-1.69 0-2.3-.07a3.6 3.6 0 0 1-1.8-.61c-.3-.22-.57-.49-.8-.8a3.6 3.6 0 0 1-.6-1.79C.5 11.11.5 10.35.5 9.43V6.58c0-.92 0-1.7.06-2.31a3.6 3.6 0 0 1 .62-1.8c.22-.3.48-.57.79-.79a3.6 3.6 0 0 1 1.8-.61C4.37 1 5.14 1 6.06 1ZM9.5 3a1 1 0 0 1 1.42 0l4.28 4.3a1 1 0 0 1 0 1.4L10.93 13a1 1 0 0 1-1.42-1.42L12.1 9H6.8a1 1 0 1 1 0-2h5.3L9.51 4.42a1 1 0 0 1 0-1.41Z" 11325 clip-rule="evenodd" 11326 /> 11327</svg>`,eFt=Object.freeze(Object.defineProperty({__proto__:null,disconnectSvg:Qjt},Symbol.toStringTag,{value:"Module"})),tFt=ae`<svg fill="none" viewBox="0 0 40 40"> 11328 <g clip-path="url(#a)"> 11329 <g clip-path="url(#b)"> 11330 <circle cx="20" cy="19.89" r="20" fill="#5865F2" /> 11331 <path 11332 fill="#fff" 11333 fill-rule="evenodd" 11334 d="M25.71 28.15C30.25 28 32 25.02 32 25.02c0-6.61-2.96-11.98-2.96-11.98-2.96-2.22-5.77-2.15-5.77-2.15l-.29.32c3.5 1.07 5.12 2.61 5.12 2.61a16.75 16.75 0 0 0-10.34-1.93l-.35.04a15.43 15.43 0 0 0-5.88 1.9s1.71-1.63 5.4-2.7l-.2-.24s-2.81-.07-5.77 2.15c0 0-2.96 5.37-2.96 11.98 0 0 1.73 2.98 6.27 3.13l1.37-1.7c-2.6-.79-3.6-2.43-3.6-2.43l.58.35.09.06.08.04.02.01.08.05a17.25 17.25 0 0 0 4.52 1.58 14.4 14.4 0 0 0 8.3-.86c.72-.27 1.52-.66 2.37-1.21 0 0-1.03 1.68-3.72 2.44.61.78 1.35 1.67 1.35 1.67Zm-9.55-9.6c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28.01-1.25-.93-2.28-2.1-2.28Zm7.5 0c-1.17 0-2.1 1.03-2.1 2.28 0 1.25.95 2.28 2.1 2.28 1.17 0 2.1-1.03 2.1-2.28 0-1.25-.93-2.28-2.1-2.28Z" 11335 clip-rule="evenodd" 11336 /> 11337 </g> 11338 </g> 11339 <defs> 11340 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 11341 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 11342 </defs> 11343</svg>`,nFt=Object.freeze(Object.defineProperty({__proto__:null,discordSvg:tFt},Symbol.toStringTag,{value:"Module"})),rFt=ae`<svg fill="none" viewBox="0 0 16 16"> 11344 <path 11345 fill="currentColor" 11346 d="M4.25 7a.63.63 0 0 0-.63.63v3.97c0 .28-.2.51-.47.54l-.75.07a.93.93 0 0 1-.9-.47A7.51 7.51 0 0 1 5.54.92a7.5 7.5 0 0 1 9.54 4.62c.12.35.06.72-.16 1-.74.97-1.68 1.78-2.6 2.44V4.44a.64.64 0 0 0-.63-.64h-1.06c-.35 0-.63.3-.63.64v5.5c0 .23-.12.42-.32.5l-.52.23V6.05c0-.36-.3-.64-.64-.64H7.45c-.35 0-.64.3-.64.64v4.97c0 .25-.17.46-.4.52a5.8 5.8 0 0 0-.45.11v-4c0-.36-.3-.65-.64-.65H4.25ZM14.07 12.4A7.49 7.49 0 0 1 3.6 14.08c4.09-.58 9.14-2.5 11.87-6.6v.03a7.56 7.56 0 0 1-1.41 4.91Z" 11347 /> 11348</svg>`,sFt=Object.freeze(Object.defineProperty({__proto__:null,etherscanSvg:rFt},Symbol.toStringTag,{value:"Module"})),iFt=ae`<svg fill="none" viewBox="0 0 14 15"> 11349 <path 11350 fill="currentColor" 11351 fill-rule="evenodd" 11352 d="M6.71 2.99a.57.57 0 0 0-.57.57 1 1 0 0 1-1 1c-.58 0-.96 0-1.24.03-.27.03-.37.07-.42.1a.97.97 0 0 0-.36.35c-.04.08-.09.21-.11.67a2.57 2.57 0 0 1 0 5.13c.02.45.07.6.11.66.09.15.21.28.36.36.07.04.21.1.67.12a2.57 2.57 0 0 1 5.12 0c.46-.03.6-.08.67-.12a.97.97 0 0 0 .36-.36c.03-.04.07-.14.1-.41.02-.29.03-.66.03-1.24a1 1 0 0 1 1-1 .57.57 0 0 0 0-1.15 1 1 0 0 1-1-1c0-.58 0-.95-.03-1.24a1.04 1.04 0 0 0-.1-.42.97.97 0 0 0-.36-.36 1.04 1.04 0 0 0-.42-.1c-.28-.02-.65-.02-1.24-.02a1 1 0 0 1-1-1 .57.57 0 0 0-.57-.57ZM5.15 13.98a1 1 0 0 0 .99-1v-.78a.57.57 0 0 1 1.14 0v.78a1 1 0 0 0 .99 1H8.36a66.26 66.26 0 0 0 .73 0 3.78 3.78 0 0 0 1.84-.38c.46-.26.85-.64 1.1-1.1.23-.4.32-.8.36-1.22.02-.2.03-.4.03-.63a2.57 2.57 0 0 0 0-4.75c0-.23-.01-.44-.03-.63a2.96 2.96 0 0 0-.35-1.22 2.97 2.97 0 0 0-1.1-1.1c-.4-.22-.8-.31-1.22-.35a8.7 8.7 0 0 0-.64-.04 2.57 2.57 0 0 0-4.74 0c-.23 0-.44.02-.63.04-.42.04-.83.13-1.22.35-.46.26-.84.64-1.1 1.1-.33.57-.37 1.2-.39 1.84a21.39 21.39 0 0 0 0 .72v.1a1 1 0 0 0 1 .99h.78a.57.57 0 0 1 0 1.15h-.77a1 1 0 0 0-1 .98v.1a63.87 63.87 0 0 0 0 .73c0 .64.05 1.27.38 1.83.26.47.64.85 1.1 1.11.56.32 1.2.37 1.84.38a20.93 20.93 0 0 0 .72 0h.1Z" 11353 clip-rule="evenodd" 11354 /> 11355</svg>`,oFt=Object.freeze(Object.defineProperty({__proto__:null,extensionSvg:iFt},Symbol.toStringTag,{value:"Module"})),aFt=ae`<svg fill="none" viewBox="0 0 14 15"> 11356 <path 11357 fill="currentColor" 11358 fill-rule="evenodd" 11359 d="M3.74 3.99a1 1 0 0 1 1-1H11a1 1 0 0 1 1 1v6.26a1 1 0 0 1-2 0V6.4l-6.3 6.3a1 1 0 0 1-1.4-1.42l6.29-6.3H4.74a1 1 0 0 1-1-1Z" 11360 clip-rule="evenodd" 11361 /> 11362</svg>`,cFt=Object.freeze(Object.defineProperty({__proto__:null,externalLinkSvg:aFt},Symbol.toStringTag,{value:"Module"})),lFt=ae`<svg fill="none" viewBox="0 0 40 40"> 11363 <g clip-path="url(#a)"> 11364 <g clip-path="url(#b)"> 11365 <circle cx="20" cy="19.89" r="20" fill="#1877F2" /> 11366 <g clip-path="url(#c)"> 11367 <path 11368 fill="#fff" 11369 d="M26 12.38h-2.89c-.92 0-1.61.38-1.61 1.34v1.66H26l-.36 4.5H2
113691.5v12H17v-12h-3v-4.5h3V12.5c0-3.03 1.6-4.62 5.2-4.62H26v4.5Z" 11370 /> 11371 </g> 11372 </g> 11373 <path 11374 fill="#1877F2" 11375 d="M40 20a20 20 0 1 0-23.13 19.76V25.78H11.8V20h5.07v-4.4c0-5.02 3-7.79 7.56-7.79 2.19 0 4.48.4 4.48.4v4.91h-2.53c-2.48 0-3.25 1.55-3.25 3.13V20h5.54l-.88 5.78h-4.66v13.98A20 20 0 0 0 40 20Z" 11376 /> 11377 <path 11378 fill="#fff" 11379 d="m27.79 25.78.88-5.78h-5.55v-3.75c0-1.58.78-3.13 3.26-3.13h2.53V8.2s-2.3-.39-4.48-.39c-4.57 0-7.55 2.77-7.55 7.78V20H11.8v5.78h5.07v13.98a20.15 20.15 0 0 0 6.25 0V25.78h4.67Z" 11380 /> 11381 </g> 11382 <defs> 11383 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 11384 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 11385 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 11386 </defs> 11387</svg>`,uFt=Object.freeze(Object.defineProperty({__proto__:null,facebookSvg:lFt},Symbol.toStringTag,{value:"Module"})),dFt=ae`<svg style="border-radius: 9999px; overflow: hidden;" fill="none" viewBox="0 0 1000 1000"> 11388 <rect width="1000" height="1000" rx="9999" ry="9999" fill="#855DCD"/> 11389 <path fill="#855DCD" d="M0 0h1000v1000H0V0Z" /> 11390 <path 11391 fill="#fff" 11392 d="M320 248h354v504h-51.96V521.13h-.5c-5.76-63.8-59.31-113.81-124.54-113.81s-118.78 50-124.53 113.81h-.5V752H320V248Z" 11393 /> 11394 <path 11395 fill="#fff" 11396 d="m225 320 21.16 71.46h17.9v289.09a16.29 16.29 0 0 0-16.28 16.24v19.49h-3.25a16.3 16.3 0 0 0-16.28 16.24V752h182.26v-19.48a16.22 16.22 0 0 0-16.28-16.24h-3.25v-19.5a16.22 16.22 0 0 0-16.28-16.23h-19.52V320H225Zm400.3 360.55a16.3 16.3 0 0 0-15.04 10.02 16.2 16.2 0 0 0-1.24 6.22v19.49h-3.25a16.29 16.29 0 0 0-16.27 16.24V752h182.24v-19.48a16.23 16.23 0 0 0-16.27-16.24h-3.25v-19.5a16.2 16.2 0 0 0-10.04-15 16.3 16.3 0 0 0-6.23-1.23v-289.1h17.9L775 320H644.82v360.55H625.3Z" 11397 /> 11398</svg>`,hFt=Object.freeze(Object.defineProperty({__proto__:null,farcasterSvg:dFt},Symbol.toStringTag,{value:"Module"})),fFt=ae`<svg fill="none" viewBox="0 0 16 16"> 11399 <path 11400 fill="currentColor" 11401 fill-rule="evenodd" 11402 d="M0 3a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H1a1 1 0 0 1-1-1Zm2.63 5.25a1 1 0 0 1 1-1h8.75a1 1 0 1 1 0 2H3.63a1 1 0 0 1-1-1Zm2.62 5.25a1 1 0 0 1 1-1h3.5a1 1 0 0 1 0 2h-3.5a1 1 0 0 1-1-1Z" 11403 clip-rule="evenodd" 11404 /> 11405</svg>`,pFt=Object.freeze(Object.defineProperty({__proto__:null,filtersSvg:fFt},Symbol.toStringTag,{value:"Module"})),gFt=ae`<svg fill="none" viewBox="0 0 40 40"> 11406 <g clip-path="url(#a)"> 11407 <g clip-path="url(#b)"> 11408 <circle cx="20" cy="19.89" r="20" fill="#1B1F23" /> 11409 <g clip-path="url(#c)"> 11410 <path 11411 fill="#fff" 11412 d="M8 19.89a12 12 0 1 1 15.8 11.38c-.6.12-.8-.26-.8-.57v-3.3c0-1.12-.4-1.85-.82-2.22 2.67-.3 5.48-1.31 5.48-5.92 0-1.31-.47-2.38-1.24-3.22.13-.3.54-1.52-.12-3.18 0 0-1-.32-3.3 1.23a11.54 11.54 0 0 0-6 0c-2.3-1.55-3.3-1.23-3.3-1.23a4.32 4.32 0 0 0-.12 3.18 4.64 4.64 0 0 0-1.24 3.22c0 4.6 2.8 5.63 5.47 5.93-.34.3-.65.83-.76 1.6-.69.31-2.42.84-3.5-1 0 0-.63-1.15-1.83-1.23 0 0-1.18-.02-.09.73 0 0 .8.37 1.34 1.76 0 0 .7 2.14 4.03 1.41v2.24c0 .31-.2.68-.8.57A12 12 0 0 1 8 19.9Z" 11413 /> 11414 </g> 11415 </g> 11416 </g> 11417 <defs> 11418 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 11419 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 11420 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 11421 </defs> 11422</svg>`,mFt=Object.freeze(Object.defineProperty({__proto__:null,githubSvg:gFt},Symbol.toStringTag,{value:"Module"})),wFt=ae`<svg fill="none" viewBox="0 0 40 40"> 11423 <path 11424 fill="#4285F4" 11425 d="M32.74 20.3c0-.93-.08-1.81-.24-2.66H20.26v5.03h7a6 6 0 0 1-2.62 3.91v3.28h4.22c2.46-2.27 3.88-5.6 3.88-9.56Z" 11426 /> 11427 <path 11428 fill="#34A853" 11429 d="M20.26 33a12.4 12.4 0 0 0 8.6-3.14l-4.22-3.28a7.74 7.74 0 0 1-4.38 1.26 7.76 7.76 0 0 1-7.28-5.36H8.65v3.36A12.99 12.99 0 0 0 20.26 33Z" 11430 /> 11431 <path 11432 fill="#FBBC05" 11433 d="M12.98 22.47a7.79 7.79 0 0 1 0-4.94v-3.36H8.65a12.84 12.84 0 0 0 0 11.66l3.37-2.63.96-.73Z" 11434 /> 11435 <path 11436 fill="#EA4335" 11437 d="M20.26 12.18a7.1 7.1 0 0 1 4.98 1.93l3.72-3.72A12.47 12.47 0 0 0 20.26 7c-5.08 0-9.47 2.92
11437-11.6 7.17l4.32 3.36a7.76 7.76 0 0 1 7.28-5.35Z" 11438 /> 11439</svg>`,yFt=Object.freeze(Object.defineProperty({__proto__:null,googleSvg:wFt},Symbol.toStringTag,{value:"Module"})),bFt=ae`<svg fill="none" viewBox="0 0 16 16"> 11440 <path 11441 fill="currentColor" 11442 d="M8.51 5.66a.83.83 0 0 0-.57-.2.83.83 0 0 0-.52.28.8.8 0 0 0-.25.52 1 1 0 0 1-2 0c0-.75.34-1.43.81-1.91a2.75 2.75 0 0 1 4.78 1.92c0 1.24-.8 1.86-1.25 2.2l-.04.03c-.47.36-.5.43-.5.65a1 1 0 1 1-2 0c0-1.25.8-1.86 1.24-2.2l.04-.04c.47-.36.5-.43.5-.65 0-.3-.1-.49-.24-.6ZM9.12 11.87a1.13 1.13 0 1 1-2.25 0 1.13 1.13 0 0 1 2.25 0Z" 11443 /> 11444 <path 11445 fill="currentColor" 11446 fill-rule="evenodd" 11447 d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6a6 6 0 1 0 0 12A6 6 0 0 0 8 2Z" 11448 clip-rule="evenodd" 11449 /> 11450</svg>`,vFt=Object.freeze(Object.defineProperty({__proto__:null,helpCircleSvg:bFt},Symbol.toStringTag,{value:"Module"})),EFt=ae`<svg width="14" height="14" viewBox="0 0 14 14" fill="none"> 11451 <path d="M4.98926 3.73932C4.2989 3.73932 3.73926 4.29896 3.73926 4.98932C3.73926 5.67968 4.2989 6.23932 4.98926 6.23932C5.67962 6.23932 6.23926 5.67968 6.23926 4.98932C6.23926 4.29896 5.67962 3.73932 4.98926 3.73932Z" fill="currentColor"/> 11452 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.60497 0.500001H6.39504C5.41068 0.499977 4.59185 0.499958 3.93178 0.571471C3.24075 0.64634 2.60613 0.809093 2.04581 1.21619C1.72745 1.44749 1.44749 1.72745 1.21619 2.04581C0.809093 2.60613 0.64634 3.24075 0.571471 3.93178C0.499958 4.59185 0.499977 5.41065 0.500001 6.39501V7.57815C0.499998 8.37476 0.499995 9.05726 0.534869 9.62725C0.570123 10.2034 0.644114 10.7419 0.828442 11.2302C0.925651 11.4877 1.05235 11.7287 1.21619 11.9542C1.44749 12.2726 1.72745 12.5525 2.04581 12.7838C2.60613 13.1909 3.24075 13.3537 3.93178 13.4285C4.59185 13.5001 5.41066 13.5 6.39503 13.5H7.60496C8.58933 13.5 9.40815 13.5001 10.0682 13.4285C10.7593 13.3537 11.3939 13.1909 11.9542 12.7838C12.2726 12.5525 12.5525 12.2726 12.7838 11.9542C13.1909 11.3939 13.3537 10.7593 13.4285 10.0682C13.5 9.40816 13.5 8.58935 13.5 7.60497V6.39505C13.5 5.41068 13.5 4.59185 13.4285 3.93178C13.3537 3.24075 13.1909 2.60613 12.7838 2.04581C12.5525 1.72745 12.2726 1.44749 11.9542 1.21619C11.3939 0.809093 10.7593 0.64634 10.0682 0.571471C9.40816 0.499958 8.58933 0.499977 7.60497 0.500001ZM3.22138 2.83422C3.38394 2.71612 3.62634 2.61627 4.14721 2.55984C4.68679 2.50138 5.39655 2.5 6.45 2.5H7.55C8.60345 2.5 9.31322 2.50138 9.8528 2.55984C10.3737 2.61627 10.6161 2.71612 10.7786 2.83422C10.9272 2.94216 11.0578 3.07281 11.1658 3.22138C11.2839 3.38394 11.3837 3.62634 11.4402 4.14721C11.4986 4.68679 11.5 5.39655 11.5 6.45V6.49703C10.9674 6.11617 10.386 5.84936 9.74213 5.81948C8.40536 5.75745 7.3556 6.73051 6.40509 7.84229C6.33236 7.92737 6.27406 7.98735 6.22971 8.02911L6.1919 8.00514L6.17483 7.99427C6.09523 7.94353 5.98115 7.87083 5.85596 7.80302C5.56887 7.64752 5.18012 7.4921 4.68105 7.4921C4.66697 7.4921 4.6529 7.49239 4.63884 7.49299C3.79163 7.52878 3.09922 8.1106 2.62901 8.55472C2.58751 8.59392 2.54594 8.6339 2.50435 8.6745C2.50011 8.34653 2.5 7.97569 2.5 7.55V6.45C2.5 5.39655 2.50138 4.68679 2.55984 4.14721C2.61627 3.62634 2.71612 3.38394 2.83422 3.22138C2.94216 3.07281 3.07281 2.94216 3.22138 2.83422ZM10.3703 8.14825C10.6798 8.37526 11.043 8.71839 11.4832 9.20889C11.4744 9.44992 11.4608 9.662 11.4402 9.8528C11.3837 10.3737 11.2839 10.6161 11.1658 10.7786C11.0578 10.9272 10.9272 11.0578 10.7786 11.1658C10.6161 11.2839 10.3737 11.3837 9.8528 11.4402C9.31322 11.4986 8.60345 11.5 7.55 11.5H6.45C5.39655 11.5 4.68679 11.4986 4.14721 11.4402C3.62634 11.3837 3.38394 11.2839 3.22138 11.1658C3.15484 11.1174 3.0919 11.0645 3.03298 11.0075C3.10126 10.9356 3.16806 10.8649 3.23317 10.7959L3.29772 10.7276C3.55763 10.4525 3.78639 10.2126 4.00232 10.0087C4.22016 9.80294 4.39412 9.66364 4.53524 9.57742C4.63352 9.51738 4.69022 9.49897 4.71275 9.49345C4.76387 9.49804 4.81803 9.51537 4.90343 9.56162C4.96409 9.59447 5.02355 9.63225 5.11802 9.69238L5.12363 9.69595C5.20522 9.74789 5.32771 9.82587 5.46078 9.89278C5.76529 10.0459 6.21427 10.186 6.74977 10.0158C7.21485 9.86796 7.59367 9.52979 7.92525 9.14195C8.91377 7.98571 9.38267 7.80495 9.64941 7.81733C9.7858 7.82366 10.0101 7.884 10.3703 8.14825Z" fill="currentColor"/> 11453</svg>`,CFt=Object.freeze(Object.defineProperty({__proto__:null,imageSvg:EFt},Symbol.toStringTag,{value:"Module"})),$Ft=ae`<svg 11454 xmlns="http://www.w3.org/2000/svg" 11455 width="28" 11456 height="28" 11457 viewBox="0 0 28 28" 11458 fill="none"> 11459 <path 11460 fill="#949E9E" 11461 fill-rule="evenodd" 11462 d="M7.974 2.975h12.052c1.248 0 2.296 0 3.143.092.89.096 1.723.307 2.461.844a4.9 4.9 0 0 1 1.084 1.084c.537.738.748 1.57.844 2.461.092.847.092 1.895.092 3.143v6.802c0 1.248 0 2.296-.092 3.143-.096.89-.307 1.723-.844 2.461a4.9 4.9 0 0 1-1.084 1.084c-.738.537-1.57.748-2.461.844-.847.092-1.895.092-3.143.092H7.974c-1.247 0-2.296 0-3.143-.092-.89-.096-1.723-.307-2.461-.844a4.901 4.901 0 0 1-1.084-1.084c-.537-.738-.748-1.571-.844-2.461C.35 19.697.35 18.649.35 17.4v-6.802c0-1.248 0-2.296.092-3.143.096-.89.307-1.723.844-2.461A4.9 4.9 0 0 1 2.37 3.91c.738-.537 1.571-.748 2.461-.844.847-.092 1.895-.092 3.143-.092ZM5.133 5.85c-.652.071-.936.194-1.117.326a2.1 2.1 0 0 0-.465.465c-.132.181-.255.465-.325 1.117-.074.678-.076 1.573-.076 2.917v6.65c0 1.344.002 2.239.076 2.917.07.652.193.936.325 1.117a2.1 2.1 0 0 0 .465.465c.181.132.465.255 1.117.326.678.073 1.574.075 2.917.075h11.9c1.344 0 2.239-.002 2.917-.075.652-.071.936-.194 1.117-.326.179-.13.335-.286.465-.465.132-.181.255-.465.326-1.117.073-.678.075-1.573.075-2.917v-6.65c0-1.344-.002-2.239-.075-2.917-.071-.652-.194-.936-.326-1.117a2.1 2.1 0 0 0-.465-.465c-.181-.132-.465-.255-1.117-.326-.678-.073-1.573-.075-2.917-.075H8.05c-1.343 0-2.239.002-2.917.075Zm.467 7.275a3.15 3.15 0 1 1 6.3 0 3.15 3.15 0 0 1-6.3 0Zm8.75-1.75a1.4 1.4 0 0 1 1.4-1.4h3.5a1.4 1.4 0 0 1 0 2.8h-3.5a1.4 1.4 0 0 1-1.4-1.4Zm0 5.25a1.4 1.4 0 0 1 1.4-1.4H21a1.4 1.4 0 1 1 0 2.8h-5.25a1.4 1.4 0 0 1-1.4-1.4Z" 11463 clip-rule="evenodd"/> 11464</svg>`,xFt=Object.freeze(Object.defineProperty({__proto__:null,idSvg:$Ft},Symbol.toStringTag,{value:"Module"})),IFt=ae`<svg fill="none" viewBox="0 0 14 15"> 11465 <path 11466 fill="currentColor" 11467 d="M6 10.49a1 1 0 1 0 2 0v-2a1 1 0 0 0-2 0v2ZM7 4.49a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" 11468 /> 11469 <path 11470 fill="currentColor" 11471 fill-rule="evenodd" 11472 d="M7 14.99a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm5-7a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z" 11473 clip-rule="evenodd" 11474 /> 11475</svg>`,SFt=Object.freeze(Object.defineProperty({__proto__:null,infoCircleSvg:IFt},Symbol.toStringTag,{value:"Module"}
11475)),AFt=ae`<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"> 11476<path fill-rule="evenodd" clip-rule="evenodd" d="M5.00177 1.78569C3.8179 1.78569 2.85819 2.74508 2.85819 3.92855C2.85819 4.52287 3.09928 5.05956 3.49077 5.4485L3.5005 5.45817C3.64381 5.60054 3.76515 5.72108 3.85631 5.81845C3.93747 5.90512 4.05255 6.03218 4.12889 6.1805C4.16999 6.26034 4.19 6.30843 4.21768 6.39385C4.22145 6.40546 4.22499 6.41703 4.22833 6.42855H5.77521C5.77854 6.41703 5.78208 6.40547 5.78585 6.39385C5.81353 6.30843 5.83354 6.26034 5.87464 6.1805C5.95098 6.03218 6.06606 5.90512 6.14722 5.81845C6.23839 5.72108 6.35973 5.60053 6.50304 5.45816L6.51276 5.4485C6.90425 5.05956 7.14534 4.52287 7.14534 3.92855C7.14534 2.74508 6.18563 1.78569 5.00177 1.78569ZM5.71629 7.85712H4.28724C4.28724 8.21403 4.28876 8.40985 4.30703 8.54571C4.30727 8.54748 4.30751 8.54921 4.30774 8.55091C4.30944 8.55115 4.31118 8.55138 4.31295 8.55162C4.44884 8.56989 4.64474 8.5714 5.00177 8.5714C5.3588 8.5714 5.55469 8.56989 5.69059 8.55162C5.69236 8.55138 5.69409 8.55115 5.69579 8.55091C5.69603 8.54921 5.69627 8.54748 5.6965 8.54571C5.71477 8.40985 5.71629 8.21403 5.71629 7.85712ZM2.85819 7.14283C2.85819 6.9948 2.85796 6.91114 2.8548 6.85032C2.85461 6.84656 2.85441 6.84309 2.85421 6.83988C2.84393 6.8282 2.83047 6.81334 2.81301 6.79469C2.74172 6.71856 2.63908 6.61643 2.48342 6.46178C1.83307 5.81566 1.42914 4.91859 1.42914 3.92855C1.42914 1.9561 3.02866 0.357117 5.00177 0.357117C6.97487 0.357117 8.57439 1.9561 8.57439 3.92855C8.57439 4.91859 8.17047 5.81566 7.52012 6.46178C7.36445 6.61643 7.26182 6.71856 7.19053 6.79469C7.17306 6.81334 7.1596 6.8282 7.14932 6.83988C7.14912 6.84309 7.14892 6.84656 7.14873 6.85032C7.14557 6.91114 7.14534 6.9948 7.14534 7.14283V7.85712C7.14534 7.87009 7.14535 7.88304 7.14535 7.89598C7.14541 8.19889 7.14547 8.49326 7.11281 8.73606C7.076 9.00978 6.98631 9.32212 6.72678 9.58156C6.46726 9.841 6.15481 9.93065 5.881 9.96745C5.63813 10.0001 5.34365 10 5.04064 9.99998C5.0277 9.99998 5.01474 9.99998 5.00177 9.99998C4.98879 9.99998 4.97583 9.99998 4.96289 9.99998C4.65988 10 4.36541 10.0001 4.12253 9.96745C3.84872 9.93065 3.53628 9.841 3.27675 9.58156C3.01722 9.32212 2.92753 9.00978 2.89072 8.73606C2.85807 8.49326 2.85812 8.19889 2.85818 7.89598C2.85819 7.88304 2.85819 7.87008 2.85819 7.85712V7.14283ZM7.1243 6.86977C7.12366 6.87069 7.1233 6.87116 7.12327 6.87119C7.12323 6.87123 7.12356 6.87076 7.1243 6.86977ZM2.88027 6.8712C2.88025 6.87119 2.87988 6.8707 2.87921 6.86975C2.87995 6.87072 2.88028 6.8712 2.88027 6.8712Z" fill="#949E9E"/> 11477</svg>`,_Ft=Object.freeze(Object.defineProperty({__proto__:null,lightbulbSvg:AFt},Symbol.toStringTag,{value:"Module"})),NFt=ae`<svg fill="none" viewBox="0 0 16 16"> 11478 <path 11479 fill="currentColor" 11480 fill-rule="evenodd" 11481 d="M4.83 1.34h6.34c.68 0 1.26 0 1.73.04.5.05.97.15 1.42.4.52.3.95.72 1.24 1.24.26.45.35.92.4 1.42.04.47.04 1.05.04 1.73v3.71c0 .69 0 1.26-.04 1.74-.05.5-.14.97-.4 1.41-.3.52-.72.95-1.24 1.25-.45.25-.92.35-1.42.4-.47.03-1.05.03-1.73.03H4.83c-.68 0-1.26 0-1.73-.04-.5-.04-.97-.14-1.42-.4-.52-.29-.95-.72-1.24-1.24a3.39 3.39 0 0 1-.4-1.41A20.9 20.9 0 0 1 0 9.88v-3.7c0-.7 0-1.27.04-1.74.05-.5.14-.97.4-1.42.3-.52.72-.95 1.24-1.24.45-.25.92-.35 1.42-.4.47-.04 1.05-.04 1.73-.04ZM3.28 3.38c-.36.03-.51.08-.6.14-.21.11-.39.29-.5.5a.8.8 0 0 0-.08.19l5.16 3.44c.45.3 1.03.3 1.48 0L13.9 4.2a.79.79 0 0 0-.08-.2c-.11-.2-.29-.38-.5-.5-.09-.05-.24-.1-.6-.13-.37-.04-.86-.04-1.6-.04H4.88c-.73 0-1.22 0-1.6.04ZM14 6.54 9.85 9.31a3.33 3.33 0 0 1-3.7 0L2 6.54v3.3c0 .74 0 1.22.03 1.6.04.36.1.5.15.6.11.2.29.38.5.5.09.05.24.1.6.14.37.03.86.03 1.6.03h6.25c.73 0 1.22 0 1.6-.03.35-.03.5-.09.6-.14.2-.12.38-.3.5-.5.05-.1.1-.24.14-.6.03-.38.03-.86.03-1.6v-3.3Z" 11482 clip-rule="evenodd" 11483 /> 11484</svg>`,TFt=Object.freeze(Object.defineProperty({__proto__:null,mailSvg:NFt},Symbol.toStringTag,{value:"Module"})),PFt=ae`<svg fill="none" viewBox="0 0 20 20"> 11485 <path fill="currentColor" d="M10.81 5.81a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z" /> 11486 <path 11487 fill="currentColor" 11488 fill-rule="evenodd" 11489 d="M3 4.75A4.75 4.75 0 0 1 7.75 0h4.5A4.75 4.75 0 0 1 17 4.75v10.5A4.75 4.75 0 0 1 12.25 20h-4.5A4.75 4.75 0 0 1 3 15.25V4.75ZM7.75 2A2.75 2.75 0 0 0 5 4.75v10.5A2.75 2.75 0 0 0 7.75 18h4.5A2.75 2.75 0 0 0 15 15.25V4.75A2.75 2.75 0 0 0 12.25 2h-4.5Z" 11490 clip-rule="evenodd" 11491 /> 11492</svg>`,OFt=Object.freeze(Object.defineProperty({__proto__:null,mobileSvg:PFt},Symbol.toStringTag,{value:"Module"})),kFt=ae`<svg fill="none" viewBox="0 0 41 40"> 11493 <path 11494 style="fill: var(--wui-color-fg-100);" 11495 fill-opacity=".05" 11496 d="M.6 20a20 20 0 1 1 40 0 20 20 0 0 1-40 0Z" 11497 /> 11498 <path 11499 fill="#949E9E" 11500 d="M15.6 20.31a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM23.1 20.31a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0ZM28.1 22.81a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z" 11501 /> 11502</svg>`,RFt=Object.freeze(Object.defineProperty({__proto__:null,moreSvg:kFt},Symbol.toStringTag,{value:"Module"})),BFt=ae`<svg fill="none" viewBox="0 0 22 20"> 11503 <path 11504 fill="currentColor" 11505 fill-rule="evenodd" 11506 d="M16.32 13.62a3.14 3.14 0 1 1-.99 1.72l-1.6-.93a3.83 3.83 0 0 1-3.71 1 3.66 3.66 0 0 1-1.74-1l-1.6.94a3.14 3.14 0 1 1-1-1.73l1.6-.94a3.7 3.7 0 0 1 0-2 3.81 3.81 0 0 1 1.8-2.33c.29-.17.6-.3.92-.38V6.1a3.14 3.14 0 1 1 2 0l-.01.02v1.85H12a3.82 3.82 0 0 1 2.33 1.8 3.7 3.7 0 0 1 .39 2.91l1.6.93ZM2.6 16.54a1.14 1.14 0 0 0 1.98-1.14 1.14 1.14 0 0 0-1.98 1.14ZM11 2.01a1.14 1.14 0 1 0 0 2.28 1.14 1.14 0 0 0 0-2.28Zm1.68 10.45c.08-.19.14-.38.16-.58v-.05l.02-.13v-.13a1.92 1.92 0 0 0-.24-.8l-.11-.15a1.89 1.89 0 0 0-.74-.6 1.86 1.86 0 0 0-.77-.17h-.19a1.97 1.97 0 0 0-.89.34 1.98 1.98 0 0 0-.61.74 1.99 1.99 0 0 0-.16.9v.05a1.87 1.87 0 0 0 .24.74l.1.15c.12.16.26.3.42.42l.16.1.13.07.04.02a1.84 1.84 0 0 0 .76.17h.17a2 2 0 0 0 .91-.35 1.78 1.78 0 0 0 .52-.58l.03-.05a.84.84 0 0 0 .05-.11Zm5.15 4.5a1.14 1.14 0 0 0 1.14-1.97 1.13 1.13 0 0 0-1.55.41c-.32.55-.13 1.25.41 1.56Z" 11507 clip-rule="evenodd" 11508 /> 11509 <path 11510 fill="currentColor" 11511 fill-rule="evenodd" 11512 d="M4.63 9.43a1.5 1.5 0 1 0 1.5-2.6 1.5 1.5 0 0 0-1.5 2.6Zm.32-1.55a.5.5 0 0 1 .68-.19.5.5 0 0 1 .18.68.5.5 0 0 1-.68.19.5.5 0 0 1-.18-.68ZM17.94 8.88a1.5 1.5 0 1 1-2.6-1.5 1.5 1.5 0 1 1 2.6 1.5ZM16.9 7.69a.5.5 0 0 0-.68.19.5.5 0 0 0 .18.68.5.5 0 0 0 .68-.19.5.5 0 0 0-.18-.68ZM9.75 17.75a1.5 1.5 0 1 1 2.6 1.5 1.5 1.5 0 1 1-2.6-1.5Zm1.05 1.18a.5.5 0 0 0 .68-.18.5.5 0 0 0-.18-.68.5.5 0 0 0-.68.18.5.5 0 0 0 .18.68Z" 11513 clip-rule="evenodd" 11514 /> 11515</svg>`,DFt=Object.freeze(Object.defineProperty({__proto__:null,networkPlaceholderSvg:BFt},Symbol.toStringTag,{value:"Module"})),UFt=ae`<svg fill="none" viewBox="0 0 20 20"> 11516 <path 11517 fill="currentColor" 11518 fill-rule="evenodd" 11519 d="M9.13 1h1.71c1.46 0 2.63 0 3.56.1.97.1 1.8.33 2.53.85a5 5 0 0 1 1.1 1.11c.53.73.75 1.56.86 2.53.1.93.1 2.1.1 3.55v1.72c0 1.45 0 2.62-.1 3.55-.1.97-.33 1.8-.86 2.53a5 5 0 0 1-1.1 1.1c-.73.53-1.56.75-2.53.86-.93.1-2.1.1-3.55.1H9.13c-1.45 0-2.62 0-3.56-.1-.96-.1-1.8-.33-2.52-.85a5 5 0 0 1-1.1-1.11 5.05 5.05 0 0 1-.86-2.53c-.1-.93-.1-2.1-.1-3.55V9.14c0-1.45 0-2.62.1-3.55.1-.97.33-1.8.85-2.53a5 5 0 0 1 1.1-1.1 5.05 5.05 0 0 1 2.53-.86C6.51 1 7.67 1 9.13 1ZM5.79 3.09a3.1 3.1 0 0 0-1.57.48 3 3 0 0 0-.66.67c-.24.32-.4.77-.48 1.56-.1.82-.1 1.88-.1 3.4v1.6c0 1.15 0 2.04.05 2.76l.41-.42c.5-.5.93-.92 1.32-1.24.41-.33.86-.6 1.43-.7a3 3 0 0 1 .94 0c.35.06.66.2.95.37a17.11 17.11 0 0 0 .8.45c.1-.08.2-.2.41-.4l.04-.03a27 27 0 0 1 1.95-1.84 4.03 4.03 0 0 1 1.91-.94 4 4 0 0 1 1.25 0c.73.11 1.33.46 1.91.94l.64.55V9.2c0-1.52 0-2.58-.1-3.4a3.1 3.1 0 0 0-.48-1.56 3 3 0 0 0-.66-.67 3.1 3.1 0 0 0-1.56-.48C13.37 3 12.3 3 10.79 3h-1.6c-1.52 0-2.59 0-3.4.09Zm11.18 10-.04-.05a26.24 26.24 0 0 0-1.83-1.74c-.45-.36-.73-.48-.97-.52a2 2 0 0 0-.63 0c-.24.04-.51.16-.97.52-.46.38-1.01.93-1.83 1.74l-.02.02c-.17.18-.34.34-.49.47a2.04 2.04 0 0 1-1.08.5 1.97 1.97 0 0 1-1.25-.27l-.79-.46-.02-.02a.65.65 0 0 0-.24-.1 1 1 0 0 0-.31 0c-.08.02-.21.06-.49.28-.3.24-.65.59-1.2 1.14l-.56.56-.65.66a3 3 0 0 0 .62.6c.33.24.77.4 1.57.49.81.09 1.88.09 3.4.09h1.6c1.52 0 2.58 0 3.4-.09a3.1 3.1 0 0 0 1.56-.48 3 3 0 0 0 .66-.67c.24-.32.4-.77.49-1.56l.07-1.12Zm-8.02-1.03ZM4.99 7a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z" 11520 clip-rule="evenodd" 11521 /> 11522</svg>`,LFt=Object.freeze(Object.defineProperty({__proto__:null,nftPlaceholderSvg:UFt},Symbol.toStringTag,{value:"Module"})),MFt=ae`<svg fill="none" viewBox="0 0 16 16"> 11523 <path 11524 fill="currentColor" 11525 fill-rule="evenodd" 11526 d="M8 0a1 1 0 0 1 1 1v5.38a1 1 0 0 1-2 0V1a1 1 0 0 1 1-1ZM5.26 2.6a1 1 0 0 1-.28 1.39 5.46 5.46 0 1 0 6.04 0 1 1 0 1 1 1.1-1.67 7.46 7.46 0 1 1-8.25 0 1 1 0 0 1 1.4.28Z" 11527 clip-rule="evenodd" 11528 /> 11529</svg>`,jFt=Object.freeze(Object.defineProperty({__proto__:null,offSvg:MFt},Symbol.toStringTag,{value:"Module"})),FFt=ae` <svg 11530 width="36" 11531 height="36" 11532 fill="none" 11533> 11534 <path 11535 d="M0 8a8 8 0 0 1 8-8h20a8 8 0 0 1 8 8v20a8 8 0 0 1-8 8H8a8 8 0 0 1-8-8V8Z" 11536 fill="#fff" 11537 fill-opacity=".05" 11538 /> 11539 <path 11540 d="m18.262 17.513-8.944 9.49v.01a2.417 2.417 0 0 0 3.56 1.452l.026-.017 10.061-5.803-4.703-5.132Z" 11541 fill="#EA4335" 11542 /> 11543 <path 11544 d="m27.307 15.9-.008-.008-4.342-2.52-4.896 4.36 4.913 4.912 4.325-2.494a2.42 2.42 0 0 0 .008-4.25Z" 11545 fill="#FBBC04" 11546 /> 11547 <path 11548 d="M9.318 8.997c-.05.202-.084.403-.084.622V26.39c0 .218.025.42.084.621l9.246-9.247-9.246-8.768Z" 11549 fill="#4285F4" 11550 /> 11551 <path 11552 d="m18.33 18 4.627-4.628-10.053-5.828a2.427 2.427 0 0 0-3.586 1.444L18.329 18Z" 11553 fill="#34A853" 11554 /> 11555 <path 11556 d="M8 .5h20A7.5 7.5 0 0 1 35.5 8v20a7.5 7.5 0 0 1-7.5 7.5H8A7.5 7.5 0 0 1 .5 28V8A7.5 7.5 0 0 1 8 .5Z" 11557 stroke="#fff" 11558 stroke-opacity=".05" 11559 /> 11560</svg>`,zFt=Object.freeze(Object.defineProperty({__proto__:null,playStoreSvg:FFt},Symbol.toStringTag,{value:"Module"})),qFt=ae`<svg 11561 width="13" 11562 height="12" 11563 viewBox="0 0 13 12" 11564 fill="none" 11565> 11566 <path 11567 fill="currentColor" 11568 fill-rule="evenodd" 11569 clip-rule="evenodd" 11570 d="M0.794373 5.99982C0.794373 5.52643 1.17812 5.14268 1.6515 5.14268H5.643V1.15109C5.643 0.677701 6.02675 0.293946 6.50012 0.293945C6.9735 0.293946 7.35725 0.677701 7.35725 1.15109V5.14268H11.3488C11.8221 5.14268 12.2059 5.52643 12.2059 5.99982C12.2059 6.47321 11.8221 6.85696 11.3488 6.85696H7.35725V10.8486C7.35725 11.3219 6.9735 11.7057 6.50012 11.7057C6.02675 11.7057 5.643 11.3219 5.643 10.8486V6.85696H1.6515C1.17812 6.85696 0.794373 6.47321 0.794373 5.99982Z" 11571 /></svg 11572>`,WFt=Object.freeze(Object.defineProperty({__proto__:null,plusSvg:qFt},Symbol.toStringTag,{value:"Module"})),HFt=ae`<svg fill="none" viewBox="0 0 20 20"> 11573 <path 11574 fill="currentColor" 11575 d="M3 6a3 3 0 0 1 3-3h1a1 1 0 1 0 0-2H6a5 5 0 0 0-5 5v1a1 1 0 0 0 2 0V6ZM13 1a1 1 0 1 0 0 2h1a3 3 0 0 1 3 3v1a1 1 0 1 0 2 0V6a5 5 0 0 0-5-5h-1ZM3 13a1 1 0 1 0-2 0v1a5 5 0 0 0 5 5h1a1 1 0 1 0 0-2H6a3 3 0 0 1-3-3v-1ZM19 13a1 1 0 1 0-2 0v1a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1.01a5 5 0 0 0 5-5v-1ZM5.3 6.36c-.04.2-.04.43-.04.89s0 .7.05.89c.14.52.54.92 1.06 1.06.19.05.42.05.89.05.46 0 .7 0 .88-.05A1.5 1.5 0 0 0 9.2 8.14c.06-.2.06-.43.06-.89s0-.7-.06-.89A1.5 1.5 0 0 0 8.14 5.3c-.19-.05-.42-.05-.88-.05-.47 0-.7 0-.9.05a1.5 1.5 0 0 0-1.05 1.06ZM10.8 6.36c-.04.2-.04.43-.04.89s0 .7.05.89c.14.52.54.92 1.06 1.06.19.05.42.05.89.05.46 0 .7 0 .88-.05a1.5 1.5 0 0 0 1.06-1.06c.06-.2.06-.43.06-.89s0-.7-.06-.89a1.5 1.5 0 0 0-1.06-1.06c-.19-.05-.42-.05-.88-.05-.47 0-.7 0-.9.05a1.5 1.5 0 0 0-1.05 1.06ZM5.26 12.75c0-.46 0-.7.05-.89a1.5 1.5 0 0 1 1.06-1.06c.19-.05.42-.05.89-.05.46 0 .7 0 .88.05.52.14.93.54 1.06 1.06.06.2.06.43.06.89s0 .7-.06.89a1.5 1.5 0 0 1-1.06 1.06c-.19.05-.42.05-.88.05-.47 0-.7 0-.9-.05a1.5 1.5 0 0 1-1.05-1.06c-.05-.2-.05-.43-.05-.89ZM10.8 11.86c-.04.2-.04.43-.04.89s0 .7.05.89c.14.52.54.92 1.06 1.06.19.05.42.05.89.05.46 0 .7 0 .88-.05a1.5 1.5 0 0 0 1.06-1.06c.06-.2.06-.43.06-.89s0-.7-.06-.89a1.5 1.5 0 0 0-1.06-1.06c-.19-.05-.42-.05-.88-.05-.47 0-.7 0-.9.05a1.5 1.5 0 0 0-1.05 1.06Z" 11576 /> 11577</svg>`,VFt=Object.freeze(Object.defineProperty({__proto__:null,qrCodeIcon:HFt},Symbol.toStringTag,{value:"Module"})),KFt=ae`<svg 11578 fill="none" 11579 viewBox="0 0 21 20" 11580> 11581 <path 11582 fill="currentColor"
11583 d="M8.8071 0.292893C9.19763 0.683417 9.19763 1.31658 8.8071 1.70711L6.91421 3.6H11.8404C14.3368 3.6 16.5533 5.1975 17.3427 7.56588L17.4487 7.88377C17.6233 8.40772 17.3402 8.97404 16.8162 9.14868C16.2923 9.32333 15.726 9.04017 15.5513 8.51623L15.4453 8.19834C14.9281 6.64664 13.476 5.6 11.8404 5.6H6.91421L8.8071 7.49289C9.19763 7.88342 9.19763 8.51658 8.8071 8.90711C8.41658 9.29763 7.78341 9.29763 7.39289 8.90711L3.79289 5.30711C3.40236 4.91658 3.40236 4.28342 3.79289 3.89289L7.39289 0.292893C7.78341 -0.0976311 8.41658 -0.0976311 8.8071 0.292893ZM4.18377 10.8513C4.70771 10.6767 5.27403 10.9598 5.44868 11.4838L5.55464 11.8017C6.07188 13.3534 7.52401 14.4 9.15964 14.4L14.0858 14.4L12.1929 12.5071C11.8024 12.1166 11.8024 11.4834 12.1929 11.0929C12.5834 10.7024 13.2166 10.7024 13.6071 11.0929L17.2071 14.6929C17.5976 15.0834 17.5976 15.7166 17.2071 16.1071L13.6071 19.7071C13.2166 20.0976 12.5834 20.0976 12.1929 19.7071C11.8024 19.3166 11.8024 18.6834 12.1929 18.2929L14.0858 16.4L9.15964 16.4C6.66314 16.4 4.44674 14.8025 3.65728 12.4341L3.55131 12.1162C3.37667 11.5923 3.65983 11.026 4.18377 10.8513Z" 11584 /></svg 11585>`,GFt=Object.freeze(Object.defineProperty({__proto__:null,recycleHorizontalSvg:KFt},Symbol.toStringTag,{value:"Module"})),ZFt=ae`<svg fill="none" viewBox="0 0 14 16"> 11586 <path 11587 fill="currentColor" 11588 fill-rule="evenodd" 11589 d="M3.94 1.04a1 1 0 0 1 .7 1.23l-.48 1.68a5.85 5.85 0 0 1 8.53 4.32 5.86 5.86 0 0 1-11.4 2.56 1 1 0 0 1 1.9-.57 3.86 3.86 0 1 0 1.83-4.5l1.87.53a1 1 0 0 1-.55 1.92l-4.1-1.15a1 1 0 0 1-.69-1.23l1.16-4.1a1 1 0 0 1 1.23-.7Z" 11590 clip-rule="evenodd" 11591 /> 11592</svg>`,YFt=Object.freeze(Object.defineProperty({__proto__:null,refreshSvg:ZFt},Symbol.toStringTag,{value:"Module"})),JFt=ae`<svg fill="none" viewBox="0 0 20 20"> 11593 <path 11594 fill="currentColor" 11595 fill-rule="evenodd" 11596 d="M9.36 4.21a5.14 5.14 0 1 0 0 10.29 5.14 5.14 0 0 0 0-10.29ZM1.64 9.36a7.71 7.71 0 1 1 14 4.47l2.52 2.5a1.29 1.29 0 1 1-1.82 1.83l-2.51-2.51A7.71 7.71 0 0 1 1.65 9.36Z" 11597 clip-rule="evenodd" 11598 /> 11599</svg>`,XFt=Object.freeze(Object.defineProperty({__proto__:null,searchSvg:JFt},Symbol.toStringTag,{value:"Module"})),QFt=ae`<svg fill="none" viewBox="0 0 21 20"> 11600 <path 11601 fill="currentColor" 11602 fill-rule="evenodd" 11603 d="M14.3808 4.34812C13.72 4.47798 12.8501 4.7587 11.5748 5.17296L9.00869 6.00646C6.90631 6.68935 5.40679 7.17779 4.38121 7.63178C3.87166 7.85734 3.5351 8.05091 3.32022 8.22035C3.11183 8.38466 3.07011 8.48486 3.05969 8.51817C2.98058 8.77103 2.98009 9.04195 3.05831 9.29509C3.06861 9.32844 3.10998 9.42878 3.31777 9.59384C3.53205 9.76404 3.86792 9.95881 4.37667 10.1862C5.29287 10.5957 6.58844 11.0341 8.35529 11.6164L10.8876 8.59854C11.2426 8.17547 11.8733 8.12028 12.2964 8.47528C12.7195 8.83029 12.7746 9.46104 12.4196 9.88412L9.88738 12.9019C10.7676 14.5408 11.4244 15.7406 11.9867 16.5718C12.299 17.0333 12.5491 17.3303 12.7539 17.5117C12.9526 17.6877 13.0586 17.711 13.0932 17.7154C13.3561 17.7484 13.6228 17.7009 13.8581 17.5791C13.8891 17.563 13.9805 17.5046 14.1061 17.2708C14.2357 17.0298 14.3679 16.6647 14.5015 16.1237C14.7705 15.0349 14.9912 13.4733 15.2986 11.2843L15.6738 8.61249C15.8603 7.28456 15.9857 6.37917 15.9989 5.7059C16.012 5.03702 15.9047 4.8056 15.8145 4.69183C15.7044 4.55297 15.5673 4.43792 15.4114 4.35365C15.2837 4.28459 15.0372 4.2191 14.3808 4.34812ZM7.99373 13.603C6.11919 12.9864 4.6304 12.4902 3.5606 12.0121C2.98683 11.7557 2.4778 11.4808 2.07383 11.1599C1.66337 10.8339 1.31312 10.4217 1.14744 9.88551C0.949667 9.24541 0.950886 8.56035 1.15094 7.92096C1.31852 7.38534 1.67024 6.97442 2.08185 6.64985C2.48697 6.33041 2.99697 6.05734 3.57166 5.80295C4.70309 5.3021 6.30179 4.78283 8.32903 4.12437L11.0196 3.25042C12.2166 2.86159 13.2017 2.54158 13.9951 2.38566C14.8065 2.22618 15.6202 2.19289 16.3627 2.59437C16.7568 2.80747 17.1035 3.09839 17.3818 3.4495C17.9062 4.111 18.0147 4.91815 17.9985 5.74496C17.9827 6.55332 17.8386 7.57903 17.6636 8.82534L17.2701 11.6268C16.9737 13.7376 16.7399 15.4022 16.4432 16.6034C16.2924 17.2135 16.1121 17.7632 15.8678 18.2176C15.6197 18.6794 15.2761 19.0971 14.7777 19.3551C14.1827 19.6632 13.5083 19.7833 12.8436 19.6997C12.2867 19.6297 11.82
1160319.3563 11.4277 19.0087C11.0415 18.6666 10.6824 18.213 10.3302 17.6925C9.67361 16.722 8.92648 15.342 7.99373 13.603Z" 11604 clip-rule="evenodd" 11605 /> 11606 <svg 11607 xmlns="http://www.w3.org/2000/svg" 11608 width="21" 11609 height="20" 11610 viewBox="0 0 21 20" 11611 fill="none" 11612 ></svg></svg 11613>`,ezt=Object.freeze(Object.defineProperty({__proto__:null,sendSvg:QFt},Symbol.toStringTag,{value:"Module"})),tzt=ae`<svg fill="none" viewBox="0 0 20 20"> 11614 <path 11615 fill="currentColor" 11616 fill-rule="evenodd" 11617 d="M6.76.3a1 1 0 0 1 0 1.4L4.07 4.4h9a1 1 0 1 1 0 2h-9l2.69 2.68a1 1 0 1 1-1.42 1.42L.95 6.09a1 1 0 0 1 0-1.4l4.4-4.4a1 1 0 0 1 1.4 0Zm6.49 9.21a1 1 0 0 1 1.41 0l4.39 4.4a1 1 0 0 1 0 1.4l-4.39 4.4a1 1 0 0 1-1.41-1.42l2.68-2.68h-9a1 1 0 0 1 0-2h9l-2.68-2.68a1 1 0 0 1 0-1.42Z" 11618 clip-rule="evenodd" 11619 /> 11620</svg>`,nzt=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalSvg:tzt},Symbol.toStringTag,{value:"Module"})),rzt=ae`<svg 11621 width="14" 11622 height="14" 11623 viewBox="0 0 14 14" 11624 fill="none" 11625 xmlns="http://www.w3.org/2000/svg" 11626> 11627 <path 11628 fill-rule="evenodd" 11629 clip-rule="evenodd" 11630 d="M13.7306 3.24213C14.0725 3.58384 14.0725 4.13786 13.7306 4.47957L10.7418 7.46737C10.4 7.80908 9.84581 7.80908 9.50399 7.46737C9.16216 7.12567 9.16216 6.57165 9.50399 6.22994L10.9986 4.73585H5.34082C4.85741 4.73585 4.46553 4.3441 4.46553 3.86085C4.46553 3.3776 4.85741 2.98585 5.34082 2.98585L10.9986 2.98585L9.50399 1.49177C9.16216 1.15006 9.16216 0.596037 9.50399 0.254328C9.84581 -0.0873803 10.4 -0.0873803 10.7418 0.254328L13.7306 3.24213ZM9.52515 10.1352C9.52515 10.6185 9.13327 11.0102 8.64986 11.0102L2.9921 11.0102L4.48669 12.5043C4.82852 12.846 4.82852 13.4001 4.48669 13.7418C4.14487 14.0835 3.59066 14.0835 3.24884 13.7418L0.26003 10.754C0.0958806 10.5899 0.0036621 10.3673 0.00366211 10.1352C0.00366212 9.90318 0.0958806 9.68062 0.26003 9.51652L3.24884 6.52872C3.59066 6.18701 4.14487 6.18701 4.48669 6.52872C4.82851 6.87043 4.82851 7.42445 4.48669 7.76616L2.9921 9.26024L8.64986 9.26024C9.13327 9.26024 9.52515 9.65199 9.52515 10.1352Z" 11631 fill="currentColor" 11632 /> 11633</svg> 11634 11635`,szt=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalMediumSvg:rzt},Symbol.toStringTag,{value:"Module"})),izt=ae`<svg width="10" height="10" viewBox="0 0 10 10"> 11636 <path 11637 fill="currentColor" 11638 fill-rule="evenodd" 11639 d="M3.77986 0.566631C4.0589 0.845577 4.0589 1.29784 3.77986 1.57678L3.08261 2.2738H6.34184C6.73647 2.2738 7.05637 2.5936 7.05637 2.98808C7.05637 3.38257 6.73647 3.70237 6.34184 3.70237H3.08261L3.77986 4.39938C4.0589 4.67833 4.0589 5.13059 3.77986 5.40954C3.50082 5.68848 3.04841 5.68848 2.76937 5.40954L0.852346 3.49316C0.573306 3.21421 0.573306 2.76195 0.852346 2.48301L2.76937 0.566631C3.04841 0.287685 3.50082 0.287685 3.77986 0.566631ZM6.22 4.59102C6.49904 4.31208 6.95145 4.31208 7.23049 4.59102L9.14751 6.5074C9.42655 6.78634 9.42655 7.23861 9.14751 7.51755L7.23049 9.43393C6.95145 9.71287 6.49904 9.71287 6.22 9.43393C5.94096 9.15498 5.94096 8.70272 6.22 8.42377L6.91725 7.72676L3.65802 7.72676C3.26339 7.72676 2.94349 7.40696 2.94349 7.01247C2.94349 6.61798 3.26339 6.29819 3.65802 6.29819L6.91725 6.29819L6.22 5.60117C5.94096 5.32223 5.94096 4.86997 6.22 4.59102Z" 11640 clip-rule="evenodd" 11641 /> 11642</svg>`,ozt=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalBoldSvg:izt},Symbol.toStringTag,{value:"Module"})),azt=ae`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"> 11643 <path 11644 fill="currentColor" 11645 fill-rule="evenodd" 11646 clip-rule="evenodd" 11647 d="M8.3071 0.292893C8.69763 0.683417 8.69763 1.31658 8.3071 1.70711L6.41421 3.6H11.3404C13.8368 3.6 16.0533 5.1975 16.8427 7.56588L16.9487 7.88377C17.1233 8.40772 16.8402 8.97404 16.3162 9.14868C15.7923 9.32333 15.226 9.04017 15.0513 8.51623L14.9453 8.19834C14.4281 6.64664 12.976 5.6 11.3404 5.6H6.41421L8.3071 7.49289C8.69763 7.88342 8.69763 8.51658 8.3071 8.90711C7.91658 9.29763 7.28341 9.29763 6.89289 8.90711L3.29289 5.30711C2.90236 4.91658 2.90236 4.28342 3.29289 3.89289L6.89289 0.292893C7.28341 -0.0976311 7.91658 -0.0976311 8.3071 0.292893ZM3.68377 10.8513C4.20771 10.6767 4.77403 10.9598 4.94868 11.4838L5.05464 11.8017C5.57188 13.3534 7.024 14.4 8.65964 14.4L13.5858 14.4L11.6929 12.5071C11.3024 12.1166 11.3024 11.4834 11.6929 11.0929C12.0834 10.7024 12.7166 10.7024 13.1071 11.0929L16.7071 14.6929C17.0976 15.0834 17.0976 15.7166 16.7071 16.1071L13.1071 19.7071C12.7166 20.0976 12.0834 20.0976 11.6929 19.7071C11.3024 19.3166 11.3024 18.6834 11.6929 18.2929L13.5858 16.4L8.65964 16.4C6.16314 16.4 3.94674 14.8025 3.15728 12.4341L3.05131 12.1162C2.87667 11.5923 3.15983 11.026 3.68377 10.8513Z" 11648 /> 11649</svg>`,czt=Object.freeze(Object.defineProperty({__proto__:null,swapHorizontalRoundedBoldSvg:azt},Symbol.toStringTag,{value:"Module"})),lzt=ae`<svg fill="none" viewBox="0 0 14 14"> 11650 <path 11651 fill="currentColor" 11652 fill-rule="evenodd" 11653 d="M3.48 2.18a1 1 0 0 1 1.41 0l2.68 2.68a1 1 0 1 1-1.41 1.42l-.98-.98v4.56a1 1 0 0 1-2 0V5.3l-.97.98A1 1 0 0 1 .79 4.86l2.69-2.68Zm6.34 2.93a1 1 0 0 1 1 1v4.56l.97-.98a1 1 0 1 1 1.42 1.42l-2.69 2.68a1 1 0 0 1-1.41 0l-2.68-2.68a1 1 0 0 1 1.41-1.42l.98.98V6.1a1 1 0 0 1 1-1Z" 11654 clip-rule="evenodd" 11655 /> 11656</svg>`,uzt=Object.freeze(Object.defineProperty({__proto__:null,swapVerticalSvg:lzt},Symbol.toStringTag,{value:"Module"})),dzt=ae`<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"> 11657 <g clip-path="url(#a)"> 11658 <path fill="url(#b)" d="M0 0h32v32H0z"/> 11659 <path fill-rule="evenodd" clip-rule="evenodd" d="M7.034 15.252c4.975-2.167 8.293-3.596 9.953-4.287 4.74-1.971 5.725-2.314 6.366-2.325.142-.002.457.033.662.198.172.14.22.33.243.463.022.132.05.435.028.671-.257 2.7-1.368 9.248-1.933 12.27-.24 1.28-.71 1.708-1.167 1.75-.99.091-1.743-.655-2.703-1.284-1.502-.985-2.351-1.598-3.81-2.558-1.684-1.11-.592-1.721.368-2.718.252-.261 4.619-4.233 4.703-4.594.01-.045.02-.213-.08-.301-.1-.09-.246-.059-.353-.035-.15.034-2.55 1.62-7.198 4.758-.682.468-1.298.696-1.851.684-.61-.013-1.782-.344-2.653-.628-1.069-.347-1.918-.53-1.845-1.12.039-.308.462-.623 1.27-.944Z" fill="#fff"/> 11660 </g> 11661 <path d="M.5 16C.5 7.44 7.44.5 16 .5 24.56.5 31.5 7.44 31.5 16c0 8.56-6.94 15.5-15.5 15.5C7.44 31.5.5 24.56.5 16Z" stroke="#141414" stroke-opacity=".05"/> 11662 <defs> 11663 <linearGradient id="b" x1="1600" y1="0" x2="1600" y2="3176.27" gradientUnits="userSpaceOnUse"> 11664 <stop stop-color="#2AABEE"/> 11665 <stop offset="1" stop-color="#229ED9"/> 11666 </linearGradient> 11667 <clipPath id="a"> 11668 <path d="M0 16C0 7.163 7.163 0 16 0s16 7.163 16 16-7.163 16-16 16S0 24.837 0 16Z" fill="#fff"/> 11669 </clipPath> 11670 </defs> 11671</svg>`,hzt=Object.freeze(Object.defineProperty({__proto__:null,telegramSvg:dzt},Symbol.toStringTag,{value:"Module"})),fzt=ae`<svg width="14" height="15" viewBox="0 0 14 15" fill="none" xmlns="http://www.w3.org/2000/svg"> 11672 <path d="M7 3.71875C6.0335 3.71875 5.25 2.93525 5.25 1.96875C5.25 1.00225 6.0335 0.21875 7 0.21875C7.9665 0.21875 8.75 1.00225 8.75 1.96875C8.75 2.93525 7.9665 3.71875 7 3.71875Z" fill="#949E9E"/> 11673 <path d="M7 8.96875C6.0335 8.96875 5.25 8.18525 5.25 7.21875C5.25 6.25225 6.0335 5.46875 7 5.46875C7.9665 5.46875 8.75 6.25225 8.75 7.21875C8.75 8.18525 7.9665 8.96875 7 8.96875Z" fill="#949E9E"/> 11674 <path d="M5.25 12.4688C5.25 13.4352 6.0335 14.2187 7 14.2187C7.9665 14.2187 8.75 13.4352 8.75 12.4688C8.75 11.5023 7.9665 10.7188 7 10.7188C6.0335 10.7188 5.25 11.5023 5.25 12.4688Z" fill="#949E9E"/> 11675</svg>`,pzt=Object.freeze(Object.defineProperty({__proto__:null,threeDotsSvg:fzt},Symbol.toStringTag,{value:"Module"})),gzt=ae`<svg fill="none" viewBox="0 0 40 40"> 11676 <g clip-path="url(#a)"> 11677 <g clip-path="url(#b)"> 11678 <circle cx="20" cy="19.89" r="20" fill="#5A3E85" /> 11679 <g clip-path="url(#c)"> 11680 <path 11681 fill="#fff" 11682 d="M18.22 25.7 20 23.91h3.34l2.1-2.1v-6.68H15.4v8.78h2.82v1.77Zm3.87-8.16h1.25v3.66H22.1v-3.66Zm-3.34 0H20v3.66h-1.25v-3.66ZM20 7.9a12 12 0 1 0 0 24 12 12 0 0 0 0-24Zm6.69 14.56-3.66 3.66h-2.72l-1.77 1.78h-1.88V26.1H13.3v-9.82l.94-2.4H26.7v8.56Z" 11683 /> 11684 </g> 11685 </g> 11686 </g>
11687 <defs> 11688 <clipPath id="a"><rect width="40" height="40" fill="#fff" rx="20" /></clipPath> 11689 <clipPath id="b"><path fill="#fff" d="M0 0h40v40H0z" /></clipPath> 11690 <clipPath id="c"><path fill="#fff" d="M8 7.89h24v24H8z" /></clipPath> 11691 </defs> 11692</svg>`,mzt=Object.freeze(Object.defineProperty({__proto__:null,twitchSvg:gzt},Symbol.toStringTag,{value:"Module"})),wzt=ae`<svg fill="none" viewBox="0 0 41 40"> 11693 <g clip-path="url(#a)"> 11694 <path fill="#000" d="M.8 0h40v40H.8z" /> 11695 <path 11696 fill="#fff" 11697 d="m22.63 18.46 7.14-8.3h-1.69l-6.2 7.2-4.96-7.2H11.2l7.5 10.9-7.5 8.71h1.7l6.55-7.61 5.23 7.61h5.72l-7.77-11.31Zm-9.13-7.03h2.6l11.98 17.13h-2.6L13.5 11.43Z" 11698 /> 11699 </g> 11700 <defs> 11701 <clipPath id="a"><path fill="#fff" d="M.8 20a20 20 0 1 1 40 0 20 20 0 0 1-40 0Z" /></clipPath> 11702 </defs> 11703</svg>`,hle=Object.freeze(Object.defineProperty({__proto__:null,xSvg:wzt},Symbol.toStringTag,{value:"Module"})),yzt=ae`<svg fill="none" viewBox="0 0 16 16"> 11704 <path 11705 fill="currentColor" 11706 d="m14.36 4.74.01.42c0 4.34-3.3 9.34-9.34 9.34A9.3 9.3 0 0 1 0 13.03a6.6 6.6 0 0 0 4.86-1.36 3.29 3.29 0 0 1-3.07-2.28c.5.1 1 .07 1.48-.06A3.28 3.28 0 0 1 .64 6.11v-.04c.46.26.97.4 1.49.41A3.29 3.29 0 0 1 1.11 2.1a9.32 9.32 0 0 0 6.77 3.43 3.28 3.28 0 0 1 5.6-3 6.59 6.59 0 0 0 2.08-.8 3.3 3.3 0 0 1-1.45 1.82A6.53 6.53 0 0 0 16 3.04c-.44.66-1 1.23-1.64 1.7Z" 11707 /> 11708</svg>`,bzt=Object.freeze(Object.defineProperty({__proto__:null,twitterIconSvg:yzt},Symbol.toStringTag,{value:"Module"})),vzt=ae`<svg fill="none" viewBox="0 0 28 28"> 11709 <path 11710 fill="currentColor" 11711 fill-rule="evenodd" 11712 d="M18.1 4.76c-.42-.73-1.33-1.01-2.09-.66l-1.42.66c-.37.18-.8.18-1.18 0l-1.4-.65a1.63 1.63 0 0 0-2.1.66l-.84 1.45c-.2.34-.53.59-.92.67l-1.7.35c-.83.17-1.39.94-1.3 1.78l.19 1.56c.04.39-.08.78-.33 1.07l-1.12 1.3c-.52.6-.52 1.5 0 2.11L5 16.38c.25.3.37.68.33 1.06l-.18 1.57c-.1.83.46 1.6 1.28 1.78l1.7.35c.4.08.73.32.93.66l.84 1.43a1.63 1.63 0 0 0 2.09.66l1.41-.66c.37-.17.8-.17 1.18 0l1.43.67c.76.35 1.66.07 2.08-.65l.86-1.45c.2-.34.54-.58.92-.66l1.68-.35A1.63 1.63 0 0 0 22.84 19l-.18-1.57a1.4 1.4 0 0 1 .33-1.06l1.12-1.32c.52-.6.52-1.5 0-2.11l-1.12-1.3a1.4 1.4 0 0 1-.33-1.07l.18-1.57c.1-.83-.46-1.6-1.28-1.77l-1.68-.35a1.4 1.4 0 0 1-.92-.66l-.86-1.47Zm-3.27-3.2a4.43 4.43 0 0 1 5.69 1.78l.54.93 1.07.22a4.43 4.43 0 0 1 3.5 4.84l-.11.96.7.83a4.43 4.43 0 0 1 .02 5.76l-.72.85.1.96a4.43 4.43 0 0 1-3.5 4.84l-1.06.22-.54.92a4.43 4.43 0 0 1-5.68 1.77l-.84-.4-.82.39a4.43 4.43 0 0 1-5.7-1.79l-.51-.89-1.09-.22a4.43 4.43 0 0 1-3.5-4.84l.1-.96-.72-.85a4.43 4.43 0 0 1 .01-5.76l.71-.83-.1-.95a4.43 4.43 0 0 1 3.5-4.84l1.08-.23.53-.9a4.43 4.43 0 0 1 5.7-1.8l.81.38.83-.39ZM18.2 9.4c.65.42.84 1.28.42 1.93l-4.4 6.87a1.4 1.4 0 0 1-2.26.14L9.5 15.39a1.4 1.4 0 0 1 2.15-1.8l1.23 1.48 3.38-5.26a1.4 1.4 0 0 1 1.93-.42Z" 11713 clip-rule="evenodd" 11714 /> 11715</svg>`,Ezt=Object.freeze(Object.defineProperty({__proto__:null,verifySvg:vzt},Symbol.toStringTag,{value:"Module"})),Czt=ae`<svg fill="none" viewBox="0 0 14 14"> 11716 <path 11717 fill="currentColor" 11718 fill-rule="evenodd" 11719 d="m4.1 12.43-.45-.78-.93-.2a1.65 1.65 0 0 1-1.31-1.8l.1-.86-.61-.71a1.65 1.65 0 0 1 0-2.16l.6-.7-.09-.85c-.1-.86.47-1.64 1.3-1.81l.94-.2.45-.78A1.65 1.65 0 0 1 6.23.9l.77.36.78-.36c.77-.36 1.69-.07 2.12.66l.47.8.91.2c.84.17 1.4.95 1.31 1.8l-.1.86.6.7c.54.62.54 1.54.01 2.16l-.6.71.09.86c.1.85-.47 1.63-1.3 1.8l-.92.2-.47.79a1.65 1.65 0 0 1-2.12.66L7 12.74l-.77.36c-.78.35-1.7.07-2.13-.67Zm5.74-6.9a1 1 0 1 0-1.68-1.07L6.32 7.3l-.55-.66a1 1 0 0 0-1.54 1.28l1.43 1.71a1 1 0 0 0 1.61-.1l2.57-4Z" 11720 clip-rule="evenodd" 11721 /> 11722</svg>`,$zt=Object.freeze(Object.defineProperty({__proto__:null,verifyFilledSvg:Czt},Symbol.toStringTag,{value:"Module"})),xzt=ae`<svg fill="none" viewBox="0 0 20 20"> 11723 <path 11724 fill="currentColor" 11725 fill-rule="evenodd" 11726 d="M0 5.5c0-1.8 1.46-3.25 3.25-3.25H14.5c1.8 0 3.25 1.46 3.25 3.25v.28A3.25 3.25 0 0 1 20 8.88v2.24c0 1.45-.94 2.68-2.25 3.1v.28c0 1.8-1.46 3.25-3.25 3.25H3.25A3.25 3.25 0 0 1 0 14.5v-9Zm15.75 8.88h-2.38a4.38 4.38 0 0 1 0-8.76h2.38V5.5c0-.69-.56-1.25-1.25-1.25H3.25C2.56 4.25 2 4.81 2 5.5v9c0 .69.56 1.25 1.25 1.25H14.5c.69 0 1.25-.56 1.25-1.25v-.13Zm-2.38-6.76a2.37 2.37 0 1 0 0 4.75h3.38c.69 0 1.25-.55 1.25-1.24V8.87c0-.69-.56-1.24-1.25-1.24h-3.38Z" 11727 clip-rule="evenodd" 11728 /> 11729</svg>`,Izt=Object.freeze(Object.defineProperty({__proto__:null,walletSvg:xzt},Symbol.toStringTag,{value:"Module"})),Szt=ae`<svg fill="none" viewBox="0 0 96 67"> 11730 <path 11731 fill="currentColor" 11732 d="M25.32 18.8a32.56 32.56 0 0 1 45.36 0l1.5 1.47c.63.62.63 1.61 0 2.22l-5.15 5.05c-.31.3-.82.3-1.14 0l-2.07-2.03a22.71 22.71 0 0 0-31.64 0l-2.22 2.18c-.31.3-.82.3-1.14 0l-5.15-5.05a1.55 1.55 0 0 1 0-2.22l1.65-1.62Zm56.02 10.44 4.59 4.5c.63.6.63 1.6 0 2.21l-20.7 20.26c-.62.61-1.63.61-2.26 0L48.28 41.83a.4.4 0 0 0-.56 0L33.03 56.21c-.63.61-1.64.61-2.27 0L10.07 35.95a1.55 1.55 0 0 1 0-2.22l4.59-4.5a1.63 1.63 0 0 1 2.27 0L31.6 43.63a.4.4 0 0 0 .57 0l14.69-14.38a1.63 1.63 0 0 1 2.26 0l14.69 14.38a.4.4 0 0 0 .57 0l14.68-14.38a1.63 1.63 0 0 1 2.27 0Z" 11733 /> 11734 <path 11735 stroke="#000" 11736 stroke-opacity=".1" 11737 d="M25.67 19.15a32.06 32.06 0 0 1 44.66 0l1.5 1.48c.43.42.43 1.09 0 1.5l-5.15 5.05a.31.31 0 0 1-.44 0l-2.07-2.03a23.21 23.21 0 0 0-32.34 0l-2.22 2.18a.31.31 0 0 1-.44 0l-5.15-5.05a1.05 1.05 0 0 1 0-1.5l1.65-1.63ZM81 29.6l4.6 4.5c.42.41.42 1.09 0 1.5l-20.7 20.26c-.43.43-1.14.43-1.57 0L48.63 41.47a.9.9 0 0 0-1.26 0L32.68 55.85c-.43.43-1.14.43-1.57 0L10.42 35.6a1.05 1.05 0 0 1 0-1.5l4.59-4.5a1.13 1.13 0 0 1 1.57 0l14.68 14.38a.9.9 0 0 0 1.27 0l-.35-.35.35.35L47.22 29.6a1.13 1.13 0 0 1 1.56 0l14.7 14.38a.9.9 0 0 0 1.26 0L79.42 29.6a1.13 1.13 0 0 1 1.57 0Z" 11738 /> 11739</svg>`,Azt=ae`
11740<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 11741<g clip-path="url(#clip0_22274_4692)"> 11742<path d="M0 6.64C0 4.17295 0 2.93942 0.525474 2.01817C0.880399 1.39592 1.39592 0.880399 2.01817 0.525474C2.93942 0 4.17295 0 6.64 0H9.36C11.8271 0 13.0606 0 13.9818 0.525474C14.6041 0.880399 15.1196 1.39592 15.4745 2.01817C16 2.93942 16 4.17295 16 6.64V9.36C16 11.8271 16 13.0606 15.4745 13.9818C15.1196 14.6041 14.6041 15.1196 13.9818 15.4745C13.0606 16 11.8271 16 9.36 16H6.64C4.17295 16 2.93942 16 2.01817 15.4745C1.39592 15.1196 0.880399 14.6041 0.525474 13.9818C0 13.0606 0 11.8271 0 9.36V6.64Z" fill="#C7B994"/> 11743<path d="M4.49038 5.76609C6.42869 3.86833 9.5713 3.86833 11.5096 5.76609L11.7429 5.99449C11.8398 6.08938 11.8398 6.24323 11.7429 6.33811L10.9449 7.11942C10.8964 7.16686 10.8179 7.16686 10.7694 7.11942L10.4484 6.80512C9.09617 5.48119 6.90381 5.48119 5.5516 6.80512L5.20782 7.14171C5.15936 7.18915 5.08079 7.18915 5.03234 7.14171L4.23434 6.3604C4.13742 6.26552 4.13742 6.11167 4.23434 6.01678L4.49038 5.76609ZM13.1599 7.38192L13.8702 8.07729C13.9671 8.17217 13.9671 8.32602 13.8702 8.4209L10.6677 11.5564C10.5708 11.6513 10.4137 11.6513 10.3168 11.5564L8.04388 9.33105C8.01965 9.30733 7.98037 9.30733 7.95614 9.33105L5.6833 11.5564C5.58638 11.6513 5.42925 11.6513 5.33234 11.5564L2.12982 8.42087C2.0329 8.32598 2.0329 8.17213 2.12982 8.07724L2.84004 7.38188C2.93695 7.28699 3.09408 7.28699 3.191 7.38188L5.46392 9.60726C5.48815 9.63098 5.52743 9.63098 5.55166 9.60726L7.82447 7.38188C7.92138 7.28699 8.07851 7.28699 8.17543 7.38187L10.4484 9.60726C10.4726 9.63098 10.5119 9.63098 10.5361 9.60726L12.809 7.38192C12.9059 7.28703 13.063 7.28703 13.1599 7.38192Z" fill="#202020"/> 11744</g> 11745<defs> 11746<clipPath id="clip0_22274_4692"> 11747<path d="M0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8Z" fill="white"/> 11748</clipPath> 11749</defs> 11750</svg> 11751`,_zt=ae` 11752<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 11753<circle cx="11" cy="11" r="11" transform="matrix(-1 0 0 1 23 1)" fill="#202020"/> 11754<circle cx="11" cy="11" r="11.5" transform="matrix(-1 0 0 1 23 1)" stroke="#C7B994" stroke-opacity="0.7"/> 11755<path d="M15.4523 11.0686L16.7472 9.78167C13.8205 6.87297 10.1838 6.87297 7.25708 9.78167L8.55201 11.0686C10.7779 8.85645 13.2279 8.85645 15.4538 11.0686H15.4523Z" fill="#C7B994"/> 11756<path d="M15.0199 14.067L12 11.0656L8.98 14.067L5.96004 11.0656L4.66663 12.3511L8.98 16.6393L12 13.638L15.0199 16.6393L19.3333 12.3511L18.0399 11.0656L15.0199 14.067Z" fill="#C7B994"/> 11757</svg> 11758`,EU=Object.freeze(Object.defineProperty({__proto__:null,walletConnectBrownSvg:_zt,walletConnectLightBrownSvg:Azt,walletConnectSvg:Szt},Symbol.toStringTag,{value:"Module"})),Nzt=ae` 11759 <svg fill="none" viewBox="0 0 48 44"> 11760 <path 11761 style="fill: var(--wui-color-bg-300);" 11762 d="M4.56 8.64c-1.23 1.68-1.23 4.08-1.23 8.88v8.96c0 4.8 0 7.2 1.23 8.88.39.55.87 1.02 1.41 1.42C7.65 38 10.
1176205 38 14.85 38h14.3c4.8 0 7.2 0 8.88-1.22a6.4 6.4 0 0 0 1.41-1.42c.83-1.14 1.1-2.6 1.19-4.92a6.4 6.4 0 0 0 5.16-4.65c.21-.81.21-1.8.21-3.79 0-1.98 0-2.98-.22-3.79a6.4 6.4 0 0 0-5.15-4.65c-.1-2.32-.36-3.78-1.19-4.92a6.4 6.4 0 0 0-1.41-1.42C36.35 6 33.95 6 29.15 6h-14.3c-4.8 0-7.2 0-8.88 1.22a6.4 6.4 0 0 0-1.41 1.42Z" 11763 /> 11764 <path 11765 style="fill: var(--wui-color-fg-200);" 11766 fill-rule="evenodd" 11767 d="M2.27 11.33a6.4 6.4 0 0 1 6.4-6.4h26.66a6.4 6.4 0 0 1 6.4 6.4v1.7a6.4 6.4 0 0 1 5.34 6.3v5.34a6.4 6.4 0 0 1-5.34 6.3v1.7a6.4 6.4 0 0 1-6.4 6.4H8.67a6.4 6.4 0 0 1-6.4-6.4V11.33ZM39.6 31.07h-6.93a9.07 9.07 0 1 1 0-18.14h6.93v-1.6a4.27 4.27 0 0 0-4.27-4.26H8.67a4.27 4.27 0 0 0-4.27 4.26v21.34a4.27 4.27 0 0 0 4.27 4.26h26.66a4.27 4.27 0 0 0 4.27-4.26v-1.6Zm-6.93-16a6.93 6.93 0 0 0 0 13.86h8a4.27 4.27 0 0 0 4.26-4.26v-5.34a4.27 4.27 0 0 0-4.26-4.26h-8Z" 11768 clip-rule="evenodd" 11769 /> 11770 </svg> 11771`,Tzt=Object.freeze(Object.defineProperty({__proto__:null,walletPlaceholderSvg:Nzt},Symbol.toStringTag,{value:"Module"})),Pzt=ae`<svg fill="none" viewBox="0 0 20 20"> 11772 <path 11773 fill="currentColor" 11774 d="M11 6.67a1 1 0 1 0-2 0v2.66a1 1 0 0 0 2 0V6.67ZM10 14.5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" 11775 /> 11776 <path 11777 fill="currentColor" 11778 fill-rule="evenodd" 11779 d="M10 1a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm-7 9a7 7 0 1 1 14 0 7 7 0 0 1-14 0Z" 11780 clip-rule="evenodd" 11781 /> 11782</svg>`,Ozt=Object.freeze(Object.defineProperty({__proto__:null,warningCircleSvg:Pzt},Symbol.toStringTag,{value:"Module"})),kzt=ae`<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"> 11783<path d="M9.125 6.875C9.125 6.57833 9.21298 6.28832 9.3778 6.04165C9.54262 5.79497 9.77689 5.60271 10.051 5.48918C10.3251 5.37565 10.6267 5.34594 10.9176 5.40382C11.2086 5.4617 11.4759 5.60456 11.6857 5.81434C11.8954 6.02412 12.0383 6.29139 12.0962 6.58236C12.1541 6.87334 12.1244 7.17494 12.0108 7.44903C11.8973 7.72311 11.705 7.95738 11.4584 8.1222C11.2117 8.28703 10.9217 8.375 10.625 8.375C10.2272 8.375 9.84565 8.21696 9.56434 7.93566C9.28304 7.65436 9.125 7.27282 9.125 6.875ZM21.125 11C21.125 13.0025 20.5312 14.9601 19.4186 16.6251C18.3061 18.2902 16.7248 19.5879 14.8747 20.3543C13.0246 21.1206 10.9888 21.3211 9.02471 20.9305C7.06066 20.5398 5.25656 19.5755 3.84055 18.1595C2.42454 16.7435 1.46023 14.9393 1.06955 12.9753C0.678878 11.0112 0.879387 8.97543 1.64572 7.12533C2.41206 5.27523 3.70981 3.69392 5.37486 2.58137C7.0399 1.46882 8.99747 0.875 11 0.875C13.6844 0.877978 16.258 1.94567 18.1562 3.84383C20.0543 5.74199 21.122 8.3156 21.125 11ZM18.875 11C18.875 9.44247 18.4131 7.91992 17.5478 6.62488C16.6825 5.32985 15.4526 4.32049 14.0136 3.72445C12.5747 3.12841 10.9913 2.97246 9.46367 3.27632C7.93607 3.58017 6.53288 4.3302 5.43154 5.43153C4.3302 6.53287 3.58018 7.93606 3.27632 9.46366C2.97246 10.9913 3.12841 12.5747 3.72445 14.0136C4.32049 15.4526 5.32985 16.6825 6.62489 17.5478C7.91993 18.4131 9.44248 18.875 11 18.875C13.0879 18.8728 15.0896 18.0424 16.566 16.566C18.0424 15.0896 18.8728 13.0879 18.875 11ZM12.125 14.4387V11.375C12.125 10.8777 11.9275 10.4008 11.5758 10.0492C11.2242 9.69754 10.7473 9.5 10.25 9.5C9.98433 9.4996 9.72708 9.59325 9.52383 9.76435C9.32058 9.93544 9.18444 10.173 9.13952 10.4348C9.09461 10.6967 9.14381 10.966 9.27843 11.195C9.41304 11.4241 9.62438 11.5981 9.875 11.6863V14.75C9.875 15.2473 10.0725 15.7242 10.4242 16.0758C10.7758 16.4275 11.2527 16.625 11.75 16.625C12.0157 16.6254 12.2729 16.5318 12.4762 16.3607C12.6794 16.1896 12.8156 15.952 12.8605 15.6902C12.9054 15.4283 12.8562 15.159 12.7216 14.93C12.587 14.7009 12.3756 14.5269 12.125 14.4387Z" fill="currentColor"/> 11784</svg>`,Rzt=Object.freeze(Object.defineProperty({__proto__:null,infoSvg:kzt},Symbol.toStringTag,{value:"Module"})),Bzt=ae`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 11785<path d="M15.0162 11.6312L9.55059 2.13937C9.39228 1.86862 9.16584 1.64405 8.8938 1.48798C8.62176 1.33192 8.3136 1.2498 7.99997 1.2498C7.68634 1.2498 7.37817 1.33192 7.10613 1.48798C6.83409 1.64405 6.60765 1.86862 6.44934 2.13937L0.983716 11.6312C0.830104 11.894 0.749146 12.1928 0.749146 12.4972C0.749146 12.8015 0.830104 13.1004 0.983716 13.3631C1.14027 13.6352 1.3664 13.8608 1.63889 14.0166C1.91139 14.1725 2.22044 14.253 2.53434 14.25H13.4656C13.7793 14.2528 14.0881 14.1721 14.3603 14.0163C14.6326 13.8604 14.8585 13.635 15.015 13.3631C15.1688 13.1005 15.2499 12.8017 15.2502 12.4973C15.2504 12.193 15.1696 11.8941 15.0162 11.6312ZM13.7162 12.6125C13.6908 12.6558 13.6541 12.6914 13.6101 12.7157C13.5661 12.7399 13.5164 12.7517 13.4662 12.75H2.53434C2.48415 12.7517 2.43442 12.7399 2.39042 12.7157C2.34641 12.6914 2.30976 12.6558 2.28434 12.6125C2.26278 12.5774 2.25137 12.5371 2.25137 12.4959C2.25137 12.4548 2.26278 12.4144 2.28434 12.3794L7.74997 2.88749C7.77703 2.84583 7.81408 2.8116 7.85774 2.7879C7.9014 2.7642 7.95029 2.75178 7.99997 2.75178C8.04964 2.75178 8.09854 2.7642 8.1422 2.7879C8.18586 2.8116 8.2229 2.84583 8.24997 2.88749L13.715 12.3794C13.7367 12.4143 13.7483 12.4546 13.7486 12.4958C13.7488 12.5369 13.7376 12.5773 13.7162 12.6125ZM7.24997 8.49999V6.49999C7.24997 6.30108 7.32898 6.11031 7.46964 5.96966C7.61029 5.82901 7.80105 5.74999 7.99997 5.74999C8.19888 5.74999 8.38964 5.82901 8.5303 5.96966C8.67095 6.11031 8.74997 6.30108 8.74997 6.49999V8.49999C8.74997 8.6989 8.67095 8.88967 8.5303 9.03032C8.38964 9.17097 8.19888 9.24999 7.99997 9.24999C7.80105 9.24999 7.61029 9.17097 7.46964 9.03032C7.32898 8.88967 7.24997 8.6989 7.24997 8.49999ZM8.99997 11C8.99997 11.1978 8.94132 11.3911 8.83144 11.5556C8.72155 11.72 8.56538 11.8482 8.38265 11.9239C8.19992 11.9996 7.99886 12.0194 7.80488 11.9808C7.6109 11.9422 7.43271 11.847 7.29286 11.7071C7.15301 11.5672 7.05777 11.3891 7.01918 11.1951C6.9806 11.0011 7.0004 10.8 7.07609 10.6173C7.15177 10.4346 7.27995 10.2784 7.4444 10.1685C7.60885 10.0586 7.80219 9.99999 7.99997 9.99999C8.26518 9.99999 8.51954 10.1053 8.70707 10.2929C8.89461 10.4804 8.99997 10.7348 8.99997 11Z" fill="currentColor"/> 11786</svg> 11787`,Dzt=Object.freeze(Object.defineProperty({__proto__:null,exclamationTriangleSvg:Bzt},Symbol.toStringTag,{value:"Module"}
11787)),Uzt=ae`<svg width="60" height="16" viewBox="0 0 60 16" fill="none""> 11788 <path d="M9.3335 4.66667C9.3335 2.08934 11.4229 0 14.0002 0H20.6669C23.2442 0 25.3335 2.08934 25.3335 4.66667V11.3333C25.3335 13.9106 23.2442 16 20.6669 16H14.0002C11.4229 16 9.3335 13.9106 9.3335 11.3333V4.66667Z" fill="#363636"/> 11789 <path d="M15.6055 11.0003L17.9448 4.66699H18.6316L16.2923 11.0003H15.6055Z" fill="#F6F6F6"/> 11790 <path d="M0 4.33333C0 1.9401 1.9401 0 4.33333 0C6.72657 0 8.66669 1.9401 8.66669 4.33333V11.6667C8.66669 14.0599 6.72657 16 4.33333 16C1.9401 16 0 14.0599 0 11.6667V4.33333Z" fill="#363636"/> 11791 <path d="M3.9165 9.99934V9.16602H4.74983V9.99934H3.9165Z" fill="#F6F6F6"/> 11792 <path d="M26 8C26 3.58172 29.3517 0 33.4863 0H52.5137C56.6483 0 60 3.58172 60 8C60 12.4183 56.6483 16 52.5137 16H33.4863C29.3517 16 26 12.4183 26 8Z" fill="#363636"/> 11793 <path d="M49.3687 9.95834V6.26232H50.0213V6.81966C50.256 6.40899 50.7326 6.16699 51.2606 6.16699C52.0599 6.16699 52.6173 6.67299 52.6173 7.65566V9.95834H51.972V7.69234C51.972 7.04696 51.6053 6.70966 51.07 6.70966C50.4906 6.70966 50.0213 7.17168 50.0213 7.82433V9.95834H49.3687Z" fill="#F6F6F6"/> 11794 <path d="M45.2538 9.95773L44.5718 6.26172H45.1877L45.6717 9.31242L46.3098 7.30306H46.9184L47.5491 9.29041L48.0404 6.26172H48.6564L47.9744 9.95773H47.2411L46.6178 8.03641L45.9871 9.95773H45.2538Z" fill="#F6F6F6"/> 11795 <path d="M42.3709 10.0536C41.2489 10.0536 40.5889 9.21765 40.5889 8.1103C40.5889 7.01035 41.2489 6.16699 42.3709 6.16699C43.4929 6.16699 44.1529 7.01035 44.1529 8.1103C44.1529 9.21765 43.4929 10.0536 42.3709 10.0536ZM42.3709 9.51096C43.1775 9.51096 43.4856 8.82164 43.4856 8.10296C43.4856 7.39163 43.1775 6.70966 42.3709 6.70966C41.5642 6.70966 41.2562 7.39163 41.2562 8.10296C41.2562 8.82164 41.5642 9.51096 42.3709 9.51096Z" fill="#F6F6F6"/> 11796 <path d="M38.2805 10.0536C37.1952 10.0536 36.5132 9.22499 36.5132 8.1103C36.5132 7.00302 37.1952 6.16699 38.2805 6.16699C39.1972 6.16699 40.0038 6.68766 39.9159 8.27896H37.1805C37.2319 8.96103 37.5472 9.5183 38.2805 9.5183C38.7718 9.5183 39.0945 9.21765 39.2045 8.87299H39.8499C39.7472 9.48903 39.1679 10.0536 38.2805 10.0536ZM37.1952 7.78765H39.2852C39.2338 7.04696 38.8892 6.70232 38.2805 6.70232C37.6132 6.70232 37.2832 7.18635 37.1952 7.78765Z" fill="#F6F6F6"/> 11797 <path d="M33.3828 9.95773V6.26172H34.0501V6.88506C34.2848 6.47439 34.6882 6.26172 35.1061 6.26172H35.9935V6.88506H35.0548C34.4682 6.88506 34.0501 7.26638 34.0501 8.00706V9.95773H33.3828Z" fill="#F6F6F6"/> 11798</svg>`,Lzt=Object.freeze(Object.defineProperty({__proto__:null,reownSvg:Uzt},Symbol.toStringTag,{value:"Module"}));export{Vzt as E,qzt as _,te as a,zzt as b,J$e as c,Wzt as d,X$e as e,WWt as f,vu as g,y0 as h,Xg as i,w0 as j,U0 as k,EMe as l,Oq as m,bVt as n,ih as o,j0 as p,gYt as q,Hzt as r,Q$e as s};
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.