const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-2hIxWHIK.js","assets/index-CXyQ5sGC.js","assets/lodash-CQGrF3PQ.js","assets/index-D5c7CNr0.css","assets/events-C8x43ppJ.js","assets/index-Vmx-EkLq.js","assets/index-FnRUSmLt.js","assets/___vite-browser-external_commonjs-proxy-DoZ_vOnO.js","assets/walletConnect-CiycSUBb.js"])))=>i.map(i=>d[i]); import{E as Un,_ as Nn,C as In,F as Tn,j as cr}from"./index-CXyQ5sGC.js";import{t as Pn}from"./index-Vmx-EkLq.js";import{C as Mn,_ as ye,g as mt,a as ee,U as fr,b as J,c as jn,S as hr,n as lr,d as Fn,e as kr,f as xn,h as Rn,w as Ln,i as Bn,j as Wn,k as Hn,s as Kn,l as $n,m as zn,o as dr,I as Yn,p as kn,q as qn,W as Gn,r as Vn}from"./index-FnRUSmLt.js";import{r as Xn}from"./___vite-browser-external_commonjs-proxy-DoZ_vOnO.js";import{O as Qn}from"./lodash-CQGrF3PQ.js";import{F as Jn,M as Zn,Z as ei,T as ti,B as ri,b as ni}from"./walletConnect-CiycSUBb.js";const Dr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALEAAACyCAYAAAANvS5rAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAsbSURBVHhe7d0LkJdVGQbwB0UFFQnxAqa2okhFm6EjqEOKKCDIRRgHK8dEi7KC0WrERqdMJ0sncbDRxMghzUqNQAxcEblIZMSQZDtIJIIRkbquiKR4S/oeztnaaHf/t+/2fuf5zTD7/46MMzoPH+d/znve02k3bt0NEcP28T9FzFKIxTyFWMxTiMU8hVjMU4jFPIVYzFOIxTyFWMxTiMU8hVjMU4jFPIVYzFOIxTyFWMxTiMU8hVjMU4jFPIVYzFOIxTyFWMxTiMU8hVjMU4jFPIVYzFOIxTyFWMxTiMU8hVjMU4jFPLV2zbPDuwJ9ewBHHgS89z6wdSewaQew423/G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rdc7AXBOmBe7iK5oBBzOsEgc223o07rbObHFQj2guBymuSGrsXdG+/fGN/XXVDOteQN290XNxXw5JZCLOZpOiHmKcRinkIs5inEYp5CLOYpxGKeQizmKcRinkIs5inEYp5CLOYpxGKeQizmKcRinkIs5inEYp5CLOYpxGKeQizmKcRinkIs5inEYp5CLOYpxGKeQizmKcRinkIs5inEYp5CLMYB/wbsYNQ1+l5RiAAAAABJRU5ErkJggg==";function ii({apiKey:e}){return function(t){var a,u,d;const r=(a=t.rpcUrls.alchemy)==null?void 0:a.http[0],i=(d=(u=t.rpcUrls.alchemy)==null?void 0:u.webSocket)==null?void 0:d[0];return r?{chain:{...t,rpcUrls:{...t.rpcUrls,default:{http:[`${r}/${e}`]}}},rpcUrls:{http:[`${r}/${e}`],webSocket:[`${i}/${e}`]}}:null}}var kt={},ht={},F={},qr={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(o,l){var _=o>>>16&65535,b=o&65535,E=l>>>16&65535,p=l&65535;return b*p+(_*p+b*E<<16>>>0)|0}e.mul=Math.imul||t;function r(o,l){return o+l|0}e.add=r;function i(o,l){return o-l|0}e.sub=i;function a(o,l){return o<>>32-l}e.rotl=a;function u(o,l){return o<<32-l|o>>>l}e.rotr=u;function d(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o}e.isInteger=Number.isInteger||d,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(o){return e.isInteger(o)&&o>=-e.MAX_SAFE_INTEGER&&o<=e.MAX_SAFE_INTEGER}})(qr);Object.defineProperty(F,"__esModule",{value:!0});var Gr=qr;function ai(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16}F.readInt16BE=ai;function si(e,t){return t===void 0&&(t=0),(e[t+0]<<8|e[t+1])>>>0}F.readUint16BE=si;function oi(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])<<16>>16}F.readInt16LE=oi;function ui(e,t){return t===void 0&&(t=0),(e[t+1]<<8|e[t])>>>0}F.readUint16LE=ui;function Vr(e,t,r){return t===void 0&&(t=new Uint8Array(2)),r===void 0&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}F.writeUint16BE=Vr;F.writeInt16BE=Vr;function Xr(e,t,r){return t===void 0&&(t=new Uint8Array(2)),r===void 0&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}F.writeUint16LE=Xr;F.writeInt16LE=Xr;function Tt(e,t){return t===void 0&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}F.readInt32BE=Tt;function Pt(e,t){return t===void 0&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}F.readUint32BE=Pt;function Mt(e,t){return t===void 0&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}F.readInt32LE=Mt;function jt(e,t){return t===void 0&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}F.readUint32LE=jt;function it(e,t,r){return t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}F.writeUint32BE=it;F.writeInt32BE=it;function at(e,t,r){return t===void 0&&(t=new Uint8Array(4)),r===void 0&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}F.writeUint32LE=at;F.writeInt32LE=at;function ci(e,t){t===void 0&&(t=0);var r=Tt(e,t),i=Tt(e,t+4);return r*4294967296+i-(i>>31)*4294967296}F.readInt64BE=ci;function fi(e,t){t===void 0&&(t=0);var r=Pt(e,t),i=Pt(e,t+4);return r*4294967296+i}F.readUint64BE=fi;function hi(e,t){t===void 0&&(t=0);var r=Mt(e,t),i=Mt(e,t+4);return i*4294967296+r-(r>>31)*4294967296}F.readInt64LE=hi;function li(e,t){t===void 0&&(t=0);var r=jt(e,t),i=jt(e,t+4);return i*4294967296+r}F.readUint64LE=li;function Qr(e,t,r){return t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0),it(e/4294967296>>>0,t,r),it(e>>>0,t,r+4),t}F.writeUint64BE=Qr;F.writeInt64BE=Qr;function Jr(e,t,r){return t===void 0&&(t=new Uint8Array(8)),r===void 0&&(r=0),at(e>>>0,t,r),at(e/4294967296>>>0,t,r+4),t}F.writeUint64LE=Jr;F.writeInt64LE=Jr;function di(e,t,r){if(r===void 0&&(r=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,a=1,u=e/8+r-1;u>=r;u--)i+=t[u]*a,a*=256;return i}F.readUintBE=di;function Di(e,t,r){if(r===void 0&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,a=1,u=r;u=i;u--)r[u]=t/a&255,a*=256;return r}F.writeUintBE=bi;function _i(e,t,r,i){if(r===void 0&&(r=new Uint8Array(e/8)),i===void 0&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Gr.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var a=1,u=i;u>>16|T<<16,N=N+T|0,n^=N,n=n>>>20|n<<12,c=c+s|0,P^=c,P=P>>>16|P<<16,M=M+P|0,s^=M,s=s>>>20|s<<12,h=h+m|0,C^=h,C=C>>>16|C<<16,x=x+C|0,m^=x,m=m>>>20|m<<12,f=f+O|0,I^=f,I=I>>>16|I<<16,j=j+I|0,O^=j,O=O>>>20|O<<12,h=h+m|0,C^=h,C=C>>>24|C<<8,x=x+C|0,m^=x,m=m>>>25|m<<7,f=f+O|0,I^=f,I=I>>>24|I<<8,j=j+I|0,O^=j,O=O>>>25|O<<7,c=c+s|0,P^=c,P=P>>>24|P<<8,M=M+P|0,s^=M,s=s>>>25|s<<7,w=w+n|0,T^=w,T=T>>>24|T<<8,N=N+T|0,n^=N,n=n>>>25|n<<7,w=w+s|0,I^=w,I=I>>>16|I<<16,x=x+I|0,s^=x,s=s>>>20|s<<12,c=c+m|0,T^=c,T=T>>>16|T<<16,j=j+T|0,m^=j,m=m>>>20|m<<12,h=h+O|0,P^=h,P=P>>>16|P<<16,N=N+P|0,O^=N,O=O>>>20|O<<12,f=f+n|0,C^=f,C=C>>>16|C<<16,M=M+C|0,n^=M,n=n>>>20|n<<12,h=h+O|0,P^=h,P=P>>>24|P<<8,N=N+P|0,O^=N,O=O>>>25|O<<7,f=f+n|0,C^=f,C=C>>>24|C<<8,M=M+C|0,n^=M,n=n>>>25|n<<7,c=c+m|0,T^=c,T=T>>>24|T<<8,j=j+T|0,m^=j,m=m>>>25|m<<7,w=w+s|0,I^=w,I=I>>>24|I<<8,x=x+I|0,s^=x,s=s>>>25|s<<7;Ee.writeUint32LE(w+i|0,e,0),Ee.writeUint32LE(c+a|0,e,4),Ee.writeUint32LE(h+u|0,e,8),Ee.writeUint32LE(f+d|0,e,12),Ee.writeUint32LE(n+o|0,e,16),Ee.writeUint32LE(s+l|0,e,20),Ee.writeUint32LE(m+_|0,e,24),Ee.writeUint32LE(O+b|0,e,28),Ee.writeUint32LE(N+E|0,e,32),Ee.writeUint32LE(M+p|0,e,36),Ee.writeUint32LE(x+g|0,e,40),Ee.writeUint32LE(j+v|0,e,44),Ee.writeUint32LE(T+S|0,e,48),Ee.writeUint32LE(P+y|0,e,52),Ee.writeUint32LE(C+U|0,e,56),Ee.writeUint32LE(I+D|0,e,60)}function Zr(e,t,r,i,a){if(a===void 0&&(a=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}var en={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});function Ii(e,t,r){return~(e-1)&t|e-1&r}Ue.select=Ii;function Ti(e,t){return(e|0)-(t|0)-1>>>31&1}Ue.lessOrEqual=Ti;function tn(e,t){if(e.length!==t.length)return 0;for(var r=0,i=0;i>>8}Ue.compare=tn;function Pi(e,t){return e.length===0||t.length===0?!1:tn(e,t)!==0}Ue.equal=Pi;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Ue,r=Ce;e.DIGEST_LENGTH=16;var i=function(){function d(o){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var l=o[0]|o[1]<<8;this._r[0]=l&8191;var _=o[2]|o[3]<<8;this._r[1]=(l>>>13|_<<3)&8191;var b=o[4]|o[5]<<8;this._r[2]=(_>>>10|b<<6)&7939;var E=o[6]|o[7]<<8;this._r[3]=(b>>>7|E<<9)&8191;var p=o[8]|o[9]<<8;this._r[4]=(E>>>4|p<<12)&255,this._r[5]=p>>>1&8190;var g=o[10]|o[11]<<8;this._r[6]=(p>>>14|g<<2)&8191;var v=o[12]|o[13]<<8;this._r[7]=(g>>>11|v<<5)&8065;var S=o[14]|o[15]<<8;this._r[8]=(v>>>8|S<<8)&8191,this._r[9]=S>>>5&127,this._pad[0]=o[16]|o[17]<<8,this._pad[1]=o[18]|o[19]<<8,this._pad[2]=o[20]|o[21]<<8,this._pad[3]=o[22]|o[23]<<8,this._pad[4]=o[24]|o[25]<<8,this._pad[5]=o[26]|o[27]<<8,this._pad[6]=o[28]|o[29]<<8,this._pad[7]=o[30]|o[31]<<8}return d.prototype._blocks=function(o,l,_){for(var b=this._fin?0:2048,E=this._h[0],p=this._h[1],g=this._h[2],v=this._h[3],S=this._h[4],y=this._h[5],U=this._h[6],D=this._h[7],w=this._h[8],c=this._h[9],h=this._r[0],f=this._r[1],n=this._r[2],s=this._r[3],m=this._r[4],O=this._r[5],N=this._r[6],M=this._r[7],x=this._r[8],j=this._r[9];_>=16;){var T=o[l+0]|o[l+1]<<8;E+=T&8191;var P=o[l+2]|o[l+3]<<8;p+=(T>>>13|P<<3)&8191;var C=o[l+4]|o[l+5]<<8;g+=(P>>>10|C<<6)&8191;var I=o[l+6]|o[l+7]<<8;v+=(C>>>7|I<<9)&8191;var q=o[l+8]|o[l+9]<<8;S+=(I>>>4|q<<12)&8191,y+=q>>>1&8191;var Z=o[l+10]|o[l+11]<<8;U+=(q>>>14|Z<<2)&8191;var Q=o[l+12]|o[l+13]<<8;D+=(Z>>>11|Q<<5)&8191;var V=o[l+14]|o[l+15]<<8;w+=(Q>>>8|V<<8)&8191,c+=V>>>5|b;var A=0,R=A;R+=E*h,R+=p*(5*j),R+=g*(5*x),R+=v*(5*M),R+=S*(5*N),A=R>>>13,R&=8191,R+=y*(5*O),R+=U*(5*m),R+=D*(5*s),R+=w*(5*n),R+=c*(5*f),A+=R>>>13,R&=8191;var L=A;L+=E*f,L+=p*h,L+=g*(5*j),L+=v*(5*x),L+=S*(5*M),A=L>>>13,L&=8191,L+=y*(5*N),L+=U*(5*O),L+=D*(5*m),L+=w*(5*s),L+=c*(5*n),A+=L>>>13,L&=8191;var B=A;B+=E*n,B+=p*f,B+=g*h,B+=v*(5*j),B+=S*(5*x),A=B>>>13,B&=8191,B+=y*(5*M),B+=U*(5*N),B+=D*(5*O),B+=w*(5*m),B+=c*(5*s),A+=B>>>13,B&=8191;var W=A;W+=E*s,W+=p*n,W+=g*f,W+=v*h,W+=S*(5*j),A=W>>>13,W&=8191,W+=y*(5*x),W+=U*(5*M),W+=D*(5*N),W+=w*(5*O),W+=c*(5*m),A+=W>>>13,W&=8191;var H=A;H+=E*m,H+=p*s,H+=g*n,H+=v*f,H+=S*h,A=H>>>13,H&=8191,H+=y*(5*j),H+=U*(5*x),H+=D*(5*M),H+=w*(5*N),H+=c*(5*O),A+=H>>>13,H&=8191;var K=A;K+=E*O,K+=p*m,K+=g*s,K+=v*n,K+=S*f,A=K>>>13,K&=8191,K+=y*h,K+=U*(5*j),K+=D*(5*x),K+=w*(5*M),K+=c*(5*N),A+=K>>>13,K&=8191;var $=A;$+=E*N,$+=p*O,$+=g*m,$+=v*s,$+=S*n,A=$>>>13,$&=8191,$+=y*f,$+=U*h,$+=D*(5*j),$+=w*(5*x),$+=c*(5*M),A+=$>>>13,$&=8191;var z=A;z+=E*M,z+=p*N,z+=g*O,z+=v*m,z+=S*s,A=z>>>13,z&=8191,z+=y*n,z+=U*f,z+=D*h,z+=w*(5*j),z+=c*(5*x),A+=z>>>13,z&=8191;var k=A;k+=E*x,k+=p*M,k+=g*N,k+=v*O,k+=S*m,A=k>>>13,k&=8191,k+=y*s,k+=U*n,k+=D*f,k+=w*h,k+=c*(5*j),A+=k>>>13,k&=8191;var G=A;G+=E*j,G+=p*x,G+=g*M,G+=v*N,G+=S*O,A=G>>>13,G&=8191,G+=y*m,G+=U*s,G+=D*n,G+=w*f,G+=c*h,A+=G>>>13,G&=8191,A=(A<<2)+A|0,A=A+R|0,R=A&8191,A=A>>>13,L+=A,E=R,p=L,g=B,v=W,S=H,y=K,U=$,D=z,w=k,c=G,l+=16,_-=16}this._h[0]=E,this._h[1]=p,this._h[2]=g,this._h[3]=v,this._h[4]=S,this._h[5]=y,this._h[6]=U,this._h[7]=D,this._h[8]=w,this._h[9]=c},d.prototype.finish=function(o,l){l===void 0&&(l=0);var _=new Uint16Array(10),b,E,p,g;if(this._leftover){for(g=this._leftover,this._buffer[g++]=1;g<16;g++)this._buffer[g]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(b=this._h[1]>>>13,this._h[1]&=8191,g=2;g<10;g++)this._h[g]+=b,b=this._h[g]>>>13,this._h[g]&=8191;for(this._h[0]+=b*5,b=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=b,b=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=b,_[0]=this._h[0]+5,b=_[0]>>>13,_[0]&=8191,g=1;g<10;g++)_[g]=this._h[g]+b,b=_[g]>>>13,_[g]&=8191;for(_[9]-=8192,E=(b^1)-1,g=0;g<10;g++)_[g]&=E;for(E=~E,g=0;g<10;g++)this._h[g]=this._h[g]&E|_[g];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,p=this._h[0]+this._pad[0],this._h[0]=p&65535,g=1;g<8;g++)p=(this._h[g]+this._pad[g]|0)+(p>>>16)|0,this._h[g]=p&65535;return o[l+0]=this._h[0]>>>0,o[l+1]=this._h[0]>>>8,o[l+2]=this._h[1]>>>0,o[l+3]=this._h[1]>>>8,o[l+4]=this._h[2]>>>0,o[l+5]=this._h[2]>>>8,o[l+6]=this._h[3]>>>0,o[l+7]=this._h[3]>>>8,o[l+8]=this._h[4]>>>0,o[l+9]=this._h[4]>>>8,o[l+10]=this._h[5]>>>0,o[l+11]=this._h[5]>>>8,o[l+12]=this._h[6]>>>0,o[l+13]=this._h[6]>>>8,o[l+14]=this._h[7]>>>0,o[l+15]=this._h[7]>>>8,this._finished=!0,this},d.prototype.update=function(o){var l=0,_=o.length,b;if(this._leftover){b=16-this._leftover,b>_&&(b=_);for(var E=0;E=16&&(b=_-_%16,this._blocks(o,l,b),l+=b,_-=b),_){for(var E=0;E<_;E++)this._buffer[this._leftover+E]=o[l+E];this._leftover+=_}return this},d.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var o=new Uint8Array(16);return this.finish(o),o},d.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},d}();e.Poly1305=i;function a(d,o){var l=new i(d);l.update(o);var _=l.digest();return l.clean(),_}e.oneTimeAuth=a;function u(d,o){return d.length!==e.DIGEST_LENGTH||o.length!==e.DIGEST_LENGTH?!1:t.equal(d,o)}e.equal=u})(en);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ht,r=en,i=Ce,a=F,u=Ue;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var d=new Uint8Array(16),o=function(){function l(_){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,_.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(_)}return l.prototype.seal=function(_,b,E,p){if(_.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var g=new Uint8Array(16);g.set(_,g.length-_.length);var v=new Uint8Array(32);t.stream(this._key,g,v,4);var S=b.length+this.tagLength,y;if(p){if(p.length!==S)throw new Error("ChaCha20Poly1305: incorrect destination length");y=p}else y=new Uint8Array(S);return t.streamXOR(this._key,g,b,y,4),this._authenticate(y.subarray(y.length-this.tagLength,y.length),v,y.subarray(0,y.length-this.tagLength),E),i.wipe(g),y},l.prototype.open=function(_,b,E,p){if(_.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(b.length0&&g.update(d.subarray(p.length%16))),g.update(E),E.length%16>0&&g.update(d.subarray(E.length%16));var v=new Uint8Array(8);p&&a.writeUint64LE(p.length,v),g.update(v),a.writeUint64LE(E.length,v),g.update(v);for(var S=g.digest(),y=0;ythis.blockSize?this._inner.update(r).finish(i).clean():i.set(r);for(var a=0;a1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(t){for(var r=new Uint8Array(t),i=0;i256)throw new Error("randomString charset is too long");let p="";const g=b.length,v=256-256%g;for(;_>0;){const S=a(Math.ceil(_*256/v),E);for(let y=0;y0;y++){const U=S[y];U0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=l[b++],_--;this._bufferLength===this.blockSize&&(u(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(_>=this.blockSize&&(b=u(this._temp,this._state,l,b,_),_%=this.blockSize);_>0;)this._buffer[this._bufferLength++]=l[b++],_--;return this},o.prototype.finish=function(l){if(!this._finished){var _=this._bytesHashed,b=this._bufferLength,E=_/536870912|0,p=_<<3,g=_%64<56?64:128;this._buffer[b]=128;for(var v=b+1;v0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},o.prototype.restoreState=function(l){return this._state.set(l.state),this._bufferLength=l.bufferLength,l.buffer&&this._buffer.set(l.buffer),this._bytesHashed=l.bytesHashed,this._finished=!1,this},o.prototype.cleanSavedState=function(l){r.wipe(l.state),l.buffer&&r.wipe(l.buffer),l.bufferLength=0,l.bytesHashed=0},o}();e.SHA256=i;var a=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function u(o,l,_,b,E){for(;E>=64;){for(var p=l[0],g=l[1],v=l[2],S=l[3],y=l[4],U=l[5],D=l[6],w=l[7],c=0;c<16;c++){var h=b+c*4;o[c]=t.readUint32BE(_,h)}for(var c=16;c<64;c++){var f=o[c-2],n=(f>>>17|f<<15)^(f>>>19|f<<13)^f>>>10;f=o[c-15];var s=(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;o[c]=(n+o[c-7]|0)+(s+o[c-16]|0)}for(var c=0;c<64;c++){var n=(((y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7))+(y&U^~y&D)|0)+(w+(a[c]+o[c]|0)|0)|0,s=((p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10))+(p&g^p&v^g&v)|0;w=D,D=U,U=y,y=S+n|0,S=v,v=g,g=p,p=n+s|0}l[0]+=p,l[1]+=g,l[2]+=v,l[3]+=S,l[4]+=y,l[5]+=U,l[6]+=D,l[7]+=w,b+=64,E-=64}return b}function d(o){var l=new i;l.update(o);var _=l.digest();return l.clean(),_}e.hash=d})(_t);var Gt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=lt,r=Ce;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function i(c){const h=new Float64Array(16);if(c)for(let f=0;f>16&1),f[O-1]&=65535;f[15]=n[15]-32767-(f[14]>>16&1);const m=f[15]>>16&1;f[14]&=65535,o(n,f,1-m)}for(let s=0;s<16;s++)c[2*s]=n[s]&255,c[2*s+1]=n[s]>>8}function _(c,h){for(let f=0;f<16;f++)c[f]=h[2*f]+(h[2*f+1]<<8);c[15]&=32767}function b(c,h,f){for(let n=0;n<16;n++)c[n]=h[n]+f[n]}function E(c,h,f){for(let n=0;n<16;n++)c[n]=h[n]-f[n]}function p(c,h,f){let n,s,m=0,O=0,N=0,M=0,x=0,j=0,T=0,P=0,C=0,I=0,q=0,Z=0,Q=0,V=0,A=0,R=0,L=0,B=0,W=0,H=0,K=0,$=0,z=0,k=0,G=0,Ne=0,Fe=0,Ke=0,et=0,yt=0,ur=0,re=f[0],ne=f[1],ie=f[2],ae=f[3],se=f[4],oe=f[5],ue=f[6],ce=f[7],fe=f[8],he=f[9],le=f[10],de=f[11],De=f[12],be=f[13],_e=f[14],we=f[15];n=h[0],m+=n*re,O+=n*ne,N+=n*ie,M+=n*ae,x+=n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+=38*W,M+=38*H,x+=38*K,j+=38*$,T+=38*z,P+=38*k,C+=38*G,I+=38*Ne,q+=38*Fe,Z+=38*Ke,Q+=38*et,V+=38*yt,A+=38*ur,s=1,n=m+s+65535,s=Math.floor(n/65536),m=n-s*65536,n=O+s+65535,s=Math.floor(n/65536),O=n-s*65536,n=N+s+65535,s=Math.floor(n/65536),N=n-s*65536,n=M+s+65535,s=Math.floor(n/65536),M=n-s*65536,n=x+s+65535,s=Math.floor(n/65536),x=n-s*65536,n=j+s+65535,s=Math.floor(n/65536),j=n-s*65536,n=T+s+65535,s=Math.floor(n/65536),T=n-s*65536,n=P+s+65535,s=Math.floor(n/65536),P=n-s*65536,n=C+s+65535,s=Math.floor(n/65536),C=n-s*65536,n=I+s+65535,s=Math.floor(n/65536),I=n-s*65536,n=q+s+65535,s=Math.floor(n/65536),q=n-s*65536,n=Z+s+65535,s=Math.floor(n/65536),Z=n-s*65536,n=Q+s+65535,s=Math.floor(n/65536),Q=n-s*65536,n=V+s+65535,s=Math.floor(n/65536),V=n-s*65536,n=A+s+65535,s=Math.floor(n/65536),A=n-s*65536,n=R+s+65535,s=Math.floor(n/65536),R=n-s*65536,m+=s-1+37*(s-1),s=1,n=m+s+65535,s=Math.floor(n/65536),m=n-s*65536,n=O+s+65535,s=Math.floor(n/65536),O=n-s*65536,n=N+s+65535,s=Math.floor(n/65536),N=n-s*65536,n=M+s+65535,s=Math.floor(n/65536),M=n-s*65536,n=x+s+65535,s=Math.floor(n/65536),x=n-s*65536,n=j+s+65535,s=Math.floor(n/65536),j=n-s*65536,n=T+s+65535,s=Math.floor(n/65536),T=n-s*65536,n=P+s+65535,s=Math.floor(n/65536),P=n-s*65536,n=C+s+65535,s=Math.floor(n/65536),C=n-s*65536,n=I+s+65535,s=Math.floor(n/65536),I=n-s*65536,n=q+s+65535,s=Math.floor(n/65536),q=n-s*65536,n=Z+s+65535,s=Math.floor(n/65536),Z=n-s*65536,n=Q+s+65535,s=Math.floor(n/65536),Q=n-s*65536,n=V+s+65535,s=Math.floor(n/65536),V=n-s*65536,n=A+s+65535,s=Math.floor(n/65536),A=n-s*65536,n=R+s+65535,s=Math.floor(n/65536),R=n-s*65536,m+=s-1+37*(s-1),c[0]=m,c[1]=O,c[2]=N,c[3]=M,c[4]=x,c[5]=j,c[6]=T,c[7]=P,c[8]=C,c[9]=I,c[10]=q,c[11]=Z,c[12]=Q,c[13]=V,c[14]=A,c[15]=R}function g(c,h){p(c,h,h)}function v(c,h){const f=i();for(let n=0;n<16;n++)f[n]=h[n];for(let n=253;n>=0;n--)g(f,f),n!==2&&n!==4&&p(f,f,h);for(let n=0;n<16;n++)c[n]=f[n]}function S(c,h){const f=new Uint8Array(32),n=new Float64Array(80),s=i(),m=i(),O=i(),N=i(),M=i(),x=i();for(let C=0;C<31;C++)f[C]=c[C];f[31]=c[31]&127|64,f[0]&=248,_(n,h);for(let C=0;C<16;C++)m[C]=n[C];s[0]=N[0]=1;for(let C=254;C>=0;--C){const I=f[C>>>3]>>>(C&7)&1;o(s,m,I),o(O,N,I),b(M,s,O),E(s,s,O),b(O,m,N),E(m,m,N),g(N,M),g(x,s),p(s,O,s),p(O,m,M),b(M,s,O),E(s,s,O),g(m,s),E(O,N,x),p(s,O,u),b(s,s,N),p(O,O,s),p(s,N,x),p(N,m,n),g(m,M),o(s,m,I),o(O,N,I)}for(let C=0;C<16;C++)n[C+16]=s[C],n[C+32]=O[C],n[C+48]=m[C],n[C+64]=N[C];const j=n.subarray(32),T=n.subarray(16);v(j,j),p(T,T,j);const P=new Uint8Array(32);return l(P,T),P}e.scalarMult=S;function y(c){return S(c,a)}e.scalarMultBase=y;function U(c){if(c.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const h=new Uint8Array(c);return{publicKey:y(h),secretKey:h}}e.generateKeyPairFromSeed=U;function D(c){const h=(0,t.randomBytes)(32,c),f=U(h);return(0,r.wipe)(h),f}e.generateKeyPair=D;function w(c,h,f=!1){if(c.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(h.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const n=S(c,h);if(f){let s=0;for(let m=0;ma+u.length,0));const r=an(t);let i=0;for(const a of e)r.set(a,i),i+=a.length;return Vt(r)}function Yi(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i>>0,c=new Uint8Array(w);U!==D;){for(var h=v[U],f=0,n=w-1;(h!==0||f>>0,c[n]=h%o>>>0,h=h/o>>>0;if(h!==0)throw new Error("Non-zero carry");y=f,U++}for(var s=w-y;s!==w&&c[s]===0;)s++;for(var m=l.repeat(S);s>>0,w=new Uint8Array(D);v[S];){var c=r[v.charCodeAt(S)];if(c===255)return;for(var h=0,f=D-1;(c!==0||h>>0,w[f]=c%256>>>0,c=c/256>>>0;if(c!==0)throw new Error("Non-zero carry");U=h,S++}if(v[S]!==" "){for(var n=D-U;n!==D&&w[n]===0;)n++;for(var s=new Uint8Array(y+(D-n)),m=y;n!==D;)s[m++]=w[n++];return s}}}function g(v){var S=p(v);if(S)return S;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:p,decode:g}}var ki=Yi,qi=ki;const Gi=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")},Vi=e=>new TextEncoder().encode(e),Xi=e=>new TextDecoder().decode(e);class Qi{constructor(t,r,i){this.name=t,this.prefix=r,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Ji{constructor(t,r,i){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=i}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 sn(this,t)}}class Zi{constructor(t){this.decoders=t}or(t){return sn(this,t)}decode(t){const r=t[0],i=this.decoders[r];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const sn=(e,t)=>new Zi({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class ea{constructor(t,r,i,a){this.name=t,this.prefix=r,this.baseEncode=i,this.baseDecode=a,this.encoder=new Qi(t,r,i),this.decoder=new Ji(t,r,a)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const wt=({name:e,prefix:t,encode:r,decode:i})=>new ea(e,t,r,i),Xe=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:a}=qi(r,t);return wt({prefix:e,name:t,encode:i,decode:u=>Gi(a(u))})},ta=(e,t,r,i)=>{const a={};for(let b=0;b=8&&(o-=8,d[_++]=255&l>>o)}if(o>=r||255&l<<8-o)throw new SyntaxError("Unexpected end of data");return d},ra=(e,t,r)=>{const i=t[t.length-1]==="=",a=(1<r;)d-=r,u+=t[a&o>>d];if(d&&(u+=t[a&o<wt({prefix:t,name:e,encode(a){return ra(a,i,r)},decode(a){return ta(a,i,r,e)}}),na=wt({prefix:"\0",name:"identity",encode:e=>Xi(e),decode:e=>Vi(e)}),ia=Object.freeze(Object.defineProperty({__proto__:null,identity:na},Symbol.toStringTag,{value:"Module"})),aa=te({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),sa=Object.freeze(Object.defineProperty({__proto__:null,base2:aa},Symbol.toStringTag,{value:"Module"})),oa=te({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ua=Object.freeze(Object.defineProperty({__proto__:null,base8:oa},Symbol.toStringTag,{value:"Module"})),ca=Xe({prefix:"9",name:"base10",alphabet:"0123456789"}),fa=Object.freeze(Object.defineProperty({__proto__:null,base10:ca},Symbol.toStringTag,{value:"Module"})),ha=te({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),la=te({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),da=Object.freeze(Object.defineProperty({__proto__:null,base16:ha,base16upper:la},Symbol.toStringTag,{value:"Module"})),Da=te({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ba=te({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_a=te({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),wa=te({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ea=te({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ga=te({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),pa=te({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),va=te({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ya=te({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ma=Object.freeze(Object.defineProperty({__proto__:null,base32:Da,base32hex:Ea,base32hexpad:pa,base32hexpadupper:va,base32hexupper:ga,base32pad:_a,base32padupper:wa,base32upper:ba,base32z:ya},Symbol.toStringTag,{value:"Module"})),Sa=Xe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ca=Xe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Oa=Object.freeze(Object.defineProperty({__proto__:null,base36:Sa,base36upper:Ca},Symbol.toStringTag,{value:"Module"})),Aa=Xe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ua=Xe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Na=Object.freeze(Object.defineProperty({__proto__:null,base58btc:Aa,base58flickr:Ua},Symbol.toStringTag,{value:"Module"})),Ia=te({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ta=te({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Pa=te({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ma=te({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),ja=Object.freeze(Object.defineProperty({__proto__:null,base64:Ia,base64pad:Ta,base64url:Pa,base64urlpad:Ma},Symbol.toStringTag,{value:"Module"})),on=Array.from("๐Ÿš€๐Ÿชโ˜„๐Ÿ›ฐ๐ŸŒŒ๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”๐ŸŒ•๐ŸŒ–๐ŸŒ—๐ŸŒ˜๐ŸŒ๐ŸŒ๐ŸŒŽ๐Ÿ‰โ˜€๐Ÿ’ป๐Ÿ–ฅ๐Ÿ’พ๐Ÿ’ฟ๐Ÿ˜‚โค๐Ÿ˜๐Ÿคฃ๐Ÿ˜Š๐Ÿ™๐Ÿ’•๐Ÿ˜ญ๐Ÿ˜˜๐Ÿ‘๐Ÿ˜…๐Ÿ‘๐Ÿ˜๐Ÿ”ฅ๐Ÿฅฐ๐Ÿ’”๐Ÿ’–๐Ÿ’™๐Ÿ˜ข๐Ÿค”๐Ÿ˜†๐Ÿ™„๐Ÿ’ช๐Ÿ˜‰โ˜บ๐Ÿ‘Œ๐Ÿค—๐Ÿ’œ๐Ÿ˜”๐Ÿ˜Ž๐Ÿ˜‡๐ŸŒน๐Ÿคฆ๐ŸŽ‰๐Ÿ’žโœŒโœจ๐Ÿคท๐Ÿ˜ฑ๐Ÿ˜Œ๐ŸŒธ๐Ÿ™Œ๐Ÿ˜‹๐Ÿ’—๐Ÿ’š๐Ÿ˜๐Ÿ’›๐Ÿ™‚๐Ÿ’“๐Ÿคฉ๐Ÿ˜„๐Ÿ˜€๐Ÿ–ค๐Ÿ˜ƒ๐Ÿ’ฏ๐Ÿ™ˆ๐Ÿ‘‡๐ŸŽถ๐Ÿ˜’๐Ÿคญโฃ๐Ÿ˜œ๐Ÿ’‹๐Ÿ‘€๐Ÿ˜ช๐Ÿ˜‘๐Ÿ’ฅ๐Ÿ™‹๐Ÿ˜ž๐Ÿ˜ฉ๐Ÿ˜ก๐Ÿคช๐Ÿ‘Š๐Ÿฅณ๐Ÿ˜ฅ๐Ÿคค๐Ÿ‘‰๐Ÿ’ƒ๐Ÿ˜ณโœ‹๐Ÿ˜š๐Ÿ˜๐Ÿ˜ด๐ŸŒŸ๐Ÿ˜ฌ๐Ÿ™ƒ๐Ÿ€๐ŸŒท๐Ÿ˜ป๐Ÿ˜“โญโœ…๐Ÿฅบ๐ŸŒˆ๐Ÿ˜ˆ๐Ÿค˜๐Ÿ’ฆโœ”๐Ÿ˜ฃ๐Ÿƒ๐Ÿ’โ˜น๐ŸŽŠ๐Ÿ’˜๐Ÿ˜ โ˜๐Ÿ˜•๐ŸŒบ๐ŸŽ‚๐ŸŒป๐Ÿ˜๐Ÿ–•๐Ÿ’๐Ÿ™Š๐Ÿ˜น๐Ÿ—ฃ๐Ÿ’ซ๐Ÿ’€๐Ÿ‘‘๐ŸŽต๐Ÿคž๐Ÿ˜›๐Ÿ”ด๐Ÿ˜ค๐ŸŒผ๐Ÿ˜ซโšฝ๐Ÿค™โ˜•๐Ÿ†๐Ÿคซ๐Ÿ‘ˆ๐Ÿ˜ฎ๐Ÿ™†๐Ÿป๐Ÿƒ๐Ÿถ๐Ÿ’๐Ÿ˜ฒ๐ŸŒฟ๐Ÿงก๐ŸŽโšก๐ŸŒž๐ŸŽˆโŒโœŠ๐Ÿ‘‹๐Ÿ˜ฐ๐Ÿคจ๐Ÿ˜ถ๐Ÿค๐Ÿšถ๐Ÿ’ฐ๐Ÿ“๐Ÿ’ข๐ŸคŸ๐Ÿ™๐Ÿšจ๐Ÿ’จ๐Ÿคฌโœˆ๐ŸŽ€๐Ÿบ๐Ÿค“๐Ÿ˜™๐Ÿ’Ÿ๐ŸŒฑ๐Ÿ˜–๐Ÿ‘ถ๐Ÿฅดโ–ถโžกโ“๐Ÿ’Ž๐Ÿ’ธโฌ‡๐Ÿ˜จ๐ŸŒš๐Ÿฆ‹๐Ÿ˜ท๐Ÿ•บโš ๐Ÿ™…๐Ÿ˜Ÿ๐Ÿ˜ต๐Ÿ‘Ž๐Ÿคฒ๐Ÿค ๐Ÿคง๐Ÿ“Œ๐Ÿ”ต๐Ÿ’…๐Ÿง๐Ÿพ๐Ÿ’๐Ÿ˜—๐Ÿค‘๐ŸŒŠ๐Ÿคฏ๐Ÿทโ˜Ž๐Ÿ’ง๐Ÿ˜ฏ๐Ÿ’†๐Ÿ‘†๐ŸŽค๐Ÿ™‡๐Ÿ‘โ„๐ŸŒด๐Ÿ’ฃ๐Ÿธ๐Ÿ’Œ๐Ÿ“๐Ÿฅ€๐Ÿคข๐Ÿ‘…๐Ÿ’ก๐Ÿ’ฉ๐Ÿ‘๐Ÿ“ธ๐Ÿ‘ป๐Ÿค๐Ÿคฎ๐ŸŽผ๐Ÿฅต๐Ÿšฉ๐ŸŽ๐ŸŠ๐Ÿ‘ผ๐Ÿ’๐Ÿ“ฃ๐Ÿฅ‚"),Fa=on.reduce((e,t,r)=>(e[r]=t,e),[]),xa=on.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function Ra(e){return e.reduce((t,r)=>(t+=Fa[r],t),"")}function La(e){const t=[];for(const r of e){const i=xa[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(i)}return new Uint8Array(t)}const Ba=wt({prefix:"๐Ÿš€",name:"base256emoji",encode:Ra,decode:La}),Wa=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Ba},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const gr={...ia,...sa,...ua,...fa,...da,...ma,...Oa,...Na,...ja,...Wa};function un(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}const pr=un("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),St=un("ascii","a",e=>{let t="a";for(let r=0;r{e=e.substring(1);const t=an(e.length);for(let r=0;r"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ya:typeof navigator<"u"?Qa(navigator.userAgent):Za()}function Xa(e){return e!==""&&Ga.reduce(function(t,r){var i=r[0],a=r[1];if(t)return t;var u=a.exec(e);return!!u&&[i,u]},!1)}function Qa(e){var t=Xa(e);if(!t)return null;var r=t[0],i=t[1];if(r==="searchbot")return new za;var a=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);a?a.length=0;o--)(d=e[o])&&(u=(a<3?d(u):a>3?d(t,r,u):d(t,r))||u);return a>3&&u&&Object.defineProperty(t,r,u),u}function is(e,t){return function(r,i){t(r,i,e)}}function as(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function ss(e,t,r,i){function a(u){return u instanceof r?u:new r(function(d){d(u)})}return new(r||(r=Promise))(function(u,d){function o(b){try{_(i.next(b))}catch(E){d(E)}}function l(b){try{_(i.throw(b))}catch(E){d(E)}}function _(b){b.done?u(b.value):a(b.value).then(o,l)}_((i=i.apply(e,t||[])).next())})}function os(e,t){var r={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},i,a,u,d;return d={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function o(_){return function(b){return l([_,b])}}function l(_){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,a&&(u=_[0]&2?a.return:_[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,_[1])).done)return u;switch(a=0,u&&(_=[_[0]&2,u.value]),_[0]){case 0:case 1:u=_;break;case 4:return r.label++,{value:_[1],done:!1};case 5:r.label++,a=_[1],_=[0];continue;case 7:_=r.ops.pop(),r.trys.pop();continue;default:if(u=r.trys,!(u=u.length>0&&u[u.length-1])&&(_[0]===6||_[0]===2)){r=0;continue}if(_[0]===3&&(!u||_[1]>u[0]&&_[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function fn(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var i=r.call(e),a,u=[],d;try{for(;(t===void 0||t-- >0)&&!(a=i.next()).done;)u.push(a.value)}catch(o){d={error:o}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(d)throw d.error}}return u}function fs(){for(var e=[],t=0;t1||o(p,g)})})}function o(p,g){try{l(i[p](g))}catch(v){E(u[0][3],v)}}function l(p){p.value instanceof qe?Promise.resolve(p.value.v).then(_,b):E(u[0][2],p)}function _(p){o("next",p)}function b(p){o("throw",p)}function E(p,g){p(g),u.shift(),u.length&&o(u[0][0],u[0][1])}}function ds(e){var t,r;return t={},i("next"),i("throw",function(a){throw a}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(a,u){t[a]=e[a]?function(d){return(r=!r)?{value:qe(e[a](d)),done:a==="return"}:u?u(d):d}:u}}function Ds(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Lt=="function"?Lt(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(u){r[u]=e[u]&&function(d){return new Promise(function(o,l){d=e[u](d),a(o,l,d.done,d.value)})}}function a(u,d,o,l){Promise.resolve(l).then(function(_){u({value:_,done:o})},d)}}function bs(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _s(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function ws(e){return e&&e.__esModule?e:{default:e}}function Es(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function gs(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}const ps=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Rt},__asyncDelegator:ds,__asyncGenerator:ls,__asyncValues:Ds,__await:qe,__awaiter:ss,__classPrivateFieldGet:Es,__classPrivateFieldSet:gs,__createBinding:us,__decorate:ns,__exportStar:cs,__extends:ts,__generator:os,__importDefault:ws,__importStar:_s,__makeTemplateObject:bs,__metadata:as,__param:is,__read:fn,__rest:rs,__spread:fs,__spreadArrays:hs,__values:Lt},Symbol.toStringTag,{value:"Module"})),Et=Qn(ps);var Ct={},$e={},Sr;function vs(){if(Sr)return $e;Sr=1,Object.defineProperty($e,"__esModule",{value:!0}),$e.delay=void 0;function e(t){return new Promise(r=>{setTimeout(()=>{r(!0)},t)})}return $e.delay=e,$e}var Ie={},Ot={},Te={},Cr;function ys(){return Cr||(Cr=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.ONE_THOUSAND=Te.ONE_HUNDRED=void 0,Te.ONE_HUNDRED=100,Te.ONE_THOUSAND=1e3),Te}var At={},Or;function ms(){return Or||(Or=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}(At)),At}var Ar;function hn(){return Ar||(Ar=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(ys(),e),t.__exportStar(ms(),e)}(Ot)),Ot}var Ur;function Ss(){if(Ur)return Ie;Ur=1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.fromMiliseconds=Ie.toMiliseconds=void 0;const e=hn();function t(i){return i*e.ONE_THOUSAND}Ie.toMiliseconds=t;function r(i){return Math.floor(i/e.ONE_THOUSAND)}return Ie.fromMiliseconds=r,Ie}var Nr;function Cs(){return Nr||(Nr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(vs(),e),t.__exportStar(Ss(),e)}(Ct)),Ct}var xe={},Ir;function Os(){if(Ir)return xe;Ir=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const a=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:a})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return xe.Watch=e,xe.default=e,xe}var Ut={},ze={},Tr;function As(){if(Tr)return ze;Tr=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.IWatch=void 0;class e{}return ze.IWatch=e,ze}var Pr;function Us(){return Pr||(Pr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Et.__exportStar(As(),e)}(Ut)),Ut}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Et;t.__exportStar(Cs(),e),t.__exportStar(Os(),e),t.__exportStar(Us(),e),t.__exportStar(hn(),e)})(Me);var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.getLocalStorage=Y.getLocalStorageOrThrow=Y.getCrypto=Y.getCryptoOrThrow=ln=Y.getLocation=Y.getLocationOrThrow=Qt=Y.getNavigator=Y.getNavigatorOrThrow=Xt=Y.getDocument=Y.getDocumentOrThrow=Y.getFromWindowOrThrow=Y.getFromWindow=void 0;function je(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}Y.getFromWindow=je;function We(e){const t=je(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Y.getFromWindowOrThrow=We;function Ns(){return We("document")}Y.getDocumentOrThrow=Ns;function Is(){return je("document")}var Xt=Y.getDocument=Is;function Ts(){return We("navigator")}Y.getNavigatorOrThrow=Ts;function Ps(){return je("navigator")}var Qt=Y.getNavigator=Ps;function Ms(){return We("location")}Y.getLocationOrThrow=Ms;function js(){return je("location")}var ln=Y.getLocation=js;function Fs(){return We("crypto")}Y.getCryptoOrThrow=Fs;function xs(){return je("crypto")}Y.getCrypto=xs;function Rs(){return We("localStorage")}Y.getLocalStorageOrThrow=Rs;function Ls(){return je("localStorage")}Y.getLocalStorage=Ls;var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0});var dn=Jt.getWindowMetadata=void 0;const Mr=Y;function Bs(){let e,t;try{e=Mr.getDocumentOrThrow(),t=Mr.getLocationOrThrow()}catch{return null}function r(){const E=e.getElementsByTagName("link"),p=[];for(let g=0;g-1){const y=v.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let U=t.protocol+"//"+t.host;if(y.indexOf("/")===0)U+=y;else{const D=t.pathname.split("/");D.pop();const w=D.join("/");U+=w+"/"+y}p.push(U)}else if(y.indexOf("//")===0){const U=t.protocol+y;p.push(U)}else p.push(y)}}return p}function i(...E){const p=e.getElementsByTagName("meta");for(let g=0;gv.getAttribute(y)).filter(y=>y?E.includes(y):!1);if(S.length&&S){const y=v.getAttribute("content");if(y)return y}}return""}function a(){let E=i("name","og:site_name","og:title","twitter:title");return E||(E=e.title),E}function u(){return i("description","og:description","twitter:description","keywords")}const d=a(),o=u(),l=t.origin,_=r();return{description:o,url:l,icons:_,name:d}}dn=Jt.getWindowMetadata=Bs;var Ge={},Ws=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),Dn="%[a-f0-9]{2}",jr=new RegExp("("+Dn+")|([^%]+?)","gi"),Fr=new RegExp("("+Dn+")+","gi");function Bt(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],Bt(r),Bt(i))}function Hs(e){try{return decodeURIComponent(e)}catch{for(var t=e.match(jr)||[],r=1;r{if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[e];const r=e.indexOf(t);return r===-1?[e]:[e.slice(0,r),e.slice(r+t.length)]},Ys=function(e,t){for(var r={},i=Object.keys(e),a=Array.isArray(t),u=0;uD==null,d=Symbol("encodeFragmentIdentifier");function o(D){switch(D.arrayFormat){case"index":return w=>(c,h)=>{const f=c.length;return h===void 0||D.skipNull&&h===null||D.skipEmptyString&&h===""?c:h===null?[...c,[b(w,D),"[",f,"]"].join("")]:[...c,[b(w,D),"[",b(f,D),"]=",b(h,D)].join("")]};case"bracket":return w=>(c,h)=>h===void 0||D.skipNull&&h===null||D.skipEmptyString&&h===""?c:h===null?[...c,[b(w,D),"[]"].join("")]:[...c,[b(w,D),"[]=",b(h,D)].join("")];case"colon-list-separator":return w=>(c,h)=>h===void 0||D.skipNull&&h===null||D.skipEmptyString&&h===""?c:h===null?[...c,[b(w,D),":list="].join("")]:[...c,[b(w,D),":list=",b(h,D)].join("")];case"comma":case"separator":case"bracket-separator":{const w=D.arrayFormat==="bracket-separator"?"[]=":"=";return c=>(h,f)=>f===void 0||D.skipNull&&f===null||D.skipEmptyString&&f===""?h:(f=f===null?"":f,h.length===0?[[b(c,D),w,b(f,D)].join("")]:[[h,b(f,D)].join(D.arrayFormatSeparator)])}default:return w=>(c,h)=>h===void 0||D.skipNull&&h===null||D.skipEmptyString&&h===""?c:h===null?[...c,b(w,D)]:[...c,[b(w,D),"=",b(h,D)].join("")]}}function l(D){let w;switch(D.arrayFormat){case"index":return(c,h,f)=>{if(w=/\[(\d*)\]$/.exec(c),c=c.replace(/\[\d*\]$/,""),!w){f[c]=h;return}f[c]===void 0&&(f[c]={}),f[c][w[1]]=h};case"bracket":return(c,h,f)=>{if(w=/(\[\])$/.exec(c),c=c.replace(/\[\]$/,""),!w){f[c]=h;return}if(f[c]===void 0){f[c]=[h];return}f[c]=[].concat(f[c],h)};case"colon-list-separator":return(c,h,f)=>{if(w=/(:list)$/.exec(c),c=c.replace(/:list$/,""),!w){f[c]=h;return}if(f[c]===void 0){f[c]=[h];return}f[c]=[].concat(f[c],h)};case"comma":case"separator":return(c,h,f)=>{const n=typeof h=="string"&&h.includes(D.arrayFormatSeparator),s=typeof h=="string"&&!n&&E(h,D).includes(D.arrayFormatSeparator);h=s?E(h,D):h;const m=n||s?h.split(D.arrayFormatSeparator).map(O=>E(O,D)):h===null?h:E(h,D);f[c]=m};case"bracket-separator":return(c,h,f)=>{const n=/(\[\])$/.test(c);if(c=c.replace(/\[\]$/,""),!n){f[c]=h&&E(h,D);return}const s=h===null?[]:h.split(D.arrayFormatSeparator).map(m=>E(m,D));if(f[c]===void 0){f[c]=s;return}f[c]=[].concat(f[c],s)};default:return(c,h,f)=>{if(f[c]===void 0){f[c]=h;return}f[c]=[].concat(f[c],h)}}}function _(D){if(typeof D!="string"||D.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(D,w){return w.encode?w.strict?t(D):encodeURIComponent(D):D}function E(D,w){return w.decode?r(D):D}function p(D){return Array.isArray(D)?D.sort():typeof D=="object"?p(Object.keys(D)).sort((w,c)=>Number(w)-Number(c)).map(w=>D[w]):D}function g(D){const w=D.indexOf("#");return w!==-1&&(D=D.slice(0,w)),D}function v(D){let w="";const c=D.indexOf("#");return c!==-1&&(w=D.slice(c)),w}function S(D){D=g(D);const w=D.indexOf("?");return w===-1?"":D.slice(w+1)}function y(D,w){return w.parseNumbers&&!Number.isNaN(Number(D))&&typeof D=="string"&&D.trim()!==""?D=Number(D):w.parseBooleans&&D!==null&&(D.toLowerCase()==="true"||D.toLowerCase()==="false")&&(D=D.toLowerCase()==="true"),D}function U(D,w){w=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},w),_(w.arrayFormatSeparator);const c=l(w),h=Object.create(null);if(typeof D!="string"||(D=D.trim().replace(/^[?#&]/,""),!D))return h;for(const f of D.split("&")){if(f==="")continue;let[n,s]=i(w.decode?f.replace(/\+/g," "):f,"=");s=s===void 0?null:["comma","separator","bracket-separator"].includes(w.arrayFormat)?s:E(s,w),c(E(n,w),s,h)}for(const f of Object.keys(h)){const n=h[f];if(typeof n=="object"&&n!==null)for(const s of Object.keys(n))n[s]=y(n[s],w);else h[f]=y(n,w)}return w.sort===!1?h:(w.sort===!0?Object.keys(h).sort():Object.keys(h).sort(w.sort)).reduce((f,n)=>{const s=h[n];return s&&typeof s=="object"&&!Array.isArray(s)?f[n]=p(s):f[n]=s,f},Object.create(null))}e.extract=S,e.parse=U,e.stringify=(D,w)=>{if(!D)return"";w=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},w),_(w.arrayFormatSeparator);const c=s=>w.skipNull&&u(D[s])||w.skipEmptyString&&D[s]==="",h=o(w),f={};for(const s of Object.keys(D))c(s)||(f[s]=D[s]);const n=Object.keys(f);return w.sort!==!1&&n.sort(w.sort),n.map(s=>{const m=D[s];return m===void 0?"":m===null?b(s,w):Array.isArray(m)?m.length===0&&w.arrayFormat==="bracket-separator"?b(s,w)+"[]":m.reduce(h(s),[]).join("&"):b(s,w)+"="+b(m,w)}).filter(s=>s.length>0).join("&")},e.parseUrl=(D,w)=>{w=Object.assign({decode:!0},w);const[c,h]=i(D,"#");return Object.assign({url:c.split("?")[0]||"",query:U(S(D),w)},w&&w.parseFragmentIdentifier&&h?{fragmentIdentifier:E(h,w)}:{})},e.stringifyUrl=(D,w)=>{w=Object.assign({encode:!0,strict:!0,[d]:!0},w);const c=g(D.url).split("?")[0]||"",h=e.extract(D.url),f=e.parse(h,{sort:!1}),n=Object.assign(f,D.query);let s=e.stringify(n,w);s&&(s=`?${s}`);let m=v(D.url);return D.fragmentIdentifier&&(m=`#${w[d]?b(D.fragmentIdentifier,w):D.fragmentIdentifier}`),`${c}${s}${m}`},e.pick=(D,w,c)=>{c=Object.assign({parseFragmentIdentifier:!0,[d]:!1},c);const{url:h,query:f,fragmentIdentifier:n}=e.parseUrl(D,c);return e.stringifyUrl({url:h,query:a(f,w),fragmentIdentifier:n},c)},e.exclude=(D,w,c)=>{const h=Array.isArray(w)?f=>!w.includes(f):(f,n)=>!w(f,n);return e.pick(D,h,c)}})(Ge);const ks={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"}},qs=":";function su(e){const[t,r]=e.split(qs);return{namespace:t,reference:r}}function ou(e,t=[]){const r=[];return Object.keys(e).forEach(i=>{if(t.length&&!t.includes(i))return;const a=e[i];r.push(...a.accounts)}),r}function bn(e,t){return e.includes(":")?[e]:t.chains||[]}const _n="base10",ge="base16",Wt="base64pad",Zt="utf8",wn=0,Qe=1,Gs=0,xr=1,Ht=12,er=32;function uu(){const e=Gt.generateKeyPair();return{privateKey:Se(e.secretKey,ge),publicKey:Se(e.publicKey,ge)}}function cu(){const e=lt.randomBytes(er);return Se(e,ge)}function fu(e,t){const r=Gt.sharedKey(me(e,ge),me(t,ge),!0),i=new Li(_t.SHA256,r).expand(er);return Se(i,ge)}function hu(e){const t=_t.hash(me(e,ge));return Se(t,ge)}function lu(e){const t=_t.hash(me(e,Zt));return Se(t,ge)}function Vs(e){return me(`${e}`,_n)}function gt(e){return Number(Se(e,_n))}function du(e){const t=Vs(typeof e.type<"u"?e.type:wn);if(gt(t)===Qe&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof e.senderPublicKey<"u"?me(e.senderPublicKey,ge):void 0,i=typeof e.iv<"u"?me(e.iv,ge):lt.randomBytes(Ht),a=new kt.ChaCha20Poly1305(me(e.symKey,ge)).seal(i,me(e.message,Zt));return Xs({type:t,sealed:a,iv:i,senderPublicKey:r})}function Du(e){const t=new kt.ChaCha20Poly1305(me(e.symKey,ge)),{sealed:r,iv:i}=En(e.encoded),a=t.open(i,r);if(a===null)throw new Error("Failed to decrypt");return Se(a,Zt)}function Xs(e){if(gt(e.type)===Qe){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Se(Er([e.type,e.senderPublicKey,e.iv,e.sealed]),Wt)}return Se(Er([e.type,e.iv,e.sealed]),Wt)}function En(e){const t=me(e,Wt),r=t.slice(Gs,xr),i=xr;if(gt(r)===Qe){const o=i+er,l=o+Ht,_=t.slice(i,o),b=t.slice(o,l),E=t.slice(l);return{type:r,sealed:E,iv:b,senderPublicKey:_}}const a=i+Ht,u=t.slice(i,a),d=t.slice(a);return{type:r,sealed:d,iv:u}}function bu(e,t){const r=En(e);return Qs({type:gt(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Se(r.senderPublicKey,ge):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function Qs(e){const t=(e==null?void 0:e.type)||wn;if(t===Qe){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 _u(e){return e.type===Qe&&typeof e.senderPublicKey=="string"&&typeof e.receiverPublicKey=="string"}var Js=Object.defineProperty,Rr=Object.getOwnPropertySymbols,Zs=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable,Lr=(e,t,r)=>t in e?Js(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Br=(e,t)=>{for(var r in t||(t={}))Zs.call(t,r)&&Lr(e,r,t[r]);if(Rr)for(var r of Rr(t))eo.call(t,r)&&Lr(e,r,t[r]);return e};const to="ReactNative",pe={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},ro="js";function gn(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Je(){return!Xt()&&!!Qt()&&navigator.product===to}function pt(){return!gn()&&!!Qt()&&!!Xt()}function Ze(){return Je()?pe.reactNative:gn()?pe.node:pt()?pe.browser:pe.unknown}function wu(){var e;try{return Je()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function no(e,t){let r=Ge.parse(e);return r=Br(Br({},r),t),e=Ge.stringify(r),e}function Eu(){return dn()||{name:"",description:"",url:"",icons:[""]}}function io(){if(Ze()===pe.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:i}=global.Platform;return[r,i].join("-")}const e=Va();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 ao(){var e;const t=Ze();return t===pe.browser?[t,((e=ln())==null?void 0:e.host)||"unknown"].join(":"):t}function so(e,t,r){const i=io(),a=ao();return[[e,t].join("-"),[ro,r].join("-"),i,a].join("/")}function gu({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:a,projectId:u,useOnCloseEvent:d,bundleId:o}){const l=r.split("?"),_=so(e,t,i),b={auth:a,ua:_,projectId:u,useOnCloseEvent:d||void 0,origin:o||void 0},E=no(l[1]||"",b);return l[0]+"?"+E}function Pe(e,t){return e.filter(r=>t.includes(r)).length===e.length}function pu(e){return Object.fromEntries(e.entries())}function vu(e){return new Map(Object.entries(e))}function yu(e=Me.FIVE_MINUTES,t){const r=Me.toMiliseconds(e||Me.FIVE_MINUTES);let i,a,u;return{resolve:d=>{u&&i&&(clearTimeout(u),i(d))},reject:d=>{u&&a&&(clearTimeout(u),a(d))},done:()=>new Promise((d,o)=>{u=setTimeout(()=>{o(new Error(t))},r),i=d,a=o})}}function mu(e,t,r){return new Promise(async(i,a)=>{const u=setTimeout(()=>a(new Error(r)),t);try{const d=await e;i(d)}catch(d){a(d)}clearTimeout(u)})}function pn(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 Su(e){return pn("topic",e)}function Cu(e){return pn("id",e)}function Ou(e){const[t,r]=e.split(":"),i={id:void 0,topic:void 0};if(t==="topic"&&typeof r=="string")i.topic=r;else if(t==="id"&&Number.isInteger(Number(r)))i.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}function Au(e,t){return Me.fromMiliseconds(Date.now()+Me.toMiliseconds(e))}function Uu(e){return Date.now()>=Me.toMiliseconds(e)}function Nu(e,t){return`${e}${t?`:${t}`:""}`}function Nt(e=[],t=[]){return[...new Set([...e,...t])]}async function Iu({id:e,topic:t,wcDeepLink:r}){try{if(!r)return;const i=typeof r=="string"?JSON.parse(r):r;let a=i==null?void 0:i.href;if(typeof a!="string")return;a.endsWith("/")&&(a=a.slice(0,-1));const u=`${a}/wc?requestId=${e}&sessionTopic=${t}`,d=Ze();d===pe.browser?u.startsWith("https://")?window.open(u,"_blank","noreferrer noopener"):window.open(u,"_self","noreferrer noopener"):d===pe.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(u)}catch(i){console.error(i)}}async function Tu(e,t){try{return await e.getItem(t)||(pt()?localStorage.getItem(t):void 0)}catch(r){console.error(r)}}const oo="irn";function Pu(e){return(e==null?void 0:e.relay)||{protocol:oo}}function Mu(e){const t=ks[e];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${e}`);return t}var uo=Object.defineProperty,Wr=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,Hr=(e,t,r)=>t in e?uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ho=(e,t)=>{for(var r in t||(t={}))co.call(t,r)&&Hr(e,r,t[r]);if(Wr)for(var r of Wr(t))fo.call(t,r)&&Hr(e,r,t[r]);return e};function lo(e,t="-"){const r={},i="relay"+t;return Object.keys(e).forEach(a=>{if(a.startsWith(i)){const u=a.replace(i,""),d=e[a];r[u]=d}}),r}function ju(e){e=e.includes("wc://")?e.replace("wc://",""):e,e=e.includes("wc:")?e.replace("wc:",""):e;const t=e.indexOf(":"),r=e.indexOf("?")!==-1?e.indexOf("?"):void 0,i=e.substring(0,t),a=e.substring(t+1,r).split("@"),u=typeof r<"u"?e.substring(r):"",d=Ge.parse(u);return{protocol:i,topic:Do(a[0]),version:parseInt(a[1],10),symKey:d.symKey,relay:lo(d)}}function Do(e){return e.startsWith("//")?e.substring(2):e}function bo(e,t="-"){const r="relay",i={};return Object.keys(e).forEach(a=>{const u=r+t+a;e[a]&&(i[u]=e[a])}),i}function Fu(e){return`${e.protocol}:${e.topic}@${e.version}?`+Ge.stringify(ho({symKey:e.symKey},bo(e.relay)))}var _o=Object.defineProperty,wo=Object.defineProperties,Eo=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertySymbols,go=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,$r=(e,t,r)=>t in e?_o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vo=(e,t)=>{for(var r in t||(t={}))go.call(t,r)&&$r(e,r,t[r]);if(Kr)for(var r of Kr(t))po.call(t,r)&&$r(e,r,t[r]);return e},yo=(e,t)=>wo(e,Eo(t));function He(e){const t=[];return e.forEach(r=>{const[i,a]=r.split(":");t.push(`${i}:${a}`)}),t}function mo(e){const t=[];return Object.values(e).forEach(r=>{t.push(...He(r.accounts))}),t}function So(e,t){const r=[];return Object.values(e).forEach(i=>{He(i.accounts).includes(t)&&r.push(...i.methods)}),r}function Co(e,t){const r=[];return Object.values(e).forEach(i=>{He(i.accounts).includes(t)&&r.push(...i.events)}),r}function xu(e,t){const r=Fo(e,t);if(r)throw new Error(r.message);const i={};for(const[a,u]of Object.entries(e))i[a]={methods:u.methods,events:u.events,chains:u.accounts.map(d=>`${d.split(":")[0]}:${d.split(":")[1]}`)};return i}function vn(e){return e.includes(":")}function Oo(e){return vn(e)?e.split(":")[0]:e}function yn(e){var t,r,i;const a={};if(!tr(e))return a;for(const[u,d]of Object.entries(e)){const o=vn(u)?[u]:d.chains,l=d.methods||[],_=d.events||[],b=Oo(u);a[b]=yo(vo({},a[b]),{chains:Nt(o,(t=a[b])==null?void 0:t.chains),methods:Nt(l,(r=a[b])==null?void 0:r.methods),events:Nt(_,(i=a[b])==null?void 0:i.events)})}return a}const Ao={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}},Uo={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 Ae(e,t){const{message:r,code:i}=Uo[e];return{message:t?`${r} ${t}`:r,code:i}}function Be(e,t){const{message:r,code:i}=Ao[e];return{message:t?`${r} ${t}`:r,code:i}}function vt(e,t){return!!Array.isArray(e)}function tr(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Le(e){return typeof e>"u"}function ve(e,t){return t&&Le(e)?!0:typeof e=="string"&&!!e.trim().length}function rr(e,t){return typeof e=="number"&&!isNaN(e)}function Ru(e,t){const{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),a=Object.keys(r);let u=!0;return Pe(a,i)?(i.forEach(d=>{const{accounts:o,methods:l,events:_}=e.namespaces[d],b=He(o),E=r[d];(!Pe(bn(d,E),b)||!Pe(E.methods,l)||!Pe(E.events,_))&&(u=!1)}),u):!1}function st(e){return ve(e,!1)&&e.includes(":")?e.split(":").length===2:!1}function No(e){if(ve(e,!1)&&e.includes(":")){const t=e.split(":");if(t.length===3){const r=t[0]+":"+t[1];return!!t[2]&&st(r)}}return!1}function Lu(e){if(ve(e,!1))try{return typeof new URL(e)<"u"}catch{return!1}return!1}function Bu(e){var t;return(t=e==null?void 0:e.proposer)==null?void 0:t.publicKey}function Wu(e){return e==null?void 0:e.topic}function Hu(e,t){let r=null;return ve(e==null?void 0:e.publicKey,!1)||(r=Ae("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function zr(e){let t=!0;return vt(e)?e.length&&(t=e.every(r=>ve(r,!1))):t=!1,t}function Io(e,t,r){let i=null;return vt(t)&&t.length?t.forEach(a=>{i||st(a)||(i=Be("UNSUPPORTED_CHAINS",`${r}, chain ${a} should be a string and conform to "namespace:chainId" format`))}):st(e)||(i=Be("UNSUPPORTED_CHAINS",`${r}, 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"] }`)),i}function To(e,t,r){let i=null;return Object.entries(e).forEach(([a,u])=>{if(i)return;const d=Io(a,bn(a,u),`${t} ${r}`);d&&(i=d)}),i}function Po(e,t){let r=null;return vt(e)?e.forEach(i=>{r||No(i)||(r=Be("UNSUPPORTED_ACCOUNTS",`${t}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):r=Be("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Mo(e,t){let r=null;return Object.values(e).forEach(i=>{if(r)return;const a=Po(i==null?void 0:i.accounts,`${t} namespace`);a&&(r=a)}),r}function jo(e,t){let r=null;return zr(e==null?void 0:e.methods)?zr(e==null?void 0:e.events)||(r=Be("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=Be("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function mn(e,t){let r=null;return Object.values(e).forEach(i=>{if(r)return;const a=jo(i,`${t}, namespace`);a&&(r=a)}),r}function Ku(e,t,r){let i=null;if(e&&tr(e)){const a=mn(e,t);a&&(i=a);const u=To(e,t,r);u&&(i=u)}else i=Ae("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return i}function Fo(e,t){let r=null;if(e&&tr(e)){const i=mn(e,t);i&&(r=i);const a=Mo(e,t);a&&(r=a)}else r=Ae("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function xo(e){return ve(e.protocol,!0)}function $u(e,t){let r=!1;return e?e&&vt(e)&&e.length&&e.forEach(i=>{r=xo(i)}):r=!0,r}function zu(e){return typeof e=="number"}function Yu(e){return typeof e<"u"&&typeof e!==null}function ku(e){return!(!e||typeof e!="object"||!e.code||!rr(e.code)||!e.message||!ve(e.message,!1))}function qu(e){return!(Le(e)||!ve(e.method,!1))}function Gu(e){return!(Le(e)||Le(e.result)&&Le(e.error)||!rr(e.id)||!ve(e.jsonrpc,!1))}function Vu(e){return!(Le(e)||!ve(e.name,!1))}function Xu(e,t){return!(!st(t)||!mo(e).includes(t))}function Qu(e,t,r){return ve(r,!1)?So(e,t).includes(r):!1}function Ju(e,t,r){return ve(r,!1)?Co(e,t).includes(r):!1}function Zu(e,t,r){let i=null;const a=Ro(e),u=Lo(t),d=Object.keys(a),o=Object.keys(u),l=Yr(Object.keys(e)),_=Yr(Object.keys(t)),b=l.filter(E=>!_.includes(E));return b.length&&(i=Ae("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${b.toString()} Received: ${Object.keys(t).toString()}`)),Pe(d,o)||(i=Ae("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${d.toString()} Approved: ${o.toString()}`)),Object.keys(t).forEach(E=>{if(!E.includes(":")||i)return;const p=He(t[E].accounts);p.includes(E)||(i=Ae("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${E} Required: ${E} Approved: ${p.toString()}`))}),d.forEach(E=>{i||(Pe(a[E].methods,u[E].methods)?Pe(a[E].events,u[E].events)||(i=Ae("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${E}`)):i=Ae("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${E}`))}),i}function Ro(e){const t={};return Object.keys(e).forEach(r=>{var i;r.includes(":")?t[r]=e[r]:(i=e[r].chains)==null||i.forEach(a=>{t[a]={methods:e[r].methods,events:e[r].events}})}),t}function Yr(e){return[...new Set(e.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Lo(e){const t={};return Object.keys(e).forEach(r=>{if(r.includes(":"))t[r]=e[r];else{const i=He(e[r].accounts);i==null||i.forEach(a=>{t[a]={accounts:e[r].accounts.filter(u=>u.includes(`${a}:`)),methods:e[r].methods,events:e[r].events}})}}),t}function ec(e,t){return rr(e)&&e<=t.max&&e>=t.min}function tc(){const e=Ze();return new Promise(t=>{switch(e){case pe.browser:t(Bo());break;case pe.reactNative:t(Wo());break;case pe.node:t(Ho());break;default:t(!0)}})}function Bo(){return pt()&&(navigator==null?void 0:navigator.onLine)}async function Wo(){if(Je()&&typeof global<"u"&&global!=null&&global.NetInfo){const e=await(global==null?void 0:global.NetInfo.fetch());return e==null?void 0:e.isConnected}return!0}function Ho(){return!0}function rc(e){switch(Ze()){case pe.browser:Ko(e);break;case pe.reactNative:$o(e);break}}function Ko(e){!Je()&&pt()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)))}function $o(e){Je()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(t=>e(t==null?void 0:t.isConnected)))}const It={};class nc{static get(t){return It[t]}static set(t,r){It[t]=r}static delete(t){delete It[t]}}var Sn="eip155",zo="store",Cn="requestedChains",Kt="wallet_addEthereumChain",X,ke,rt,$t,nr,On,nt,zt,Yt,An,ot,ir,Re,Ye,ut,ar,ct,sr,ft,or,Yo=class extends Mn{constructor(e){super({...e,options:{isNewChainsStale:!0,...e.options}}),ye(this,rt),ye(this,nr),ye(this,nt),ye(this,Yt),ye(this,ot),ye(this,Re),ye(this,ut),ye(this,ct),ye(this,ft),this.id="walletConnect",this.name="WalletConnect",this.ready=!0,ye(this,X,void 0),ye(this,ke,void 0),this.onAccountsChanged=t=>{t.length===0?this.emit("disconnect"):this.emit("change",{account:mt(t[0])})},this.onChainChanged=t=>{const r=Number(t),i=this.isChainUnsupported(r);this.emit("change",{chain:{id:r,unsupported:i}})},this.onDisconnect=()=>{ee(this,Re,Ye).call(this,[]),this.emit("disconnect")},this.onDisplayUri=t=>{this.emit("message",{type:"display_uri",data:t})},this.onConnect=()=>{this.emit("connect",{})},ee(this,rt,$t).call(this)}async connect({chainId:e,pairingTopic:t}={}){var r,i,a,u,d;try{let o=e;if(!o){const v=(r=this.storage)==null?void 0:r.getItem(zo),S=(u=(a=(i=v==null?void 0:v.state)==null?void 0:i.data)==null?void 0:a.chain)==null?void 0:u.id;S&&!this.isChainUnsupported(S)?o=S:o=(d=this.chains[0])==null?void 0:d.id}if(!o)throw new Error("No chains found on connector.");const l=await this.getProvider();ee(this,Yt,An).call(this);const _=ee(this,nt,zt).call(this);if(l.session&&_&&await l.disconnect(),!l.session||_){const v=this.chains.filter(S=>S.id!==o).map(S=>S.id);this.emit("message",{type:"connecting"}),await l.connect({pairingTopic:t,optionalChains:[o,...v]}),ee(this,Re,Ye).call(this,this.chains.map(({id:S})=>S))}const b=await l.enable(),E=mt(b[0]),p=await this.getChainId(),g=this.isChainUnsupported(p);return{account:E,chain:{id:p,unsupported:g}}}catch(o){throw/user rejected/i.test(o==null?void 0:o.message)?new fr(o):o}}async disconnect(){const e=await this.getProvider();try{await e.disconnect()}catch(t){if(!/No matching key/i.test(t.message))throw t}finally{ee(this,ot,ir).call(this),ee(this,Re,Ye).call(this,[])}}async getAccount(){const{accounts:e}=await this.getProvider();return mt(e[0])}async getChainId(){const{chainId:e}=await this.getProvider();return e}async getProvider({chainId:e}={}){return J(this,X)||await ee(this,rt,$t).call(this),e&&await this.switchChain(e),J(this,X)}async getWalletClient({chainId:e}={}){const[t,r]=await Promise.all([this.getProvider({chainId:e}),this.getAccount()]),i=this.chains.find(a=>a.id===e);if(!t)throw new Error("provider is required.");return jn({account:r,chain:i,transport:Fn(t)})}async isAuthorized(){try{const[e,t]=await Promise.all([this.getAccount(),this.getProvider()]),r=ee(this,nt,zt).call(this);if(!e)return!1;if(r&&t.session){try{await t.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(e){var r,i;const t=this.chains.find(a=>a.id===e);if(!t)throw new hr(new Error("chain not found on connector."));try{const a=await this.getProvider(),u=ee(this,ct,sr).call(this),d=ee(this,ft,or).call(this);if(!u.includes(e)&&d.includes(Kt)){await a.request({method:Kt,params:[{chainId:lr(t.id),blockExplorerUrls:[(i=(r=t.blockExplorers)==null?void 0:r.default)==null?void 0:i.url],chainName:t.name,nativeCurrency:t.nativeCurrency,rpcUrls:[...t.rpcUrls.default.http]}]});const l=ee(this,ut,ar).call(this);l.push(e),ee(this,Re,Ye).call(this,l)}return await a.request({method:"wallet_switchEthereumChain",params:[{chainId:lr(e)}]}),t}catch(a){const u=typeof a=="string"?a:a==null?void 0:a.message;throw/user rejected request/i.test(u)?new fr(a):new hr(a)}}};X=new WeakMap;ke=new WeakMap;rt=new WeakSet;$t=async function(){return!J(this,ke)&&typeof window<"u"&&kr(this,ke,ee(this,nr,On).call(this)),J(this,ke)};nr=new WeakSet;On=async function(){const{EthereumProvider:e}=await Nn(async()=>{const{EthereumProvider:r}=await import("./index.es-2hIxWHIK.js");return{EthereumProvider:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])),t=this.chains.map(({id:r})=>r);if(t.length){const{projectId:r,showQrModal:i=!0,qrModalOptions:a,metadata:u,relayUrl:d}=this.options;kr(this,X,await e.init({showQrModal:i,qrModalOptions:a,projectId:r,optionalChains:t,rpcMap:Object.fromEntries(this.chains.map(o=>[o.id,o.rpcUrls.default.http[0]])),metadata:u,relayUrl:d}))}};nt=new WeakSet;zt=function(){if(ee(this,ft,or).call(this).includes(Kt)||!this.options.isNewChainsStale)return!1;const t=ee(this,ut,ar).call(this),r=this.chains.map(({id:a})=>a),i=ee(this,ct,sr).call(this);return i.length&&!i.some(a=>r.includes(a))?!1:!r.every(a=>t.includes(a))};Yt=new WeakSet;An=function(){J(this,X)&&(ee(this,ot,ir).call(this),J(this,X).on("accountsChanged",this.onAccountsChanged),J(this,X).on("chainChanged",this.onChainChanged),J(this,X).on("disconnect",this.onDisconnect),J(this,X).on("session_delete",this.onDisconnect),J(this,X).on("display_uri",this.onDisplayUri),J(this,X).on("connect",this.onConnect))};ot=new WeakSet;ir=function(){J(this,X)&&(J(this,X).removeListener("accountsChanged",this.onAccountsChanged),J(this,X).removeListener("chainChanged",this.onChainChanged),J(this,X).removeListener("disconnect",this.onDisconnect),J(this,X).removeListener("session_delete",this.onDisconnect),J(this,X).removeListener("display_uri",this.onDisplayUri),J(this,X).removeListener("connect",this.onConnect))};Re=new WeakSet;Ye=function(e){var t;(t=this.storage)==null||t.setItem(Cn,e)};ut=new WeakSet;ar=function(){var e;return((e=this.storage)==null?void 0:e.getItem(Cn))??[]};ct=new WeakSet;sr=function(){var i,a,u;if(!J(this,X))return[];const e=(i=J(this,X).session)==null?void 0:i.namespaces;return e?((u=(a=yn(e)[Sn])==null?void 0:a.chains)==null?void 0:u.map(d=>parseInt(d.split(":")[1]||"")))??[]:[]};ft=new WeakSet;or=function(){var i,a;if(!J(this,X))return[];const e=(i=J(this,X).session)==null?void 0:i.namespaces;return e?((a=yn(e)[Sn])==null?void 0:a.methods)??[]:[]};function ko({rpc:e}){return function(t){const r=e(t);return!r||r.http===""?null:{chain:{...t,rpcUrls:{...t.rpcUrls,default:{http:[r.http]}}},rpcUrls:{http:[r.http],webSocket:r.webSocket?[r.webSocket]:void 0}}}}const qo="wallet_addEthereumChain";class Go{constructor(t,r){this.wagmi={},this.chains=[],this.namespace="eip155",this.disconnect=xn,this.getAccount=Rn,this.watchAccount=Ln,this.fetchBalance=Bn,this.getNetwork=Wn,this.watchNetwork=Hn,this.switchNetwork=Kn,this.fetchEnsName=$n,this.fetchEnsAvatar=zn,this.wagmi=t,this.chains=r}getWalletConnectConnector(){const t=this.wagmi.connectors.find(r=>r.id==="walletConnect");if(!t)throw new Error("WalletConnectConnector is required");return t}async connectWalletConnectProvider(t,r){return await t.getProvider(),new Promise(i=>{t.once("message",a=>{a.type==="display_uri"&&(r(a.data),i())})})}getConnectorById(t){const r=this.wagmi.connectors.find(i=>i.id===t);if(!r)throw new Error(`Connector for id ${t} was not found`);return r}getConnectors(){return this.wagmi.connectors.filter(t=>!t.id.includes("walletConnect"))}async connectWalletConnect(t,r){const i=this.getWalletConnectConnector(),a={connector:i};return r&&(a.chainId=r),Promise.all([dr(a),this.connectWalletConnectProvider(i,t)])}async connectConnector(t,r){const i={connector:this.getConnectorById(t)};return r&&(i.chainId=r),await dr(i)}isInjectedProviderInstalled(){return typeof window.ethereum<"u"}safeCheckInjectedProvider(t){var r;try{const i=String(t);return!!((r=window.ethereum)!=null&&r[i])}catch(i){return console.error(i),!1}}async getConnectedChainIds(){var t,r,i;const a=(r=(t=(await this.getWalletConnectConnector().getProvider()).signer)==null?void 0:t.session)==null?void 0:r.namespaces,u=(i=a==null?void 0:a[this.namespace])==null?void 0:i.methods;if(u!=null&&u.includes(qo))return"ALL";if(a){const d=[];return Object.keys(a).forEach(o=>{o.includes(this.namespace)&&d.push(...a[o].accounts)}),d==null?void 0:d.map(o=>o.split(":")[1])}return"ALL"}}const Vo="eip155",Xo="https://rpc.walletconnect.com";function Qo({projectId:e}){return ko({rpc:t=>{var r;return[1,3,4,5,10,42,56,69,97,100,137,280,324,420,42161,42220,43114,80001,421611,421613,1313161554,1313161555].includes(t.id)?{http:`${Xo}/v1/?chainId=${Vo}:${t.id}&projectId=${e}`}:{http:t.rpcUrls.default.http[0],webSocket:(r=t.rpcUrls.default.webSocket)==null?void 0:r[0]}}})}function Jo({chains:e,projectId:t}){return[new Yo({chains:e,options:{projectId:t,showQrModal:!1}}),new Yn({chains:e,options:{shimDisconnect:!0}})]}const tt=[ni,Vn],Zo=({children:e})=>{const{projectId:t,alchemyId:r,enabled:i,defaultChainId:a}=In.app.walletConnect,{publicClient:u}=kn(tt,[Qo({projectId:t}),ii({apiKey:r})]),d=qn({autoConnect:!0,connectors:Jo({projectId:t,chains:tt}),publicClient:u}),o={explorerRecommendedWalletIds:[Jn,Zn,ei,ti,ri],ethereumClient:new Go(d,tt),chainImages:{5165:Dr},tokenImages:{FTN:Dr},themeVariables:{"--w3m-z-index":"99999999999999999999","--w3m-background-color":"#263045","--w3m-accent-color":"#263045"},projectId:t,themeMode:"light",defaultChain:tt.find(Tn("id",a)),enableAccountView:!0};return cr.jsxs(Gn,{config:d,children:[e,i&&cr.jsx(Pn,{...o})]})},ic=Object.freeze(Object.defineProperty({__proto__:null,default:Zo},Symbol.toStringTag,{value:"Module"}));export{gt as $,Qs as A,Ou as B,Su as C,Cu as D,Je as E,Du as F,pt as G,bu as H,Fu as I,wu as J,hu as K,gn as L,Wu as M,Ae as N,pu as O,vu as P,lu as Q,Pu as R,Mu as S,vt as T,Be as U,Bu as V,Eu as W,gu as X,tr as Y,xu as Z,Qe as _,Er as a,Tu as a0,Iu as a1,Ru as a2,nc as a3,$u as a4,Ku as a5,Fo as a6,Zu as a7,ku as a8,xo as a9,Hu as aa,Xu as ab,qu as ac,Qu as ad,ec as ae,Gu as af,Vu as ag,Ju as ah,zu as ai,Oo as aj,vn as ak,Nt as al,su as am,ou as an,ic as ao,F as b,Me as c,Le as d,cu as e,me as f,fu as g,En as h,tc as i,Au as j,uu as k,ju as l,yu as m,rc as n,Uu as o,ge as p,_u as q,lt as r,Yu as s,Se as t,mu as u,Lu as v,Ce as w,du as x,Nu as y,ve as z};