@imtbl/checkout-widgets 2.10.6 → 2.10.7-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{AddTokensWidget-C2V-oXb0.js → AddTokensWidget-CoYtaqbo.js} +3 -3
- package/dist/browser/{BridgeWidget-BhZiq8V0.js → BridgeWidget-DHbT5v9l.js} +6 -6
- package/dist/browser/{CommerceWidget-bIk3rrXp.js → CommerceWidget-ko2GnLnO.js} +13 -13
- package/dist/browser/{FeesBreakdown-C3BLPlvu.js → FeesBreakdown-Cn2jiiIF.js} +1 -1
- package/dist/browser/{OnRampWidget-EVEETfXU.js → OnRampWidget-Dpe4tZoY.js} +3 -3
- package/dist/browser/{SaleWidget-CCkOILVS.js → SaleWidget-OurkfekH.js} +10 -10
- package/dist/browser/{SpendingCapHero-Cq5A-mCF.js → SpendingCapHero-DSZfS-6Z.js} +1 -1
- package/dist/browser/{SwapWidget-DRmAETp-.js → SwapWidget-DdYAKFbP.js} +6 -6
- package/dist/browser/{TokenImage-zEm2x-b9.js → TokenImage-Bh3xNe1O.js} +1 -1
- package/dist/browser/{TopUpView-CAR2Or-z.js → TopUpView-DXo3aNw2.js} +1 -1
- package/dist/browser/{WalletApproveHero-D-uPg7Hw.js → WalletApproveHero-Cx9yp0a1.js} +2 -2
- package/dist/browser/{WalletWidget-CKOU9edh.js → WalletWidget-DIKU4h19.js} +3 -3
- package/dist/browser/{auto-track-DYIE7Zo8.js → auto-track-ukaXGHw5.js} +1 -1
- package/dist/browser/{index-Cq_4evW5.js → index-BHJq6Nn2.js} +1 -1
- package/dist/browser/{index-DXMYxnSC.js → index-C5Pj3wdV.js} +1 -1
- package/dist/browser/{index-B_0G9oxZ.js → index-CDDRCw9i.js} +1 -1
- package/dist/browser/{index-BZRHi750.js → index-DAogBkn2.js} +1 -1
- package/dist/browser/{index-RVYhcgvA.js → index-DYIvEBsg.js} +1 -1
- package/dist/browser/{index-DQiUXIz-.js → index-DZMMWbSK.js} +1 -1
- package/dist/browser/{index-CGIj2lNQ.js → index-ZnMsHsOF.js} +95 -104
- package/dist/browser/{index-Bw8O5XB8.js → index-hY8dPZlc.js} +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/{index.umd-FrO0rxk6.js → index.umd-BCga4FY5.js} +1 -1
- package/dist/browser/{useInterval-CPscBEsE.js → useInterval-CAUdzzzS.js} +1 -1
- package/package.json +8 -8
|
@@ -4109,7 +4109,7 @@ const clearGlobalNamespace = (namespace) => {
|
|
|
4109
4109
|
};
|
|
4110
4110
|
lib$4.clearGlobalNamespace = clearGlobalNamespace;
|
|
4111
4111
|
|
|
4112
|
-
var Ut$2=Object.defineProperty;var St$1=(u,c)=>{for(var p in c)Ut$2(u,p,{get:c[p],enumerable:!0});};function Br$1(u){throw new Error("Node.js process "+u+" is not supported by JSPM core outside of Node.js")}var G$3=[],tr$1=!1,W$3,cr$2=-1;function kt$2(){!tr$1||!W$3||(tr$1=!1,W$3.length?G$3=W$3.concat(G$3):cr$2=-1,G$3.length&&Vr$1());}function Vr$1(){if(!tr$1){var u=setTimeout(kt$2,0);tr$1=!0;for(var c=G$3.length;c;){for(W$3=G$3,G$3=[];++cr$2<c;)W$3&&W$3[cr$2].run();cr$2=-1,c=G$3.length;}W$3=null,tr$1=!1,clearTimeout(u);}}function _t$1(u){var c=new Array(arguments.length-1);if(arguments.length>1)for(var p=1;p<arguments.length;p++)c[p-1]=arguments[p];G$3.push(new Gr$1(u,c)),G$3.length===1&&!tr$1&&setTimeout(Vr$1,0);}function Gr$1(u,c){this.fun=u,this.array=c;}Gr$1.prototype.run=function(){this.fun.apply(null,this.array);};var Pt$1="browser",Rt$1="x64",bt$1="browser",Nt$1={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},vt$1=["/usr/bin/node"],Mt$1=[],Ct$3="v16.8.0",Lt$2={},Dt$2=function(u,c){console.warn((c?c+": ":"")+u);},$t$2=function(u){Br$1("binding");},Ft$2=function(u){return 0},Ot$2=function(){return "/"},Vt$1=function(u){},Gt$3={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function M$7(){}var Yt$2=M$7,Kt$2=[];function Ht$2(u){Br$1("_linkedBinding");}var Wt$2={},jt$3=!1,Xt$3={};function qt$2(u){Br$1("dlopen");}function Jt$3(){return []}function zt$2(){return []}var Qt$1=M$7,Zt$2=M$7,Tr$2=function(){return {}},re$3=Tr$2,te$3=Tr$2,ee$2=M$7,ne$5=M$7,ie$5=M$7,oe$4={};function se$3(u,c){if(!u)throw new Error(c||"assertion error")}var ue$2={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},ae$2=M$7,ce$2=M$7;function pe$3(){return !1}var le$2=M$7,fe$4=M$7,he$2=M$7,de$2=M$7,me$3=M$7,we$3=void 0,ge$4=void 0,ye$3=void 0,Ee$2=M$7,Ie$1=2,Be$3=1,Te$2="/bin/usr/node",Ae$2=9229,xe$2="node",Ue$3=[],Se$3=M$7,K$7={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};K$7.now===void 0&&(yr$2=Date.now(),K$7.timing&&K$7.timing.navigationStart&&(yr$2=K$7.timing.navigationStart),K$7.now=()=>Date.now()-yr$2);var yr$2;function ke$3(){return K$7.now()/1e3}var Er$1=1e9;function Ir$2(u){var c=Math.floor((Date.now()-K$7.now())*.001),p=K$7.now()*.001,l=Math.floor(p)+c,m=Math.floor(p%1*1e9);return u&&(l=l-u[0],m=m-u[1],m<0&&(l--,m+=Er$1)),[l,m]}Ir$2.bigint=function(u){var c=Ir$2(u);return typeof BigInt>"u"?c[0]*Er$1+c[1]:BigInt(c[0]*Er$1)+BigInt(c[1])};var _e$2=10,Pe$3={},Re$4=0;function H$3(){return T$6}var be$3=H$3,Ne$1=H$3,ve$2=H$3,Me$1=H$3,Ce$3=H$3,Le$1=M$7,De$3=H$3,$e$3=H$3;function Fe$3(u){return []}var T$6={version:Ct$3,versions:Lt$2,arch:Rt$1,platform:bt$1,release:Gt$3,_rawDebug:Yt$2,moduleLoadList:Kt$2,binding:$t$2,_linkedBinding:Ht$2,_events:Pe$3,_eventsCount:Re$4,_maxListeners:_e$2,on:H$3,addListener:be$3,once:Ne$1,off:ve$2,removeListener:Me$1,removeAllListeners:Ce$3,emit:Le$1,prependListener:De$3,prependOnceListener:$e$3,listeners:Fe$3,domain:Wt$2,_exiting:jt$3,config:Xt$3,dlopen:qt$2,uptime:ke$3,_getActiveRequests:Jt$3,_getActiveHandles:zt$2,reallyExit:Qt$1,_kill:Zt$2,cpuUsage:Tr$2,resourceUsage:re$3,memoryUsage:te$3,kill:ee$2,exit:ne$5,openStdin:ie$5,allowedNodeEnvironmentFlags:oe$4,assert:se$3,features:ue$2,_fatalExceptions:ae$2,setUncaughtExceptionCaptureCallback:ce$2,hasUncaughtExceptionCaptureCallback:pe$3,emitWarning:Dt$2,nextTick:_t$1,_tickCallback:le$2,_debugProcess:fe$4,_debugEnd:he$2,_startProfilerIdleNotifier:de$2,_stopProfilerIdleNotifier:me$3,stdout:we$3,stdin:ye$3,stderr:ge$4,abort:Ee$2,umask:Ft$2,chdir:Vt$1,cwd:Ot$2,env:Nt$1,title:Pt$1,argv:vt$1,execArgv:Mt$1,pid:Ie$1,ppid:Be$3,execPath:Te$2,debugPort:Ae$2,hrtime:Ir$2,argv0:xe$2,_preload_modules:Ue$3,setSourceMapsEnabled:Se$3};var nr$1={},Yr$1=!1;function Oe$2(){if(Yr$1)return nr$1;Yr$1=!0,nr$1.byteLength=E,nr$1.toByteArray=C,nr$1.fromByteArray=_;for(var u=[],c=[],p=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,w=l.length;m<w;++m)u[m]=l[m],c[l.charCodeAt(m)]=m;c[45]=62,c[95]=63;function o(f){var h=f.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var g=f.indexOf("=");g===-1&&(g=h);var A=g===h?0:4-g%4;return [g,A]}function E(f){var h=o(f),g=h[0],A=h[1];return (g+A)*3/4-A}function b(f,h,g){return (h+g)*3/4-g}function C(f){var h,g=o(f),A=g[0],v=g[1],P=new p(b(f,A,v)),D=0,F=v>0?A-4:A,L;for(L=0;L<F;L+=4)h=c[f.charCodeAt(L)]<<18|c[f.charCodeAt(L+1)]<<12|c[f.charCodeAt(L+2)]<<6|c[f.charCodeAt(L+3)],P[D++]=h>>16&255,P[D++]=h>>8&255,P[D++]=h&255;return v===2&&(h=c[f.charCodeAt(L)]<<2|c[f.charCodeAt(L+1)]>>4,P[D++]=h&255),v===1&&(h=c[f.charCodeAt(L)]<<10|c[f.charCodeAt(L+1)]<<4|c[f.charCodeAt(L+2)]>>2,P[D++]=h>>8&255,P[D++]=h&255),P}function B(f){return u[f>>18&63]+u[f>>12&63]+u[f>>6&63]+u[f&63]}function k(f,h,g){for(var A,v=[],P=h;P<g;P+=3)A=(f[P]<<16&16711680)+(f[P+1]<<8&65280)+(f[P+2]&255),v.push(B(A));return v.join("")}function _(f){for(var h,g=f.length,A=g%3,v=[],P=16383,D=0,F=g-A;D<F;D+=P)v.push(k(f,D,D+P>F?F:D+P));return A===1?(h=f[g-1],v.push(u[h>>2]+u[h<<4&63]+"==")):A===2&&(h=(f[g-2]<<8)+f[g-1],v.push(u[h>>10]+u[h>>4&63]+u[h<<2&63]+"=")),v.join("")}return nr$1}var pr$1={},Kr$2=!1;function Ve$1(){if(Kr$2)return pr$1;Kr$2=!0;return pr$1.read=function(u,c,p,l,m){var w,o,E=m*8-l-1,b=(1<<E)-1,C=b>>1,B=-7,k=p?m-1:0,_=p?-1:1,f=u[c+k];for(k+=_,w=f&(1<<-B)-1,f>>=-B,B+=E;B>0;w=w*256+u[c+k],k+=_,B-=8);for(o=w&(1<<-B)-1,w>>=-B,B+=l;B>0;o=o*256+u[c+k],k+=_,B-=8);if(w===0)w=1-C;else {if(w===b)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,l),w=w-C;}return (f?-1:1)*o*Math.pow(2,w-l)},pr$1.write=function(u,c,p,l,m,w){var o,E,b,C=w*8-m-1,B=(1<<C)-1,k=B>>1,_=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=l?0:w-1,h=l?1:-1,g=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(E=isNaN(c)?1:0,o=B):(o=Math.floor(Math.log(c)/Math.LN2),c*(b=Math.pow(2,-o))<1&&(o--,b*=2),o+k>=1?c+=_/b:c+=_*Math.pow(2,1-k),c*b>=2&&(o++,b/=2),o+k>=B?(E=0,o=B):o+k>=1?(E=(c*b-1)*Math.pow(2,m),o=o+k):(E=c*Math.pow(2,k-1)*Math.pow(2,m),o=0));m>=8;u[p+f]=E&255,f+=h,E/=256,m-=8);for(o=o<<m|E,C+=m;C>0;u[p+f]=o&255,f+=h,o/=256,C-=8);u[p+f-h]|=g*128;},pr$1}var j$7={},Hr$1=!1;function Ge$2(){if(Hr$1)return j$7;Hr$1=!0;let u=Oe$2(),c=Ve$1(),p=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j$7.Buffer=o,j$7.SlowBuffer=v,j$7.INSPECT_MAX_BYTES=50;let l=2147483647;j$7.kMaxLength=l,o.TYPED_ARRAY_SUPPORT=m(),!o.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 m(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return !1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function w(e){if(e>l)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,o.prototype),r}function o(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(e)}return E(e,r,t)}o.poolSize=8192;function E(e,r,t){if(typeof e=="string")return k(e,r);if(ArrayBuffer.isView(e))return f(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return h(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return o.from(n,r,t);let i=g(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return o.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}o.from=function(e,r,t){return E(e,r,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function b(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function C(e,r,t){return b(e),e<=0?w(e):r!==void 0?typeof t=="string"?w(e).fill(r,t):w(e).fill(r):w(e)}o.alloc=function(e,r,t){return C(e,r,t)};function B(e){return b(e),w(e<0?0:A(e)|0)}o.allocUnsafe=function(e){return B(e)},o.allocUnsafeSlow=function(e){return B(e)};function k(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=P(e,r)|0,n=w(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function _(e){let r=e.length<0?0:A(e.length)|0,t=w(r);for(let n=0;n<r;n+=1)t[n]=e[n]&255;return t}function f(e){if(O(e,Uint8Array)){let r=new Uint8Array(e);return h(r.buffer,r.byteOffset,r.byteLength)}return _(e)}function h(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(e):t===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,t),Object.setPrototypeOf(n,o.prototype),n}function g(e){if(o.isBuffer(e)){let r=A(e.length)|0,t=w(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||gr(e.length)?w(0):_(e);if(e.type==="Buffer"&&Array.isArray(e.data))return _(e.data)}function A(e){if(e>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return e|0}function v(e){return +e!=e&&(e=0),o.alloc(+e)}o.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==o.prototype},o.compare=function(r,t){if(O(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),O(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(r)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,i=t.length;for(let s=0,a=Math.min(n,i);s<a;++s)if(r[s]!==t[s]){n=r[s],i=t[s];break}return n<i?-1:i<n?1:0},o.isEncoding=function(r){switch(String(r).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}},o.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let i=o.allocUnsafe(t),s=0;for(n=0;n<r.length;++n){let a=r[n];if(O(a,Uint8Array))s+a.length>i.length?(o.isBuffer(a)||(a=o.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(o.isBuffer(a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length;}return i};function P(e,r){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return wr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Or(e).length;default:if(i)return n?-1:wr(e).length;r=(""+r).toLowerCase(),i=!0;}}o.byteLength=P;function D(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return "";for(e||(e="utf8");;)switch(e){case"hex":return wt(this,r,t);case"utf8":case"utf-8":return br(this,r,t);case"ascii":return dt(this,r,t);case"latin1":case"binary":return mt(this,r,t);case"base64":return ft(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}o.prototype._isBuffer=!0;function F(e,r,t){let n=e[r];e[r]=e[t],e[t]=n;}o.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)F(this,t,t+1);return this},o.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},o.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},o.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?br(this,0,r):D.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(r){if(!o.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0},o.prototype.inspect=function(){let r="",t=j$7.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"},p&&(o.prototype[p]=o.prototype.inspect),o.prototype.compare=function(r,t,n,i,s){if(O(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>r.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===r)return 0;let a=s-i,d=n-t,x=Math.min(a,d),I=this.slice(i,s),U=r.slice(t,n);for(let y=0;y<x;++y)if(I[y]!==U[y]){a=I[y],d=U[y];break}return a<d?-1:d<a?1:0};function L(e,r,t,n,i){if(e.length===0)return -1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,gr(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return -1;t=e.length-1;}else if(t<0)if(i)t=0;else return -1;if(typeof r=="string"&&(r=o.from(r,n)),o.isBuffer(r))return r.length===0?-1:Rr(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):Rr(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Rr(e,r,t,n,i){let s=1,a=e.length,d=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return -1;s=2,a/=2,d/=2,t/=2;}function x(U,y){return s===1?U[y]:U.readUInt16BE(y*s)}let I;if(i){let U=-1;for(I=t;I<a;I++)if(x(e,I)===x(r,U===-1?0:I-U)){if(U===-1&&(U=I),I-U+1===d)return U*s}else U!==-1&&(I-=I-U),U=-1;}else for(t+d>a&&(t=a-d),I=t;I>=0;I--){let U=!0;for(let y=0;y<d;y++)if(x(e,I+y)!==x(r,y)){U=!1;break}if(U)return I}return -1}o.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1},o.prototype.indexOf=function(r,t,n){return L(this,r,t,n,!0)},o.prototype.lastIndexOf=function(r,t,n){return L(this,r,t,n,!1)};function ut(e,r,t,n){t=Number(t)||0;let i=e.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=r.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let d=parseInt(r.substr(a*2,2),16);if(gr(d))return a;e[t+a]=d;}return a}function at(e,r,t,n){return ar(wr(r,e.length-t),e,t,n)}function ct(e,r,t,n){return ar(Bt(r),e,t,n)}function pt(e,r,t,n){return ar(Or(r),e,t,n)}function lt(e,r,t,n){return ar(Tt(r,e.length-t),e,t,n)}o.prototype.write=function(r,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return ut(this,r,t,n);case"utf8":case"utf-8":return at(this,r,t,n);case"ascii":case"latin1":case"binary":return ct(this,r,t,n);case"base64":return pt(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,r,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ft(e,r,t){return r===0&&t===e.length?u.fromByteArray(e):u.fromByteArray(e.slice(r,t))}function br(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i<t;){let s=e[i],a=null,d=s>239?4:s>223?3:s>191?2:1;if(i+d<=t){let x,I,U,y;switch(d){case 1:s<128&&(a=s);break;case 2:x=e[i+1],(x&192)===128&&(y=(s&31)<<6|x&63,y>127&&(a=y));break;case 3:x=e[i+1],I=e[i+2],(x&192)===128&&(I&192)===128&&(y=(s&15)<<12|(x&63)<<6|I&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:x=e[i+1],I=e[i+2],U=e[i+3],(x&192)===128&&(I&192)===128&&(U&192)===128&&(y=(s&15)<<18|(x&63)<<12|(I&63)<<6|U&63,y>65535&&y<1114112&&(a=y));}}a===null?(a=65533,d=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=d;}return ht(n)}let Nr=4096;function ht(e){let r=e.length;if(r<=Nr)return String.fromCharCode.apply(String,e);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=Nr));return t}function dt(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]&127);return n}function mt(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]);return n}function wt(e,r,t){let n=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let i="";for(let s=r;s<t;++s)i+=At[e[s]];return i}function gt(e,r,t){let n=e.slice(r,t),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}o.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let i=this.subarray(r,t);return Object.setPrototypeOf(i,o.prototype),i};function N(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=this[r],s=1,a=0;for(;++a<t&&(s*=256);)i+=this[r+a]*s;return i},o.prototype.readUintBE=o.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=this[r+--t],s=1;for(;t>0&&(s*=256);)i+=this[r+--t]*s;return i},o.prototype.readUint8=o.prototype.readUInt8=function(r,t){return r=r>>>0,t||N(r,1,this.length),this[r]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||N(r,2,this.length),this[r]|this[r+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||N(r,2,this.length),this[r]<<8|this[r+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||N(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||N(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},o.prototype.readBigUInt64LE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,s=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))}),o.prototype.readBigUInt64BE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],s=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return (BigInt(i)<<BigInt(32))+BigInt(s)}),o.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=this[r],s=1,a=0;for(;++a<t&&(s*=256);)i+=this[r+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=t,s=1,a=this[r+--i];for(;i>0&&(s*=256);)a+=this[r+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(r,t){return r=r>>>0,t||N(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},o.prototype.readInt16LE=function(r,t){r=r>>>0,t||N(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n},o.prototype.readInt16BE=function(r,t){r=r>>>0,t||N(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n},o.prototype.readInt32LE=function(r,t){return r=r>>>0,t||N(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},o.prototype.readInt32BE=function(r,t){return r=r>>>0,t||N(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},o.prototype.readBigInt64LE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return (BigInt(i)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),o.prototype.readBigInt64BE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return (BigInt(i)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n)}),o.prototype.readFloatLE=function(r,t){return r=r>>>0,t||N(r,4,this.length),c.read(this,r,!0,23,4)},o.prototype.readFloatBE=function(r,t){return r=r>>>0,t||N(r,4,this.length),c.read(this,r,!1,23,4)},o.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||N(r,8,this.length),c.read(this,r,!0,52,8)},o.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||N(r,8,this.length),c.read(this,r,!1,52,8)};function $(e,r,t,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<s)throw new RangeError('"value" argument is out of bounds');if(t+n>e.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let d=Math.pow(2,8*n)-1;$(this,r,t,n,d,0);}let s=1,a=0;for(this[t]=r&255;++a<n&&(s*=256);)this[t+a]=r/s&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let d=Math.pow(2,8*n)-1;$(this,r,t,n,d,0);}let s=n-1,a=1;for(this[t+s]=r&255;--s>=0&&(a*=256);)this[t+s]=r/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,1,255,0),this[t]=r&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function vr(e,r,t,n,i){Fr(r,n,i,e,t,7);let s=Number(r&BigInt(4294967295));e[t++]=s,s=s>>8,e[t++]=s,s=s>>8,e[t++]=s,s=s>>8,e[t++]=s;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,t}function Mr(e,r,t,n,i){Fr(r,n,i,e,t,7);let s=Number(r&BigInt(4294967295));e[t+7]=s,s=s>>8,e[t+6]=s,s=s>>8,e[t+5]=s,s=s>>8,e[t+4]=s;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=a,a=a>>8,e[t+2]=a,a=a>>8,e[t+1]=a,a=a>>8,e[t]=a,t+8}o.prototype.writeBigUInt64LE=Y(function(r,t=0){return vr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Y(function(r,t=0){return Mr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let x=Math.pow(2,8*n-1);$(this,r,t,n,x-1,-x);}let s=0,a=1,d=0;for(this[t]=r&255;++s<n&&(a*=256);)r<0&&d===0&&this[t+s-1]!==0&&(d=1),this[t+s]=(r/a>>0)-d&255;return t+n},o.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let x=Math.pow(2,8*n-1);$(this,r,t,n,x-1,-x);}let s=n-1,a=1,d=0;for(this[t+s]=r&255;--s>=0&&(a*=256);)r<0&&d===0&&this[t+s+1]!==0&&(d=1),this[t+s]=(r/a>>0)-d&255;return t+n},o.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1},o.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},o.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},o.prototype.writeBigInt64LE=Y(function(r,t=0){return vr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Y(function(r,t=0){return Mr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cr(e,r,t,n,i,s){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Lr(e,r,t,n,i){return r=+r,t=t>>>0,i||Cr(e,r,t,4),c.write(e,r,t,n,23,4),t+4}o.prototype.writeFloatLE=function(r,t,n){return Lr(this,r,t,!0,n)},o.prototype.writeFloatBE=function(r,t,n){return Lr(this,r,t,!1,n)};function Dr(e,r,t,n,i){return r=+r,t=t>>>0,i||Cr(e,r,t,8),c.write(e,r,t,n,52,8),t+8}o.prototype.writeDoubleLE=function(r,t,n){return Dr(this,r,t,!0,n)},o.prototype.writeDoubleBE=function(r,t,n){return Dr(this,r,t,!1,n)},o.prototype.copy=function(r,t,n,i){if(!o.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t<i-n&&(i=r.length-t+n);let s=i-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(r,this.subarray(n,i),t),s},o.prototype.fill=function(r,t,n,i){if(typeof r=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){let a=r.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(r=a);}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let s;if(typeof r=="number")for(s=t;s<n;++s)this[s]=r;else {let a=o.isBuffer(r)?r:o.from(r,i),d=a.length;if(d===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=a[s%d];}return this};let Z={};function mr(e,r,t){Z[e]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,delete this.name;}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}mr("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),mr("ERR_INVALID_ARG_TYPE",function(e,r){return `The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError),mr("ERR_OUT_OF_RANGE",function(e,r,t){let n=`The value of "${e}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=$r(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=$r(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function $r(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return `${e.slice(0,t)}${r}`}function yt(e,r,t){rr(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&er(r,e.length-(t+1));}function Fr(e,r,t,n,i,s){if(e>t||e<r){let a=typeof r=="bigint"?"n":"",d;throw r===0||r===BigInt(0)?d=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:d=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`,new Z.ERR_OUT_OF_RANGE("value",d,e)}yt(n,i,s);}function rr(e,r){if(typeof e!="number")throw new Z.ERR_INVALID_ARG_TYPE(r,"number",e)}function er(e,r,t){throw Math.floor(e)!==e?(rr(e,t),new Z.ERR_OUT_OF_RANGE("offset","an integer",e)):r<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${r}`,e)}let Et=/[^+/0-9A-Za-z-_]/g;function It(e){if(e=e.split("=")[0],e=e.trim().replace(Et,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function wr(e,r){r=r||1/0;let t,n=e.length,i=null,s=[];for(let a=0;a<n;++a){if(t=e.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536;}else i&&(r-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;s.push(t);}else if(t<2048){if((r-=2)<0)break;s.push(t>>6|192,t&63|128);}else if(t<65536){if((r-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((r-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return s}function Bt(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function Tt(e,r){let t,n,i,s=[];for(let a=0;a<e.length&&!((r-=2)<0);++a)t=e.charCodeAt(a),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function Or(e){return u.toByteArray(It(e))}function ar(e,r,t,n){let i;for(i=0;i<n&&!(i+t>=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function O(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function gr(e){return e!==e}let At=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i];}return r}();function Y(e){return typeof BigInt>"u"?xt:e}function xt(){throw new Error("BigInt not supported")}return j$7}var X$4=Ge$2();var S$8=X$4.Buffer;var Ur$2={};St$1(Ur$2,{deleteItem:()=>We$5,getItem:()=>fr$1,setItem:()=>or$2});var ir$1=()=>typeof window>"u",lr$2=()=>!ir$1();var Ye$2="__IMX-",Ar$2=()=>lr$2()&&window.localStorage,Ke$1=u=>{if(u!==null)try{return JSON.parse(u)}catch{return u}},He$2=u=>typeof u=="string"?u:JSON.stringify(u),xr$2=u=>`${Ye$2}${u}`;function fr$1(u){if(Ar$2())return Ke$1(window.localStorage.getItem(xr$2(u)))}var or$2=(u,c)=>Ar$2()?(window.localStorage.setItem(xr$2(u),He$2(c)),!0):!1,We$5=u=>Ar$2()?(window.localStorage.removeItem(xr$2(u)),!0):!1;var Sr$2=0,Wr=u=>{let c=parseInt(u,10)*1e3,p=new Date(c),l=new Date;return Sr$2=p.getTime()-l.getTime(),Sr$2},jr$1=()=>{let u=new Date().getTime()+Sr$2;return new Date(u).toISOString()};var sr$1=(E=>(E.RUNTIME_ID="rid",E.PASSPORT_CLIENT_ID="passportClientId",E.ENVIRONMENT="env",E.PUBLISHABLE_API_KEY="pak",E.IDENTITY="uid",E.DOMAIN="domain",E.SDK_VERSION="sdkVersion",E))(sr$1||{});var Xe$4="https://api.immutable.com";async function hr$2(u,c){let p=axios$1.create({baseURL:Xe$4}),l=JSON.stringify(c),m={payload:S$8.from(l).toString("base64")};return (await p.post(u,m)).data}var q$6,J$4,qe$1=()=>{q$6=fr$1("metrics-events")||[],J$4=fr$1("metrics-runtime")||{};};qe$1();var V$5=(u,c)=>{J$4={...J$4,[u]:c},or$2("metrics-runtime",J$4);},ur$1=u=>{if(J$4[u]!==void 0)return J$4[u]},Xr=()=>J$4,qr$1=()=>q$6,Jr$1=u=>{q$6.push(u),or$2("metrics-events",q$6);},zr$2=u=>{q$6=q$6.slice(u),or$2("metrics-events",q$6);},dr$1=u=>{let c=[];return Object.entries(u).forEach(([p,l])=>{(typeof p=="string"||typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&c.push([p,l.toString()]);}),c};var kr$1="2.10.6",Je$3=()=>ir$1()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",ze$2=()=>{if(ir$1())return "";let u;try{window.self!==window.top&&(u=Je$3());}catch{}return u||(u=window.location.hostname),u},Qe$3=()=>{if(V$5("sdkVersion",kr$1),ir$1())return {browser:"nodejs",sdkVersion:kr$1};let u=ze$2();return u&&V$5("domain",u),{sdkVersion:kr$1,browser:window.navigator.userAgent,domain:u,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},_r$2=!1,Qr$1=()=>_r$2,Zr=async()=>{_r$2=!0;try{let u=dr$1(Qe$3()),c=ur$1("rid"),p=ur$1("uid"),m=await hr$2("/v1/sdk/initialise",{version:1,data:{runtimeDetails:u,runtimeId:c,uId:p}}),{runtimeId:w,sTime:o}=m;V$5("rid",w),Wr(o);}catch{_r$2=!1;}};function R$3(u,c){return (...p)=>{try{let l=u(...p);return l instanceof Promise?l.catch(()=>c):l}catch{return c}}}function Ze$4(){return lr$2()||typeof T$6>"u"?!1:T$6.env.JEST_WORKER_ID!==void 0}var rt$1=R$3(Ze$4,!1);var et$1="imtbl__metrics",tn$1=5e3,en$1=1e3,z$8=(u,c)=>getGlobalisedValue_1(et$1,u,c),nt$2=(u,c)=>{let p=memorise(c,{lruOptions:{ttl:tn$1,max:en$1}});return getGlobalisedValue_1(et$1,u,p)};var nn=5e3,on=(u,c,p)=>{let l={event:`${u}.${c}`,time:jr$1(),...p&&{properties:dr$1(p)}};Jr$1(l);},Q$6=R$3(nt$2("track",on)),sn=async()=>{if(Qr$1()===!1){await Zr();return}let u=qr$1();if(u.length===0)return;let c=u.length,p=Xr();await hr$2("/v1/sdk/metrics",{version:1,data:{events:u,details:p}})instanceof Error||zr$2(c);},un=R$3(sn),ot$1=async()=>{await un(),setTimeout(ot$1,nn);},it$1=!1,an=()=>{it$1||(it$1=!0,ot$1());};rt$1()||R$3(z$8("startFlushing",an))();var Pr$2=(u,c,p,l)=>Q$6(u,c,{...l||{},duration:Math.round(p)});var st$2=()=>{let u=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${u()}${u()}-${u()}-${u()}-${u()}-${u()}${u()}${u()}`};var cn=(...u)=>{if(!u.some(l=>!!l))return {};let p={};return u.forEach(l=>{l&&(p={...p,...l});}),p},pn$1=u=>u.replace(/[^a-zA-Z0-9\s\-_]/g,""),ln=(u,c)=>`${u}_${pn$1(c)}`,fn=(u,c,p=!0,l)=>{let m=st$2(),w=Date.now(),o=0,E=0,b={},C=(..._)=>cn(b,..._,{flowId:m,flowName:c});b=C(l);let B=_=>{_&&(b=C(_));},k=(_,f)=>{let h=ln(c,_),g=0,A=performance.now();o>0&&(g=A-E);let v=C(f,{flowEventName:_,flowStep:o});Pr$2(u,h,g,v),o++,E=A;};return p&&k("Start"),{details:{moduleName:u,flowName:c,flowId:m,flowStartTime:w},addEvent:R$3(k),addFlowProperties:R$3(B)}},hn=R$3(fn);var dn$1=(u,c,p,l)=>{let{message:m}=p,w=p.stack||"",{cause:o}=p;o instanceof Error&&(w=`${w}
|
|
4112
|
+
var Ut$2=Object.defineProperty;var St$1=(u,c)=>{for(var p in c)Ut$2(u,p,{get:c[p],enumerable:!0});};function Br$1(u){throw new Error("Node.js process "+u+" is not supported by JSPM core outside of Node.js")}var G$3=[],tr$1=!1,W$3,cr$2=-1;function kt$2(){!tr$1||!W$3||(tr$1=!1,W$3.length?G$3=W$3.concat(G$3):cr$2=-1,G$3.length&&Vr$1());}function Vr$1(){if(!tr$1){var u=setTimeout(kt$2,0);tr$1=!0;for(var c=G$3.length;c;){for(W$3=G$3,G$3=[];++cr$2<c;)W$3&&W$3[cr$2].run();cr$2=-1,c=G$3.length;}W$3=null,tr$1=!1,clearTimeout(u);}}function _t$1(u){var c=new Array(arguments.length-1);if(arguments.length>1)for(var p=1;p<arguments.length;p++)c[p-1]=arguments[p];G$3.push(new Gr$1(u,c)),G$3.length===1&&!tr$1&&setTimeout(Vr$1,0);}function Gr$1(u,c){this.fun=u,this.array=c;}Gr$1.prototype.run=function(){this.fun.apply(null,this.array);};var Pt$1="browser",Rt$1="x64",bt$1="browser",Nt$1={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},vt$1=["/usr/bin/node"],Mt$1=[],Ct$3="v16.8.0",Lt$2={},Dt$2=function(u,c){console.warn((c?c+": ":"")+u);},$t$2=function(u){Br$1("binding");},Ft$2=function(u){return 0},Ot$2=function(){return "/"},Vt$1=function(u){},Gt$3={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function M$7(){}var Yt$2=M$7,Kt$2=[];function Ht$2(u){Br$1("_linkedBinding");}var Wt$2={},jt$3=!1,Xt$3={};function qt$2(u){Br$1("dlopen");}function Jt$3(){return []}function zt$2(){return []}var Qt$1=M$7,Zt$2=M$7,Tr$2=function(){return {}},re$3=Tr$2,te$3=Tr$2,ee$2=M$7,ne$5=M$7,ie$5=M$7,oe$4={};function se$3(u,c){if(!u)throw new Error(c||"assertion error")}var ue$2={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},ae$2=M$7,ce$2=M$7;function pe$3(){return !1}var le$2=M$7,fe$4=M$7,he$2=M$7,de$2=M$7,me$3=M$7,we$3=void 0,ge$4=void 0,ye$3=void 0,Ee$2=M$7,Ie$1=2,Be$3=1,Te$2="/bin/usr/node",Ae$2=9229,xe$2="node",Ue$3=[],Se$3=M$7,K$7={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};K$7.now===void 0&&(yr$2=Date.now(),K$7.timing&&K$7.timing.navigationStart&&(yr$2=K$7.timing.navigationStart),K$7.now=()=>Date.now()-yr$2);var yr$2;function ke$3(){return K$7.now()/1e3}var Er$1=1e9;function Ir$2(u){var c=Math.floor((Date.now()-K$7.now())*.001),p=K$7.now()*.001,l=Math.floor(p)+c,m=Math.floor(p%1*1e9);return u&&(l=l-u[0],m=m-u[1],m<0&&(l--,m+=Er$1)),[l,m]}Ir$2.bigint=function(u){var c=Ir$2(u);return typeof BigInt>"u"?c[0]*Er$1+c[1]:BigInt(c[0]*Er$1)+BigInt(c[1])};var _e$2=10,Pe$3={},Re$4=0;function H$3(){return T$6}var be$3=H$3,Ne$1=H$3,ve$2=H$3,Me$1=H$3,Ce$3=H$3,Le$1=M$7,De$3=H$3,$e$3=H$3;function Fe$3(u){return []}var T$6={version:Ct$3,versions:Lt$2,arch:Rt$1,platform:bt$1,release:Gt$3,_rawDebug:Yt$2,moduleLoadList:Kt$2,binding:$t$2,_linkedBinding:Ht$2,_events:Pe$3,_eventsCount:Re$4,_maxListeners:_e$2,on:H$3,addListener:be$3,once:Ne$1,off:ve$2,removeListener:Me$1,removeAllListeners:Ce$3,emit:Le$1,prependListener:De$3,prependOnceListener:$e$3,listeners:Fe$3,domain:Wt$2,_exiting:jt$3,config:Xt$3,dlopen:qt$2,uptime:ke$3,_getActiveRequests:Jt$3,_getActiveHandles:zt$2,reallyExit:Qt$1,_kill:Zt$2,cpuUsage:Tr$2,resourceUsage:re$3,memoryUsage:te$3,kill:ee$2,exit:ne$5,openStdin:ie$5,allowedNodeEnvironmentFlags:oe$4,assert:se$3,features:ue$2,_fatalExceptions:ae$2,setUncaughtExceptionCaptureCallback:ce$2,hasUncaughtExceptionCaptureCallback:pe$3,emitWarning:Dt$2,nextTick:_t$1,_tickCallback:le$2,_debugProcess:fe$4,_debugEnd:he$2,_startProfilerIdleNotifier:de$2,_stopProfilerIdleNotifier:me$3,stdout:we$3,stdin:ye$3,stderr:ge$4,abort:Ee$2,umask:Ft$2,chdir:Vt$1,cwd:Ot$2,env:Nt$1,title:Pt$1,argv:vt$1,execArgv:Mt$1,pid:Ie$1,ppid:Be$3,execPath:Te$2,debugPort:Ae$2,hrtime:Ir$2,argv0:xe$2,_preload_modules:Ue$3,setSourceMapsEnabled:Se$3};var nr$1={},Yr$1=!1;function Oe$2(){if(Yr$1)return nr$1;Yr$1=!0,nr$1.byteLength=E,nr$1.toByteArray=C,nr$1.fromByteArray=_;for(var u=[],c=[],p=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,w=l.length;m<w;++m)u[m]=l[m],c[l.charCodeAt(m)]=m;c[45]=62,c[95]=63;function o(f){var h=f.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var g=f.indexOf("=");g===-1&&(g=h);var A=g===h?0:4-g%4;return [g,A]}function E(f){var h=o(f),g=h[0],A=h[1];return (g+A)*3/4-A}function b(f,h,g){return (h+g)*3/4-g}function C(f){var h,g=o(f),A=g[0],v=g[1],P=new p(b(f,A,v)),D=0,F=v>0?A-4:A,L;for(L=0;L<F;L+=4)h=c[f.charCodeAt(L)]<<18|c[f.charCodeAt(L+1)]<<12|c[f.charCodeAt(L+2)]<<6|c[f.charCodeAt(L+3)],P[D++]=h>>16&255,P[D++]=h>>8&255,P[D++]=h&255;return v===2&&(h=c[f.charCodeAt(L)]<<2|c[f.charCodeAt(L+1)]>>4,P[D++]=h&255),v===1&&(h=c[f.charCodeAt(L)]<<10|c[f.charCodeAt(L+1)]<<4|c[f.charCodeAt(L+2)]>>2,P[D++]=h>>8&255,P[D++]=h&255),P}function B(f){return u[f>>18&63]+u[f>>12&63]+u[f>>6&63]+u[f&63]}function k(f,h,g){for(var A,v=[],P=h;P<g;P+=3)A=(f[P]<<16&16711680)+(f[P+1]<<8&65280)+(f[P+2]&255),v.push(B(A));return v.join("")}function _(f){for(var h,g=f.length,A=g%3,v=[],P=16383,D=0,F=g-A;D<F;D+=P)v.push(k(f,D,D+P>F?F:D+P));return A===1?(h=f[g-1],v.push(u[h>>2]+u[h<<4&63]+"==")):A===2&&(h=(f[g-2]<<8)+f[g-1],v.push(u[h>>10]+u[h>>4&63]+u[h<<2&63]+"=")),v.join("")}return nr$1}var pr$1={},Kr$2=!1;function Ve$1(){if(Kr$2)return pr$1;Kr$2=!0;return pr$1.read=function(u,c,p,l,m){var w,o,E=m*8-l-1,b=(1<<E)-1,C=b>>1,B=-7,k=p?m-1:0,_=p?-1:1,f=u[c+k];for(k+=_,w=f&(1<<-B)-1,f>>=-B,B+=E;B>0;w=w*256+u[c+k],k+=_,B-=8);for(o=w&(1<<-B)-1,w>>=-B,B+=l;B>0;o=o*256+u[c+k],k+=_,B-=8);if(w===0)w=1-C;else {if(w===b)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,l),w=w-C;}return (f?-1:1)*o*Math.pow(2,w-l)},pr$1.write=function(u,c,p,l,m,w){var o,E,b,C=w*8-m-1,B=(1<<C)-1,k=B>>1,_=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=l?0:w-1,h=l?1:-1,g=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(E=isNaN(c)?1:0,o=B):(o=Math.floor(Math.log(c)/Math.LN2),c*(b=Math.pow(2,-o))<1&&(o--,b*=2),o+k>=1?c+=_/b:c+=_*Math.pow(2,1-k),c*b>=2&&(o++,b/=2),o+k>=B?(E=0,o=B):o+k>=1?(E=(c*b-1)*Math.pow(2,m),o=o+k):(E=c*Math.pow(2,k-1)*Math.pow(2,m),o=0));m>=8;u[p+f]=E&255,f+=h,E/=256,m-=8);for(o=o<<m|E,C+=m;C>0;u[p+f]=o&255,f+=h,o/=256,C-=8);u[p+f-h]|=g*128;},pr$1}var j$7={},Hr$1=!1;function Ge$2(){if(Hr$1)return j$7;Hr$1=!0;let u=Oe$2(),c=Ve$1(),p=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;j$7.Buffer=o,j$7.SlowBuffer=v,j$7.INSPECT_MAX_BYTES=50;let l=2147483647;j$7.kMaxLength=l,o.TYPED_ARRAY_SUPPORT=m(),!o.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 m(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return !1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function w(e){if(e>l)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,o.prototype),r}function o(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(e)}return E(e,r,t)}o.poolSize=8192;function E(e,r,t){if(typeof e=="string")return k(e,r);if(ArrayBuffer.isView(e))return f(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return h(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return o.from(n,r,t);let i=g(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return o.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}o.from=function(e,r,t){return E(e,r,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function b(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function C(e,r,t){return b(e),e<=0?w(e):r!==void 0?typeof t=="string"?w(e).fill(r,t):w(e).fill(r):w(e)}o.alloc=function(e,r,t){return C(e,r,t)};function B(e){return b(e),w(e<0?0:A(e)|0)}o.allocUnsafe=function(e){return B(e)},o.allocUnsafeSlow=function(e){return B(e)};function k(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=P(e,r)|0,n=w(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function _(e){let r=e.length<0?0:A(e.length)|0,t=w(r);for(let n=0;n<r;n+=1)t[n]=e[n]&255;return t}function f(e){if(O(e,Uint8Array)){let r=new Uint8Array(e);return h(r.buffer,r.byteOffset,r.byteLength)}return _(e)}function h(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(e):t===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,t),Object.setPrototypeOf(n,o.prototype),n}function g(e){if(o.isBuffer(e)){let r=A(e.length)|0,t=w(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||gr(e.length)?w(0):_(e);if(e.type==="Buffer"&&Array.isArray(e.data))return _(e.data)}function A(e){if(e>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return e|0}function v(e){return +e!=e&&(e=0),o.alloc(+e)}o.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==o.prototype},o.compare=function(r,t){if(O(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),O(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(r)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,i=t.length;for(let s=0,a=Math.min(n,i);s<a;++s)if(r[s]!==t[s]){n=r[s],i=t[s];break}return n<i?-1:i<n?1:0},o.isEncoding=function(r){switch(String(r).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}},o.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let i=o.allocUnsafe(t),s=0;for(n=0;n<r.length;++n){let a=r[n];if(O(a,Uint8Array))s+a.length>i.length?(o.isBuffer(a)||(a=o.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(o.isBuffer(a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length;}return i};function P(e,r){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return wr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Or(e).length;default:if(i)return n?-1:wr(e).length;r=(""+r).toLowerCase(),i=!0;}}o.byteLength=P;function D(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return "";for(e||(e="utf8");;)switch(e){case"hex":return wt(this,r,t);case"utf8":case"utf-8":return br(this,r,t);case"ascii":return dt(this,r,t);case"latin1":case"binary":return mt(this,r,t);case"base64":return ft(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0;}}o.prototype._isBuffer=!0;function F(e,r,t){let n=e[r];e[r]=e[t],e[t]=n;}o.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)F(this,t,t+1);return this},o.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)F(this,t,t+3),F(this,t+1,t+2);return this},o.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)F(this,t,t+7),F(this,t+1,t+6),F(this,t+2,t+5),F(this,t+3,t+4);return this},o.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?br(this,0,r):D.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(r){if(!o.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0},o.prototype.inspect=function(){let r="",t=j$7.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"},p&&(o.prototype[p]=o.prototype.inspect),o.prototype.compare=function(r,t,n,i,s){if(O(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>r.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===r)return 0;let a=s-i,d=n-t,x=Math.min(a,d),I=this.slice(i,s),U=r.slice(t,n);for(let y=0;y<x;++y)if(I[y]!==U[y]){a=I[y],d=U[y];break}return a<d?-1:d<a?1:0};function L(e,r,t,n,i){if(e.length===0)return -1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,gr(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return -1;t=e.length-1;}else if(t<0)if(i)t=0;else return -1;if(typeof r=="string"&&(r=o.from(r,n)),o.isBuffer(r))return r.length===0?-1:Rr(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):Rr(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Rr(e,r,t,n,i){let s=1,a=e.length,d=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return -1;s=2,a/=2,d/=2,t/=2;}function x(U,y){return s===1?U[y]:U.readUInt16BE(y*s)}let I;if(i){let U=-1;for(I=t;I<a;I++)if(x(e,I)===x(r,U===-1?0:I-U)){if(U===-1&&(U=I),I-U+1===d)return U*s}else U!==-1&&(I-=I-U),U=-1;}else for(t+d>a&&(t=a-d),I=t;I>=0;I--){let U=!0;for(let y=0;y<d;y++)if(x(e,I+y)!==x(r,y)){U=!1;break}if(U)return I}return -1}o.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1},o.prototype.indexOf=function(r,t,n){return L(this,r,t,n,!0)},o.prototype.lastIndexOf=function(r,t,n){return L(this,r,t,n,!1)};function ut(e,r,t,n){t=Number(t)||0;let i=e.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=r.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let d=parseInt(r.substr(a*2,2),16);if(gr(d))return a;e[t+a]=d;}return a}function at(e,r,t,n){return ar(wr(r,e.length-t),e,t,n)}function ct(e,r,t,n){return ar(Bt(r),e,t,n)}function pt(e,r,t,n){return ar(Or(r),e,t,n)}function lt(e,r,t,n){return ar(Tt(r,e.length-t),e,t,n)}o.prototype.write=function(r,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return ut(this,r,t,n);case"utf8":case"utf-8":return at(this,r,t,n);case"ascii":case"latin1":case"binary":return ct(this,r,t,n);case"base64":return pt(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lt(this,r,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0;}},o.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ft(e,r,t){return r===0&&t===e.length?u.fromByteArray(e):u.fromByteArray(e.slice(r,t))}function br(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i<t;){let s=e[i],a=null,d=s>239?4:s>223?3:s>191?2:1;if(i+d<=t){let x,I,U,y;switch(d){case 1:s<128&&(a=s);break;case 2:x=e[i+1],(x&192)===128&&(y=(s&31)<<6|x&63,y>127&&(a=y));break;case 3:x=e[i+1],I=e[i+2],(x&192)===128&&(I&192)===128&&(y=(s&15)<<12|(x&63)<<6|I&63,y>2047&&(y<55296||y>57343)&&(a=y));break;case 4:x=e[i+1],I=e[i+2],U=e[i+3],(x&192)===128&&(I&192)===128&&(U&192)===128&&(y=(s&15)<<18|(x&63)<<12|(I&63)<<6|U&63,y>65535&&y<1114112&&(a=y));}}a===null?(a=65533,d=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=d;}return ht(n)}let Nr=4096;function ht(e){let r=e.length;if(r<=Nr)return String.fromCharCode.apply(String,e);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=Nr));return t}function dt(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]&127);return n}function mt(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]);return n}function wt(e,r,t){let n=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let i="";for(let s=r;s<t;++s)i+=At[e[s]];return i}function gt(e,r,t){let n=e.slice(r,t),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}o.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let i=this.subarray(r,t);return Object.setPrototypeOf(i,o.prototype),i};function N(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=this[r],s=1,a=0;for(;++a<t&&(s*=256);)i+=this[r+a]*s;return i},o.prototype.readUintBE=o.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=this[r+--t],s=1;for(;t>0&&(s*=256);)i+=this[r+--t]*s;return i},o.prototype.readUint8=o.prototype.readUInt8=function(r,t){return r=r>>>0,t||N(r,1,this.length),this[r]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||N(r,2,this.length),this[r]|this[r+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||N(r,2,this.length),this[r]<<8|this[r+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||N(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||N(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},o.prototype.readBigUInt64LE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,s=this[++r]+this[++r]*2**8+this[++r]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))}),o.prototype.readBigUInt64BE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],s=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n;return (BigInt(i)<<BigInt(32))+BigInt(s)}),o.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=this[r],s=1,a=0;for(;++a<t&&(s*=256);)i+=this[r+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||N(r,t,this.length);let i=t,s=1,a=this[r+--i];for(;i>0&&(s*=256);)a+=this[r+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(r,t){return r=r>>>0,t||N(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},o.prototype.readInt16LE=function(r,t){r=r>>>0,t||N(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n},o.prototype.readInt16BE=function(r,t){r=r>>>0,t||N(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n},o.prototype.readInt32LE=function(r,t){return r=r>>>0,t||N(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},o.prototype.readInt32BE=function(r,t){return r=r>>>0,t||N(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},o.prototype.readBigInt64LE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(n<<24);return (BigInt(i)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),o.prototype.readBigInt64BE=Y(function(r){r=r>>>0,rr(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&er(r,this.length-8);let i=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return (BigInt(i)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+n)}),o.prototype.readFloatLE=function(r,t){return r=r>>>0,t||N(r,4,this.length),c.read(this,r,!0,23,4)},o.prototype.readFloatBE=function(r,t){return r=r>>>0,t||N(r,4,this.length),c.read(this,r,!1,23,4)},o.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||N(r,8,this.length),c.read(this,r,!0,52,8)},o.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||N(r,8,this.length),c.read(this,r,!1,52,8)};function $(e,r,t,n,i,s){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<s)throw new RangeError('"value" argument is out of bounds');if(t+n>e.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let d=Math.pow(2,8*n)-1;$(this,r,t,n,d,0);}let s=1,a=0;for(this[t]=r&255;++a<n&&(s*=256);)this[t+a]=r/s&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let d=Math.pow(2,8*n)-1;$(this,r,t,n,d,0);}let s=n-1,a=1;for(this[t+s]=r&255;--s>=0&&(a*=256);)this[t+s]=r/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,1,255,0),this[t]=r&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function vr(e,r,t,n,i){Fr(r,n,i,e,t,7);let s=Number(r&BigInt(4294967295));e[t++]=s,s=s>>8,e[t++]=s,s=s>>8,e[t++]=s,s=s>>8,e[t++]=s;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,t}function Mr(e,r,t,n,i){Fr(r,n,i,e,t,7);let s=Number(r&BigInt(4294967295));e[t+7]=s,s=s>>8,e[t+6]=s,s=s>>8,e[t+5]=s,s=s>>8,e[t+4]=s;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=a,a=a>>8,e[t+2]=a,a=a>>8,e[t+1]=a,a=a>>8,e[t]=a,t+8}o.prototype.writeBigUInt64LE=Y(function(r,t=0){return vr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Y(function(r,t=0){return Mr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let x=Math.pow(2,8*n-1);$(this,r,t,n,x-1,-x);}let s=0,a=1,d=0;for(this[t]=r&255;++s<n&&(a*=256);)r<0&&d===0&&this[t+s-1]!==0&&(d=1),this[t+s]=(r/a>>0)-d&255;return t+n},o.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let x=Math.pow(2,8*n-1);$(this,r,t,n,x-1,-x);}let s=n-1,a=1,d=0;for(this[t+s]=r&255;--s>=0&&(a*=256);)r<0&&d===0&&this[t+s+1]!==0&&(d=1),this[t+s]=(r/a>>0)-d&255;return t+n},o.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1},o.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},o.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},o.prototype.writeBigInt64LE=Y(function(r,t=0){return vr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Y(function(r,t=0){return Mr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cr(e,r,t,n,i,s){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Lr(e,r,t,n,i){return r=+r,t=t>>>0,i||Cr(e,r,t,4),c.write(e,r,t,n,23,4),t+4}o.prototype.writeFloatLE=function(r,t,n){return Lr(this,r,t,!0,n)},o.prototype.writeFloatBE=function(r,t,n){return Lr(this,r,t,!1,n)};function Dr(e,r,t,n,i){return r=+r,t=t>>>0,i||Cr(e,r,t,8),c.write(e,r,t,n,52,8),t+8}o.prototype.writeDoubleLE=function(r,t,n){return Dr(this,r,t,!0,n)},o.prototype.writeDoubleBE=function(r,t,n){return Dr(this,r,t,!1,n)},o.prototype.copy=function(r,t,n,i){if(!o.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t<i-n&&(i=r.length-t+n);let s=i-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(r,this.subarray(n,i),t),s},o.prototype.fill=function(r,t,n,i){if(typeof r=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){let a=r.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(r=a);}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let s;if(typeof r=="number")for(s=t;s<n;++s)this[s]=r;else {let a=o.isBuffer(r)?r:o.from(r,i),d=a.length;if(d===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=a[s%d];}return this};let Z={};function mr(e,r,t){Z[e]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,delete this.name;}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}mr("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),mr("ERR_INVALID_ARG_TYPE",function(e,r){return `The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError),mr("ERR_OUT_OF_RANGE",function(e,r,t){let n=`The value of "${e}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=$r(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=$r(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function $r(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return `${e.slice(0,t)}${r}`}function yt(e,r,t){rr(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&er(r,e.length-(t+1));}function Fr(e,r,t,n,i,s){if(e>t||e<r){let a=typeof r=="bigint"?"n":"",d;throw r===0||r===BigInt(0)?d=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:d=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`,new Z.ERR_OUT_OF_RANGE("value",d,e)}yt(n,i,s);}function rr(e,r){if(typeof e!="number")throw new Z.ERR_INVALID_ARG_TYPE(r,"number",e)}function er(e,r,t){throw Math.floor(e)!==e?(rr(e,t),new Z.ERR_OUT_OF_RANGE("offset","an integer",e)):r<0?new Z.ERR_BUFFER_OUT_OF_BOUNDS:new Z.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${r}`,e)}let Et=/[^+/0-9A-Za-z-_]/g;function It(e){if(e=e.split("=")[0],e=e.trim().replace(Et,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function wr(e,r){r=r||1/0;let t,n=e.length,i=null,s=[];for(let a=0;a<n;++a){if(t=e.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536;}else i&&(r-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;s.push(t);}else if(t<2048){if((r-=2)<0)break;s.push(t>>6|192,t&63|128);}else if(t<65536){if((r-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128);}else if(t<1114112){if((r-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128);}else throw new Error("Invalid code point")}return s}function Bt(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function Tt(e,r){let t,n,i,s=[];for(let a=0;a<e.length&&!((r-=2)<0);++a)t=e.charCodeAt(a),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function Or(e){return u.toByteArray(It(e))}function ar(e,r,t,n){let i;for(i=0;i<n&&!(i+t>=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function O(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function gr(e){return e!==e}let At=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i];}return r}();function Y(e){return typeof BigInt>"u"?xt:e}function xt(){throw new Error("BigInt not supported")}return j$7}var X$4=Ge$2();var S$8=X$4.Buffer;var Ur$2={};St$1(Ur$2,{deleteItem:()=>We$5,getItem:()=>fr$1,setItem:()=>or$2});var ir$1=()=>typeof window>"u",lr$2=()=>!ir$1();var Ye$2="__IMX-",Ar$2=()=>lr$2()&&window.localStorage,Ke$1=u=>{if(u!==null)try{return JSON.parse(u)}catch{return u}},He$2=u=>typeof u=="string"?u:JSON.stringify(u),xr$2=u=>`${Ye$2}${u}`;function fr$1(u){if(Ar$2())return Ke$1(window.localStorage.getItem(xr$2(u)))}var or$2=(u,c)=>Ar$2()?(window.localStorage.setItem(xr$2(u),He$2(c)),!0):!1,We$5=u=>Ar$2()?(window.localStorage.removeItem(xr$2(u)),!0):!1;var Sr$2=0,Wr=u=>{let c=parseInt(u,10)*1e3,p=new Date(c),l=new Date;return Sr$2=p.getTime()-l.getTime(),Sr$2},jr$1=()=>{let u=new Date().getTime()+Sr$2;return new Date(u).toISOString()};var sr$1=(E=>(E.RUNTIME_ID="rid",E.PASSPORT_CLIENT_ID="passportClientId",E.ENVIRONMENT="env",E.PUBLISHABLE_API_KEY="pak",E.IDENTITY="uid",E.DOMAIN="domain",E.SDK_VERSION="sdkVersion",E))(sr$1||{});var Xe$4="https://api.immutable.com";async function hr$2(u,c){let p=axios$1.create({baseURL:Xe$4}),l=JSON.stringify(c),m={payload:S$8.from(l).toString("base64")};return (await p.post(u,m)).data}var q$6,J$4,qe$1=()=>{q$6=fr$1("metrics-events")||[],J$4=fr$1("metrics-runtime")||{};};qe$1();var V$5=(u,c)=>{J$4={...J$4,[u]:c},or$2("metrics-runtime",J$4);},ur$1=u=>{if(J$4[u]!==void 0)return J$4[u]},Xr=()=>J$4,qr$1=()=>q$6,Jr$1=u=>{q$6.push(u),or$2("metrics-events",q$6);},zr$2=u=>{q$6=q$6.slice(u),or$2("metrics-events",q$6);},dr$1=u=>{let c=[];return Object.entries(u).forEach(([p,l])=>{(typeof p=="string"||typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&c.push([p,l.toString()]);}),c};var kr$1="2.10.7-alpha.2",Je$3=()=>ir$1()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",ze$2=()=>{if(ir$1())return "";let u;try{window.self!==window.top&&(u=Je$3());}catch{}return u||(u=window.location.hostname),u},Qe$3=()=>{if(V$5("sdkVersion",kr$1),ir$1())return {browser:"nodejs",sdkVersion:kr$1};let u=ze$2();return u&&V$5("domain",u),{sdkVersion:kr$1,browser:window.navigator.userAgent,domain:u,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},_r$2=!1,Qr$1=()=>_r$2,Zr=async()=>{_r$2=!0;try{let u=dr$1(Qe$3()),c=ur$1("rid"),p=ur$1("uid"),m=await hr$2("/v1/sdk/initialise",{version:1,data:{runtimeDetails:u,runtimeId:c,uId:p}}),{runtimeId:w,sTime:o}=m;V$5("rid",w),Wr(o);}catch{_r$2=!1;}};function R$3(u,c){return (...p)=>{try{let l=u(...p);return l instanceof Promise?l.catch(()=>c):l}catch{return c}}}function Ze$4(){return lr$2()||typeof T$6>"u"?!1:T$6.env.JEST_WORKER_ID!==void 0}var rt$1=R$3(Ze$4,!1);var et$1="imtbl__metrics",tn$1=5e3,en$1=1e3,z$8=(u,c)=>getGlobalisedValue_1(et$1,u,c),nt$2=(u,c)=>{let p=memorise(c,{lruOptions:{ttl:tn$1,max:en$1}});return getGlobalisedValue_1(et$1,u,p)};var nn=5e3,on=(u,c,p)=>{let l={event:`${u}.${c}`,time:jr$1(),...p&&{properties:dr$1(p)}};Jr$1(l);},Q$6=R$3(nt$2("track",on)),sn=async()=>{if(Qr$1()===!1){await Zr();return}let u=qr$1();if(u.length===0)return;let c=u.length,p=Xr();await hr$2("/v1/sdk/metrics",{version:1,data:{events:u,details:p}})instanceof Error||zr$2(c);},un=R$3(sn),ot$1=async()=>{await un(),setTimeout(ot$1,nn);},it$1=!1,an=()=>{it$1||(it$1=!0,ot$1());};rt$1()||R$3(z$8("startFlushing",an))();var Pr$2=(u,c,p,l)=>Q$6(u,c,{...l||{},duration:Math.round(p)});var st$2=()=>{let u=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${u()}${u()}-${u()}-${u()}-${u()}-${u()}${u()}${u()}`};var cn=(...u)=>{if(!u.some(l=>!!l))return {};let p={};return u.forEach(l=>{l&&(p={...p,...l});}),p},pn$1=u=>u.replace(/[^a-zA-Z0-9\s\-_]/g,""),ln=(u,c)=>`${u}_${pn$1(c)}`,fn=(u,c,p=!0,l)=>{let m=st$2(),w=Date.now(),o=0,E=0,b={},C=(..._)=>cn(b,..._,{flowId:m,flowName:c});b=C(l);let B=_=>{_&&(b=C(_));},k=(_,f)=>{let h=ln(c,_),g=0,A=performance.now();o>0&&(g=A-E);let v=C(f,{flowEventName:_,flowStep:o});Pr$2(u,h,g,v),o++,E=A;};return p&&k("Start"),{details:{moduleName:u,flowName:c,flowId:m,flowStartTime:w},addEvent:R$3(k),addFlowProperties:R$3(B)}},hn=R$3(fn);var dn$1=(u,c,p,l)=>{let{message:m}=p,w=p.stack||"",{cause:o}=p;o instanceof Error&&(w=`${w}
|
|
4113
4113
|
Cause: ${o.message}
|
|
4114
4114
|
${o.stack}`),Q$6(u,`trackError_${c}`,{...l||{},errorMessage:m,errorStack:w,isTrackError:!0});},mn$1=R$3(dn$1);var En$1=u=>{V$5("env",u);},In$1=R$3(z$8("setEnvironment",En$1)),Bn=u=>{V$5("passportClientId",u);};R$3(z$8("setPassportClientId",Bn));var An=u=>{V$5("pak",u);};R$3(z$8("setPublishableApiKey",An));R$3(z$8("getDetail",ur$1));
|
|
4115
4115
|
|
|
@@ -4184,12 +4184,12 @@ function defineProperties$2(target, values, types) {
|
|
|
4184
4184
|
*
|
|
4185
4185
|
* @_section: api/utils/errors:Errors [about-errors]
|
|
4186
4186
|
*/
|
|
4187
|
-
function stringify$
|
|
4187
|
+
function stringify$4(value) {
|
|
4188
4188
|
if (value == null) {
|
|
4189
4189
|
return "null";
|
|
4190
4190
|
}
|
|
4191
4191
|
if (Array.isArray(value)) {
|
|
4192
|
-
return "[ " + (value.map(stringify$
|
|
4192
|
+
return "[ " + (value.map(stringify$4)).join(", ") + " ]";
|
|
4193
4193
|
}
|
|
4194
4194
|
if (value instanceof Uint8Array) {
|
|
4195
4195
|
const HEX = "0123456789abcdef";
|
|
@@ -4201,7 +4201,7 @@ function stringify$5(value) {
|
|
|
4201
4201
|
return result;
|
|
4202
4202
|
}
|
|
4203
4203
|
if (typeof (value) === "object" && typeof (value.toJSON) === "function") {
|
|
4204
|
-
return stringify$
|
|
4204
|
+
return stringify$4(value.toJSON());
|
|
4205
4205
|
}
|
|
4206
4206
|
switch (typeof (value)) {
|
|
4207
4207
|
case "boolean":
|
|
@@ -4216,7 +4216,7 @@ function stringify$5(value) {
|
|
|
4216
4216
|
case "object": {
|
|
4217
4217
|
const keys = Object.keys(value);
|
|
4218
4218
|
keys.sort();
|
|
4219
|
-
return "{ " + keys.map((k) => `${stringify$
|
|
4219
|
+
return "{ " + keys.map((k) => `${stringify$4(k)}: ${stringify$4(value[k])}`).join(", ") + " }";
|
|
4220
4220
|
}
|
|
4221
4221
|
}
|
|
4222
4222
|
return `[ COULD NOT SERIALIZE ]`;
|
|
@@ -4265,7 +4265,7 @@ function makeError(message, code, info) {
|
|
|
4265
4265
|
const details = [];
|
|
4266
4266
|
if (info) {
|
|
4267
4267
|
if ("message" in info || "code" in info || "name" in info) {
|
|
4268
|
-
throw new Error(`value will overwrite populated values: ${stringify$
|
|
4268
|
+
throw new Error(`value will overwrite populated values: ${stringify$4(info)}`);
|
|
4269
4269
|
}
|
|
4270
4270
|
for (const key in info) {
|
|
4271
4271
|
if (key === "shortMessage") {
|
|
@@ -4273,7 +4273,7 @@ function makeError(message, code, info) {
|
|
|
4273
4273
|
}
|
|
4274
4274
|
const value = (info[key]);
|
|
4275
4275
|
// try {
|
|
4276
|
-
details.push(key + "=" + stringify$
|
|
4276
|
+
details.push(key + "=" + stringify$4(value));
|
|
4277
4277
|
// } catch (error: any) {
|
|
4278
4278
|
// console.log("MMM", error.message);
|
|
4279
4279
|
// details.push(key + "=[could not serialize object]");
|
|
@@ -63777,7 +63777,7 @@ var voidElements = {
|
|
|
63777
63777
|
|
|
63778
63778
|
var e$1 = /*@__PURE__*/getDefaultExportFromCjs$2(voidElements);
|
|
63779
63779
|
|
|
63780
|
-
var t$2=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$5(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e$1[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$2),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r$4=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i$
|
|
63780
|
+
var t$2=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$5(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e$1[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$2),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r$4=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i$4=/^\s*$/,s$2=Object.create(null);function a$3(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a$3,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c$5={parse:function(e,t){t||(t={}),t.components||(t.components=s$2);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r$4,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$5(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$5(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i$4.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a$3("",t)},"")}};
|
|
63781
63781
|
|
|
63782
63782
|
function warn() {
|
|
63783
63783
|
if (console && console.warn) {
|
|
@@ -69830,7 +69830,7 @@ function snapshot(proxyObject, handlePromise) {
|
|
|
69830
69830
|
|
|
69831
69831
|
const o$2=proxy({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),T$4={state:o$2,subscribe(e){return subscribe(o$2,()=>e(o$2))},push(e,t){e!==o$2.view&&(o$2.view=e,t&&(o$2.data=t),o$2.history.push(e));},reset(e){o$2.view=e,o$2.history=[e];},replace(e){o$2.history.length>1&&(o$2.history[o$2.history.length-1]=e,o$2.view=e);},goBack(){if(o$2.history.length>1){o$2.history.pop();const[e]=o$2.history.slice(-1);o$2.view=e;}},setData(e){o$2.data=e;}},a$2={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return a$2.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return a$2.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(a$2.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const i=encodeURIComponent(t);return `${n}wc?uri=${i}`},formatUniversalUrl(e,t,s){if(!a$2.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const i=encodeURIComponent(t);return `${n}wc?uri=${i}`},async wait(e){return new Promise(t=>{setTimeout(t,e);})},openHref(e,t){window.open(e,t,"noreferrer noopener");},setWalletConnectDeepLink(e,t){try{localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}));}catch{console.info("Unable to set WalletConnect deep link");}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}));}catch{console.info("Unable to set WalletConnect android deep link");}},removeWalletConnectDeepLink(){try{localStorage.removeItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE);}catch{console.info("Unable to remove WalletConnect deep link");}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(a$2.WCM_VERSION,"2.6.2");}catch{console.info("Unable to set Web3Modal version in storage");}},getWalletRouterData(){var e;const t=(e=T$4.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},_$2=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),r$3=proxy({enabled:_$2,userSessionId:"",events:[],connectedWalletId:void 0}),R$1={state:r$3,subscribe(e){return subscribe(r$3.events,()=>e(snapshot(r$3.events[r$3.events.length-1])))},initialize(){r$3.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(r$3.userSessionId=crypto.randomUUID());},setConnectedWalletId(e){r$3.connectedWalletId=e;},click(e){if(r$3.enabled){const t={type:"CLICK",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t);}},track(e){if(r$3.enabled){const t={type:"TRACK",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t);}},view(e){if(r$3.enabled){const t={type:"VIEW",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t);}}},c$3=proxy({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),p$8={state:c$3,subscribe(e){return subscribe(c$3,()=>e(c$3))},setChains(e){c$3.chains=e;},setWalletConnectUri(e){c$3.walletConnectUri=e;},setIsCustomDesktop(e){c$3.isCustomDesktop=e;},setIsCustomMobile(e){c$3.isCustomMobile=e;},setIsDataLoaded(e){c$3.isDataLoaded=e;},setIsUiLoaded(e){c$3.isUiLoaded=e;},setIsAuth(e){c$3.isAuth=e;}},W$1=proxy({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),y$7={state:W$1,subscribe(e){return subscribe(W$1,()=>e(W$1))},setConfig(e){var t,s;R$1.initialize(),p$8.setChains(e.chains),p$8.setIsAuth(Boolean(e.enableAuthMode)),p$8.setIsCustomMobile(Boolean((t=e.mobileWallets)==null?void 0:t.length)),p$8.setIsCustomDesktop(Boolean((s=e.desktopWallets)==null?void 0:s.length)),a$2.setModalVersionInStorage(),Object.assign(W$1,e);}};var V$3=Object.defineProperty,D$4=Object.getOwnPropertySymbols,H$1=Object.prototype.hasOwnProperty,B$3=Object.prototype.propertyIsEnumerable,M$4=(e,t,s)=>t in e?V$3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,K$3=(e,t)=>{for(var s in t||(t={}))H$1.call(t,s)&&M$4(e,s,t[s]);if(D$4)for(var s of D$4(t))B$3.call(t,s)&&M$4(e,s,t[s]);return e};const L$6="https://explorer-api.walletconnect.com",E$7="wcm",O$5="js-2.6.2";async function w$5(e,t){const s=K$3({sdkType:E$7,sdkVersion:O$5},t),n=new URL(e,L$6);return n.searchParams.append("projectId",y$7.state.projectId),Object.entries(s).forEach(([i,l])=>{l&&n.searchParams.append(i,String(l));}),(await fetch(n)).json()}const m$4={async getDesktopListings(e){return w$5("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return w$5("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return w$5("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return w$5("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return `${L$6}/w3m/v1/getWalletImage/${e}?projectId=${y$7.state.projectId}&sdkType=${E$7}&sdkVersion=${O$5}`},getAssetImageUrl(e){return `${L$6}/w3m/v1/getAssetImage/${e}?projectId=${y$7.state.projectId}&sdkType=${E$7}&sdkVersion=${O$5}`}};var z$6=Object.defineProperty,j$5=Object.getOwnPropertySymbols,J$1=Object.prototype.hasOwnProperty,q$3=Object.prototype.propertyIsEnumerable,k$3=(e,t,s)=>t in e?z$6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,F=(e,t)=>{for(var s in t||(t={}))J$1.call(t,s)&&k$3(e,s,t[s]);if(j$5)for(var s of j$5(t))q$3.call(t,s)&&k$3(e,s,t[s]);return e};const N$3=a$2.isMobile(),d$4=proxy({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),te$2={state:d$4,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=y$7.state;if(e==="NONE"||t==="ALL"&&!e)return d$4.recomendedWallets;if(a$2.isArray(e)){const s={recommendedIds:e.join(",")},{listings:n}=await m$4.getAllListings(s),i=Object.values(n);i.sort((l,v)=>{const b=e.indexOf(l.id),f=e.indexOf(v.id);return b-f}),d$4.recomendedWallets=i;}else {const{chains:s,isAuth:n}=p$8.state,i=s?.join(","),l=a$2.isArray(t),v={page:1,sdks:n?"auth_v1":void 0,entries:a$2.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:l?t.join(","):void 0},{listings:b}=N$3?await m$4.getMobileListings(v):await m$4.getDesktopListings(v);d$4.recomendedWallets=Object.values(b);}return d$4.recomendedWallets},async getWallets(e){const t=F({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=y$7.state,{recomendedWallets:i}=d$4;if(n==="ALL")return d$4.wallets;i.length?t.excludedIds=i.map(x=>x.id).join(","):a$2.isArray(s)&&(t.excludedIds=s.join(",")),a$2.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),p$8.state.isAuth&&(t.sdks="auth_v1");const{page:l,search:v}=e,{listings:b,total:f}=N$3?await m$4.getMobileListings(t):await m$4.getDesktopListings(t),A=Object.values(b),U=v?"search":"wallets";return d$4[U]={listings:[...d$4[U].listings,...A],total:f,page:l??1},{listings:A,total:f}},getWalletImageUrl(e){return m$4.getWalletImageUrl(e)},getAssetImageUrl(e){return m$4.getAssetImageUrl(e)},resetSearch(){d$4.search={listings:[],total:0,page:1};}},I$3=proxy({open:!1}),se$2={state:I$3,subscribe(e){return subscribe(I$3,()=>e(I$3))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=p$8.state;if(a$2.removeWalletConnectDeepLink(),p$8.setWalletConnectUri(e?.uri),p$8.setChains(e?.chains),T$4.reset("ConnectWallet"),s&&n)I$3.open=!0,t();else {const i=setInterval(()=>{const l=p$8.state;l.isUiLoaded&&l.isDataLoaded&&(clearInterval(i),I$3.open=!0,t());},200);}})},close(){I$3.open=!1;}};var G$1=Object.defineProperty,$$1=Object.getOwnPropertySymbols,Q$4=Object.prototype.hasOwnProperty,X$2=Object.prototype.propertyIsEnumerable,S$5=(e,t,s)=>t in e?G$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Y$1=(e,t)=>{for(var s in t||(t={}))Q$4.call(t,s)&&S$5(e,s,t[s]);if($$1)for(var s of $$1(t))X$2.call(t,s)&&S$5(e,s,t[s]);return e};function Z$2(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const C$5=proxy({themeMode:Z$2()?"dark":"light"}),ne$3={state:C$5,subscribe(e){return subscribe(C$5,()=>e(C$5))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(C$5.themeMode=t),s&&(C$5.themeVariables=Y$1({},s));}},g$5=proxy({open:!1,message:"",variant:"success"}),oe$3={state:g$5,subscribe(e){return subscribe(g$5,()=>e(g$5))},openToast(e,t){g$5.open=!0,g$5.message=e,g$5.variant=t;},closeToast(){g$5.open=!1;}};
|
|
69832
69832
|
|
|
69833
|
-
let d$3 = class d{constructor(e){this.openModal=se$2.open,this.closeModal=se$2.close,this.subscribeModal=se$2.subscribe,this.setTheme=ne$3.setThemeConfig,ne$3.setThemeConfig(e),y$7.setConfig(e),this.initUi();}async initUi(){if(typeof window<"u"){await import('./index-
|
|
69833
|
+
let d$3 = class d{constructor(e){this.openModal=se$2.open,this.closeModal=se$2.close,this.subscribeModal=se$2.subscribe,this.setTheme=ne$3.setThemeConfig,ne$3.setThemeConfig(e),y$7.setConfig(e),this.initUi();}async initUi(){if(typeof window<"u"){await import('./index-BHJq6Nn2.js');const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),p$8.setIsUiLoaded(!0);}}};
|
|
69834
69834
|
|
|
69835
69835
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
69836
69836
|
__proto__: null,
|
|
@@ -75120,7 +75120,7 @@ function isPureObject(value) {
|
|
|
75120
75120
|
const proto = Object.getPrototypeOf(value);
|
|
75121
75121
|
return !proto || proto.isPrototypeOf(Object);
|
|
75122
75122
|
}
|
|
75123
|
-
function stringify$
|
|
75123
|
+
function stringify$3(value) {
|
|
75124
75124
|
if (isPrimitive(value)) {
|
|
75125
75125
|
return String(value);
|
|
75126
75126
|
}
|
|
@@ -75128,7 +75128,7 @@ function stringify$4(value) {
|
|
|
75128
75128
|
return JSON.stringify(value);
|
|
75129
75129
|
}
|
|
75130
75130
|
if (typeof value.toJSON === "function") {
|
|
75131
|
-
return stringify$
|
|
75131
|
+
return stringify$3(value.toJSON());
|
|
75132
75132
|
}
|
|
75133
75133
|
throw new Error("[unstorage] Cannot stringify value!");
|
|
75134
75134
|
}
|
|
@@ -75370,7 +75370,7 @@ function createStorage(options = {}) {
|
|
|
75370
75370
|
if (!driver.setItem) {
|
|
75371
75371
|
return;
|
|
75372
75372
|
}
|
|
75373
|
-
await asyncCall(driver.setItem, relativeKey, stringify$
|
|
75373
|
+
await asyncCall(driver.setItem, relativeKey, stringify$3(value), opts);
|
|
75374
75374
|
if (!driver.watch) {
|
|
75375
75375
|
onChange("update", key);
|
|
75376
75376
|
}
|
|
@@ -75382,7 +75382,7 @@ function createStorage(options = {}) {
|
|
|
75382
75382
|
batch.driver.setItems,
|
|
75383
75383
|
batch.items.map((item) => ({
|
|
75384
75384
|
key: item.relativeKey,
|
|
75385
|
-
value: stringify$
|
|
75385
|
+
value: stringify$3(item.value),
|
|
75386
75386
|
options: item.options
|
|
75387
75387
|
})),
|
|
75388
75388
|
commonOptions
|
|
@@ -75396,7 +75396,7 @@ function createStorage(options = {}) {
|
|
|
75396
75396
|
return asyncCall(
|
|
75397
75397
|
batch.driver.setItem,
|
|
75398
75398
|
item.relativeKey,
|
|
75399
|
-
stringify$
|
|
75399
|
+
stringify$3(item.value),
|
|
75400
75400
|
item.options
|
|
75401
75401
|
);
|
|
75402
75402
|
})
|
|
@@ -75715,7 +75715,7 @@ const x$2="idb-keyval";var z$5=(i={})=>{const t=i.base&&i.base.length>0?`${i.bas
|
|
|
75715
75715
|
class IEvents {
|
|
75716
75716
|
}
|
|
75717
75717
|
|
|
75718
|
-
let n$4 = class n extends IEvents{constructor(e){super();}};const s=cjs$3.FIVE_SECONDS,r$2={pulse:"heartbeat_pulse"};let i$
|
|
75718
|
+
let n$4 = class n extends IEvents{constructor(e){super();}};const s=cjs$3.FIVE_SECONDS,r$2={pulse:"heartbeat_pulse"};let i$3 = class i extends n$4{constructor(e){super(e),this.events=new EventEmitter$2,this.interval=s,this.interval=e?.interval||s;}static async init(e){const t=new i(e);return await t.init(),t}async init(){await this.initialize();}stop(){clearInterval(this.intervalRef);}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),cjs$3.toMiliseconds(this.interval));}pulse(){this.events.emit(r$2.pulse);}};
|
|
75719
75719
|
|
|
75720
75720
|
function tryStringify (o) {
|
|
75721
75721
|
try { return JSON.stringify(o) } catch(e) { return '"[Circular]"' }
|
|
@@ -76185,7 +76185,7 @@ function pfGlobalThisOrFallback () {
|
|
|
76185
76185
|
|
|
76186
76186
|
var Hg$1 = /*@__PURE__*/getDefaultExportFromCjs$2(browser$2);
|
|
76187
76187
|
|
|
76188
|
-
const c$1={level:"info"},n$3="custom_context",l$3=1e3*1024;let O$3 = class O{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null;}get value(){return this.nodeValue}get size(){return this.sizeInBytes}};let d$2 = class d{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0;}append(e){const t=new O$3(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size;}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size;}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return {next:()=>{if(!e)return {done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}};let L$4 = class L{constructor(e,t=l$3){this.level=e??"error",this.levelValue=browser$2.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d$2(this.MAX_LOG_SIZE_IN_BYTES);}forwardToConsole(e,t){t===browser$2.levels.values.error?console.error(e):t===browser$2.levels.values.warn?console.warn(e):t===browser$2.levels.values.debug?console.debug(e):t===browser$2.levels.values.trace?console.trace(e):console.log(e);}appendToLogs(e){this.logs.append(safeJsonStringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t);}getLogs(){return this.logs}clearLogs(){this.logs=new d$2(this.MAX_LOG_SIZE_IN_BYTES);}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(safeJsonStringify({extraMetadata:e})),new Blob(t,{type:"application/json"})}};let m$3 = class m{constructor(e,t=l$3){this.baseChunkLogger=new L$4(e,t);}write(e){this.baseChunkLogger.appendToLogs(e);}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs();}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t);}};let B$2 = class B{constructor(e,t=l$3){this.baseChunkLogger=new L$4(e,t);}write(e){this.baseChunkLogger.appendToLogs(e);}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs();}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var x$1=Object.defineProperty,S$4=Object.defineProperties,_=Object.getOwnPropertyDescriptors,p$7=Object.getOwnPropertySymbols,T$3=Object.prototype.hasOwnProperty,z$4=Object.prototype.propertyIsEnumerable,f$7=(r,e,t)=>e in r?x$1(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,i$
|
|
76188
|
+
const c$1={level:"info"},n$3="custom_context",l$3=1e3*1024;let O$3 = class O{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null;}get value(){return this.nodeValue}get size(){return this.sizeInBytes}};let d$2 = class d{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0;}append(e){const t=new O$3(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size;}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size;}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return {next:()=>{if(!e)return {done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}};let L$4 = class L{constructor(e,t=l$3){this.level=e??"error",this.levelValue=browser$2.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new d$2(this.MAX_LOG_SIZE_IN_BYTES);}forwardToConsole(e,t){t===browser$2.levels.values.error?console.error(e):t===browser$2.levels.values.warn?console.warn(e):t===browser$2.levels.values.debug?console.debug(e):t===browser$2.levels.values.trace?console.trace(e):console.log(e);}appendToLogs(e){this.logs.append(safeJsonStringify({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t);}getLogs(){return this.logs}clearLogs(){this.logs=new d$2(this.MAX_LOG_SIZE_IN_BYTES);}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(safeJsonStringify({extraMetadata:e})),new Blob(t,{type:"application/json"})}};let m$3 = class m{constructor(e,t=l$3){this.baseChunkLogger=new L$4(e,t);}write(e){this.baseChunkLogger.appendToLogs(e);}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs();}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),o=document.createElement("a");o.href=t,o.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(t);}};let B$2 = class B{constructor(e,t=l$3){this.baseChunkLogger=new L$4(e,t);}write(e){this.baseChunkLogger.appendToLogs(e);}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs();}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var x$1=Object.defineProperty,S$4=Object.defineProperties,_=Object.getOwnPropertyDescriptors,p$7=Object.getOwnPropertySymbols,T$3=Object.prototype.hasOwnProperty,z$4=Object.prototype.propertyIsEnumerable,f$7=(r,e,t)=>e in r?x$1(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,i$2=(r,e)=>{for(var t in e||(e={}))T$3.call(e,t)&&f$7(r,t,e[t]);if(p$7)for(var t of p$7(e))z$4.call(e,t)&&f$7(r,t,e[t]);return r},g$4=(r,e)=>S$4(r,_(e));function k$1(r){return g$4(i$2({},r),{level:r?.level||c$1.level})}function v$4(r,e=n$3){return r[e]||""}function b$3(r,e,t=n$3){return r[t]=e,r}function y$5(r,e=n$3){let t="";return typeof r.bindings>"u"?t=v$4(r,e):t=r.bindings().context||"",t}function w$4(r,e,t=n$3){const o=y$5(r,t);return o.trim()?`${o}/${e}`:e}function E$5(r,e,t=n$3){const o=w$4(r,e,t),a=r.child({context:o});return b$3(a,o,t)}function C$3(r){var e,t;const o=new m$3((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return {logger:Hg$1(g$4(i$2({},r.opts),{level:"trace",browser:g$4(i$2({},(t=r.opts)==null?void 0:t.browser),{write:a=>o.write(a)})})),chunkLoggerController:o}}function I$2(r){var e;const t=new B$2((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return {logger:Hg$1(g$4(i$2({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function A$1(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C$3(r):I$2(r)}
|
|
76189
76189
|
|
|
76190
76190
|
let n$2 = class n extends IEvents{constructor(s){super(),this.opts=s,this.protocol="wc",this.version=2;}};let h$1 = class h extends IEvents{constructor(s,t){super(),this.core=s,this.logger=t,this.records=new Map;}};let a$1 = class a{constructor(s,t){this.logger=s,this.core=t;}};let u$1 = class u extends IEvents{constructor(s,t){super(),this.relayer=s,this.logger=t;}};let g$3 = class g extends IEvents{constructor(s){super();}};let p$6 = class p{constructor(s,t,o,M){this.core=s,this.logger=t,this.name=o;}};let d$1 = class d extends IEvents{constructor(s,t){super(),this.relayer=s,this.logger=t;}};let E$4 = class E extends IEvents{constructor(s,t){super(),this.core=s,this.logger=t;}};let y$4 = class y{constructor(s,t){this.projectId=s,this.logger=t;}};let v$3 = class v{constructor(s,t){this.projectId=s,this.logger=t;}};let b$2 = class b{constructor(s){this.opts=s,this.protocol="wc",this.version=2;}};let w$3 = class w{constructor(s){this.client=s;}};
|
|
76191
76191
|
|
|
@@ -79803,7 +79803,7 @@ var browser$1 = self.fetch || (self.fetch = require$$0$2.default || require$$0$2
|
|
|
79803
79803
|
|
|
79804
79804
|
var Yi$1 = /*@__PURE__*/getDefaultExportFromCjs$2(browser$1);
|
|
79805
79805
|
|
|
79806
|
-
function Hi$1(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var s=0;s<o.length;s++){var r=o.charAt(s),n=r.charCodeAt(0);if(t[n]!==255)throw new TypeError(r+" is ambiguous");t[n]=s;}var a=o.length,h=o.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function g(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return "";for(var p=0,T=0,D=0,P=u.length;D!==P&&u[D]===0;)D++,p++;for(var x=(P-D)*d+1>>>0,w=new Uint8Array(x);D!==P;){for(var O=u[D],N=0,_=x-1;(O!==0||N<T)&&_!==-1;_--,N++)O+=256*w[_]>>>0,w[_]=O%a>>>0,O=O/a>>>0;if(O!==0)throw new Error("Non-zero carry");T=N,D++;}for(var A=x-T;A!==x&&w[A]===0;)A++;for(var G=h.repeat(p);A<x;++A)G+=o.charAt(w[A]);return G}function m(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var p=0;if(u[p]!==" "){for(var T=0,D=0;u[p]===h;)T++,p++;for(var P=(u.length-p)*l+1>>>0,x=new Uint8Array(P);u[p];){var w=t[u.charCodeAt(p)];if(w===255)return;for(var O=0,N=P-1;(w!==0||O<D)&&N!==-1;N--,O++)w+=a*x[N]>>>0,x[N]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=O,p++;}if(u[p]!==" "){for(var _=P-D;_!==P&&x[_]===0;)_++;for(var A=new Uint8Array(T+(P-_)),G=T;_!==P;)A[G++]=x[_++];return A}}}function L(u){var p=m(u);if(p)return p;throw new Error(`Non-${e} character`)}return {encode:g,decodeUnsafe:m,decode:L}}var Ji$1=Hi$1,Xi$1=Ji$1;const Ue$2=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},Wi$2=o=>new TextEncoder().encode(o),Qi$1=o=>new TextDecoder().decode(o);let Zi$1 = class Zi{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i;}encode(e){if(e instanceof Uint8Array)return `${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};let es$1 = class es{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i;}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Fe$2(this,e)}};let ts$1 = class ts{constructor(e){this.decoders=e;}or(e){return Fe$2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Fe$2=(o,e)=>new ts$1({...o.decoders||{[o.prefix]:o},...e.decoders||{[e.prefix]:e}});let is$1 = class is{constructor(e,t,i,s){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=s,this.encoder=new Zi$1(e,t,i),this.decoder=new es$1(e,t,s);}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Q$2=({name:o,prefix:e,encode:t,decode:i})=>new is$1(o,e,t,i),V$1=({prefix:o,name:e,alphabet:t})=>{const{encode:i,decode:s}=Xi$1(t,e);return Q$2({prefix:o,name:e,encode:i,decode:r=>Ue$2(s(r))})},ss$1=(o,e,t,i)=>{const s={};for(let d=0;d<e.length;++d)s[e[d]]=d;let r=o.length;for(;o[r-1]==="=";)--r;const n=new Uint8Array(r*t/8|0);let a=0,h=0,l=0;for(let d=0;d<r;++d){const g=s[o[d]];if(g===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|g,a+=t,a>=8&&(a-=8,n[l++]=255&h>>a);}if(a>=t||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return n},rs$1=(o,e,t)=>{const i=e[e.length-1]==="=",s=(1<<t)-1;let r="",n=0,a=0;for(let h=0;h<o.length;++h)for(a=a<<8|o[h],n+=8;n>t;)n-=t,r+=e[s&a>>n];if(n&&(r+=e[s&a<<t-n]),i)for(;r.length*t&7;)r+="=";return r},y$3=({name:o,prefix:e,bitsPerChar:t,alphabet:i})=>Q$2({prefix:e,name:o,encode(s){return rs$1(s,i,t)},decode(s){return ss$1(s,i,t,o)}}),ns$1=Q$2({prefix:"\0",name:"identity",encode:o=>Qi$1(o),decode:o=>Wi$2(o)});var os=Object.freeze({__proto__:null,identity:ns$1});const as=y$3({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs=Object.freeze({__proto__:null,base2:as});const cs=y$3({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ls=Object.freeze({__proto__:null,base8:cs});const us=V$1({prefix:"9",name:"base10",alphabet:"0123456789"});var ds=Object.freeze({__proto__:null,base10:us});const gs=y$3({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps=y$3({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds=Object.freeze({__proto__:null,base16:gs,base16upper:ps});const ys=y$3({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms=y$3({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs=y$3({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs=y$3({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es=y$3({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws$1=y$3({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs=y$3({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is=y$3({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs=y$3({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ts=Object.freeze({__proto__:null,base32:ys,base32upper:ms,base32pad:bs,base32padupper:fs,base32hex:Es,base32hexupper:ws$1,base32hexpad:vs,base32hexpadupper:Is,base32z:Cs});const _s=V$1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Rs=V$1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss=Object.freeze({__proto__:null,base36:_s,base36upper:Rs});const Ps=V$1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs$1=V$1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os=Object.freeze({__proto__:null,base58btc:Ps,base58flickr:xs$1});const As=y$3({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs=y$3({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns=y$3({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ls=y$3({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Us=Object.freeze({__proto__:null,base64:As,base64pad:zs,base64url:Ns,base64urlpad:Ls});const $e$1=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Fs=$e$1.reduce((o,e,t)=>(o[t]=e,o),[]),$s=$e$1.reduce((o,e,t)=>(o[e.codePointAt(0)]=t,o),[]);function Bs(o){return o.reduce((e,t)=>(e+=Fs[t],e),"")}function Ms(o){const e=[];for(const t of o){const i=$s[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i);}return new Uint8Array(e)}const ks=Q$2({prefix:"\u{1F680}",name:"base256emoji",encode:Bs,decode:Ms});var Ks=Object.freeze({__proto__:null,base256emoji:ks});new TextEncoder,new TextDecoder;const Je$2={...os,...hs,...ls,...ds,...Ds,...Ts,...Ss,...Os,...Us,...Ks};function Dr(o=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(o):new Uint8Array(o)}function Xe$2(o,e,t,i){return {name:o,prefix:e,encoder:{name:o,prefix:e,encode:t},decoder:{decode:i}}}const We$2=Xe$2("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),pe$1=Xe$2("ascii","a",o=>{let e="a";for(let t=0;t<o.length;t++)e+=String.fromCharCode(o[t]);return e},o=>{o=o.substring(1);const e=Dr(o.length);for(let t=0;t<o.length;t++)e[t]=o.charCodeAt(t);return e}),yr={utf8:We$2,"utf-8":We$2,hex:Je$2.base16,latin1:pe$1,ascii:pe$1,binary:pe$1,...Je$2};function mr(o,e="utf8"){const t=yr[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return (e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(o,"utf8"):t.decoder.decode(`${t.prefix}${o}`)}const De$1="wc",Qe$2=2,Z$1="core",z$3=`${De$1}@2:${Z$1}:`,Ze$2={name:Z$1,logger:"error"},et={database:":memory:"},tt="crypto",ye$1="client_ed25519_seed",it=cjs$3.ONE_DAY,st="keychain",rt="0.3",nt="messages",ot="0.3",at=cjs$3.SIX_HOURS,ht="publisher",ct="irn",lt="error",me$1="wss://relay.walletconnect.com",be$1="wss://relay.walletconnect.org",ut="relayer",f$5={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"},dt="_subscription",E$3={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},gt=cjs$3.ONE_SECOND,pt="2.13.0",Dt=1e4,yt="0.3",mt="WALLETCONNECT_CLIENT_ID",S$2={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},bt="subscription",ft$1="0.3",Et=cjs$3.FIVE_SECONDS*1e3,wt="pairing",vt="0.3",B$1={wc_pairingDelete:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:cjs$3.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:cjs$3.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:0},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:0}}},q$2={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},I$1={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},It="history",Ct$1="0.3",Tt="expirer",C$2={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},_t="0.3",ee$1="verify-api",M$3="https://verify.walletconnect.com",te$1="https://verify.walletconnect.org",Rt=[M$3,te$1],St="echo",Pt="https://echo.walletconnect.com";class xt{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=st,this.version=rt,this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0;}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,s)=>{this.isInitialized(),this.keychain.set(i,s),await this.persist();},this.get=i=>{this.isInitialized();const s=this.keychain.get(i);if(typeof s>"u"){const{message:r}=xe$1("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(r)}return s},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist();},this.core=e,this.logger=E$5(t,this.name);}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,i0(e));}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?n0(e):void 0}async persist(){await this.setKeyChain(this.keychain);}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ot{constructor(e,t,i){this.core=e,this.logger=t,this.name=tt,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()=>{this.isInitialized();const s=await this.getClientSeed(),r=generateKeyPair(s);return encodeIss(r.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const s=mu();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const r=await this.getClientSeed(),n=generateKeyPair(r),a=gu(),h=it;return await signJWT(a,s,h,n)},this.generateSharedKey=(s,r,n)=>{this.isInitialized();const a=this.getPrivateKey(s),h=Au(a,r);return this.setSymKey(h,n)},this.setSymKey=async(s,r)=>{this.isInitialized();const n=r||bu(s);return await this.keychain.set(n,s),n},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,r,n)=>{this.isInitialized();const a=eo(n),h=safeJsonStringify(r);if(Eu(a)){const m=a.senderPublicKey,L=a.receiverPublicKey;s=await this.generateSharedKey(m,L);}const l=this.getSymKey(s),{type:d,senderPublicKey:g}=a;return wu({type:d,symKey:l,message:h,senderPublicKey:g})},this.decode=async(s,r,n)=>{this.isInitialized();const a=Mu(r,n);if(Eu(a)){const h=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(h,l);}try{const h=this.getSymKey(s),l=xu({symKey:h,encoded:r});return safeJsonParse(l)}catch(h){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(h);}},this.getPayloadType=s=>{const r=Xi$2(s);return Mr(r.type)},this.getPayloadSenderPublicKey=s=>{const r=Xi$2(s);return r.senderPublicKey?toString$2(r.senderPublicKey,zt$1):void 0},this.core=e,this.logger=E$5(t,this.name),this.keychain=i||new xt(this.core,this.logger);}get context(){return y$5(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(ye$1);}catch{e=gu(),await this.keychain.set(ye$1,e);}return mr(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class At extends a$1{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=nt,this.version=ot,this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size});}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i);}finally{this.initialized=!0;}}},this.set=async(i,s)=>{this.isInitialized();const r=yu(s);let n=this.messages.get(i);return typeof n>"u"&&(n={}),typeof n[r]<"u"||(n[r]=s,this.messages.set(i,n),await this.persist()),r},this.get=i=>{this.isInitialized();let s=this.messages.get(i);return typeof s>"u"&&(s={}),s},this.has=(i,s)=>{this.isInitialized();const r=this.get(i),n=yu(s);return typeof r[n]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist();},this.logger=E$5(e,this.name),this.core=t;}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,i0(e));}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?n0(e):void 0}async persist(){await this.setRelayerMessages(this.messages);}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class vr extends u$1{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new EventEmitter$2,this.name=ht,this.queue=new Map,this.publishTimeout=cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),this.failedPublishTimeout=cjs$3.toMiliseconds(cjs$3.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,s,r)=>{var n;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:s,opts:r}});const a=r?.ttl||at,h=Su(r),l=r?.prompt||!1,d=r?.tag||0,g=r?.id||getBigIntRpcId().toString(),m={topic:i,message:s,opts:{ttl:a,relay:h,prompt:l,tag:d,id:g}},L=`Failed to publish payload, please try again. id:${g} tag:${d}`,u=Date.now();let p,T=1;try{for(;p===void 0;){if(Date.now()-u>this.publishTimeout)throw new Error(L);this.logger.trace({id:g,attempts:T},`publisher.publish - attempt ${T}`),p=await await u0(this.rpcPublish(i,s,a,h,l,d,g).catch(D=>this.logger.warn(D)),this.publishTimeout,L),T++,p||await new Promise(D=>setTimeout(D,this.failedPublishTimeout));}this.relayer.events.emit(f$5.publish,m),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:i,message:s,opts:r}});}catch(D){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(D),(n=r?.internal)!=null&&n.throwOnFailedPublish)throw D;this.queue.set(g,m);}},this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.relayer=e,this.logger=E$5(t,this.name),this.registerEventListeners();}get context(){return y$5(this.logger)}rpcPublish(e,t,i,s,r,n,a){var h,l,d,g;const m={method:Nu(s.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:r,tag:n},id:a};return Pe$1((h=m.params)==null?void 0:h.prompt)&&((l=m.params)==null||delete l.prompt),Pe$1((d=m.params)==null?void 0:d.tag)&&((g=m.params)==null||delete g.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:m}),this.relayer.request(m)}removeRequestFromQueue(e){this.queue.delete(e);}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:s}=e;await this.publish(t,i,s);});}registerEventListeners(){this.relayer.core.heartbeat.on(r$2.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(f$5.connection_stalled);return}this.checkQueue();}),this.relayer.on(f$5.message_ack,e=>{this.removeRequestFromQueue(e.id.toString());});}}class Ir{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t]);},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const s=i.filter(r=>r!==t);if(!s.length){this.map.delete(e);return}this.map.set(e,s);},this.clear=()=>{this.map.clear();};}get topics(){return Array.from(this.map.keys())}}var Cr=Object.defineProperty,Tr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,zt=Object.getOwnPropertySymbols,Rr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Nt=(o,e,t)=>e in o?Cr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,j$2=(o,e)=>{for(var t in e||(e={}))Rr.call(e,t)&&Nt(o,t,e[t]);if(zt)for(var t of zt(e))Sr.call(e,t)&&Nt(o,t,e[t]);return o},fe$1=(o,e)=>Tr(o,_r(e));class Lt extends d$1{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Ir,this.events=new EventEmitter$2,this.name=bt,this.version=ft$1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=z$3,this.subscribeTimeout=cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId());},this.subscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}});try{const r=Su(s),n={topic:i,relay:r};this.pending.set(i,n);const a=await this.rpcSubscribe(i,r);return typeof a=="string"&&(this.onSubscribe(a,n),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}})),a}catch(r){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(r),r}},this.unsubscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),typeof s?.id<"u"?await this.unsubscribeById(i,s.id,s):await this.unsubscribeByTopic(i,s);},this.isSubscribed=async i=>{if(this.topics.includes(i))return !0;const s=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((r,n)=>{const a=new cjs$3.Watch;a.start(s);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),a.stop(s),r(!0)),a.elapsed(s)>=Et&&(clearInterval(h),a.stop(s),n(new Error("Subscription resolution timeout")));},this.pollingInterval);}).catch(()=>!1)},this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.start=async()=>{await this.onConnect();},this.stop=async()=>{await this.onDisconnect();},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1;},this.relayer=e,this.logger=E$5(t,this.name),this.clientId="";}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t;}catch{}return i}onEnable(){this.cached=[],this.initialized=!0;}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear();}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async s=>await this.unsubscribeById(e,s,t)));}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const s=Su(i);await this.rpcUnsubscribe(e,t,s);const r=tr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,r),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,t){const i={method:Nu(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await u0(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)?yu(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(f$5.connection_stalled);}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Nu(t.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await u0(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(f$5.connection_stalled);}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Nu(t.protocol).batchFetchMessages,params:{topics:e.map(r=>r.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let s;try{s=await await u0(this.relayer.request(i).catch(r=>this.logger.warn(r)),this.subscribeTimeout);}catch{this.relayer.events.emit(f$5.connection_stalled);}return s}rpcUnsubscribe(e,t,i){const s={method:Nu(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,t){this.setSubscription(e,fe$1(j$2({},t),{id:e})),this.pending.delete(t.topic);}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,j$2({},t)),this.pending.delete(t.topic);});}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e);}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e);}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t);}addSubscription(e,t){this.subscriptions.set(e,j$2({},t)),this.topicMap.set(t.topic,e),this.events.emit(S$2.created,t);}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(S$2.deleted,fe$1(j$2({},i),{reason:t}));}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(S$2.sync);}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i);}}this.events.emit(S$2.resubscribed);}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values});}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e);}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Er(t)&&this.onBatchSubscribe(t.map((i,s)=>fe$1(j$2({},e[s]),{id:i})));}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages));}async onConnect(){await this.restart(),this.onEnable();}onDisconnect(){this.onDisable();}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t);}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[]);}registerEventListeners(){this.relayer.core.heartbeat.on(r$2.pulse,async()=>{await this.checkPending();}),this.events.on(S$2.created,async e=>{const t=S$2.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist();}),this.events.on(S$2.deleted,async e=>{const t=S$2.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist();});}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e());},this.pollingInterval);});}}var Pr=Object.defineProperty,Ut=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Ft=(o,e,t)=>e in o?Pr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Ar=(o,e)=>{for(var t in e||(e={}))xr.call(e,t)&&Ft(o,t,e[t]);if(Ut)for(var t of Ut(e))Or.call(e,t)&&Ft(o,t,e[t]);return o};class $t extends g$3{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new EventEmitter$2,this.name=ut,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=cjs$3.toMiliseconds(cjs$3.THIRTY_SECONDS+cjs$3.ONE_SECOND),this.request=async t=>{var i,s;this.logger.debug("Publishing Request Payload");const r=t.id||getBigIntRpcId().toString();await this.toEstablishConnection();try{const n=this.provider.request(t);this.requestsInFlight.set(r,{promise:n,request:t}),this.logger.trace({id:r,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(h,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${r}`));};this.provider.on(E$3.disconnect,d);const g=await n;this.provider.off(E$3.disconnect,d),h(g);});return this.logger.trace({id:r,method:t.method,topic:(s=t.params)==null?void 0:s.topic},"relayer.request - published"),a}catch(n){throw this.logger.debug(`Failed to Publish Request: ${r}`),n}finally{this.requestsInFlight.delete(r);}},this.resetPingTimeout=()=>{if(pi$1())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,s;(s=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||s.terminate();},this.heartBeatTimeout);}catch(t){this.logger.warn(t);}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout();},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(f$5.connect);},this.onDisconnectHandler=()=>{this.onProviderDisconnect();},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(f$5.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose();},this.registerProviderListeners=()=>{this.provider.on(E$3.payload,this.onPayloadHandler),this.provider.on(E$3.connect,this.onConnectHandler),this.provider.on(E$3.disconnect,this.onDisconnectHandler),this.provider.on(E$3.error,this.onProviderErrorHandler);},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?E$5(e.logger,this.name):Hg$1(k$1({level:e.logger||lt})),this.messages=new At(this.logger,e.core),this.subscriber=new Lt(this,this.logger),this.publisher=new vr(this,this.logger),this.relayUrl=e?.relayUrl||me$1,this.projectId=e.projectId,this.bundleId=Wo(),this.provider={};}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen();}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${be$1}...`),await this.restartTransport(be$1);}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1);},Dt);}get context(){return y$5(this.logger)}get connected(){var e,t,i;return ((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return ((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()});}async subscribe(e,t){var i;this.isInitialized();let s=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",r;const n=a=>{a.topic===e&&(this.subscriber.off(S$2.created,n),r());};return await Promise.all([new Promise(a=>{r=a,this.subscriber.on(S$2.created,n);}),new Promise(async a=>{s=await this.subscriber.subscribe(e,t)||s,a();})]),s}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t);}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise));}catch(e){this.logger.warn(e);}this.hasExperiencedNetworkDisruption||this.connected?await u0(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect();}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect();}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const s=()=>{this.provider.off(E$3.disconnect,s),i(new Error("Connection interrupted while trying to subscribe"));};this.provider.on(E$3.disconnect,s),await u0(this.provider.connect(),cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(r=>{i(r);}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,t();});}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1;}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen());}async confirmOnlineStateOrThrow(){if(!await hh$1())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,s)=>i.publishedAt-s.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i);}catch(s){this.logger.warn(s);}this.logger.trace(`Batch of ${t.length} message events processed`);}startPingTimeout(){var e,t,i,s,r;if(pi$1())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((r=(s=(i=this.provider)==null?void 0:i.connection)==null?void 0:s.socket)==null||r.once("ping",()=>{this.resetPingTimeout();})),this.resetPingTimeout();}catch(n){this.logger.warn(n);}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new o$1(new f$6($o({sdkVersion:pt,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i);}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const s=this.messages.has(t,i);return s&&this.logger.debug(`Ignoring duplicate message: ${i}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),isJsonRpcRequest(e)){if(!e.method.endsWith(dt))return;const t=e.params,{topic:i,message:s,publishedAt:r}=t.data,n={topic:i,message:s,publishedAt:r};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar({type:"event",event:t.id},n)),this.events.emit(t.id,n),await this.acknowledgePayload(e),await this.onMessageEvent(n);}else isJsonRpcResponse(e)&&this.events.emit(f$5.message_ack,e);}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(f$5.message,e),await this.recordMessageEvent(e));}async acknowledgePayload(e){const t=formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t);}unregisterProviderListeners(){this.provider.off(E$3.payload,this.onPayloadHandler),this.provider.off(E$3.connect,this.onConnectHandler),this.provider.off(E$3.disconnect,this.onDisconnectHandler),this.provider.off(E$3.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout);}async registerEventListeners(){let e=await hh$1();ch$1(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1));});}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(f$5.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e));},cjs$3.toMiliseconds(gt));}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e());},this.connectionStatusPollingInterval);}),await this.transportOpen());}}var zr=Object.defineProperty,Bt$1=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,Mt=(o,e,t)=>e in o?zr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,kt=(o,e)=>{for(var t in e||(e={}))Nr.call(e,t)&&Mt(o,t,e[t]);if(Bt$1)for(var t of Bt$1(e))Lr.call(e,t)&&Mt(o,t,e[t]);return o};class Kt extends p$6{constructor(e,t,i,s=z$3,r=void 0){super(e,t,i,s),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=yt,this.cached=[],this.initialized=!1,this.storagePrefix=z$3,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>{this.getKey&&n!==null&&!Pe$1(n)?this.map.set(this.getKey(n),n):Gu(n)?this.map.set(n.id,n):Yu(n)&&this.map.set(n.topic,n);}),this.cached=[],this.initialized=!0);},this.set=async(n,a)=>{this.isInitialized(),this.map.has(n)?await this.update(n,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:n,value:a}),this.map.set(n,a),await this.persist());},this.get=n=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:n}),this.getData(n)),this.getAll=n=>(this.isInitialized(),n?this.values.filter(a=>Object.keys(n).every(h=>Gi$1(a[h],n[h]))):this.values),this.update=async(n,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:n,update:a});const h=kt(kt({},this.getData(n)),a);this.map.set(n,h),await this.persist();},this.delete=async(n,a)=>{this.isInitialized(),this.map.has(n)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:n,reason:a}),this.map.delete(n),this.addToRecentlyDeleted(n),await this.persist());},this.logger=E$5(t,this.name),this.storagePrefix=s,this.getKey=r;}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2);}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e);}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:s}=xe$1("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values);}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values});}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e);}}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Vt{constructor(e,t){this.core=e,this.logger=t,this.name=wt,this.version=vt,this.events=new EventEmitter$2,this.initialized=!1,this.storagePrefix=z$3,this.ignoredPayloadTypes=[lr$1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"));},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])];},this.create=async i=>{this.isInitialized();const s=gu(),r=await this.core.crypto.setSymKey(s),n=d0(cjs$3.FIVE_MINUTES),a={protocol:ct},h={topic:r,expiry:n,relay:a,active:!1},l=Du({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:s,relay:a,expiryTimestamp:n,methods:i?.methods});return this.core.expirer.set(r,n),await this.pairings.set(r,h),await this.core.relayer.subscribe(r),{topic:r,uri:l}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);const{topic:s,symKey:r,relay:n,expiryTimestamp:a,methods:h}=Pu(i.uri);let l;if(this.pairings.keys.includes(s)&&(l=this.pairings.get(s),l.active))throw new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);const d=a||d0(cjs$3.FIVE_MINUTES),g={topic:s,relay:n,expiry:d,active:!1,methods:h};return this.core.expirer.set(s,d),await this.pairings.set(s,g),i.activatePairing&&await this.activate({topic:s}),this.events.emit(q$2.create,g),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(r,s),await this.core.relayer.subscribe(s,{relay:n}),g},this.activate=async({topic:i})=>{this.isInitialized();const s=d0(cjs$3.THIRTY_DAYS);this.core.expirer.set(i,s),await this.pairings.update(i,{active:!0,expiry:s});},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:s}=i;if(this.pairings.keys.includes(s)){const r=await this.sendRequest(s,"wc_pairingPing",{}),{done:n,resolve:a,reject:h}=a0();this.events.once(v0("pairing_ping",r),({error:l})=>{l?h(l):a();}),await n();}},this.updateExpiry=async({topic:i,expiry:s})=>{this.isInitialized(),await this.pairings.update(i,{expiry:s});},this.updateMetadata=async({topic:i,metadata:s})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:s});},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:s}=i;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(s));},this.sendRequest=async(i,s,r)=>{const n=formatJsonRpcRequest(s,r),a=await this.core.crypto.encode(i,n),h=B$1[s].req;return this.core.history.set(i,n),this.core.relayer.publish(i,a,h),n.id},this.sendResult=async(i,s,r)=>{const n=formatJsonRpcResult(i,r),a=await this.core.crypto.encode(s,n),h=await this.core.history.get(s,i),l=B$1[h.request.method].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(n);},this.sendError=async(i,s,r)=>{const n=formatJsonRpcError(i,r),a=await this.core.crypto.encode(s,n),h=await this.core.history.get(s,i),l=B$1[h.request.method]?B$1[h.request.method].res:B$1.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(n);},this.deletePairing=async(i,s)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),s?Promise.resolve():this.core.expirer.del(i)]);},this.cleanup=async()=>{const i=this.pairings.getAll().filter(s=>p0(s.expiry));await Promise.all(i.map(s=>this.deletePairing(s.topic)));},this.onRelayEventRequest=i=>{const{topic:s,payload:r}=i;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(s,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(s,r);default:return this.onUnknownRpcMethodRequest(s,r)}},this.onRelayEventResponse=async i=>{const{topic:s,payload:r}=i,n=(await this.core.history.get(s,r.id)).request.method;switch(n){case"wc_pairingPing":return this.onPairingPingResponse(s,r);default:return this.onUnknownRpcMethodResponse(n)}},this.onPairingPingRequest=async(i,s)=>{const{id:r}=s;try{this.isValidPing({topic:i}),await this.sendResult(r,i,!0),this.events.emit(q$2.ping,{id:r,topic:i});}catch(n){await this.sendError(r,i,n),this.logger.error(n);}},this.onPairingPingResponse=(i,s)=>{const{id:r}=s;setTimeout(()=>{isJsonRpcResult(s)?this.events.emit(v0("pairing_ping",r),{}):isJsonRpcError(s)&&this.events.emit(v0("pairing_ping",r),{error:s.error});},500);},this.onPairingDeleteRequest=async(i,s)=>{const{id:r}=s;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(q$2.delete,{id:r,topic:i});}catch(n){await this.sendError(r,i,n),this.logger.error(n);}},this.onUnknownRpcMethodRequest=async(i,s)=>{const{id:r,method:n}=s;try{if(this.registeredMethods.includes(n))return;const a=tr("WC_METHOD_UNSUPPORTED",n);await this.sendError(r,i,a),this.logger.error(a);}catch(a){await this.sendError(r,i,a),this.logger.error(a);}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",i));},this.isValidPair=i=>{var s;if(!$u(i)){const{message:n}=xe$1("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!Ju(i.uri)){const{message:n}=xe$1("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}const r=Pu(i.uri);if(!((s=r?.relay)!=null&&s.protocol)){const{message:n}=xe$1("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(n)}if(!(r!=null&&r.symKey)){const{message:n}=xe$1("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(n)}if(r!=null&&r.expiryTimestamp&&cjs$3.toMiliseconds(r?.expiryTimestamp)<Date.now()){const{message:n}=xe$1("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(n)}},this.isValidPing=async i=>{if(!$u(i)){const{message:r}=xe$1("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(r)}const{topic:s}=i;await this.isValidPairingTopic(s);},this.isValidDisconnect=async i=>{if(!$u(i)){const{message:r}=xe$1("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(r)}const{topic:s}=i;await this.isValidPairingTopic(s);},this.isValidPairingTopic=async i=>{if(!Gt$1(i,!1)){const{message:s}=xe$1("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(s)}if(!this.pairings.keys.includes(i)){const{message:s}=xe$1("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(s)}if(p0(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:s}=xe$1("EXPIRED",`pairing topic: ${i}`);throw new Error(s)}},this.core=e,this.logger=E$5(t,this.name),this.pairings=new Kt(this.core,this.logger,this.name,this.storagePrefix);}get context(){return y$5(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(f$5.message,async e=>{const{topic:t,message:i}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{isJsonRpcRequest(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):isJsonRpcResponse(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id));}catch(r){this.logger.error(r);}});}registerExpirerEvents(){this.core.expirer.on(C$2.expired,async e=>{const{topic:t}=l0(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(q$2.expire,{topic:t}));});}}class qt extends h$1{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new EventEmitter$2,this.name=It,this.version=Ct$1,this.cached=[],this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0);},this.set=(i,s,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:s,chainId:r}),this.records.has(s.id))return;const n={id:s.id,topic:i,request:{method:s.method,params:s.params||null},chainId:r,expiry:d0(cjs$3.THIRTY_DAYS)};this.records.set(n.id,n),this.persist(),this.events.emit(I$1.created,n);},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const s=await this.getRecord(i.id);typeof s.response>"u"&&(s.response=isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(s.id,s),this.persist(),this.events.emit(I$1.updated,s));},this.get=async(i,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:s}),await this.getRecord(s)),this.delete=(i,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(r=>{if(r.topic===i){if(typeof s<"u"&&r.id!==s)return;this.records.delete(r.id),this.events.emit(I$1.deleted,r);}}),this.persist();},this.exists=async(i,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===i:!1),this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.logger=E$5(t,this.name);}get context(){return y$5(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 e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e);}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(I$1.sync);}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values});}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e);}}registerEventListeners(){this.events.on(I$1.created,e=>{const t=I$1.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e});}),this.events.on(I$1.updated,e=>{const t=I$1.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e});}),this.events.on(I$1.deleted,e=>{const t=I$1.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e});}),this.core.heartbeat.on(r$2.pulse,()=>{this.cleanup();});}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{cjs$3.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(I$1.deleted,t,!1),e=!0);}),e&&this.persist();}catch(e){this.logger.warn(e);}}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class jt extends E$4{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new EventEmitter$2,this.name=Tt,this.version=_t,this.cached=[],this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0);},this.has=i=>{try{const s=this.formatTarget(i);return typeof this.getExpiration(s)<"u"}catch{return !1}},this.set=(i,s)=>{this.isInitialized();const r=this.formatTarget(i),n={target:r,expiry:s};this.expirations.set(r,n),this.checkExpiry(r,n),this.events.emit(C$2.created,{target:r,expiration:n});},this.get=i=>{this.isInitialized();const s=this.formatTarget(i);return this.getExpiration(s)},this.del=i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),r=this.getExpiration(s);this.expirations.delete(s),this.events.emit(C$2.deleted,{target:s,expiration:r});}},this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.logger=E$5(t,this.name);}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return h0(e);if(typeof e=="number")return c0(e);const{message:t}=xe$1("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e);}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(C$2.sync);}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values});}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e);}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;cjs$3.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t);}expire(e,t){this.expirations.delete(e),this.events.emit(C$2.expired,{target:e,expiration:t});}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e));}registerEventListeners(){this.core.heartbeat.on(r$2.pulse,()=>this.checkExpirations()),this.events.on(C$2.created,e=>{const t=C$2.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist();}),this.events.on(C$2.expired,e=>{const t=C$2.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist();}),this.events.on(C$2.deleted,e=>{const t=C$2.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist();});}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Gt extends y$4{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=ee$1,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async i=>{if(this.verifyDisabled||er()||!pr())return;const s=this.getVerifyUrl(i?.verifyUrl);this.verifyUrl!==s&&this.removeIframe(),this.verifyUrl=s;try{await this.createIframe();}catch(r){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(r);}if(!this.initialized){this.removeIframe(),this.verifyUrl=te$1;try{await this.createIframe();}catch(r){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(r),this.verifyDisabled=!0;}}},this.register=async i=>{this.initialized?this.sendPost(i.attestationId):(this.addToQueue(i.attestationId),await this.init());},this.resolve=async i=>{if(this.isDevEnv)return "";const s=this.getVerifyUrl(i?.verifyUrl);let r;try{r=await this.fetchAttestation(i.attestationId,s);}catch(n){this.logger.info(`failed to resolve attestation: ${i.attestationId} from url: ${s}`),this.logger.info(n),r=await this.fetchAttestation(i.attestationId,te$1);}return r},this.fetchAttestation=async(i,s)=>{this.logger.info(`resolving attestation: ${i} from url: ${s}`);const r=this.startAbortTimer(cjs$3.ONE_SECOND*2),n=await fetch(`${s}/attestation/${i}`,{signal:this.abortController.signal});return clearTimeout(r),n.status===200?await n.json():void 0},this.addToQueue=i=>{this.queue.push(i);},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(i=>this.sendPost(i)),this.queue=[]);},this.sendPost=i=>{var s;try{if(!this.iframe)return;(s=this.iframe.contentWindow)==null||s.postMessage(i,"*"),this.logger.info(`postMessage sent: ${i} ${this.verifyUrl}`);}catch{}},this.createIframe=async()=>{let i;const s=r=>{r.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",s),i());};await Promise.race([new Promise(r=>{const n=document.getElementById(ee$1);if(n)return this.iframe=n,this.onInit(),r();window.addEventListener("message",s);const a=document.createElement("iframe");a.id=ee$1,a.src=`${this.verifyUrl}/${this.projectId}`,a.style.display="none",document.body.append(a),this.iframe=a,i=r;}),new Promise((r,n)=>setTimeout(()=>{window.removeEventListener("message",s),n("verify iframe load timeout");},cjs$3.toMiliseconds(cjs$3.FIVE_SECONDS)))]);},this.onInit=()=>{this.initialized=!0,this.processQueue();},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1);},this.getVerifyUrl=i=>{let s=i||M$3;return Rt.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${M$3}`),s=M$3),s},this.logger=E$5(t,this.name),this.verifyUrl=M$3,this.abortController=new AbortController,this.isDevEnv=pi$1()&&process.env.IS_VITEST;}get context(){return y$5(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$3.toMiliseconds(e))}}let Yt$1 = class Yt extends v$3{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=St,this.registerDeviceToken=async i=>{const{clientId:s,token:r,notificationType:n,enableEncrypted:a=!1}=i,h=`${Pt}/${this.projectId}/clients`;await Yi$1(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:n,token:r,always_raw:a})});},this.logger=E$5(t,this.context);}};var Ur=Object.defineProperty,Ht=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Jt$1=(o,e,t)=>e in o?Ur(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Xt$1=(o,e)=>{for(var t in e||(e={}))Fr.call(e,t)&&Jt$1(o,t,e[t]);if(Ht)for(var t of Ht(e))$r.call(e,t)&&Jt$1(o,t,e[t]);return o};let ie$2 = class ie extends n$2{constructor(e){var t;super(e),this.protocol=De$1,this.version=Qe$2,this.name=Z$1,this.events=new EventEmitter$2,this.initialized=!1,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||me$1,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=k$1({level:typeof e?.logger=="string"&&e.logger?e.logger:Ze$2.logger}),{logger:s,chunkLoggerController:r}=A$1({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=r,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var n,a;(n=this.logChunkController)!=null&&n.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}));}),this.logger=E$5(s,this.name),this.heartbeat=new i$4,this.crypto=new Ot(this,this.logger,e?.keychain),this.history=new qt(this,this.logger),this.expirer=new jt(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new h$2(Xt$1(Xt$1({},et),e?.storageOptions)),this.relayer=new $t({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Vt(this,this.logger),this.verify=new Gt(this.projectId||"",this.logger),this.echoClient=new Yt$1(this.projectId||"",this.logger);}static async init(e){const t=new ie(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(mt,i),t}get context(){return y$5(this.logger)}async start(){this.initialized||await this.initialize();}async getLogsBlob(){var e;return (e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}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.initialized=!0,this.logger.info("Core Initialization Success");}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const Br=ie$2;
|
|
79806
|
+
function Hi$1(o,e){if(o.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var s=0;s<o.length;s++){var r=o.charAt(s),n=r.charCodeAt(0);if(t[n]!==255)throw new TypeError(r+" is ambiguous");t[n]=s;}var a=o.length,h=o.charAt(0),l=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function g(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return "";for(var p=0,T=0,D=0,P=u.length;D!==P&&u[D]===0;)D++,p++;for(var x=(P-D)*d+1>>>0,w=new Uint8Array(x);D!==P;){for(var O=u[D],N=0,_=x-1;(O!==0||N<T)&&_!==-1;_--,N++)O+=256*w[_]>>>0,w[_]=O%a>>>0,O=O/a>>>0;if(O!==0)throw new Error("Non-zero carry");T=N,D++;}for(var A=x-T;A!==x&&w[A]===0;)A++;for(var G=h.repeat(p);A<x;++A)G+=o.charAt(w[A]);return G}function m(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;var p=0;if(u[p]!==" "){for(var T=0,D=0;u[p]===h;)T++,p++;for(var P=(u.length-p)*l+1>>>0,x=new Uint8Array(P);u[p];){var w=t[u.charCodeAt(p)];if(w===255)return;for(var O=0,N=P-1;(w!==0||O<D)&&N!==-1;N--,O++)w+=a*x[N]>>>0,x[N]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=O,p++;}if(u[p]!==" "){for(var _=P-D;_!==P&&x[_]===0;)_++;for(var A=new Uint8Array(T+(P-_)),G=T;_!==P;)A[G++]=x[_++];return A}}}function L(u){var p=m(u);if(p)return p;throw new Error(`Non-${e} character`)}return {encode:g,decodeUnsafe:m,decode:L}}var Ji$1=Hi$1,Xi$1=Ji$1;const Ue$2=o=>{if(o instanceof Uint8Array&&o.constructor.name==="Uint8Array")return o;if(o instanceof ArrayBuffer)return new Uint8Array(o);if(ArrayBuffer.isView(o))return new Uint8Array(o.buffer,o.byteOffset,o.byteLength);throw new Error("Unknown type, must be binary type")},Wi$2=o=>new TextEncoder().encode(o),Qi$1=o=>new TextDecoder().decode(o);let Zi$1 = class Zi{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i;}encode(e){if(e instanceof Uint8Array)return `${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};let es$1 = class es{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i;}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Fe$2(this,e)}};let ts$1 = class ts{constructor(e){this.decoders=e;}or(e){return Fe$2(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Fe$2=(o,e)=>new ts$1({...o.decoders||{[o.prefix]:o},...e.decoders||{[e.prefix]:e}});let is$1 = class is{constructor(e,t,i,s){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=s,this.encoder=new Zi$1(e,t,i),this.decoder=new es$1(e,t,s);}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Q$2=({name:o,prefix:e,encode:t,decode:i})=>new is$1(o,e,t,i),V$1=({prefix:o,name:e,alphabet:t})=>{const{encode:i,decode:s}=Xi$1(t,e);return Q$2({prefix:o,name:e,encode:i,decode:r=>Ue$2(s(r))})},ss$1=(o,e,t,i)=>{const s={};for(let d=0;d<e.length;++d)s[e[d]]=d;let r=o.length;for(;o[r-1]==="=";)--r;const n=new Uint8Array(r*t/8|0);let a=0,h=0,l=0;for(let d=0;d<r;++d){const g=s[o[d]];if(g===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<t|g,a+=t,a>=8&&(a-=8,n[l++]=255&h>>a);}if(a>=t||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return n},rs$1=(o,e,t)=>{const i=e[e.length-1]==="=",s=(1<<t)-1;let r="",n=0,a=0;for(let h=0;h<o.length;++h)for(a=a<<8|o[h],n+=8;n>t;)n-=t,r+=e[s&a>>n];if(n&&(r+=e[s&a<<t-n]),i)for(;r.length*t&7;)r+="=";return r},y$3=({name:o,prefix:e,bitsPerChar:t,alphabet:i})=>Q$2({prefix:e,name:o,encode(s){return rs$1(s,i,t)},decode(s){return ss$1(s,i,t,o)}}),ns$1=Q$2({prefix:"\0",name:"identity",encode:o=>Qi$1(o),decode:o=>Wi$2(o)});var os=Object.freeze({__proto__:null,identity:ns$1});const as=y$3({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs=Object.freeze({__proto__:null,base2:as});const cs=y$3({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ls=Object.freeze({__proto__:null,base8:cs});const us=V$1({prefix:"9",name:"base10",alphabet:"0123456789"});var ds=Object.freeze({__proto__:null,base10:us});const gs=y$3({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps=y$3({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds=Object.freeze({__proto__:null,base16:gs,base16upper:ps});const ys=y$3({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms=y$3({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs=y$3({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs=y$3({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es=y$3({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws$1=y$3({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs=y$3({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is=y$3({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs=y$3({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ts=Object.freeze({__proto__:null,base32:ys,base32upper:ms,base32pad:bs,base32padupper:fs,base32hex:Es,base32hexupper:ws$1,base32hexpad:vs,base32hexpadupper:Is,base32z:Cs});const _s=V$1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Rs=V$1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss=Object.freeze({__proto__:null,base36:_s,base36upper:Rs});const Ps=V$1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs$1=V$1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os=Object.freeze({__proto__:null,base58btc:Ps,base58flickr:xs$1});const As=y$3({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs=y$3({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns=y$3({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ls=y$3({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Us=Object.freeze({__proto__:null,base64:As,base64pad:zs,base64url:Ns,base64urlpad:Ls});const $e$1=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Fs=$e$1.reduce((o,e,t)=>(o[t]=e,o),[]),$s=$e$1.reduce((o,e,t)=>(o[e.codePointAt(0)]=t,o),[]);function Bs(o){return o.reduce((e,t)=>(e+=Fs[t],e),"")}function Ms(o){const e=[];for(const t of o){const i=$s[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i);}return new Uint8Array(e)}const ks=Q$2({prefix:"\u{1F680}",name:"base256emoji",encode:Bs,decode:Ms});var Ks=Object.freeze({__proto__:null,base256emoji:ks});new TextEncoder,new TextDecoder;const Je$2={...os,...hs,...ls,...ds,...Ds,...Ts,...Ss,...Os,...Us,...Ks};function Dr(o=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(o):new Uint8Array(o)}function Xe$2(o,e,t,i){return {name:o,prefix:e,encoder:{name:o,prefix:e,encode:t},decoder:{decode:i}}}const We$2=Xe$2("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),pe$1=Xe$2("ascii","a",o=>{let e="a";for(let t=0;t<o.length;t++)e+=String.fromCharCode(o[t]);return e},o=>{o=o.substring(1);const e=Dr(o.length);for(let t=0;t<o.length;t++)e[t]=o.charCodeAt(t);return e}),yr={utf8:We$2,"utf-8":We$2,hex:Je$2.base16,latin1:pe$1,ascii:pe$1,binary:pe$1,...Je$2};function mr(o,e="utf8"){const t=yr[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return (e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(o,"utf8"):t.decoder.decode(`${t.prefix}${o}`)}const De$1="wc",Qe$2=2,Z$1="core",z$3=`${De$1}@2:${Z$1}:`,Ze$2={name:Z$1,logger:"error"},et={database:":memory:"},tt="crypto",ye$1="client_ed25519_seed",it=cjs$3.ONE_DAY,st="keychain",rt="0.3",nt="messages",ot="0.3",at=cjs$3.SIX_HOURS,ht="publisher",ct="irn",lt="error",me$1="wss://relay.walletconnect.com",be$1="wss://relay.walletconnect.org",ut="relayer",f$5={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"},dt="_subscription",E$3={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},gt=cjs$3.ONE_SECOND,pt="2.13.0",Dt=1e4,yt="0.3",mt="WALLETCONNECT_CLIENT_ID",S$2={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},bt="subscription",ft$1="0.3",Et=cjs$3.FIVE_SECONDS*1e3,wt="pairing",vt="0.3",B$1={wc_pairingDelete:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:cjs$3.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:cjs$3.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:0},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:0}}},q$2={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},I$1={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},It="history",Ct$1="0.3",Tt="expirer",C$2={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},_t="0.3",ee$1="verify-api",M$3="https://verify.walletconnect.com",te$1="https://verify.walletconnect.org",Rt=[M$3,te$1],St="echo",Pt="https://echo.walletconnect.com";class xt{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=st,this.version=rt,this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0;}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,s)=>{this.isInitialized(),this.keychain.set(i,s),await this.persist();},this.get=i=>{this.isInitialized();const s=this.keychain.get(i);if(typeof s>"u"){const{message:r}=xe$1("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(r)}return s},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist();},this.core=e,this.logger=E$5(t,this.name);}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,i0(e));}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?n0(e):void 0}async persist(){await this.setKeyChain(this.keychain);}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ot{constructor(e,t,i){this.core=e,this.logger=t,this.name=tt,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()=>{this.isInitialized();const s=await this.getClientSeed(),r=generateKeyPair(s);return encodeIss(r.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const s=mu();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const r=await this.getClientSeed(),n=generateKeyPair(r),a=gu(),h=it;return await signJWT(a,s,h,n)},this.generateSharedKey=(s,r,n)=>{this.isInitialized();const a=this.getPrivateKey(s),h=Au(a,r);return this.setSymKey(h,n)},this.setSymKey=async(s,r)=>{this.isInitialized();const n=r||bu(s);return await this.keychain.set(n,s),n},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,r,n)=>{this.isInitialized();const a=eo(n),h=safeJsonStringify(r);if(Eu(a)){const m=a.senderPublicKey,L=a.receiverPublicKey;s=await this.generateSharedKey(m,L);}const l=this.getSymKey(s),{type:d,senderPublicKey:g}=a;return wu({type:d,symKey:l,message:h,senderPublicKey:g})},this.decode=async(s,r,n)=>{this.isInitialized();const a=Mu(r,n);if(Eu(a)){const h=a.receiverPublicKey,l=a.senderPublicKey;s=await this.generateSharedKey(h,l);}try{const h=this.getSymKey(s),l=xu({symKey:h,encoded:r});return safeJsonParse(l)}catch(h){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(h);}},this.getPayloadType=s=>{const r=Xi$2(s);return Mr(r.type)},this.getPayloadSenderPublicKey=s=>{const r=Xi$2(s);return r.senderPublicKey?toString$2(r.senderPublicKey,zt$1):void 0},this.core=e,this.logger=E$5(t,this.name),this.keychain=i||new xt(this.core,this.logger);}get context(){return y$5(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(ye$1);}catch{e=gu(),await this.keychain.set(ye$1,e);}return mr(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class At extends a$1{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=nt,this.version=ot,this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size});}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i);}finally{this.initialized=!0;}}},this.set=async(i,s)=>{this.isInitialized();const r=yu(s);let n=this.messages.get(i);return typeof n>"u"&&(n={}),typeof n[r]<"u"||(n[r]=s,this.messages.set(i,n),await this.persist()),r},this.get=i=>{this.isInitialized();let s=this.messages.get(i);return typeof s>"u"&&(s={}),s},this.has=(i,s)=>{this.isInitialized();const r=this.get(i),n=yu(s);return typeof r[n]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist();},this.logger=E$5(e,this.name),this.core=t;}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,i0(e));}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?n0(e):void 0}async persist(){await this.setRelayerMessages(this.messages);}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class vr extends u$1{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new EventEmitter$2,this.name=ht,this.queue=new Map,this.publishTimeout=cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),this.failedPublishTimeout=cjs$3.toMiliseconds(cjs$3.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,s,r)=>{var n;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:s,opts:r}});const a=r?.ttl||at,h=Su(r),l=r?.prompt||!1,d=r?.tag||0,g=r?.id||getBigIntRpcId().toString(),m={topic:i,message:s,opts:{ttl:a,relay:h,prompt:l,tag:d,id:g}},L=`Failed to publish payload, please try again. id:${g} tag:${d}`,u=Date.now();let p,T=1;try{for(;p===void 0;){if(Date.now()-u>this.publishTimeout)throw new Error(L);this.logger.trace({id:g,attempts:T},`publisher.publish - attempt ${T}`),p=await await u0(this.rpcPublish(i,s,a,h,l,d,g).catch(D=>this.logger.warn(D)),this.publishTimeout,L),T++,p||await new Promise(D=>setTimeout(D,this.failedPublishTimeout));}this.relayer.events.emit(f$5.publish,m),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:g,topic:i,message:s,opts:r}});}catch(D){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(D),(n=r?.internal)!=null&&n.throwOnFailedPublish)throw D;this.queue.set(g,m);}},this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.relayer=e,this.logger=E$5(t,this.name),this.registerEventListeners();}get context(){return y$5(this.logger)}rpcPublish(e,t,i,s,r,n,a){var h,l,d,g;const m={method:Nu(s.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:r,tag:n},id:a};return Pe$1((h=m.params)==null?void 0:h.prompt)&&((l=m.params)==null||delete l.prompt),Pe$1((d=m.params)==null?void 0:d.tag)&&((g=m.params)==null||delete g.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:m}),this.relayer.request(m)}removeRequestFromQueue(e){this.queue.delete(e);}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:s}=e;await this.publish(t,i,s);});}registerEventListeners(){this.relayer.core.heartbeat.on(r$2.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(f$5.connection_stalled);return}this.checkQueue();}),this.relayer.on(f$5.message_ack,e=>{this.removeRequestFromQueue(e.id.toString());});}}class Ir{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t]);},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const s=i.filter(r=>r!==t);if(!s.length){this.map.delete(e);return}this.map.set(e,s);},this.clear=()=>{this.map.clear();};}get topics(){return Array.from(this.map.keys())}}var Cr=Object.defineProperty,Tr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,zt=Object.getOwnPropertySymbols,Rr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Nt=(o,e,t)=>e in o?Cr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,j$2=(o,e)=>{for(var t in e||(e={}))Rr.call(e,t)&&Nt(o,t,e[t]);if(zt)for(var t of zt(e))Sr.call(e,t)&&Nt(o,t,e[t]);return o},fe$1=(o,e)=>Tr(o,_r(e));class Lt extends d$1{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Ir,this.events=new EventEmitter$2,this.name=bt,this.version=ft$1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=z$3,this.subscribeTimeout=cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId());},this.subscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}});try{const r=Su(s),n={topic:i,relay:r};this.pending.set(i,n);const a=await this.rpcSubscribe(i,r);return typeof a=="string"&&(this.onSubscribe(a,n),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}})),a}catch(r){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(r),r}},this.unsubscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),typeof s?.id<"u"?await this.unsubscribeById(i,s.id,s):await this.unsubscribeByTopic(i,s);},this.isSubscribed=async i=>{if(this.topics.includes(i))return !0;const s=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((r,n)=>{const a=new cjs$3.Watch;a.start(s);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),a.stop(s),r(!0)),a.elapsed(s)>=Et&&(clearInterval(h),a.stop(s),n(new Error("Subscription resolution timeout")));},this.pollingInterval);}).catch(()=>!1)},this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.start=async()=>{await this.onConnect();},this.stop=async()=>{await this.onDisconnect();},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1;},this.relayer=e,this.logger=E$5(t,this.name),this.clientId="";}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t;}catch{}return i}onEnable(){this.cached=[],this.initialized=!0;}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear();}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async s=>await this.unsubscribeById(e,s,t)));}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const s=Su(i);await this.rpcUnsubscribe(e,t,s);const r=tr("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,r),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(e,t){const i={method:Nu(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await u0(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)?yu(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(f$5.connection_stalled);}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Nu(t.protocol).batchSubscribe,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await u0(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(f$5.connection_stalled);}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:Nu(t.protocol).batchFetchMessages,params:{topics:e.map(r=>r.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let s;try{s=await await u0(this.relayer.request(i).catch(r=>this.logger.warn(r)),this.subscribeTimeout);}catch{this.relayer.events.emit(f$5.connection_stalled);}return s}rpcUnsubscribe(e,t,i){const s={method:Nu(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,t){this.setSubscription(e,fe$1(j$2({},t),{id:e})),this.pending.delete(t.topic);}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,j$2({},t)),this.pending.delete(t.topic);});}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e);}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e);}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t);}addSubscription(e,t){this.subscriptions.set(e,j$2({},t)),this.topicMap.set(t.topic,e),this.events.emit(S$2.created,t);}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(S$2.deleted,fe$1(j$2({},i),{reason:t}));}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(S$2.sync);}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i);}}this.events.emit(S$2.resubscribed);}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values});}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e);}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Er(t)&&this.onBatchSubscribe(t.map((i,s)=>fe$1(j$2({},e[s]),{id:i})));}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(t.messages));}async onConnect(){await this.restart(),this.onEnable();}onDisconnect(){this.onDisable();}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t);}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[]);}registerEventListeners(){this.relayer.core.heartbeat.on(r$2.pulse,async()=>{await this.checkPending();}),this.events.on(S$2.created,async e=>{const t=S$2.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist();}),this.events.on(S$2.deleted,async e=>{const t=S$2.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist();});}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e());},this.pollingInterval);});}}var Pr=Object.defineProperty,Ut=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Ft=(o,e,t)=>e in o?Pr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Ar=(o,e)=>{for(var t in e||(e={}))xr.call(e,t)&&Ft(o,t,e[t]);if(Ut)for(var t of Ut(e))Or.call(e,t)&&Ft(o,t,e[t]);return o};class $t extends g$3{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new EventEmitter$2,this.name=ut,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=cjs$3.toMiliseconds(cjs$3.THIRTY_SECONDS+cjs$3.ONE_SECOND),this.request=async t=>{var i,s;this.logger.debug("Publishing Request Payload");const r=t.id||getBigIntRpcId().toString();await this.toEstablishConnection();try{const n=this.provider.request(t);this.requestsInFlight.set(r,{promise:n,request:t}),this.logger.trace({id:r,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(h,l)=>{const d=()=>{l(new Error(`relayer.request - publish interrupted, id: ${r}`));};this.provider.on(E$3.disconnect,d);const g=await n;this.provider.off(E$3.disconnect,d),h(g);});return this.logger.trace({id:r,method:t.method,topic:(s=t.params)==null?void 0:s.topic},"relayer.request - published"),a}catch(n){throw this.logger.debug(`Failed to Publish Request: ${r}`),n}finally{this.requestsInFlight.delete(r);}},this.resetPingTimeout=()=>{if(pi$1())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,i,s;(s=(i=(t=this.provider)==null?void 0:t.connection)==null?void 0:i.socket)==null||s.terminate();},this.heartBeatTimeout);}catch(t){this.logger.warn(t);}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout();},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(f$5.connect);},this.onDisconnectHandler=()=>{this.onProviderDisconnect();},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(f$5.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose();},this.registerProviderListeners=()=>{this.provider.on(E$3.payload,this.onPayloadHandler),this.provider.on(E$3.connect,this.onConnectHandler),this.provider.on(E$3.disconnect,this.onDisconnectHandler),this.provider.on(E$3.error,this.onProviderErrorHandler);},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?E$5(e.logger,this.name):Hg$1(k$1({level:e.logger||lt})),this.messages=new At(this.logger,e.core),this.subscriber=new Lt(this,this.logger),this.publisher=new vr(this,this.logger),this.relayUrl=e?.relayUrl||me$1,this.projectId=e.projectId,this.bundleId=Wo(),this.provider={};}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen();}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${be$1}...`),await this.restartTransport(be$1);}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1);},Dt);}get context(){return y$5(this.logger)}get connected(){var e,t,i;return ((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1}get connecting(){var e,t,i;return ((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()});}async subscribe(e,t){var i;this.isInitialized();let s=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",r;const n=a=>{a.topic===e&&(this.subscriber.off(S$2.created,n),r());};return await Promise.all([new Promise(a=>{r=a,this.subscriber.on(S$2.created,n);}),new Promise(async a=>{s=await this.subscriber.subscribe(e,t)||s,a();})]),s}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t);}on(e,t){this.events.on(e,t);}once(e,t){this.events.once(e,t);}off(e,t){this.events.off(e,t);}removeListener(e,t){this.events.removeListener(e,t);}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise));}catch(e){this.logger.warn(e);}this.hasExperiencedNetworkDisruption||this.connected?await u0(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect();}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect();}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,i)=>{const s=()=>{this.provider.off(E$3.disconnect,s),i(new Error("Connection interrupted while trying to subscribe"));};this.provider.on(E$3.disconnect,s),await u0(this.provider.connect(),cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(r=>{i(r);}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,t();});}catch(t){this.logger.error(t);const i=t;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw t}finally{this.connectionAttemptInProgress=!1;}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen());}async confirmOnlineStateOrThrow(){if(!await hh$1())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,s)=>i.publishedAt-s.publishedAt);this.logger.trace(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i);}catch(s){this.logger.warn(s);}this.logger.trace(`Batch of ${t.length} message events processed`);}startPingTimeout(){var e,t,i,s,r;if(pi$1())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((r=(s=(i=this.provider)==null?void 0:i.connection)==null?void 0:s.socket)==null||r.once("ping",()=>{this.resetPingTimeout();})),this.resetPingTimeout();}catch(n){this.logger.warn(n);}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new o$1(new f$6($o({sdkVersion:pt,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i);}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const s=this.messages.has(t,i);return s&&this.logger.debug(`Ignoring duplicate message: ${i}`),s}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),isJsonRpcRequest(e)){if(!e.method.endsWith(dt))return;const t=e.params,{topic:i,message:s,publishedAt:r}=t.data,n={topic:i,message:s,publishedAt:r};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar({type:"event",event:t.id},n)),this.events.emit(t.id,n),await this.acknowledgePayload(e),await this.onMessageEvent(n);}else isJsonRpcResponse(e)&&this.events.emit(f$5.message_ack,e);}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(f$5.message,e),await this.recordMessageEvent(e));}async acknowledgePayload(e){const t=formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t);}unregisterProviderListeners(){this.provider.off(E$3.payload,this.onPayloadHandler),this.provider.off(E$3.connect,this.onConnectHandler),this.provider.off(E$3.disconnect,this.onDisconnectHandler),this.provider.off(E$3.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout);}async registerEventListeners(){let e=await hh$1();ch$1(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1));});}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(f$5.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e));},cjs$3.toMiliseconds(gt));}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e());},this.connectionStatusPollingInterval);}),await this.transportOpen());}}var zr=Object.defineProperty,Bt$1=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,Mt=(o,e,t)=>e in o?zr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,kt=(o,e)=>{for(var t in e||(e={}))Nr.call(e,t)&&Mt(o,t,e[t]);if(Bt$1)for(var t of Bt$1(e))Lr.call(e,t)&&Mt(o,t,e[t]);return o};class Kt extends p$6{constructor(e,t,i,s=z$3,r=void 0){super(e,t,i,s),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=yt,this.cached=[],this.initialized=!1,this.storagePrefix=z$3,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>{this.getKey&&n!==null&&!Pe$1(n)?this.map.set(this.getKey(n),n):Gu(n)?this.map.set(n.id,n):Yu(n)&&this.map.set(n.topic,n);}),this.cached=[],this.initialized=!0);},this.set=async(n,a)=>{this.isInitialized(),this.map.has(n)?await this.update(n,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:n,value:a}),this.map.set(n,a),await this.persist());},this.get=n=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:n}),this.getData(n)),this.getAll=n=>(this.isInitialized(),n?this.values.filter(a=>Object.keys(n).every(h=>Gi$1(a[h],n[h]))):this.values),this.update=async(n,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:n,update:a});const h=kt(kt({},this.getData(n)),a);this.map.set(n,h),await this.persist();},this.delete=async(n,a)=>{this.isInitialized(),this.map.has(n)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:n,reason:a}),this.map.delete(n),this.addToRecentlyDeleted(n),await this.persist());},this.logger=E$5(t,this.name),this.storagePrefix=s,this.getKey=r;}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2);}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e);}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:s}=xe$1("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values);}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values});}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e);}}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Vt{constructor(e,t){this.core=e,this.logger=t,this.name=wt,this.version=vt,this.events=new EventEmitter$2,this.initialized=!1,this.storagePrefix=z$3,this.ignoredPayloadTypes=[lr$1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"));},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])];},this.create=async i=>{this.isInitialized();const s=gu(),r=await this.core.crypto.setSymKey(s),n=d0(cjs$3.FIVE_MINUTES),a={protocol:ct},h={topic:r,expiry:n,relay:a,active:!1},l=Du({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:s,relay:a,expiryTimestamp:n,methods:i?.methods});return this.core.expirer.set(r,n),await this.pairings.set(r,h),await this.core.relayer.subscribe(r),{topic:r,uri:l}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);const{topic:s,symKey:r,relay:n,expiryTimestamp:a,methods:h}=Pu(i.uri);let l;if(this.pairings.keys.includes(s)&&(l=this.pairings.get(s),l.active))throw new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);const d=a||d0(cjs$3.FIVE_MINUTES),g={topic:s,relay:n,expiry:d,active:!1,methods:h};return this.core.expirer.set(s,d),await this.pairings.set(s,g),i.activatePairing&&await this.activate({topic:s}),this.events.emit(q$2.create,g),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(r,s),await this.core.relayer.subscribe(s,{relay:n}),g},this.activate=async({topic:i})=>{this.isInitialized();const s=d0(cjs$3.THIRTY_DAYS);this.core.expirer.set(i,s),await this.pairings.update(i,{active:!0,expiry:s});},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:s}=i;if(this.pairings.keys.includes(s)){const r=await this.sendRequest(s,"wc_pairingPing",{}),{done:n,resolve:a,reject:h}=a0();this.events.once(v0("pairing_ping",r),({error:l})=>{l?h(l):a();}),await n();}},this.updateExpiry=async({topic:i,expiry:s})=>{this.isInitialized(),await this.pairings.update(i,{expiry:s});},this.updateMetadata=async({topic:i,metadata:s})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:s});},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:s}=i;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(s));},this.sendRequest=async(i,s,r)=>{const n=formatJsonRpcRequest(s,r),a=await this.core.crypto.encode(i,n),h=B$1[s].req;return this.core.history.set(i,n),this.core.relayer.publish(i,a,h),n.id},this.sendResult=async(i,s,r)=>{const n=formatJsonRpcResult(i,r),a=await this.core.crypto.encode(s,n),h=await this.core.history.get(s,i),l=B$1[h.request.method].res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(n);},this.sendError=async(i,s,r)=>{const n=formatJsonRpcError(i,r),a=await this.core.crypto.encode(s,n),h=await this.core.history.get(s,i),l=B$1[h.request.method]?B$1[h.request.method].res:B$1.unregistered_method.res;await this.core.relayer.publish(s,a,l),await this.core.history.resolve(n);},this.deletePairing=async(i,s)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),s?Promise.resolve():this.core.expirer.del(i)]);},this.cleanup=async()=>{const i=this.pairings.getAll().filter(s=>p0(s.expiry));await Promise.all(i.map(s=>this.deletePairing(s.topic)));},this.onRelayEventRequest=i=>{const{topic:s,payload:r}=i;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(s,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(s,r);default:return this.onUnknownRpcMethodRequest(s,r)}},this.onRelayEventResponse=async i=>{const{topic:s,payload:r}=i,n=(await this.core.history.get(s,r.id)).request.method;switch(n){case"wc_pairingPing":return this.onPairingPingResponse(s,r);default:return this.onUnknownRpcMethodResponse(n)}},this.onPairingPingRequest=async(i,s)=>{const{id:r}=s;try{this.isValidPing({topic:i}),await this.sendResult(r,i,!0),this.events.emit(q$2.ping,{id:r,topic:i});}catch(n){await this.sendError(r,i,n),this.logger.error(n);}},this.onPairingPingResponse=(i,s)=>{const{id:r}=s;setTimeout(()=>{isJsonRpcResult(s)?this.events.emit(v0("pairing_ping",r),{}):isJsonRpcError(s)&&this.events.emit(v0("pairing_ping",r),{error:s.error});},500);},this.onPairingDeleteRequest=async(i,s)=>{const{id:r}=s;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(q$2.delete,{id:r,topic:i});}catch(n){await this.sendError(r,i,n),this.logger.error(n);}},this.onUnknownRpcMethodRequest=async(i,s)=>{const{id:r,method:n}=s;try{if(this.registeredMethods.includes(n))return;const a=tr("WC_METHOD_UNSUPPORTED",n);await this.sendError(r,i,a),this.logger.error(a);}catch(a){await this.sendError(r,i,a),this.logger.error(a);}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",i));},this.isValidPair=i=>{var s;if(!$u(i)){const{message:n}=xe$1("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!Ju(i.uri)){const{message:n}=xe$1("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}const r=Pu(i.uri);if(!((s=r?.relay)!=null&&s.protocol)){const{message:n}=xe$1("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(n)}if(!(r!=null&&r.symKey)){const{message:n}=xe$1("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(n)}if(r!=null&&r.expiryTimestamp&&cjs$3.toMiliseconds(r?.expiryTimestamp)<Date.now()){const{message:n}=xe$1("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(n)}},this.isValidPing=async i=>{if(!$u(i)){const{message:r}=xe$1("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(r)}const{topic:s}=i;await this.isValidPairingTopic(s);},this.isValidDisconnect=async i=>{if(!$u(i)){const{message:r}=xe$1("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(r)}const{topic:s}=i;await this.isValidPairingTopic(s);},this.isValidPairingTopic=async i=>{if(!Gt$1(i,!1)){const{message:s}=xe$1("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(s)}if(!this.pairings.keys.includes(i)){const{message:s}=xe$1("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(s)}if(p0(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:s}=xe$1("EXPIRED",`pairing topic: ${i}`);throw new Error(s)}},this.core=e,this.logger=E$5(t,this.name),this.pairings=new Kt(this.core,this.logger,this.name,this.storagePrefix);}get context(){return y$5(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(f$5.message,async e=>{const{topic:t,message:i}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(t,i);try{isJsonRpcRequest(s)?(this.core.history.set(t,s),this.onRelayEventRequest({topic:t,payload:s})):isJsonRpcResponse(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id));}catch(r){this.logger.error(r);}});}registerExpirerEvents(){this.core.expirer.on(C$2.expired,async e=>{const{topic:t}=l0(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(q$2.expire,{topic:t}));});}}class qt extends h$1{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new EventEmitter$2,this.name=It,this.version=Ct$1,this.cached=[],this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0);},this.set=(i,s,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:s,chainId:r}),this.records.has(s.id))return;const n={id:s.id,topic:i,request:{method:s.method,params:s.params||null},chainId:r,expiry:d0(cjs$3.THIRTY_DAYS)};this.records.set(n.id,n),this.persist(),this.events.emit(I$1.created,n);},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const s=await this.getRecord(i.id);typeof s.response>"u"&&(s.response=isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(s.id,s),this.persist(),this.events.emit(I$1.updated,s));},this.get=async(i,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:s}),await this.getRecord(s)),this.delete=(i,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(r=>{if(r.topic===i){if(typeof s<"u"&&r.id!==s)return;this.records.delete(r.id),this.events.emit(I$1.deleted,r);}}),this.persist();},this.exists=async(i,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===i:!1),this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.logger=E$5(t,this.name);}get context(){return y$5(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 e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e);}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(I$1.sync);}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values});}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e);}}registerEventListeners(){this.events.on(I$1.created,e=>{const t=I$1.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e});}),this.events.on(I$1.updated,e=>{const t=I$1.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e});}),this.events.on(I$1.deleted,e=>{const t=I$1.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e});}),this.core.heartbeat.on(r$2.pulse,()=>{this.cleanup();});}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{cjs$3.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(I$1.deleted,t,!1),e=!0);}),e&&this.persist();}catch(e){this.logger.warn(e);}}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class jt extends E$4{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new EventEmitter$2,this.name=Tt,this.version=_t,this.cached=[],this.initialized=!1,this.storagePrefix=z$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0);},this.has=i=>{try{const s=this.formatTarget(i);return typeof this.getExpiration(s)<"u"}catch{return !1}},this.set=(i,s)=>{this.isInitialized();const r=this.formatTarget(i),n={target:r,expiry:s};this.expirations.set(r,n),this.checkExpiry(r,n),this.events.emit(C$2.created,{target:r,expiration:n});},this.get=i=>{this.isInitialized();const s=this.formatTarget(i);return this.getExpiration(s)},this.del=i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),r=this.getExpiration(s);this.expirations.delete(s),this.events.emit(C$2.deleted,{target:s,expiration:r});}},this.on=(i,s)=>{this.events.on(i,s);},this.once=(i,s)=>{this.events.once(i,s);},this.off=(i,s)=>{this.events.off(i,s);},this.removeListener=(i,s)=>{this.events.removeListener(i,s);},this.logger=E$5(t,this.name);}get context(){return y$5(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return h0(e);if(typeof e=="number")return c0(e);const{message:t}=xe$1("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e);}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(C$2.sync);}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=xe$1("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values});}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e);}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=xe$1("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;cjs$3.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t);}expire(e,t){this.expirations.delete(e),this.events.emit(C$2.expired,{target:e,expiration:t});}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e));}registerEventListeners(){this.core.heartbeat.on(r$2.pulse,()=>this.checkExpirations()),this.events.on(C$2.created,e=>{const t=C$2.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist();}),this.events.on(C$2.expired,e=>{const t=C$2.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist();}),this.events.on(C$2.deleted,e=>{const t=C$2.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist();});}isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Gt extends y$4{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=ee$1,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async i=>{if(this.verifyDisabled||er()||!pr())return;const s=this.getVerifyUrl(i?.verifyUrl);this.verifyUrl!==s&&this.removeIframe(),this.verifyUrl=s;try{await this.createIframe();}catch(r){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(r);}if(!this.initialized){this.removeIframe(),this.verifyUrl=te$1;try{await this.createIframe();}catch(r){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(r),this.verifyDisabled=!0;}}},this.register=async i=>{this.initialized?this.sendPost(i.attestationId):(this.addToQueue(i.attestationId),await this.init());},this.resolve=async i=>{if(this.isDevEnv)return "";const s=this.getVerifyUrl(i?.verifyUrl);let r;try{r=await this.fetchAttestation(i.attestationId,s);}catch(n){this.logger.info(`failed to resolve attestation: ${i.attestationId} from url: ${s}`),this.logger.info(n),r=await this.fetchAttestation(i.attestationId,te$1);}return r},this.fetchAttestation=async(i,s)=>{this.logger.info(`resolving attestation: ${i} from url: ${s}`);const r=this.startAbortTimer(cjs$3.ONE_SECOND*2),n=await fetch(`${s}/attestation/${i}`,{signal:this.abortController.signal});return clearTimeout(r),n.status===200?await n.json():void 0},this.addToQueue=i=>{this.queue.push(i);},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(i=>this.sendPost(i)),this.queue=[]);},this.sendPost=i=>{var s;try{if(!this.iframe)return;(s=this.iframe.contentWindow)==null||s.postMessage(i,"*"),this.logger.info(`postMessage sent: ${i} ${this.verifyUrl}`);}catch{}},this.createIframe=async()=>{let i;const s=r=>{r.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",s),i());};await Promise.race([new Promise(r=>{const n=document.getElementById(ee$1);if(n)return this.iframe=n,this.onInit(),r();window.addEventListener("message",s);const a=document.createElement("iframe");a.id=ee$1,a.src=`${this.verifyUrl}/${this.projectId}`,a.style.display="none",document.body.append(a),this.iframe=a,i=r;}),new Promise((r,n)=>setTimeout(()=>{window.removeEventListener("message",s),n("verify iframe load timeout");},cjs$3.toMiliseconds(cjs$3.FIVE_SECONDS)))]);},this.onInit=()=>{this.initialized=!0,this.processQueue();},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1);},this.getVerifyUrl=i=>{let s=i||M$3;return Rt.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${M$3}`),s=M$3),s},this.logger=E$5(t,this.name),this.verifyUrl=M$3,this.abortController=new AbortController,this.isDevEnv=pi$1()&&process.env.IS_VITEST;}get context(){return y$5(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$3.toMiliseconds(e))}}let Yt$1 = class Yt extends v$3{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=St,this.registerDeviceToken=async i=>{const{clientId:s,token:r,notificationType:n,enableEncrypted:a=!1}=i,h=`${Pt}/${this.projectId}/clients`;await Yi$1(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:n,token:r,always_raw:a})});},this.logger=E$5(t,this.context);}};var Ur=Object.defineProperty,Ht=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Jt$1=(o,e,t)=>e in o?Ur(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Xt$1=(o,e)=>{for(var t in e||(e={}))Fr.call(e,t)&&Jt$1(o,t,e[t]);if(Ht)for(var t of Ht(e))$r.call(e,t)&&Jt$1(o,t,e[t]);return o};let ie$2 = class ie extends n$2{constructor(e){var t;super(e),this.protocol=De$1,this.version=Qe$2,this.name=Z$1,this.events=new EventEmitter$2,this.initialized=!1,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||me$1,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=k$1({level:typeof e?.logger=="string"&&e.logger?e.logger:Ze$2.logger}),{logger:s,chunkLoggerController:r}=A$1({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=r,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var n,a;(n=this.logChunkController)!=null&&n.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}));}),this.logger=E$5(s,this.name),this.heartbeat=new i$3,this.crypto=new Ot(this,this.logger,e?.keychain),this.history=new qt(this,this.logger),this.expirer=new jt(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new h$2(Xt$1(Xt$1({},et),e?.storageOptions)),this.relayer=new $t({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Vt(this,this.logger),this.verify=new Gt(this.projectId||"",this.logger),this.echoClient=new Yt$1(this.projectId||"",this.logger);}static async init(e){const t=new ie(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(mt,i),t}get context(){return y$5(this.logger)}async start(){this.initialized||await this.initialize();}async getLogsBlob(){var e;return (e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}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.initialized=!0,this.logger.info("Core Initialization Success");}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const Br=ie$2;
|
|
79807
79807
|
|
|
79808
79808
|
const Re$1="wc",Ee$1=2,Se$1="client",ie$1=`${Re$1}@${Ee$1}:${Se$1}:`,re$1={name:Se$1,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},_e="WALLETCONNECT_DEEPLINK_CHOICE",Ue$1="proposal",Ge$1="Proposal expired",ke$1="session",L$3=cjs$3.SEVEN_DAYS,Fe$1="engine",f$4={wc_sessionPropose:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1114},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:cjs$3.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:cjs$3.ONE_HOUR,prompt:!1,tag:1117}}},ne$1={min:cjs$3.FIVE_MINUTES,max:cjs$3.SEVEN_DAYS},D$2={idle:"IDLE",active:"ACTIVE"},Qe$1="request",je$1=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],ze$1="wc",He$1="auth",Ye$1="authKeys",Xe$1="pairingTopics",Je$1="requests",X$1=`${ze$1}@${1.5}:${He$1}:`,J=`${X$1}:PUB_KEY`;var Yt=Object.defineProperty,Xt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptors,Be$1=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable,We$1=(R,n,t)=>n in R?Yt(R,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):R[n]=t,y$2=(R,n)=>{for(var t in n||(n={}))Bt.call(n,t)&&We$1(R,t,n[t]);if(Be$1)for(var t of Be$1(n))Wt.call(n,t)&&We$1(R,t,n[t]);return R},M$2=(R,n)=>Xt(R,Jt(n));class Zt extends w$3{constructor(n){super(n),this.name=Fe$1,this.events=new EventEmitter$2,this.initialized=!1,this.requestQueue={state:D$2.idle,queue:[]},this.sessionRequestQueue={state:D$2.idle,queue:[]},this.requestQueueDelay=cjs$3.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(f$4)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue();},cjs$3.toMiliseconds(this.requestQueueDelay)));},this.connect=async t=>{await this.isInitialized();const e=M$2(y$2({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(e);const{pairingTopic:s,requiredNamespaces:i,optionalNamespaces:r,sessionProperties:o,relays:a}=e;let c=s,h,p=!1;try{c&&(p=this.client.core.pairing.pairings.get(c).active);}catch(P){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),P}if(!c||!p){const{topic:P,uri:v}=await this.client.core.pairing.create();c=P,h=v;}if(!c){const{message:P}=xe$1("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(P)}const g=await this.client.core.crypto.generateKeyPair(),d=f$4.wc_sessionPropose.req.ttl||cjs$3.FIVE_MINUTES,w=d0(d),m=y$2({requiredNamespaces:i,optionalNamespaces:r,relays:a??[{protocol:ct}],proposer:{publicKey:g,metadata:this.client.metadata},expiryTimestamp:w},o&&{sessionProperties:o}),{reject:E,resolve:O,done:S}=a0(d,Ge$1);this.events.once(v0("session_connect"),async({error:P,session:v})=>{if(P)E(P);else if(v){v.self.publicKey=g;const B=M$2(y$2({},v),{requiredNamespaces:m.requiredNamespaces,optionalNamespaces:m.optionalNamespaces});await this.client.session.set(v.topic,B),await this.setExpiry(v.topic,v.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:v.peer.metadata}),O(B);}});const N=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:m,throwOnFailedPublish:!0});return await this.setProposal(N,y$2({id:N},m)),{uri:h,approval:S}},this.pair=async t=>{await this.isInitialized();try{return await this.client.core.pairing.pair(t)}catch(e){throw this.client.logger.error("pair() failed"),e}},this.approve=async t=>{await this.isInitialized();try{await this.isValidApprove(t);}catch(S){throw this.client.logger.error("approve() -> isValidApprove() failed"),S}const{id:e,relayProtocol:s,namespaces:i,sessionProperties:r,sessionConfig:o}=t;let a;try{a=this.client.proposal.get(e);}catch(S){throw this.client.logger.error(`approve() -> proposal.get(${e}) failed`),S}let{pairingTopic:c,proposer:h,requiredNamespaces:p,optionalNamespaces:g}=a;c=c||"";const d=await this.client.core.crypto.generateKeyPair(),w=h.publicKey,m=await this.client.core.crypto.generateSharedKey(d,w),E=y$2(y$2({relay:{protocol:s??"irn"},namespaces:i,pairingTopic:c,controller:{publicKey:d,metadata:this.client.metadata},expiry:d0(L$3)},r&&{sessionProperties:r}),o&&{sessionConfig:o});await this.client.core.relayer.subscribe(m);const O=M$2(y$2({},E),{topic:m,requiredNamespaces:p,optionalNamespaces:g,pairingTopic:c,acknowledged:!1,self:E.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:d});await this.client.session.set(m,O);try{await this.sendResult({id:e,topic:c,result:{relay:{protocol:s??"irn"},responderPublicKey:d},throwOnFailedPublish:!0}),await this.sendRequest({topic:m,method:"wc_sessionSettle",params:E,throwOnFailedPublish:!0});}catch(S){throw this.client.logger.error(S),this.client.session.delete(m,tr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(m),S}return await this.client.core.pairing.updateMetadata({topic:c,metadata:h.metadata}),await this.client.proposal.delete(e,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:c}),await this.setExpiry(m,d0(L$3)),{topic:m,acknowledged:()=>new Promise(S=>setTimeout(()=>S(this.client.session.get(m)),500))}},this.reject=async t=>{await this.isInitialized();try{await this.isValidReject(t);}catch(r){throw this.client.logger.error("reject() -> isValidReject() failed"),r}const{id:e,reason:s}=t;let i;try{i=this.client.proposal.get(e).pairingTopic;}catch(r){throw this.client.logger.error(`reject() -> proposal.get(${e}) failed`),r}i&&(await this.sendError({id:e,topic:i,error:s}),await this.client.proposal.delete(e,tr("USER_DISCONNECTED")));},this.update=async t=>{await this.isInitialized();try{await this.isValidUpdate(t);}catch(p){throw this.client.logger.error("update() -> isValidUpdate() failed"),p}const{topic:e,namespaces:s}=t,{done:i,resolve:r,reject:o}=a0(),a=payloadId(),c=getBigIntRpcId().toString(),h=this.client.session.get(e).namespaces;return this.events.once(v0("session_update",a),({error:p})=>{p?o(p):r();}),await this.client.session.update(e,{namespaces:s}),await this.sendRequest({topic:e,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:a,relayRpcId:c}).catch(p=>{this.client.logger.error(p),this.client.session.update(e,{namespaces:h}),o(p);}),{acknowledged:i}},this.extend=async t=>{await this.isInitialized();try{await this.isValidExtend(t);}catch(a){throw this.client.logger.error("extend() -> isValidExtend() failed"),a}const{topic:e}=t,s=payloadId(),{done:i,resolve:r,reject:o}=a0();return this.events.once(v0("session_extend",s),({error:a})=>{a?o(a):r();}),await this.setExpiry(e,d0(L$3)),this.sendRequest({topic:e,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(a=>{o(a);}),{acknowledged:i}},this.request=async t=>{await this.isInitialized();try{await this.isValidRequest(t);}catch(d){throw this.client.logger.error("request() -> isValidRequest() failed"),d}const{chainId:e,request:s,topic:i,expiry:r=f$4.wc_sessionRequest.req.ttl}=t,o=this.client.session.get(i),a=payloadId(),c=getBigIntRpcId().toString(),{done:h,resolve:p,reject:g}=a0(r,"Request expired. Please try again.");return this.events.once(v0("session_request",a),({error:d,result:w})=>{d?g(d):p(w);}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,relayRpcId:c,topic:i,method:"wc_sessionRequest",params:{request:M$2(y$2({},s),{expiryTimestamp:d0(r)}),chainId:e},expiry:r,throwOnFailedPublish:!0}).catch(w=>g(w)),this.client.events.emit("session_request_sent",{topic:i,request:s,chainId:e,id:a}),d();}),new Promise(async d=>{var w;if(!((w=o.sessionConfig)!=null&&w.disableDeepLink)){const m=await g0(this.client.core.storage,_e);m0({id:a,topic:i,wcDeepLink:m});}d();}),h()]).then(d=>d[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:e,response:s}=t,{id:i}=s;isJsonRpcResult(s)?await this.sendResult({id:i,topic:e,result:s.result,throwOnFailedPublish:!0}):isJsonRpcError(s)&&await this.sendError({id:i,topic:e,error:s.error}),this.cleanupAfterResponse(t);},this.ping=async t=>{await this.isInitialized();try{await this.isValidPing(t);}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:e}=t;if(this.client.session.keys.includes(e)){const s=payloadId(),i=getBigIntRpcId().toString(),{done:r,resolve:o,reject:a}=a0();this.events.once(v0("session_ping",s),({error:c})=>{c?a(c):o();}),await Promise.all([this.sendRequest({topic:e,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:i}),r()]);}else this.client.core.pairing.pairings.keys.includes(e)&&await this.client.core.pairing.ping({topic:e});},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:e,event:s,chainId:i}=t,r=getBigIntRpcId().toString();await this.sendRequest({topic:e,method:"wc_sessionEvent",params:{event:s,chainId:i},throwOnFailedPublish:!0,relayRpcId:r});},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:e}=t;if(this.client.session.keys.includes(e))await this.sendRequest({topic:e,method:"wc_sessionDelete",params:tr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:e,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(e))await this.client.core.pairing.disconnect({topic:e});else {const{message:s}=xe$1("MISMATCHED_TOPIC",`Session or pairing topic not found: ${e}`);throw new Error(s)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(e=>Qu(e,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async t=>{this.isInitialized(),this.isValidAuthenticate(t);const{chains:e,statement:s="",uri:i,domain:r,nonce:o,type:a,exp:c,nbf:h,methods:p=[],expiry:g}=t,d=[...t.resources||[]],{topic:w,uri:m}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:m}});const E=await this.client.core.crypto.generateKeyPair(),O=bu(E);if(await Promise.all([this.client.auth.authKeys.set(J,{responseTopic:O,publicKey:E}),this.client.auth.pairingTopics.set(O,{topic:O,pairingTopic:w})]),await this.client.core.relayer.subscribe(O),this.client.logger.info(`sending request to new pairing topic: ${w}`),p.length>0){const{namespace:T}=dn(e[0]);let _=cu(T,"request",p);Qr(d)&&(_=lu(_,d.pop())),d.push(_);}const S=g&&g>f$4.wc_sessionAuthenticate.req.ttl?g:f$4.wc_sessionAuthenticate.req.ttl,N={authPayload:{type:a??"caip122",chains:e,statement:s,aud:i,domain:r,version:"1",nonce:o,iat:new Date().toISOString(),exp:c,nbf:h,resources:d},requester:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:d0(S)},P={eip155:{chains:e,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},v={requiredNamespaces:{},optionalNamespaces:P,relays:[{protocol:"irn"}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:d0(f$4.wc_sessionPropose.req.ttl)},{done:B,resolve:Ie,reject:ae}=a0(S,"Request expired"),W=async({error:T,session:_})=>{if(this.events.off(v0("session_request",K),ce),T)ae(T);else if(_){_.self.publicKey=E,await this.client.session.set(_.topic,_),await this.setExpiry(_.topic,_.expiry),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:_.peer.metadata});const j=this.client.session.get(_.topic);await this.deleteProposal(Q),Ie({session:j});}},ce=async T=>{if(await this.deletePendingAuthRequest(K,{message:"fulfilled",code:0}),T.error){const z=tr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return T.error.code===z.code?void 0:(this.events.off(v0("session_connect"),W),ae(T.error.message))}await this.deleteProposal(Q),this.events.off(v0("session_connect"),W);const{cacaos:_,responder:j}=T.result,le=[],fe=[];for(const z of _){await ou({cacao:z,projectId:this.client.core.projectId})||(this.client.logger.error(z,"Signature verification failed"),ae(tr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:he}=z,pe=Qr(he.resources),qe=[fu(he.iss)],et=Li$1(he.iss);if(pe){const de=du(pe),tt=pu(pe);le.push(...de),qe.push(...tt);}for(const de of qe)fe.push(`${de}:${et}`);}const Z=await this.client.core.crypto.generateSharedKey(E,j.publicKey);let ee;le.length>0&&(ee={topic:Z,acknowledged:!0,self:{publicKey:E,metadata:this.client.metadata},peer:j,controller:j.publicKey,expiry:d0(L$3),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:ju([...new Set(le)],[...new Set(fe)])},await this.client.core.relayer.subscribe(Z),await this.client.session.set(Z,ee),ee=this.client.session.get(Z)),Ie({auths:_,session:ee});},K=payloadId(),Q=payloadId();this.events.once(v0("session_connect"),W),this.events.once(v0("session_request",K),ce);try{await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:N,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:K}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:v,expiry:f$4.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:Q})]);}catch(T){throw this.events.off(v0("session_connect"),W),this.events.off(v0("session_request",K),ce),T}return await this.setProposal(Q,y$2({id:Q},v)),await this.setAuthRequest(K,{request:M$2(y$2({},N),{verifyContext:{}}),pairingTopic:w}),{uri:m,response:B}},this.approveSessionAuthenticate=async t=>{this.isInitialized();const{id:e,auths:s}=t,i=this.getPendingAuthRequest(e);if(!i)throw new Error(`Could not find pending auth request with id ${e}`);const r=i.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),a=bu(r),c={type:lr$1,receiverPublicKey:r,senderPublicKey:o},h=[],p=[];for(const w of s){if(!await ou({cacao:w,projectId:this.client.core.projectId})){const N=tr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:e,topic:a,error:N,encodeOpts:c}),new Error(N.message)}const{p:m}=w,E=Qr(m.resources),O=[fu(m.iss)],S=Li$1(m.iss);if(E){const N=du(E),P=pu(E);h.push(...N),O.push(...P);}for(const N of O)p.push(`${N}:${S}`);}const g=await this.client.core.crypto.generateSharedKey(o,r);let d;return h?.length>0&&(d={topic:g,acknowledged:!0,self:{publicKey:o,metadata:this.client.metadata},peer:{publicKey:r,metadata:i.requester.metadata},controller:r,expiry:d0(L$3),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:ju([...new Set(h)],[...new Set(p)])},await this.client.core.relayer.subscribe(g),await this.client.session.set(g,d)),await this.sendResult({topic:a,id:e,result:{cacaos:s,responder:{publicKey:o,metadata:this.client.metadata}},encodeOpts:c,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(e,{message:"fullfilled",code:0}),await this.client.core.pairing.activate({topic:i.pairingTopic}),{session:d}},this.rejectSessionAuthenticate=async t=>{await this.isInitialized();const{id:e,reason:s}=t,i=this.getPendingAuthRequest(e);if(!i)throw new Error(`Could not find pending auth request with id ${e}`);const r=i.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),a=bu(r),c={type:lr$1,receiverPublicKey:r,senderPublicKey:o};await this.sendError({id:e,topic:a,error:s,encodeOpts:c}),await this.client.auth.requests.delete(e,{message:"rejected",code:0}),await this.client.proposal.delete(e,tr("USER_DISCONNECTED"));},this.formatAuthMessage=t=>{this.isInitialized();const{request:e,iss:s}=t;return zf$1(e,s)},this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const e=this.client.core.pairing.pairings.get(t.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(i=>{var r,o;return ((r=i.peerMetadata)==null?void 0:r.url)&&((o=i.peerMetadata)==null?void 0:o.url)===t.peer.metadata.url&&i.topic&&i.topic!==e.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(e){this.client.logger.error(e);}},this.deleteSession=async t=>{const{topic:e,expirerHasDeleted:s=!1,emitEvent:i=!0,id:r=0}=t,{self:o}=this.client.session.get(e);await this.client.core.relayer.unsubscribe(e),await this.client.session.delete(e,tr("USER_DISCONNECTED")),this.addToRecentlyDeleted(e,"session"),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(e)&&await this.client.core.crypto.deleteSymKey(e),s||this.client.core.expirer.del(e),this.client.core.storage.removeItem(_e).catch(a=>this.client.logger.warn(a)),this.getPendingSessionRequests().forEach(a=>{a.topic===e&&this.deletePendingSessionRequest(a.id,tr("USER_DISCONNECTED"));}),i&&this.client.events.emit("session_delete",{id:r,topic:e});},this.deleteProposal=async(t,e)=>{await Promise.all([this.client.proposal.delete(t,tr("USER_DISCONNECTED")),e?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal");},this.deletePendingSessionRequest=async(t,e,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,e),s?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(i=>i.id!==t),s&&(this.sessionRequestQueue.state=D$2.idle,this.client.events.emit("session_request_expire",{id:t}));},this.deletePendingAuthRequest=async(t,e,s=!1)=>{await Promise.all([this.client.auth.requests.delete(t,e),s?Promise.resolve():this.client.core.expirer.del(t)]);},this.setExpiry=async(t,e)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,e),await this.client.session.update(t,{expiry:e}));},this.setProposal=async(t,e)=>{this.client.core.expirer.set(t,d0(f$4.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,e);},this.setAuthRequest=async(t,e)=>{const{request:s,pairingTopic:i}=e;this.client.core.expirer.set(t,s.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:t,pairingTopic:i,verifyContext:s.verifyContext});},this.setPendingSessionRequest=async t=>{const{id:e,topic:s,params:i,verifyContext:r}=t,o=i.request.expiryTimestamp||d0(f$4.wc_sessionRequest.req.ttl);this.client.core.expirer.set(e,o),await this.client.pendingRequest.set(e,{id:e,topic:s,params:i,verifyContext:r});},this.sendRequest=async t=>{const{topic:e,method:s,params:i,expiry:r,relayRpcId:o,clientRpcId:a,throwOnFailedPublish:c}=t,h=formatJsonRpcRequest(s,i,a);if(pr()&&je$1.includes(s)){const d=yu(JSON.stringify(h));this.client.core.verify.register({attestationId:d});}let p;try{p=await this.client.core.crypto.encode(e,h);}catch(d){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${e} failed`),d}const g=f$4[s].req;return r&&(g.ttl=r),o&&(g.id=o),this.client.core.history.set(e,h),c?(g.internal=M$2(y$2({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(e,p,g)):this.client.core.relayer.publish(e,p,g).catch(d=>this.client.logger.error(d)),h.id},this.sendResult=async t=>{const{id:e,topic:s,result:i,throwOnFailedPublish:r,encodeOpts:o}=t,a=formatJsonRpcResult(e,i);let c;try{c=await this.client.core.crypto.encode(s,a,o);}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),g}let h;try{h=await this.client.core.history.get(s,e);}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${e}) failed`),g}const p=f$4[h.request.method].res;r?(p.internal=M$2(y$2({},p.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,c,p)):this.client.core.relayer.publish(s,c,p).catch(g=>this.client.logger.error(g)),await this.client.core.history.resolve(a);},this.sendError=async t=>{const{id:e,topic:s,error:i,encodeOpts:r}=t,o=formatJsonRpcError(e,i);let a;try{a=await this.client.core.crypto.encode(s,o,r);}catch(p){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),p}let c;try{c=await this.client.core.history.get(s,e);}catch(p){throw this.client.logger.error(`sendError() -> history.get(${s}, ${e}) failed`),p}const h=f$4[c.request.method].res;this.client.core.relayer.publish(s,a,h),await this.client.core.history.resolve(o);},this.cleanup=async()=>{const t=[],e=[];this.client.session.getAll().forEach(s=>{let i=!1;p0(s.expiry)&&(i=!0),this.client.core.crypto.keychain.has(s.topic)||(i=!0),i&&t.push(s.topic);}),this.client.proposal.getAll().forEach(s=>{p0(s.expiryTimestamp)&&e.push(s.id);}),await Promise.all([...t.map(s=>this.deleteSession({topic:s})),...e.map(s=>this.deleteProposal(s))]);},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue();},this.processRequestsQueue=async()=>{if(this.requestQueue.state===D$2.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=D$2.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(e=>setTimeout(e,300));}catch(e){this.client.logger.warn(e);}}this.requestQueue.state=D$2.idle;},this.processRequest=t=>{const{topic:e,payload:s}=t,i=s.method;if(!this.shouldIgnorePairingRequest({topic:e,requestMethod:i}))switch(i){case"wc_sessionPropose":return this.onSessionProposeRequest(e,s);case"wc_sessionSettle":return this.onSessionSettleRequest(e,s);case"wc_sessionUpdate":return this.onSessionUpdateRequest(e,s);case"wc_sessionExtend":return this.onSessionExtendRequest(e,s);case"wc_sessionPing":return this.onSessionPingRequest(e,s);case"wc_sessionDelete":return this.onSessionDeleteRequest(e,s);case"wc_sessionRequest":return this.onSessionRequest(e,s);case"wc_sessionEvent":return this.onSessionEventRequest(e,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(e,s);default:return this.client.logger.info(`Unsupported request method ${i}`)}},this.onRelayEventResponse=async t=>{const{topic:e,payload:s}=t,i=(await this.client.core.history.get(e,s.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(e,s);case"wc_sessionSettle":return this.onSessionSettleResponse(e,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(e,s);case"wc_sessionExtend":return this.onSessionExtendResponse(e,s);case"wc_sessionPing":return this.onSessionPingResponse(e,s);case"wc_sessionRequest":return this.onSessionRequestResponse(e,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(e,s);default:return this.client.logger.info(`Unsupported response method ${i}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:e}=t,{message:s}=xe$1("MISSING_OR_INVALID",`Decoded payload on topic ${e} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)},this.shouldIgnorePairingRequest=t=>{const{topic:e,requestMethod:s}=t,i=this.expectedPairingMethodMap.get(e);return !i||i.includes(s)?!1:!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(t,e)=>{const{params:s,id:i}=e;try{this.isValidConnect(y$2({},e.params));const r=s.expiryTimestamp||d0(f$4.wc_sessionPropose.req.ttl),o=y$2({id:i,pairingTopic:t,expiryTimestamp:r},s);await this.setProposal(i,o);const a=yu(JSON.stringify(e)),c=await this.getVerifyContext(a,o.proposer.metadata);this.client.events.emit("session_proposal",{id:i,params:o,verifyContext:c});}catch(r){await this.sendError({id:i,topic:t,error:r}),this.client.logger.error(r);}},this.onSessionProposeResponse=async(t,e)=>{const{id:s}=e;if(isJsonRpcResult(e)){const{result:i}=e;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});const r=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:r});const o=r.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});const a=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});const c=await this.client.core.crypto.generateSharedKey(o,a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});const h=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:t});}else if(isJsonRpcError(e)){await this.client.proposal.delete(s,tr("USER_DISCONNECTED"));const i=v0("session_connect");if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners, 954`);this.events.emit(v0("session_connect"),{error:e.error});}},this.onSessionSettleRequest=async(t,e)=>{const{id:s,params:i}=e;try{this.isValidSessionSettleRequest(i);const{relay:r,controller:o,expiry:a,namespaces:c,sessionProperties:h,pairingTopic:p,sessionConfig:g}=e.params,d=y$2(y$2({topic:t,relay:r,expiry:a,namespaces:c,acknowledged:!0,pairingTopic:p,requiredNamespaces:{},optionalNamespaces:{},controller:o.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},h&&{sessionProperties:h}),g&&{sessionConfig:g});await this.sendResult({id:e.id,topic:t,result:!0,throwOnFailedPublish:!0});const w=v0("session_connect");if(this.events.listenerCount(w)===0)throw new Error(`emitting ${w} without any listeners 997`);this.events.emit(v0("session_connect"),{session:d}),this.cleanupDuplicatePairings(d);}catch(r){await this.sendError({id:s,topic:t,error:r}),this.client.logger.error(r);}},this.onSessionSettleResponse=async(t,e)=>{const{id:s}=e;isJsonRpcResult(e)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(v0("session_approve",s),{})):isJsonRpcError(e)&&(await this.client.session.delete(t,tr("USER_DISCONNECTED")),this.events.emit(v0("session_approve",s),{error:e.error}));},this.onSessionUpdateRequest=async(t,e)=>{const{params:s,id:i}=e;try{const r=`${t}_session_update`,o=lh$1.get(r);if(o&&this.isRequestOutOfSync(o,i)){this.client.logger.info(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:t,error:tr("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(y$2({topic:t},s));try{lh$1.set(r,i),await this.client.session.update(t,{namespaces:s.namespaces}),await this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0});}catch(a){throw lh$1.delete(r),a}this.client.events.emit("session_update",{id:i,topic:t,params:s});}catch(r){await this.sendError({id:i,topic:t,error:r}),this.client.logger.error(r);}},this.isRequestOutOfSync=(t,e)=>parseInt(e.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,e)=>{const{id:s}=e,i=v0("session_update",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);isJsonRpcResult(e)?this.events.emit(v0("session_update",s),{}):isJsonRpcError(e)&&this.events.emit(v0("session_update",s),{error:e.error});},this.onSessionExtendRequest=async(t,e)=>{const{id:s}=e;try{this.isValidExtend({topic:t}),await this.setExpiry(t,d0(L$3)),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:s,topic:t});}catch(i){await this.sendError({id:s,topic:t,error:i}),this.client.logger.error(i);}},this.onSessionExtendResponse=(t,e)=>{const{id:s}=e,i=v0("session_extend",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);isJsonRpcResult(e)?this.events.emit(v0("session_extend",s),{}):isJsonRpcError(e)&&this.events.emit(v0("session_extend",s),{error:e.error});},this.onSessionPingRequest=async(t,e)=>{const{id:s}=e;try{this.isValidPing({topic:t}),await this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:t});}catch(i){await this.sendError({id:s,topic:t,error:i}),this.client.logger.error(i);}},this.onSessionPingResponse=(t,e)=>{const{id:s}=e,i=v0("session_ping",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);setTimeout(()=>{isJsonRpcResult(e)?this.events.emit(v0("session_ping",s),{}):isJsonRpcError(e)&&this.events.emit(v0("session_ping",s),{error:e.error});},500);},this.onSessionDeleteRequest=async(t,e)=>{const{id:s}=e;try{this.isValidDisconnect({topic:t,reason:e.params}),await Promise.all([new Promise(i=>{this.client.core.relayer.once(f$5.publish,async()=>{i(await this.deleteSession({topic:t,id:s}));});}),this.sendResult({id:s,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:tr("USER_DISCONNECTED")})]);}catch(i){this.client.logger.error(i);}},this.onSessionRequest=async(t,e)=>{var s;const{id:i,params:r}=e;try{await this.isValidRequest(y$2({topic:t},r));const o=yu(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",r,i))),a=this.client.session.get(t),c=await this.getVerifyContext(o,a.peer.metadata),h={id:i,topic:t,params:r,verifyContext:c};await this.setPendingSessionRequest(h),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(h):(this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue());}catch(o){await this.sendError({id:i,topic:t,error:o}),this.client.logger.error(o);}},this.onSessionRequestResponse=(t,e)=>{const{id:s}=e,i=v0("session_request",s);if(this.events.listenerCount(i)===0)throw new Error(`emitting ${i} without any listeners`);isJsonRpcResult(e)?this.events.emit(v0("session_request",s),{result:e.result}):isJsonRpcError(e)&&this.events.emit(v0("session_request",s),{error:e.error});},this.onSessionEventRequest=async(t,e)=>{const{id:s,params:i}=e;try{const r=`${t}_session_event_${i.event.name}`,o=lh$1.get(r);if(o&&this.isRequestOutOfSync(o,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(y$2({topic:t},i)),this.client.events.emit("session_event",{id:s,topic:t,params:i}),lh$1.set(r,s);}catch(r){await this.sendError({id:s,topic:t,error:r}),this.client.logger.error(r);}},this.onSessionAuthenticateResponse=(t,e)=>{const{id:s}=e;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:e}),isJsonRpcResult(e)?this.events.emit(v0("session_request",s),{result:e.result}):isJsonRpcError(e)&&this.events.emit(v0("session_request",s),{error:e.error});},this.onSessionAuthenticateRequest=async(t,e)=>{const{requester:s,authPayload:i,expiryTimestamp:r}=e.params,o=yu(JSON.stringify(e)),a=await this.getVerifyContext(o,this.client.metadata),c={requester:s,pairingTopic:t,id:e.id,authPayload:i,verifyContext:a,expiryTimestamp:r};await this.setAuthRequest(e.id,{request:c,pairingTopic:t}),this.client.events.emit("session_authenticate",{topic:t,params:e.params,id:e.id});},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t);},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=D$2.idle,this.processSessionRequestQueue();},cjs$3.toMiliseconds(this.requestQueueDelay));},this.cleanupPendingSentRequestsForTopic=({topic:t,error:e})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(i=>i.topic===t&&i.request.method==="wc_sessionRequest").forEach(i=>{const r=i.request.id,o=v0("session_request",r);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners`);this.events.emit(v0("session_request",i.request.id),{error:e});});},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===D$2.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=D$2.active,this.emitSessionRequest(t);}catch(e){this.client.logger.error(e);}},this.emitSessionRequest=t=>{this.client.events.emit("session_request",t);},this.onPairingCreated=t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const e=this.client.proposal.getAll().find(s=>s.pairingTopic===t.topic);e&&this.onSessionProposeRequest(t.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:e.requiredNamespaces,optionalNamespaces:e.optionalNamespaces,relays:e.relays,proposer:e.proposer,sessionProperties:e.sessionProperties},e.id));},this.isValidConnect=async t=>{if(!$u(t)){const{message:a}=xe$1("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(a)}const{pairingTopic:e,requiredNamespaces:s,optionalNamespaces:i,sessionProperties:r,relays:o}=t;if(Pe$1(e)||await this.isValidPairingTopic(e),!Xu(o)){const{message:a}=xe$1("MISSING_OR_INVALID",`connect() relays: ${o}`);throw new Error(a)}!Pe$1(s)&&Yr(s)!==0&&this.validateNamespaces(s,"requiredNamespaces"),!Pe$1(i)&&Yr(i)!==0&&this.validateNamespaces(i,"optionalNamespaces"),Pe$1(r)||this.validateSessionProps(r,"sessionProperties");},this.validateNamespaces=(t,e)=>{const s=Wu(t,"connect()",e);if(s)throw new Error(s.message)},this.isValidApprove=async t=>{if(!$u(t))throw new Error(xe$1("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:e,namespaces:s,relayProtocol:i,sessionProperties:r}=t;this.checkRecentlyDeleted(e),await this.isValidProposalId(e);const o=this.client.proposal.get(e),a=So(s,"approve()");if(a)throw new Error(a.message);const c=Io(o.requiredNamespaces,s,"approve()");if(c)throw new Error(c.message);if(!Gt$1(i,!0)){const{message:h}=xe$1("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw new Error(h)}Pe$1(r)||this.validateSessionProps(r,"sessionProperties");},this.isValidReject=async t=>{if(!$u(t)){const{message:i}=xe$1("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(i)}const{id:e,reason:s}=t;if(this.checkRecentlyDeleted(e),await this.isValidProposalId(e),!th$1(s)){const{message:i}=xe$1("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(i)}},this.isValidSessionSettleRequest=t=>{if(!$u(t)){const{message:c}=xe$1("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(c)}const{relay:e,controller:s,namespaces:i,expiry:r}=t;if(!No(e)){const{message:c}=xe$1("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}const o=Vu(s,"onSessionSettleRequest()");if(o)throw new Error(o.message);const a=So(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);if(p0(r)){const{message:c}=xe$1("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async t=>{if(!$u(t)){const{message:a}=xe$1("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(a)}const{topic:e,namespaces:s}=t;this.checkRecentlyDeleted(e),await this.isValidSessionTopic(e);const i=this.client.session.get(e),r=So(s,"update()");if(r)throw new Error(r.message);const o=Io(i.requiredNamespaces,s,"update()");if(o)throw new Error(o.message)},this.isValidExtend=async t=>{if(!$u(t)){const{message:s}=xe$1("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(s)}const{topic:e}=t;this.checkRecentlyDeleted(e),await this.isValidSessionTopic(e);},this.isValidRequest=async t=>{if(!$u(t)){const{message:a}=xe$1("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(a)}const{topic:e,request:s,chainId:i,expiry:r}=t;this.checkRecentlyDeleted(e),await this.isValidSessionTopic(e);const{namespaces:o}=this.client.session.get(e);if(!nh$1(o,i)){const{message:a}=xe$1("MISSING_OR_INVALID",`request() chainId: ${i}`);throw new Error(a)}if(!eh$1(s)){const{message:a}=xe$1("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(a)}if(!fh$1(o,i,s.method)){const{message:a}=xe$1("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(a)}if(r&&!uh$1(r,ne$1)){const{message:a}=xe$1("MISSING_OR_INVALID",`request() expiry: ${r}. Expiry must be a number (in seconds) between ${ne$1.min} and ${ne$1.max}`);throw new Error(a)}},this.isValidRespond=async t=>{var e;if(!$u(t)){const{message:r}=xe$1("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(r)}const{topic:s,response:i}=t;try{await this.isValidSessionTopic(s);}catch(r){throw (e=t?.response)!=null&&e.id&&this.cleanupAfterResponse(t),r}if(!rh$1(i)){const{message:r}=xe$1("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(r)}},this.isValidPing=async t=>{if(!$u(t)){const{message:s}=xe$1("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(s)}const{topic:e}=t;await this.isValidSessionOrPairingTopic(e);},this.isValidEmit=async t=>{if(!$u(t)){const{message:o}=xe$1("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(o)}const{topic:e,event:s,chainId:i}=t;await this.isValidSessionTopic(e);const{namespaces:r}=this.client.session.get(e);if(!nh$1(r,i)){const{message:o}=xe$1("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw new Error(o)}if(!ih$1(s)){const{message:o}=xe$1("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(o)}if(!oh$1(r,i,s.name)){const{message:o}=xe$1("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidDisconnect=async t=>{if(!$u(t)){const{message:s}=xe$1("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(s)}const{topic:e}=t;await this.isValidSessionOrPairingTopic(e);},this.isValidAuthenticate=t=>{const{chains:e,uri:s,domain:i,nonce:r}=t;if(!Array.isArray(e)||e.length===0)throw new Error("chains is required and must be a non-empty array");if(!Gt$1(s,!1))throw new Error("uri is required parameter");if(!Gt$1(i,!1))throw new Error("domain is required parameter");if(!Gt$1(r,!1))throw new Error("nonce is required parameter");if([...new Set(e.map(a=>dn(a).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:o}=dn(e[0]);if(o!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(t,e)=>{const s={verified:{verifyUrl:e.verifyUrl||M$3,validation:"UNKNOWN",origin:e.url||""}};try{const i=await this.client.core.verify.resolve({attestationId:t,verifyUrl:e.verifyUrl});i&&(s.verified.origin=i.origin,s.verified.isScam=i.isScam,s.verified.validation=i.origin===new URL(e.url).origin?"VALID":"INVALID");}catch(i){this.client.logger.info(i);}return this.client.logger.info(`Verify context: ${JSON.stringify(s)}`),s},this.validateSessionProps=(t,e)=>{Object.values(t).forEach(s=>{if(!Gt$1(s,!1)){const{message:i}=xe$1("MISSING_OR_INVALID",`${e} must be in Record<string, string> format. Received: ${JSON.stringify(s)}`);throw new Error(i)}});},this.getPendingAuthRequest=t=>{const e=this.client.auth.requests.get(t);return typeof e=="object"?e:void 0},this.addToRecentlyDeleted=(t,e)=>{if(this.recentlyDeletedMap.set(t,e),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const i=this.recentlyDeletedLimit/2;for(const r of this.recentlyDeletedMap.keys()){if(s++>=i)break;this.recentlyDeletedMap.delete(r);}}},this.checkRecentlyDeleted=t=>{const e=this.recentlyDeletedMap.get(t);if(e){const{message:s}=xe$1("MISSING_OR_INVALID",`Record was recently deleted - ${e}: ${t}`);throw new Error(s)}};}async isInitialized(){if(!this.initialized){const{message:n}=xe$1("NOT_INITIALIZED",this.name);throw new Error(n)}await this.client.core.relayer.confirmOnlineStateOrThrow();}registerRelayerEvents(){this.client.core.relayer.on(f$5.message,async n=>{const{topic:t,message:e}=n,{publicKey:s}=this.client.auth.authKeys.keys.includes(J)?this.client.auth.authKeys.get(J):{responseTopic:void 0,publicKey:void 0},i=await this.client.core.crypto.decode(t,e,{receiverPublicKey:s});try{isJsonRpcRequest(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.client.core.history.delete(t,i.id)):this.onRelayEventUnknownPayload({topic:t,payload:i});}catch(r){this.client.logger.error(r);}});}registerExpirerEvents(){this.client.core.expirer.on(C$2.expired,async n=>{const{topic:t,id:e}=l0(n.target);if(e&&this.client.pendingRequest.keys.includes(e))return await this.deletePendingSessionRequest(e,xe$1("EXPIRED"),!0);if(e&&this.client.auth.requests.keys.includes(e))return await this.deletePendingAuthRequest(e,xe$1("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):e&&(await this.deleteProposal(e,!0),this.client.events.emit("proposal_expire",{id:e}));});}registerPairingEvents(){this.client.core.pairing.events.on(q$2.create,n=>this.onPairingCreated(n)),this.client.core.pairing.events.on(q$2.delete,n=>{this.addToRecentlyDeleted(n.topic,"pairing");});}isValidPairingTopic(n){if(!Gt$1(n,!1)){const{message:t}=xe$1("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(n)){const{message:t}=xe$1("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(t)}if(p0(this.client.core.pairing.pairings.get(n).expiry)){const{message:t}=xe$1("EXPIRED",`pairing topic: ${n}`);throw new Error(t)}}async isValidSessionTopic(n){if(!Gt$1(n,!1)){const{message:t}=xe$1("MISSING_OR_INVALID",`session topic should be a string: ${n}`);throw new Error(t)}if(this.checkRecentlyDeleted(n),!this.client.session.keys.includes(n)){const{message:t}=xe$1("NO_MATCHING_KEY",`session topic doesn't exist: ${n}`);throw new Error(t)}if(p0(this.client.session.get(n).expiry)){await this.deleteSession({topic:n});const{message:t}=xe$1("EXPIRED",`session topic: ${n}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(n)){const{message:t}=xe$1("MISSING_OR_INVALID",`session topic does not exist in keychain: ${n}`);throw await this.deleteSession({topic:n}),new Error(t)}}async isValidSessionOrPairingTopic(n){if(this.checkRecentlyDeleted(n),this.client.session.keys.includes(n))await this.isValidSessionTopic(n);else if(this.client.core.pairing.pairings.keys.includes(n))this.isValidPairingTopic(n);else if(Gt$1(n,!1)){const{message:t}=xe$1("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${n}`);throw new Error(t)}else {const{message:t}=xe$1("MISSING_OR_INVALID",`session or pairing topic should be a string: ${n}`);throw new Error(t)}}async isValidProposalId(n){if(!Zu(n)){const{message:t}=xe$1("MISSING_OR_INVALID",`proposal id should be a number: ${n}`);throw new Error(t)}if(!this.client.proposal.keys.includes(n)){const{message:t}=xe$1("NO_MATCHING_KEY",`proposal id doesn't exist: ${n}`);throw new Error(t)}if(p0(this.client.proposal.get(n).expiryTimestamp)){await this.deleteProposal(n);const{message:t}=xe$1("EXPIRED",`proposal id: ${n}`);throw new Error(t)}}}class es extends Kt{constructor(n,t){super(n,t,Ue$1,ie$1),this.core=n,this.logger=t;}}let Ze$1 = class Ze extends Kt{constructor(n,t){super(n,t,ke$1,ie$1),this.core=n,this.logger=t;}};class ts extends Kt{constructor(n,t){super(n,t,Qe$1,ie$1,e=>e.id),this.core=n,this.logger=t;}}class ss extends Kt{constructor(n,t){super(n,t,Ye$1,X$1,()=>J),this.core=n,this.logger=t;}}class is extends Kt{constructor(n,t){super(n,t,Xe$1,X$1),this.core=n,this.logger=t;}}class rs extends Kt{constructor(n,t){super(n,t,Je$1,X$1,e=>e.id),this.core=n,this.logger=t;}}class ns{constructor(n,t){this.core=n,this.logger=t,this.authKeys=new ss(this.core,this.logger),this.pairingTopics=new is(this.core,this.logger),this.requests=new rs(this.core,this.logger);}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init();}}let oe$1 = class oe extends b$2{constructor(n){super(n),this.protocol=Re$1,this.version=Ee$1,this.name=re$1.name,this.events=new EventEmitter$2,this.on=(e,s)=>this.events.on(e,s),this.once=(e,s)=>this.events.once(e,s),this.off=(e,s)=>this.events.off(e,s),this.removeListener=(e,s)=>this.events.removeListener(e,s),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(s){throw this.logger.error(s.message),s}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(s){throw this.logger.error(s.message),s}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(s){throw this.logger.error(s.message),s}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(s){throw this.logger.error(s.message),s}},this.update=async e=>{try{return await this.engine.update(e)}catch(s){throw this.logger.error(s.message),s}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(s){throw this.logger.error(s.message),s}},this.request=async e=>{try{return await this.engine.request(e)}catch(s){throw this.logger.error(s.message),s}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(s){throw this.logger.error(s.message),s}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(s){throw this.logger.error(s.message),s}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(s){throw this.logger.error(s.message),s}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(s){throw this.logger.error(s.message),s}},this.find=e=>{try{return this.engine.find(e)}catch(s){throw this.logger.error(s.message),s}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}},this.authenticate=async e=>{try{return await this.engine.authenticate(e)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(s){throw this.logger.error(s.message),s}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(s){throw this.logger.error(s.message),s}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(s){throw this.logger.error(s.message),s}},this.name=n?.name||re$1.name,this.metadata=n?.metadata||Xo(),this.signConfig=n?.signConfig;const t=typeof n?.logger<"u"&&typeof n?.logger!="string"?n.logger:Hg$1(k$1({level:n?.logger||re$1.logger}));this.core=n?.core||new Br(n),this.logger=E$5(t,this.name),this.session=new Ze$1(this.core,this.logger),this.proposal=new es(this.core,this.logger),this.pendingRequest=new ts(this.core,this.logger),this.engine=new Zt(this),this.auth=new ns(this.core,this.logger);}static async init(n){const t=new oe(n);return await t.initialize(),t}get context(){return y$5(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.engine.init(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success");}catch(n){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(n.message),n}}};
|
|
79809
79809
|
|
|
@@ -81303,7 +81303,7 @@ function serialize$1 (children, callback) {
|
|
|
81303
81303
|
* @param {function} callback
|
|
81304
81304
|
* @return {string}
|
|
81305
81305
|
*/
|
|
81306
|
-
function stringify$
|
|
81306
|
+
function stringify$2 (element, index, children, callback) {
|
|
81307
81307
|
switch (element.type) {
|
|
81308
81308
|
case LAYER$1: if (element.children.length) break
|
|
81309
81309
|
case IMPORT$1: case DECLARATION$1: return element.return = element.return || element.value
|
|
@@ -81759,7 +81759,7 @@ var createCache$1 = function createCache(options) {
|
|
|
81759
81759
|
|
|
81760
81760
|
{
|
|
81761
81761
|
var currentSheet;
|
|
81762
|
-
var finalizingPlugins = [stringify$
|
|
81762
|
+
var finalizingPlugins = [stringify$2, rulesheet$1(function (rule) {
|
|
81763
81763
|
currentSheet.insert(rule);
|
|
81764
81764
|
})];
|
|
81765
81765
|
var serializer = middleware$1(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
@@ -86165,7 +86165,7 @@ var Analytics = /** @class */ (function (_super) {
|
|
|
86165
86165
|
return __generator(this, function (_b) {
|
|
86166
86166
|
switch (_b.label) {
|
|
86167
86167
|
case 0: return [4 /*yield*/, import(
|
|
86168
|
-
/* webpackChunkName: "auto-track" */ './auto-track-
|
|
86168
|
+
/* webpackChunkName: "auto-track" */ './auto-track-ukaXGHw5.js')];
|
|
86169
86169
|
case 1:
|
|
86170
86170
|
autotrack = _b.sent();
|
|
86171
86171
|
return [2 /*return*/, (_a = autotrack.link).call.apply(_a, __spreadArray$1([this], args, false))];
|
|
@@ -86184,7 +86184,7 @@ var Analytics = /** @class */ (function (_super) {
|
|
|
86184
86184
|
return __generator(this, function (_b) {
|
|
86185
86185
|
switch (_b.label) {
|
|
86186
86186
|
case 0: return [4 /*yield*/, import(
|
|
86187
|
-
/* webpackChunkName: "auto-track" */ './auto-track-
|
|
86187
|
+
/* webpackChunkName: "auto-track" */ './auto-track-ukaXGHw5.js')];
|
|
86188
86188
|
case 1:
|
|
86189
86189
|
autotrack = _b.sent();
|
|
86190
86190
|
return [2 /*return*/, (_a = autotrack.link).call.apply(_a, __spreadArray$1([this], args, false))];
|
|
@@ -86203,7 +86203,7 @@ var Analytics = /** @class */ (function (_super) {
|
|
|
86203
86203
|
return __generator(this, function (_b) {
|
|
86204
86204
|
switch (_b.label) {
|
|
86205
86205
|
case 0: return [4 /*yield*/, import(
|
|
86206
|
-
/* webpackChunkName: "auto-track" */ './auto-track-
|
|
86206
|
+
/* webpackChunkName: "auto-track" */ './auto-track-ukaXGHw5.js')];
|
|
86207
86207
|
case 1:
|
|
86208
86208
|
autotrack = _b.sent();
|
|
86209
86209
|
return [2 /*return*/, (_a = autotrack.form).call.apply(_a, __spreadArray$1([this], args, false))];
|
|
@@ -86222,7 +86222,7 @@ var Analytics = /** @class */ (function (_super) {
|
|
|
86222
86222
|
return __generator(this, function (_b) {
|
|
86223
86223
|
switch (_b.label) {
|
|
86224
86224
|
case 0: return [4 /*yield*/, import(
|
|
86225
|
-
/* webpackChunkName: "auto-track" */ './auto-track-
|
|
86225
|
+
/* webpackChunkName: "auto-track" */ './auto-track-ukaXGHw5.js')];
|
|
86226
86226
|
case 1:
|
|
86227
86227
|
autotrack = _b.sent();
|
|
86228
86228
|
return [2 /*return*/, (_a = autotrack.form).call.apply(_a, __spreadArray$1([this], args, false))];
|
|
@@ -86372,7 +86372,7 @@ var Analytics = /** @class */ (function (_super) {
|
|
|
86372
86372
|
return [2 /*return*/, []];
|
|
86373
86373
|
}
|
|
86374
86374
|
return [4 /*yield*/, import(
|
|
86375
|
-
/* webpackChunkName: "queryString" */ './index-
|
|
86375
|
+
/* webpackChunkName: "queryString" */ './index-C5Pj3wdV.js')];
|
|
86376
86376
|
case 1:
|
|
86377
86377
|
queryString = (_a.sent()).queryString;
|
|
86378
86378
|
return [2 /*return*/, queryString(this, query)];
|
|
@@ -87530,12 +87530,12 @@ function Identify(dictionary, opts) {
|
|
|
87530
87530
|
}
|
|
87531
87531
|
identify.Identify = Identify;
|
|
87532
87532
|
inherits_1$4.default(Identify, facade_1$3.Facade);
|
|
87533
|
-
var i$
|
|
87534
|
-
i$
|
|
87533
|
+
var i$1 = Identify.prototype;
|
|
87534
|
+
i$1.action = function () {
|
|
87535
87535
|
return "identify";
|
|
87536
87536
|
};
|
|
87537
|
-
i$
|
|
87538
|
-
i$
|
|
87537
|
+
i$1.type = i$1.action;
|
|
87538
|
+
i$1.traits = function (aliases) {
|
|
87539
87539
|
var ret = this.field("traits") || {};
|
|
87540
87540
|
var id = this.userId();
|
|
87541
87541
|
aliases = aliases || {};
|
|
@@ -87551,7 +87551,7 @@ i$2.traits = function (aliases) {
|
|
|
87551
87551
|
}
|
|
87552
87552
|
return ret;
|
|
87553
87553
|
};
|
|
87554
|
-
i$
|
|
87554
|
+
i$1.email = function () {
|
|
87555
87555
|
var email = this.proxy("traits.email");
|
|
87556
87556
|
if (email)
|
|
87557
87557
|
return email;
|
|
@@ -87559,22 +87559,22 @@ i$2.email = function () {
|
|
|
87559
87559
|
if (is_email_1$2.default(userId))
|
|
87560
87560
|
return userId;
|
|
87561
87561
|
};
|
|
87562
|
-
i$
|
|
87562
|
+
i$1.created = function () {
|
|
87563
87563
|
var created = this.proxy("traits.created") || this.proxy("traits.createdAt");
|
|
87564
87564
|
if (created)
|
|
87565
87565
|
return new_date_1.default(created);
|
|
87566
87566
|
};
|
|
87567
|
-
i$
|
|
87567
|
+
i$1.companyCreated = function () {
|
|
87568
87568
|
var created = this.proxy("traits.company.created") ||
|
|
87569
87569
|
this.proxy("traits.company.createdAt");
|
|
87570
87570
|
if (created) {
|
|
87571
87571
|
return new_date_1.default(created);
|
|
87572
87572
|
}
|
|
87573
87573
|
};
|
|
87574
|
-
i$
|
|
87574
|
+
i$1.companyName = function () {
|
|
87575
87575
|
return this.proxy("traits.company.name");
|
|
87576
87576
|
};
|
|
87577
|
-
i$
|
|
87577
|
+
i$1.name = function () {
|
|
87578
87578
|
var name = this.proxy("traits.name");
|
|
87579
87579
|
if (typeof name === "string") {
|
|
87580
87580
|
return trim$2(name);
|
|
@@ -87585,7 +87585,7 @@ i$2.name = function () {
|
|
|
87585
87585
|
return trim$2(firstName + " " + lastName);
|
|
87586
87586
|
}
|
|
87587
87587
|
};
|
|
87588
|
-
i$
|
|
87588
|
+
i$1.firstName = function () {
|
|
87589
87589
|
var firstName = this.proxy("traits.firstName");
|
|
87590
87590
|
if (typeof firstName === "string") {
|
|
87591
87591
|
return trim$2(firstName);
|
|
@@ -87595,7 +87595,7 @@ i$2.firstName = function () {
|
|
|
87595
87595
|
return trim$2(name).split(" ")[0];
|
|
87596
87596
|
}
|
|
87597
87597
|
};
|
|
87598
|
-
i$
|
|
87598
|
+
i$1.lastName = function () {
|
|
87599
87599
|
var lastName = this.proxy("traits.lastName");
|
|
87600
87600
|
if (typeof lastName === "string") {
|
|
87601
87601
|
return trim$2(lastName);
|
|
@@ -87610,13 +87610,13 @@ i$2.lastName = function () {
|
|
|
87610
87610
|
}
|
|
87611
87611
|
return trim$2(name.substr(space + 1));
|
|
87612
87612
|
};
|
|
87613
|
-
i$
|
|
87613
|
+
i$1.uid = function () {
|
|
87614
87614
|
return this.userId() || this.username() || this.email();
|
|
87615
87615
|
};
|
|
87616
|
-
i$
|
|
87616
|
+
i$1.description = function () {
|
|
87617
87617
|
return this.proxy("traits.description") || this.proxy("traits.background");
|
|
87618
87618
|
};
|
|
87619
|
-
i$
|
|
87619
|
+
i$1.age = function () {
|
|
87620
87620
|
var date = this.birthday();
|
|
87621
87621
|
var age = obj_case_1$1.default(this.traits(), "age");
|
|
87622
87622
|
if (age != null)
|
|
@@ -87626,22 +87626,22 @@ i$2.age = function () {
|
|
|
87626
87626
|
var now = new Date();
|
|
87627
87627
|
return now.getFullYear() - date.getFullYear();
|
|
87628
87628
|
};
|
|
87629
|
-
i$
|
|
87629
|
+
i$1.avatar = function () {
|
|
87630
87630
|
var traits = this.traits();
|
|
87631
87631
|
return (obj_case_1$1.default(traits, "avatar") || obj_case_1$1.default(traits, "photoUrl") || obj_case_1$1.default(traits, "avatarUrl"));
|
|
87632
87632
|
};
|
|
87633
|
-
i$
|
|
87633
|
+
i$1.position = function () {
|
|
87634
87634
|
var traits = this.traits();
|
|
87635
87635
|
return obj_case_1$1.default(traits, "position") || obj_case_1$1.default(traits, "jobTitle");
|
|
87636
87636
|
};
|
|
87637
|
-
i$
|
|
87638
|
-
i$
|
|
87639
|
-
i$
|
|
87640
|
-
i$
|
|
87641
|
-
i$
|
|
87642
|
-
i$
|
|
87643
|
-
i$
|
|
87644
|
-
i$
|
|
87637
|
+
i$1.username = facade_1$3.Facade.proxy("traits.username");
|
|
87638
|
+
i$1.website = facade_1$3.Facade.one("traits.website");
|
|
87639
|
+
i$1.websites = facade_1$3.Facade.multi("traits.website");
|
|
87640
|
+
i$1.phone = facade_1$3.Facade.one("traits.phone");
|
|
87641
|
+
i$1.phones = facade_1$3.Facade.multi("traits.phone");
|
|
87642
|
+
i$1.address = facade_1$3.Facade.proxy("traits.address");
|
|
87643
|
+
i$1.gender = facade_1$3.Facade.proxy("traits.gender");
|
|
87644
|
+
i$1.birthday = facade_1$3.Facade.proxy("traits.birthday");
|
|
87645
87645
|
|
|
87646
87646
|
var track = {};
|
|
87647
87647
|
|
|
@@ -88225,7 +88225,7 @@ var ActionDestination = /** @class */ (function () {
|
|
|
88225
88225
|
};
|
|
88226
88226
|
return ActionDestination;
|
|
88227
88227
|
}());
|
|
88228
|
-
function validate$
|
|
88228
|
+
function validate$1(pluginLike) {
|
|
88229
88229
|
if (!Array.isArray(pluginLike)) {
|
|
88230
88230
|
throw new Error('Not a valid list of plugins');
|
|
88231
88231
|
}
|
|
@@ -88311,7 +88311,7 @@ function remoteLoader(settings, userIntegrations, mergedIntegrations, obfuscate,
|
|
|
88311
88311
|
case 10:
|
|
88312
88312
|
plugin = _a.sent();
|
|
88313
88313
|
plugins = Array.isArray(plugin) ? plugin : [plugin];
|
|
88314
|
-
validate$
|
|
88314
|
+
validate$1(plugins);
|
|
88315
88315
|
routing_1 = routingRules.filter(function (rule) { return rule.destinationName === remotePlugin.creationName; });
|
|
88316
88316
|
plugins.forEach(function (plugin) {
|
|
88317
88317
|
var wrapper = new ActionDestination(remotePlugin.creationName, plugin);
|
|
@@ -88704,7 +88704,7 @@ function segmentio(analytics, settings, integrations) {
|
|
|
88704
88704
|
});
|
|
88705
88705
|
}
|
|
88706
88706
|
|
|
88707
|
-
function validate
|
|
88707
|
+
function validate(ctx) {
|
|
88708
88708
|
var _a;
|
|
88709
88709
|
var event = ctx.event;
|
|
88710
88710
|
assertEventExists(event);
|
|
@@ -88725,12 +88725,12 @@ var validation = {
|
|
|
88725
88725
|
version: '1.0.0',
|
|
88726
88726
|
isLoaded: function () { return true; },
|
|
88727
88727
|
load: function () { return Promise.resolve(); },
|
|
88728
|
-
track: validate
|
|
88729
|
-
identify: validate
|
|
88730
|
-
page: validate
|
|
88731
|
-
alias: validate
|
|
88732
|
-
group: validate
|
|
88733
|
-
screen: validate
|
|
88728
|
+
track: validate,
|
|
88729
|
+
identify: validate,
|
|
88730
|
+
page: validate,
|
|
88731
|
+
alias: validate,
|
|
88732
|
+
group: validate,
|
|
88733
|
+
screen: validate,
|
|
88734
88734
|
};
|
|
88735
88735
|
|
|
88736
88736
|
/**
|
|
@@ -89076,7 +89076,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
|
|
|
89076
89076
|
case 0:
|
|
89077
89077
|
if (!hasTsubMiddleware(legacySettings)) return [3 /*break*/, 2];
|
|
89078
89078
|
return [4 /*yield*/, import(
|
|
89079
|
-
/* webpackChunkName: "tsub-middleware" */ './index-
|
|
89079
|
+
/* webpackChunkName: "tsub-middleware" */ './index-DAogBkn2.js').then(function (mod) {
|
|
89080
89080
|
return mod.tsubMiddleware(legacySettings.middlewareSettings.routingRules);
|
|
89081
89081
|
})];
|
|
89082
89082
|
case 1:
|
|
@@ -89089,7 +89089,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
|
|
|
89089
89089
|
tsubMiddleware = _d;
|
|
89090
89090
|
if (!(hasLegacyDestinations(legacySettings) || legacyIntegrationSources.length > 0)) return [3 /*break*/, 5];
|
|
89091
89091
|
return [4 /*yield*/, import(
|
|
89092
|
-
/* webpackChunkName: "ajs-destination" */ './index-
|
|
89092
|
+
/* webpackChunkName: "ajs-destination" */ './index-CDDRCw9i.js').then(function (mod) {
|
|
89093
89093
|
return mod.ajsDestinations(writeKey, legacySettings, analytics.integrations, opts, tsubMiddleware, legacyIntegrationSources);
|
|
89094
89094
|
})];
|
|
89095
89095
|
case 4:
|
|
@@ -89102,7 +89102,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
|
|
|
89102
89102
|
legacyDestinations = _e;
|
|
89103
89103
|
if (!legacySettings.legacyVideoPluginsEnabled) return [3 /*break*/, 8];
|
|
89104
89104
|
return [4 /*yield*/, import(
|
|
89105
|
-
/* webpackChunkName: "legacyVideos" */ './index-
|
|
89105
|
+
/* webpackChunkName: "legacyVideos" */ './index-hY8dPZlc.js').then(function (mod) {
|
|
89106
89106
|
return mod.loadLegacyVideoPlugins(analytics);
|
|
89107
89107
|
})];
|
|
89108
89108
|
case 7:
|
|
@@ -89111,7 +89111,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
|
|
|
89111
89111
|
case 8:
|
|
89112
89112
|
if (!((_a = opts.plan) === null || _a === void 0 ? void 0 : _a.track)) return [3 /*break*/, 10];
|
|
89113
89113
|
return [4 /*yield*/, import(
|
|
89114
|
-
/* webpackChunkName: "schemaFilter" */ './index-
|
|
89114
|
+
/* webpackChunkName: "schemaFilter" */ './index-DYIvEBsg.js').then(function (mod) {
|
|
89115
89115
|
var _a;
|
|
89116
89116
|
return mod.schemaFilter((_a = opts.plan) === null || _a === void 0 ? void 0 : _a.track, legacySettings);
|
|
89117
89117
|
})];
|
|
@@ -89150,7 +89150,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
|
|
|
89150
89150
|
return enabled;
|
|
89151
89151
|
})) return [3 /*break*/, 17];
|
|
89152
89152
|
return [4 /*yield*/, import(
|
|
89153
|
-
/* webpackChunkName: "remoteMiddleware" */ './index-
|
|
89153
|
+
/* webpackChunkName: "remoteMiddleware" */ './index-DZMMWbSK.js').then(function (_a) {
|
|
89154
89154
|
var remoteMiddlewares = _a.remoteMiddlewares;
|
|
89155
89155
|
return __awaiter$5(_this, void 0, void 0, function () {
|
|
89156
89156
|
var middleware, promises;
|
|
@@ -90043,7 +90043,7 @@ function serialize(children, callback) {
|
|
|
90043
90043
|
output += callback(children[i], i, children, callback) || "";
|
|
90044
90044
|
return output;
|
|
90045
90045
|
}
|
|
90046
|
-
function stringify$
|
|
90046
|
+
function stringify$1(element, index, children, callback) {
|
|
90047
90047
|
switch (element.type) {
|
|
90048
90048
|
case LAYER:
|
|
90049
90049
|
if (element.children.length) break;
|
|
@@ -90410,7 +90410,7 @@ var createCache = function createCache2(options) {
|
|
|
90410
90410
|
var omnipresentPlugins = [compat, removeLabel];
|
|
90411
90411
|
if (!getServerStylisCache) {
|
|
90412
90412
|
var currentSheet;
|
|
90413
|
-
var finalizingPlugins = [stringify$
|
|
90413
|
+
var finalizingPlugins = [stringify$1, rulesheet(function(rule) {
|
|
90414
90414
|
currentSheet.insert(rule);
|
|
90415
90415
|
})];
|
|
90416
90416
|
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
@@ -90425,7 +90425,7 @@ var createCache = function createCache2(options) {
|
|
|
90425
90425
|
}
|
|
90426
90426
|
};
|
|
90427
90427
|
} else {
|
|
90428
|
-
var _finalizingPlugins = [stringify$
|
|
90428
|
+
var _finalizingPlugins = [stringify$1];
|
|
90429
90429
|
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
|
90430
90430
|
var _stylis = function _stylis2(styles) {
|
|
90431
90431
|
return serialize(compile(styles), _serializer);
|
|
@@ -132420,7 +132420,7 @@ function toCmcdQuery(cmcd, options = {}) {
|
|
|
132420
132420
|
return `${CMCD_PARAM}=${encodeURIComponent(params)}`;
|
|
132421
132421
|
}
|
|
132422
132422
|
|
|
132423
|
-
const REGEX
|
|
132423
|
+
const REGEX = /CMCD=[^&#]+/;
|
|
132424
132424
|
/**
|
|
132425
132425
|
* Append CMCD query args to a URL.
|
|
132426
132426
|
*
|
|
@@ -132441,8 +132441,8 @@ function appendCmcdQuery(url, cmcd, options) {
|
|
|
132441
132441
|
if (!query) {
|
|
132442
132442
|
return url;
|
|
132443
132443
|
}
|
|
132444
|
-
if (REGEX
|
|
132445
|
-
return url.replace(REGEX
|
|
132444
|
+
if (REGEX.test(url)) {
|
|
132445
|
+
return url.replace(REGEX, query);
|
|
132446
132446
|
}
|
|
132447
132447
|
const separator = url.includes('?') ? '&' : '?';
|
|
132448
132448
|
return `${url}${separator}${query}`;
|
|
@@ -172806,7 +172806,7 @@ const useProvidersContext = () => {
|
|
|
172806
172806
|
return context;
|
|
172807
172807
|
};
|
|
172808
172808
|
|
|
172809
|
-
const AddTokensWidget = React.lazy(() => import('./AddTokensWidget-
|
|
172809
|
+
const AddTokensWidget = React.lazy(() => import('./AddTokensWidget-CoYtaqbo.js'));
|
|
172810
172810
|
class AddTokens extends Base$3 {
|
|
172811
172811
|
eventTopic = ro$1.IMTBL_ADD_TOKENS_WIDGET_EVENT;
|
|
172812
172812
|
getValidatedProperties({ config, }) {
|
|
@@ -172850,7 +172850,7 @@ class AddTokens extends Base$3 {
|
|
|
172850
172850
|
}
|
|
172851
172851
|
}
|
|
172852
172852
|
|
|
172853
|
-
const BridgeWidget = React.lazy(() => import('./BridgeWidget-
|
|
172853
|
+
const BridgeWidget = React.lazy(() => import('./BridgeWidget-DHbT5v9l.js').then(function (n) { return n.a; }));
|
|
172854
172854
|
class Bridge extends Base$3 {
|
|
172855
172855
|
eventTopic = ro$1.IMTBL_BRIDGE_WIDGET_EVENT;
|
|
172856
172856
|
getValidatedProperties({ config }) {
|
|
@@ -172993,7 +172993,7 @@ const commerceFlows = [
|
|
|
172993
172993
|
Ao$1.TRANSFER,
|
|
172994
172994
|
];
|
|
172995
172995
|
|
|
172996
|
-
const CommerceWidget = React.lazy(() => import('./CommerceWidget-
|
|
172996
|
+
const CommerceWidget = React.lazy(() => import('./CommerceWidget-ko2GnLnO.js'));
|
|
172997
172997
|
class CommerceWidgetRoot extends Base$3 {
|
|
172998
172998
|
eventTopic = ro$1.IMTBL_COMMERCE_WIDGET_EVENT;
|
|
172999
172999
|
getValidatedProperties({ config, }) {
|
|
@@ -175246,7 +175246,7 @@ const orchestrationEvents = {
|
|
|
175246
175246
|
sendRequestAddTokensEvent,
|
|
175247
175247
|
};
|
|
175248
175248
|
|
|
175249
|
-
const OnRampWidget = React.lazy(() => import('./OnRampWidget-
|
|
175249
|
+
const OnRampWidget = React.lazy(() => import('./OnRampWidget-Dpe4tZoY.js'));
|
|
175250
175250
|
class OnRamp extends Base$3 {
|
|
175251
175251
|
eventTopic = ro$1.IMTBL_ONRAMP_WIDGET_EVENT;
|
|
175252
175252
|
getValidatedProperties({ config }) {
|
|
@@ -175385,7 +175385,7 @@ const sendSalePaymentTokenEvent = (eventTarget, details) => {
|
|
|
175385
175385
|
eventTarget.dispatchEvent(event);
|
|
175386
175386
|
};
|
|
175387
175387
|
|
|
175388
|
-
const SaleWidget = React.lazy(() => import('./SaleWidget-
|
|
175388
|
+
const SaleWidget = React.lazy(() => import('./SaleWidget-OurkfekH.js'));
|
|
175389
175389
|
class Sale extends Base$3 {
|
|
175390
175390
|
eventTopic = ro$1.IMTBL_SALE_WIDGET_EVENT;
|
|
175391
175391
|
// TODO: add specific validation logic for the sale items
|
|
@@ -175536,7 +175536,7 @@ const sendSwapRejectedEvent = (eventTarget, reason) => {
|
|
|
175536
175536
|
eventTarget.dispatchEvent(rejectedEvent);
|
|
175537
175537
|
};
|
|
175538
175538
|
|
|
175539
|
-
const SwapWidget = React.lazy(() => import('./SwapWidget-
|
|
175539
|
+
const SwapWidget = React.lazy(() => import('./SwapWidget-DdYAKFbP.js').then(function (n) { return n.b; }));
|
|
175540
175540
|
class Swap extends Base$3 {
|
|
175541
175541
|
eventTopic = ro$1.IMTBL_SWAP_WIDGET_EVENT;
|
|
175542
175542
|
getValidatedProperties({ config }) {
|
|
@@ -175643,7 +175643,7 @@ function sendDisconnectWalletEvent(eventTarget) {
|
|
|
175643
175643
|
eventTarget.dispatchEvent(disconnectWalletEvent);
|
|
175644
175644
|
}
|
|
175645
175645
|
|
|
175646
|
-
const WalletWidget = React.lazy(() => import('./WalletWidget-
|
|
175646
|
+
const WalletWidget = React.lazy(() => import('./WalletWidget-DIKU4h19.js'));
|
|
175647
175647
|
class Wallet extends Base$3 {
|
|
175648
175648
|
eventTopic = ro$1.IMTBL_WALLET_WIDGET_EVENT;
|
|
175649
175649
|
getValidatedProperties({ config }) {
|
|
@@ -175704,14 +175704,13 @@ class Wallet extends Base$3 {
|
|
|
175704
175704
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
175705
175705
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
175706
175706
|
// generators (like Math.random()).
|
|
175707
|
-
|
|
175708
|
-
|
|
175707
|
+
let getRandomValues;
|
|
175708
|
+
const rnds8 = new Uint8Array(16);
|
|
175709
175709
|
function rng() {
|
|
175710
175710
|
// lazy load so that environments that need to polyfill have a chance to do so
|
|
175711
175711
|
if (!getRandomValues) {
|
|
175712
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
175713
|
-
|
|
175714
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
175712
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
175713
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
175715
175714
|
|
|
175716
175715
|
if (!getRandomValues) {
|
|
175717
175716
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
@@ -175721,48 +175720,40 @@ function rng() {
|
|
|
175721
175720
|
return getRandomValues(rnds8);
|
|
175722
175721
|
}
|
|
175723
175722
|
|
|
175724
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
175725
|
-
|
|
175726
|
-
function validate(uuid) {
|
|
175727
|
-
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
175728
|
-
}
|
|
175729
|
-
|
|
175730
175723
|
/**
|
|
175731
175724
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
175732
175725
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
175733
175726
|
*/
|
|
175734
175727
|
|
|
175735
|
-
|
|
175728
|
+
const byteToHex = [];
|
|
175736
175729
|
|
|
175737
|
-
for (
|
|
175738
|
-
byteToHex.push((i
|
|
175730
|
+
for (let i = 0; i < 256; ++i) {
|
|
175731
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
175739
175732
|
}
|
|
175740
175733
|
|
|
175741
|
-
function
|
|
175742
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
175734
|
+
function unsafeStringify(arr, offset = 0) {
|
|
175743
175735
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
175744
175736
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
175745
|
-
|
|
175746
|
-
// of the following:
|
|
175747
|
-
// - One or more input array values don't map to a hex octet (leading to
|
|
175748
|
-
// "undefined" in the uuid)
|
|
175749
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
|
175750
|
-
|
|
175751
|
-
if (!validate(uuid)) {
|
|
175752
|
-
throw TypeError('Stringified UUID is invalid');
|
|
175753
|
-
}
|
|
175754
|
-
|
|
175755
|
-
return uuid;
|
|
175737
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
175756
175738
|
}
|
|
175757
175739
|
|
|
175740
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
175741
|
+
var native = {
|
|
175742
|
+
randomUUID
|
|
175743
|
+
};
|
|
175744
|
+
|
|
175758
175745
|
function v4(options, buf, offset) {
|
|
175746
|
+
if (native.randomUUID && !buf && !options) {
|
|
175747
|
+
return native.randomUUID();
|
|
175748
|
+
}
|
|
175749
|
+
|
|
175759
175750
|
options = options || {};
|
|
175760
|
-
|
|
175751
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
175761
175752
|
|
|
175762
175753
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
175763
175754
|
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
175764
175755
|
|
|
175765
|
-
return
|
|
175756
|
+
return unsafeStringify(rnds);
|
|
175766
175757
|
}
|
|
175767
175758
|
|
|
175768
175759
|
const initialPurchaseState = {
|